Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rocmPackages_6: init at 6.0.2(?) #289187

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b38a8be
rocmPackages: Copying rocm5 into rocm6 to start an upgrade.
ScatteredRay Feb 10, 2024
39a1805
rocmPackages: Updating some additional older references.
ScatteredRay Feb 10, 2024
606f664
rocmPackages: Updating versions and hashes.
ScatteredRay Feb 13, 2024
7fbe125
rocmPackages: Fixes for ROCm 6 rocm-runtime and clr
ScatteredRay Feb 14, 2024
8677426
rocmPackages: Mark ROCm 6 modules as not-broken, retain mark if they …
ScatteredRay Feb 14, 2024
7dd58a7
rocmPackages: Fixing ROCm 6 rocprofiler, roctracer and hipify.
ScatteredRay Feb 16, 2024
44640ba
rocmPackages: update source for rocm-docs-core
mschwaig Feb 10, 2024
8b6d7e6
rocmPackages: deprecate miopengemm
mschwaig Feb 10, 2024
8f3608b
rocmPackages: add git to composable_kernel build
mschwaig Feb 10, 2024
5061892
rocmPackages: fix rocmlir build
mschwaig Feb 11, 2024
bb19da4
rocmPackages: fix MIOpen build
mschwaig Feb 11, 2024
d55c19a
rocmPackages: set GPU_TARGETS for migraphx
mschwaig Feb 11, 2024
9b6376d
rocmPackages: fix rccl build by adding version info to clr output
mschwaig Feb 14, 2024
da8d70d
rocmPackages: skip building composable_kernel profiler for now
mschwaig Feb 15, 2024
5bb3c36
rocmPackages: manually update a few packages
mschwaig Feb 9, 2024
b754964
rocmPackages: Updating source hash for migraphx, rccl, rdc, and rocal…
ScatteredRay Feb 16, 2024
4b24fb9
rocmPackages: Fixing broken predicate for tensile.
ScatteredRay Feb 16, 2024
2d79bff
rocmPackages: fix rocmlir build (e2e test generation)
mschwaig Mar 2, 2024
f018aa2
rocmPackages: remove miopen-opencl since its deprecated
mschwaig Mar 3, 2024
99ab715
rocmPackages: update deprecation notice of miopengemm
mschwaig Mar 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions pkgs/development/rocm-modules/6/clang-ocl/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{ lib
, stdenv
, fetchFromGitHub
, rocmUpdateScript
, cmake
, rocm-cmake
, rocm-device-libs
}:

stdenv.mkDerivation (finalAttrs: {
pname = "clang-ocl";
version = "6.0.2";

src = fetchFromGitHub {
owner = "ROCm";
repo = "clang-ocl";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-uMSvcVJj+me2E+7FsXZ4l4hTcK6uKEegXpkHGcuist0=";
};

nativeBuildInputs = [
cmake
rocm-cmake
];

buildInputs = [ rocm-device-libs ];

passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};

meta = with lib; {
description = "OpenCL compilation with clang compiler";
homepage = "https://github.com/ROCm/clang-ocl";
license = with licenses; [ mit ];
maintainers = teams.rocm.members;
platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version || versionAtLeast finalAttrs.version "7.0.0";
};
})
175 changes: 175 additions & 0 deletions pkgs/development/rocm-modules/6/clr/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
{ lib
, stdenv
, callPackage
, fetchFromGitHub
, rocmUpdateScript
, makeWrapper
, cmake
, perl
, clang
, hip-common
, hipcc
, rocm-device-libs
, rocm-comgr
, rocm-runtime
, roctracer
, rocminfo
, rocm-smi
, numactl
, libGL
, libxml2
, libX11
, python3Packages
}:

