diff options
Diffstat (limited to 'pkgs/development/rocm-modules/5')
25 files changed, 351 insertions, 488 deletions
diff --git a/pkgs/development/rocm-modules/5/default.nix b/pkgs/development/rocm-modules/5/default.nix index be597edfe150..d3effc777613 100644 --- a/pkgs/development/rocm-modules/5/default.nix +++ b/pkgs/development/rocm-modules/5/default.nix @@ -82,6 +82,7 @@ in rec { stdenv = llvm.rocmClangStdenv; }; + # Replaces hip, opencl-runtime, and rocclr clr = callPackage ./clr { inherit rocmUpdateScript hip-common hipcc rocm-device-libs rocm-comgr rocm-runtime roctracer rocminfo; inherit (llvm) clang; @@ -122,118 +123,125 @@ in rec { stdenv = llvm.rocmClangStdenv; }; - - - - - - - - - - - - - - composable_kernel = callPackage ./composable_kernel { - inherit (llvm) openmp clang-tools-extra; + ## ROCmSoftwarePlatform ## + rocprim = callPackage ./rocprim { + inherit rocmUpdateScript rocm-cmake clr; stdenv = llvm.rocmClangStdenv; }; - hipcub = callPackage ./hipcub { + rocsparse = callPackage ./rocsparse { + inherit rocmUpdateScript rocm-cmake rocprim clr; stdenv = llvm.rocmClangStdenv; }; - hipsparse = callPackage ./hipsparse { - inherit (llvm) openmp; + rocthrust = callPackage ./rocthrust { + inherit rocmUpdateScript rocm-cmake rocprim clr; stdenv = llvm.rocmClangStdenv; }; - hipfort = callPackage ./hipfort { + rocrand = callPackage ./rocrand { + inherit rocmUpdateScript rocm-cmake clr; stdenv = llvm.rocmClangStdenv; }; - hipfft = callPackage ./hipfft { + hiprand = rocrand; # rocrand includes hiprand + + rocfft = callPackage ./rocfft { + inherit rocmUpdateScript rocm-cmake rocrand rocfft clr; inherit (llvm) openmp; stdenv = llvm.rocmClangStdenv; }; - hipsolver = callPackage ./hipsolver { + rccl = callPackage ./rccl { + inherit rocmUpdateScript rocm-cmake rocm-smi clr hipify; stdenv = llvm.rocmClangStdenv; }; - hipblas = callPackage ./hipblas { + hipcub = callPackage ./hipcub { + inherit rocmUpdateScript rocm-cmake rocprim clr; stdenv = llvm.rocmClangStdenv; }; - migraphx = callPackage ./migraphx { - inherit (llvm) clang-tools-extra openmp; + hipsparse = callPackage ./hipsparse { + inherit rocmUpdateScript rocm-cmake rocsparse clr; + inherit (llvm) openmp; stdenv = llvm.rocmClangStdenv; - rocmlir = rocmlir-rock; }; - rccl = callPackage ./rccl { + hipfort = callPackage ./hipfort { + inherit rocmUpdateScript rocm-cmake; stdenv = llvm.rocmClangStdenv; }; - rocalution = callPackage ./rocalution { + hipfft = callPackage ./hipfft { + inherit rocmUpdateScript rocm-cmake rocfft clr; inherit (llvm) openmp; stdenv = llvm.rocmClangStdenv; }; - rocsolver = callPackage ./rocsolver { + tensile = python3Packages.callPackage ./tensile { + inherit rocmUpdateScript rocminfo; stdenv = llvm.rocmClangStdenv; }; - rocmlir = callPackage ./rocmlir { + rocblas = callPackage ./rocblas { + inherit rocmUpdateScript rocm-cmake clr tensile; + inherit (llvm) openmp; stdenv = llvm.rocmClangStdenv; }; - rocmlir-rock = rocmlir.override { - buildRockCompiler = true; - }; - - rocprim = callPackage ./rocprim { + rocsolver = callPackage ./rocsolver { + inherit rocmUpdateScript rocm-cmake rocblas rocsparse clr; stdenv = llvm.rocmClangStdenv; }; - rocsparse = callPackage ./rocsparse { + rocwmma = callPackage ./rocwmma { + inherit rocmUpdateScript rocm-cmake rocm-smi rocblas clr; + inherit (llvm) openmp; stdenv = llvm.rocmClangStdenv; }; - rocfft = callPackage ./rocfft { + rocalution = callPackage ./rocalution { + inherit rocmUpdateScript rocm-cmake rocprim rocsparse rocrand rocblas clr; inherit (llvm) openmp; stdenv = llvm.rocmClangStdenv; }; - rocrand = callPackage ./rocrand { + rocmlir = callPackage ./rocmlir { + inherit rocmUpdateScript rocm-cmake clr; stdenv = llvm.rocmClangStdenv; }; - tensile = python3Packages.callPackage ./tensile { - stdenv = llvm.rocmClangStdenv; + rocmlir-rock = rocmlir.override { + buildRockCompiler = true; }; - rocwmma = callPackage ./rocwmma { - inherit (llvm) openmp; + hipsolver = callPackage ./hipsolver { + inherit rocmUpdateScript rocm-cmake rocblas rocsolver clr; stdenv = llvm.rocmClangStdenv; }; - rocblas = callPackage ./rocblas { - inherit (llvm) openmp; + hipblas = callPackage ./hipblas { + inherit rocmUpdateScript rocm-cmake rocblas rocsolver clr; stdenv = llvm.rocmClangStdenv; }; + # hipBlasLt - Very broken with Tensile at the moment, only supports GFX9 + # hipTensor - Only supports GFX9 + miopengemm = callPackage ./miopengemm { + inherit rocmUpdateScript rocm-cmake clr; stdenv = llvm.rocmClangStdenv; }; - rocthrust = callPackage ./rocthrust { + composable_kernel = callPackage ./composable_kernel { + inherit (llvm) openmp clang-tools-extra; stdenv = llvm.rocmClangStdenv; }; miopen = callPackage ./miopen { - inherit (llvm) llvm clang-tools-extra; + inherit rocmUpdateScript rocm-cmake rocblas clang-ocl miopengemm composable_kernel rocm-comgr clr rocm-docs-core half; + inherit (llvm) clang-tools-extra; stdenv = llvm.rocmClangStdenv; rocmlir = rocmlir-rock; boost = boost179.override { enableStatic = true; }; @@ -246,4 +254,11 @@ in rec { miopen-opencl = miopen.override { useOpenCL = true; }; + + migraphx = callPackage ./migraphx { + inherit rocmUpdateScript rocm-cmake rocblas composable_kernel miopengemm miopen clr half rocm-device-libs; + inherit (llvm) openmp clang-tools-extra; + stdenv = llvm.rocmClangStdenv; + rocmlir = rocmlir-rock; + }; } diff --git a/pkgs/development/rocm-modules/5/hipblas/default.nix b/pkgs/development/rocm-modules/5/hipblas/default.nix index cb60e5de6633..b2206c737b00 100644 --- a/pkgs/development/rocm-modules/5/hipblas/default.nix +++ b/pkgs/development/rocm-modules/5/hipblas/default.nix @@ -4,7 +4,7 @@ , rocmUpdateScript , cmake , rocm-cmake -, hip +, clr , gfortran , rocblas , rocsolver @@ -40,7 +40,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake - hip + clr gfortran ]; @@ -94,7 +94,6 @@ stdenv.mkDerivation (finalAttrs: { license = with licenses; [ mit ]; maintainers = teams.rocm.members; platforms = platforms.linux; - # Fixed in develop branch by using C++17 and related refactor - broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version || buildTests || buildBenchmarks || buildSamples; + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; }; }) diff --git a/pkgs/development/rocm-modules/5/hipcub/default.nix b/pkgs/development/rocm-modules/5/hipcub/default.nix index b3a23241366f..447c2c4174af 100644 --- a/pkgs/development/rocm-modules/5/hipcub/default.nix +++ b/pkgs/development/rocm-modules/5/hipcub/default.nix @@ -5,11 +5,12 @@ , cmake , rocm-cmake , rocprim -, hip +, clr , gtest , gbenchmark , buildTests ? false , buildBenchmarks ? false +, gpuTargets ? [ ] }: # CUB can also be used as a backend instead of rocPRIM. @@ -35,7 +36,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake - hip + clr ]; buildInputs = [ @@ -48,12 +49,14 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ "-DCMAKE_CXX_COMPILER=hipcc" - "-DHIP_ROOT_DIR=${hip}" + "-DHIP_ROOT_DIR=${clr}" # Manually define CMAKE_INSTALL_<DIR> # 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_TEST=ON" ] ++ lib.optionals buildBenchmarks [ diff --git a/pkgs/development/rocm-modules/5/hipfft/default.nix b/pkgs/development/rocm-modules/5/hipfft/default.nix index 1e959f0ad56a..153a7c8c18cc 100644 --- a/pkgs/development/rocm-modules/5/hipfft/default.nix +++ b/pkgs/development/rocm-modules/5/hipfft/default.nix @@ -4,7 +4,7 @@ , rocmUpdateScript , cmake , rocm-cmake -, hip +, clr , git , rocfft , gtest @@ -15,6 +15,7 @@ , buildTests ? false , buildBenchmarks ? false , buildSamples ? false +, gpuTargets ? [ ] }: # Can also use cuFFT @@ -41,7 +42,7 @@ stdenv.mkDerivation (finalAttrs: { }; nativeBuildInputs = [ - hip + clr git cmake rocm-cmake @@ -60,14 +61,16 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ "-DCMAKE_C_COMPILER=hipcc" "-DCMAKE_CXX_COMPILER=hipcc" - "-DCMAKE_MODULE_PATH=${hip}/lib/cmake/hip" - "-DHIP_ROOT_DIR=${hip}" - "-DHIP_PATH=${hip}" + "-DCMAKE_MODULE_PATH=${clr}/lib/cmake/hip" + "-DHIP_ROOT_DIR=${clr}" + "-DHIP_PATH=${clr}" # Manually define CMAKE_INSTALL_<DIR> # 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 [ diff --git a/pkgs/development/rocm-modules/5/hipsolver/default.nix b/pkgs/development/rocm-modules/5/hipsolver/default.nix index 238564d631bc..34592a5bbd96 100644 --- a/pkgs/development/rocm-modules/5/hipsolver/default.nix +++ b/pkgs/development/rocm-modules/5/hipsolver/default.nix @@ -4,7 +4,7 @@ , rocmUpdateScript , cmake , rocm-cmake -, hip +, clr , gfortran , rocblas , rocsolver @@ -40,7 +40,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake - hip + clr gfortran ]; diff --git a/pkgs/development/rocm-modules/5/hipsparse/default.nix b/pkgs/development/rocm-modules/5/hipsparse/default.nix index 6e6197209e4b..79b78f3661d8 100644 --- a/pkgs/development/rocm-modules/5/hipsparse/default.nix +++ b/pkgs/development/rocm-modules/5/hipsparse/default.nix @@ -5,13 +5,14 @@ , cmake , rocm-cmake , rocsparse -, hip +, clr , gfortran , git , gtest , openmp , buildTests ? false , buildSamples ? false +, gpuTargets ? [ ] }: # This can also use cuSPARSE as a backend instead of rocSPARSE @@ -37,7 +38,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake - hip + clr gfortran ]; @@ -59,16 +60,15 @@ stdenv.mkDerivation (finalAttrs: { "-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" ]; # 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 '' + postPatch = lib.optionalString buildTests '' mkdir -p matrices ln -s ${rocsparse.passthru.matrices.matrix-01}/*.mtx matrices @@ -116,7 +116,7 @@ stdenv.mkDerivation (finalAttrs: { mkdir -p $sample/bin mv clients/staging/example_* $sample/bin patchelf --set-rpath $out/lib:${lib.makeLibraryPath ( - finalAttrs.buildInputs ++ [ hip gfortran.cc ])} $sample/bin/example_* + finalAttrs.buildInputs ++ [ clr gfortran.cc ])} $sample/bin/example_* ''; passthru.updateScript = rocmUpdateScript { diff --git a/pkgs/development/rocm-modules/5/migraphx/default.nix b/pkgs/development/rocm-modules/5/migraphx/default.nix index fdc97f45da9d..5842cd1695d5 100644 --- a/pkgs/development/rocm-modules/5/migraphx/default.nix +++ b/pkgs/development/rocm-modules/5/migraphx/default.nix @@ -5,11 +5,12 @@ , pkg-config , cmake , rocm-cmake -, hip +, clr , clang-tools-extra , openmp , rocblas , rocmlir +, composable_kernel , miopengemm , miopen , protobuf @@ -19,6 +20,8 @@ , sqlite , oneDNN_2 , blaze +, cppcheck +, rocm-device-libs , texlive , doxygen , sphinx @@ -67,7 +70,7 @@ in stdenv.mkDerivation (finalAttrs: { pkg-config cmake rocm-cmake - hip + clr clang-tools-extra python3Packages.python ] ++ lib.optionals buildDocs [ @@ -84,6 +87,7 @@ in stdenv.mkDerivation (finalAttrs: { openmp rocblas rocmlir + composable_kernel miopengemm miopen protobuf @@ -93,18 +97,16 @@ in stdenv.mkDerivation (finalAttrs: { sqlite oneDNN_2 blaze + cppcheck python3Packages.pybind11 python3Packages.onnx ]; cmakeFlags = [ - "-DCMAKE_POLICY_DEFAULT_CMP0079=NEW" - # "-DCMAKE_C_COMPILER=hipcc" - # "-DCMAKE_CXX_COMPILER=hipcc" - "-DMIGRAPHX_ENABLE_GPU=OFF" # GPU compilation is broken, don't know why + "-DMIGRAPHX_ENABLE_GPU=ON" "-DMIGRAPHX_ENABLE_CPU=ON" "-DMIGRAPHX_ENABLE_FPGA=ON" - "-DMIGRAPHX_ENABLE_MLIR=ON" + "-DMIGRAPHX_ENABLE_MLIR=OFF" # LLVM or rocMLIR mismatch? # Manually define CMAKE_INSTALL_<DIR> # See: https://github.com/NixOS/nixpkgs/pull/197838 "-DCMAKE_INSTALL_BINDIR=bin" @@ -113,10 +115,20 @@ in stdenv.mkDerivation (finalAttrs: { ]; postPatch = '' + # We need to not use hipcc and define the CXXFLAGS manually due to `undefined hidden symbol: tensorflow:: ...` + export CXXFLAGS+="--rocm-path=${clr} --rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode" patchShebangs tools + # `error: '__clang_hip_runtime_wrapper.h' file not found [clang-diagnostic-error]` + substituteInPlace CMakeLists.txt \ + --replace "set(MIGRAPHX_TIDY_ERRORS ALL)" "" + + # JIT library was removed from composable_kernel... + # https://github.com/ROCmSoftwarePlatform/composable_kernel/issues/782 substituteInPlace src/targets/gpu/CMakeLists.txt \ - --replace "CMAKE_CXX_COMPILER MATCHES \".*clang\\\+\\\+\$\"" "TRUE" + --replace " COMPONENTS jit_library" "" \ + --replace " composable_kernel::jit_library" "" \ + --replace "if(WIN32)" "if(TRUE)" '' + lib.optionalString (!buildDocs) '' substituteInPlace CMakeLists.txt \ --replace "add_subdirectory(doc)" "" diff --git a/pkgs/development/rocm-modules/5/miopen/default.nix b/pkgs/development/rocm-modules/5/miopen/default.nix index dd7661a09756..d22518aa51c6 100644 --- a/pkgs/development/rocm-modules/5/miopen/default.nix +++ b/pkgs/development/rocm-modules/5/miopen/default.nix @@ -1,23 +1,26 @@ { lib , stdenv , fetchFromGitHub -, fetchurl +, fetchpatch , rocmUpdateScript +, runCommand , pkg-config , cmake , rocm-cmake , rocblas , rocmlir -, hip +, clr , clang-tools-extra , clang-ocl -, llvm , miopengemm , composable_kernel +, frugally-deep +, rocm-docs-core , half , boost , sqlite , bzip2 +, lbzip2 , nlohmann_json , texlive , doxygen @@ -26,13 +29,48 @@ , gtest , rocm-comgr , python3Packages -, buildDocs ? true +, buildDocs ? false # Needs internet because of rocm-docs-core , buildTests ? false -, fetchKDBs ? true , useOpenCL ? false }: let + version = "5.7.0"; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "MIOpen"; + rev = "rocm-${version}"; + hash = "sha256-xcKmFI8HcRA9bbh6EQGElKykIQ3RJX/q5f4IxXvM1Is="; + fetchLFS = true; + leaveDotGit = true; + + # If you're reading this, it's gonna take a bit of time. + # fetchSubModules doesn't work with postFetch??? + # fetchLFS isn't actually fetching the LFS files... + postFetch = '' + export HOME=$(mktemp -d) + cd $out + + # We need more history to fetch LFS files + git remote add origin $url + git fetch origin + git clean -fdx + git checkout rocm-${version} + + # We need to do this manually since using leaveDotGit and fetchSubmodules errors + git submodule update --init + + # Fetch the LFS files + git lfs install + git lfs fetch --all + git lfs checkout + + # Remove the defunct .git folder + rm -rf .git + ''; + }; + latex = lib.optionalAttrs buildDocs texlive.combine { inherit (texlive) scheme-small latexmk @@ -47,13 +85,40 @@ let titlesec; }; - kdbs = lib.optionalAttrs fetchKDBs import ./deps.nix { - inherit fetchurl; - mirror = "https://repo.radeon.com/rocm/miopen-kernel/rel-5.0"; - }; + gfx900 = runCommand "miopen-gfx900.kdb" { preferLocalBuild = true; } '' + ${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx900.kdb.bz2 > $out + ''; + + gfx906 = runCommand "miopen-gfx906.kdb" { preferLocalBuild = true; } '' + ${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx906.kdb.bz2 > $out + ''; + + gfx908 = runCommand "miopen-gfx908.kdb" { preferLocalBuild = true; } '' + ${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx908.kdb.bz2 > $out + ''; + + gfx90a = runCommand "miopen-gfx90a.kdb" { preferLocalBuild = true; } '' + ${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx90a.kdb.bz2 > $out + ''; + + gfx1030 = runCommand "miopen-gfx1030.kdb" { preferLocalBuild = true; } '' + ${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx1030.kdb.bz2 > $out + ''; in stdenv.mkDerivation (finalAttrs: { + inherit version src; pname = "miopen"; - version = "5.7.0"; + + # Find zstd and add to target. Mainly for torch. + patches = [ + (fetchpatch { + url = "https://github.com/ROCmSoftwarePlatform/MIOpen/commit/e608b4325646afeabb5e52846997b926d2019d19.patch"; + hash = "sha256-oxa3qlIC2bzbwGxrQOZXoY/S7CpLsMrnWRB7Og0tk0M="; + }) + (fetchpatch { + url = "https://github.com/ROCmSoftwarePlatform/MIOpen/commit/3413d2daaeb44b7d6eadcc03033a5954a118491e.patch"; + hash = "sha256-ST4snUcTmmSI1Ogx815KEX9GdMnmubsavDzXCGJkiKs="; + }) + ]; outputs = [ "out" @@ -63,23 +128,15 @@ in stdenv.mkDerivation (finalAttrs: { "test" ]; - src = fetchFromGitHub { - owner = "ROCmSoftwarePlatform"; - repo = "MIOpen"; - rev = "rocm-${finalAttrs.version}"; - hash = "sha256-6Bz4yDbQtV8XlEpwbH0YsJFaaZqH7BOfZDL7F4JTS1Q="; - }; - nativeBuildInputs = [ pkg-config cmake rocm-cmake - hip + clr clang-tools-extra ]; buildInputs = [ - llvm rocblas rocmlir clang-ocl @@ -90,10 +147,12 @@ in stdenv.mkDerivation (finalAttrs: { sqlite bzip2 nlohmann_json + frugally-deep ] ++ lib.optionals buildDocs [ latex doxygen sphinx + rocm-docs-core python3Packages.sphinx-rtd-theme python3Packages.breathe python3Packages.myst-parser @@ -102,7 +161,9 @@ in stdenv.mkDerivation (finalAttrs: { ]; cmakeFlags = [ + "-DCMAKE_CXX_FLAGS=-Wno-#warnings" # <half> -> <half/half.hpp> "-DMIOPEN_USE_MIOPENGEMM=ON" + "-DUNZIPPER=${bzip2}/bin/bunzip2" # Manually define CMAKE_INSTALL_<DIR> # See: https://github.com/NixOS/nixpkgs/pull/197838 "-DCMAKE_INSTALL_BINDIR=bin" @@ -117,58 +178,47 @@ in stdenv.mkDerivation (finalAttrs: { ] ++ lib.optionals buildTests [ "-DBUILD_TESTS=ON" "-DMIOPEN_TEST_ALL=ON" - "-DMIOPEN_TEST_GFX900=ON" - "-DMIOPEN_TEST_GFX906=ON" - "-DMIOPEN_TEST_GFX908=ON" - "-DMIOPEN_TEST_GFX90A=ON" - "-DMIOPEN_TEST_GFX103X=ON" - "-DGOOGLETEST_DIR=${gtest.src}" # Custom linker names ]; postPatch = '' + patchShebangs test src/composable_kernel fin utils install_deps.cmake + substituteInPlace CMakeLists.txt \ - --replace "enable_testing()" "" \ + --replace "unpack_db(\"\''${CMAKE_SOURCE_DIR}/src/kernels/\''${FILE_NAME}.kdb.bz2\")" "" \ --replace "MIOPEN_HIP_COMPILER MATCHES \".*clang\\\\+\\\\+$\"" "true" \ --replace "set(MIOPEN_TIDY_ERRORS ALL)" "" # error: missing required key 'key' - '' + lib.optionalString buildTests '' + substituteInPlace test/gtest/CMakeLists.txt \ - --replace "enable_testing()" "" - '' + lib.optionalString (!buildTests) '' - substituteInPlace CMakeLists.txt \ - --replace "add_subdirectory(test)" "" - '' + lib.optionalString fetchKDBs '' - ln -sf ${kdbs.gfx1030_36} src/kernels/gfx1030_36.kdb - ln -sf ${kdbs.gfx900_56} src/kernels/gfx900_56.kdb - ln -sf ${kdbs.gfx900_64} src/kernels/gfx900_64.kdb - ln -sf ${kdbs.gfx906_60} src/kernels/gfx906_60.kdb - ln -sf ${kdbs.gfx906_64} src/kernels/gfx906_64.kdb - ln -sf ${kdbs.gfx90878} src/kernels/gfx90878.kdb - ln -sf ${kdbs.gfx90a68} src/kernels/gfx90a68.kdb - ln -sf ${kdbs.gfx90a6e} src/kernels/gfx90a6e.kdb + --replace "include(googletest)" "" + + ln -sf ${gfx900} src/kernels/gfx900.kdb + ln -sf ${gfx906} src/kernels/gfx906.kdb + ln -sf ${gfx908} src/kernels/gfx908.kdb + ln -sf ${gfx90a} src/kernels/gfx90a.kdb + ln -sf ${gfx1030} src/kernels/gfx1030.kdb ''; # Unfortunately, it seems like we have to call make on these manually postBuild = lib.optionalString buildDocs '' - export HOME=$(mktemp -d) - make -j$NIX_BUILD_CORES doc + python -m sphinx -T -E -b html -d _build/doctrees -D language=en ../docs _build/html '' + lib.optionalString buildTests '' make -j$NIX_BUILD_CORES check ''; postInstall = '' rm $out/bin/install_precompiled_kernels.sh + ln -sf ${gfx900} $out/share/miopen/db/gfx900.kdb + ln -sf ${gfx906} $out/share/miopen/db/gfx906.kdb + ln -sf ${gfx908} $out/share/miopen/db/gfx908.kdb + ln -sf ${gfx90a} $out/share/miopen/db/gfx90a.kdb + ln -sf ${gfx1030} $out/share/miopen/db/gfx1030.kdb '' + lib.optionalString buildDocs '' mv ../doc/html $out/share/doc/miopen-${if useOpenCL then "opencl" else "hip"} - mv ../doc/pdf/miopen.pdf $out/share/doc/miopen-${if useOpenCL then "opencl" else "hip"} '' + lib.optionalString buildTests '' mkdir -p $test/bin mv bin/test_* $test/bin patchelf --set-rpath $out/lib:${lib.makeLibraryPath (finalAttrs.buildInputs ++ - [ hip rocm-comgr ])} $test/bin/* - '' + lib.optionalString fetchKDBs '' - # Apparently gfx1030_40 wasn't generated so the developers suggest just renaming gfx1030_36 to it - # Should be fixed in the next miopen kernel generation batch - ln -s ${kdbs.gfx1030_36} $out/share/miopen/db/gfx1030_40.kdb + [ clr rocm-comgr ])} $test/bin/* ''; requiredSystemFeatures = [ "big-parallel" ]; diff --git a/pkgs/development/rocm-modules/5/miopen/deps.nix b/pkgs/development/rocm-modules/5/miopen/deps.nix deleted file mode 100644 index e88b61ad974c..000000000000 --- a/pkgs/development/rocm-modules/5/miopen/deps.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ fetchurl -, mirror -}: - -{ - gfx1030_36 = fetchurl { - sha256 = "sha256-zEXDLkRWAHS15LDA5IRyqG5rO7HHPBiVgPlQ8JjSqNc="; - url = "${mirror}/gfx1030_36.kdb"; - }; - - gfx900_56 = fetchurl { - sha256 = "sha256-ZTqUPhVKcQzjO6bxykvZMJk1VZh31dRVs+XqcxEtmeI="; - url = "${mirror}/gfx900_56.kdb"; - }; - - gfx900_64 = fetchurl { - sha256 = "sha256-ZTqUPhVKcQzjO6bxykvZMJk1VZh31dRVs+XqcxEtmeI="; - url = "${mirror}/gfx900_64.kdb"; - }; - - gfx906_60 = fetchurl { - sha256 = "sha256-U6pDo8ICfs6fVIEqRziWeE5/4Vzvu41JkcRVn3ou1e4="; - url = "${mirror}/gfx906_60.kdb"; - }; - - gfx906_64 = fetchurl { - sha256 = "sha256-U6pDo8ICfs6fVIEqRziWeE5/4Vzvu41JkcRVn3ou1e4="; - url = "${mirror}/gfx906_64.kdb"; - }; - - gfx90878 = fetchurl { - sha256 = "sha256-r7DRhNH+jHUXAu64b9vWsZzGD4w5oSHnxH0l2RN0qlQ="; - url = "${mirror}/gfx90878.kdb"; - }; - - gfx90a68 = fetchurl { - sha256 = "sha256-NT//zIPTbzsPJyaVycxwU6BcMTzGc/d+Z4Ab9FImDko="; - url = "${mirror}/gfx90a68.kdb"; - }; - - gfx90a6e = fetchurl { - sha256 = "sha256-ENZHbf+/MGYgSTpALKh2meuZPNhH5bG+WrW/jzvGpBs="; - url = "${mirror}/gfx90a6e.kdb"; - }; -} diff --git a/pkgs/development/rocm-modules/5/miopengemm/default.nix b/pkgs/development/rocm-modules/5/miopengemm/default.nix index 92616f79eedc..bda94cee61b3 100644 --- a/pkgs/development/rocm-modules/5/miopengemm/default.nix +++ b/pkgs/development/rocm-modules/5/miopengemm/default.nix @@ -4,7 +4,8 @@ , rocmUpdateScript , cmake , rocm-cmake -, rocm-opencl-runtime +, clr +, clblast , texlive , doxygen , sphinx @@ -53,11 +54,10 @@ in stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake + clr ]; - buildInputs = [ - rocm-opencl-runtime - ] ++ lib.optionals buildDocs [ + buildInputs = lib.optionals buildDocs [ latex doxygen sphinx @@ -65,6 +65,9 @@ in stdenv.mkDerivation (finalAttrs: { python3Packages.breathe ] ++ lib.optionals buildTests [ openblas + ] ++ lib.optionals buildBenchmarks [ + clblast + python3Packages.openai-triton ]; cmakeFlags = [ @@ -77,10 +80,8 @@ in stdenv.mkDerivation (finalAttrs: { "-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" + "-DAPI_BENCH_CLBLAST=ON" + "-DAPI_BENCH_ISAAC=ON" ]; # Unfortunately, it seems like we have to call make on these manually @@ -118,6 +119,8 @@ in stdenv.mkDerivation (finalAttrs: { license = with licenses; [ mit ]; maintainers = teams.rocm.members; platforms = platforms.linux; - broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; + # They are not making tags or releases, this may break other derivations in the future + # Use version major instead of minor, 6.0 will HOPEFULLY have a release or tag + broken = versions.major finalAttrs.version != versions.major stdenv.cc.version; }; }) diff --git a/pkgs/development/rocm-modules/5/rccl/default.nix b/pkgs/development/rocm-modules/5/rccl/default.nix index 68dafc29c164..d4045252bae4 100644 --- a/pkgs/development/rocm-modules/5/rccl/default.nix +++ b/pkgs/development/rocm-modules/5/rccl/default.nix @@ -5,10 +5,13 @@ , cmake , rocm-cmake , rocm-smi -, hip +, clr +, perl +, hipify , gtest , chrpath , buildTests ? false +, gpuTargets ? [ ] }: stdenv.mkDerivation (finalAttrs: { @@ -31,7 +34,9 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake - hip + clr + perl + hipify ]; buildInputs = [ @@ -42,22 +47,25 @@ stdenv.mkDerivation (finalAttrs: { ]; cmakeFlags = [ - "-DCMAKE_C_COMPILER=hipcc" "-DCMAKE_CXX_COMPILER=hipcc" + "-DBUILD_BFD=OFF" # Can't get it to detect bfd.h # Manually define CMAKE_INSTALL_<DIR> # 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_TESTS=ON" ]; - # Replace the manually set parallel jobs to NIX_BUILD_CORES postPatch = '' + patchShebangs src tools + + # Really strange behavior, `#!/usr/bin/env perl` should work... substituteInPlace CMakeLists.txt \ - --replace "8 P" "$NIX_BUILD_CORES P" \ - --replace "8)" "$NIX_BUILD_CORES)" + --replace "\''$ \''${hipify-perl_executable}" "${perl}/bin/perl ${hipify}/bin/hipify-perl" ''; postInstall = lib.optionalString buildTests '' diff --git a/pkgs/development/rocm-modules/5/rocalution/default.nix b/pkgs/development/rocm-modules/5/rocalution/default.nix index 650e9dc7a1ca..80fd655557df 100644 --- a/pkgs/development/rocm-modules/5/rocalution/default.nix +++ b/pkgs/development/rocm-modules/5/rocalution/default.nix @@ -8,7 +8,7 @@ , rocsparse , rocprim , rocrand -, hip +, clr , git , openmp , openmpi @@ -43,7 +43,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake - hip + clr git ]; @@ -60,8 +60,8 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ "-DCMAKE_CXX_COMPILER=hipcc" - "-DROCM_PATH=${hip}" - "-DHIP_ROOT_DIR=${hip}" + "-DROCM_PATH=${clr}" + "-DHIP_ROOT_DIR=${clr}" "-DSUPPORT_HIP=ON" "-DSUPPORT_OMP=ON" "-DSUPPORT_MPI=ON" @@ -92,7 +92,7 @@ stdenv.mkDerivation (finalAttrs: { rm $sample/bin/rocalution-bench || true patchelf --set-rpath \ - $out/lib:${lib.makeLibraryPath (finalAttrs.buildInputs ++ [ hip ])} \ + $out/lib:${lib.makeLibraryPath (finalAttrs.buildInputs ++ [ clr ])} \ $sample/bin/* '' + lib.optionalString (buildTests || buildBenchmarks) '' rmdir $out/bin diff --git a/pkgs/development/rocm-modules/5/rocblas/default.nix b/pkgs/development/rocm-modules/5/rocblas/default.nix index 59d23ad121da..f1cd81df663f 100644 --- a/pkgs/development/rocm-modules/5/rocblas/default.nix +++ b/pkgs/development/rocm-modules/5/rocblas/default.nix @@ -4,7 +4,7 @@ , rocmUpdateScript , cmake , rocm-cmake -, hip +, clr , python3 , tensile , msgpack @@ -18,13 +18,14 @@ , buildTests ? false , buildBenchmarks ? false , tensileLogic ? "asm_full" -, tensileCOVersion ? "V3" +, tensileCOVersion ? "default" , tensileSepArch ? true , tensileLazyLib ? true , tensileLibFormat ? "msgpack" , gpuTargets ? [ "all" ] }: +# rocBLAS is 3.7GB... I'll have to figure out hydra in another PR stdenv.mkDerivation (finalAttrs: { pname = "rocblas"; version = "5.7.0"; @@ -47,7 +48,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake - hip + clr ]; buildInputs = [ @@ -56,6 +57,7 @@ stdenv.mkDerivation (finalAttrs: { msgpack libxml2 python3Packages.msgpack + python3Packages.joblib ] ++ lib.optionals buildTests [ gtest ] ++ lib.optionals (buildTests || buildBenchmarks) [ diff --git a/pkgs/development/rocm-modules/5/rocfft/default.nix b/pkgs/development/rocm-modules/5/rocfft/default.nix index ee1078eabb28..ac50318622ce 100644 --- a/pkgs/development/rocm-modules/5/rocfft/default.nix +++ b/pkgs/development/rocm-modules/5/rocfft/default.nix @@ -4,7 +4,7 @@ , fetchFromGitHub , rocmUpdateScript , cmake -, hip +, clr , python3 , rocm-cmake , sqlite @@ -14,73 +14,9 @@ , gtest , openmp , rocrand -# NOTE: Update the default GPU targets on every update -, gpuTargets ? [ - "gfx803" - "gfx900" - "gfx906" - "gfx908" - "gfx90a" - "gfx1030" - "gfx1100" - "gfx1102" -] +, gpuTargets ? [ ] }: -let - # To avoid output limit exceeded errors in hydra, we build kernel - # device libs and the kernel RTC cache database in separate derivations - kernelDeviceLibs = map - (target: - (rocfft.overrideAttrs (prevAttrs: { - pname = "rocfft-device-${target}"; - - patches = prevAttrs.patches ++ [ - # Add back install rule for device library - # This workaround is needed because rocm_install_targets - # doesn't support an EXCLUDE_FROM_ALL option - ./device-install.patch - ]; - - buildFlags = [ "rocfft-device-${target}" ]; - - installPhase = '' - runHook preInstall - cmake --install . --component device - runHook postInstall - ''; - - requiredSystemFeatures = [ "big-parallel" ]; - })).override { - gpuTargets = [ target ]; - } - ) - gpuTargets; - - # TODO: Figure out how to also split this by GPU target - # - # It'll be bit more complicated than what we're doing for the kernel - # device libs, because the kernel cache needs to be compiled into - # one sqlite database (whereas the device libs can be linked into - # rocfft as separate libraries for each GPU target). - # - # It's not clear why this needs to even be a db in the first place. - # It would simplify things A LOT if we could just store these - # pre-compiled kernels as files (but that'd need a lot of patching). - kernelRtcCache = rocfft.overrideAttrs (_: { - pname = "rocfft-kernel-cache"; - - buildFlags = [ "rocfft_kernel_cache_target" ]; - - installPhase = '' - runHook preInstall - cmake --install . --component kernel_cache - runHook postInstall - ''; - - requiredSystemFeatures = [ "big-parallel" ]; - }); -in stdenv.mkDerivation (finalAttrs: { pname = "rocfft"; version = "5.7.0"; @@ -92,40 +28,28 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-GZSi03geTT+NUztBWhGYyghLqJGsFjUQzVAKQ7d03uA="; }; - patches = [ - # Exclude kernel compilation & installation from "all" target, - # and split device libraries by GPU target - ./split-kernel-compilation.patch - ]; - nativeBuildInputs = [ cmake - hip + clr python3 rocm-cmake ]; - buildInputs = [ - sqlite - ] ++ lib.optionals (finalAttrs.pname == "rocfft") kernelDeviceLibs; + buildInputs = [ sqlite ]; cmakeFlags = [ "-DCMAKE_C_COMPILER=hipcc" "-DCMAKE_CXX_COMPILER=hipcc" - "-DUSE_HIP_CLANG=ON" "-DSQLITE_USE_SYSTEM_PACKAGE=ON" # Manually define CMAKE_INSTALL_<DIR> # 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}" ]; - postInstall = lib.optionalString (finalAttrs.pname == "rocfft") '' - ln -s ${kernelRtcCache}/lib/rocfft_kernel_cache.db "$out/lib" - ''; - passthru = { test = stdenv.mkDerivation { pname = "${finalAttrs.pname}-test"; @@ -135,7 +59,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake - hip + clr rocm-cmake ]; @@ -168,7 +92,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake - hip + clr rocm-cmake ]; @@ -201,7 +125,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake - hip + clr rocm-cmake ]; @@ -232,6 +156,8 @@ stdenv.mkDerivation (finalAttrs: { }; }; + requiredSystemFeatures = [ "big-parallel" ]; + meta = with lib; { description = "FFT implementation for ROCm"; homepage = "https://github.com/ROCmSoftwarePlatform/rocFFT"; diff --git a/pkgs/development/rocm-modules/5/rocfft/device-install.patch b/pkgs/development/rocm-modules/5/rocfft/device-install.patch deleted file mode 100644 index 355cf30d07ff..000000000000 --- a/pkgs/development/rocm-modules/5/rocfft/device-install.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/library/src/device/CMakeLists.txt b/library/src/device/CMakeLists.txt -index 73a8ec9..9bfd4b8 100644 ---- a/library/src/device/CMakeLists.txt -+++ b/library/src/device/CMakeLists.txt -@@ -255,4 +255,10 @@ foreach( sub ${AMDGPU_TARGETS} ) - if( NOT BUILD_SHARED_LIBS ) - set_target_properties( rocfft-device-${sub} PROPERTIES PREFIX "lib" ) - endif( ) -+ -+ rocm_install_targets( -+ TARGETS -+ rocfft-device-${sub} -+ COMPONENT device -+ ) - endforeach() diff --git a/pkgs/development/rocm-modules/5/rocfft/split-kernel-compilation.patch b/pkgs/development/rocm-modules/5/rocfft/split-kernel-compilation.patch deleted file mode 100644 index 5d71fe399c1a..000000000000 --- a/pkgs/development/rocm-modules/5/rocfft/split-kernel-compilation.patch +++ /dev/null @@ -1,124 +0,0 @@ -diff --git a/library/src/CMakeLists.txt b/library/src/CMakeLists.txt -index 3a16304..606b711 100644 ---- a/library/src/CMakeLists.txt -+++ b/library/src/CMakeLists.txt -@@ -250,12 +250,12 @@ foreach( target - - endforeach() - --add_executable( rocfft_aot_helper -+add_executable( rocfft_aot_helper EXCLUDE_FROM_ALL - rocfft_aot_helper.cpp - rocfft_stub.cpp - ) - --add_executable( rocfft_config_search -+add_executable( rocfft_config_search EXCLUDE_FROM_ALL - rocfft_config_search.cpp - rocfft_stub.cpp - ) -@@ -279,10 +279,10 @@ endif() - - target_link_libraries( rocfft PRIVATE ${ROCFFT_DEVICE_LINK_LIBS} ) - --target_link_libraries( rocfft PRIVATE rocfft-device-0 ) --target_link_libraries( rocfft PRIVATE rocfft-device-1 ) --target_link_libraries( rocfft PRIVATE rocfft-device-2 ) --target_link_libraries( rocfft PRIVATE rocfft-device-3 ) -+foreach( sub ${AMDGPU_TARGETS} ) -+ target_link_libraries( rocfft PRIVATE -lrocfft-device-${sub} ) -+endforeach() -+ - foreach( target rocfft rocfft_aot_helper rocfft_config_search ) - # RTC uses dladdr to find the RTC helper program - if( NOT WIN32 ) -@@ -347,7 +347,7 @@ add_custom_command( - DEPENDS rocfft_aot_helper rocfft_rtc_helper - COMMENT "Compile kernels into shipped cache file" - ) --add_custom_target( rocfft_kernel_cache_target ALL -+add_custom_target( rocfft_kernel_cache_target - DEPENDS rocfft_kernel_cache.db - VERBATIM - ) -@@ -392,7 +392,8 @@ else() - endif() - rocm_install(FILES ${ROCFFT_KERNEL_CACHE_PATH} - DESTINATION "${ROCFFT_KERNEL_CACHE_INSTALL_DIR}" -- COMPONENT runtime -+ COMPONENT kernel_cache -+ EXCLUDE_FROM_ALL - ) - - # PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ -diff --git a/library/src/device/CMakeLists.txt b/library/src/device/CMakeLists.txt -index 9f7b85f..73a8ec9 100644 ---- a/library/src/device/CMakeLists.txt -+++ b/library/src/device/CMakeLists.txt -@@ -170,11 +170,11 @@ list( SORT rocfft_device_source ) - # functions callable by rocFFT and depends on amdhip64, and another - # one usable by AOT RTC that contains no device code - list( FILTER rocfft_device_source EXCLUDE REGEX function_pool.cpp ) --add_library( rocfft-function-pool OBJECT -+add_library( rocfft-function-pool OBJECT EXCLUDE_FROM_ALL - function_pool.cpp - ) - target_compile_definitions( rocfft-function-pool PRIVATE FUNCTION_POOL_STANDALONE_BODY= ) --add_library( rocfft-function-pool-standalone OBJECT -+add_library( rocfft-function-pool-standalone OBJECT EXCLUDE_FROM_ALL - function_pool.cpp - ) - target_compile_definitions( rocfft-function-pool-standalone PRIVATE FUNCTION_POOL_STANDALONE_BODY={} ) -@@ -193,26 +193,15 @@ foreach( pool rocfft-function-pool rocfft-function-pool-standalone ) - add_dependencies(${pool} gen_headers_target) - endforeach() - --list( LENGTH rocfft_device_source rocfft_device_source_len ) --math(EXPR split_len "${rocfft_device_source_len} / 4") --math(EXPR split_idx_2 "${rocfft_device_source_len} / 4 * 2") --math(EXPR split_idx_3 "${rocfft_device_source_len} / 4 * 3") -- --list( SUBLIST rocfft_device_source 0 ${split_len} rocfft_device_source_0 ) --list( SUBLIST rocfft_device_source ${split_len} ${split_len} rocfft_device_source_1 ) --list( SUBLIST rocfft_device_source ${split_idx_2} ${split_len} rocfft_device_source_2 ) --list( SUBLIST rocfft_device_source ${split_idx_3} -1 rocfft_device_source_3 ) -- --foreach( sub RANGE 3 ) -- set( rocfft_device_source_var rocfft_device_source_${sub} ) -+foreach( sub ${AMDGPU_TARGETS} ) - if(NOT SINGLELIB) -- add_library( rocfft-device-${sub} -- ${${rocfft_device_source_var}} ) -+ add_library( rocfft-device-${sub} EXCLUDE_FROM_ALL -+ ${rocfft_device_source} ) - else() - # Compile the device lib as a static library, which is then linked - # into librocfft.so Useful for testing purposes. -- add_library( rocfft-device-${sub} STATIC -- ${${rocfft_device_source_var}} ) -+ add_library( rocfft-device-${sub} STATIC EXCLUDE_FROM_ALL -+ ${rocfft_device_source} ) - - # if we're building singlelib, we don't want to export any of the - # device library symbols to the main library -@@ -241,9 +230,7 @@ foreach( sub RANGE 3 ) - # Set AMD GPU architecture options - - # Enable compilation of desired architectures -- foreach( target ${AMDGPU_TARGETS} ) -- target_compile_options( rocfft-device-${sub} PRIVATE --offload-arch=${target} ) -- endforeach( ) -+ target_compile_options( rocfft-device-${sub} PRIVATE --offload-arch=${sub} ) - - target_include_directories( rocfft-device-${sub} - PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> -@@ -268,9 +255,4 @@ foreach( sub RANGE 3 ) - if( NOT BUILD_SHARED_LIBS ) - set_target_properties( rocfft-device-${sub} PROPERTIES PREFIX "lib" ) - endif( ) -- -- rocm_install_targets( -- TARGETS -- rocfft-device-${sub} -- ) - endforeach() diff --git a/pkgs/development/rocm-modules/5/rocmlir/default.nix b/pkgs/development/rocm-modules/5/rocmlir/default.nix index a2a4923148a0..9b24112dce8a 100644 --- a/pkgs/development/rocm-modules/5/rocmlir/default.nix +++ b/pkgs/development/rocm-modules/5/rocmlir/default.nix @@ -3,28 +3,35 @@ , fetchFromGitHub , rocmUpdateScript , cmake +, rocm-cmake , ninja -, hip -, rocminfo +, clr , git , libxml2 , libedit +, zstd , zlib , ncurses -, python3 +, python3Packages , buildRockCompiler ? false +, buildTests ? false # `argument of type 'NoneType' is not iterable` }: # Theoretically, we could have our MLIR have an output # with the source and built objects so that we can just # use it as the external LLVM repo for this let + suffix = + if buildRockCompiler + then "-rock" + else ""; + llvmNativeTarget = if stdenv.isx86_64 then "X86" else if stdenv.isAarch64 then "AArch64" else throw "Unsupported ROCm LLVM platform"; in stdenv.mkDerivation (finalAttrs: { - pname = "rocmlir"; + pname = "rocmlir${suffix}"; version = "5.7.0"; outputs = [ @@ -42,44 +49,61 @@ in stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake + rocm-cmake ninja - ] ++ lib.optionals (!buildRockCompiler) [ - hip + clr + python3Packages.python + python3Packages.tomli ]; buildInputs = [ git libxml2 libedit - python3 ]; propagatedBuildInputs = [ + zstd zlib ncurses ]; cmakeFlags = [ "-DLLVM_TARGETS_TO_BUILD=AMDGPU;${llvmNativeTarget}" + "-DLLVM_ENABLE_ZSTD=ON" "-DLLVM_ENABLE_ZLIB=ON" "-DLLVM_ENABLE_TERMINFO=ON" + "-DROCM_PATH=${clr}" + # Manually define CMAKE_INSTALL_<DIR> + # See: https://github.com/NixOS/nixpkgs/pull/197838 + "-DCMAKE_INSTALL_BINDIR=bin" + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_INCLUDEDIR=include" ] ++ lib.optionals buildRockCompiler [ "-DBUILD_FAT_LIBROCKCOMPILER=ON" ] ++ lib.optionals (!buildRockCompiler) [ - "-DROCM_PATH=${rocminfo}" "-DROCM_TEST_CHIPSET=gfx000" ]; + postPatch = '' + patchShebangs mlir + + substituteInPlace mlir/utils/performance/common/CMakeLists.txt \ + --replace "/opt/rocm" "${clr}" + ''; + dontBuild = true; doCheck = true; # Certain libs aren't being generated, try enabling tests next update checkTarget = if buildRockCompiler then "librockCompiler" - else "check-mlir-miopen-build-only"; + else if buildTests + then "check-rocmlir" + else "check-rocmlir-build-only"; postInstall = let - libPath = lib.makeLibraryPath [ zlib ncurses hip stdenv.cc.cc ]; + libPath = lib.makeLibraryPath [ zstd zlib ncurses clr stdenv.cc.cc ]; in lib.optionals (!buildRockCompiler) '' mkdir -p $external/lib cp -a external/llvm-project/llvm/lib/{*.a*,*.so*} $external/lib diff --git a/pkgs/development/rocm-modules/5/rocprim/default.nix b/pkgs/development/rocm-modules/5/rocprim/default.nix index e8233547664f..1dd2555c6915 100644 --- a/pkgs/development/rocm-modules/5/rocprim/default.nix +++ b/pkgs/development/rocm-modules/5/rocprim/default.nix @@ -4,11 +4,12 @@ , rocmUpdateScript , cmake , rocm-cmake -, hip +, clr , gtest , gbenchmark , buildTests ? false , buildBenchmarks ? false +, gpuTargets ? [ ] }: stdenv.mkDerivation (finalAttrs: { @@ -33,7 +34,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake - hip + clr ]; buildInputs = lib.optionals buildTests [ @@ -49,6 +50,8 @@ stdenv.mkDerivation (finalAttrs: { "-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_INCLUDEDIR=include" + ] ++ lib.optionals (gpuTargets != [ ]) [ + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" ] ++ lib.optionals buildTests [ "-DBUILD_TEST=ON" ] ++ lib.optionals buildBenchmarks [ @@ -58,6 +61,7 @@ stdenv.mkDerivation (finalAttrs: { postInstall = lib.optionalString buildTests '' mkdir -p $test/bin mv $out/bin/test_* $test/bin + mv $out/bin/rocprim $test/bin '' + lib.optionalString buildBenchmarks '' mkdir -p $benchmark/bin mv $out/bin/benchmark_* $benchmark/bin diff --git a/pkgs/development/rocm-modules/5/rocrand/default.nix b/pkgs/development/rocm-modules/5/rocrand/default.nix index daa24b870ceb..954a299e317e 100644 --- a/pkgs/development/rocm-modules/5/rocrand/default.nix +++ b/pkgs/development/rocm-modules/5/rocrand/default.nix @@ -4,11 +4,12 @@ , rocmUpdateScript , cmake , rocm-cmake -, hip +, clr , gtest , gbenchmark , buildTests ? false , buildBenchmarks ? false +, gpuTargets ? [ ] }: stdenv.mkDerivation (finalAttrs: { @@ -34,7 +35,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake - hip + clr ]; buildInputs = lib.optionals buildTests [ @@ -46,12 +47,14 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ "-DCMAKE_C_COMPILER=hipcc" "-DCMAKE_CXX_COMPILER=hipcc" - "-DHIP_ROOT_DIR=${hip}" + "-DHIP_ROOT_DIR=${clr}" # Manually define CMAKE_INSTALL_<DIR> # 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_TEST=ON" ] ++ lib.optionals buildBenchmarks [ diff --git a/pkgs/development/rocm-modules/5/rocsolver/default.nix b/pkgs/development/rocm-modules/5/rocsolver/default.nix index 3a0858af6335..48bf0950351c 100644 --- a/pkgs/development/rocm-modules/5/rocsolver/default.nix +++ b/pkgs/development/rocm-modules/5/rocsolver/default.nix @@ -5,7 +5,8 @@ , cmake , rocm-cmake , rocblas -, hip +, rocsparse +, clr , fmt , gtest , gfortran @@ -37,13 +38,14 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake - hip + clr ] ++ lib.optionals (buildTests || buildBenchmarks) [ gfortran ]; buildInputs = [ rocblas + rocsparse fmt ] ++ lib.optionals buildTests [ gtest @@ -53,6 +55,7 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ "-DCMAKE_CXX_COMPILER=hipcc" + "-DCMAKE_CXX_FLAGS=-Wno-switch" # Way too many warnings # Manually define CMAKE_INSTALL_<DIR> # See: https://github.com/NixOS/nixpkgs/pull/197838 "-DCMAKE_INSTALL_BINDIR=bin" diff --git a/pkgs/development/rocm-modules/5/rocsparse/default.nix b/pkgs/development/rocm-modules/5/rocsparse/default.nix index d97951530119..945e03c0bc8b 100644 --- a/pkgs/development/rocm-modules/5/rocsparse/default.nix +++ b/pkgs/development/rocm-modules/5/rocsparse/default.nix @@ -6,7 +6,7 @@ , cmake , rocm-cmake , rocprim -, hip +, clr , gfortran , git , gtest @@ -14,6 +14,7 @@ , python3Packages , buildTests ? false , buildBenchmarks ? false # Seems to depend on tests +, gpuTargets ? [ ] }: stdenv.mkDerivation (finalAttrs: { @@ -38,7 +39,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake - hip + clr gfortran ]; @@ -59,6 +60,8 @@ stdenv.mkDerivation (finalAttrs: { "-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" diff --git a/pkgs/development/rocm-modules/5/rocthrust/default.nix b/pkgs/development/rocm-modules/5/rocthrust/default.nix index e441709f89f7..b80b161f5799 100644 --- a/pkgs/development/rocm-modules/5/rocthrust/default.nix +++ b/pkgs/development/rocm-modules/5/rocthrust/default.nix @@ -5,10 +5,11 @@ , cmake , rocm-cmake , rocprim -, hip +, clr , gtest , buildTests ? false , buildBenchmarks ? false +, gpuTargets ? [ ] }: stdenv.mkDerivation (finalAttrs: { @@ -34,7 +35,7 @@ stdenv.mkDerivation (finalAttrs: { cmake rocm-cmake rocprim - hip + clr ]; buildInputs = lib.optionals buildTests [ @@ -43,12 +44,14 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ "-DCMAKE_CXX_COMPILER=hipcc" - "-DHIP_ROOT_DIR=${hip}" + "-DHIP_ROOT_DIR=${clr}" # Manually define CMAKE_INSTALL_<DIR> # 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_TEST=ON" ] ++ lib.optionals buildBenchmarks [ diff --git a/pkgs/development/rocm-modules/5/rocwmma/0000-dont-fetch-googletest.patch b/pkgs/development/rocm-modules/5/rocwmma/0000-dont-fetch-googletest.patch index cee603679758..fa47a3c42249 100644 --- a/pkgs/development/rocm-modules/5/rocwmma/0000-dont-fetch-googletest.patch +++ b/pkgs/development/rocm-modules/5/rocwmma/0000-dont-fetch-googletest.patch @@ -1,8 +1,8 @@ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt -index e1160bb..2a5462e 100644 +index 0d00883..86ce282 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt -@@ -30,26 +30,6 @@ cmake_dependent_option( ROCWMMA_BUILD_VALIDATION_TESTS "Build validation tests" +@@ -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 ) @@ -12,20 +12,24 @@ index e1160bb..2a5462e 100644 -FetchContent_Declare( - googletest - GIT_REPOSITORY https://github.com/google/googletest.git -- GIT_TAG 609281088cfefc76f9d0ce82e1ff6c30cc3591e5 +- 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/5/rocwmma/default.nix b/pkgs/development/rocm-modules/5/rocwmma/default.nix index ef21ed86248a..71d0e3fbe793 100644 --- a/pkgs/development/rocm-modules/5/rocwmma/default.nix +++ b/pkgs/development/rocm-modules/5/rocwmma/default.nix @@ -4,44 +4,24 @@ , rocmUpdateScript , cmake , rocm-cmake -, hip +, rocm-smi +, clr , openmp , gtest , rocblas -, texlive -, doxygen -, sphinx -, python3Packages -, buildDocs ? true -, buildTests ? false +, buildTests ? false # Will likely fail building because wavefront shifts are not supported for certain archs , buildExtendedTests ? false , buildBenchmarks ? false , buildSamples ? false , gpuTargets ? [ ] # gpuTargets = [ "gfx908:xnack-" "gfx90a:xnack-" "gfx90a:xnack+" ... ] }: -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 (finalAttrs: { +stdenv.mkDerivation (finalAttrs: { pname = "rocwmma"; version = "5.7.0"; outputs = [ "out" - ] ++ lib.optionals buildDocs [ - "doc" ] ++ lib.optionals (buildTests || buildBenchmarks) [ "test" ] ++ lib.optionals buildBenchmarks [ @@ -64,28 +44,21 @@ in stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake - hip + clr ]; buildInputs = [ openmp ] ++ lib.optionals (buildTests || buildBenchmarks) [ + rocm-smi gtest rocblas - ] ++ lib.optionals buildDocs [ - latex - doxygen - sphinx - python3Packages.sphinx-rtd-theme - python3Packages.breathe ]; cmakeFlags = [ "-DCMAKE_CXX_COMPILER=hipcc" "-DROCWMMA_BUILD_TESTS=${if buildTests || buildBenchmarks then "ON" else "OFF"}" - "-DROCWMMA_BUILD_VALIDATION_TESTS=ON" "-DROCWMMA_BUILD_SAMPLES=${if buildSamples then "ON" else "OFF"}" - "-DROCWMMA_VALIDATE_WITH_ROCBLAS=ON" # Manually define CMAKE_INSTALL_<DIR> # See: https://github.com/NixOS/nixpkgs/pull/197838 "-DCMAKE_INSTALL_BINDIR=bin" @@ -100,21 +73,7 @@ in stdenv.mkDerivation (finalAttrs: { "-DROCWMMA_BENCHMARK_WITH_ROCBLAS=ON" ]; - postPatch = lib.optionalString buildDocs '' - patchShebangs docs/*.sh - ''; - - # Unfortunately, it seems like we have to call make on this manually - # -DROCWMMA_BUILD_DOCS=ON is invalid, despite being on the README - postBuild = lib.optionalString buildDocs '' - export HOME=$(mktemp -d) - ../docs/run_doc.sh - ''; - - postInstall = lib.optionalString buildDocs '' - mv ../docs/source/_build/html $out/share/doc/rocwmma - mv ../docs/source/_build/latex/rocWMMA.pdf $out/share/doc/rocwmma - '' + lib.optionalString (buildTests || buildBenchmarks) '' + postInstall = lib.optionalString (buildTests || buildBenchmarks) '' mkdir -p $test/bin mv $out/bin/{*_test,*-validate} $test/bin '' + lib.optionalString buildBenchmarks '' diff --git a/pkgs/development/rocm-modules/5/tensile/default.nix b/pkgs/development/rocm-modules/5/tensile/default.nix index 7d0165a42060..86dbaa95e192 100644 --- a/pkgs/development/rocm-modules/5/tensile/default.nix +++ b/pkgs/development/rocm-modules/5/tensile/default.nix @@ -3,14 +3,20 @@ , fetchFromGitHub , rocmUpdateScript , buildPythonPackage +, pytestCheckHook +, setuptools , pyyaml , msgpack , pandas +, joblib +, filelock +, rocminfo }: buildPythonPackage rec { pname = "tensile"; version = "5.7.0"; + format = "pyproject"; src = fetchFromGitHub { owner = "ROCmSoftwarePlatform"; @@ -19,12 +25,29 @@ buildPythonPackage rec { hash = "sha256-CyPGiM/53duJc/oNtOsl6JSsl9uOOYm5R7O6YXaVOm4="; }; - buildInputs = [ + buildInputs = [ setuptools ]; + + propagatedBuildInputs = [ pyyaml msgpack pandas + joblib + ]; + + doCheck = false; # Too many errors, not sure how to set this up properly + + nativeCheckInputs = [ + pytestCheckHook + filelock + rocminfo ]; + preCheck = '' + export ROCM_PATH=${rocminfo} + ''; + + pythonImportsCheck = [ "Tensile" ]; + passthru.updateScript = rocmUpdateScript { name = pname; owner = src.owner; |