2022-11-04 12:27:35 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2022-12-17 10:02:37 +00:00
|
|
|
, unstableGitUpdater
|
2022-11-04 12:27:35 +00:00
|
|
|
, 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-12-17 10:02:37 +00:00
|
|
|
version = "unstable-2022-12-08";
|
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-12-17 10:02:37 +00:00
|
|
|
rev = "d58b7f5155b44c8b608f3edc6a6eab314493ec1a";
|
|
|
|
hash = "sha256-4nzyaWhPnY/0TygcoJAqVzdgfXOkf+o/BE2V9N+Bm7Q=";
|
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
|
|
|
|
'';
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
passthru.updateScript = unstableGitUpdater { };
|
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
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
|
|
|
})
|