-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198770 from Madouura/pr/aggr
- Loading branch information
Showing
26 changed files
with
1,626 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; | ||
} |
Oops, something went wrong.