diff --git a/pkgs/development/compilers/hip/default.nix b/pkgs/development/compilers/hip/default.nix index dce3dab727f47..60400f38bb7dd 100644 --- a/pkgs/development/compilers/hip/default.nix +++ b/pkgs/development/compilers/hip/default.nix @@ -14,6 +14,7 @@ , numactl , perl , python3 +, python3Packages , rocclr , rocm-comgr , rocm-device-libs @@ -29,13 +30,13 @@ let hip = stdenv.mkDerivation rec { pname = "hip"; - version = "5.3.0"; + version = "5.3.1"; src = fetchFromGitHub { owner = "ROCm-Developer-Tools"; repo = "HIP"; rev = "rocm-${version}"; - hash = "sha256-UAodlVUiTU4n/EyvTIuQekTGh4izmBjKCRXOHXVKY4M="; + hash = "sha256-kmRvrwnT0h2dBMI+H9d1vmeW3TmDBD+qW4YYhaMV2dE="; }; patches = [ @@ -109,17 +110,17 @@ let in stdenv.mkDerivation rec { pname = "hip"; - version = "5.3.0"; + version = "5.3.1"; src = fetchFromGitHub { owner = "ROCm-Developer-Tools"; repo = "hipamd"; rev = "rocm-${version}"; - hash = "sha256-gZGZiDP/HbdmzLQkG9Jq9lyMP9hoD6UzTMiX9cUmQNA="; + hash = "sha256-i7hT/j+V0LT6Va2XcQyyKXF1guoIyhcOHvn842wCRx4="; }; nativeBuildInputs = [ cmake python3 makeWrapper perl ]; - buildInputs = [ libxml2 numactl libglvnd libX11 ]; + buildInputs = [ libxml2 numactl libglvnd libX11 python3Packages.cppheaderparser ]; propagatedBuildInputs = [ clang llvm diff --git a/pkgs/development/compilers/llvm/rocm/default.nix b/pkgs/development/compilers/llvm/rocm/default.nix index a952615a6c240..cb2ed8a703db7 100644 --- a/pkgs/development/compilers/llvm/rocm/default.nix +++ b/pkgs/development/compilers/llvm/rocm/default.nix @@ -1,12 +1,12 @@ { stdenv, lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith, overrideCC }: let - version = "5.3.0"; + version = "5.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; repo = "llvm-project"; rev = "rocm-${version}"; - hash = "sha256-MN7W4Gl6+a1nCozdn9gMzIXOiBPquoOP87x26boeSCA="; + hash = "sha256-IKo7N8wWvh5PBrZ2mh1Vu5s3uUXhanqYtC4qLV/+JBs="; }; in rec { clang = wrapCCWith rec { diff --git a/pkgs/development/libraries/clang-ocl/default.nix b/pkgs/development/libraries/clang-ocl/default.nix new file mode 100644 index 0000000000000..198a2a20af1e3 --- /dev/null +++ b/pkgs/development/libraries/clang-ocl/default.nix @@ -0,0 +1,44 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, rocm-cmake +, rocm-device-libs +, clang +}: + +stdenv.mkDerivation rec { + pname = "clang-ocl"; + rocmVersion = "5.3.1"; + version = rocmVersion; + + src = fetchFromGitHub { + owner = "RadeonOpenCompute"; + repo = "clang-ocl"; + rev = "rocm-${rocmVersion}"; + hash = "sha256-uMSvcVJj+me2E+7FsXZ4l4hTcK6uKEegXpkHGcuist0="; + }; + + nativeBuildInputs = [ + cmake + rocm-cmake + clang + ]; + + buildInputs = [ + rocm-device-libs + ]; + + cmakeFlags = [ + "-DCMAKE_C_COMPILER=clang" + "-DCMAKE_CXX_COMPILER=clang++" + ]; + + meta = with lib; { + description = "OpenCL compilation with clang compiler"; + homepage = "https://github.com/RadeonOpenCompute/clang-ocl"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ Madouura ]; + broken = rocmVersion != clang.version; + }; +} diff --git a/pkgs/development/libraries/composable_kernel/default.nix b/pkgs/development/libraries/composable_kernel/default.nix new file mode 100644 index 0000000000000..9efb60814a8da --- /dev/null +++ b/pkgs/development/libraries/composable_kernel/default.nix @@ -0,0 +1,91 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, rocm-cmake +, hip +, openmp +, gtest ? null +, buildTests ? false +, buildExamples ? false +, gpuTargets ? null # gpuTargets = [ "gfx803" "gfx900" "gfx1030" ... ] +}: + +assert buildTests -> gtest != null; + +# Several tests seem to either not compile or have a race condition +# Undefined reference to symbol '_ZTIN7testing4TestE' +# Try removing this next update +assert buildTests == false; + +stdenv.mkDerivation rec { + pname = "composable_kernel"; + version = "unstable-2022-11-02"; + + outputs = [ + "out" + ] ++ lib.optionals buildTests [ + "test" + ] ++ lib.optionals buildExamples [ + "example" + ]; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "composable_kernel"; + rev = "79aa3fb1793c265c59d392e916baa851a55521c8"; + hash = "sha256-vIfMdvRYCTqrjMGSb7gQfodzLw2wf3tGoCAa5jtfbvw="; + }; + + nativeBuildInputs = [ + cmake + rocm-cmake + hip + ]; + + buildInputs = [ + openmp + ] ++ lib.optionals buildTests [ + gtest + ]; + + cmakeFlags = [ + "-DCMAKE_C_COMPILER=hipcc" + "-DCMAKE_CXX_COMPILER=hipcc" + ] ++ lib.optionals (gpuTargets != null) [ + "-DGPU_TARGETS=${lib.strings.concatStringsSep ";" gpuTargets}" + ]; + + # No flags to build selectively it seems... + postPatch = '' + substituteInPlace test/CMakeLists.txt \ + --replace "include(googletest)" "" + + substituteInPlace CMakeLists.txt \ + --replace "enable_testing()" "" + '' + lib.optionalString (!buildTests) '' + substituteInPlace CMakeLists.txt \ + --replace "add_subdirectory(test)" "" + '' + lib.optionalString (!buildExamples) '' + substituteInPlace CMakeLists.txt \ + --replace "add_subdirectory(example)" "" + ''; + + postInstall = '' + mkdir -p $out/bin + mv bin/ckProfiler $out/bin + '' + lib.optionalString buildTests '' + mkdir -p $test/bin + mv bin/test_* $test/bin + '' + lib.optionalString buildExamples '' + mkdir -p $example/bin + mv bin/example_* $example/bin + ''; + + meta = with lib; { + description = "Performance portable programming model for machine learning tensor operators"; + homepage = "https://github.com/ROCmSoftwarePlatform/composable_kernel"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ Madouura ]; + }; +} diff --git a/pkgs/development/libraries/hipcub/default.nix b/pkgs/development/libraries/hipcub/default.nix new file mode 100644 index 0000000000000..facb890a3eb7c --- /dev/null +++ b/pkgs/development/libraries/hipcub/default.nix @@ -0,0 +1,89 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, rocm-cmake +, rocm-runtime +, rocm-device-libs +, rocm-comgr +, rocprim +, hip +, gtest ? null +, gbenchmark ? null +, buildTests ? false +, buildBenchmarks ? false +}: + +assert buildTests -> gtest != null; +assert buildBenchmarks -> gbenchmark != null; + +# CUB can also be used as a backend instead of rocPRIM. +stdenv.mkDerivation rec { + pname = "hipcub"; + rocmVersion = "5.3.1"; + version = "2.12.0-${rocmVersion}"; + + outputs = [ + "out" + ] ++ lib.optionals buildTests [ + "test" + ] ++ lib.optionals buildBenchmarks [ + "benchmark" + ]; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "hipCUB"; + rev = "rocm-${rocmVersion}"; + hash = "sha256-/GMZKbMD1sZQCM2FulM9jiJQ8ByYZinn0C8d/deFh0g="; + }; + + nativeBuildInputs = [ + cmake + rocm-cmake + hip + ]; + + buildInputs = [ + rocm-runtime + rocm-device-libs + rocm-comgr + rocprim + ] ++ lib.optionals buildTests [ + gtest + ] ++ lib.optionals buildBenchmarks [ + gbenchmark + ]; + + cmakeFlags = [ + "-DCMAKE_CXX_COMPILER=hipcc" + "-DHIP_ROOT_DIR=${hip}" + # 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 [ + "-DBUILD_TEST=ON" + ] ++ lib.optionals buildBenchmarks [ + "-DBUILD_BENCHMARK=ON" + ]; + + postInstall = lib.optionalString buildTests '' + mkdir -p $test/bin + mv $out/bin/test_* $test/bin + '' + lib.optionalString buildBenchmarks '' + mkdir -p $benchmark/bin + mv $out/bin/benchmark_* $benchmark/bin + '' + lib.optionalString (buildTests || buildBenchmarks) '' + rmdir $out/bin + ''; + + meta = with lib; { + description = "Thin wrapper library on top of rocPRIM or CUB"; + homepage = "https://github.com/ROCmSoftwarePlatform/hipCUB"; + license = with licenses; [ bsd3 ]; + maintainers = with maintainers; [ Madouura ]; + broken = rocmVersion != hip.version; + }; +} diff --git a/pkgs/development/libraries/hipsparse/default.nix b/pkgs/development/libraries/hipsparse/default.nix new file mode 100644 index 0000000000000..cf3fab40cef8b --- /dev/null +++ b/pkgs/development/libraries/hipsparse/default.nix @@ -0,0 +1,132 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, rocm-cmake +, rocm-runtime +, rocm-device-libs +, rocm-comgr +, rocsparse +, hip +, gfortran +, git +, fetchzip ? null +, gtest ? null +, buildTests ? false +}: + +assert buildTests -> fetchzip != null; +assert buildTests -> gtest != null; + +# This can also use cuSPARSE as a backend instead of rocSPARSE +let + matrices = lib.optionalAttrs buildTests import ./deps.nix { + inherit fetchzip; + mirror1 = "https://sparse.tamu.edu/MM"; + mirror2 = "https://www.cise.ufl.edu/research/sparse/MM"; + }; +in stdenv.mkDerivation rec { + pname = "hipsparse"; + rocmVersion = "5.3.1"; + version = "2.3.1-${rocmVersion}"; + + outputs = [ + "out" + ] ++ lib.optionals buildTests [ + "test" + ]; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "hipSPARSE"; + rev = "rocm-${rocmVersion}"; + hash = "sha256-Phcihat774ZSAe1QetE/GSZzGlnCnvS9GwsHBHCaD4c="; + }; + + nativeBuildInputs = [ + cmake + rocm-cmake + hip + gfortran + ]; + + buildInputs = [ + rocm-runtime + rocm-device-libs + rocm-comgr + rocsparse + git + ] ++ 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" + ] ++ lib.optionals buildTests [ + "-DBUILD_CLIENTS_TESTS=ON" + ]; + + # We have to manually generate the matrices + # CMAKE_MATRICES_DIR seems to be reset in clients/tests/CMakeLists.txt + postPatch = '' + substituteInPlace clients/common/utility.cpp \ + --replace "#ifdef __cpp_lib_filesystem" " #if true" + '' + lib.optionalString buildTests '' + mkdir -p matrices + + ln -s ${matrices.matrix-01}/*.mtx matrices + ln -s ${matrices.matrix-02}/*.mtx matrices + ln -s ${matrices.matrix-03}/*.mtx matrices + ln -s ${matrices.matrix-04}/*.mtx matrices + ln -s ${matrices.matrix-05}/*.mtx matrices + ln -s ${matrices.matrix-06}/*.mtx matrices + ln -s ${matrices.matrix-07}/*.mtx matrices + ln -s ${matrices.matrix-08}/*.mtx matrices + ln -s ${matrices.matrix-09}/*.mtx matrices + ln -s ${matrices.matrix-10}/*.mtx matrices + ln -s ${matrices.matrix-11}/*.mtx matrices + ln -s ${matrices.matrix-12}/*.mtx matrices + ln -s ${matrices.matrix-13}/*.mtx matrices + ln -s ${matrices.matrix-14}/*.mtx matrices + ln -s ${matrices.matrix-15}/*.mtx matrices + ln -s ${matrices.matrix-16}/*.mtx matrices + ln -s ${matrices.matrix-17}/*.mtx matrices + ln -s ${matrices.matrix-18}/*.mtx matrices + ln -s ${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 + ''; + + meta = with lib; { + description = "ROCm SPARSE marshalling library"; + homepage = "https://github.com/ROCmSoftwarePlatform/hipSPARSE"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ Madouura ]; + broken = rocmVersion != hip.version; + }; +} diff --git a/pkgs/development/libraries/hipsparse/deps.nix b/pkgs/development/libraries/hipsparse/deps.nix new file mode 100644 index 0000000000000..d70df67e2b78d --- /dev/null +++ b/pkgs/development/libraries/hipsparse/deps.nix @@ -0,0 +1,177 @@ +{ fetchzip +, mirror1 +, mirror2 +}: + +{ + matrix-01 = fetchzip { + sha256 = "sha256-AHur5ZIDZTFRrO2GV0ieXrffq4KUiGWiZ59pv0fUtEQ="; + + urls = [ + "${mirror1}/SNAP/amazon0312.tar.gz" + "${mirror2}/SNAP/amazon0312.tar.gz" + ]; + }; + + matrix-02 = fetchzip { + sha256 = "sha256-0rSxaN4lQcdaCLsvlgicG70FXUxXeERPiEmQ4MzbRdE="; + + urls = [ + "${mirror1}/Muite/Chebyshev4.tar.gz" + "${mirror2}/Muite/Chebyshev4.tar.gz" + ]; + }; + + matrix-03 = fetchzip { + sha256 = "sha256-hDzDWDUnHEyFedX/tMNq83ZH8uWyM4xtZYUUAD3rizo="; + + urls = [ + "${mirror1}/FEMLAB/sme3Dc.tar.gz" + "${mirror2}/FEMLAB/sme3Dc.tar.gz" + ]; + }; + + matrix-04 = fetchzip { + sha256 = "sha256-GmN2yOt/MoX01rKe05aTyB3ypUP4YbQGOITZ0BqPmC0="; + + urls = [ + "${mirror1}/Williams/webbase-1M.tar.gz" + "${mirror2}/Williams/webbase-1M.tar.gz" + ]; + }; + + matrix-05 = fetchzip { + sha256 = "sha256-gQNjfVyWzNM9RwImJGhkhahRmZz74LzDs1oijL7mI7k="; + + urls = [ + "${mirror1}/Williams/mac_econ_fwd500.tar.gz" + "${mirror2}/Williams/mac_econ_fwd500.tar.gz" + ]; + }; + + matrix-06 = fetchzip { + sha256 = "sha256-87cdZjntNcTuz5BtO59irhcuRbPllWSbhCEX3Td02qc="; + + urls = [ + "${mirror1}/Williams/mc2depi.tar.gz" + "${mirror2}/Williams/mc2depi.tar.gz" + ]; + }; + + matrix-07 = fetchzip { + sha256 = "sha256-WRamuJX3D8Tm+k0q67RjUDG3DeNAxhKiaPkk5afY5eU="; + + urls = [ + "${mirror1}/Bova/rma10.tar.gz" + "${mirror2}/Bova/rma10.tar.gz" + ]; + }; + + matrix-08 = fetchzip { + sha256 = "sha256-5dhkm293Mc3lzakKxHy5W5XIn4Rw+gihVh7gyrjEHXo="; + + urls = [ + "${mirror1}/JGD_BIBD/bibd_22_8.tar.gz" + "${mirror2}/JGD_BIBD/bibd_22_8.tar.gz" + ]; + }; + + matrix-09 = fetchzip { + sha256 = "sha256-czjLWCjXAjZCk5TGYHaEkwSAzQu3TQ3QyB6eNKR4G88="; + + urls = [ + "${mirror1}/Hamm/scircuit.tar.gz" + "${mirror2}/Hamm/scircuit.tar.gz" + ]; + }; + + matrix-10 = fetchzip { + sha256 = "sha256-bYuLnJViAIcIejAkh69/bsNAVIDU4wfTLtD+nmHd6FM="; + + urls = [ + "${mirror1}/Sandia/ASIC_320k.tar.gz" + "${mirror2}/Sandia/ASIC_320k.tar.gz" + ]; + }; + + matrix-11 = fetchzip { + sha256 = "sha256-aDwn8P1khYjo2Agbq5m9ZBInJUxf/knJNvyptt0fak0="; + + urls = [ + "${mirror1}/GHS_psdef/bmwcra_1.tar.gz" + "${mirror2}/GHS_psdef/bmwcra_1.tar.gz" + ]; + }; + + matrix-12 = fetchzip { + sha256 = "sha256-8OJqA/byhlAZd869TPUzZFdsOiwOoRGfKyhM+RMjXoY="; + + urls = [ + "${mirror1}/HB/nos1.tar.gz" + "${mirror2}/HB/nos1.tar.gz" + ]; + }; + + matrix-13 = fetchzip { + sha256 = "sha256-FS0rKqmg+uHwsM/yGfQLBdd7LH/rUrdutkNGBD/Mh1I="; + + urls = [ + "${mirror1}/HB/nos2.tar.gz" + "${mirror2}/HB/nos2.tar.gz" + ]; + }; + + matrix-14 = fetchzip { + sha256 = "sha256-DANnlrNJikrI7Pst9vRedtbuxepyHmCIu2yhltc4Qcs="; + + urls = [ + "${mirror1}/HB/nos3.tar.gz" + "${mirror2}/HB/nos3.tar.gz" + ]; + }; + + matrix-15 = fetchzip { + sha256 = "sha256-21mUgqjWGUfYgiWwSrKh9vH8Vdt3xzcefmqYNYRpxiY="; + + urls = [ + "${mirror1}/HB/nos4.tar.gz" + "${mirror2}/HB/nos4.tar.gz" + ]; + }; + + matrix-16 = fetchzip { + sha256 = "sha256-FOuXvGqBBFNkVS6cexmkluret54hCfCOdK+DOZllE4c="; + + urls = [ + "${mirror1}/HB/nos5.tar.gz" + "${mirror2}/HB/nos5.tar.gz" + ]; + }; + + matrix-17 = fetchzip { + sha256 = "sha256-+7NI1rA/qQxYPpjXKHvAaCZ+LSaAJ4xuJvMRMBEUYxg="; + + urls = [ + "${mirror1}/HB/nos6.tar.gz" + "${mirror2}/HB/nos6.tar.gz" + ]; + }; + + matrix-18 = fetchzip { + sha256 = "sha256-q3NxJjbwGGcFiQ9nhWfUKgZmdVwCfPmgQoqy0AqOsNc="; + + urls = [ + "${mirror1}/HB/nos7.tar.gz" + "${mirror2}/HB/nos7.tar.gz" + ]; + }; + + matrix-19 = fetchzip { + sha256 = "sha256-0GAN6qmVfD+tprIigzuUUUwm5KVhkN9X65wMEvFltDY="; + + urls = [ + "${mirror1}/DNVS/shipsec1.tar.gz" + "${mirror2}/DNVS/shipsec1.tar.gz" + ]; + }; +} diff --git a/pkgs/development/libraries/miopengemm/default.nix b/pkgs/development/libraries/miopengemm/default.nix new file mode 100644 index 0000000000000..9330530389e99 --- /dev/null +++ b/pkgs/development/libraries/miopengemm/default.nix @@ -0,0 +1,129 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, rocm-cmake +, rocm-opencl-runtime +, clang +, texlive ? null +, doxygen ? null +, sphinx ? null +, python3Packages ? null +, openblas ? null +, buildDocs ? false +, buildTests ? false +, buildBenchmarks ? false +}: + +assert buildDocs -> texlive != null; +assert buildDocs -> doxygen != null; +assert buildDocs -> sphinx != null; +assert buildDocs -> python3Packages != null; +assert buildTests -> openblas != null; + +let + latex = lib.optionalAttrs buildDocs (texlive.combine { + inherit (texlive) scheme-small + latexmk + tex-gyre + fncychap + wrapfig + capt-of + framed + needspace + tabulary + varwidth + titlesec; + }); +in stdenv.mkDerivation rec { + pname = "miopengemm"; + rocmVersion = "5.3.1"; + version = rocmVersion; + + outputs = [ + "out" + ] ++ lib.optionals buildDocs [ + "docs" + ] ++ lib.optionals buildTests [ + "test" + ] ++ lib.optionals buildBenchmarks [ + "benchmark" + ]; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "MIOpenGEMM"; + rev = "rocm-${rocmVersion}"; + hash = "sha256-AiRzOMYRA/0nbQomyq4oOEwNZdkPYWRA2W6QFlctvFc="; + }; + + nativeBuildInputs = [ + cmake + rocm-cmake + clang + ]; + + buildInputs = [ + rocm-opencl-runtime + ] ++ lib.optionals buildDocs [ + latex + doxygen + sphinx + python3Packages.sphinx_rtd_theme + python3Packages.breathe + ] ++ lib.optionals buildTests [ + openblas + ]; + + cmakeFlags = [ + "-DCMAKE_C_COMPILER=clang" + "-DCMAKE_CXX_COMPILER=clang++" + # 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 [ + "-DOPENBLAS=ON" + ] ++ lib.optionals buildBenchmarks [ + "-DAPI_BENCH_MIOGEMM=ON" + # Needs https://github.com/CNugteren/CLBlast + # "-DAPI_BENCH_CLBLAST=ON" + # Needs https://github.com/openai/triton + # "-DAPI_BENCH_ISAAC=ON" + ]; + + # Unfortunately, it seems like we have to call make on these manually + postBuild = lib.optionalString buildDocs '' + export HOME=$(mktemp -d) + make doc + '' + lib.optionalString buildTests '' + make check + '' + lib.optionalString buildBenchmarks '' + make examples + ''; + + postInstall = lib.optionalString buildTests '' + mkdir -p $test/bin + find tests -executable -type f -exec mv {} $test/bin \; + patchelf --set-rpath ${lib.makeLibraryPath buildInputs}:$out/lib $test/bin/* + '' + lib.optionalString buildBenchmarks '' + mkdir -p $benchmark/bin + find examples -executable -type f -exec mv {} $benchmark/bin \; + patchelf --set-rpath ${lib.makeLibraryPath buildInputs}:$out/lib $benchmark/bin/* + ''; + + postFixup = lib.optionalString buildDocs '' + mkdir -p $docs/share/doc/miopengemm + mv ../doc/html $docs/share/doc/miopengemm + mv ../doc/pdf/miopengemm.pdf $docs/share/doc/miopengemm + ''; + + meta = with lib; { + description = "OpenCL general matrix multiplication API for ROCm"; + homepage = "https://github.com/ROCmSoftwarePlatform/MIOpenGEMM"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ Madouura ]; + broken = rocmVersion != clang.version; + }; +} diff --git a/pkgs/development/libraries/rccl/default.nix b/pkgs/development/libraries/rccl/default.nix new file mode 100644 index 0000000000000..440705b2c017b --- /dev/null +++ b/pkgs/development/libraries/rccl/default.nix @@ -0,0 +1,84 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, rocm-cmake +, rocm-runtime +, rocm-device-libs +, rocm-comgr +, rocm-smi +, hip +, gtest +, chrpath ? null +, buildTests ? false +}: + +assert buildTests -> chrpath != null; + +stdenv.mkDerivation rec { + pname = "rccl"; + rocmVersion = "5.3.1"; + version = "2.12.10-${rocmVersion}"; + + outputs = [ + "out" + ] ++ lib.optionals buildTests [ + "test" + ]; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "rccl"; + rev = "rocm-${rocmVersion}"; + hash = "sha256-whRXGD8oINDYhFs8+hEWKWoGNqacGlyy7xi8peA8Qsk="; + }; + + nativeBuildInputs = [ + cmake + rocm-cmake + hip + ]; + + buildInputs = [ + rocm-runtime + rocm-device-libs + rocm-comgr + rocm-smi + gtest + ] ++ lib.optionals buildTests [ + chrpath + ]; + + cmakeFlags = [ + "-DCMAKE_C_COMPILER=hipcc" + "-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" + ] ++ lib.optionals buildTests [ + "-DBUILD_TESTS=ON" + ]; + + # Replace the manually set parallel jobs to NIX_BUILD_CORES + postPatch = '' + substituteInPlace CMakeLists.txt \ + --replace "8 P" "$NIX_BUILD_CORES P" \ + --replace "8)" "$NIX_BUILD_CORES)" + ''; + + postInstall = lib.optionalString buildTests '' + mkdir -p $test/bin + mv $out/bin/* $test/bin + rmdir $out/bin + ''; + + meta = with lib; { + description = "ROCm communication collectives library"; + homepage = "https://github.com/ROCmSoftwarePlatform/rccl"; + license = with licenses; [ bsd2 bsd3 ]; + maintainers = with maintainers; [ Madouura ]; + broken = rocmVersion != hip.version; + }; +} diff --git a/pkgs/development/libraries/rocblas/default.nix b/pkgs/development/libraries/rocblas/default.nix new file mode 100644 index 0000000000000..fd9b895c076c5 --- /dev/null +++ b/pkgs/development/libraries/rocblas/default.nix @@ -0,0 +1,136 @@ +{ lib +, stdenv +, fetchFromGitHub +, fetchpatch +, cmake +, rocm-cmake +, rocm-runtime +, rocm-device-libs +, rocm-comgr +, hip +, python3 +, tensile ? null +, msgpack ? null +, libxml2 ? null +, llvm ? null +, python3Packages ? null +, gtest ? null +, gfortran ? null +, buildTensile ? true +, buildTests ? false +, buildBenchmarks ? false +, tensileLogic ? "asm_full" +, tensileCOVersion ? "V3" +, tensileSepArch ? true +, tensileLazyLib ? true +, tensileLibFormat ? "msgpack" +, gpuTargets ? [ "all" ] +}: + +assert buildTensile -> tensile != null; +assert buildTensile -> msgpack != null; +assert buildTensile -> libxml2 != null; +assert buildTensile -> llvm != null; +assert buildTensile -> python3Packages != null; +assert buildTests -> gtest != null; +assert buildTests -> gfortran != null; + +# Tests and benchmarks are a can of worms that I will tackle in a different PR +# It involves completely rewriting the amd-blis derivation +assert buildTests == false; +assert buildBenchmarks == false; + +stdenv.mkDerivation rec { + pname = "rocblas"; + rocmVersion = "5.3.1"; + version = "2.45.0-${rocmVersion}"; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "rocBLAS"; + rev = "rocm-${rocmVersion}"; + hash = "sha256-GeeICEI1dNE6D+nUUlBtUncLkPowAa5n+bsy160EtaU="; + }; + + # We currently need this patch due to faulty toolchain includes + # See: https://github.com/ROCmSoftwarePlatform/rocBLAS/issues/1277 + patches = [ + (fetchpatch { + name = "only-std_norm-from-rocblas_complex.patch"; + url = "https://github.com/ROCmSoftwarePlatform/rocBLAS/commit/44b99c6df26002139ca9ec68ee1fc8899c7b001f.patch"; + hash = "sha256-vSZkVYY951fqfOThKFqnYBasWMblS6peEJZ6sFMCk9k="; + }) + ]; + + nativeBuildInputs = [ + cmake + rocm-cmake + hip + ]; + + buildInputs = [ + rocm-runtime + rocm-device-libs + rocm-comgr + python3 + ] ++ lib.optionals buildTensile [ + msgpack + libxml2 + llvm + python3Packages.pyyaml + python3Packages.msgpack + ] ++ lib.optionals buildTests [ + gtest + gfortran + ]; + + cmakeFlags = [ + "-DCMAKE_C_COMPILER=hipcc" + "-DCMAKE_CXX_COMPILER=hipcc" + "-Dpython=python3" + "-DAMDGPU_TARGETS=${lib.strings.concatStringsSep ";" gpuTargets}" + "-DBUILD_WITH_TENSILE=${if buildTensile 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 buildTensile [ + "-DVIRTUALENV_HOME_DIR=/build/source/tensile" + "-DTensile_TEST_LOCAL_PATH=/build/source/tensile" + "-DTensile_ROOT=/build/source/tensile/lib/python${python3.pythonVersion}/site-packages/Tensile" + "-DTensile_LOGIC=${tensileLogic}" + "-DTensile_CODE_OBJECT_VERSION=${tensileCOVersion}" + "-DTensile_SEPARATE_ARCHITECTURES=${if tensileSepArch then "ON" else "OFF"}" + "-DTensile_LAZY_LIBRARY_LOADING=${if tensileLazyLib then "ON" else "OFF"}" + "-DTensile_LIBRARY_FORMAT=${tensileLibFormat}" + ] ++ lib.optionals buildTests [ + "-DBUILD_CLIENTS_TESTS=ON" + ] ++ lib.optionals buildBenchmarks [ + "-DBUILD_CLIENTS_BENCHMARKS=ON" + ]; + + # Tensile REALLY wants to write to the nix directory if we include it normally + # We need to manually fixup the path so tensile will generate .co and .dat files + postPatch = lib.optionalString buildTensile '' + export PATH=${llvm}/bin:$PATH + cp -a ${tensile} tensile + chmod +w -R tensile + + # Rewrap Tensile + substituteInPlace tensile/bin/{.t*,.T*,*} \ + --replace "${tensile}" "/build/source/tensile" + + substituteInPlace CMakeLists.txt \ + --replace "include(virtualenv)" "" \ + --replace "virtualenv_install(\''${Tensile_TEST_LOCAL_PATH})" "" + ''; + + meta = with lib; { + description = "BLAS implementation for ROCm platform"; + homepage = "https://github.com/ROCmSoftwarePlatform/rocBLAS"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ Madouura ]; + broken = rocmVersion != hip.version; + }; +} diff --git a/pkgs/development/libraries/rocclr/default.nix b/pkgs/development/libraries/rocclr/default.nix index a9e254d9d349b..325e7a9105fe5 100644 --- a/pkgs/development/libraries/rocclr/default.nix +++ b/pkgs/development/libraries/rocclr/default.nix @@ -7,13 +7,13 @@ stdenv.mkDerivation rec { pname = "rocclr"; - version = "5.3.0"; + version = "5.3.1"; src = fetchFromGitHub { owner = "ROCm-Developer-Tools"; repo = "ROCclr"; rev = "rocm-${version}"; - hash = "sha256-l14+l8FkiFmGuRZ9dyD/PEYH9nHVRRg1vMXMnVhg3K4="; + hash = "sha256-dmL9krI/gHGQdOZ53+bQ7WjKcmJ+fZZP0lzF8ITLT4E="; }; patches = [ diff --git a/pkgs/development/libraries/rocfft/default.nix b/pkgs/development/libraries/rocfft/default.nix new file mode 100644 index 0000000000000..9dbc5a66fb18b --- /dev/null +++ b/pkgs/development/libraries/rocfft/default.nix @@ -0,0 +1,114 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, rocm-cmake +, rocm-runtime +, rocm-device-libs +, rocm-comgr +, hip +, sqlite +, python3 +, gtest ? null +, boost ? null +, fftw ? null +, fftwFloat ? null +, llvmPackages ? null +, buildTests ? false +, buildBenchmarks ? false +}: + +assert buildTests -> gtest != null; +assert buildBenchmarks -> fftw != null; +assert buildBenchmarks -> fftwFloat != null; +assert (buildTests || buildBenchmarks) -> boost != null; +assert (buildTests || buildBenchmarks) -> llvmPackages != null; + +stdenv.mkDerivation rec { + pname = "rocfft"; + rocmVersion = "5.3.1"; + version = "1.0.18-${rocmVersion}"; + + outputs = [ + "out" + ] ++ lib.optionals buildTests [ + "test" + ] ++ lib.optionals buildBenchmarks [ + "benchmark" + ]; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "rocFFT"; + rev = "rocm-${rocmVersion}"; + hash = "sha256-jb2F1fRe+YLloYJ/KtzrptUDhmdBDBtddeW/g55owKM="; + }; + + nativeBuildInputs = [ + cmake + rocm-cmake + hip + ]; + + buildInputs = [ + rocm-runtime + rocm-device-libs + rocm-comgr + sqlite + python3 + ] ++ lib.optionals buildTests [ + gtest + ] ++ lib.optionals (buildTests || buildBenchmarks) [ + boost + fftw + fftwFloat + llvmPackages.openmp + ]; + + propogatedBuildInputs = lib.optionals buildTests [ + fftw + fftwFloat + ]; + + cmakeFlags = [ + "-DCMAKE_C_COMPILER=hipcc" + "-DCMAKE_CXX_COMPILER=hipcc" + "-DUSE_HIP_CLANG=ON" + "-DSQLITE_USE_SYSTEM_PACKAGE=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 buildTests [ + "-DBUILD_CLIENTS_TESTS=ON" + ] ++ lib.optionals buildBenchmarks [ + "-DBUILD_CLIENTS_RIDER=ON" + "-DBUILD_CLIENTS_SAMPLES=ON" + ]; + + postInstall = lib.optionalString buildTests '' + mkdir -p $test/{bin,lib/fftw} + cp -a $out/bin/* $test/bin + ln -s ${fftw}/lib/libfftw*.so $test/lib/fftw + ln -s ${fftwFloat}/lib/libfftw*.so $test/lib/fftw + rm -r $out/lib/fftw + rm $test/bin/{rocfft_rtc_helper,*-rider} || true + '' + lib.optionalString buildBenchmarks '' + mkdir -p $benchmark/bin + cp -a $out/bin/* $benchmark/bin + rm $benchmark/bin/{rocfft_rtc_helper,*-test} || true + '' + lib.optionalString (buildTests || buildBenchmarks ) '' + mv $out/bin/rocfft_rtc_helper $out + rm -r $out/bin/* + mv $out/rocfft_rtc_helper $out/bin + ''; + + meta = with lib; { + description = "FFT implementation for ROCm "; + homepage = "https://github.com/ROCmSoftwarePlatform/rocFFT"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ Madouura ]; + broken = rocmVersion != hip.version; + }; +} diff --git a/pkgs/development/libraries/rocm-comgr/default.nix b/pkgs/development/libraries/rocm-comgr/default.nix index e7f07380758b7..032584fa2599b 100644 --- a/pkgs/development/libraries/rocm-comgr/default.nix +++ b/pkgs/development/libraries/rocm-comgr/default.nix @@ -2,7 +2,7 @@ stdenv.mkDerivation rec { pname = "rocm-comgr"; - version = "5.3.0"; + version = "5.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; diff --git a/pkgs/development/libraries/rocm-device-libs/default.nix b/pkgs/development/libraries/rocm-device-libs/default.nix index c94e1f2753e05..d9ada30e155df 100644 --- a/pkgs/development/libraries/rocm-device-libs/default.nix +++ b/pkgs/development/libraries/rocm-device-libs/default.nix @@ -8,7 +8,7 @@ stdenv.mkDerivation rec { pname = "rocm-device-libs"; - version = "5.3.0"; + version = "5.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; diff --git a/pkgs/development/libraries/rocm-opencl-runtime/default.nix b/pkgs/development/libraries/rocm-opencl-runtime/default.nix index fc5f8fba52500..cfbcab461d18b 100644 --- a/pkgs/development/libraries/rocm-opencl-runtime/default.nix +++ b/pkgs/development/libraries/rocm-opencl-runtime/default.nix @@ -22,7 +22,7 @@ stdenv.mkDerivation rec { pname = "rocm-opencl-runtime"; - version = "5.3.0"; + version = "5.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; diff --git a/pkgs/development/libraries/rocm-runtime/default.nix b/pkgs/development/libraries/rocm-runtime/default.nix index 563632b9d7f51..cc08149ce2878 100644 --- a/pkgs/development/libraries/rocm-runtime/default.nix +++ b/pkgs/development/libraries/rocm-runtime/default.nix @@ -15,7 +15,7 @@ stdenv.mkDerivation rec { pname = "rocm-runtime"; - version = "5.3.0"; + version = "5.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; diff --git a/pkgs/development/libraries/rocm-thunk/default.nix b/pkgs/development/libraries/rocm-thunk/default.nix index d7add50386e75..5a7167e616710 100644 --- a/pkgs/development/libraries/rocm-thunk/default.nix +++ b/pkgs/development/libraries/rocm-thunk/default.nix @@ -9,7 +9,7 @@ stdenv.mkDerivation rec { pname = "rocm-thunk"; - version = "5.3.0"; + version = "5.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; diff --git a/pkgs/development/libraries/rocprim/default.nix b/pkgs/development/libraries/rocprim/default.nix new file mode 100644 index 0000000000000..97b8daf8a7b1e --- /dev/null +++ b/pkgs/development/libraries/rocprim/default.nix @@ -0,0 +1,85 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, rocm-cmake +, rocm-runtime +, rocm-device-libs +, rocm-comgr +, hip +, gtest ? null +, gbenchmark ? null +, buildTests ? false +, buildBenchmarks ? false +}: + +assert buildTests -> gtest != null; +assert buildBenchmarks -> gbenchmark != null; + +stdenv.mkDerivation rec { + pname = "rocprim"; + rocmVersion = "5.3.1"; + version = "2.11.0-${rocmVersion}"; + + outputs = [ + "out" + ] ++ lib.optionals buildTests [ + "test" + ] ++ lib.optionals buildBenchmarks [ + "benchmark" + ]; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "rocPRIM"; + rev = "rocm-${rocmVersion}"; + hash = "sha256-aapvj9bwwlg7VJfnH1PVR8DulMcJh1xR6B4rPPGU6Q4="; + }; + + nativeBuildInputs = [ + cmake + rocm-cmake + hip + ]; + + buildInputs = [ + rocm-runtime + rocm-device-libs + rocm-comgr + ] ++ lib.optionals buildTests [ + gtest + ] ++ lib.optionals buildBenchmarks [ + gbenchmark + ]; + + 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" + ] ++ lib.optionals buildTests [ + "-DBUILD_TEST=ON" + ] ++ lib.optionals buildBenchmarks [ + "-DBUILD_BENCHMARK=ON" + ]; + + postInstall = lib.optionalString buildTests '' + mkdir -p $test/bin + mv $out/bin/test_* $test/bin + '' + lib.optionalString buildBenchmarks '' + mkdir -p $benchmark/bin + mv $out/bin/benchmark_* $benchmark/bin + '' + lib.optionalString (buildTests || buildBenchmarks) '' + rmdir $out/bin + ''; + + meta = with lib; { + description = "ROCm parallel primitives"; + homepage = "https://github.com/ROCmSoftwarePlatform/rocPRIM"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ Madouura ]; + broken = rocmVersion != hip.version; + }; +} diff --git a/pkgs/development/libraries/rocsparse/default.nix b/pkgs/development/libraries/rocsparse/default.nix new file mode 100644 index 0000000000000..f6321d4e08a3c --- /dev/null +++ b/pkgs/development/libraries/rocsparse/default.nix @@ -0,0 +1,148 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, rocm-cmake +, rocm-runtime +, rocm-device-libs +, rocm-comgr +, rocprim +, hip +, gfortran +, git +, fetchzip ? null +, gtest ? null +, boost ? null +, python3Packages ? null +, buildTests ? false +, buildBenchmarks ? false # Seems to depend on tests +}: + +assert (buildTests || buildBenchmarks) -> fetchzip != null; +assert (buildTests || buildBenchmarks) -> gtest != null; +assert (buildTests || buildBenchmarks) -> boost != null; +assert (buildTests || buildBenchmarks) -> python3Packages != null; + +let + matrices = lib.optionalAttrs (buildTests || buildBenchmarks) import ./deps.nix { + inherit fetchzip; + mirror1 = "https://sparse.tamu.edu/MM"; + mirror2 = "https://www.cise.ufl.edu/research/sparse/MM"; + }; +in stdenv.mkDerivation rec { + pname = "rocsparse"; + rocmVersion = "5.3.1"; + version = "2.3.2-${rocmVersion}"; + + outputs = [ + "out" + ] ++ lib.optionals (buildTests || buildBenchmarks) [ + "test" + ] ++ lib.optionals buildBenchmarks [ + "benchmark" + ]; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "rocSPARSE"; + rev = "rocm-${rocmVersion}"; + hash = "sha256-1069oBrIpZ4M9CAkzoQ9a5j3WlCXErirTbgTUZuT6b0="; + }; + + nativeBuildInputs = [ + cmake + rocm-cmake + hip + gfortran + ]; + + buildInputs = [ + rocm-runtime + rocm-device-libs + rocm-comgr + rocprim + git + ] ++ lib.optionals (buildTests || buildBenchmarks) [ + gtest + boost + python3Packages.python + python3Packages.pyyaml + ]; + + 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" + ] ++ 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 ${matrices.matrix-01}/*.mtx matrices + ln -s ${matrices.matrix-02}/*.mtx matrices + ln -s ${matrices.matrix-03}/*.mtx matrices + ln -s ${matrices.matrix-04}/*.mtx matrices + ln -s ${matrices.matrix-05}/*.mtx matrices + ln -s ${matrices.matrix-06}/*.mtx matrices + ln -s ${matrices.matrix-07}/*.mtx matrices + ln -s ${matrices.matrix-08}/*.mtx matrices + ln -s ${matrices.matrix-09}/*.mtx matrices + ln -s ${matrices.matrix-10}/*.mtx matrices + ln -s ${matrices.matrix-11}/*.mtx matrices + ln -s ${matrices.matrix-12}/*.mtx matrices + ln -s ${matrices.matrix-13}/*.mtx matrices + ln -s ${matrices.matrix-14}/*.mtx matrices + ln -s ${matrices.matrix-15}/*.mtx matrices + ln -s ${matrices.matrix-16}/*.mtx matrices + ln -s ${matrices.matrix-17}/*.mtx matrices + ln -s ${matrices.matrix-18}/*.mtx matrices + ln -s ${matrices.matrix-19}/*.mtx matrices + ln -s ${matrices.matrix-20}/*.mtx matrices + ln -s ${matrices.matrix-21}/*.mtx matrices + ln -s ${matrices.matrix-22}/*.mtx matrices + ln -s ${matrices.matrix-23}/*.mtx matrices + ln -s ${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 + ''; + + meta = with lib; { + description = "ROCm SPARSE implementation"; + homepage = "https://github.com/ROCmSoftwarePlatform/rocSPARSE"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ Madouura ]; + broken = rocmVersion != hip.version; + }; +} diff --git a/pkgs/development/libraries/rocsparse/deps.nix b/pkgs/development/libraries/rocsparse/deps.nix new file mode 100644 index 0000000000000..cef880ab3232d --- /dev/null +++ b/pkgs/development/libraries/rocsparse/deps.nix @@ -0,0 +1,222 @@ +{ fetchzip +, mirror1 +, mirror2 +}: + +{ + matrix-01 = fetchzip { + sha256 = "sha256-AHur5ZIDZTFRrO2GV0ieXrffq4KUiGWiZ59pv0fUtEQ="; + + urls = [ + "${mirror1}/SNAP/amazon0312.tar.gz" + "${mirror2}/SNAP/amazon0312.tar.gz" + ]; + }; + + matrix-02 = fetchzip { + sha256 = "sha256-0rSxaN4lQcdaCLsvlgicG70FXUxXeERPiEmQ4MzbRdE="; + + urls = [ + "${mirror1}/Muite/Chebyshev4.tar.gz" + "${mirror2}/Muite/Chebyshev4.tar.gz" + ]; + }; + + matrix-03 = fetchzip { + sha256 = "sha256-hDzDWDUnHEyFedX/tMNq83ZH8uWyM4xtZYUUAD3rizo="; + + urls = [ + "${mirror1}/FEMLAB/sme3Dc.tar.gz" + "${mirror2}/FEMLAB/sme3Dc.tar.gz" + ]; + }; + + matrix-04 = fetchzip { + sha256 = "sha256-GmN2yOt/MoX01rKe05aTyB3ypUP4YbQGOITZ0BqPmC0="; + + urls = [ + "${mirror1}/Williams/webbase-1M.tar.gz" + "${mirror2}/Williams/webbase-1M.tar.gz" + ]; + }; + + matrix-05 = fetchzip { + sha256 = "sha256-gQNjfVyWzNM9RwImJGhkhahRmZz74LzDs1oijL7mI7k="; + + urls = [ + "${mirror1}/Williams/mac_econ_fwd500.tar.gz" + "${mirror2}/Williams/mac_econ_fwd500.tar.gz" + ]; + }; + + matrix-06 = fetchzip { + sha256 = "sha256-87cdZjntNcTuz5BtO59irhcuRbPllWSbhCEX3Td02qc="; + + urls = [ + "${mirror1}/Williams/mc2depi.tar.gz" + "${mirror2}/Williams/mc2depi.tar.gz" + ]; + }; + + matrix-07 = fetchzip { + sha256 = "sha256-WRamuJX3D8Tm+k0q67RjUDG3DeNAxhKiaPkk5afY5eU="; + + urls = [ + "${mirror1}/Bova/rma10.tar.gz" + "${mirror2}/Bova/rma10.tar.gz" + ]; + }; + + matrix-08 = fetchzip { + sha256 = "sha256-5dhkm293Mc3lzakKxHy5W5XIn4Rw+gihVh7gyrjEHXo="; + + urls = [ + "${mirror1}/JGD_BIBD/bibd_22_8.tar.gz" + "${mirror2}/JGD_BIBD/bibd_22_8.tar.gz" + ]; + }; + + matrix-09 = fetchzip { + sha256 = "sha256-czjLWCjXAjZCk5TGYHaEkwSAzQu3TQ3QyB6eNKR4G88="; + + urls = [ + "${mirror1}/Hamm/scircuit.tar.gz" + "${mirror2}/Hamm/scircuit.tar.gz" + ]; + }; + + matrix-10 = fetchzip { + sha256 = "sha256-bYuLnJViAIcIejAkh69/bsNAVIDU4wfTLtD+nmHd6FM="; + + urls = [ + "${mirror1}/Sandia/ASIC_320k.tar.gz" + "${mirror2}/Sandia/ASIC_320k.tar.gz" + ]; + }; + + matrix-11 = fetchzip { + sha256 = "sha256-aDwn8P1khYjo2Agbq5m9ZBInJUxf/knJNvyptt0fak0="; + + urls = [ + "${mirror1}/GHS_psdef/bmwcra_1.tar.gz" + "${mirror2}/GHS_psdef/bmwcra_1.tar.gz" + ]; + }; + + matrix-12 = fetchzip { + sha256 = "sha256-8OJqA/byhlAZd869TPUzZFdsOiwOoRGfKyhM+RMjXoY="; + + urls = [ + "${mirror1}/HB/nos1.tar.gz" + "${mirror2}/HB/nos1.tar.gz" + ]; + }; + + matrix-13 = fetchzip { + sha256 = "sha256-FS0rKqmg+uHwsM/yGfQLBdd7LH/rUrdutkNGBD/Mh1I="; + + urls = [ + "${mirror1}/HB/nos2.tar.gz" + "${mirror2}/HB/nos2.tar.gz" + ]; + }; + + matrix-14 = fetchzip { + sha256 = "sha256-DANnlrNJikrI7Pst9vRedtbuxepyHmCIu2yhltc4Qcs="; + + urls = [ + "${mirror1}/HB/nos3.tar.gz" + "${mirror2}/HB/nos3.tar.gz" + ]; + }; + + matrix-15 = fetchzip { + sha256 = "sha256-21mUgqjWGUfYgiWwSrKh9vH8Vdt3xzcefmqYNYRpxiY="; + + urls = [ + "${mirror1}/HB/nos4.tar.gz" + "${mirror2}/HB/nos4.tar.gz" + ]; + }; + + matrix-16 = fetchzip { + sha256 = "sha256-FOuXvGqBBFNkVS6cexmkluret54hCfCOdK+DOZllE4c="; + + urls = [ + "${mirror1}/HB/nos5.tar.gz" + "${mirror2}/HB/nos5.tar.gz" + ]; + }; + + matrix-17 = fetchzip { + sha256 = "sha256-+7NI1rA/qQxYPpjXKHvAaCZ+LSaAJ4xuJvMRMBEUYxg="; + + urls = [ + "${mirror1}/HB/nos6.tar.gz" + "${mirror2}/HB/nos6.tar.gz" + ]; + }; + + matrix-18 = fetchzip { + sha256 = "sha256-q3NxJjbwGGcFiQ9nhWfUKgZmdVwCfPmgQoqy0AqOsNc="; + + urls = [ + "${mirror1}/HB/nos7.tar.gz" + "${mirror2}/HB/nos7.tar.gz" + ]; + }; + + matrix-19 = fetchzip { + sha256 = "sha256-0GAN6qmVfD+tprIigzuUUUwm5KVhkN9X65wMEvFltDY="; + + urls = [ + "${mirror1}/DNVS/shipsec1.tar.gz" + "${mirror2}/DNVS/shipsec1.tar.gz" + ]; + }; + + matrix-20 = fetchzip { + sha256 = "sha256-f28Du/Urxsiq5NkRmRO10Zz9vvGRjEchquzHzbZpZ7U="; + + urls = [ + "${mirror1}/Cote/mplate.tar.gz" + "${mirror2}/Cote/mplate.tar.gz" + ]; + }; + + matrix-21 = fetchzip { + sha256 = "sha256-O+Wy0NfCU1hVUOfNR1dJpvDHLBwwa301IRJDrQJnhak="; + + urls = [ + "${mirror1}/Bai/qc2534.tar.gz" + "${mirror2}/Bai/qc2534.tar.gz" + ]; + }; + + matrix-22 = fetchzip { + sha256 = "sha256-oxMnt8U5Cf1ILWcBdU6W9jdSMMm+U6bIVl8nm3n3+OA="; + + urls = [ + "${mirror1}/Chevron/Chevron2.tar.gz" + "${mirror2}/Chevron/Chevron2.tar.gz" + ]; + }; + + matrix-23 = fetchzip { + sha256 = "sha256-MFD9BxFI/3IS7yatW121BAI04fbqrXpgYDT5UKjeKcU="; + + urls = [ + "${mirror1}/Chevron/Chevron3.tar.gz" + "${mirror2}/Chevron/Chevron3.tar.gz" + ]; + }; + + matrix-24 = fetchzip { + sha256 = "sha256-ikS8O51pe1nt3BNyhvfvqCbVL0+bg/da9bqGqeBDkTg="; + + urls = [ + "${mirror1}/Chevron/Chevron4.tar.gz" + "${mirror2}/Chevron/Chevron4.tar.gz" + ]; + }; +} diff --git a/pkgs/development/libraries/rocthrust/default.nix b/pkgs/development/libraries/rocthrust/default.nix new file mode 100644 index 0000000000000..99e5827917693 --- /dev/null +++ b/pkgs/development/libraries/rocthrust/default.nix @@ -0,0 +1,91 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, rocm-cmake +, rocm-runtime +, rocm-device-libs +, rocm-comgr +, rocprim +, hip +, gtest ? null +, buildTests ? false +, buildBenchmarks ? false +}: + +assert buildTests -> gtest != null; + +# Doesn't seem to work, thousands of errors compiling with no clear fix +# Is this an upstream issue? We don't seem to be missing dependencies +assert buildTests == false; +assert buildBenchmarks == false; + +stdenv.mkDerivation rec { + pname = "rocthrust"; + rocmVersion = "5.3.1"; + version = "2.16.0-${rocmVersion}"; + + # Comment out these outputs until tests/benchmarks are fixed (upstream?) + # outputs = [ + # "out" + # ] ++ lib.optionals buildTests [ + # "test" + # ] ++ lib.optionals buildBenchmarks [ + # "benchmark" + # ]; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "rocThrust"; + rev = "rocm-${rocmVersion}"; + hash = "sha256-cT0VyEVz86xR6qubAY2ncTxtCRTwXrNTWcFyf3mV+y0="; + }; + + nativeBuildInputs = [ + cmake + rocm-cmake + rocprim + hip + ]; + + buildInputs = [ + rocm-runtime + rocm-device-libs + rocm-comgr + ] ++ lib.optionals buildTests [ + gtest + ]; + + cmakeFlags = [ + "-DCMAKE_CXX_COMPILER=hipcc" + "-DHIP_ROOT_DIR=${hip}" + # 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 [ + "-DBUILD_TEST=ON" + ] ++ lib.optionals buildBenchmarks [ + "-DBUILD_BENCHMARKS=ON" + ]; + + # Comment out these outputs until tests/benchmarks are fixed (upstream?) + # postInstall = lib.optionalString buildTests '' + # mkdir -p $test/bin + # mv $out/bin/test_* $test/bin + # '' + lib.optionalString buildBenchmarks '' + # mkdir -p $benchmark/bin + # mv $out/bin/benchmark_* $benchmark/bin + # '' + lib.optionalString (buildTests || buildBenchmarks) '' + # rmdir $out/bin + # ''; + + meta = with lib; { + description = "ROCm parallel algorithm library"; + homepage = "https://github.com/ROCmSoftwarePlatform/rocThrust"; + license = with licenses; [ asl20 ]; + maintainers = with maintainers; [ Madouura ]; + broken = rocmVersion != hip.version; + }; +} diff --git a/pkgs/development/libraries/tensile/default.nix b/pkgs/development/libraries/tensile/default.nix new file mode 100644 index 0000000000000..d957ea7494419 --- /dev/null +++ b/pkgs/development/libraries/tensile/default.nix @@ -0,0 +1,34 @@ +{ lib +, stdenv +, fetchFromGitHub +, buildPythonPackage +, pyyaml +, msgpack +, pandas +}: + +buildPythonPackage rec { + pname = "tensile"; + rocmVersion = "5.3.1"; + version = "4.34.0-${rocmVersion}"; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "Tensile"; + rev = "rocm-${rocmVersion}"; + hash = "sha256-QWt/zzBrZKM8h3MTnbLX4vN3p6cCQvo67U1C2yqAQxw="; + }; + + buildInputs = [ + pyyaml + msgpack + pandas + ]; + + meta = with lib; { + description = "GEMMs and tensor contractions"; + homepage = "https://github.com/ROCmSoftwarePlatform/Tensile"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ Madouura ]; + }; +} diff --git a/pkgs/development/tools/build-managers/rocm-cmake/default.nix b/pkgs/development/tools/build-managers/rocm-cmake/default.nix index efd2e3a05e53e..0c61324beebda 100644 --- a/pkgs/development/tools/build-managers/rocm-cmake/default.nix +++ b/pkgs/development/tools/build-managers/rocm-cmake/default.nix @@ -2,7 +2,7 @@ stdenv.mkDerivation rec { pname = "rocm-cmake"; - version = "5.3.0"; + version = "5.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; diff --git a/pkgs/development/tools/rocminfo/default.nix b/pkgs/development/tools/rocminfo/default.nix index 1761227045b7c..078c4aa71d91a 100644 --- a/pkgs/development/tools/rocminfo/default.nix +++ b/pkgs/development/tools/rocminfo/default.nix @@ -7,7 +7,7 @@ # compilers to determine the desired target. , defaultTargets ? []}: stdenv.mkDerivation rec { - version = "5.3.0"; + version = "5.3.1"; pname = "rocminfo"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; diff --git a/pkgs/tools/system/rocm-smi/default.nix b/pkgs/tools/system/rocm-smi/default.nix index 7f3f1ef03531d..9015f231bab09 100644 --- a/pkgs/tools/system/rocm-smi/default.nix +++ b/pkgs/tools/system/rocm-smi/default.nix @@ -2,7 +2,7 @@ stdenv.mkDerivation rec { pname = "rocm-smi"; - version = "5.3.0"; + version = "5.3.1"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0b826aad54369..2ee2371ab156e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14841,6 +14841,14 @@ with pkgs; rgbds = callPackage ../development/compilers/rgbds { }; + composable_kernel = callPackage ../development/libraries/composable_kernel { + inherit (llvmPackages) openmp; + }; + + clang-ocl = callPackage ../development/libraries/clang-ocl { + inherit (llvmPackages_rocm) clang; + }; + rgxg = callPackage ../tools/text/rgxg { }; rocclr = callPackage ../development/libraries/rocclr { }; @@ -14849,6 +14857,12 @@ with pkgs; inherit (llvmPackages_rocm) clang llvm; }; + hipcub = callPackage ../development/libraries/hipcub { }; + + hipsparse = callPackage ../development/libraries/hipsparse { }; + + rccl = callPackage ../development/libraries/rccl { }; + rocm-cmake = callPackage ../development/tools/build-managers/rocm-cmake { }; rocm-comgr = callPackage ../development/libraries/rocm-comgr { @@ -14877,6 +14891,24 @@ with pkgs; rocmlir = callPackage ../development/libraries/rocmlir { }; + rocprim = callPackage ../development/libraries/rocprim { }; + + rocsparse = callPackage ../development/libraries/rocsparse { }; + + rocfft = callPackage ../development/libraries/rocfft { }; + + tensile = python3Packages.callPackage ../development/libraries/tensile { }; + + rocblas = callPackage ../development/libraries/rocblas { + inherit (llvmPackages_rocm) llvm; + }; + + miopengemm = callPackage ../development/libraries/miopengemm { + inherit (llvmPackages_rocm) clang; + }; + + rocthrust = callPackage ../development/libraries/rocthrust { }; + rtags = callPackage ../development/tools/rtags { inherit (darwin) apple_sdk; };