let
wrapperArgs = [
"--prefix PATH : $out/bin"
"--prefix LD_LIBRARY_PATH : ${rocm-runtime}"
"--set HIP_PLATFORM amd"
"--set HIP_PATH $out"
"--set HIP_CLANG_PATH ${clang}/bin"
"--set DEVICE_LIB_PATH ${rocm-device-libs}/amdgcn/bitcode"
"--set HSA_PATH ${rocm-runtime}"
"--set ROCM_PATH $out"
];
in stdenv.mkDerivation (finalAttrs: {
pname = "clr";
version = "6.0.2";

outputs = [
"out"
"icd"
];

src = fetchFromGitHub {
owner = "ROCm";
repo = "clr";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-ZMpA7vCW2CcpGdBLZfPimMHcgjhN1PHuewJiYwZMgGY=";
};

nativeBuildInputs = [
makeWrapper
cmake
perl
python3Packages.python
python3Packages.cppheaderparser
];

buildInputs = [
numactl
libGL
libxml2
libX11
];

propagatedBuildInputs = [
rocm-device-libs
rocm-comgr
rocm-runtime
rocminfo
];

cmakeFlags = [
"-DCMAKE_POLICY_DEFAULT_CMP0072=NEW" # Prefer newer OpenGL libraries
"-DCLR_BUILD_HIP=ON"
"-DCLR_BUILD_OCL=ON"
"-DHIP_COMMON_DIR=${hip-common}"
"-DHIPCC_BIN_DIR=${hipcc}/bin"
"-DHIP_PLATFORM=amd"
"-DPROF_API_HEADER_PATH=${roctracer.src}/inc/ext"
"-DROCM_PATH=${rocminfo}"

# Temporarily set variables to work around upstream CMakeLists issue
# Can be removed once https://github.com/ROCm/rocm-cmake/issues/121 is fixed
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
"-DCMAKE_INSTALL_LIBDIR=lib"
];

postPatch = ''
patchShebangs hipamd/*.sh
patchShebangs hipamd/src

# We're not on Windows so these are never installed to hipcc...
substituteInPlace hipamd/CMakeLists.txt \
--replace "install(PROGRAMS \''${HIPCC_BIN_DIR}/hipcc.bat DESTINATION bin)" "" \
--replace "install(PROGRAMS \''${HIPCC_BIN_DIR}/hipconfig.bat DESTINATION bin)" ""

substituteInPlace hipamd/src/hip_embed_pch.sh \
--replace "\''$LLVM_DIR/bin/clang" "${clang}/bin/clang"
'';

postInstall = ''
patchShebangs $out/bin

# hipcc.bin and hipconfig.bin is mysteriously never installed
cp -a ${hipcc}/bin/{hipcc.bin,hipconfig.bin} $out/bin

wrapProgram $out/bin/hipcc.bin ${lib.concatStringsSep " " wrapperArgs}
wrapProgram $out/bin/hipconfig.bin ${lib.concatStringsSep " " wrapperArgs}
wrapProgram $out/bin/hipcc.pl ${lib.concatStringsSep " " wrapperArgs}
wrapProgram $out/bin/hipconfig.pl ${lib.concatStringsSep " " wrapperArgs}

# Just link rocminfo, it's easier
ln -s ${rocminfo}/bin/* $out/bin

# Replace rocm-opencl-icd functionality
mkdir -p $icd/etc/OpenCL/vendors
echo "$out/lib/libamdocl64.so" > $icd/etc/OpenCL/vendors/amdocl64.icd

# add version info to output (downstream rocmPackages look for this)
mkdir $out/.info
echo "${finalAttrs.version}" > $out/.info/version
'';

passthru = {
# All known and valid general GPU targets
# We cannot use this for each ROCm library, as each defines their own supported targets
# See: https://github.com/ROCm/ROCm/blob/77cbac4abab13046ee93d8b5bf410684caf91145/README.md#library-target-matrix
gpuTargets = lib.forEach [
"803"
"900"
"906"
"908"
"90a"
"940"
"941"
"942"
"1010"
"1012"
"1030"
"1100"
"1101"
"1102"
] (target: "gfx${target}");

updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
page = "tags?per_page=1";
filter = ".[0].name | split(\"-\") | .[1]";
};

impureTests = {
rocm-smi = callPackage ./test-rocm-smi.nix {
inherit rocm-smi;
clr = finalAttrs.finalPackage;
};
opencl-example = callPackage ./test-opencl-example.nix {
clr = finalAttrs.finalPackage;
};
};
};

meta = with lib; {
description = "AMD Common Language Runtime for hipamd, opencl, and rocclr";
homepage = "https://github.com/ROCm/clr";
license = with licenses; [ mit ];
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version || versionAtLeast finalAttrs.version "7.0.0";
};
})
75 changes: 75 additions & 0 deletions pkgs/development/rocm-modules/6/clr/test-opencl-example.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{ lib
, stdenv
, makeImpureTest
, fetchFromGitHub
, clr
, cmake
, pkg-config
, glew
, freeglut
, opencl-headers
, ocl-icd
}:

let

examples = stdenv.mkDerivation {
pname = "amd-app-samples";
version = "2018-06-10";

src = fetchFromGitHub {
owner = "OpenCL";
repo = "AMD_APP_samples";
rev = "54da6ca465634e78fc51fc25edf5840467ee2411";
hash = "sha256-qARQpUiYsamHbko/I1gPZE9pUGJ+3396Vk2n7ERSftA=";
};

nativeBuildInputs = [ cmake pkg-config ];

buildInputs = [ glew freeglut opencl-headers ocl-icd ];

installPhase = ''
runHook preInstall

mkdir -p $out/bin
# Example path is bin/x86_64/Release/cl/Reduction/Reduction
cp -r bin/*/*/*/*/* $out/bin/

runHook postInstall
'';

cmakeFlags = [ "-DBUILD_CPP_CL=OFF" ];

meta = with lib; {
description = "Samples from the AMD APP SDK (with OpenCRun support) ";
homepage = "https://github.com/OpenCL/AMD_APP_samples";
license = licenses.bsd2;
platforms = platforms.linux;
maintainers = lib.teams.rocm.members;
};
};

in
makeImpureTest {
name = "opencl-example";
testedPackage = "rocmPackages_6.clr";

sandboxPaths = [ "/sys" "/dev/dri" "/dev/kfd" ];

nativeBuildInputs = [ examples ];

OCL_ICD_VENDORS = "${clr.icd}/etc/OpenCL/vendors";

testScript = ''
# Examples load resources from current directory
cd ${examples}/bin
echo OCL_ICD_VENDORS=$OCL_ICD_VENDORS
pwd

HelloWorld | grep HelloWorld
'';

meta = with lib; {
maintainers = teams.rocm.members;
};
}
23 changes: 23 additions & 0 deletions pkgs/development/rocm-modules/6/clr/test-rocm-smi.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ lib
, makeImpureTest
, clinfo
, clr
, rocm-smi
}:

makeImpureTest {
name = "rocm-smi";
testedPackage = "rocmPackages_6.clr";
nativeBuildInputs = [ clinfo rocm-smi ];
OCL_ICD_VENDORS = "${clr.icd}/etc/OpenCL/vendors";

testScript = ''
# Test fails if the number of platforms is 0
clinfo | grep -E 'Number of platforms * [1-9]'
rocm-smi | grep -A1 GPU
'';

meta = with lib; {
maintainers = teams.rocm.members;
};
}
Loading
Loading