2022-11-04 12:27:35 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, rocm-cmake
|
|
|
|
, hip
|
|
|
|
, openmp
|
2022-12-02 08:20:57 +00:00
|
|
|
, gtest
|
2022-11-04 12:27:35 +00:00
|
|
|
, buildTests ? false
|
|
|
|
, buildExamples ? false
|
2022-12-02 08:20:57 +00:00
|
|
|
, gpuTargets ? [ ] # gpuTargets = [ "gfx803" "gfx900" "gfx1030" ... ]
|
2022-11-04 12:27:35 +00:00
|
|
|
}:
|
|
|
|
|
2022-11-27 09:42:12 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-11-04 12:27:35 +00:00
|
|
|
pname = "composable_kernel";
|
2022-11-27 09:42:12 +00:00
|
|
|
version = "unstable-2022-11-19";
|
2022-11-04 12:27:35 +00:00
|
|
|
|
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
] ++ lib.optionals buildTests [
|
|
|
|
"test"
|
|
|
|
] ++ lib.optionals buildExamples [
|
|
|
|
"example"
|
|
|
|
];
|
|
|
|
|
2022-11-27 09:42:12 +00:00
|
|
|
# There is now a release, but it's cpu-only it seems to be for a very specific purpose
|
|
|
|
# Thus, we're sticking with the develop branch for now...
|
2022-11-04 12:27:35 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ROCmSoftwarePlatform";
|
|
|
|
repo = "composable_kernel";
|
2022-11-27 09:42:12 +00:00
|
|
|
rev = "43a889b72e3faabf04c16ff410d387ce28486c3e";
|
|
|
|
hash = "sha256-DDRrWKec/RcOhW3CrN0gl9NZsp0Bjnja7HAiTcEh7qg=";
|
2022-11-04 12:27:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
rocm-cmake
|
|
|
|
hip
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
openmp
|
|
|
|
] ++ lib.optionals buildTests [
|
|
|
|
gtest
|
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DCMAKE_C_COMPILER=hipcc"
|
|
|
|
"-DCMAKE_CXX_COMPILER=hipcc"
|
2022-12-02 08:20:57 +00:00
|
|
|
] ++ lib.optionals (gpuTargets != [ ]) [
|
|
|
|
"-DGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
|
2022-11-04 12:27:35 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# 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 ];
|
2022-11-27 09:42:12 +00:00
|
|
|
maintainers = teams.rocm.members;
|
2022-12-02 08:20:57 +00:00
|
|
|
# Several tests seem to either not compile or have a race condition
|
|
|
|
# Undefined reference to symbol '_ZTIN7testing4TestE'
|
|
|
|
# Try removing this next update
|
|
|
|
broken = buildTests;
|
2022-11-04 12:27:35 +00:00
|
|
|
};
|
2022-11-27 09:42:12 +00:00
|
|
|
})
|