From 40280b90d9f678f3fe90bcef5d14e79a8d197e26 Mon Sep 17 00:00:00 2001 From: randomizedcoder Date: Thu, 22 Oct 2026 07:19:13 -0700 Subject: [PATCH 01/10] rocmPackages_10: copy sparse, solvers, rocALUTION, rocWMMA, hipfort Verbatim copies of the rocmPackages (ROCm 7.2.4) expressions for rocsparse, hipsparse, rocsolver, hipblas, hipsolver, rocalution, rocwmma, hipfort, hipsparselt, not yet part of the rocmPackages_10 scope. The following commits update each one to ROCm 10.1, so their diffs read against 7.2.4. Assisted-by: Claude Code (claude-opus-5-5) --- .../rocm-modules/10/hipblas/default.nix | 132 +++++++++++ .../rocm-modules/10/hipfort/default.nix | 70 ++++++ .../rocm-modules/10/hipsolver/default.nix | 117 +++++++++ .../rocm-modules/10/hipsparse/default.nix | 148 ++++++++++++ .../rocm-modules/10/hipsparselt/default.nix | 123 ++++++++++ .../rocm-modules/10/rocalution/default.nix | 122 ++++++++++ .../rocm-modules/10/rocsolver/default.nix | 135 +++++++++++ .../rocm-modules/10/rocsparse/default.nix | 159 +++++++++++++ .../rocm-modules/10/rocsparse/deps.nix | 223 ++++++++++++++++++ .../rocwmma/0000-dont-fetch-googletest.patch | 35 +++ .../rocm-modules/10/rocwmma/default.nix | 116 +++++++++ 11 files changed, 1380 insertions(+) create mode 100644 pkgs/development/rocm-modules/10/hipblas/default.nix create mode 100644 pkgs/development/rocm-modules/10/hipfort/default.nix create mode 100644 pkgs/development/rocm-modules/10/hipsolver/default.nix create mode 100644 pkgs/development/rocm-modules/10/hipsparse/default.nix create mode 100644 pkgs/development/rocm-modules/10/hipsparselt/default.nix create mode 100644 pkgs/development/rocm-modules/10/rocalution/default.nix create mode 100644 pkgs/development/rocm-modules/10/rocsolver/default.nix create mode 100644 pkgs/development/rocm-modules/10/rocsparse/default.nix create mode 100644 pkgs/development/rocm-modules/10/rocsparse/deps.nix create mode 100644 pkgs/development/rocm-modules/10/rocwmma/0000-dont-fetch-googletest.patch create mode 100644 pkgs/development/rocm-modules/10/rocwmma/default.nix diff --git a/pkgs/development/rocm-modules/10/hipblas/default.nix b/pkgs/development/rocm-modules/10/hipblas/default.nix new file mode 100644 index 0000000000000..af6c620211805 --- /dev/null +++ b/pkgs/development/rocm-modules/10/hipblas/default.nix @@ -0,0 +1,132 @@ +{ + lib, + stdenv, + fetchFromGitHub, + rocmUpdateScript, + cmake, + rocm-cmake, + clr, + gfortran, + hipblas-common, + rocblas, + rocsolver, + rocsparse, + rocprim, + gtest, + lapack-reference, + buildTests ? false, + buildBenchmarks ? false, + buildSamples ? false, + # for passthru.tests + hipblas, +}: + +# Can also use cuBLAS +stdenv.mkDerivation (finalAttrs: { + pname = "hipblas"; + version = "7.2.4"; + + outputs = [ + "out" + ] + ++ lib.optionals buildTests [ + "test" + ] + ++ lib.optionals buildBenchmarks [ + "benchmark" + ] + ++ lib.optionals buildSamples [ + "sample" + ]; + + src = fetchFromGitHub { + owner = "ROCm"; + repo = "rocm-libraries"; + tag = "rocm-${finalAttrs.version}"; + sparseCheckout = [ + "projects/hipblas" + "shared" + ]; + hash = "sha256-1+aNDotV5liHBnGddmWtaKYCcsWPxQD3AoEubnghV0M="; + }; + sourceRoot = "${finalAttrs.src.name}/projects/hipblas"; + + postPatch = '' + substituteInPlace library/CMakeLists.txt \ + --replace-fail "find_package(Git REQUIRED)" "" + ''; + + nativeBuildInputs = [ + cmake + rocm-cmake + clr + gfortran + ]; + + propagatedBuildInputs = [ hipblas-common ]; + + buildInputs = [ + rocblas + rocprim + rocsparse + rocsolver + ] + ++ lib.optionals buildTests [ + gtest + ] + ++ lib.optionals (buildTests || buildBenchmarks) [ + lapack-reference + ]; + + cmakeFlags = [ + "-DCMAKE_CXX_COMPILER=${lib.getExe' clr "amdclang++"}" + # Manually define CMAKE_INSTALL_ + # See: https://github.com/NixOS/nixpkgs/pull/197838 + "-DCMAKE_INSTALL_BINDIR=bin" + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_INCLUDEDIR=include" + "-DBUILD_WITH_SOLVER=ON" + "-DAMDGPU_TARGETS=${rocblas.amdgpu_targets}" + ] + ++ lib.optionals buildTests [ + "-DBUILD_CLIENTS_TESTS=ON" + ] + ++ lib.optionals buildBenchmarks [ + "-DBUILD_CLIENTS_BENCHMARKS=ON" + ] + ++ lib.optionals buildSamples [ + "-DBUILD_CLIENTS_SAMPLES=ON" + ]; + + postInstall = + lib.optionalString buildTests '' + mkdir -p $test/bin + mv $out/bin/hipblas-test $test/bin + '' + + lib.optionalString buildBenchmarks '' + mkdir -p $benchmark/bin + mv $out/bin/hipblas-bench $benchmark/bin + '' + + lib.optionalString buildSamples '' + mkdir -p $sample/bin + mv $out/bin/example-* $sample/bin + '' + + lib.optionalString (buildTests || buildBenchmarks || buildSamples) '' + rmdir $out/bin + ''; + + passthru.updateScript = rocmUpdateScript { inherit finalAttrs; }; + passthru.tests.hipblas-tested = hipblas.override { + buildTests = true; + buildBenchmarks = true; + buildSamples = true; + }; + + meta = { + description = "ROCm BLAS marshalling library"; + homepage = "https://github.com/ROCm/rocm-libraries/tree/develop/projects/hipblas"; + license = lib.licenses.mit; + teams = [ lib.teams.rocm ]; + platforms = lib.platforms.linux; + }; +}) diff --git a/pkgs/development/rocm-modules/10/hipfort/default.nix b/pkgs/development/rocm-modules/10/hipfort/default.nix new file mode 100644 index 0000000000000..72519db7b0458 --- /dev/null +++ b/pkgs/development/rocm-modules/10/hipfort/default.nix @@ -0,0 +1,70 @@ +{ + lib, + stdenv, + fetchFromGitHub, + rocmUpdateScript, + cmake, + rocm-cmake, + gfortran, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "hipfort"; + version = "7.2.4"; + + src = fetchFromGitHub { + owner = "ROCm"; + repo = "hipfort"; + tag = "rocm-${finalAttrs.version}"; + hash = "sha256-XaB4jauCN41tgD1YHHA2td/yckwfMBemBe/iL0SCxQo="; + }; + + __structuredAttrs = true; + strictDeps = true; + + nativeBuildInputs = [ + cmake + gfortran + ]; + + buildInputs = [ + rocm-cmake + ]; + + cmakeFlags = [ + (lib.cmakeFeature "HIPFORT_COMPILER" "${gfortran}/bin/gfortran") + (lib.cmakeFeature "HIPFORT_AR" "${gfortran.cc}/bin/gcc-ar") + (lib.cmakeFeature "HIPFORT_RANLIB" "${gfortran.cc}/bin/gcc-ranlib") + # Manually define CMAKE_INSTALL_ + # See: https://github.com/NixOS/nixpkgs/pull/197838 + (lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin") + (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib") + (lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include") + ]; + + postPatch = '' + patchShebangs bin + + substituteInPlace bin/hipfc bin/mymcpu \ + --replace-fail "/bin/cat" "cat" + + substituteInPlace bin/CMakeLists.txt \ + --replace-fail "/bin/mkdir" "mkdir" \ + --replace-fail "/bin/cp" "cp" \ + --replace-fail "/bin/sed" "sed" \ + --replace-fail "/bin/chmod" "chmod" \ + --replace-fail "/bin/ln" "ln" + ''; + + passthru.updateScript = rocmUpdateScript { inherit finalAttrs; }; + + meta = { + description = "Fortran interfaces for ROCm libraries"; + homepage = "https://github.com/ROCm/hipfort"; + changelog = "https://github.com/ROCm/hipfort/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.mit; # mitx11 + mainProgram = "hipfc"; + teams = [ lib.teams.rocm ]; + platforms = lib.platforms.linux; + }; +}) diff --git a/pkgs/development/rocm-modules/10/hipsolver/default.nix b/pkgs/development/rocm-modules/10/hipsolver/default.nix new file mode 100644 index 0000000000000..c0f548bf7d1e9 --- /dev/null +++ b/pkgs/development/rocm-modules/10/hipsolver/default.nix @@ -0,0 +1,117 @@ +{ + lib, + stdenv, + fetchFromGitHub, + rocmUpdateScript, + cmake, + rocm-cmake, + clr, + gfortran, + rocblas, + rocsolver, + rocsparse, + suitesparse, + gtest, + lapack-reference, + buildTests ? false, + buildBenchmarks ? false, + buildSamples ? false, +}: + +# Can also use cuSOLVER +stdenv.mkDerivation (finalAttrs: { + pname = "hipsolver"; + version = "7.2.4"; + + outputs = [ + "out" + ] + ++ lib.optionals buildTests [ + "test" + ] + ++ lib.optionals buildBenchmarks [ + "benchmark" + ] + ++ lib.optionals buildSamples [ + "sample" + ]; + + src = fetchFromGitHub { + owner = "ROCm"; + repo = "rocm-libraries"; + tag = "rocm-${finalAttrs.version}"; + sparseCheckout = [ + "projects/hipsolver" + "shared" + ]; + hash = "sha256-ts5wuXHoBFZ1WMAk8Ir5cucP75G0SMOWmn3FEH04ZEQ="; + }; + sourceRoot = "${finalAttrs.src.name}/projects/hipsolver"; + + nativeBuildInputs = [ + cmake + rocm-cmake + clr + gfortran + ]; + + buildInputs = [ + rocblas + rocsolver + rocsparse + suitesparse + ] + ++ lib.optionals buildTests [ + gtest + ] + ++ lib.optionals (buildTests || buildBenchmarks) [ + lapack-reference + ]; + + cmakeFlags = [ + "-DCMAKE_CXX_COMPILER=hipcc" + # Manually define CMAKE_INSTALL_ + # See: https://github.com/NixOS/nixpkgs/pull/197838 + "-DCMAKE_INSTALL_BINDIR=bin" + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_INCLUDEDIR=include" + "-DBUILD_WITH_SPARSE=OFF" # FIXME: broken - can't find suitesparse/cholmod, looks fixed in master + ] + ++ lib.optionals buildTests [ + "-DBUILD_CLIENTS_TESTS=ON" + ] + ++ lib.optionals buildBenchmarks [ + "-DBUILD_CLIENTS_BENCHMARKS=ON" + ] + ++ lib.optionals buildSamples [ + "-DBUILD_CLIENTS_SAMPLES=ON" + ]; + + postInstall = + lib.optionalString buildTests '' + mkdir -p $test/bin + mv $out/bin/hipsolver-test $test/bin + '' + + lib.optionalString buildBenchmarks '' + mkdir -p $benchmark/bin + mv $out/bin/hipsolver-bench $benchmark/bin + '' + + lib.optionalString buildSamples '' + mkdir -p $sample/bin + mv clients/staging/example-* $sample/bin + patchelf $sample/bin/example-* --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" + '' + + lib.optionalString (buildTests || buildBenchmarks) '' + rmdir $out/bin + ''; + + passthru.updateScript = rocmUpdateScript { inherit finalAttrs; }; + + meta = { + description = "ROCm SOLVER marshalling library"; + homepage = "https://github.com/ROCm/rocm-libraries/tree/develop/projects/hipsolver"; + license = lib.licenses.mit; + teams = [ lib.teams.rocm ]; + platforms = lib.platforms.linux; + }; +}) diff --git a/pkgs/development/rocm-modules/10/hipsparse/default.nix b/pkgs/development/rocm-modules/10/hipsparse/default.nix new file mode 100644 index 0000000000000..7057fb8ceb5b0 --- /dev/null +++ b/pkgs/development/rocm-modules/10/hipsparse/default.nix @@ -0,0 +1,148 @@ +{ + lib, + stdenv, + fetchFromGitHub, + rocmUpdateScript, + cmake, + rocm-cmake, + rocsparse, + clr, + gfortran, + gtest, + openmp, + buildTests ? false, + buildBenchmarks ? false, + buildSamples ? false, + gpuTargets ? clr.localGpuTargets or [ ], +}: + +# This can also use cuSPARSE as a backend instead of rocSPARSE +stdenv.mkDerivation (finalAttrs: { + pname = "hipsparse"; + version = "7.2.4"; + + outputs = [ + "out" + ] + ++ lib.optionals buildTests [ + "test" + ] + ++ lib.optionals buildSamples [ + "sample" + ]; + + src = fetchFromGitHub { + owner = "ROCm"; + repo = "rocm-libraries"; + tag = "rocm-${finalAttrs.version}"; + sparseCheckout = [ + "projects/hipsparse" + "shared" + ]; + hash = "sha256-E1chG+giFtf02fjutoV4yM2XvrQKjgXRSvxs0NBBkvI="; + }; + sourceRoot = "${finalAttrs.src.name}/projects/hipsparse"; + + nativeBuildInputs = [ + cmake + rocm-cmake + clr + gfortran + ]; + + buildInputs = [ + rocsparse + ] + ++ lib.optionals (buildTests || buildBenchmarks) [ + gtest + ] + ++ lib.optionals (buildTests || buildSamples) [ + openmp + ]; + + cmakeFlags = [ + # Manually define CMAKE_INSTALL_ + # See: https://github.com/NixOS/nixpkgs/pull/197838 + "-DCMAKE_INSTALL_BINDIR=bin" + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_INCLUDEDIR=include" + (lib.cmakeBool "BUILD_CLIENTS_TESTS" buildTests) + (lib.cmakeBool "BUILD_CLIENTS_BENCHMARKS" buildBenchmarks) + (lib.cmakeBool "BUILD_CLIENTS_SAMPLES" buildSamples) + ] + ++ lib.optionals (gpuTargets != [ ]) [ + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" + ]; + + # We have to manually generate the matrices + # CMAKE_MATRICES_DIR seems to be reset in clients/tests/CMakeLists.txt + postPatch = lib.optionalString buildTests '' + mkdir -p matrices + + ln -s ${rocsparse.passthru.matrices.matrix-01}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-02}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-03}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-04}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-05}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-06}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-07}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-08}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-09}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-10}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-11}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-12}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-13}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-14}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-15}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-16}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-17}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-18}/*.mtx matrices + ln -s ${rocsparse.passthru.matrices.matrix-19}/*.mtx matrices + + # Not used by the original cmake, causes an error + rm matrices/*_b.mtx + + echo "deps/convert.cpp -> deps/mtx2csr" + hipcc deps/convert.cpp -O3 -o deps/mtx2csr + + for mat in $(ls -1 matrices | cut -d "." -f 1); do + echo "mtx2csr: $mat.mtx -> $mat.bin" + deps/mtx2csr matrices/$mat.mtx matrices/$mat.bin + unlink matrices/$mat.mtx + done + + substituteInPlace clients/tests/CMakeLists.txt \ + --replace "\''${PROJECT_BINARY_DIR}/matrices" "/build/source/matrices" + ''; + + postInstall = + lib.optionalString buildTests '' + mkdir -p $test/bin + mv $out/bin/hipsparse-test $test/bin + mv /build/source/matrices $test + rmdir $out/bin + '' + + lib.optionalString buildSamples '' + mkdir -p $sample/bin + mv clients/staging/example_* $sample/bin + patchelf --set-rpath $out/lib:${ + lib.makeLibraryPath ( + finalAttrs.buildInputs + ++ [ + clr + gfortran.cc + ] + ) + } $sample/bin/example_* + ''; + + passthru.updateScript = rocmUpdateScript { inherit finalAttrs; }; + + meta = { + description = "ROCm SPARSE marshalling library"; + homepage = "https://github.com/ROCm/rocm-libraries/tree/develop/projects/hipsparse"; + license = lib.licenses.mit; + teams = [ lib.teams.rocm ]; + platforms = lib.platforms.linux; + }; +}) diff --git a/pkgs/development/rocm-modules/10/hipsparselt/default.nix b/pkgs/development/rocm-modules/10/hipsparselt/default.nix new file mode 100644 index 0000000000000..9cd7c710a6d6c --- /dev/null +++ b/pkgs/development/rocm-modules/10/hipsparselt/default.nix @@ -0,0 +1,123 @@ +{ + lib, + stdenv, + fetchFromGitHub, + rocmUpdateScript, + cmake, + ninja, + git, + pkg-config, + rocm-cmake, + rocm-smi, + clr, + hipsparse, + openmp, + llvm, + msgpack-cxx, + libxml2, + zlib, + zstd, + python3, + python3Packages, + # hipsparselt only supports gfx942/gfx950 + gpuTargets ? (clr.localGpuTargets or clr.gpuTargets), +}: + +let + supportedTargets = ( + lib.lists.intersectLists gpuTargets [ + "gfx942" + "gfx950" + ] + ); + supportsTargetArches = supportedTargets != [ ]; + py = python3.withPackages (ps: [ + ps.pyyaml + ps.setuptools + ps.packaging + ps.nanobind + ps.msgpack + ps.joblib + ]); + compiler = "amdclang++"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "hipsparselt${clr.gpuArchSuffix}"; + version = "7.2.4"; + + src = fetchFromGitHub { + owner = "ROCm"; + repo = "rocm-libraries"; + tag = "rocm-${finalAttrs.version}"; + hash = "sha256-Al/0yZPn/wqtBFQU1FcGoSquDMObk6HQ3D5sSh5biHg="; + sparseCheckout = [ + "projects/hipsparselt" + "projects/hipblaslt/tensilelite" + "projects/hipblaslt/cmake" + "projects/hipblaslt/device-library" + "shared/origami" + ]; + }; + sourceRoot = "${finalAttrs.src.name}/projects/hipsparselt"; + + env.CXX = compiler; + env.ROCM_PATH = "${clr}"; + env.TENSILE_ROCM_ASSEMBLER_PATH = lib.getExe' clr "amdclang++"; + env.TENSILE_GEN_ASSEMBLY_TOOLCHAIN = lib.getExe' clr "amdclang++"; + requiredSystemFeatures = [ "big-parallel" ]; + + __structuredAttrs = true; + strictDeps = true; + + nativeBuildInputs = [ + cmake + ninja + git + pkg-config + rocm-cmake + rocm-smi + py + clr + ]; + + buildInputs = [ + llvm.llvm + clr + rocm-cmake + hipsparse + openmp + msgpack-cxx + libxml2 + python3Packages.msgpack + zlib + zstd + ]; + + cmakeFlags = [ + (lib.cmakeFeature "GPU_TARGETS" (lib.concatStringsSep ";" supportedTargets)) + (lib.cmakeBool "HIPSPARSELT_ENABLE_DEVICE" supportsTargetArches) + (lib.cmakeBool "HIPSPARSELT_ENABLE_CLIENT" false) + (lib.cmakeBool "HIPSPARSELT_BUILD_TESTING" false) + (lib.cmakeBool "HIPSPARSELT_ENABLE_MARKER" false) + (lib.cmakeBool "HIPBLASLT_ENABLE_ROCROLLER" false) + (lib.cmakeBool "HIPBLASLT_ENABLE_MARKER" false) + (lib.cmakeFeature "CMAKE_C_COMPILER" "amdclang") + (lib.cmakeFeature "CMAKE_HIP_COMPILER" compiler) + (lib.cmakeFeature "CMAKE_CXX_COMPILER" compiler) + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_NANOBIND" "${python3Packages.nanobind.src}") + (lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin") + (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib") + (lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include") + ]; + + passthru.supportsTargetArches = supportsTargetArches; + passthru.updateScript = rocmUpdateScript { inherit finalAttrs; }; + + meta = { + description = "ROCm hipSPARSELt - a SPARSE marshalling library"; + homepage = "https://github.com/ROCm/rocm-libraries/tree/develop/projects/hipsparselt"; + license = lib.licenses.mit; + teams = [ lib.teams.rocm ]; + platforms = lib.platforms.linux; + }; +}) diff --git a/pkgs/development/rocm-modules/10/rocalution/default.nix b/pkgs/development/rocm-modules/10/rocalution/default.nix new file mode 100644 index 0000000000000..8fd50e6fc589b --- /dev/null +++ b/pkgs/development/rocm-modules/10/rocalution/default.nix @@ -0,0 +1,122 @@ +{ + lib, + stdenv, + fetchFromGitHub, + rocmUpdateScript, + cmake, + rocm-cmake, + rocblas, + rocsparse, + rocprim, + rocrand, + clr, + pkg-config, + openmp, + openmpi, + gtest, + buildTests ? false, + buildBenchmarks ? false, + buildSamples ? false, + gpuTargets ? clr.localGpuTargets or [ ], # gpuTargets = [ "gfx803" "gfx900:xnack-" "gfx906:xnack-" ... ] +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "rocalution"; + version = "7.2.4"; + + outputs = [ + "out" + ] + ++ lib.optionals buildTests [ + "test" + ] + ++ lib.optionals buildBenchmarks [ + "benchmark" + ] + ++ lib.optionals buildSamples [ + "sample" + ]; + + src = fetchFromGitHub { + owner = "ROCm"; + repo = "rocALUTION"; + tag = "rocm-${finalAttrs.version}"; + hash = "sha256-yPM26e8tGNpPScIriAPRb+6OZfdpX4PgE0E9bmc3FkU="; + }; + + nativeBuildInputs = [ + cmake + rocm-cmake + clr + pkg-config + ]; + + buildInputs = [ + rocblas + rocsparse + rocprim + rocrand + openmp + openmpi + ] + ++ lib.optionals buildTests [ + gtest + ]; + + cmakeFlags = [ + "-DROCM_PATH=${clr}" + "-DHIP_ROOT_DIR=${clr}" + "-DSUPPORT_HIP=ON" + "-DSUPPORT_OMP=ON" + "-DSUPPORT_MPI=ON" + "-DBUILD_CLIENTS_SAMPLES=${if buildSamples then "ON" else "OFF"}" + # Manually define CMAKE_INSTALL_ + # See: https://github.com/NixOS/nixpkgs/pull/197838 + "-DCMAKE_INSTALL_BINDIR=bin" + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_INCLUDEDIR=include" + ] + ++ lib.optionals (gpuTargets != [ ]) [ + "-DAMDGPU_TARGETS=${lib.strings.concatStringsSep ";" gpuTargets}" + "-DGPU_TARGETS=${lib.strings.concatStringsSep ";" gpuTargets}" + ] + ++ lib.optionals buildTests [ + "-DBUILD_CLIENTS_TESTS=ON" + ] + ++ lib.optionals buildBenchmarks [ + "-DBUILD_CLIENTS_BENCHMARKS=ON" + ]; + + postInstall = + lib.optionalString buildTests '' + mkdir -p $test/bin + mv $out/bin/rocalution-test $test/bin + '' + + lib.optionalString buildBenchmarks '' + mkdir -p $benchmark/bin + mv $out/bin/rocalution-bench $benchmark/bin + '' + + lib.optionalString buildSamples '' + mkdir -p $sample/bin + mv clients/staging/* $sample/bin + rm $sample/bin/rocalution-test || true + rm $sample/bin/rocalution-bench || true + + patchelf --set-rpath \ + $out/lib:${lib.makeLibraryPath (finalAttrs.buildInputs ++ [ clr ])} \ + $sample/bin/* + '' + + lib.optionalString (buildTests || buildBenchmarks) '' + rmdir $out/bin + ''; + + passthru.updateScript = rocmUpdateScript { inherit finalAttrs; }; + + meta = { + description = "Iterative sparse solvers for ROCm"; + homepage = "https://github.com/ROCm/rocALUTION"; + license = lib.licenses.mit; + teams = [ lib.teams.rocm ]; + platforms = lib.platforms.linux; + }; +}) diff --git a/pkgs/development/rocm-modules/10/rocsolver/default.nix b/pkgs/development/rocm-modules/10/rocsolver/default.nix new file mode 100644 index 0000000000000..a70d06e30efc7 --- /dev/null +++ b/pkgs/development/rocm-modules/10/rocsolver/default.nix @@ -0,0 +1,135 @@ +{ + lib, + stdenv, + fetchFromGitHub, + rocmUpdateScript, + cmake, + rocm-cmake, + rocblas, + rocprim, + rocsparse, + clr, + fmt, + gtest, + gfortran, + lapack-reference, + buildTests ? false, + buildBenchmarks ? false, + gpuTargets ? ( + clr.localGpuTargets or [ + "gfx900" + "gfx906" + "gfx908" + "gfx90a" + "gfx942" + "gfx1010" + "gfx1030" + "gfx1100" + "gfx1101" + "gfx1102" + "gfx1150" + "gfx1151" + "gfx1200" + "gfx1201" + ] + ), +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "rocsolver${clr.gpuArchSuffix}"; + version = "7.2.4"; + + outputs = [ + "out" + ] + ++ lib.optionals buildTests [ + "test" + ] + ++ lib.optionals buildBenchmarks [ + "benchmark" + ]; + + src = fetchFromGitHub { + owner = "ROCm"; + repo = "rocm-libraries"; + tag = "rocm-${finalAttrs.version}"; + sparseCheckout = [ + "projects/rocsolver" + "shared" + ]; + hash = "sha256-n+Y8RheA0UYeSfpvOw5zfwe4VAW5hsKjlCXtBceGhf0="; + }; + sourceRoot = "${finalAttrs.src.name}/projects/rocsolver"; + + nativeBuildInputs = [ + cmake + # no ninja, it buffers console output and nix times out long periods of no output + rocm-cmake + clr + ] + ++ lib.optionals (buildTests || buildBenchmarks) [ + gfortran + ]; + + buildInputs = [ + # FIXME: rocblas and rocsolver can't build in parallel + # but rocsolver doesn't need rocblas' offload builds at build time + # could we build against a rocblas-minimal? + rocblas + rocprim + rocsparse + fmt + ] + ++ lib.optionals buildTests [ + gtest + ] + ++ lib.optionals (buildTests || buildBenchmarks) [ + lapack-reference + ]; + + cmakeFlags = [ + "-DHIP_CLANG_NUM_PARALLEL_JOBS=4" + "-DCMAKE_VERBOSE_MAKEFILE=ON" + # Manually define CMAKE_INSTALL_ + # See: https://github.com/NixOS/nixpkgs/pull/197838 + "-DCMAKE_INSTALL_BINDIR=bin" + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_INCLUDEDIR=include" + ] + ++ lib.optionals (gpuTargets != [ ]) [ + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" + ] + ++ lib.optionals buildTests [ + "-DBUILD_CLIENTS_TESTS=ON" + ] + ++ lib.optionals buildBenchmarks [ + "-DBUILD_CLIENTS_BENCHMARKS=ON" + ]; + + postInstall = + lib.optionalString buildTests '' + mkdir -p $test/bin + mv $out/bin/rocsolver-test $test/bin + '' + + lib.optionalString buildBenchmarks '' + mkdir -p $benchmark/bin + mv $out/bin/rocsolver-bench $benchmark/bin + '' + + lib.optionalString (buildTests || buildBenchmarks) '' + rmdir $out/bin + ''; + + passthru.updateScript = rocmUpdateScript { inherit finalAttrs; }; + + requiredSystemFeatures = [ "big-parallel" ]; + + meta = { + description = "ROCm LAPACK implementation"; + homepage = "https://github.com/ROCm/rocm-libraries/tree/develop/projects/rocsolver"; + license = lib.licenses.bsd2; + teams = [ lib.teams.rocm ]; + platforms = lib.platforms.linux; + timeout = 14400; # 4 hours + maxSilent = 14400; # 4 hours + }; +}) diff --git a/pkgs/development/rocm-modules/10/rocsparse/default.nix b/pkgs/development/rocm-modules/10/rocsparse/default.nix new file mode 100644 index 0000000000000..db7b0b156850a --- /dev/null +++ b/pkgs/development/rocm-modules/10/rocsparse/default.nix @@ -0,0 +1,159 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchzip, + rocmUpdateScript, + cmake, + rocm-cmake, + rocprim, + rocblas, + clr, + gfortran, + gtest, + boost, + python3Packages, + buildTests ? false, + buildBenchmarks ? false, # Seems to depend on tests + gpuTargets ? clr.localGpuTargets or clr.gpuTargets, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "rocsparse${clr.gpuArchSuffix}"; + version = "7.2.4"; + + outputs = [ + "out" + ] + ++ lib.optionals (buildTests || buildBenchmarks) [ + "test" + ] + ++ lib.optionals buildBenchmarks [ + "benchmark" + ]; + + src = fetchFromGitHub { + owner = "ROCm"; + repo = "rocm-libraries"; + tag = "rocm-${finalAttrs.version}"; + sparseCheckout = [ + "projects/rocsparse" + "shared" + ]; + hash = "sha256-hkfBTcLig39al2w8zFTSQQnouaou9wlD6VlvIyFTNMg="; + }; + sourceRoot = "${finalAttrs.src.name}/projects/rocsparse"; + + nativeBuildInputs = [ + cmake + # no ninja, it buffers console output and nix times out long periods of no output + rocm-cmake + clr + gfortran + ]; + + buildInputs = [ + rocprim + rocblas + ] + ++ lib.optionals (buildTests || buildBenchmarks) [ + gtest + boost + python3Packages.python + python3Packages.pyyaml + ]; + + cmakeFlags = [ + "-DCMAKE_CXX_COMPILER=amdclang++" + # Manually define CMAKE_INSTALL_ + # See: https://github.com/NixOS/nixpkgs/pull/197838 + "-DCMAKE_INSTALL_BINDIR=bin" + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_INCLUDEDIR=include" + ] + ++ lib.optionals (gpuTargets != [ ]) [ + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" + ] + ++ lib.optionals (buildTests || buildBenchmarks) [ + "-DBUILD_CLIENTS_TESTS=ON" + "-DCMAKE_MATRICES_DIR=/build/source/matrices" + "-Dpython=python3" + ] + ++ lib.optionals buildBenchmarks [ + "-DBUILD_CLIENTS_BENCHMARKS=ON" + ]; + + # We have to manually generate the matrices + postPatch = lib.optionalString (buildTests || buildBenchmarks) '' + mkdir -p matrices + + ln -s ${finalAttrs.passthru.matrices.matrix-01}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-02}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-03}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-04}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-05}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-06}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-07}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-08}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-09}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-10}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-11}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-12}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-13}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-14}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-15}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-16}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-17}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-18}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-19}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-20}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-21}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-22}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-23}/*.mtx matrices + ln -s ${finalAttrs.passthru.matrices.matrix-24}/*.mtx matrices + + # Not used by the original cmake, causes an error + rm matrices/*_b.mtx + + echo "deps/convert.cpp -> deps/mtx2csr" + hipcc deps/convert.cpp -O3 -o deps/mtx2csr + + for mat in $(ls -1 matrices | cut -d "." -f 1); do + echo "mtx2csr: $mat.mtx -> $mat.csr" + deps/mtx2csr matrices/$mat.mtx matrices/$mat.csr + unlink matrices/$mat.mtx + done + ''; + + postInstall = + lib.optionalString buildBenchmarks '' + mkdir -p $benchmark/bin + cp -a $out/bin/* $benchmark/bin + rm $benchmark/bin/rocsparse-test + '' + + lib.optionalString (buildTests || buildBenchmarks) '' + mkdir -p $test/bin + mv $out/bin/* $test/bin + rm $test/bin/rocsparse-bench || true + mv /build/source/matrices $test + rmdir $out/bin + ''; + + passthru = { + matrices = import ./deps.nix { + inherit fetchzip; + mirror1 = "https://sparse.tamu.edu/MM"; + mirror2 = "https://www.cise.ufl.edu/research/sparse/MM"; + }; + + updateScript = rocmUpdateScript { inherit finalAttrs; }; + }; + + meta = { + description = "ROCm SPARSE implementation"; + homepage = "https://github.com/ROCm/rocm-libraries/tree/develop/projects/rocsparse"; + license = lib.licenses.mit; + teams = [ lib.teams.rocm ]; + platforms = lib.platforms.linux; + }; +}) diff --git a/pkgs/development/rocm-modules/10/rocsparse/deps.nix b/pkgs/development/rocm-modules/10/rocsparse/deps.nix new file mode 100644 index 0000000000000..00096ca4bf7ba --- /dev/null +++ b/pkgs/development/rocm-modules/10/rocsparse/deps.nix @@ -0,0 +1,223 @@ +{ + fetchzip, + mirror1, + mirror2, +}: + +{ + matrix-01 = fetchzip { + hash = "sha256-AHur5ZIDZTFRrO2GV0ieXrffq4KUiGWiZ59pv0fUtEQ="; + + urls = [ + "${mirror1}/SNAP/amazon0312.tar.gz" + "${mirror2}/SNAP/amazon0312.tar.gz" + ]; + }; + + matrix-02 = fetchzip { + hash = "sha256-0rSxaN4lQcdaCLsvlgicG70FXUxXeERPiEmQ4MzbRdE="; + + urls = [ + "${mirror1}/Muite/Chebyshev4.tar.gz" + "${mirror2}/Muite/Chebyshev4.tar.gz" + ]; + }; + + matrix-03 = fetchzip { + hash = "sha256-hDzDWDUnHEyFedX/tMNq83ZH8uWyM4xtZYUUAD3rizo="; + + urls = [ + "${mirror1}/FEMLAB/sme3Dc.tar.gz" + "${mirror2}/FEMLAB/sme3Dc.tar.gz" + ]; + }; + + matrix-04 = fetchzip { + hash = "sha256-GmN2yOt/MoX01rKe05aTyB3ypUP4YbQGOITZ0BqPmC0="; + + urls = [ + "${mirror1}/Williams/webbase-1M.tar.gz" + "${mirror2}/Williams/webbase-1M.tar.gz" + ]; + }; + + matrix-05 = fetchzip { + hash = "sha256-gQNjfVyWzNM9RwImJGhkhahRmZz74LzDs1oijL7mI7k="; + + urls = [ + "${mirror1}/Williams/mac_econ_fwd500.tar.gz" + "${mirror2}/Williams/mac_econ_fwd500.tar.gz" + ]; + }; + + matrix-06 = fetchzip { + hash = "sha256-87cdZjntNcTuz5BtO59irhcuRbPllWSbhCEX3Td02qc="; + + urls = [ + "${mirror1}/Williams/mc2depi.tar.gz" + "${mirror2}/Williams/mc2depi.tar.gz" + ]; + }; + + matrix-07 = fetchzip { + hash = "sha256-WRamuJX3D8Tm+k0q67RjUDG3DeNAxhKiaPkk5afY5eU="; + + urls = [ + "${mirror1}/Bova/rma10.tar.gz" + "${mirror2}/Bova/rma10.tar.gz" + ]; + }; + + matrix-08 = fetchzip { + hash = "sha256-5dhkm293Mc3lzakKxHy5W5XIn4Rw+gihVh7gyrjEHXo="; + + urls = [ + "${mirror1}/JGD_BIBD/bibd_22_8.tar.gz" + "${mirror2}/JGD_BIBD/bibd_22_8.tar.gz" + ]; + }; + + matrix-09 = fetchzip { + hash = "sha256-czjLWCjXAjZCk5TGYHaEkwSAzQu3TQ3QyB6eNKR4G88="; + + urls = [ + "${mirror1}/Hamm/scircuit.tar.gz" + "${mirror2}/Hamm/scircuit.tar.gz" + ]; + }; + + matrix-10 = fetchzip { + hash = "sha256-bYuLnJViAIcIejAkh69/bsNAVIDU4wfTLtD+nmHd6FM="; + + urls = [ + "${mirror1}/Sandia/ASIC_320k.tar.gz" + "${mirror2}/Sandia/ASIC_320k.tar.gz" + ]; + }; + + matrix-11 = fetchzip { + hash = "sha256-aDwn8P1khYjo2Agbq5m9ZBInJUxf/knJNvyptt0fak0="; + + urls = [ + "${mirror1}/GHS_psdef/bmwcra_1.tar.gz" + "${mirror2}/GHS_psdef/bmwcra_1.tar.gz" + ]; + }; + + matrix-12 = fetchzip { + hash = "sha256-8OJqA/byhlAZd869TPUzZFdsOiwOoRGfKyhM+RMjXoY="; + + urls = [ + "${mirror1}/HB/nos1.tar.gz" + "${mirror2}/HB/nos1.tar.gz" + ]; + }; + + matrix-13 = fetchzip { + hash = "sha256-FS0rKqmg+uHwsM/yGfQLBdd7LH/rUrdutkNGBD/Mh1I="; + + urls = [ + "${mirror1}/HB/nos2.tar.gz" + "${mirror2}/HB/nos2.tar.gz" + ]; + }; + + matrix-14 = fetchzip { + hash = "sha256-DANnlrNJikrI7Pst9vRedtbuxepyHmCIu2yhltc4Qcs="; + + urls = [ + "${mirror1}/HB/nos3.tar.gz" + "${mirror2}/HB/nos3.tar.gz" + ]; + }; + + matrix-15 = fetchzip { + hash = "sha256-21mUgqjWGUfYgiWwSrKh9vH8Vdt3xzcefmqYNYRpxiY="; + + urls = [ + "${mirror1}/HB/nos4.tar.gz" + "${mirror2}/HB/nos4.tar.gz" + ]; + }; + + matrix-16 = fetchzip { + hash = "sha256-FOuXvGqBBFNkVS6cexmkluret54hCfCOdK+DOZllE4c="; + + urls = [ + "${mirror1}/HB/nos5.tar.gz" + "${mirror2}/HB/nos5.tar.gz" + ]; + }; + + matrix-17 = fetchzip { + hash = "sha256-+7NI1rA/qQxYPpjXKHvAaCZ+LSaAJ4xuJvMRMBEUYxg="; + + urls = [ + "${mirror1}/HB/nos6.tar.gz" + "${mirror2}/HB/nos6.tar.gz" + ]; + }; + + matrix-18 = fetchzip { + hash = "sha256-q3NxJjbwGGcFiQ9nhWfUKgZmdVwCfPmgQoqy0AqOsNc="; + + urls = [ + "${mirror1}/HB/nos7.tar.gz" + "${mirror2}/HB/nos7.tar.gz" + ]; + }; + + matrix-19 = fetchzip { + hash = "sha256-0GAN6qmVfD+tprIigzuUUUwm5KVhkN9X65wMEvFltDY="; + + urls = [ + "${mirror1}/DNVS/shipsec1.tar.gz" + "${mirror2}/DNVS/shipsec1.tar.gz" + ]; + }; + + matrix-20 = fetchzip { + hash = "sha256-f28Du/Urxsiq5NkRmRO10Zz9vvGRjEchquzHzbZpZ7U="; + + urls = [ + "${mirror1}/Cote/mplate.tar.gz" + "${mirror2}/Cote/mplate.tar.gz" + ]; + }; + + matrix-21 = fetchzip { + hash = "sha256-O+Wy0NfCU1hVUOfNR1dJpvDHLBwwa301IRJDrQJnhak="; + + urls = [ + "${mirror1}/Bai/qc2534.tar.gz" + "${mirror2}/Bai/qc2534.tar.gz" + ]; + }; + + matrix-22 = fetchzip { + hash = "sha256-oxMnt8U5Cf1ILWcBdU6W9jdSMMm+U6bIVl8nm3n3+OA="; + + urls = [ + "${mirror1}/Chevron/Chevron2.tar.gz" + "${mirror2}/Chevron/Chevron2.tar.gz" + ]; + }; + + matrix-23 = fetchzip { + hash = "sha256-MFD9BxFI/3IS7yatW121BAI04fbqrXpgYDT5UKjeKcU="; + + urls = [ + "${mirror1}/Chevron/Chevron3.tar.gz" + "${mirror2}/Chevron/Chevron3.tar.gz" + ]; + }; + + matrix-24 = fetchzip { + hash = "sha256-ikS8O51pe1nt3BNyhvfvqCbVL0+bg/da9bqGqeBDkTg="; + + urls = [ + "${mirror1}/Chevron/Chevron4.tar.gz" + "${mirror2}/Chevron/Chevron4.tar.gz" + ]; + }; +} diff --git a/pkgs/development/rocm-modules/10/rocwmma/0000-dont-fetch-googletest.patch b/pkgs/development/rocm-modules/10/rocwmma/0000-dont-fetch-googletest.patch new file mode 100644 index 0000000000000..fa47a3c42249b --- /dev/null +++ b/pkgs/development/rocm-modules/10/rocwmma/0000-dont-fetch-googletest.patch @@ -0,0 +1,35 @@ +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 0d00883..86ce282 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -30,30 +30,6 @@ cmake_dependent_option( ROCWMMA_BUILD_VALIDATION_TESTS "Build validation tests" + cmake_dependent_option( ROCWMMA_BUILD_BENCHMARK_TESTS "Build benchmarking tests" OFF "ROCWMMA_BUILD_TESTS" OFF ) + cmake_dependent_option( ROCWMMA_BUILD_EXTENDED_TESTS "Build extended test parameter coverage" OFF "ROCWMMA_BUILD_TESTS" OFF ) + +-# Test/benchmark requires additional dependencies +-include( FetchContent ) +- +-FetchContent_Declare( +- googletest +- GIT_REPOSITORY https://github.com/google/googletest.git +- GIT_TAG release-1.12.1 +-) +-FetchContent_GetProperties(googletest) +-if(NOT googletest_POPULATED) +- +- # Fetch the content using default details +- FetchContent_Populate(googletest) +- # Save the shared libs setting, then force to static libs +- set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS}) +- set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Build SHARED libraries" FORCE) +- +- # Add gtest targets as static libs +- add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) +- +- # Restore shared libs setting +- set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_OLD} CACHE INTERNAL "Build SHARED libraries" FORCE) +-endif() +- + set(ROCWMMA_TEST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) + set(ROCWMMA_COMMON_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/hip_device.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/rocwmma_gtest_main.cpp) diff --git a/pkgs/development/rocm-modules/10/rocwmma/default.nix b/pkgs/development/rocm-modules/10/rocwmma/default.nix new file mode 100644 index 0000000000000..454cced2a0fdd --- /dev/null +++ b/pkgs/development/rocm-modules/10/rocwmma/default.nix @@ -0,0 +1,116 @@ +{ + lib, + stdenv, + fetchFromGitHub, + rocmUpdateScript, + cmake, + rocm-cmake, + rocm-smi, + clr, + openmp, + gtest, + rocblas, + buildTests ? false, # Will likely fail building because wavefront shifts are not supported for certain archs + buildExtendedTests ? false, + buildBenchmarks ? false, + buildSamples ? false, + gpuTargets ? clr.localGpuTargets or [ ], +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "rocwmma"; + version = "7.2.4"; + + outputs = [ + "out" + ] + ++ lib.optionals (buildTests || buildBenchmarks) [ + "test" + ] + ++ lib.optionals buildBenchmarks [ + "benchmark" + ] + ++ lib.optionals buildSamples [ + "sample" + ]; + + src = fetchFromGitHub { + owner = "ROCm"; + repo = "rocm-libraries"; + tag = "rocm-${finalAttrs.version}"; + sparseCheckout = [ + "projects/rocwmma" + "shared" + ]; + hash = "sha256-eoF8a7zknpgvDOSDzolOrdtszUJ5tC7Ur2sRShiQEO0="; + }; + sourceRoot = "${finalAttrs.src.name}/projects/rocwmma"; + + patches = lib.optionals (buildTests || buildBenchmarks) [ + ./0000-dont-fetch-googletest.patch + ]; + + nativeBuildInputs = [ + cmake + rocm-cmake + clr + ]; + + buildInputs = [ + openmp + ] + ++ lib.optionals (buildTests || buildBenchmarks) [ + rocm-smi + gtest + rocblas + ]; + + cmakeFlags = [ + "-DROCWMMA_BUILD_TESTS=${if buildTests || buildBenchmarks then "ON" else "OFF"}" + "-DROCWMMA_BUILD_SAMPLES=${if buildSamples then "ON" else "OFF"}" + # Manually define CMAKE_INSTALL_ + # See: https://github.com/NixOS/nixpkgs/pull/197838 + "-DCMAKE_INSTALL_BINDIR=bin" + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_INCLUDEDIR=include" + ] + ++ lib.optionals (gpuTargets != [ ]) [ + "-DGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" + ] + ++ lib.optionals buildExtendedTests [ + "-DROCWMMA_BUILD_EXTENDED_TESTS=ON" + ] + ++ lib.optionals buildBenchmarks [ + "-DROCWMMA_BUILD_BENCHMARK_TESTS=ON" + "-DROCWMMA_BENCHMARK_WITH_ROCBLAS=ON" + ]; + + postInstall = + lib.optionalString (buildTests || buildBenchmarks) '' + mkdir -p $test/bin + mv $out/bin/{*_test,*-validate} $test/bin + '' + + lib.optionalString buildBenchmarks '' + mkdir -p $benchmark/bin + mv $out/bin/*-bench $benchmark/bin + '' + + lib.optionalString buildSamples '' + mkdir -p $sample/bin + mv $out/bin/sgemmv $sample/bin + mv $out/bin/simple_gemm $sample/bin + mv $out/bin/simple_dlrm $sample/bin + '' + + lib.optionalString (buildTests || buildBenchmarks || buildSamples) '' + rm -rf $out/bin + ''; + + passthru.updateScript = rocmUpdateScript { inherit finalAttrs; }; + + meta = { + description = "Mixed precision matrix multiplication and accumulation"; + homepage = "https://github.com/ROCm/rocm-libraries/tree/develop/projects/rocwmma"; + license = lib.licenses.mit; + teams = [ lib.teams.rocm ]; + platforms = lib.platforms.linux; + }; +}) From 9e03b9b4e2f31b4eb5157c73b640120045b79f8f Mon Sep 17 00:00:00 2001 From: randomizedcoder Date: Thu, 22 Oct 2026 07:19:14 -0700 Subject: [PATCH 02/10] rocmPackages_10.rocsparse: init at 10.1 Update the rocmPackages.rocsparse copy from the previous commit to ROCm 10.1 and add it to the rocmPackages_10 scope. Source/version bump only. Assisted-by: Claude Code (claude-opus-5-5) --- pkgs/development/rocm-modules/10/default.nix | 2 ++ pkgs/development/rocm-modules/10/rocsparse/default.nix | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/development/rocm-modules/10/default.nix b/pkgs/development/rocm-modules/10/default.nix index 3154983f16e31..568f502b69f2c 100644 --- a/pkgs/development/rocm-modules/10/default.nix +++ b/pkgs/development/rocm-modules/10/default.nix @@ -105,6 +105,8 @@ let rocprim = self.callPackage ./rocprim { }; + rocsparse = self.callPackage ./rocsparse { }; + rocthrust = self.callPackage ./rocthrust { }; rocrand = self.callPackage ./rocrand { }; diff --git a/pkgs/development/rocm-modules/10/rocsparse/default.nix b/pkgs/development/rocm-modules/10/rocsparse/default.nix index db7b0b156850a..a25210f1c7883 100644 --- a/pkgs/development/rocm-modules/10/rocsparse/default.nix +++ b/pkgs/development/rocm-modules/10/rocsparse/default.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocsparse${clr.gpuArchSuffix}"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -35,12 +35,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocsparse" "shared" ]; - hash = "sha256-hkfBTcLig39al2w8zFTSQQnouaou9wlD6VlvIyFTNMg="; + hash = "sha256-CdUH85q4ZwZh+1OwzOMvLhE0LSwkAl4RzBSjhY1xuGo="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocsparse"; From 10bc4fe214a5a02650557869710c9ce3a3be745e Mon Sep 17 00:00:00 2001 From: randomizedcoder Date: Thu, 22 Oct 2026 07:19:14 -0700 Subject: [PATCH 03/10] rocmPackages_10.hipsparse: init at 10.1 Update the rocmPackages.hipsparse copy from the previous commit to ROCm 10.1 and add it to the rocmPackages_10 scope. From the mass bump: - hipblas, hipsparse: new find_package(Python3 REQUIRED) -> add python3. Assisted-by: Claude Code (claude-opus-5-5) --- pkgs/development/rocm-modules/10/default.nix | 2 ++ pkgs/development/rocm-modules/10/hipsparse/default.nix | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/development/rocm-modules/10/default.nix b/pkgs/development/rocm-modules/10/default.nix index 568f502b69f2c..62e738541711e 100644 --- a/pkgs/development/rocm-modules/10/default.nix +++ b/pkgs/development/rocm-modules/10/default.nix @@ -123,6 +123,8 @@ let hipcub = self.callPackage ./hipcub { }; + hipsparse = self.callPackage ./hipsparse { }; + hipfft = self.callPackage ./hipfft { }; tensile = pyPackages.callPackage ./tensile { diff --git a/pkgs/development/rocm-modules/10/hipsparse/default.nix b/pkgs/development/rocm-modules/10/hipsparse/default.nix index 7057fb8ceb5b0..c26c9b742c8d5 100644 --- a/pkgs/development/rocm-modules/10/hipsparse/default.nix +++ b/pkgs/development/rocm-modules/10/hipsparse/default.nix @@ -5,6 +5,7 @@ rocmUpdateScript, cmake, rocm-cmake, + python3, rocsparse, clr, gfortran, @@ -19,7 +20,7 @@ # This can also use cuSPARSE as a backend instead of rocSPARSE stdenv.mkDerivation (finalAttrs: { pname = "hipsparse"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -34,18 +35,20 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/hipsparse" "shared" ]; - hash = "sha256-E1chG+giFtf02fjutoV4yM2XvrQKjgXRSvxs0NBBkvI="; + hash = "sha256-kvDzX1SnvumRgj+Va+zFPbU93dZttIE/ovL4BPG2Xi0="; }; sourceRoot = "${finalAttrs.src.name}/projects/hipsparse"; nativeBuildInputs = [ cmake rocm-cmake + # CMakeLists.txt does find_package(Python3 REQUIRED) + python3 clr gfortran ]; From df9c71a953befc9ed75fa2154add0cb1baaf9230 Mon Sep 17 00:00:00 2001 From: randomizedcoder Date: Thu, 22 Oct 2026 07:19:15 -0700 Subject: [PATCH 04/10] rocmPackages_10.rocsolver: init at 10.1 Update the rocmPackages.rocsolver copy from the previous commit to ROCm 10.1 and add it to the rocmPackages_10 scope. From "rocmPackages.{hipsolver,rocsolver}: link openblas-backed LAPACK": ROCm 10 hipSOLVER/rocSOLVER link a CPU-side BLAS/LAPACK. Upstream defaults to git-clone+build a static OpenBLAS at configure (blocked in the sandbox), so set HIPSOLVER_INTERNAL_LAPACK_BUILD=OFF and provide the openblas-backed 'blas'/'lapack' wrappers (LP64). Deliberately NOT lapack-reference: its libblas.so.3 carries ILP64 (_64_) symbols that collide with numpy's openblas in one process (e.g. 'import torch' -> undefined symbol cherk_64_). Discover LAPACK in CMake MODULE mode, since the openblas wrappers ship no LAPACKConfig.cmake. Assisted-by: Claude Code (claude-opus-5-5) --- pkgs/development/rocm-modules/10/default.nix | 2 ++ .../rocm-modules/10/rocsolver/default.nix | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pkgs/development/rocm-modules/10/default.nix b/pkgs/development/rocm-modules/10/default.nix index 62e738541711e..827b01578b639 100644 --- a/pkgs/development/rocm-modules/10/default.nix +++ b/pkgs/development/rocm-modules/10/default.nix @@ -140,6 +140,8 @@ let rocblas_base = self.callPackage ./rocblas/base.nix { }; rocblas = self.callPackage ./rocblas { }; + rocsolver = self.callPackage ./rocsolver { }; + hipblas-common = self.callPackage ./hipblas-common { }; hipblaslt = self.callPackage ./hipblaslt { }; diff --git a/pkgs/development/rocm-modules/10/rocsolver/default.nix b/pkgs/development/rocm-modules/10/rocsolver/default.nix index a70d06e30efc7..d9c3a00ad3392 100644 --- a/pkgs/development/rocm-modules/10/rocsolver/default.nix +++ b/pkgs/development/rocm-modules/10/rocsolver/default.nix @@ -12,7 +12,8 @@ fmt, gtest, gfortran, - lapack-reference, + blas, + lapack, buildTests ? false, buildBenchmarks ? false, gpuTargets ? ( @@ -37,7 +38,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocsolver${clr.gpuArchSuffix}"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -52,12 +53,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocsolver" "shared" ]; - hash = "sha256-n+Y8RheA0UYeSfpvOw5zfwe4VAW5hsKjlCXtBceGhf0="; + hash = "sha256-hqCOQ5frigvHc21MBnjPJff6pQNm+JjzelwO8NR9dXo="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocsolver"; @@ -84,7 +85,10 @@ stdenv.mkDerivation (finalAttrs: { gtest ] ++ lib.optionals (buildTests || buildBenchmarks) [ - lapack-reference + # openblas-backed wrappers, not lapack-reference (avoids the ILP64 libblas.so.3 + # soname collision — see hipsolver). + blas + lapack ]; cmakeFlags = [ From 4424ea1ce89ab95d64457749b26423c8dd6e57b9 Mon Sep 17 00:00:00 2001 From: randomizedcoder Date: Thu, 22 Oct 2026 07:19:16 -0700 Subject: [PATCH 05/10] rocmPackages_10.hipblas: init at 10.1 Update the rocmPackages.hipblas copy from the previous commit to ROCm 10.1 and add it to the rocmPackages_10 scope. From the mass bump: - hipblas, hipsparse: new find_package(Python3 REQUIRED) -> add python3. Assisted-by: Claude Code (claude-opus-5-5) --- pkgs/development/rocm-modules/10/default.nix | 2 ++ pkgs/development/rocm-modules/10/hipblas/default.nix | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/development/rocm-modules/10/default.nix b/pkgs/development/rocm-modules/10/default.nix index 827b01578b639..636d8fd1935db 100644 --- a/pkgs/development/rocm-modules/10/default.nix +++ b/pkgs/development/rocm-modules/10/default.nix @@ -144,6 +144,8 @@ let hipblas-common = self.callPackage ./hipblas-common { }; + hipblas = self.callPackage ./hipblas { }; + hipblaslt = self.callPackage ./hipblaslt { }; half = self.callPackage ./half { }; diff --git a/pkgs/development/rocm-modules/10/hipblas/default.nix b/pkgs/development/rocm-modules/10/hipblas/default.nix index af6c620211805..0915099dddba8 100644 --- a/pkgs/development/rocm-modules/10/hipblas/default.nix +++ b/pkgs/development/rocm-modules/10/hipblas/default.nix @@ -5,6 +5,7 @@ rocmUpdateScript, cmake, rocm-cmake, + python3, clr, gfortran, hipblas-common, @@ -24,7 +25,7 @@ # Can also use cuBLAS stdenv.mkDerivation (finalAttrs: { pname = "hipblas"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -42,12 +43,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/hipblas" "shared" ]; - hash = "sha256-1+aNDotV5liHBnGddmWtaKYCcsWPxQD3AoEubnghV0M="; + hash = "sha256-VUM+5qu8VK6fUbKPCVMm0PtmuZhJZYfEI6aKJEV9Vwg="; }; sourceRoot = "${finalAttrs.src.name}/projects/hipblas"; @@ -59,6 +60,8 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake + # CMakeLists.txt does find_package(Python3 REQUIRED) + python3 clr gfortran ]; From 9b39b486a5ec0e092303e51ab07163b0a05c8611 Mon Sep 17 00:00:00 2001 From: randomizedcoder Date: Thu, 22 Oct 2026 07:19:16 -0700 Subject: [PATCH 06/10] rocmPackages_10.hipsolver: init at 10.1 Update the rocmPackages.hipsolver copy from the previous commit to ROCm 10.1 and add it to the rocmPackages_10 scope. From "rocmPackages.{hipsolver,rocsolver}: link openblas-backed LAPACK": ROCm 10 hipSOLVER/rocSOLVER link a CPU-side BLAS/LAPACK. Upstream defaults to git-clone+build a static OpenBLAS at configure (blocked in the sandbox), so set HIPSOLVER_INTERNAL_LAPACK_BUILD=OFF and provide the openblas-backed 'blas'/'lapack' wrappers (LP64). Deliberately NOT lapack-reference: its libblas.so.3 carries ILP64 (_64_) symbols that collide with numpy's openblas in one process (e.g. 'import torch' -> undefined symbol cherk_64_). Discover LAPACK in CMake MODULE mode, since the openblas wrappers ship no LAPACKConfig.cmake. Assisted-by: Claude Code (claude-opus-5-5) --- pkgs/development/rocm-modules/10/default.nix | 2 ++ .../rocm-modules/10/hipsolver/default.nix | 20 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/pkgs/development/rocm-modules/10/default.nix b/pkgs/development/rocm-modules/10/default.nix index 636d8fd1935db..440c12459bacb 100644 --- a/pkgs/development/rocm-modules/10/default.nix +++ b/pkgs/development/rocm-modules/10/default.nix @@ -142,6 +142,8 @@ let rocsolver = self.callPackage ./rocsolver { }; + hipsolver = self.callPackage ./hipsolver { }; + hipblas-common = self.callPackage ./hipblas-common { }; hipblas = self.callPackage ./hipblas { }; diff --git a/pkgs/development/rocm-modules/10/hipsolver/default.nix b/pkgs/development/rocm-modules/10/hipsolver/default.nix index c0f548bf7d1e9..cfc00ed7b406a 100644 --- a/pkgs/development/rocm-modules/10/hipsolver/default.nix +++ b/pkgs/development/rocm-modules/10/hipsolver/default.nix @@ -12,7 +12,8 @@ rocsparse, suitesparse, gtest, - lapack-reference, + blas, + lapack, buildTests ? false, buildBenchmarks ? false, buildSamples ? false, @@ -21,7 +22,7 @@ # Can also use cuSOLVER stdenv.mkDerivation (finalAttrs: { pname = "hipsolver"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -39,12 +40,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/hipsolver" "shared" ]; - hash = "sha256-ts5wuXHoBFZ1WMAk8Ir5cucP75G0SMOWmn3FEH04ZEQ="; + hash = "sha256-Djncqth/JEH1ko0iVvx3WdvK2UeK/Ywuwca9y4q2Xvg="; }; sourceRoot = "${finalAttrs.src.name}/projects/hipsolver"; @@ -60,12 +61,13 @@ stdenv.mkDerivation (finalAttrs: { rocsolver rocsparse suitesparse + # CPU LAPACK for geev. Not lapack-reference: its ILP64 libblas.so.3 breaks + # `import torch` ("undefined symbol: cherk_64_"). + blas + lapack ] ++ lib.optionals buildTests [ gtest - ] - ++ lib.optionals (buildTests || buildBenchmarks) [ - lapack-reference ]; cmakeFlags = [ @@ -76,6 +78,10 @@ stdenv.mkDerivation (finalAttrs: { "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_INCLUDEDIR=include" "-DBUILD_WITH_SPARSE=OFF" # FIXME: broken - can't find suitesparse/cholmod, looks fixed in master + # Don't clone and build OpenBLAS at configure time. + "-DHIPSOLVER_INTERNAL_LAPACK_BUILD=OFF" + # The openblas-backed wrappers ship no LAPACKConfig.cmake. + "-DHIPSOLVER_FIND_PACKAGE_LAPACK_CONFIG=OFF" ] ++ lib.optionals buildTests [ "-DBUILD_CLIENTS_TESTS=ON" From 07f20883f5f18bdc8629e1d2a569648e122c6404 Mon Sep 17 00:00:00 2001 From: randomizedcoder Date: Thu, 22 Oct 2026 07:19:17 -0700 Subject: [PATCH 07/10] rocmPackages_10.rocalution: init at 10.1 Update the rocmPackages.rocalution copy from the previous commit to ROCm 10.1 and add it to the rocmPackages_10 scope. From the mass bump: - rocalution, rpp: moved into the rocm-libraries monorepo (sparse Assisted-by: Claude Code (claude-opus-5-5) --- pkgs/development/rocm-modules/10/default.nix | 2 ++ .../rocm-modules/10/rocalution/default.nix | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/development/rocm-modules/10/default.nix b/pkgs/development/rocm-modules/10/default.nix index 440c12459bacb..64a17f94a5bc8 100644 --- a/pkgs/development/rocm-modules/10/default.nix +++ b/pkgs/development/rocm-modules/10/default.nix @@ -142,6 +142,8 @@ let rocsolver = self.callPackage ./rocsolver { }; + rocalution = self.callPackage ./rocalution { }; + hipsolver = self.callPackage ./hipsolver { }; hipblas-common = self.callPackage ./hipblas-common { }; diff --git a/pkgs/development/rocm-modules/10/rocalution/default.nix b/pkgs/development/rocm-modules/10/rocalution/default.nix index 8fd50e6fc589b..a08359d89b146 100644 --- a/pkgs/development/rocm-modules/10/rocalution/default.nix +++ b/pkgs/development/rocm-modules/10/rocalution/default.nix @@ -22,7 +22,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocalution"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -39,10 +39,16 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; - repo = "rocALUTION"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-yPM26e8tGNpPScIriAPRb+6OZfdpX4PgE0E9bmc3FkU="; + # rocALUTION moved into the rocm-libraries monorepo during the TheRock 7.x series + repo = "rocm-libraries"; + tag = "therock-${finalAttrs.version}"; + sparseCheckout = [ + "projects/rocalution" + "shared" + ]; + hash = "sha256-peElY9WF9GbITUkeUwW0Ys8UYrUeXQ3Go7uWYGvMZBY="; }; + sourceRoot = "${finalAttrs.src.name}/projects/rocalution"; nativeBuildInputs = [ cmake From 998367b9b3d6f881c2160cffdbbab7e504cf1038 Mon Sep 17 00:00:00 2001 From: randomizedcoder Date: Thu, 22 Oct 2026 07:19:17 -0700 Subject: [PATCH 08/10] rocmPackages_10.rocwmma: init at 10.1 Update the rocmPackages.rocwmma copy from the previous commit to ROCm 10.1 and add it to the rocmPackages_10 scope. From "rocmPackages.rocwmma: rocm_smi -> amd_smi, system googletest": ROCm 10 rocWMMA's benchmark tests find_package(amd_smi) (was rocm_smi) and replaced the hardcoded FetchContent(googletest) with a ROCWMMA_USE_SYSTEM_GOOGLETEST option. Switch to amdsmi, enable the system-gtest option, and drop the obsolete 0000-dont-fetch-googletest.patch. Assisted-by: Claude Code (claude-opus-5-5) --- pkgs/development/rocm-modules/10/default.nix | 2 ++ .../rocwmma/0000-dont-fetch-googletest.patch | 35 ------------------- .../rocm-modules/10/rocwmma/default.nix | 19 +++++----- 3 files changed, 12 insertions(+), 44 deletions(-) delete mode 100644 pkgs/development/rocm-modules/10/rocwmma/0000-dont-fetch-googletest.patch diff --git a/pkgs/development/rocm-modules/10/default.nix b/pkgs/development/rocm-modules/10/default.nix index 64a17f94a5bc8..1238c93ec6ddd 100644 --- a/pkgs/development/rocm-modules/10/default.nix +++ b/pkgs/development/rocm-modules/10/default.nix @@ -142,6 +142,8 @@ let rocsolver = self.callPackage ./rocsolver { }; + rocwmma = self.callPackage ./rocwmma { }; + rocalution = self.callPackage ./rocalution { }; hipsolver = self.callPackage ./hipsolver { }; diff --git a/pkgs/development/rocm-modules/10/rocwmma/0000-dont-fetch-googletest.patch b/pkgs/development/rocm-modules/10/rocwmma/0000-dont-fetch-googletest.patch deleted file mode 100644 index fa47a3c42249b..0000000000000 --- a/pkgs/development/rocm-modules/10/rocwmma/0000-dont-fetch-googletest.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt -index 0d00883..86ce282 100644 ---- a/test/CMakeLists.txt -+++ b/test/CMakeLists.txt -@@ -30,30 +30,6 @@ cmake_dependent_option( ROCWMMA_BUILD_VALIDATION_TESTS "Build validation tests" - cmake_dependent_option( ROCWMMA_BUILD_BENCHMARK_TESTS "Build benchmarking tests" OFF "ROCWMMA_BUILD_TESTS" OFF ) - cmake_dependent_option( ROCWMMA_BUILD_EXTENDED_TESTS "Build extended test parameter coverage" OFF "ROCWMMA_BUILD_TESTS" OFF ) - --# Test/benchmark requires additional dependencies --include( FetchContent ) -- --FetchContent_Declare( -- googletest -- GIT_REPOSITORY https://github.com/google/googletest.git -- GIT_TAG release-1.12.1 --) --FetchContent_GetProperties(googletest) --if(NOT googletest_POPULATED) -- -- # Fetch the content using default details -- FetchContent_Populate(googletest) -- # Save the shared libs setting, then force to static libs -- set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS}) -- set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Build SHARED libraries" FORCE) -- -- # Add gtest targets as static libs -- add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) -- -- # Restore shared libs setting -- set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_OLD} CACHE INTERNAL "Build SHARED libraries" FORCE) --endif() -- - set(ROCWMMA_TEST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) - set(ROCWMMA_COMMON_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/hip_device.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rocwmma_gtest_main.cpp) diff --git a/pkgs/development/rocm-modules/10/rocwmma/default.nix b/pkgs/development/rocm-modules/10/rocwmma/default.nix index 454cced2a0fdd..bf9c553de5115 100644 --- a/pkgs/development/rocm-modules/10/rocwmma/default.nix +++ b/pkgs/development/rocm-modules/10/rocwmma/default.nix @@ -5,7 +5,7 @@ rocmUpdateScript, cmake, rocm-cmake, - rocm-smi, + amdsmi, clr, openmp, gtest, @@ -19,7 +19,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocwmma"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -37,19 +37,15 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocwmma" "shared" ]; - hash = "sha256-eoF8a7zknpgvDOSDzolOrdtszUJ5tC7Ur2sRShiQEO0="; + hash = "sha256-RvhZH4VVJLpj9ThF3MuvUPsAC7Y4BBTdIAReq7NyX3A="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocwmma"; - patches = lib.optionals (buildTests || buildBenchmarks) [ - ./0000-dont-fetch-googletest.patch - ]; - nativeBuildInputs = [ cmake rocm-cmake @@ -60,7 +56,8 @@ stdenv.mkDerivation (finalAttrs: { openmp ] ++ lib.optionals (buildTests || buildBenchmarks) [ - rocm-smi + # rocWMMA's benchmark tests do find_package(amd_smi) + amdsmi gtest rocblas ]; @@ -74,6 +71,10 @@ stdenv.mkDerivation (finalAttrs: { "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_INCLUDEDIR=include" ] + ++ lib.optionals (buildTests || buildBenchmarks) [ + # Use nixpkgs gtest instead of the upstream FetchContent googletest download + "-DROCWMMA_USE_SYSTEM_GOOGLETEST=ON" + ] ++ lib.optionals (gpuTargets != [ ]) [ "-DGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" ] From f2fe03b7459193df490c64912612ce5b9f8e51d4 Mon Sep 17 00:00:00 2001 From: randomizedcoder Date: Thu, 22 Oct 2026 07:19:18 -0700 Subject: [PATCH 09/10] rocmPackages_10.hipfort: init at 10.1.0 Update the rocmPackages.hipfort copy from the previous commit to ROCm 10.1 and add it to the rocmPackages_10 scope. From "rocmPackages.hipfort: 7.2.4 -> 10.1.0": hipfort keeps the three-component rocm-X.Y.Z tag scheme (rocm-10.1.0), so it is not derived from the therock-X.Y monorepo tags like the rest of the set. hipfort 10.x dropped the bin/ wrapper scripts (hipfc, mymcpu) entirely and is now a pure Fortran interface library, so the obsolete bin/ postPatch and meta.mainProgram are removed. Assisted-by: Claude Code (claude-opus-5-5) --- pkgs/development/rocm-modules/10/default.nix | 2 ++ .../rocm-modules/10/hipfort/default.nix | 19 ++----------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/pkgs/development/rocm-modules/10/default.nix b/pkgs/development/rocm-modules/10/default.nix index 1238c93ec6ddd..0cbb030a9d7a4 100644 --- a/pkgs/development/rocm-modules/10/default.nix +++ b/pkgs/development/rocm-modules/10/default.nix @@ -125,6 +125,8 @@ let hipsparse = self.callPackage ./hipsparse { }; + hipfort = self.callPackage ./hipfort { }; + hipfft = self.callPackage ./hipfft { }; tensile = pyPackages.callPackage ./tensile { diff --git a/pkgs/development/rocm-modules/10/hipfort/default.nix b/pkgs/development/rocm-modules/10/hipfort/default.nix index 72519db7b0458..c8430de356c89 100644 --- a/pkgs/development/rocm-modules/10/hipfort/default.nix +++ b/pkgs/development/rocm-modules/10/hipfort/default.nix @@ -10,13 +10,13 @@ stdenv.mkDerivation (finalAttrs: { pname = "hipfort"; - version = "7.2.4"; + version = "10.1.0"; src = fetchFromGitHub { owner = "ROCm"; repo = "hipfort"; tag = "rocm-${finalAttrs.version}"; - hash = "sha256-XaB4jauCN41tgD1YHHA2td/yckwfMBemBe/iL0SCxQo="; + hash = "sha256-/Q/wVXkJJjDSsqVRSdtMPyOw72SRDawxnyv4BY0be8g="; }; __structuredAttrs = true; @@ -42,20 +42,6 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include") ]; - postPatch = '' - patchShebangs bin - - substituteInPlace bin/hipfc bin/mymcpu \ - --replace-fail "/bin/cat" "cat" - - substituteInPlace bin/CMakeLists.txt \ - --replace-fail "/bin/mkdir" "mkdir" \ - --replace-fail "/bin/cp" "cp" \ - --replace-fail "/bin/sed" "sed" \ - --replace-fail "/bin/chmod" "chmod" \ - --replace-fail "/bin/ln" "ln" - ''; - passthru.updateScript = rocmUpdateScript { inherit finalAttrs; }; meta = { @@ -63,7 +49,6 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://github.com/ROCm/hipfort"; changelog = "https://github.com/ROCm/hipfort/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.mit; # mitx11 - mainProgram = "hipfc"; teams = [ lib.teams.rocm ]; platforms = lib.platforms.linux; }; From 3988705038b6ec26ec88862e1d4567e8cc1b5117 Mon Sep 17 00:00:00 2001 From: randomizedcoder Date: Thu, 22 Oct 2026 07:19:19 -0700 Subject: [PATCH 10/10] rocmPackages_10.hipsparselt: init at 10.1 Update the rocmPackages.hipsparselt copy from the previous commit to ROCm 10.1 and add it to the rocmPackages_10 scope. From "rocmPackages.hipsparselt: add hipblaslt device-library/stinkytofu sources": ROCm 10 hipsparselt configures hipBLASLt's CMakeLists (for rocisa), which needs library/include/hipblaslt-version.h.in and add_subdirectory's shared/stinkytofu. Extend the sparse checkout. Revised during the split review: Drop the stinkytofu clang-tidy workaround: therock-10.1 guards its include(ClangTidy) with ENABLE_CLANG_TIDY. Drop the HOME override; disabling the helper cache is enough, as hipBLASLt shows. Assisted-by: Claude Code (claude-opus-5-5) --- pkgs/development/rocm-modules/10/default.nix | 2 ++ .../rocm-modules/10/hipsparselt/default.nix | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/development/rocm-modules/10/default.nix b/pkgs/development/rocm-modules/10/default.nix index 0cbb030a9d7a4..709e07e947f7e 100644 --- a/pkgs/development/rocm-modules/10/default.nix +++ b/pkgs/development/rocm-modules/10/default.nix @@ -156,6 +156,8 @@ let hipblaslt = self.callPackage ./hipblaslt { }; + hipsparselt = self.callPackage ./hipsparselt { }; + half = self.callPackage ./half { }; # Even if config.rocmSupport is false we need rocmSupport true diff --git a/pkgs/development/rocm-modules/10/hipsparselt/default.nix b/pkgs/development/rocm-modules/10/hipsparselt/default.nix index 9cd7c710a6d6c..297f261ce9557 100644 --- a/pkgs/development/rocm-modules/10/hipsparselt/default.nix +++ b/pkgs/development/rocm-modules/10/hipsparselt/default.nix @@ -43,19 +43,23 @@ let in stdenv.mkDerivation (finalAttrs: { pname = "hipsparselt${clr.gpuArchSuffix}"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-Al/0yZPn/wqtBFQU1FcGoSquDMObk6HQ3D5sSh5biHg="; + tag = "therock-${finalAttrs.version}"; + hash = "sha256-pJvsJv007YCXR4YiOq3qFWlcDFoGxwKovNSk0Mjxnes="; sparseCheckout = [ "projects/hipsparselt" "projects/hipblaslt/tensilelite" "projects/hipblaslt/cmake" "projects/hipblaslt/device-library" + # hipBLASLt's CMakeLists, configured for rocisa, needs hipblaslt-version.h.in. + "projects/hipblaslt/library/include" "shared/origami" + # rocisa (tensilelite/rocisa/CMakeLists.txt) add_subdirectory's stinkytofu + "shared/stinkytofu" ]; }; sourceRoot = "${finalAttrs.src.name}/projects/hipsparselt"; @@ -64,6 +68,9 @@ stdenv.mkDerivation (finalAttrs: { env.ROCM_PATH = "${clr}"; env.TENSILE_ROCM_ASSEMBLER_PATH = lib.getExe' clr "amdclang++"; env.TENSILE_GEN_ASSEMBLY_TOOLCHAIN = lib.getExe' clr "amdclang++"; + # The tensilelite helper cache defaults to the unwritable $HOME/.tensile. + env.TENSILE_DISABLE_HELPER_CACHE = "1"; + requiredSystemFeatures = [ "big-parallel" ]; __structuredAttrs = true;