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

rocm-related: 5.3.0 -> 5.3.1 & aggregate #198770

Merged
merged 23 commits into from
Nov 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 6 additions & 5 deletions pkgs/development/compilers/hip/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
, numactl
, perl
, python3
, python3Packages
, rocclr
, rocm-comgr
, rocm-device-libs
Expand All @@ -29,13 +30,13 @@
let
hip = stdenv.mkDerivation rec {
pname = "hip";
version = "5.3.0";
version = "5.3.1";

src = fetchFromGitHub {
owner = "ROCm-Developer-Tools";
repo = "HIP";
rev = "rocm-${version}";
hash = "sha256-UAodlVUiTU4n/EyvTIuQekTGh4izmBjKCRXOHXVKY4M=";
hash = "sha256-kmRvrwnT0h2dBMI+H9d1vmeW3TmDBD+qW4YYhaMV2dE=";
};

patches = [
Expand Down Expand Up @@ -109,17 +110,17 @@ let
in
stdenv.mkDerivation rec {
pname = "hip";
version = "5.3.0";
version = "5.3.1";

src = fetchFromGitHub {
owner = "ROCm-Developer-Tools";
repo = "hipamd";
rev = "rocm-${version}";
hash = "sha256-gZGZiDP/HbdmzLQkG9Jq9lyMP9hoD6UzTMiX9cUmQNA=";
hash = "sha256-i7hT/j+V0LT6Va2XcQyyKXF1guoIyhcOHvn842wCRx4=";
};

nativeBuildInputs = [ cmake python3 makeWrapper perl ];
buildInputs = [ libxml2 numactl libglvnd libX11 ];
buildInputs = [ libxml2 numactl libglvnd libX11 python3Packages.cppheaderparser ];
propagatedBuildInputs = [
clang
llvm
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/compilers/llvm/rocm/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{ stdenv, lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith, overrideCC }:

let
version = "5.3.0";
version = "5.3.1";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "llvm-project";
rev = "rocm-${version}";
hash = "sha256-MN7W4Gl6+a1nCozdn9gMzIXOiBPquoOP87x26boeSCA=";
hash = "sha256-IKo7N8wWvh5PBrZ2mh1Vu5s3uUXhanqYtC4qLV/+JBs=";
};
in rec {
clang = wrapCCWith rec {
Expand Down
44 changes: 44 additions & 0 deletions pkgs/development/libraries/clang-ocl/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, rocm-cmake
, rocm-device-libs
, clang
}:

stdenv.mkDerivation rec {
pname = "clang-ocl";
rocmVersion = "5.3.1";
version = rocmVersion;

src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "clang-ocl";
rev = "rocm-${rocmVersion}";
hash = "sha256-uMSvcVJj+me2E+7FsXZ4l4hTcK6uKEegXpkHGcuist0=";
};

nativeBuildInputs = [
cmake
rocm-cmake
clang
];

buildInputs = [
rocm-device-libs
];

cmakeFlags = [
"-DCMAKE_C_COMPILER=clang"
"-DCMAKE_CXX_COMPILER=clang++"
];

meta = with lib; {
description = "OpenCL compilation with clang compiler";
homepage = "https://github.com/RadeonOpenCompute/clang-ocl";
license = with licenses; [ mit ];
maintainers = with maintainers; [ Madouura ];
broken = rocmVersion != clang.version;
};
}
91 changes: 91 additions & 0 deletions pkgs/development/libraries/composable_kernel/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, rocm-cmake
, hip
, openmp
, gtest ? null
, buildTests ? false
, buildExamples ? false
, gpuTargets ? null # gpuTargets = [ "gfx803" "gfx900" "gfx1030" ... ]
}:

assert buildTests -> gtest != null;

# Several tests seem to either not compile or have a race condition
# Undefined reference to symbol '_ZTIN7testing4TestE'
# Try removing this next update
assert buildTests == false;

stdenv.mkDerivation rec {
pname = "composable_kernel";
version = "unstable-2022-11-02";

outputs = [
"out"
] ++ lib.optionals buildTests [
"test"
] ++ lib.optionals buildExamples [
"example"
];

src = fetchFromGitHub {
owner = "ROCmSoftwarePlatform";
repo = "composable_kernel";
rev = "79aa3fb1793c265c59d392e916baa851a55521c8";
hash = "sha256-vIfMdvRYCTqrjMGSb7gQfodzLw2wf3tGoCAa5jtfbvw=";
};

nativeBuildInputs = [
cmake
rocm-cmake
hip
];

buildInputs = [
openmp
] ++ lib.optionals buildTests [
gtest
];

cmakeFlags = [
"-DCMAKE_C_COMPILER=hipcc"
"-DCMAKE_CXX_COMPILER=hipcc"
] ++ lib.optionals (gpuTargets != null) [
"-DGPU_TARGETS=${lib.strings.concatStringsSep ";" gpuTargets}"
];

# No flags to build selectively it seems...
postPatch = ''
substituteInPlace test/CMakeLists.txt \
--replace "include(googletest)" ""

substituteInPlace CMakeLists.txt \
--replace "enable_testing()" ""
'' + lib.optionalString (!buildTests) ''
substituteInPlace CMakeLists.txt \
--replace "add_subdirectory(test)" ""
'' + lib.optionalString (!buildExamples) ''
substituteInPlace CMakeLists.txt \
--replace "add_subdirectory(example)" ""
'';

postInstall = ''
mkdir -p $out/bin
mv bin/ckProfiler $out/bin
'' + lib.optionalString buildTests ''
mkdir -p $test/bin
mv bin/test_* $test/bin
'' + lib.optionalString buildExamples ''
mkdir -p $example/bin
mv bin/example_* $example/bin
'';

meta = with lib; {
description = "Performance portable programming model for machine learning tensor operators";
homepage = "https://github.com/ROCmSoftwarePlatform/composable_kernel";
license = with licenses; [ mit ];
maintainers = with maintainers; [ Madouura ];
};
}
89 changes: 89 additions & 0 deletions pkgs/development/libraries/hipcub/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, rocm-cmake
, rocm-runtime
, rocm-device-libs
, rocm-comgr
, rocprim
, hip
, gtest ? null
, gbenchmark ? null
, buildTests ? false
, buildBenchmarks ? false
}:

assert buildTests -> gtest != null;
assert buildBenchmarks -> gbenchmark != null;

# CUB can also be used as a backend instead of rocPRIM.
stdenv.mkDerivation rec {
pname = "hipcub";
rocmVersion = "5.3.1";
version = "2.12.0-${rocmVersion}";

outputs = [
"out"
] ++ lib.optionals buildTests [
"test"
] ++ lib.optionals buildBenchmarks [
"benchmark"
];

src = fetchFromGitHub {
owner = "ROCmSoftwarePlatform";
repo = "hipCUB";
rev = "rocm-${rocmVersion}";
hash = "sha256-/GMZKbMD1sZQCM2FulM9jiJQ8ByYZinn0C8d/deFh0g=";
};

nativeBuildInputs = [
cmake
rocm-cmake
hip
];

buildInputs = [
rocm-runtime
rocm-device-libs
rocm-comgr
rocprim
] ++ lib.optionals buildTests [
gtest
] ++ lib.optionals buildBenchmarks [
gbenchmark
];

cmakeFlags = [
"-DCMAKE_CXX_COMPILER=hipcc"
"-DHIP_ROOT_DIR=${hip}"
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
] ++ lib.optionals buildTests [
"-DBUILD_TEST=ON"
] ++ lib.optionals buildBenchmarks [
"-DBUILD_BENCHMARK=ON"
];

postInstall = lib.optionalString buildTests ''
mkdir -p $test/bin
mv $out/bin/test_* $test/bin
'' + lib.optionalString buildBenchmarks ''
mkdir -p $benchmark/bin
mv $out/bin/benchmark_* $benchmark/bin
'' + lib.optionalString (buildTests || buildBenchmarks) ''
rmdir $out/bin
'';

meta = with lib; {
description = "Thin wrapper library on top of rocPRIM or CUB";
homepage = "https://github.com/ROCmSoftwarePlatform/hipCUB";
license = with licenses; [ bsd3 ];
maintainers = with maintainers; [ Madouura ];
broken = rocmVersion != hip.version;
};
}
Loading