diff --git a/pkgs/development/rocm-modules/10/default.nix b/pkgs/development/rocm-modules/10/default.nix
index 3154983f16e31..709e07e947f7e 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 { };
@@ -121,6 +123,10 @@ let
hipcub = self.callPackage ./hipcub { };
+ hipsparse = self.callPackage ./hipsparse { };
+
+ hipfort = self.callPackage ./hipfort { };
+
hipfft = self.callPackage ./hipfft { };
tensile = pyPackages.callPackage ./tensile {
@@ -136,10 +142,22 @@ let
rocblas_base = self.callPackage ./rocblas/base.nix { };
rocblas = self.callPackage ./rocblas { };
+ rocsolver = self.callPackage ./rocsolver { };
+
+ rocwmma = self.callPackage ./rocwmma { };
+
+ rocalution = self.callPackage ./rocalution { };
+
+ hipsolver = self.callPackage ./hipsolver { };
+
hipblas-common = self.callPackage ./hipblas-common { };
+ hipblas = self.callPackage ./hipblas { };
+
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/hipblas/default.nix b/pkgs/development/rocm-modules/10/hipblas/default.nix
new file mode 100644
index 0000000000000..0915099dddba8
--- /dev/null
+++ b/pkgs/development/rocm-modules/10/hipblas/default.nix
@@ -0,0 +1,135 @@
+{
+ lib,
+ stdenv,
+ fetchFromGitHub,
+ rocmUpdateScript,
+ cmake,
+ rocm-cmake,
+ python3,
+ 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 = "10.1";
+
+ outputs = [
+ "out"
+ ]
+ ++ lib.optionals buildTests [
+ "test"
+ ]
+ ++ lib.optionals buildBenchmarks [
+ "benchmark"
+ ]
+ ++ lib.optionals buildSamples [
+ "sample"
+ ];
+
+ src = fetchFromGitHub {
+ owner = "ROCm";
+ repo = "rocm-libraries";
+ tag = "therock-${finalAttrs.version}";
+ sparseCheckout = [
+ "projects/hipblas"
+ "shared"
+ ];
+ hash = "sha256-VUM+5qu8VK6fUbKPCVMm0PtmuZhJZYfEI6aKJEV9Vwg=";
+ };
+ sourceRoot = "${finalAttrs.src.name}/projects/hipblas";
+
+ postPatch = ''
+ substituteInPlace library/CMakeLists.txt \
+ --replace-fail "find_package(Git REQUIRED)" ""
+ '';
+
+ nativeBuildInputs = [
+ cmake
+ rocm-cmake
+ # CMakeLists.txt does find_package(Python3 REQUIRED)
+ python3
+ 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..c8430de356c89
--- /dev/null
+++ b/pkgs/development/rocm-modules/10/hipfort/default.nix
@@ -0,0 +1,55 @@
+{
+ lib,
+ stdenv,
+ fetchFromGitHub,
+ rocmUpdateScript,
+ cmake,
+ rocm-cmake,
+ gfortran,
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+ pname = "hipfort";
+ version = "10.1.0";
+
+ src = fetchFromGitHub {
+ owner = "ROCm";
+ repo = "hipfort";
+ tag = "rocm-${finalAttrs.version}";
+ hash = "sha256-/Q/wVXkJJjDSsqVRSdtMPyOw72SRDawxnyv4BY0be8g=";
+ };
+
+ __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")
+ ];
+
+ 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
+ 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..cfc00ed7b406a
--- /dev/null
+++ b/pkgs/development/rocm-modules/10/hipsolver/default.nix
@@ -0,0 +1,123 @@
+{
+ lib,
+ stdenv,
+ fetchFromGitHub,
+ rocmUpdateScript,
+ cmake,
+ rocm-cmake,
+ clr,
+ gfortran,
+ rocblas,
+ rocsolver,
+ rocsparse,
+ suitesparse,
+ gtest,
+ blas,
+ lapack,
+ buildTests ? false,
+ buildBenchmarks ? false,
+ buildSamples ? false,
+}:
+
+# Can also use cuSOLVER
+stdenv.mkDerivation (finalAttrs: {
+ pname = "hipsolver";
+ version = "10.1";
+
+ outputs = [
+ "out"
+ ]
+ ++ lib.optionals buildTests [
+ "test"
+ ]
+ ++ lib.optionals buildBenchmarks [
+ "benchmark"
+ ]
+ ++ lib.optionals buildSamples [
+ "sample"
+ ];
+
+ src = fetchFromGitHub {
+ owner = "ROCm";
+ repo = "rocm-libraries";
+ tag = "therock-${finalAttrs.version}";
+ sparseCheckout = [
+ "projects/hipsolver"
+ "shared"
+ ];
+ hash = "sha256-Djncqth/JEH1ko0iVvx3WdvK2UeK/Ywuwca9y4q2Xvg=";
+ };
+ sourceRoot = "${finalAttrs.src.name}/projects/hipsolver";
+
+ nativeBuildInputs = [
+ cmake
+ rocm-cmake
+ clr
+ gfortran
+ ];
+
+ buildInputs = [
+ rocblas
+ 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
+ ];
+
+ 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
+ # 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"
+ ]
+ ++ 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..c26c9b742c8d5
--- /dev/null
+++ b/pkgs/development/rocm-modules/10/hipsparse/default.nix
@@ -0,0 +1,151 @@
+{
+ lib,
+ stdenv,
+ fetchFromGitHub,
+ rocmUpdateScript,
+ cmake,
+ rocm-cmake,
+ python3,
+ 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 = "10.1";
+
+ outputs = [
+ "out"
+ ]
+ ++ lib.optionals buildTests [
+ "test"
+ ]
+ ++ lib.optionals buildSamples [
+ "sample"
+ ];
+
+ src = fetchFromGitHub {
+ owner = "ROCm";
+ repo = "rocm-libraries";
+ tag = "therock-${finalAttrs.version}";
+ sparseCheckout = [
+ "projects/hipsparse"
+ "shared"
+ ];
+ 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
+ ];
+
+ 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..297f261ce9557
--- /dev/null
+++ b/pkgs/development/rocm-modules/10/hipsparselt/default.nix
@@ -0,0 +1,130 @@
+{
+ 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 = "10.1";
+
+ src = fetchFromGitHub {
+ owner = "ROCm";
+ repo = "rocm-libraries";
+ 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";
+
+ 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++";
+ # The tensilelite helper cache defaults to the unwritable $HOME/.tensile.
+ env.TENSILE_DISABLE_HELPER_CACHE = "1";
+
+ 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..a08359d89b146
--- /dev/null
+++ b/pkgs/development/rocm-modules/10/rocalution/default.nix
@@ -0,0 +1,128 @@
+{
+ 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 = "10.1";
+
+ outputs = [
+ "out"
+ ]
+ ++ lib.optionals buildTests [
+ "test"
+ ]
+ ++ lib.optionals buildBenchmarks [
+ "benchmark"
+ ]
+ ++ lib.optionals buildSamples [
+ "sample"
+ ];
+
+ src = fetchFromGitHub {
+ owner = "ROCm";
+ # 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
+ 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..d9c3a00ad3392
--- /dev/null
+++ b/pkgs/development/rocm-modules/10/rocsolver/default.nix
@@ -0,0 +1,139 @@
+{
+ lib,
+ stdenv,
+ fetchFromGitHub,
+ rocmUpdateScript,
+ cmake,
+ rocm-cmake,
+ rocblas,
+ rocprim,
+ rocsparse,
+ clr,
+ fmt,
+ gtest,
+ gfortran,
+ blas,
+ lapack,
+ 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 = "10.1";
+
+ outputs = [
+ "out"
+ ]
+ ++ lib.optionals buildTests [
+ "test"
+ ]
+ ++ lib.optionals buildBenchmarks [
+ "benchmark"
+ ];
+
+ src = fetchFromGitHub {
+ owner = "ROCm";
+ repo = "rocm-libraries";
+ tag = "therock-${finalAttrs.version}";
+ sparseCheckout = [
+ "projects/rocsolver"
+ "shared"
+ ];
+ hash = "sha256-hqCOQ5frigvHc21MBnjPJff6pQNm+JjzelwO8NR9dXo=";
+ };
+ 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) [
+ # openblas-backed wrappers, not lapack-reference (avoids the ILP64 libblas.so.3
+ # soname collision — see hipsolver).
+ blas
+ lapack
+ ];
+
+ 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..a25210f1c7883
--- /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 = "10.1";
+
+ outputs = [
+ "out"
+ ]
+ ++ lib.optionals (buildTests || buildBenchmarks) [
+ "test"
+ ]
+ ++ lib.optionals buildBenchmarks [
+ "benchmark"
+ ];
+
+ src = fetchFromGitHub {
+ owner = "ROCm";
+ repo = "rocm-libraries";
+ tag = "therock-${finalAttrs.version}";
+ sparseCheckout = [
+ "projects/rocsparse"
+ "shared"
+ ];
+ hash = "sha256-CdUH85q4ZwZh+1OwzOMvLhE0LSwkAl4RzBSjhY1xuGo=";
+ };
+ 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/default.nix b/pkgs/development/rocm-modules/10/rocwmma/default.nix
new file mode 100644
index 0000000000000..bf9c553de5115
--- /dev/null
+++ b/pkgs/development/rocm-modules/10/rocwmma/default.nix
@@ -0,0 +1,117 @@
+{
+ lib,
+ stdenv,
+ fetchFromGitHub,
+ rocmUpdateScript,
+ cmake,
+ rocm-cmake,
+ amdsmi,
+ 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 = "10.1";
+
+ outputs = [
+ "out"
+ ]
+ ++ lib.optionals (buildTests || buildBenchmarks) [
+ "test"
+ ]
+ ++ lib.optionals buildBenchmarks [
+ "benchmark"
+ ]
+ ++ lib.optionals buildSamples [
+ "sample"
+ ];
+
+ src = fetchFromGitHub {
+ owner = "ROCm";
+ repo = "rocm-libraries";
+ tag = "therock-${finalAttrs.version}";
+ sparseCheckout = [
+ "projects/rocwmma"
+ "shared"
+ ];
+ hash = "sha256-RvhZH4VVJLpj9ThF3MuvUPsAC7Y4BBTdIAReq7NyX3A=";
+ };
+ sourceRoot = "${finalAttrs.src.name}/projects/rocwmma";
+
+ nativeBuildInputs = [
+ cmake
+ rocm-cmake
+ clr
+ ];
+
+ buildInputs = [
+ openmp
+ ]
+ ++ lib.optionals (buildTests || buildBenchmarks) [
+ # rocWMMA's benchmark tests do find_package(amd_smi)
+ amdsmi
+ 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 (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}"
+ ]
+ ++ 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;
+ };
+})