{ lib, stdenv, fetchFromGitHub, rocmUpdateScript, cmake, rocm-cmake, rocm-merged-llvm, clr, rocminfo, python3, hipify, gitMinimal, gtest, zstd, buildTests ? false, buildExamples ? false, gpuTargets ? ( clr.localGpuTargets or [ "gfx900" "gfx906" "gfx908" "gfx90a" "gfx942" "gfx1030" "gfx1100" "gfx1101" "gfx1102" "gfx1200" "gfx1201" ] ), }: stdenv.mkDerivation (finalAttrs: { preBuild = '' echo "This derivation isn't intended to be built directly and only exists to be overridden and built in chunks"; exit 1 ''; pname = "composable_kernel_base"; # Picked this version over 6.3 because much easier to get to build # and it matches the version torch 2.6 wants version = "6.4.0-unstable-2024-12-20"; outputs = [ "out" ] ++ lib.optionals buildTests [ "test" ] ++ lib.optionals buildExamples [ "example" ]; src = fetchFromGitHub { owner = "ROCm"; repo = "composable_kernel"; rev = "07339c738396ebeae57374771ded4dcf11bddf1e"; hash = "sha256-EvEBxlOpQ71BF57VW79WBo/cdxAwTKFXFMiYKyGyyEs="; }; nativeBuildInputs = [ # Deliberately not using ninja # because we're jankily composing build outputs from multiple drvs # ninja won't believe they're up to date gitMinimal cmake rocminfo clr hipify zstd python3 ]; buildInputs = [ rocm-cmake clr zstd ]; strictDeps = true; enableParallelBuilding = true; env.ROCM_PATH = clr; env.HIP_CLANG_PATH = "${rocm-merged-llvm}/bin"; cmakeFlags = [ "-DCMAKE_MODULE_PATH=${clr}/hip/cmake" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_POLICY_DEFAULT_CMP0069=NEW" # "-DDL_KERNELS=ON" # Not needed, slow to build # CK_USE_CODEGEN Required for migraphx which uses device_gemm_multiple_d.hpp # but migraphx requires an incompatible fork of CK and fails anyway # "-DCK_USE_CODEGEN=ON" # It might be worth skipping fp64 in future with this: # "-DDTYPES=fp32;fp16;fp8;bf16;int8" # Manually define CMAKE_INSTALL_