rocmPackages: cleanup and remove double building for rocblas

Signed-off-by: Gavin Zhao <git@gzgz.dev>

+10 -100
+5 -100
pkgs/development/rocm-modules/6/rocblas/default.nix
··· 33 33 , gpuTargets ? [ "all" ] 34 34 }: 35 35 36 - let 37 - # NOTE: Update the default GPU targets on every update 38 - gfx80 = (rocblas.override { 39 - gpuTargets = [ 40 - "gfx803" 41 - ]; 42 - }).overrideAttrs { pname = "rocblas-tensile-gfx80"; }; 43 - 44 - gfx90 = (rocblas.override { 45 - gpuTargets = [ 46 - "gfx900" 47 - "gfx906:xnack-" 48 - "gfx908:xnack-" 49 - "gfx90a:xnack+" 50 - "gfx90a:xnack-" 51 - ]; 52 - }).overrideAttrs { pname = "rocblas-tensile-gfx90"; }; 53 - 54 - gfx94 = (rocblas.override { 55 - gpuTargets = [ 56 - "gfx940" 57 - "gfx941" 58 - "gfx942" 59 - ]; 60 - }).overrideAttrs { pname = "rocblas-tensile-gfx94"; }; 61 - 62 - gfx10 = (rocblas.override { 63 - gpuTargets = [ 64 - "gfx1010" 65 - "gfx1012" 66 - "gfx1030" 67 - ]; 68 - }).overrideAttrs { pname = "rocblas-tensile-gfx10"; }; 69 - 70 - gfx11 = (rocblas.override { 71 - gpuTargets = [ 72 - "gfx1100" 73 - "gfx1101" 74 - "gfx1102" 75 - ]; 76 - }).overrideAttrs { pname = "rocblas-tensile-gfx11"; }; 77 - 78 - # Unfortunately, we have to do two full builds, otherwise we get overlapping _fallback.dat files 79 - fallbacks = rocblas.overrideAttrs { pname = "rocblas-tensile-fallbacks"; }; 80 - in stdenv.mkDerivation (finalAttrs: { 36 + stdenv.mkDerivation (finalAttrs: { 81 37 pname = "rocblas"; 82 38 version = "6.0.2"; 83 39 ··· 100 56 cmake 101 57 rocm-cmake 102 58 clr 59 + tensile 103 60 ]; 104 61 105 62 buildInputs = [ ··· 126 83 (lib.cmakeFeature "AMDGPU_TARGETS" (lib.concatStringsSep ";" gpuTargets)) 127 84 (lib.cmakeBool "BUILD_WITH_TENSILE" buildTensile) 128 85 (lib.cmakeBool "ROCM_SYMLINK_LIBS" false) 129 - # # Manually define CMAKE_INSTALL_<DIR> 130 - # # See: https://github.com/NixOS/nixpkgs/pull/197838 131 - # "-DCMAKE_INSTALL_BINDIR=bin" 132 - # "-DCMAKE_INSTALL_LIBDIR=lib" 133 - # "-DCMAKE_INSTALL_INCLUDEDIR=include" 86 + (lib.cmakeFeature "ROCBLAS_TENSILE_LIBRARY_DIR" "lib/rocblas") 134 87 (lib.cmakeBool "BUILD_CLIENTS_TESTS" buildTests) 135 88 (lib.cmakeBool "BUILD_CLIENTS_BENCHMARKS" buildBenchmarks) 136 89 ] ++ lib.optionals buildTensile [ 137 - (lib.cmakeFeature "VIRTUALENV_HOME_DIR" "/build/source/tensile") 138 - (lib.cmakeFeature "Tensile_TEST_LOCAL_PATH" "/build/source/tensile") 139 - (lib.cmakeFeature "Tensile_ROOT" "/build/source/tensile/${python3.sitePackages}/Tensile") 90 + (lib.cmakeBool "BUILD_WITH_PIP" false) 140 91 (lib.cmakeFeature "Tensile_LOGIC" tensileLogic) 141 92 (lib.cmakeFeature "Tensile_CODE_OBJECT_VERSION" tensileCOVersion) 142 93 (lib.cmakeBool "Tensile_SEPARATE_ARCHITECTURES" tensileSepArch) ··· 155 106 }) 156 107 ]; 157 108 109 + # Pass $NIX_BUILD_CORES to Tensile 158 110 postPatch = '' 159 111 substituteInPlace cmake/build-options.cmake \ 160 112 --replace-fail 'Tensile_CPU_THREADS ""' 'Tensile_CPU_THREADS "$ENV{NIX_BUILD_CORES}"' 161 - '' + lib.optionalString (finalAttrs.pname != "rocblas") '' 162 - # Return early and install tensile files manually 163 - substituteInPlace library/src/CMakeLists.txt \ 164 - --replace "set_target_properties( TensileHost PROPERTIES OUTPUT_NAME" "return()''\nset_target_properties( TensileHost PROPERTIES OUTPUT_NAME" 165 - '' + lib.optionalString (buildTensile && finalAttrs.pname == "rocblas") '' 166 - # Link the prebuilt Tensile files 167 - mkdir -p build/Tensile/library 168 - 169 - for path in ${gfx80} ${gfx90} ${gfx94} ${gfx10} ${gfx11} ${fallbacks}; do 170 - ln -s $path/lib/rocblas/library/* build/Tensile/library 171 - done 172 - 173 - unlink build/Tensile/library/TensileManifest.txt 174 - '' + lib.optionalString buildTensile '' 175 - # Tensile REALLY wants to write to the nix directory if we include it normally 176 - cp -a ${tensile} tensile 177 - chmod +w -R tensile 178 - 179 - # Rewrap Tensile 180 - substituteInPlace tensile/bin/{.t*,.T*,*} \ 181 - --replace "${tensile}" "/build/source/tensile" 182 - 183 - substituteInPlace CMakeLists.txt \ 184 - --replace "include(virtualenv)" "" \ 185 - --replace "virtualenv_install(\''${Tensile_TEST_LOCAL_PATH})" "" 186 - ''; 187 - 188 - postInstall = lib.optionalString (finalAttrs.pname == "rocblas") '' 189 - ln -sf ${fallbacks}/lib/rocblas/library/TensileManifest.txt $out/lib/rocblas/library 190 - '' + lib.optionalString (finalAttrs.pname != "rocblas") '' 191 - mkdir -p $out/lib/rocblas/library 192 - rm -rf $out/share 193 - '' + lib.optionalString (finalAttrs.pname != "rocblas" && finalAttrs.pname != "rocblas-tensile-fallbacks") '' 194 - rm Tensile/library/{TensileManifest.txt,*_fallback.dat} 195 - mv Tensile/library/* $out/lib/rocblas/library 196 - '' + lib.optionalString (finalAttrs.pname == "rocblas-tensile-fallbacks") '' 197 - mv Tensile/library/{TensileManifest.txt,*_fallback.dat} $out/lib/rocblas/library 198 - '' + lib.optionalString buildTests '' 199 - mkdir -p $test/bin 200 - cp -a $out/bin/* $test/bin 201 - rm $test/bin/*-bench || true 202 - '' + lib.optionalString buildBenchmarks '' 203 - mkdir -p $benchmark/bin 204 - cp -a $out/bin/* $benchmark/bin 205 - rm $benchmark/bin/*-test || true 206 - '' + lib.optionalString (buildTests || buildBenchmarks ) '' 207 - rm -rf $out/bin 208 113 ''; 209 114 210 115 passthru.updateScript = rocmUpdateScript {
+5
pkgs/development/rocm-modules/6/tensile/default.nix
··· 41 41 url = "https://github.com/GZGavinZhao/Tensile/commit/855cb15839849addb0816a6dde45772034a3e41f.patch"; 42 42 hash = "sha256-d+fVf/vz+sxGqJ96vuxe0jRMgbC5K6j5FQ5SJ1e3Sl8="; 43 43 }) 44 + (fetchpatch { 45 + name = "Don-t-copy-file-twice-in-copyStaticFiles.patch"; 46 + url = "https://github.com/GZGavinZhao/Tensile/commit/9e14d5a00a096bddac605910a0e4dfb4c35bb0d5.patch"; 47 + hash = "sha256-gOzjJyD1K056OFQ+hK5nbUeBhxLTIgQLoT+0K12SypI="; 48 + }) 44 49 ]; 45 50 46 51 doCheck = false; # Too many errors, not sure how to set this up properly