Loading pkgs/development/libraries/rapidjson/default.nix +1 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { version = "1.1.0"; src = fetchFromGitHub { owner = "miloyip"; owner = "Tencent"; repo = "rapidjson"; rev = "v${version}"; sha256 = "1jixgb8w97l9gdh3inihz7avz7i770gy2j2irvvlyrq3wi41f5ab"; Loading pkgs/development/libraries/rapidjson/unstable.nix 0 → 100644 +50 −0 Original line number Diff line number Diff line { lib , stdenv , fetchFromGitHub , fetchpatch , pkg-config , cmake , gtest , valgrind }: stdenv.mkDerivation rec { pname = "rapidjson"; version = "unstable-2023-09-28"; src = fetchFromGitHub { owner = "Tencent"; repo = "rapidjson"; rev = "f9d53419e912910fd8fa57d5705fa41425428c35"; hash = "sha256-rl7iy14jn1K2I5U2DrcZnoTQVEGEDKlxmdaOCF/3hfY="; }; nativeBuildInputs = [ pkg-config cmake ]; patches = [ (fetchpatch { name = "do-not-include-gtest-src-dir.patch"; url = "https://git.alpinelinux.org/aports/plain/community/rapidjson/do-not-include-gtest-src-dir.patch?id=9e5eefc7a5fcf5938a8dc8a3be8c75e9e6809909"; hash = "sha256-BjSZEwfCXA/9V+kxQ/2JPWbc26jQn35CfN8+8NW24s4="; }) ]; # for tests, adding gtest to checkInputs does not work # https://github.com/NixOS/nixpkgs/pull/212200 buildInputs = [ gtest ]; cmakeFlags = [ "-DGTEST_SOURCE_DIR=${gtest.dev}/include" ]; nativeCheckInputs = [ valgrind ]; doCheck = !stdenv.hostPlatform.isStatic && !stdenv.isDarwin; meta = with lib; { description = "Fast JSON parser/generator for C++ with both SAX/DOM style API"; homepage = "http://rapidjson.org/"; license = licenses.mit; platforms = platforms.unix; maintainers = with maintainers; [ Madouura ]; }; } pkgs/development/rocm-modules/5/default.nix +257 −1 Original line number Diff line number Diff line { callPackage , recurseIntoAttrs , symlinkJoin , fetchFromGitHub , cudaPackages , python3Packages , elfutils , boost179 , opencv , ffmpeg_4 , libjpeg_turbo , rapidjson-unstable }: let Loading Loading @@ -187,7 +193,7 @@ in rec { }; rocblas = callPackage ./rocblas { inherit rocmUpdateScript rocm-cmake clr tensile; inherit rocblas rocmUpdateScript rocm-cmake clr tensile; inherit (llvm) openmp; stdenv = llvm.rocmClangStdenv; }; Loading Loading @@ -269,4 +275,254 @@ in rec { stdenv = llvm.rocmClangStdenv; rocmlir = rocmlir-rock; }; ## GPUOpen-ProfessionalCompute-Libraries ## rpp = callPackage ./rpp { inherit rocmUpdateScript rocm-cmake rocm-docs-core clr half; inherit (llvm) openmp; stdenv = llvm.rocmClangStdenv; }; rpp-hip = rpp.override { useOpenCL = false; useCPU = false; }; rpp-opencl = rpp.override { useOpenCL = true; useCPU = false; }; rpp-cpu = rpp.override { useOpenCL = false; useCPU = true; }; mivisionx = callPackage ./mivisionx { inherit rocmUpdateScript rocm-cmake rocm-device-libs clr rpp rocblas miopengemm miopen migraphx half rocm-docs-core; inherit (llvm) clang openmp; opencv = opencv.override { enablePython = true; }; ffmpeg = ffmpeg_4; rapidjson = rapidjson-unstable; stdenv = llvm.rocmClangStdenv; # Unfortunately, rocAL needs a custom libjpeg-turbo until further notice # See: https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX/issues/1051 libjpeg_turbo = libjpeg_turbo.overrideAttrs { version = "2.0.6.1"; src = fetchFromGitHub { owner = "rrawther"; repo = "libjpeg-turbo"; rev = "640d7ee1917fcd3b6a5271aa6cf4576bccc7c5fb"; sha256 = "sha256-T52whJ7nZi8jerJaZtYInC2YDN0QM+9tUDqiNr6IsNY="; }; }; }; mivisionx-hip = mivisionx.override { rpp = rpp-hip; useOpenCL = false; useCPU = false; }; mivisionx-opencl = mivisionx.override { rpp = rpp-opencl; miopen = miopen-opencl; useOpenCL = true; useCPU = false; }; mivisionx-cpu = mivisionx.override { rpp = rpp-cpu; useOpenCL = false; useCPU = true; }; ## Meta ## # Emulate common ROCm meta layout # These are mainly for users. I strongly suggest NOT using these in nixpkgs derivations # Don't put these into `propagatedBuildInputs` unless you want PATH/PYTHONPATH issues! # See: https://rocm.docs.amd.com/en/latest/_images/image.004.png # See: https://rocm.docs.amd.com/en/latest/deploy/linux/os-native/package_manager_integration.html meta = rec { rocm-developer-tools = symlinkJoin { name = "rocm-developer-tools-meta"; paths = [ hsa-amd-aqlprofile-bin rocm-core rocr-debug-agent roctracer rocdbgapi rocprofiler rocgdb rocm-language-runtime ]; }; rocm-ml-sdk = symlinkJoin { name = "rocm-ml-sdk-meta"; paths = [ rocm-core miopen-hip rocm-hip-sdk rocm-ml-libraries ]; }; rocm-ml-libraries = symlinkJoin { name = "rocm-ml-libraries-meta"; paths = [ llvm.clang llvm.mlir llvm.openmp rocm-core miopen-hip rocm-hip-libraries ]; }; rocm-hip-sdk = symlinkJoin { name = "rocm-hip-sdk-meta"; paths = [ rocprim rocalution hipfft rocm-core hipcub hipblas rocrand rocfft rocsparse rccl rocthrust rocblas hipsparse hipfort rocwmma hipsolver rocsolver rocm-hip-libraries rocm-hip-runtime-devel ]; }; rocm-hip-libraries = symlinkJoin { name = "rocm-hip-libraries-meta"; paths = [ rocblas hipfort rocm-core rocsolver rocalution rocrand hipblas rocfft hipfft rccl rocsparse hipsparse hipsolver rocm-hip-runtime ]; }; rocm-openmp-sdk = symlinkJoin { name = "rocm-openmp-sdk-meta"; paths = [ rocm-core llvm.clang llvm.mlir llvm.openmp # openmp-extras-devel (https://github.com/ROCm-Developer-Tools/aomp) rocm-language-runtime ]; }; rocm-opencl-sdk = symlinkJoin { name = "rocm-opencl-sdk-meta"; paths = [ rocm-core rocm-runtime clr clr.icd rocm-thunk rocm-opencl-runtime ]; }; rocm-opencl-runtime = symlinkJoin { name = "rocm-opencl-runtime-meta"; paths = [ rocm-core clr clr.icd rocm-language-runtime ]; }; rocm-hip-runtime-devel = symlinkJoin { name = "rocm-hip-runtime-devel-meta"; paths = [ clr rocm-core hipify rocm-cmake llvm.clang llvm.mlir llvm.openmp rocm-thunk rocm-runtime rocm-hip-runtime ]; }; rocm-hip-runtime = symlinkJoin { name = "rocm-hip-runtime-meta"; paths = [ rocm-core rocminfo clr rocm-language-runtime ]; }; rocm-language-runtime = symlinkJoin { name = "rocm-language-runtime-meta"; paths = [ rocm-runtime rocm-core rocm-comgr llvm.openmp # openmp-extras-runtime (https://github.com/ROCm-Developer-Tools/aomp) ]; }; rocm-all = symlinkJoin { name = "rocm-all-meta"; paths = [ rocm-developer-tools rocm-ml-sdk rocm-ml-libraries rocm-hip-sdk rocm-hip-libraries rocm-openmp-sdk rocm-opencl-sdk rocm-opencl-runtime rocm-hip-runtime-devel rocm-hip-runtime rocm-language-runtime ]; }; }; } pkgs/development/rocm-modules/5/mivisionx/default.nix 0 → 100644 +145 −0 Original line number Diff line number Diff line { lib , stdenv , fetchFromGitHub , rocmUpdateScript , cmake , rocm-cmake , rocm-device-libs , clr , pkg-config , rpp , rocblas , miopengemm , miopen , migraphx , clang , openmp , protobuf , qtcreator , opencv , ffmpeg , boost , libjpeg_turbo , half , lmdb , rapidjson , rocm-docs-core , python3Packages , useOpenCL ? false , useCPU ? false , buildDocs ? false # Needs internet , gpuTargets ? [ ] }: stdenv.mkDerivation (finalAttrs: { pname = "mivisionx-" + ( if (!useOpenCL && !useCPU) then "hip" else if (!useOpenCL && !useCPU) then "opencl" else "cpu" ); version = "5.7.0"; src = fetchFromGitHub { owner = "GPUOpen-ProfessionalCompute-Libraries"; repo = "MIVisionX"; rev = "rocm-${finalAttrs.version}"; hash = "sha256-Z7UIqJWuSD+/FoZ1VIbITp4R/bwaqFCQqsL8CRW73Ek="; }; nativeBuildInputs = [ cmake rocm-cmake clr pkg-config ] ++ lib.optionals buildDocs [ rocm-docs-core python3Packages.python ]; buildInputs = [ miopengemm miopen migraphx rpp rocblas openmp half protobuf qtcreator opencv ffmpeg boost libjpeg_turbo lmdb rapidjson python3Packages.pybind11 python3Packages.numpy python3Packages.torchWithRocm ]; cmakeFlags = [ "-DROCM_PATH=${clr}" "-DAMDRPP_PATH=${rpp}" # 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" "-DCMAKE_INSTALL_PREFIX_PYTHON=lib" # "-DAMD_FP16_SUPPORT=ON" `error: typedef redefinition with different types ('__half' vs 'half_float::half')` ] ++ lib.optionals (gpuTargets != [ ]) [ "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" ] ++ lib.optionals (!useOpenCL && !useCPU) [ "-DBACKEND=HIP" ] ++ lib.optionals (useOpenCL && !useCPU) [ "-DBACKEND=OCL" ] ++ lib.optionals useCPU [ "-DBACKEND=CPU" ]; 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 rocAL/rocAL_pybind/examples # Properly find miopengemm and miopen substituteInPlace amd_openvx_extensions/CMakeLists.txt \ --replace "miopengemm PATHS \''${ROCM_PATH} QUIET" "miopengemm PATHS ${miopengemm} QUIET" \ --replace "miopen PATHS \''${ROCM_PATH} QUIET" "miopen PATHS ${miopen} QUIET" \ --replace "\''${ROCM_PATH}/include/miopen/config.h" "${miopen}/include/miopen/config.h" # Properly find turbojpeg substituteInPlace amd_openvx/cmake/FindTurboJpeg.cmake \ --replace "\''${TURBO_JPEG_PATH}/include" "${libjpeg_turbo.dev}/include" \ --replace "\''${TURBO_JPEG_PATH}/lib" "${libjpeg_turbo.out}/lib" # Fix bad paths substituteInPlace rocAL/rocAL/rocAL_hip/CMakeLists.txt amd_openvx_extensions/amd_nn/nn_hip/CMakeLists.txt amd_openvx/openvx/hipvx/CMakeLists.txt \ --replace "COMPILER_FOR_HIP \''${ROCM_PATH}/llvm/bin/clang++" "COMPILER_FOR_HIP ${clang}/bin/clang++" ''; postBuild = lib.optionalString buildDocs '' python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en ../docs _build/html ''; postInstall = lib.optionalString (!useOpenCL && !useCPU) '' patchelf $out/lib/rocal_pybind*.so --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" chmod +x $out/lib/rocal_pybind*.so ''; passthru.updateScript = rocmUpdateScript { name = finalAttrs.pname; owner = finalAttrs.src.owner; repo = finalAttrs.src.repo; }; meta = with lib; { description = "Set of comprehensive computer vision and machine intelligence libraries, utilities, and applications"; homepage = "https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX"; license = with licenses; [ mit ]; maintainers = teams.rocm.members; platforms = platforms.linux; broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; }; }) pkgs/development/rocm-modules/5/rocblas/default.nix +160 −151 Original line number Diff line number Diff line { lib { rocblas , lib , stdenv , fetchFromGitHub , rocmUpdateScript Loading @@ -25,8 +26,52 @@ , tensileLibFormat ? "msgpack" , gpuTargets ? [ "all" ] }: let rocblas = stdenv.mkDerivation (finalAttrs: { # NOTE: Update the default GPU targets on every update gfx80 = (rocblas.override { gpuTargets = [ "gfx803" ]; }).overrideAttrs { pname = "rocblas-tensile-gfx80"; }; gfx90 = (rocblas.override { gpuTargets = [ "gfx900" "gfx906:xnack-" "gfx908:xnack-" "gfx90a:xnack+" "gfx90a:xnack-" ]; }).overrideAttrs { pname = "rocblas-tensile-gfx90"; }; gfx94 = (rocblas.override { gpuTargets = [ "gfx940" "gfx941" "gfx942" ]; }).overrideAttrs { pname = "rocblas-tensile-gfx94"; }; gfx10 = (rocblas.override { gpuTargets = [ "gfx1010" "gfx1012" "gfx1030" ]; }).overrideAttrs { pname = "rocblas-tensile-gfx10"; }; gfx11 = (rocblas.override { gpuTargets = [ "gfx1100" "gfx1101" "gfx1102" ]; }).overrideAttrs { pname = "rocblas-tensile-gfx11"; }; # Unfortunately, we have to do two full builds, otherwise we get overlapping _fallback.dat files fallbacks = rocblas.overrideAttrs { pname = "rocblas-tensile-fallbacks"; }; in stdenv.mkDerivation (finalAttrs: { pname = "rocblas"; version = "5.7.0"; Loading Loading @@ -82,7 +127,7 @@ let ] ++ 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_ROOT=/build/source/tensile/${python3.sitePackages}/Tensile" "-DTensile_LOGIC=${tensileLogic}" "-DTensile_CODE_OBJECT_VERSION=${tensileCOVersion}" "-DTensile_SEPARATE_ARCHITECTURES=${if tensileSepArch then "ON" else "OFF"}" Loading @@ -96,8 +141,21 @@ let "-DCMAKE_CXX_FLAGS=-I${amd-blis}/include/blis" ]; postPatch = lib.optionalString (finalAttrs.pname != "rocblas") '' # Return early and install tensile files manually substituteInPlace library/src/CMakeLists.txt \ --replace "set_target_properties( TensileHost PROPERTIES OUTPUT_NAME" "return()''\nset_target_properties( TensileHost PROPERTIES OUTPUT_NAME" '' + lib.optionalString (buildTensile && finalAttrs.pname == "rocblas") '' # Link the prebuilt Tensile files mkdir -p build/Tensile/library for path in ${gfx80} ${gfx90} ${gfx94} ${gfx10} ${gfx11} ${fallbacks}; do ln -s $path/lib/rocblas/library/* build/Tensile/library done unlink build/Tensile/library/TensileManifest.txt '' + lib.optionalString buildTensile '' # Tensile REALLY wants to write to the nix directory if we include it normally postPatch = lib.optionalString buildTensile '' cp -a ${tensile} tensile chmod +w -R tensile Loading @@ -110,7 +168,17 @@ let --replace "virtualenv_install(\''${Tensile_TEST_LOCAL_PATH})" "" ''; postInstall = lib.optionalString buildTests '' postInstall = lib.optionalString (finalAttrs.pname == "rocblas") '' ln -sf ${fallbacks}/lib/rocblas/library/TensileManifest.txt $out/lib/rocblas/library '' + lib.optionalString (finalAttrs.pname != "rocblas") '' mkdir -p $out/lib/rocblas/library rm -rf $out/share '' + lib.optionalString (finalAttrs.pname != "rocblas" && finalAttrs.pname != "rocblas-tensile-fallbacks") '' rm Tensile/library/{TensileManifest.txt,*_fallback.dat} mv Tensile/library/* $out/lib/rocblas/library '' + lib.optionalString (finalAttrs.pname == "rocblas-tensile-fallbacks") '' mv Tensile/library/{TensileManifest.txt,*_fallback.dat} $out/lib/rocblas/library '' + lib.optionalString buildTests '' mkdir -p $test/bin cp -a $out/bin/* $test/bin rm $test/bin/*-bench || true Loading Loading @@ -138,63 +206,4 @@ let platforms = platforms.linux; broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; }; }); gfx80 = runCommand "rocblas-gfx80" { preferLocalBuild = true; } '' mkdir -p $out/lib/rocblas/library cp -a ${rocblas}/lib/rocblas/library/*gfx80* $out/lib/rocblas/library ''; gfx90 = runCommand "rocblas-gfx90" { preferLocalBuild = true; } '' mkdir -p $out/lib/rocblas/library cp -a ${rocblas}/lib/rocblas/library/*gfx90* $out/lib/rocblas/library ''; gfx94 = runCommand "rocblas-gfx94" { preferLocalBuild = true; } '' mkdir -p $out/lib/rocblas/library cp -a ${rocblas}/lib/rocblas/library/*gfx94* $out/lib/rocblas/library ''; gfx10 = runCommand "rocblas-gfx10" { preferLocalBuild = true; } '' mkdir -p $out/lib/rocblas/library cp -a ${rocblas}/lib/rocblas/library/*gfx10* $out/lib/rocblas/library ''; gfx11 = runCommand "rocblas-gfx11" { preferLocalBuild = true; } '' mkdir -p $out/lib/rocblas/library cp -a ${rocblas}/lib/rocblas/library/*gfx11* $out/lib/rocblas/library ''; in stdenv.mkDerivation (finalAttrs: { inherit (rocblas) pname version src passthru meta; outputs = [ "out" ] ++ lib.optionals buildTests [ "test" ] ++ lib.optionals buildBenchmarks [ "benchmark" ]; dontUnpack = true; dontPatch = true; dontConfigure = true; dontBuild = true; installPhase = '' runHook preInstall mkdir -p $out cp -a --no-preserve=mode ${rocblas}/* $out ln -sf ${gfx80}/lib/rocblas/library/* $out/lib/rocblas/library ln -sf ${gfx90}/lib/rocblas/library/* $out/lib/rocblas/library ln -sf ${gfx94}/lib/rocblas/library/* $out/lib/rocblas/library ln -sf ${gfx10}/lib/rocblas/library/* $out/lib/rocblas/library ln -sf ${gfx11}/lib/rocblas/library/* $out/lib/rocblas/library '' + lib.optionalString buildTests '' cp -a ${rocblas.test} $test '' + lib.optionalString buildBenchmarks '' cp -a ${rocblas.benchmark} $benchmark '' + '' runHook postInstall ''; }) Loading
pkgs/development/libraries/rapidjson/default.nix +1 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { version = "1.1.0"; src = fetchFromGitHub { owner = "miloyip"; owner = "Tencent"; repo = "rapidjson"; rev = "v${version}"; sha256 = "1jixgb8w97l9gdh3inihz7avz7i770gy2j2irvvlyrq3wi41f5ab"; Loading
pkgs/development/libraries/rapidjson/unstable.nix 0 → 100644 +50 −0 Original line number Diff line number Diff line { lib , stdenv , fetchFromGitHub , fetchpatch , pkg-config , cmake , gtest , valgrind }: stdenv.mkDerivation rec { pname = "rapidjson"; version = "unstable-2023-09-28"; src = fetchFromGitHub { owner = "Tencent"; repo = "rapidjson"; rev = "f9d53419e912910fd8fa57d5705fa41425428c35"; hash = "sha256-rl7iy14jn1K2I5U2DrcZnoTQVEGEDKlxmdaOCF/3hfY="; }; nativeBuildInputs = [ pkg-config cmake ]; patches = [ (fetchpatch { name = "do-not-include-gtest-src-dir.patch"; url = "https://git.alpinelinux.org/aports/plain/community/rapidjson/do-not-include-gtest-src-dir.patch?id=9e5eefc7a5fcf5938a8dc8a3be8c75e9e6809909"; hash = "sha256-BjSZEwfCXA/9V+kxQ/2JPWbc26jQn35CfN8+8NW24s4="; }) ]; # for tests, adding gtest to checkInputs does not work # https://github.com/NixOS/nixpkgs/pull/212200 buildInputs = [ gtest ]; cmakeFlags = [ "-DGTEST_SOURCE_DIR=${gtest.dev}/include" ]; nativeCheckInputs = [ valgrind ]; doCheck = !stdenv.hostPlatform.isStatic && !stdenv.isDarwin; meta = with lib; { description = "Fast JSON parser/generator for C++ with both SAX/DOM style API"; homepage = "http://rapidjson.org/"; license = licenses.mit; platforms = platforms.unix; maintainers = with maintainers; [ Madouura ]; }; }
pkgs/development/rocm-modules/5/default.nix +257 −1 Original line number Diff line number Diff line { callPackage , recurseIntoAttrs , symlinkJoin , fetchFromGitHub , cudaPackages , python3Packages , elfutils , boost179 , opencv , ffmpeg_4 , libjpeg_turbo , rapidjson-unstable }: let Loading Loading @@ -187,7 +193,7 @@ in rec { }; rocblas = callPackage ./rocblas { inherit rocmUpdateScript rocm-cmake clr tensile; inherit rocblas rocmUpdateScript rocm-cmake clr tensile; inherit (llvm) openmp; stdenv = llvm.rocmClangStdenv; }; Loading Loading @@ -269,4 +275,254 @@ in rec { stdenv = llvm.rocmClangStdenv; rocmlir = rocmlir-rock; }; ## GPUOpen-ProfessionalCompute-Libraries ## rpp = callPackage ./rpp { inherit rocmUpdateScript rocm-cmake rocm-docs-core clr half; inherit (llvm) openmp; stdenv = llvm.rocmClangStdenv; }; rpp-hip = rpp.override { useOpenCL = false; useCPU = false; }; rpp-opencl = rpp.override { useOpenCL = true; useCPU = false; }; rpp-cpu = rpp.override { useOpenCL = false; useCPU = true; }; mivisionx = callPackage ./mivisionx { inherit rocmUpdateScript rocm-cmake rocm-device-libs clr rpp rocblas miopengemm miopen migraphx half rocm-docs-core; inherit (llvm) clang openmp; opencv = opencv.override { enablePython = true; }; ffmpeg = ffmpeg_4; rapidjson = rapidjson-unstable; stdenv = llvm.rocmClangStdenv; # Unfortunately, rocAL needs a custom libjpeg-turbo until further notice # See: https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX/issues/1051 libjpeg_turbo = libjpeg_turbo.overrideAttrs { version = "2.0.6.1"; src = fetchFromGitHub { owner = "rrawther"; repo = "libjpeg-turbo"; rev = "640d7ee1917fcd3b6a5271aa6cf4576bccc7c5fb"; sha256 = "sha256-T52whJ7nZi8jerJaZtYInC2YDN0QM+9tUDqiNr6IsNY="; }; }; }; mivisionx-hip = mivisionx.override { rpp = rpp-hip; useOpenCL = false; useCPU = false; }; mivisionx-opencl = mivisionx.override { rpp = rpp-opencl; miopen = miopen-opencl; useOpenCL = true; useCPU = false; }; mivisionx-cpu = mivisionx.override { rpp = rpp-cpu; useOpenCL = false; useCPU = true; }; ## Meta ## # Emulate common ROCm meta layout # These are mainly for users. I strongly suggest NOT using these in nixpkgs derivations # Don't put these into `propagatedBuildInputs` unless you want PATH/PYTHONPATH issues! # See: https://rocm.docs.amd.com/en/latest/_images/image.004.png # See: https://rocm.docs.amd.com/en/latest/deploy/linux/os-native/package_manager_integration.html meta = rec { rocm-developer-tools = symlinkJoin { name = "rocm-developer-tools-meta"; paths = [ hsa-amd-aqlprofile-bin rocm-core rocr-debug-agent roctracer rocdbgapi rocprofiler rocgdb rocm-language-runtime ]; }; rocm-ml-sdk = symlinkJoin { name = "rocm-ml-sdk-meta"; paths = [ rocm-core miopen-hip rocm-hip-sdk rocm-ml-libraries ]; }; rocm-ml-libraries = symlinkJoin { name = "rocm-ml-libraries-meta"; paths = [ llvm.clang llvm.mlir llvm.openmp rocm-core miopen-hip rocm-hip-libraries ]; }; rocm-hip-sdk = symlinkJoin { name = "rocm-hip-sdk-meta"; paths = [ rocprim rocalution hipfft rocm-core hipcub hipblas rocrand rocfft rocsparse rccl rocthrust rocblas hipsparse hipfort rocwmma hipsolver rocsolver rocm-hip-libraries rocm-hip-runtime-devel ]; }; rocm-hip-libraries = symlinkJoin { name = "rocm-hip-libraries-meta"; paths = [ rocblas hipfort rocm-core rocsolver rocalution rocrand hipblas rocfft hipfft rccl rocsparse hipsparse hipsolver rocm-hip-runtime ]; }; rocm-openmp-sdk = symlinkJoin { name = "rocm-openmp-sdk-meta"; paths = [ rocm-core llvm.clang llvm.mlir llvm.openmp # openmp-extras-devel (https://github.com/ROCm-Developer-Tools/aomp) rocm-language-runtime ]; }; rocm-opencl-sdk = symlinkJoin { name = "rocm-opencl-sdk-meta"; paths = [ rocm-core rocm-runtime clr clr.icd rocm-thunk rocm-opencl-runtime ]; }; rocm-opencl-runtime = symlinkJoin { name = "rocm-opencl-runtime-meta"; paths = [ rocm-core clr clr.icd rocm-language-runtime ]; }; rocm-hip-runtime-devel = symlinkJoin { name = "rocm-hip-runtime-devel-meta"; paths = [ clr rocm-core hipify rocm-cmake llvm.clang llvm.mlir llvm.openmp rocm-thunk rocm-runtime rocm-hip-runtime ]; }; rocm-hip-runtime = symlinkJoin { name = "rocm-hip-runtime-meta"; paths = [ rocm-core rocminfo clr rocm-language-runtime ]; }; rocm-language-runtime = symlinkJoin { name = "rocm-language-runtime-meta"; paths = [ rocm-runtime rocm-core rocm-comgr llvm.openmp # openmp-extras-runtime (https://github.com/ROCm-Developer-Tools/aomp) ]; }; rocm-all = symlinkJoin { name = "rocm-all-meta"; paths = [ rocm-developer-tools rocm-ml-sdk rocm-ml-libraries rocm-hip-sdk rocm-hip-libraries rocm-openmp-sdk rocm-opencl-sdk rocm-opencl-runtime rocm-hip-runtime-devel rocm-hip-runtime rocm-language-runtime ]; }; }; }
pkgs/development/rocm-modules/5/mivisionx/default.nix 0 → 100644 +145 −0 Original line number Diff line number Diff line { lib , stdenv , fetchFromGitHub , rocmUpdateScript , cmake , rocm-cmake , rocm-device-libs , clr , pkg-config , rpp , rocblas , miopengemm , miopen , migraphx , clang , openmp , protobuf , qtcreator , opencv , ffmpeg , boost , libjpeg_turbo , half , lmdb , rapidjson , rocm-docs-core , python3Packages , useOpenCL ? false , useCPU ? false , buildDocs ? false # Needs internet , gpuTargets ? [ ] }: stdenv.mkDerivation (finalAttrs: { pname = "mivisionx-" + ( if (!useOpenCL && !useCPU) then "hip" else if (!useOpenCL && !useCPU) then "opencl" else "cpu" ); version = "5.7.0"; src = fetchFromGitHub { owner = "GPUOpen-ProfessionalCompute-Libraries"; repo = "MIVisionX"; rev = "rocm-${finalAttrs.version}"; hash = "sha256-Z7UIqJWuSD+/FoZ1VIbITp4R/bwaqFCQqsL8CRW73Ek="; }; nativeBuildInputs = [ cmake rocm-cmake clr pkg-config ] ++ lib.optionals buildDocs [ rocm-docs-core python3Packages.python ]; buildInputs = [ miopengemm miopen migraphx rpp rocblas openmp half protobuf qtcreator opencv ffmpeg boost libjpeg_turbo lmdb rapidjson python3Packages.pybind11 python3Packages.numpy python3Packages.torchWithRocm ]; cmakeFlags = [ "-DROCM_PATH=${clr}" "-DAMDRPP_PATH=${rpp}" # 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" "-DCMAKE_INSTALL_PREFIX_PYTHON=lib" # "-DAMD_FP16_SUPPORT=ON" `error: typedef redefinition with different types ('__half' vs 'half_float::half')` ] ++ lib.optionals (gpuTargets != [ ]) [ "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" ] ++ lib.optionals (!useOpenCL && !useCPU) [ "-DBACKEND=HIP" ] ++ lib.optionals (useOpenCL && !useCPU) [ "-DBACKEND=OCL" ] ++ lib.optionals useCPU [ "-DBACKEND=CPU" ]; 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 rocAL/rocAL_pybind/examples # Properly find miopengemm and miopen substituteInPlace amd_openvx_extensions/CMakeLists.txt \ --replace "miopengemm PATHS \''${ROCM_PATH} QUIET" "miopengemm PATHS ${miopengemm} QUIET" \ --replace "miopen PATHS \''${ROCM_PATH} QUIET" "miopen PATHS ${miopen} QUIET" \ --replace "\''${ROCM_PATH}/include/miopen/config.h" "${miopen}/include/miopen/config.h" # Properly find turbojpeg substituteInPlace amd_openvx/cmake/FindTurboJpeg.cmake \ --replace "\''${TURBO_JPEG_PATH}/include" "${libjpeg_turbo.dev}/include" \ --replace "\''${TURBO_JPEG_PATH}/lib" "${libjpeg_turbo.out}/lib" # Fix bad paths substituteInPlace rocAL/rocAL/rocAL_hip/CMakeLists.txt amd_openvx_extensions/amd_nn/nn_hip/CMakeLists.txt amd_openvx/openvx/hipvx/CMakeLists.txt \ --replace "COMPILER_FOR_HIP \''${ROCM_PATH}/llvm/bin/clang++" "COMPILER_FOR_HIP ${clang}/bin/clang++" ''; postBuild = lib.optionalString buildDocs '' python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en ../docs _build/html ''; postInstall = lib.optionalString (!useOpenCL && !useCPU) '' patchelf $out/lib/rocal_pybind*.so --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" chmod +x $out/lib/rocal_pybind*.so ''; passthru.updateScript = rocmUpdateScript { name = finalAttrs.pname; owner = finalAttrs.src.owner; repo = finalAttrs.src.repo; }; meta = with lib; { description = "Set of comprehensive computer vision and machine intelligence libraries, utilities, and applications"; homepage = "https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX"; license = with licenses; [ mit ]; maintainers = teams.rocm.members; platforms = platforms.linux; broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; }; })
pkgs/development/rocm-modules/5/rocblas/default.nix +160 −151 Original line number Diff line number Diff line { lib { rocblas , lib , stdenv , fetchFromGitHub , rocmUpdateScript Loading @@ -25,8 +26,52 @@ , tensileLibFormat ? "msgpack" , gpuTargets ? [ "all" ] }: let rocblas = stdenv.mkDerivation (finalAttrs: { # NOTE: Update the default GPU targets on every update gfx80 = (rocblas.override { gpuTargets = [ "gfx803" ]; }).overrideAttrs { pname = "rocblas-tensile-gfx80"; }; gfx90 = (rocblas.override { gpuTargets = [ "gfx900" "gfx906:xnack-" "gfx908:xnack-" "gfx90a:xnack+" "gfx90a:xnack-" ]; }).overrideAttrs { pname = "rocblas-tensile-gfx90"; }; gfx94 = (rocblas.override { gpuTargets = [ "gfx940" "gfx941" "gfx942" ]; }).overrideAttrs { pname = "rocblas-tensile-gfx94"; }; gfx10 = (rocblas.override { gpuTargets = [ "gfx1010" "gfx1012" "gfx1030" ]; }).overrideAttrs { pname = "rocblas-tensile-gfx10"; }; gfx11 = (rocblas.override { gpuTargets = [ "gfx1100" "gfx1101" "gfx1102" ]; }).overrideAttrs { pname = "rocblas-tensile-gfx11"; }; # Unfortunately, we have to do two full builds, otherwise we get overlapping _fallback.dat files fallbacks = rocblas.overrideAttrs { pname = "rocblas-tensile-fallbacks"; }; in stdenv.mkDerivation (finalAttrs: { pname = "rocblas"; version = "5.7.0"; Loading Loading @@ -82,7 +127,7 @@ let ] ++ 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_ROOT=/build/source/tensile/${python3.sitePackages}/Tensile" "-DTensile_LOGIC=${tensileLogic}" "-DTensile_CODE_OBJECT_VERSION=${tensileCOVersion}" "-DTensile_SEPARATE_ARCHITECTURES=${if tensileSepArch then "ON" else "OFF"}" Loading @@ -96,8 +141,21 @@ let "-DCMAKE_CXX_FLAGS=-I${amd-blis}/include/blis" ]; postPatch = lib.optionalString (finalAttrs.pname != "rocblas") '' # Return early and install tensile files manually substituteInPlace library/src/CMakeLists.txt \ --replace "set_target_properties( TensileHost PROPERTIES OUTPUT_NAME" "return()''\nset_target_properties( TensileHost PROPERTIES OUTPUT_NAME" '' + lib.optionalString (buildTensile && finalAttrs.pname == "rocblas") '' # Link the prebuilt Tensile files mkdir -p build/Tensile/library for path in ${gfx80} ${gfx90} ${gfx94} ${gfx10} ${gfx11} ${fallbacks}; do ln -s $path/lib/rocblas/library/* build/Tensile/library done unlink build/Tensile/library/TensileManifest.txt '' + lib.optionalString buildTensile '' # Tensile REALLY wants to write to the nix directory if we include it normally postPatch = lib.optionalString buildTensile '' cp -a ${tensile} tensile chmod +w -R tensile Loading @@ -110,7 +168,17 @@ let --replace "virtualenv_install(\''${Tensile_TEST_LOCAL_PATH})" "" ''; postInstall = lib.optionalString buildTests '' postInstall = lib.optionalString (finalAttrs.pname == "rocblas") '' ln -sf ${fallbacks}/lib/rocblas/library/TensileManifest.txt $out/lib/rocblas/library '' + lib.optionalString (finalAttrs.pname != "rocblas") '' mkdir -p $out/lib/rocblas/library rm -rf $out/share '' + lib.optionalString (finalAttrs.pname != "rocblas" && finalAttrs.pname != "rocblas-tensile-fallbacks") '' rm Tensile/library/{TensileManifest.txt,*_fallback.dat} mv Tensile/library/* $out/lib/rocblas/library '' + lib.optionalString (finalAttrs.pname == "rocblas-tensile-fallbacks") '' mv Tensile/library/{TensileManifest.txt,*_fallback.dat} $out/lib/rocblas/library '' + lib.optionalString buildTests '' mkdir -p $test/bin cp -a $out/bin/* $test/bin rm $test/bin/*-bench || true Loading Loading @@ -138,63 +206,4 @@ let platforms = platforms.linux; broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; }; }); gfx80 = runCommand "rocblas-gfx80" { preferLocalBuild = true; } '' mkdir -p $out/lib/rocblas/library cp -a ${rocblas}/lib/rocblas/library/*gfx80* $out/lib/rocblas/library ''; gfx90 = runCommand "rocblas-gfx90" { preferLocalBuild = true; } '' mkdir -p $out/lib/rocblas/library cp -a ${rocblas}/lib/rocblas/library/*gfx90* $out/lib/rocblas/library ''; gfx94 = runCommand "rocblas-gfx94" { preferLocalBuild = true; } '' mkdir -p $out/lib/rocblas/library cp -a ${rocblas}/lib/rocblas/library/*gfx94* $out/lib/rocblas/library ''; gfx10 = runCommand "rocblas-gfx10" { preferLocalBuild = true; } '' mkdir -p $out/lib/rocblas/library cp -a ${rocblas}/lib/rocblas/library/*gfx10* $out/lib/rocblas/library ''; gfx11 = runCommand "rocblas-gfx11" { preferLocalBuild = true; } '' mkdir -p $out/lib/rocblas/library cp -a ${rocblas}/lib/rocblas/library/*gfx11* $out/lib/rocblas/library ''; in stdenv.mkDerivation (finalAttrs: { inherit (rocblas) pname version src passthru meta; outputs = [ "out" ] ++ lib.optionals buildTests [ "test" ] ++ lib.optionals buildBenchmarks [ "benchmark" ]; dontUnpack = true; dontPatch = true; dontConfigure = true; dontBuild = true; installPhase = '' runHook preInstall mkdir -p $out cp -a --no-preserve=mode ${rocblas}/* $out ln -sf ${gfx80}/lib/rocblas/library/* $out/lib/rocblas/library ln -sf ${gfx90}/lib/rocblas/library/* $out/lib/rocblas/library ln -sf ${gfx94}/lib/rocblas/library/* $out/lib/rocblas/library ln -sf ${gfx10}/lib/rocblas/library/* $out/lib/rocblas/library ln -sf ${gfx11}/lib/rocblas/library/* $out/lib/rocblas/library '' + lib.optionalString buildTests '' cp -a ${rocblas.test} $test '' + lib.optionalString buildBenchmarks '' cp -a ${rocblas.benchmark} $benchmark '' + '' runHook postInstall ''; })