diff --git a/nixos/doc/manual/release-notes/rl-2611.section.md b/nixos/doc/manual/release-notes/rl-2611.section.md index 9c6bac4f7aa62..cba8545e6f556 100644 --- a/nixos/doc/manual/release-notes/rl-2611.section.md +++ b/nixos/doc/manual/release-notes/rl-2611.section.md @@ -632,3 +632,32 @@ The above example can be migrated via the following structured code block: If your environment requires strict reverse path filtering, you must now explicitly configure it with `networking.firewall.checkReversePath = "strict";`. - `services.photoprism` installations that are upgrading to version `260919-28c46a116` or later are advised to [migrate their library](https://docs.photoprism.app/user-guide/ai/face-recognition/#upgrading-an-existing-library) to take advantage of the newer face detection and embedding models. This can be done by using the `photoprism-manage` script. + +- `rocmPackages.rocm-bandwidth-test` has been removed; upstream retired it. + +- `rocmPackages` has been updated from ROCm 7.2.4 to ROCm 10.1. AMD skipped + the 8.x and 9.x series. ROCm 10 breaks ABI and API: + `amdsmi` moves to the 27.0.0 ABI (`libamd_smi.so.27`, several clock/throttle + APIs removed), `rocsparse` drops `rocsparse_indextype_u16`, `hipcub` removes + its deprecated iterators and operators, and `miopen` drops its OpenCL backend. + Update out-of-tree packages that compile against `rocmPackages` for these + changes. The ROCm LLVM toolchain is now LLVM 24. + + `rocmPackages.rocmlir` has been removed: `ROCm/rocMLIR` has no ROCm 10 + release. MIGraphX uses `rocmPackages.rocmlir-triton`, the fork that + AMDMIGraphX 10.1 pins. MIOpen 10.1 is built without MLIR, following + upstream's new default. + + `rocmPackages.hipfile` is new: hipFile, ROCm's direct-to-GPU file I/O + library (the counterpart of cuFile). PyTorch 2.14 requires it with ROCm 7.14 + and later, so `torch` with `rocmSupport` now builds against it. + + `composable_kernel`, the `miopen` CK solvers, and `vllm` no longer support + `gfx900`/`gfx906` (Vega / MI25 / MI50 / Radeon VII) on ROCm 10. + `rocblas`/`hipblas`-only consumers such as `llama-cpp` and `ollama` still + build for those targets. To stay on ROCm 7.2.x, use the NixOS 26.05 + stable channel. + + The versioned `rocmPackages_10` attribute remains available. MIOpen's hipconv + backend is disabled because its cdna4 kernels fail to compile with the ROCm + LLVM 24 toolchain. diff --git a/pkgs/by-name/ol/ollama/package.nix b/pkgs/by-name/ol/ollama/package.nix index 48ce97ec8b4d9..59000f20c6ffc 100644 --- a/pkgs/by-name/ol/ollama/package.nix +++ b/pkgs/by-name/ol/ollama/package.nix @@ -259,13 +259,12 @@ goBuild (finalAttrs: { # ship without `libggml-cuda.so` and fall back to CPU at runtime. # The accepted values map to cmake/local.cmake's elseif chain # (cuda_v12 / cuda_v13 / rocm_v7_1 / rocm_v7_2 / vulkan / cuda_jetpack*). - rocmMajorVersion = lib.versions.major rocmPackages.clr.version; - rocmMinorVersion = lib.versions.minor rocmPackages.clr.version; llamaBackend = if enableCuda then "cuda_v${cudaMajorVersion}" else if enableRocm then - "rocm_v${rocmMajorVersion}_${rocmMinorVersion}" + # TODO: switch to a ROCm 10 backend once ollama has one. + "rocm_v7_2" else if enableVulkan then "vulkan" else diff --git a/pkgs/by-name/op/opensplat/package.nix b/pkgs/by-name/op/opensplat/package.nix index c69f7ce03478b..f679723b89ab7 100644 --- a/pkgs/by-name/op/opensplat/package.nix +++ b/pkgs/by-name/op/opensplat/package.nix @@ -3,6 +3,7 @@ stdenv, cmake, ninja, + pkg-config, fetchFromGitHub, python3, opencv, @@ -81,6 +82,7 @@ stdenv'.mkDerivation (finalAttrs: { ] ++ lib.optionals rocmSupport [ rocmPackages.clr + pkg-config ] ++ lib.optionals cudaSupport [ cudaPackages.cuda_nvcc @@ -106,7 +108,6 @@ stdenv'.mkDerivation (finalAttrs: { rocmPackages.hipblaslt rocmPackages.rocblas rocmPackages.rocsolver - rocmPackages.rocsolver rocmPackages.miopen ] ++ lib.optionals cudaSupport [ diff --git a/pkgs/development/compilers/llvm/common/openmp/default.nix b/pkgs/development/compilers/llvm/common/openmp/default.nix index 2601e294fccfe..d6792fa1a94b5 100644 --- a/pkgs/development/compilers/llvm/common/openmp/default.nix +++ b/pkgs/development/compilers/llvm/common/openmp/default.nix @@ -36,15 +36,28 @@ stdenv.mkDerivation (finalAttrs: { strictDeps = true; __structuredAttrs = true; } - '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/openmp "$out" - '' + ( + '' + mkdir -p "$out" + cp -r ${monorepoSrc}/cmake "$out" + cp -r ${monorepoSrc}/openmp "$out" + '' + + lib.optionalString (lib.versionAtLeast release_version "23") '' + mkdir -p "$out/llvm" + cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" + cp -r ${monorepoSrc}/llvm/utils "$out/llvm" + cp -r ${monorepoSrc}/third-party "$out" + cp -r ${monorepoSrc}/runtimes "$out" + '' + ) else src; - sourceRoot = "${finalAttrs.src.name}/openmp"; + # LLVM 23 removed OpenMP's standalone build + # https://openmp.llvm.org/Building.html + sourceRoot = + "${finalAttrs.src.name}/" + + (if lib.versionAtLeast release_version "23" then "runtimes" else "openmp"); outputs = [ "out" @@ -89,6 +102,9 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeFeature "OPT_TOOL" "${llvm}/bin/opt") (lib.cmakeFeature "LINK_TOOL" "${llvm}/bin/llvm-link") ] + ++ lib.optionals (lib.versionAtLeast release_version "23") [ + (lib.cmakeFeature "LLVM_ENABLE_RUNTIMES" "openmp") + ] ++ devExtraCmakeFlags; doCheck = false; @@ -96,7 +112,9 @@ stdenv.mkDerivation (finalAttrs: { checkTarget = "check-openmp"; preCheck = '' - patchShebangs ../tools/archer/tests/deflake.bash + patchShebangs ${ + if lib.versionAtLeast release_version "23" then "../../openmp" else ".." + }/tools/archer/tests/deflake.bash ''; __structuredAttrs = true; diff --git a/pkgs/development/python-modules/torch/source/default.nix b/pkgs/development/python-modules/torch/source/default.nix index bfa46e21f05e7..acf87c6f362a9 100644 --- a/pkgs/development/python-modules/torch/source/default.nix +++ b/pkgs/development/python-modules/torch/source/default.nix @@ -58,6 +58,7 @@ openssl, numactl, llvmPackages, + libdrm, # dependencies filelock, @@ -236,6 +237,8 @@ let rocprofiler-sdk rocprofiler-sdk.dev amdsmi + # LoadHIP requires hipfile from ROCm 7.14 on + hipfile ] ++ lib.optionals (!vendorComposableKernel) [ composable_kernel @@ -646,6 +649,7 @@ buildPythonPackage.override { inherit stdenv; } (finalAttrs: { ++ lib.optionals rocmSupport [ rocmtoolkit_joined rocmPackages.clr # Added separately so setup hook applies + libdrm ]; dependencies = [ @@ -673,7 +677,13 @@ buildPythonPackage.override { inherit stdenv; } (finalAttrs: { ]; propagatedCxxBuildInputs = - [ ] ++ lib.optionals MPISupport [ mpi ] ++ lib.optionals rocmSupport [ rocmtoolkit_joined ]; + [ ] + ++ lib.optionals MPISupport [ mpi ] + ++ lib.optionals rocmSupport [ + rocmtoolkit_joined + # cxxdev records plain store paths, so name the output with libdrm.pc + (lib.getDev libdrm) + ]; # Tests take a long time and may be flaky, so just sanity-check imports doCheck = false; diff --git a/pkgs/development/python-modules/torchcodec/default.nix b/pkgs/development/python-modules/torchcodec/default.nix index cd8934ea99927..f663619e1c4cd 100644 --- a/pkgs/development/python-modules/torchcodec/default.nix +++ b/pkgs/development/python-modules/torchcodec/default.nix @@ -15,6 +15,7 @@ libjpeg, libpng, libwebp, + libdrm, # build-system cmake, @@ -113,7 +114,8 @@ buildPythonPackage.override { inherit (torch) stdenv; } (finalAttrs: { libnpp # nppicc libnvjpeg # nvjpeg.h ] - ); + ) + ++ lib.optionals rocmSupport [ libdrm ]; build-system = [ cmake diff --git a/pkgs/development/python-modules/vllm/default.nix b/pkgs/development/python-modules/vllm/default.nix index 54f7c55f8ad62..f0f908ebb79c8 100644 --- a/pkgs/development/python-modules/vllm/default.nix +++ b/pkgs/development/python-modules/vllm/default.nix @@ -539,6 +539,8 @@ buildPythonPackage.override { stdenv = torch.stdenv; } (finalAttrs: { rocshmem rocm-smi hipsparselt + # torch's LoadHIP requires hipfile from ROCm 7.14 on + hipfile ] ) ++ lib.optionals stdenv.cc.isClang [ diff --git a/pkgs/development/rocm-modules/amdsmi/default.nix b/pkgs/development/rocm-modules/10/amdsmi/default.nix similarity index 60% rename from pkgs/development/rocm-modules/amdsmi/default.nix rename to pkgs/development/rocm-modules/10/amdsmi/default.nix index d483dde8b6e8a..abb1ecd74e48e 100644 --- a/pkgs/development/rocm-modules/amdsmi/default.nix +++ b/pkgs/development/rocm-modules/10/amdsmi/default.nix @@ -6,62 +6,57 @@ cmake, pkg-config, libdrm, + libnl, + libmnl, python, wrapPython, autoPatchelfHook, + binutils, }: let esmi_ib_src = fetchFromGitHub { owner = "amd"; repo = "esmi_ib_library"; - tag = "esmi_pkg_ver-4.2"; - hash = "sha256-czF9ezkAO0PuDkXh8y639AcOZH+KVcWiXPX74H5W/nw="; + # The commit amdsmi pins (tag esmi_pkg_ver-5.2.1.1) + rev = "d494a3194ceb4cc4dbb2debf9fcbe8773c6d3bef"; + hash = "sha256-StSYzyIujaH8UJIRpfJC0lf+oVT9fWflJgQONvRqu70="; }; in stdenv.mkDerivation (finalAttrs: { pname = "amdsmi"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/amdsmi" "shared" ]; - hash = "sha256-TFi+3txemvV6K827e8S3hZOd9jcj4Qzop6V9CdKrpLg="; + hash = "sha256-CmCVPmqgU0HtqIBuJUs+Nr7LRKtngOaNNsWFek9Nino="; }; sourceRoot = "${finalAttrs.src.name}/projects/amdsmi"; postPatch = '' - substituteInPlace goamdsmi_shim/CMakeLists.txt \ - --replace-fail "amd_smi)" ${"'"}''${AMD_SMI_TARGET})' \ - --replace-fail 'target_link_libraries(''${GOAMDSMI_SHIM_TARGET} -L' '#' - substituteInPlace CMakeLists.txt \ - --replace-fail "if(NOT latest_esmi_tag STREQUAL current_esmi_tag)" "if(OFF)" - - # Manually unpack esmi_ib_src and add amd_hsmp.h so execute-process git clone doesn't run + # Pre-populate esmi_ib_library so CMake does not FetchContent it. cp -rf --no-preserve=mode ${esmi_ib_src} ./esmi_ib_library mkdir -p ./esmi_ib_library/include/asm cp ./include/amd_smi/impl/amd_hsmp.h ./esmi_ib_library/include/asm/amd_hsmp.h ''; - patches = [ - # Fix error: redefinition of 'struct drm_color_ctm_3x4' - # https://github.com/ROCm/amdsmi/pull/165 - ./drm-struct-redefinition-fix.patch - ]; - nativeBuildInputs = [ cmake pkg-config wrapPython autoPatchelfHook + binutils # CMake resolves link-lib SONAMEs via `objdump -p` ]; buildInputs = [ libdrm + libnl # pkg_check_modules libnl-3.0 + libnl-genl-3.0 + libmnl # pkg_check_modules libmnl ]; cmakeFlags = [ @@ -70,6 +65,15 @@ stdenv.mkDerivation (finalAttrs: { "-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_INCLUDEDIR=include" + # py-interface/CMakeLists.txt fails without a system python3 unless this is set. + "-DAMDSMI_SYSTEM_PYTHON_SITELIB=${placeholder "out"}/${python.sitePackages}" + # libamd_smi.so still exports rsmi_init, and its own call to it goes + # through the PLT. Once librocm_smi64 is loaded globally (torch's + # libtorch_hip needs it), that call binds to rocm_smi's copy, amdsmi's own + # state is never initialised, and enumeration returns no processors: + # torch.cuda.device_count() is then 0. Upstream links only the wheel's + # libamd_smi_python.so this way; do the same for the system library. + "-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-Bsymbolic-functions" ]; postInstall = '' diff --git a/pkgs/development/rocm-modules/aqlprofile/default.nix b/pkgs/development/rocm-modules/10/aqlprofile/default.nix similarity index 86% rename from pkgs/development/rocm-modules/aqlprofile/default.nix rename to pkgs/development/rocm-modules/10/aqlprofile/default.nix index 34b1d92f3d57f..84e13ff75271a 100644 --- a/pkgs/development/rocm-modules/aqlprofile/default.nix +++ b/pkgs/development/rocm-modules/10/aqlprofile/default.nix @@ -9,17 +9,17 @@ stdenv.mkDerivation (finalAttrs: { pname = "aqlprofile"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/aqlprofile" "shared" ]; - hash = "sha256-74HjB5Ughu17rSRx9mfCCsPJI4TVyXnT4aU7vIbm7ak="; + hash = "sha256-7yeEJoyShSCwy1MTCeArYBabh5qTVm5uZL8N74rvxPA="; }; sourceRoot = "${finalAttrs.src.name}/projects/aqlprofile"; diff --git a/pkgs/development/rocm-modules/clr/cmake-find-x11-libgl.patch b/pkgs/development/rocm-modules/10/clr/cmake-find-x11-libgl.patch similarity index 100% rename from pkgs/development/rocm-modules/clr/cmake-find-x11-libgl.patch rename to pkgs/development/rocm-modules/10/clr/cmake-find-x11-libgl.patch diff --git a/pkgs/development/rocm-modules/clr/default.nix b/pkgs/development/rocm-modules/10/clr/default.nix similarity index 95% rename from pkgs/development/rocm-modules/clr/default.nix rename to pkgs/development/rocm-modules/10/clr/default.nix index 554c76d845c04..238c9ae4ba023 100644 --- a/pkgs/development/rocm-modules/clr/default.nix +++ b/pkgs/development/rocm-modules/10/clr/default.nix @@ -70,7 +70,7 @@ let in stdenv.mkDerivation (finalAttrs: { pname = "clr"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -83,12 +83,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/clr" "shared" ]; - hash = "sha256-//cQBKlSB9uSP4fBgJpI1FxnqlzyQN913CHVGa2tqv8="; + hash = "sha256-uK/JD5p72os15+n6Jw6aU0xELphBHdYnVu7NmXC3BA4="; }; sourceRoot = "${finalAttrs.src.name}/projects/clr"; @@ -212,6 +212,11 @@ stdenv.mkDerivation (finalAttrs: { ln -s ${rocminfo}/bin/* $out/bin ln -s ${rocm-core}/include/* $out/include/ + # Installed by opencl/CMakeLists.txt; the ICD file would collide with $icd's. + # https://github.com/ROCm/rocm-systems/blob/therock-10.1/projects/clr/opencl/CMakeLists.txt#L124-L143 + rm $out/etc/OpenCL/vendors/amdocl64.icd $out/etc/ld.so.conf.d/10-rocm-opencl.conf + rmdir $out/etc/OpenCL/vendors $out/etc/OpenCL $out/etc/ld.so.conf.d $out/etc + # Replace rocm-opencl-icd functionality mkdir -p $icd/etc/OpenCL/vendors echo "$out/lib/libamdocl64.so" > $icd/etc/OpenCL/vendors/amdocl64.icd diff --git a/pkgs/development/rocm-modules/clr/test-hiprtc-type-traits.cpp b/pkgs/development/rocm-modules/10/clr/test-hiprtc-type-traits.cpp similarity index 100% rename from pkgs/development/rocm-modules/clr/test-hiprtc-type-traits.cpp rename to pkgs/development/rocm-modules/10/clr/test-hiprtc-type-traits.cpp diff --git a/pkgs/development/rocm-modules/clr/test-hiprtc-type-traits.nix b/pkgs/development/rocm-modules/10/clr/test-hiprtc-type-traits.nix similarity index 100% rename from pkgs/development/rocm-modules/clr/test-hiprtc-type-traits.nix rename to pkgs/development/rocm-modules/10/clr/test-hiprtc-type-traits.nix diff --git a/pkgs/development/rocm-modules/clr/test-isa-compat.nix b/pkgs/development/rocm-modules/10/clr/test-isa-compat.nix similarity index 100% rename from pkgs/development/rocm-modules/clr/test-isa-compat.nix rename to pkgs/development/rocm-modules/10/clr/test-isa-compat.nix diff --git a/pkgs/development/rocm-modules/clr/test-opencl-cts.nix b/pkgs/development/rocm-modules/10/clr/test-opencl-cts.nix similarity index 100% rename from pkgs/development/rocm-modules/clr/test-opencl-cts.nix rename to pkgs/development/rocm-modules/10/clr/test-opencl-cts.nix diff --git a/pkgs/development/rocm-modules/clr/test-rocm-smi.nix b/pkgs/development/rocm-modules/10/clr/test-rocm-smi.nix similarity index 100% rename from pkgs/development/rocm-modules/clr/test-rocm-smi.nix rename to pkgs/development/rocm-modules/10/clr/test-rocm-smi.nix diff --git a/pkgs/development/rocm-modules/composable_kernel/base.nix b/pkgs/development/rocm-modules/10/composable_kernel/base.nix similarity index 97% rename from pkgs/development/rocm-modules/composable_kernel/base.nix rename to pkgs/development/rocm-modules/10/composable_kernel/base.nix index ef7304291ed4c..b740419c1bf4c 100644 --- a/pkgs/development/rocm-modules/composable_kernel/base.nix +++ b/pkgs/development/rocm-modules/10/composable_kernel/base.nix @@ -44,7 +44,7 @@ stdenv.mkDerivation (finalAttrs: { ''; pname = "composable_kernel_base"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -59,12 +59,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ projectRoot "shared" ]; - hash = "sha256-Zs6wwPmys1kUlgDD4XzKKw273nH/Ur3HtuYxJjvjDs0="; + hash = "sha256-1ycnnO7ul/uFsIPAOWfg641nsx96LI/Txs79RAxaBDI="; }; sourceRoot = "${finalAttrs.src.name}/${projectRoot}"; diff --git a/pkgs/development/rocm-modules/composable_kernel/ck4inductor.nix b/pkgs/development/rocm-modules/10/composable_kernel/ck4inductor.nix similarity index 100% rename from pkgs/development/rocm-modules/composable_kernel/ck4inductor.nix rename to pkgs/development/rocm-modules/10/composable_kernel/ck4inductor.nix diff --git a/pkgs/development/rocm-modules/composable_kernel/default.nix b/pkgs/development/rocm-modules/10/composable_kernel/default.nix similarity index 70% rename from pkgs/development/rocm-modules/composable_kernel/default.nix rename to pkgs/development/rocm-modules/10/composable_kernel/default.nix index ae0707fabbd01..cbe11dfebd2aa 100644 --- a/pkgs/development/rocm-modules/composable_kernel/default.nix +++ b/pkgs/development/rocm-modules/10/composable_kernel/default.nix @@ -7,6 +7,88 @@ let inherit (composable_kernel_base) miOpenReqLibsOnly; parts = { + # Compile convolution OBJECT targets in groups; the final build archives them. + grouped_conv_bwd = { + targets = [ + "device_grouped_conv1d_bwd_weight_gnwc_instance" + "device_grouped_conv1d_bwd_weight_nwgc_instance" + "device_grouped_conv2d_bwd_data_nhwgc_instance" + "device_grouped_conv2d_bwd_data_gnhwc_instance" + "device_grouped_conv2d_bwd_data_ngchw_instance" + "device_grouped_conv2d_bwd_weight_nhwgc_instance" + "device_grouped_conv2d_bwd_weight_gnhwc_instance" + "device_grouped_conv2d_bwd_weight_ngchw_instance" + ]; + }; + grouped_conv_fwd = { + targets = [ + "device_grouped_conv1d_fwd_gnwc_instance" + "device_grouped_conv2d_fwd_nhwgc_instance" + "device_grouped_conv2d_fwd_gnhwc_instance" + "device_grouped_conv2d_fwd_ngchw_instance" + "device_grouped_conv2d_fwd_bias_bnorm_clamp_nhwgc_instance" + "device_grouped_conv2d_fwd_bias_clamp_nhwgc_instance" + "device_grouped_conv2d_fwd_clamp_nhwgc_instance" + "device_grouped_conv2d_fwd_dynamic_op_nhwgc_instance" + ]; + }; + grouped_conv_bwd_3d1 = { + targets = [ + "device_grouped_conv3d_bwd_data_ndhwgc_instance" + "device_grouped_conv3d_bwd_data_gndhwc_instance" + "device_grouped_conv3d_bwd_data_ngcdhw_instance" + "device_grouped_conv3d_bwd_data_bilinear_ndhwgc_instance" + "device_grouped_conv3d_bwd_data_scale_ndhwgc_instance" + ]; + }; + grouped_conv_bwd_3d2 = { + targets = [ + "device_grouped_conv3d_bwd_weight_ndhwgc_instance" + "device_grouped_conv3d_bwd_weight_gndhwc_instance" + "device_grouped_conv3d_bwd_weight_ngcdhw_instance" + "device_grouped_conv3d_bwd_weight_bilinear_ndhwgc_instance" + "device_grouped_conv3d_bwd_weight_scale_ndhwgc_instance" + ]; + }; + grouped_conv_fwd_3d1 = { + targets = [ + "device_grouped_conv3d_fwd_ndhwgc_instance" + "device_grouped_conv3d_fwd_gndhwc_instance" + "device_grouped_conv3d_fwd_ngcdhw_instance" + "device_grouped_conv3d_fwd_clamp_ndhwgc_instance" + "device_grouped_conv3d_fwd_bias_bnorm_clamp_ndhwgc_instance" + "device_grouped_conv3d_fwd_bias_bnorm_clamp_nhwgc_instance" + "device_grouped_conv3d_fwd_bias_clamp_ndhwgc_instance" + "device_grouped_conv3d_fwd_bilinear_ndhwgc_instance" + "device_grouped_conv3d_fwd_convinvscale_ndhwgc_instance" + "device_grouped_conv3d_fwd_convscale_ndhwgc_instance" + "device_grouped_conv3d_fwd_convscale_add_ndhwgc_instance" + ]; + }; + grouped_conv_fwd_3d2 = { + targets = [ + "device_grouped_conv3d_fwd_convscale_relu_ndhwgc_instance" + "device_grouped_conv3d_fwd_dynamic_op_ndhwgc_instance" + "device_grouped_conv3d_fwd_scale_ndhwgc_instance" + "device_grouped_conv3d_fwd_scaleadd_ab_ndhwgc_instance" + "device_grouped_conv3d_fwd_scaleadd_scaleadd_relu_ndhwgc_instance" + ]; + }; + grouped_conv_fwd_nd = { + targets = [ + "device_grouped_convnd_bwd_weight_instance" + ]; + }; + conv_other = { + targets = [ + "device_conv1d_bwd_data_instance" + "device_conv2d_bwd_data_instance" + "device_conv2d_fwd_instance" + "device_conv2d_fwd_bias_relu_instance" + "device_conv2d_fwd_bias_relu_add_instance" + "device_conv3d_bwd_data_instance" + ]; + }; _mha = { enabled = !miOpenReqLibsOnly; # mha takes ~3hrs on 64 cores on an EPYC milan system at ~2.5GHz @@ -43,63 +125,6 @@ let "gfx950" ]; }; - grouped_conv_bwd = { - targets = [ - "device_grouped_conv1d_bwd_weight_instance" - "device_grouped_conv2d_bwd_data_instance" - "device_grouped_conv2d_bwd_weight_instance" - ]; - }; - grouped_conv_fwd = { - targets = [ - "device_grouped_conv1d_fwd_instance" - "device_grouped_conv2d_fwd_instance" - "device_grouped_conv2d_fwd_bias_bnorm_clamp_instance" - "device_grouped_conv2d_fwd_bias_clamp_instance" - "device_grouped_conv2d_fwd_clamp_instance" - "device_grouped_conv2d_fwd_dynamic_op_instance" - ]; - }; - grouped_conv_bwd_3d1 = { - targets = [ - "device_grouped_conv3d_bwd_data_instance" - "device_grouped_conv3d_bwd_data_bilinear_instance" - "device_grouped_conv3d_bwd_data_scale_instance" - ]; - }; - grouped_conv_bwd_3d2 = { - targets = [ - "device_grouped_conv3d_bwd_weight_instance" - "device_grouped_conv3d_bwd_weight_bilinear_instance" - "device_grouped_conv3d_bwd_weight_scale_instance" - ]; - }; - grouped_conv_fwd_3d1 = { - targets = [ - "device_grouped_conv3d_fwd_instance" - "device_grouped_conv3d_fwd_clamp_instance" - "device_grouped_conv3d_fwd_bias_bnorm_clamp_instance" - "device_grouped_conv3d_fwd_bias_clamp_instance" - "device_grouped_conv3d_fwd_bilinear_instance" - "device_grouped_conv3d_fwd_convinvscale_instance" - "device_grouped_conv3d_fwd_convscale_instance" - "device_grouped_conv3d_fwd_convscale_add_instance" - ]; - }; - grouped_conv_fwd_3d2 = { - targets = [ - "device_grouped_conv3d_fwd_convscale_relu_instance" - "device_grouped_conv3d_fwd_dynamic_op_instance" - "device_grouped_conv3d_fwd_scale_instance" - "device_grouped_conv3d_fwd_scaleadd_ab_instance" - "device_grouped_conv3d_fwd_scaleadd_scaleadd_relu_instance" - ]; - }; - grouped_conv_fwd_nd = { - targets = [ - "device_grouped_convnd_bwd_weight_instance" - ]; - }; batched_gemm1 = { enabled = !miOpenReqLibsOnly; targets = [ @@ -136,7 +161,6 @@ let enabled = !miOpenReqLibsOnly; targets = [ "device_gemm_universal_reduce_instance" - "device_gemm_universal_streamk_instance" ]; }; gemm_other1 = { @@ -164,17 +188,6 @@ let "device_gemm_multiply_add_instance" "device_gemm_reduce_instance" "device_gemm_splitk_instance" - "device_gemm_streamk_instance" - ]; - }; - conv = { - targets = [ - "device_conv1d_bwd_data_instance" - "device_conv2d_bwd_data_instance" - "device_conv2d_fwd_instance" - "device_conv2d_fwd_bias_relu_instance" - "device_conv2d_fwd_bias_relu_add_instance" - "device_conv3d_bwd_data_instance" ]; }; pool = { @@ -187,11 +200,6 @@ let "device_max_pool_bwd_instance" ]; }; - other0 = { - targets = [ - "device_quantization_instance" - ]; - }; other1 = { enabled = !miOpenReqLibsOnly; targets = [ @@ -243,7 +251,24 @@ let makeTargets = targets; preBuild = '' echo "Building ${part}" - makeFlagsArray+=($makeTargets) + # Build the targets this configuration generates; fail on names the CK + # source no longer defines, so they are not compiled unsplit later. + partTargets=() + for target in $makeTargets; do + if grep -q "^$target:" Makefile; then + partTargets+=("$target") + elif grep -rqsE "add_instance_library\($target([[:space:])]|$)" ../library/src/tensor_operation_instance; then + echo "CK part ${part}: $target not configured, skipping" + else + echo "CK part ${part}: $target is not defined in the CK source" >&2 + exit 1 + fi + done + if (( ''${#partTargets[@]} == 0 )); then + mkdir -p "$out" + exit 0 + fi + makeFlagsArray+=("''${partTargets[@]}") substituteInPlace $(find ./ -name "Makefile" -type f) \ --replace-fail '.NOTPARALLEL:' '.UNUSED_NOTPARALLEL:' ''; @@ -254,7 +279,14 @@ let # Nix/nixpkgs doesn't really have any infra to tell it that this build is unusually memory hungry # So, bodge. Otherwise you end up having to build all of ROCm with a low core limit when # it's only this package that has trouble. - preConfigure = old.preConfigure or "" + '' + preConfigure = (old.preConfigure or "") + '' + # clang 24 passes NIX_LDFLAGS' self-rpath into the compressed .hip_fatbin, + # where it cannot be scrubbed; the parts only emit objects. + for _v in NIX_LDFLAGS ''${!NIX_LDFLAGS_*}; do + printf -v "$_v" '%s' "$(sed "s| *-rpath $out/lib||g" <<< "''${!_v-}")" + export "$_v" + done + MEM_GB_TOTAL=$(awk '/MemTotal/ { printf "%d \n", $2/1024/1024 }' /proc/meminfo) MEM_GB_AVAILABLE=$(awk '/MemAvailable/ { printf "%d \n", $2/1024/1024 }' /proc/meminfo) APPX_GB=$((MEM_GB_AVAILABLE > MEM_GB_TOTAL ? MEM_GB_TOTAL : MEM_GB_AVAILABLE)) diff --git a/pkgs/development/rocm-modules/composable_kernel/fix-empty-offload-targets.diff b/pkgs/development/rocm-modules/10/composable_kernel/fix-empty-offload-targets.diff similarity index 79% rename from pkgs/development/rocm-modules/composable_kernel/fix-empty-offload-targets.diff rename to pkgs/development/rocm-modules/10/composable_kernel/fix-empty-offload-targets.diff index d314873ff61b6..ca7b7aceccaed 100644 --- a/pkgs/development/rocm-modules/composable_kernel/fix-empty-offload-targets.diff +++ b/pkgs/development/rocm-modules/10/composable_kernel/fix-empty-offload-targets.diff @@ -1,8 +1,7 @@ diff --git a/library/src/tensor_operation_instance/gpu/CMakeLists.txt b/library/src/tensor_operation_instance/gpu/CMakeLists.txt -index 172f6681b8..d3ddbb2f15 100644 ---- a/library/src/tensor_operation_instance/gpu/CMakeLists.txt -+++ b/library/src/tensor_operation_instance/gpu/CMakeLists.txt -@@ -154,9 +154,15 @@ function(add_instance_library INSTANCE_NAME) +--- a/library/src/tensor_operation_instance/gpu/CMakeLists.txt 2026-10-08 00:34:05.472466099 -0700 ++++ b/library/src/tensor_operation_instance/gpu/CMakeLists.txt 2026-10-08 00:34:05.502420794 -0700 +@@ -182,9 +182,15 @@ list(FILTER INST_TARGETS INCLUDE REGEX "gfx12") endif() set(offload_targets) @@ -18,6 +17,6 @@ index 172f6681b8..d3ddbb2f15 100644 + string(APPEND offload_targets "--offload-arch=${target} ") + endforeach() + endif() - set_source_files_properties(${source} PROPERTIES COMPILE_FLAGS ${offload_targets}) + set_source_files_properties(${source} PROPERTIES COMPILE_FLAGS "${offload_targets}") list(APPEND INST_OBJ ${source}) endforeach() diff --git a/pkgs/development/rocm-modules/default.nix b/pkgs/development/rocm-modules/10/default.nix similarity index 83% rename from pkgs/development/rocm-modules/default.nix rename to pkgs/development/rocm-modules/10/default.nix index b9617499a66ab..c72d06e9a16e7 100644 --- a/pkgs/development/rocm-modules/default.nix +++ b/pkgs/development/rocm-modules/10/default.nix @@ -25,7 +25,14 @@ let inherit rocmClangStdenv; stdenv = rocmClangStdenv; - rocmUpdateScript = self.callPackage ./update.nix { }; + rocmUpdateScript = self.callPackage ../update.nix { + maxMajor = 10; + tagPrefixes = [ + "rocm" + "therock" + ]; + setName = "rocmPackages_10"; + }; ## ROCm ## llvm = lib.recurseIntoAttrs ( @@ -63,16 +70,16 @@ let rdc = self.callPackage ./rdc { }; - rocm-docs-core = python3Packages.callPackage ./rocm-docs-core { }; + rocm-docs-core = python3Packages.callPackage ../rocm-docs-core { }; hip-common = self.callPackage ./hip-common { }; - hipcc = self.callPackage ./hipcc { stdenv = origStdenv; }; + hipcc = self.callPackage ../hipcc { stdenv = origStdenv; }; # Replaces hip, opencl-runtime, and rocclr clr = self.callPackage ./clr { }; - aotriton = self.callPackage ./aotriton { stdenv = origStdenv; }; + aotriton = self.callPackage ../aotriton { stdenv = origStdenv; }; hipify = self.callPackage ./hipify { stdenv = origStdenv; @@ -89,7 +96,9 @@ let }; rocprofiler-sdk = self.callPackage ./rocprofiler-sdk { }; - rocprof-compute-viewer = self.callPackage ./rocprof-compute-viewer { }; + hipfile = self.callPackage ./hipfile { }; + + rocprof-compute-viewer = self.callPackage ../rocprof-compute-viewer { }; rocprof-trace-decoder = self.callPackage ./rocprof-trace-decoder { }; @@ -113,7 +122,7 @@ let rocfft = self.callPackage ./rocfft { }; - mscclpp = self.callPackage ./mscclpp { }; + mscclpp = self.callPackage ../mscclpp { }; rccl = self.callPackage ./rccl { }; @@ -127,7 +136,7 @@ let hipfft = self.callPackage ./hipfft { }; - hiprt = self.callPackage ./hiprt { }; + hiprt = self.callPackage ../hiprt { }; tensile = pyPackages.callPackage ./tensile { inherit (self) @@ -136,6 +145,10 @@ let ; }; + # rocblas_base is the raw per-arch builder (marked broken, like + # composable_kernel_base); rocblas (default.nix) assembles the per-arch + # Tensile shards into one joined output (see rocblas/default.nix). + rocblas_base = self.callPackage ./rocblas/base.nix { }; rocblas = self.callPackage ./rocblas { }; rocsolver = self.callPackage ./rocsolver { }; @@ -144,10 +157,10 @@ let rocalution = self.callPackage ./rocalution { }; - rocmlir-rock = self.callPackage ./rocmlir { + # ROCm/rocMLIR has no ROCm 10 release; MIGraphX 10.1 pins this fork. + rocmlir-triton = self.callPackage ./rocmlir-triton { buildRockCompiler = true; }; - rocmlir = self.rocmlir-rock; hipsolver = self.callPackage ./hipsolver { }; @@ -184,7 +197,7 @@ let rpp-cpu = self.rpp.override { useCPU = true; }; - mivisionx = self.callPackage ./mivisionx { + mivisionx = self.callPackage ../mivisionx { stdenv = origStdenv; opencv = opencv.override { enablePython = true; }; }; @@ -230,7 +243,7 @@ let platforms = [ "x86_64-linux" ]; - attrPaths = (builtins.fromJSON (builtins.readFile ./release-attrPaths.json)).attrPaths; + attrPaths = (builtins.fromJSON (builtins.readFile ../release-attrPaths.json)).attrPaths; in lib.foldl' ( acc: path: @@ -241,15 +254,21 @@ let ) { } attrPaths; }; - rocm-bandwidth-test = self.callPackage ./rocm-bandwidth-test { - rocmPackages = self; - }; - - rocm-tests = self.callPackage ./rocm-tests { + rocm-tests = self.callPackage ../rocm-tests { rocmPackages = self; }; } // lib.optionalAttrs config.allowAliases { + rocmlir = throw '' + 'rocmlir' (ROCm/rocMLIR) has no ROCm 10 release. MIGraphX uses + 'rocmlir-triton', the fork it pins. + ''; # Added 2026-10-17 + rocmlir-rock = throw "'rocmlir-rock' has been replaced by 'rocmlir-triton'"; # Added 2026-10-17 + + rocm-bandwidth-test = throw '' + 'rocm-bandwidth-test' has been removed as it is no longer maintained upstream. + ''; # Added 2026-10-14 + rpp-opencl = throw '' 'rpp-opencl' has been removed as it has been broken for a year and has no consuming packages. Use 'rpp' or 'rpp-cpu' instead. diff --git a/pkgs/development/rocm-modules/half/default.nix b/pkgs/development/rocm-modules/10/half/default.nix similarity index 91% rename from pkgs/development/rocm-modules/half/default.nix rename to pkgs/development/rocm-modules/10/half/default.nix index 8541b82d596fe..ae57c10d2caeb 100644 --- a/pkgs/development/rocm-modules/half/default.nix +++ b/pkgs/development/rocm-modules/10/half/default.nix @@ -9,12 +9,12 @@ stdenv.mkDerivation (finalAttrs: { pname = "half"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "half"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; hash = "sha256-If9O5BEeymsLN+C0drZsPSxEWXpJTxeDBGNHNXSumm4="; }; diff --git a/pkgs/development/rocm-modules/hip-common/default.nix b/pkgs/development/rocm-modules/10/hip-common/default.nix similarity index 87% rename from pkgs/development/rocm-modules/hip-common/default.nix rename to pkgs/development/rocm-modules/10/hip-common/default.nix index f2415ab549c33..c791e60f5b31a 100644 --- a/pkgs/development/rocm-modules/hip-common/default.nix +++ b/pkgs/development/rocm-modules/10/hip-common/default.nix @@ -7,17 +7,17 @@ stdenv.mkDerivation (finalAttrs: { pname = "hip-common"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/hip" "shared" ]; - hash = "sha256-orfTXKjcZJ5E73cmXEyltZVYhCQo8FLExVHM3J/rqUM="; + hash = "sha256-MP92iAemtjBLt9hy4JJpud+UfT2xolfm7mtLknrU5EE="; }; sourceRoot = "${finalAttrs.src.name}/projects/hip"; diff --git a/pkgs/development/rocm-modules/hipblas-common/default.nix b/pkgs/development/rocm-modules/10/hipblas-common/default.nix similarity index 86% rename from pkgs/development/rocm-modules/hipblas-common/default.nix rename to pkgs/development/rocm-modules/10/hipblas-common/default.nix index 6ddc7c8e258a5..620be6f63942f 100644 --- a/pkgs/development/rocm-modules/hipblas-common/default.nix +++ b/pkgs/development/rocm-modules/10/hipblas-common/default.nix @@ -8,17 +8,17 @@ }: stdenv.mkDerivation (finalAttrs: { pname = "hipblas-common"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/hipblas-common" "shared" ]; - hash = "sha256-83LgS4I1fMSaNtWdVFf1qhYRMT7a9jVzO3XpUzEipXg="; + hash = "sha256-2sUJqcy/LSfKOvY1IBzlxmbKZImMxf6YGA+qQml8DLc="; }; sourceRoot = "${finalAttrs.src.name}/projects/hipblas-common"; diff --git a/pkgs/development/rocm-modules/hipblas/default.nix b/pkgs/development/rocm-modules/10/hipblas/default.nix similarity index 92% rename from pkgs/development/rocm-modules/hipblas/default.nix rename to pkgs/development/rocm-modules/10/hipblas/default.nix index af6c620211805..0915099dddba8 100644 --- a/pkgs/development/rocm-modules/hipblas/default.nix +++ b/pkgs/development/rocm-modules/10/hipblas/default.nix @@ -5,6 +5,7 @@ rocmUpdateScript, cmake, rocm-cmake, + python3, clr, gfortran, hipblas-common, @@ -24,7 +25,7 @@ # Can also use cuBLAS stdenv.mkDerivation (finalAttrs: { pname = "hipblas"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -42,12 +43,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/hipblas" "shared" ]; - hash = "sha256-1+aNDotV5liHBnGddmWtaKYCcsWPxQD3AoEubnghV0M="; + hash = "sha256-VUM+5qu8VK6fUbKPCVMm0PtmuZhJZYfEI6aKJEV9Vwg="; }; sourceRoot = "${finalAttrs.src.name}/projects/hipblas"; @@ -59,6 +60,8 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake rocm-cmake + # CMakeLists.txt does find_package(Python3 REQUIRED) + python3 clr gfortran ]; diff --git a/pkgs/development/rocm-modules/hipblaslt/default.nix b/pkgs/development/rocm-modules/10/hipblaslt/default.nix similarity index 85% rename from pkgs/development/rocm-modules/hipblaslt/default.nix rename to pkgs/development/rocm-modules/10/hipblaslt/default.nix index d24759510a5c3..1dc5962ec0698 100644 --- a/pkgs/development/rocm-modules/hipblaslt/default.nix +++ b/pkgs/development/rocm-modules/10/hipblaslt/default.nix @@ -4,7 +4,7 @@ fetchFromGitHub, cmake, rocm-cmake, - rocm-smi, + amdsmi, pkg-config, clr, gfortran, @@ -56,6 +56,8 @@ let ps.packaging ps.nanobind ps.msgpack + # tensilelite imports joblib (Parallel.py) and lists it in requirements.txt. + ps.joblib ]); # workaround: build for one working target if no targets are supported # a few CXX files are still build for the device @@ -70,13 +72,13 @@ let in stdenv.mkDerivation (finalAttrs: { pname = "hipblaslt${clr.gpuArchSuffix}"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-+xMmPKb32NP9U35dHCXfXWwa6exfiL5TezfXERVDfe4="; + tag = "therock-${finalAttrs.version}"; + hash = "sha256-FOwC+eG8dYgiktogDrUZhtKbKl9iNFvnGXSt0Uj02lQ="; sparseCheckout = [ "projects/hipblaslt" "shared" @@ -95,6 +97,9 @@ stdenv.mkDerivation (finalAttrs: { env.TENSILE_GEN_ASSEMBLY_TOOLCHAIN = lib.getExe' clr "amdclang++"; env.LD_PRELOAD = "${jemalloc}/lib/libjemalloc.so"; env.MALLOC_CONF = "background_thread:true,metadata_thp:auto,dirty_decay_ms:10000,muzzy_decay_ms:10000"; + # tensilelite caches helper-kernel code objects in $HOME/.tensile, which is + # unwritable in the sandbox, and a cache across builds is useless under Nix. + env.TENSILE_DISABLE_HELPER_CACHE = "1"; requiredSystemFeatures = [ "big-parallel" ]; __structuredAttrs = true; @@ -117,13 +122,10 @@ stdenv.mkDerivation (finalAttrs: { # parallel-jobs for these invocations # https://github.com/ROCm/rocm-libraries/issues/1242 ./parallel-buildSourceCodeObjectFile.diff + ./tensile-memory.patch # Support loading zstd compressed .dat files, required to keep output under # hydra size limit ./messagepack-compression-support.patch - # [hipblaslt] Refactor Parallel.py to drop joblib, massively reduce peak disk space usage - # https://github.com/ROCm/rocm-libraries/pull/2073 - ./TensileCreateLibrary-refactor.patch - ./Tensile-interning.patch ]; preConfigure = '' @@ -131,11 +133,15 @@ stdenv.mkDerivation (finalAttrs: { ''; postPatch = '' - # git isn't needed and we have no .git - substituteInPlace cmake/dependencies.cmake \ + # origami needs Git only for a rocm-cmake FetchContent fallback we never take. + substituteInPlace ../../shared/origami/cmake/dependencies.cmake \ --replace-fail "find_package(Git REQUIRED)" "" - substituteInPlace CMakeLists.txt \ - --replace-fail " LANGUAGES CXX" " LANGUAGES CXX C ASM" + + + + # For messagepack-compression-support.patch; amdclang ignores NIX_LDFLAGS. + echo 'target_link_libraries(tensilelite-host PRIVATE ${lib.getLib zstd}/lib/libzstd.so)' \ + >> tensilelite/src/msgpack/CMakeLists.txt ''; doCheck = false; @@ -149,7 +155,7 @@ stdenv.mkDerivation (finalAttrs: { gfortran pkg-config ninja - rocm-smi + amdsmi zstd ]; @@ -159,7 +165,7 @@ stdenv.mkDerivation (finalAttrs: { rocm-cmake hipblas-common amd-blis - rocm-smi + amdsmi openmp libffi ncurses @@ -195,6 +201,9 @@ stdenv.mkDerivation (finalAttrs: { "-DBLIS_INCLUDE_DIR=${amd-blis}/include/blis/" "-DBLA_PREFER_PKGCONFIG=ON" "-DFETCHCONTENT_SOURCE_DIR_NANOBIND=${python3Packages.nanobind.src}" + # Tensile codegen writes into a CONFIGURE_DEPENDS glob; the mid-build re-run + # of cmake >= 4.4 then loses nanobind_add_module. + (lib.cmakeBool "CMAKE_SUPPRESS_REGENERATION" true) # Manually define CMAKE_INSTALL_ # See: https://github.com/NixOS/nixpkgs/pull/197838 "-DCMAKE_INSTALL_BINDIR=bin" @@ -214,7 +223,6 @@ stdenv.mkDerivation (finalAttrs: { # Move binaries to appropriate outputs and delete leftover /bin + '' mkdir -p $benchmark/bin - mv $out/bin/hipblaslt-{api-overhead,bench*} $out/bin/*.yaml $out/bin/*.py $benchmark/bin ${lib.optionalString buildTests '' mkdir -p $test/bin mv $out/bin/hipblas-test $test/bin @@ -223,6 +231,8 @@ stdenv.mkDerivation (finalAttrs: { mkdir -p $sample/bin mv $out/bin/example-* $sample/bin ''} + # Everything else in bin/ is a benchmark tool. + mv $out/bin/* $benchmark/bin rmdir $out/bin ''; diff --git a/pkgs/development/rocm-modules/hipblaslt/messagepack-compression-support.patch b/pkgs/development/rocm-modules/10/hipblaslt/messagepack-compression-support.patch similarity index 83% rename from pkgs/development/rocm-modules/hipblaslt/messagepack-compression-support.patch rename to pkgs/development/rocm-modules/10/hipblaslt/messagepack-compression-support.patch index ace6b2b728ad2..bf14f9711c9c8 100644 --- a/pkgs/development/rocm-modules/hipblaslt/messagepack-compression-support.patch +++ b/pkgs/development/rocm-modules/10/hipblaslt/messagepack-compression-support.patch @@ -1,18 +1,16 @@ -diff --git a/Tensile/Source/lib/source/msgpack/MessagePack.cpp b/Tensile/Source/lib/source/msgpack/MessagePack.cpp -index de97929c..dbc397e0 100644 --- a/tensilelite/src/msgpack/MessagePack.cpp +++ b/tensilelite/src/msgpack/MessagePack.cpp -@@ -28,6 +28,8 @@ +@@ -27,6 +27,8 @@ + #include #include - -+#include + - #include ++#include - namespace Tensile -@@ -86,6 +88,34 @@ namespace Tensile - return nullptr; + #include + #include +@@ -245,6 +247,34 @@ + return false; } + // Check if the file is zstd compressed @@ -46,11 +44,11 @@ index de97929c..dbc397e0 100644 msgpack::unpacker unp; bool finished_parsing; constexpr size_t buffer_size = 1 << 19; -@@ -109,6 +139,7 @@ namespace Tensile +@@ -278,6 +308,7 @@ - return nullptr; + return false; } + } } - catch(std::runtime_error const& exc) + catch(std::exception const& exc) { diff --git a/pkgs/development/rocm-modules/10/hipblaslt/parallel-buildSourceCodeObjectFile.diff b/pkgs/development/rocm-modules/10/hipblaslt/parallel-buildSourceCodeObjectFile.diff new file mode 100644 index 0000000000000..0aed828b1178a --- /dev/null +++ b/pkgs/development/rocm-modules/10/hipblaslt/parallel-buildSourceCodeObjectFile.diff @@ -0,0 +1,13 @@ +diff --git a/tensilelite/Tensile/Toolchain/Component.py b/tensilelite/Tensile/Toolchain/Component.py +--- a/tensilelite/Tensile/Toolchain/Component.py ++++ b/tensilelite/Tensile/Toolchain/Component.py +@@ -219,6 +219,9 @@ + "-x", "hip", "-O3", + "-Xoffload-linker", f"--build-id={build_id_kind}", + "-std=c++17", ++ # Parallelise the per-arch device compiles of each invocation. ++ # https://github.com/ROCm/rocm-libraries/issues/1242 ++ "-parallel-jobs=8", + ] + + if asan_build: diff --git a/pkgs/development/rocm-modules/10/hipblaslt/tensile-memory.patch b/pkgs/development/rocm-modules/10/hipblaslt/tensile-memory.patch new file mode 100644 index 0000000000000..d38c111717707 --- /dev/null +++ b/pkgs/development/rocm-modules/10/hipblaslt/tensile-memory.patch @@ -0,0 +1,92 @@ +Subject: [PATCH] Limit Tensile workers and retain only kernel metadata + +Adapt the memory protections from the ROCm 7 Tensile patches to the new +pipeline. Honor build-system worker limits, intern immutable YAML strings, +and release generated assembly after it has been written and assembled. +Keep SizeMapping objects separate: passPostKernelInfoToLibrary mutates them. + +--- a/tensilelite/Tensile/Common/Parallel.py ++++ b/tensilelite/Tensile/Common/Parallel.py +@@ -25,6 +25,7 @@ + import concurrent.futures + import itertools + import os ++import re + import sys + import time + +@@ -46,19 +47,24 @@ + + if not enable: + return 1 +- else: +- if os.name == "nt": +- # Windows supports at most 61 workers because the scheduler uses +- # WaitForMultipleObjects directly, which has the limit (the limit +- # is actually 64, but some handles are needed for accounting). +- cpu_count = min(os.cpu_count(), 61) +- else: +- cpu_count = len(os.sched_getaffinity(0)) +- cpuThreads = globalParameters["CpuThreads"] +- if cpuThreads == -1: +- return cpu_count +- +- return min(cpu_count, cpuThreads) ++ cpu_count = os.cpu_count() if os.name == "nt" else len(os.sched_getaffinity(0)) ++ if os.name == "nt": ++ cpu_count = min(cpu_count, 61) ++ limits = [cpu_count] ++ configured = globalParameters["CpuThreads"] ++ if configured > 0: ++ limits.append(configured) ++ for name in ("CMAKE_BUILD_PARALLEL_LEVEL", "NIX_BUILD_CORES"): ++ try: ++ limit = int(os.environ.get(name, "")) ++ except ValueError: ++ continue ++ if limit > 0: ++ limits.append(limit) ++ match = re.search(r"(?:^|\s)-j\s*(\d+)(?:\s|$)", os.environ.get("MAKEFLAGS", "")) ++ if match and int(match[1]) > 0: ++ limits.append(int(match[1])) ++ return max(1, min(limits)) + + + def pcallWithGlobalParamsMultiArg(f, args, newGlobalParameters): +--- a/tensilelite/Tensile/CustomYamlLoader.py ++++ b/tensilelite/Tensile/CustomYamlLoader.py +@@ -1,6 +1,7 @@ + # Copyright © Advanced Micro Devices, Inc., or its affiliates. + # SPDX-License-Identifier: MIT + ++import sys + import yaml + from pathlib import Path + from typing import List +@@ -73,7 +74,7 @@ + elif is_float(value_lower): + return float(value_lower) + +- return value ++ return sys.intern(value) + + def load_yaml_stream(yaml_path: Path, loader_type: yaml.Loader): + with open(yaml_path, 'r') as f: +--- a/tensilelite/Tensile/TensileCreateLibrary/Run.py ++++ b/tensilelite/Tensile/TensileCreateLibrary/Run.py +@@ -672,8 +672,13 @@ + def composed_function(kernel): + processed_kernel = unaryProcessKernelSource(kernel) + written_kernel = unaryWriteAssembly(processed_kernel) +- assembled_kernel = assemble(written_kernel) +- return processed_kernel ++ assemble(written_kernel) ++ return KernelMinResult( ++ processed_kernel.err, ++ processed_kernel.cuoccupancy, ++ processed_kernel.pgr, ++ processed_kernel.mathclk, ++ ) + return composed_function + + results = ParallelMap2( diff --git a/pkgs/development/rocm-modules/hipcub/default.nix b/pkgs/development/rocm-modules/10/hipcub/default.nix similarity index 94% rename from pkgs/development/rocm-modules/hipcub/default.nix rename to pkgs/development/rocm-modules/10/hipcub/default.nix index a775d81509a1e..257a52b65508c 100644 --- a/pkgs/development/rocm-modules/hipcub/default.nix +++ b/pkgs/development/rocm-modules/10/hipcub/default.nix @@ -17,7 +17,7 @@ # CUB can also be used as a backend instead of rocPRIM. stdenv.mkDerivation (finalAttrs: { pname = "hipcub"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -32,12 +32,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/hipcub" "shared" ]; - hash = "sha256-geO6LS1osKAlmVRtiZ6keqFHsJccyB7pRZdWPEkue2M="; + hash = "sha256-66uC/CxNSXoHWo9uSbrYfqZkchr7zHVLrwbsfZoYtUQ="; }; sourceRoot = "${finalAttrs.src.name}/projects/hipcub"; diff --git a/pkgs/development/rocm-modules/hipfft/default.nix b/pkgs/development/rocm-modules/10/hipfft/default.nix similarity index 95% rename from pkgs/development/rocm-modules/hipfft/default.nix rename to pkgs/development/rocm-modules/10/hipfft/default.nix index 62c98375d029a..0d7d6b75b0786 100644 --- a/pkgs/development/rocm-modules/hipfft/default.nix +++ b/pkgs/development/rocm-modules/10/hipfft/default.nix @@ -21,7 +21,7 @@ # Can also use cuFFT stdenv.mkDerivation (finalAttrs: { pname = "hipfft"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -39,13 +39,13 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/hipfft" "shared" ]; fetchSubmodules = true; - hash = "sha256-EtxZuxBPx6trTN9iC7uri2+UR0Eolp919Ry4U1PEqNA="; + hash = "sha256-QTcdNpA/xEH99DZ6rlhMGWUVpc0aitve4lKlhNiF0OM="; }; sourceRoot = "${finalAttrs.src.name}/projects/hipfft"; diff --git a/pkgs/development/rocm-modules/10/hipfile/default.nix b/pkgs/development/rocm-modules/10/hipfile/default.nix new file mode 100644 index 0000000000000..86b3353af1365 --- /dev/null +++ b/pkgs/development/rocm-modules/10/hipfile/default.nix @@ -0,0 +1,72 @@ +{ + lib, + stdenv, + fetchFromGitHub, + rocmUpdateScript, + cmake, + rocm-cmake, + clr, + rocm-runtime, + rocprofiler-register, + util-linux, + gpuTargets ? (clr.localGpuTargets or clr.gpuTargets), +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "hipfile${clr.gpuArchSuffix}"; + version = "10.1"; + + src = fetchFromGitHub { + owner = "ROCm"; + repo = "rocm-systems"; + tag = "therock-${finalAttrs.version}"; + sparseCheckout = [ "projects/hipfile" ]; + hash = "sha256-huhoP2J2qw/y6xdhlcLF3kH7CO2cjL5FEJXAmVucANY="; + }; + sourceRoot = "${finalAttrs.src.name}/projects/hipfile"; + + # The unwrapped clang++ ignores NIX_CFLAGS_COMPILE, and hipFile links + # libmount with a bare find_library and no include directory. + env.CXXFLAGS = "-isystem ${lib.getDev util-linux}/include"; + + nativeBuildInputs = [ + cmake + rocm-cmake + clr + ]; + + buildInputs = [ + clr + rocm-runtime + rocprofiler-register + # libmount, for mount-point detection + util-linux + ]; + + cmakeFlags = [ + # Without ROCM_PATH, the build reads /opt/rocm/core-10.1/.info/version. + (lib.cmakeFeature "ROCM_PATH" "${clr}") + (lib.cmakeFeature "ROCM_VERSION" "10.1.0") + (lib.cmakeFeature "CMAKE_HIP_COMPILER" "amdclang++") + (lib.cmakeFeature "CMAKE_HIP_COMPILER_ROCM_ROOT" "${clr}") + # backend/memcpy-kernel.hip is device code. + (lib.cmakeFeature "CMAKE_HIP_ARCHITECTURES" (lib.concatStringsSep ";" gpuTargets)) + (lib.cmakeBool "BUILD_TESTING" false) + (lib.cmakeBool "AIS_INSTALL_EXAMPLES" false) + # Manually define CMAKE_INSTALL_ + # See: https://github.com/NixOS/nixpkgs/pull/197838 + (lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin") + (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib") + (lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include") + ]; + + passthru.updateScript = rocmUpdateScript { inherit finalAttrs; }; + + meta = { + description = "Direct-to-GPU file I/O for ROCm, the counterpart of cuFile"; + homepage = "https://github.com/ROCm/rocm-systems/tree/develop/projects/hipfile"; + license = lib.licenses.mit; + teams = [ lib.teams.rocm ]; + platforms = lib.platforms.linux; + }; +}) diff --git a/pkgs/development/rocm-modules/hipfort/default.nix b/pkgs/development/rocm-modules/10/hipfort/default.nix similarity index 72% rename from pkgs/development/rocm-modules/hipfort/default.nix rename to pkgs/development/rocm-modules/10/hipfort/default.nix index 72519db7b0458..c8430de356c89 100644 --- a/pkgs/development/rocm-modules/hipfort/default.nix +++ b/pkgs/development/rocm-modules/10/hipfort/default.nix @@ -10,13 +10,13 @@ stdenv.mkDerivation (finalAttrs: { pname = "hipfort"; - version = "7.2.4"; + version = "10.1.0"; src = fetchFromGitHub { owner = "ROCm"; repo = "hipfort"; tag = "rocm-${finalAttrs.version}"; - hash = "sha256-XaB4jauCN41tgD1YHHA2td/yckwfMBemBe/iL0SCxQo="; + hash = "sha256-/Q/wVXkJJjDSsqVRSdtMPyOw72SRDawxnyv4BY0be8g="; }; __structuredAttrs = true; @@ -42,20 +42,6 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include") ]; - postPatch = '' - patchShebangs bin - - substituteInPlace bin/hipfc bin/mymcpu \ - --replace-fail "/bin/cat" "cat" - - substituteInPlace bin/CMakeLists.txt \ - --replace-fail "/bin/mkdir" "mkdir" \ - --replace-fail "/bin/cp" "cp" \ - --replace-fail "/bin/sed" "sed" \ - --replace-fail "/bin/chmod" "chmod" \ - --replace-fail "/bin/ln" "ln" - ''; - passthru.updateScript = rocmUpdateScript { inherit finalAttrs; }; meta = { @@ -63,7 +49,6 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://github.com/ROCm/hipfort"; changelog = "https://github.com/ROCm/hipfort/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.mit; # mitx11 - mainProgram = "hipfc"; teams = [ lib.teams.rocm ]; platforms = lib.platforms.linux; }; diff --git a/pkgs/development/rocm-modules/hipify/default.nix b/pkgs/development/rocm-modules/10/hipify/default.nix similarity index 90% rename from pkgs/development/rocm-modules/hipify/default.nix rename to pkgs/development/rocm-modules/10/hipify/default.nix index b121f0859dce6..5f35a82d79f46 100644 --- a/pkgs/development/rocm-modules/hipify/default.nix +++ b/pkgs/development/rocm-modules/10/hipify/default.nix @@ -12,13 +12,13 @@ stdenv.mkDerivation (finalAttrs: { pname = "hipify"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "HIPIFY"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-LC0lnYetV7RPVw92zew6za6bDH4zmnERXUM4MVaRVtc="; + tag = "therock-${finalAttrs.version}"; + hash = "sha256-Ayw+jfXmeK9XDy1C+cmalTIDStvr6kGY2n78x5b2KYk="; }; strictDeps = true; diff --git a/pkgs/development/rocm-modules/hiprand/default.nix b/pkgs/development/rocm-modules/10/hiprand/default.nix similarity index 92% rename from pkgs/development/rocm-modules/hiprand/default.nix rename to pkgs/development/rocm-modules/10/hiprand/default.nix index 5e0fd0812ada3..663cd52383aa2 100644 --- a/pkgs/development/rocm-modules/hiprand/default.nix +++ b/pkgs/development/rocm-modules/10/hiprand/default.nix @@ -14,7 +14,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "hiprand"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -26,12 +26,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/hiprand" "shared" ]; - hash = "sha256-bjcwjN1dNukhoDAbiSpATlK6dtAwM8bOJTe3IjhdwwY="; + hash = "sha256-ocVmceoelvCbg95F+z02wbSi+M/Wm4nFolrlpqKIhlk="; }; sourceRoot = "${finalAttrs.src.name}/projects/hiprand"; diff --git a/pkgs/development/rocm-modules/hipsolver/default.nix b/pkgs/development/rocm-modules/10/hipsolver/default.nix similarity index 82% rename from pkgs/development/rocm-modules/hipsolver/default.nix rename to pkgs/development/rocm-modules/10/hipsolver/default.nix index c0f548bf7d1e9..cfc00ed7b406a 100644 --- a/pkgs/development/rocm-modules/hipsolver/default.nix +++ b/pkgs/development/rocm-modules/10/hipsolver/default.nix @@ -12,7 +12,8 @@ rocsparse, suitesparse, gtest, - lapack-reference, + blas, + lapack, buildTests ? false, buildBenchmarks ? false, buildSamples ? false, @@ -21,7 +22,7 @@ # Can also use cuSOLVER stdenv.mkDerivation (finalAttrs: { pname = "hipsolver"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -39,12 +40,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/hipsolver" "shared" ]; - hash = "sha256-ts5wuXHoBFZ1WMAk8Ir5cucP75G0SMOWmn3FEH04ZEQ="; + hash = "sha256-Djncqth/JEH1ko0iVvx3WdvK2UeK/Ywuwca9y4q2Xvg="; }; sourceRoot = "${finalAttrs.src.name}/projects/hipsolver"; @@ -60,12 +61,13 @@ stdenv.mkDerivation (finalAttrs: { rocsolver rocsparse suitesparse + # CPU LAPACK for geev. Not lapack-reference: its ILP64 libblas.so.3 breaks + # `import torch` ("undefined symbol: cherk_64_"). + blas + lapack ] ++ lib.optionals buildTests [ gtest - ] - ++ lib.optionals (buildTests || buildBenchmarks) [ - lapack-reference ]; cmakeFlags = [ @@ -76,6 +78,10 @@ stdenv.mkDerivation (finalAttrs: { "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_INCLUDEDIR=include" "-DBUILD_WITH_SPARSE=OFF" # FIXME: broken - can't find suitesparse/cholmod, looks fixed in master + # Don't clone and build OpenBLAS at configure time. + "-DHIPSOLVER_INTERNAL_LAPACK_BUILD=OFF" + # The openblas-backed wrappers ship no LAPACKConfig.cmake. + "-DHIPSOLVER_FIND_PACKAGE_LAPACK_CONFIG=OFF" ] ++ lib.optionals buildTests [ "-DBUILD_CLIENTS_TESTS=ON" diff --git a/pkgs/development/rocm-modules/hipsparse/default.nix b/pkgs/development/rocm-modules/10/hipsparse/default.nix similarity index 95% rename from pkgs/development/rocm-modules/hipsparse/default.nix rename to pkgs/development/rocm-modules/10/hipsparse/default.nix index 7057fb8ceb5b0..c26c9b742c8d5 100644 --- a/pkgs/development/rocm-modules/hipsparse/default.nix +++ b/pkgs/development/rocm-modules/10/hipsparse/default.nix @@ -5,6 +5,7 @@ rocmUpdateScript, cmake, rocm-cmake, + python3, rocsparse, clr, gfortran, @@ -19,7 +20,7 @@ # This can also use cuSPARSE as a backend instead of rocSPARSE stdenv.mkDerivation (finalAttrs: { pname = "hipsparse"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -34,18 +35,20 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/hipsparse" "shared" ]; - hash = "sha256-E1chG+giFtf02fjutoV4yM2XvrQKjgXRSvxs0NBBkvI="; + hash = "sha256-kvDzX1SnvumRgj+Va+zFPbU93dZttIE/ovL4BPG2Xi0="; }; sourceRoot = "${finalAttrs.src.name}/projects/hipsparse"; nativeBuildInputs = [ cmake rocm-cmake + # CMakeLists.txt does find_package(Python3 REQUIRED) + python3 clr gfortran ]; diff --git a/pkgs/development/rocm-modules/hipsparselt/default.nix b/pkgs/development/rocm-modules/10/hipsparselt/default.nix similarity index 85% rename from pkgs/development/rocm-modules/hipsparselt/default.nix rename to pkgs/development/rocm-modules/10/hipsparselt/default.nix index 9cd7c710a6d6c..297f261ce9557 100644 --- a/pkgs/development/rocm-modules/hipsparselt/default.nix +++ b/pkgs/development/rocm-modules/10/hipsparselt/default.nix @@ -43,19 +43,23 @@ let in stdenv.mkDerivation (finalAttrs: { pname = "hipsparselt${clr.gpuArchSuffix}"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-Al/0yZPn/wqtBFQU1FcGoSquDMObk6HQ3D5sSh5biHg="; + tag = "therock-${finalAttrs.version}"; + hash = "sha256-pJvsJv007YCXR4YiOq3qFWlcDFoGxwKovNSk0Mjxnes="; sparseCheckout = [ "projects/hipsparselt" "projects/hipblaslt/tensilelite" "projects/hipblaslt/cmake" "projects/hipblaslt/device-library" + # hipBLASLt's CMakeLists, configured for rocisa, needs hipblaslt-version.h.in. + "projects/hipblaslt/library/include" "shared/origami" + # rocisa (tensilelite/rocisa/CMakeLists.txt) add_subdirectory's stinkytofu + "shared/stinkytofu" ]; }; sourceRoot = "${finalAttrs.src.name}/projects/hipsparselt"; @@ -64,6 +68,9 @@ stdenv.mkDerivation (finalAttrs: { env.ROCM_PATH = "${clr}"; env.TENSILE_ROCM_ASSEMBLER_PATH = lib.getExe' clr "amdclang++"; env.TENSILE_GEN_ASSEMBLY_TOOLCHAIN = lib.getExe' clr "amdclang++"; + # The tensilelite helper cache defaults to the unwritable $HOME/.tensile. + env.TENSILE_DISABLE_HELPER_CACHE = "1"; + requiredSystemFeatures = [ "big-parallel" ]; __structuredAttrs = true; diff --git a/pkgs/development/rocm-modules/10/llvm/clang-add-getbundleidsinfile.diff b/pkgs/development/rocm-modules/10/llvm/clang-add-getbundleidsinfile.diff new file mode 100644 index 0000000000000..ea6c9193ef34a --- /dev/null +++ b/pkgs/development/rocm-modules/10/llvm/clang-add-getbundleidsinfile.diff @@ -0,0 +1,75 @@ +--- a/include/clang/Driver/OffloadBundler.h 2026-10-07 22:36:18.030705685 -0700 ++++ b/include/clang/Driver/OffloadBundler.h 2026-10-07 22:36:50.353394217 -0700 +@@ -23,6 +23,7 @@ + #include "llvm/TargetParser/Triple.h" + #include + #include ++#include + + namespace clang { + +@@ -64,6 +65,13 @@ + ListBundleIDsInFile(llvm::StringRef InputFileName, + const OffloadBundlerConfig &BundlerConfig); + ++ // Collect available bundle IDs into a std::set. Return true if an error was ++ // found. ++ static llvm::Error ++ GetBundleIDsInFile(llvm::StringRef InputFileName, ++ const OffloadBundlerConfig &BundlerConfig, ++ std::set &BundleIds); ++ + llvm::Error BundleFiles(); + llvm::Error UnbundleFiles(); + llvm::Error UnbundleArchive(); +--- a/lib/Driver/OffloadBundler.cpp 2026-10-07 22:36:18.033306744 -0700 ++++ b/lib/Driver/OffloadBundler.cpp 2026-10-07 22:36:50.372606013 -0700 +@@ -1087,6 +1087,48 @@ + return Error::success(); + } + ++// Collect available bundle IDs into a std::set. Return true if an error was ++// found. ++Error OffloadBundler::GetBundleIDsInFile(StringRef InputFileName, ++ const OffloadBundlerConfig &BundlerConfig, ++ std::set &BundleIDs) { ++ // Open Input file. ++ ErrorOr> CodeOrErr = ++ MemoryBuffer::getFileOrSTDIN(InputFileName); ++ if (std::error_code EC = CodeOrErr.getError()) ++ return createFileError(InputFileName, EC); ++ ++ // Decompress the input if necessary. ++ Expected> DecompressedBufferOrErr = ++ CompressedOffloadBundle::decompress( ++ **CodeOrErr, BundlerConfig.Verbose ? &llvm::errs() : nullptr); ++ if (!DecompressedBufferOrErr) ++ return createStringError( ++ inconvertibleErrorCode(), ++ "Failed to decompress input: " + ++ llvm::toString(DecompressedBufferOrErr.takeError())); ++ ++ MemoryBuffer &DecompressedInput = **DecompressedBufferOrErr; ++ ++ // Select the right files handler. ++ Expected> FileHandlerOrErr = ++ CreateFileHandler(DecompressedInput, BundlerConfig); ++ if (!FileHandlerOrErr) ++ return FileHandlerOrErr.takeError(); ++ ++ std::unique_ptr &FH = *FileHandlerOrErr; ++ assert(FH); ++ ++ std::set BundleIDsRefs; ++ if (auto Error = FH->getBundleIDs(DecompressedInput, BundleIDsRefs)) ++ return Error; ++ ++ for (auto bundle_id : BundleIDsRefs) ++ BundleIDs.insert(bundle_id.str()); ++ ++ return Error::success(); ++} ++ + /// @brief Checks if a code object \p CodeObjectInfo is compatible with a given + /// target \p TargetInfo. + /// @link https://clang.llvm.org/docs/ClangOffloadBundler.html#bundle-entry-id diff --git a/pkgs/development/rocm-modules/llvm/clang-bodge-ignore-systemwide-incls.diff b/pkgs/development/rocm-modules/10/llvm/clang-bodge-ignore-systemwide-incls.diff similarity index 100% rename from pkgs/development/rocm-modules/llvm/clang-bodge-ignore-systemwide-incls.diff rename to pkgs/development/rocm-modules/10/llvm/clang-bodge-ignore-systemwide-incls.diff diff --git a/pkgs/development/rocm-modules/llvm/default.nix b/pkgs/development/rocm-modules/10/llvm/default.nix similarity index 67% rename from pkgs/development/rocm-modules/llvm/default.nix rename to pkgs/development/rocm-modules/10/llvm/default.nix index 4fbb9fb0d1c92..f235f751a9ee2 100644 --- a/pkgs/development/rocm-modules/llvm/default.nix +++ b/pkgs/development/rocm-modules/10/llvm/default.nix @@ -1,8 +1,9 @@ { lib, stdenv, - # LLVM version closest to ROCm fork to override - llvmPackages_22, + # Packaging base only; there is no llvmPackages_24, and the llvmPackages_git + # alias fails with allowAliases = false. + llvmPackages_23, overrideCC, lndir, rocm-device-libs, @@ -16,14 +17,13 @@ libffi, libxml2, removeReferencesTo, - fetchpatch, # Build compilers and stdenv suitable for profiling # leaving compressed line tables (-g1 -gz) unstripped # TODO: Should also apply to downstream packages which use rocmClangStdenv? profilableStdenv ? false, # FIXME: proper two-stage bootstrap & PGO/BOLT/LTO - # LTO currently disabled due to llvm 22 vs 22.1 bitcode mismatch between - # llvmPackages_22 (22.1) and ROCm LLVM (22.0). Uses new bitcode attr + # LTO currently disabled due to bitcode mismatch between the nixpkgs + # llvmPackages_23 and ROCm LLVM (24.0.0git). Uses new bitcode attr # 105 nocreateundeforpoison fails to link hipify. # Whether to use LTO when building the ROCm toolchain # Slows down this toolchain's build, for typical ROCm usecase @@ -36,12 +36,14 @@ }: let - version = "7.2.4"; + version = "10.1"; + # ROCm/TheRock two-component tag (therock-.) for all monorepo/llvm sources + srcTag = "therock-${version}"; # major version of this should be the clang version ROCm forked from - rocmLlvmVersion = "22.0.0-rocm"; - # llvmPackages_base version should match rocmLlvmVersion - # so libllvm's bitcode is compatible with the built toolchain - llvmPackages_base = llvmPackages_22; + rocmLlvmVersion = "24.0.0-rocm"; + # The base's own libllvm is used only to bootstrap (LTO is off, see withLto), + # so a released base one major behind ROCm's LLVM is fine. + llvmPackages_base = llvmPackages_23; llvmPackagesNoBintools = llvmPackages_base.override { bootBintools = null; bootBintoolsNoLibc = null; @@ -117,18 +119,17 @@ let llvmSrc = fetchFromGitHub { owner = "ROCm"; repo = "llvm-project"; - tag = "rocm-${version}"; - hash = "sha256-TwFvQimbax2E37ZC/52lNkHXCgyBNfSGDBaqmas2x/s="; + tag = srcTag; + hash = "sha256-WkgJF0D4XsrWKbJO+vKow9CrNIKL/PqOXRwrB3ECsQE="; }; llvmMajorVersion = lib.versions.major rocmLlvmVersion; # An llvmPackages (pkgs/development/compilers/llvm/) built from ROCm LLVM's source tree llvmPackagesRocm = llvmPackages_base.override (_old: { stdenv = stdenvToBuildRocmLlvm; - # not setting gitRelease = because that causes patch selection logic to use git patches - # ROCm LLVM is closer to 20 official - # gitRelease = {}; officialRelease = null; - officialRelease = { }; # Set but empty because we're overriding everything from it. + # Keep the official (not git) patch-selection path: ROCm LLVM tracks official + # releases closely. Set but empty because we're overriding everything from it. + officialRelease = { }; # this version determines which patches are applied version = rocmLlvmVersion; src = llvmSrc; @@ -212,8 +213,10 @@ let # Clang config file: redirect resource dir to the sysroot (where compiler-rt # lives) and set GCC install prefix for header/library search + # -L zstd: clang-linker-wrapper links -lzstd for compressed offload images. cat > $out/bin/${stdenv.hostPlatform.config}.cfg <127 - substituteInPlace src/targets/gpu/kernels/include/migraphx/kernels/bit.hpp \ - --replace-fail "// popcount(~(x | −x))" "// popcount(~(x | -x))" + # Fix Unicode minus sign (U+2212) in comment that breaks EMBED_USE=CArrays + # The embed mechanism generates char[] arrays that can't store unicode − + # which has values >127 + substituteInPlace src/targets/gpu/kernels/include/migraphx/kernels/bit.hpp \ + --replace-fail "// popcount(~(x | −x))" "// popcount(~(x | -x))" '' + lib.optionalString (!buildDocs) '' substituteInPlace CMakeLists.txt \ diff --git a/pkgs/development/rocm-modules/migraphx/test-migraphx-driver.nix b/pkgs/development/rocm-modules/10/migraphx/test-migraphx-driver.nix similarity index 100% rename from pkgs/development/rocm-modules/migraphx/test-migraphx-driver.nix rename to pkgs/development/rocm-modules/10/migraphx/test-migraphx-driver.nix diff --git a/pkgs/development/rocm-modules/miopen/default.nix b/pkgs/development/rocm-modules/10/miopen/default.nix similarity index 81% rename from pkgs/development/rocm-modules/miopen/default.nix rename to pkgs/development/rocm-modules/10/miopen/default.nix index 881b0a2bbbdf6..ee6cd1a16aa52 100644 --- a/pkgs/development/rocm-modules/miopen/default.nix +++ b/pkgs/development/rocm-modules/10/miopen/default.nix @@ -10,7 +10,6 @@ cmake, rocm-cmake, rocblas, - rocmlir, rocrand, rocm-runtime, hipblas-common, @@ -31,9 +30,11 @@ doxygen, sphinx, zlib, + zstd, gtest, rocm-comgr, roctracer, + python3, python3Packages, gpuTargets ? clr.localGpuTargets or clr.gpuTargets, buildDocs ? false, # Needs internet because of rocm-docs-core @@ -43,8 +44,9 @@ let # FIXME: cmake files need patched to include this properly - cFlags = "-Wno-documentation-pedantic --offload-compress -I${hipblas-common}/include -I${hipblas}/include -I${roctracer}/include -I${nlohmann_json}/include -I${sqlite.dev}/include -I${rocrand}/include"; - version = "7.2.4"; + # nlohmann_json 3.12 headers warn under MIOpen's -Werror. + cFlags = "-Wno-documentation-pedantic -Wno-covered-switch-default --offload-compress -I${hipblas-common}/include -I${hipblas}/include -I${roctracer}/include -isystem ${nlohmann_json}/include -I${sqlite.dev}/include -I${rocrand}/include"; + version = "10.1"; # Targets outside this list will get # error: use of undeclared identifier 'CK_BUFFER_RESOURCE_3RD_DWORD' @@ -124,37 +126,24 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/miopen" "shared" ]; fetchSubmodules = true; - hash = "sha256-plZpBTbEBVMa5CasjfbUsu45xP/BYstrEpWKK2H7QQ4="; + hash = "sha256-pIo0QeVJ64Abte5u319kd2O6gjHIOtMkBo3h4thpzDo="; }; sourceRoot = "${finalAttrs.src.name}/projects/miopen"; env.CFLAGS = cFlags; env.CXXFLAGS = cFlags; - # Find zstd and add to target. Mainly for torch. patches = [ ./skip-preexisting-dbs.patch - (fetchpatch { - url = "https://github.com/ROCm/MIOpen/commit/e608b4325646afeabb5e52846997b926d2019d19.patch"; - hash = "sha256-oxa3qlIC2bzbwGxrQOZXoY/S7CpLsMrnWRB7Og0tk0M="; - }) - (fetchpatch { - url = "https://github.com/ROCm/MIOpen/commit/3413d2daaeb44b7d6eadcc03033a5954a118491e.patch"; - hash = "sha256-ST4snUcTmmSI1Ogx815KEX9GdMnmubsavDzXCGJkiKs="; - }) - (fetchpatch { - # [miopen] Extend HIP ISA compatibility - name = "Extend-MIOpen-ISA-compatibility.patch"; - url = "https://github.com/GZGavinZhao/rocm-libraries/commit/02f0fedffdc197f146dd45f41e10990a00cde3ee.patch"; - hash = "sha256-My32iZw75rvB4fyvUJJ2kw2bU9/39awGteFGjzijixw="; - relative = "projects/miopen"; - }) + # Extend MIOpen's HIP ISA compatibility check (e.g. gfx906 code objects on + # gfx90c-class devices). Rebased from GZGavinZhao/MIOpen 02f0fedf. + ./extend-miopen-isa-compatibility.patch ]; outputs = [ @@ -174,6 +163,8 @@ stdenv.mkDerivation (finalAttrs: { pkg-config cmake rocm-cmake + # cmake/CopyExternalHeader.cmake does find_package(Python3 REQUIRED) + python3 clr ]; @@ -181,11 +172,11 @@ stdenv.mkDerivation (finalAttrs: { hipblas hipblas-common rocblas - rocmlir half boost sqlite bzip2 + zstd nlohmann_json frugally-deep roctracer @@ -210,6 +201,8 @@ stdenv.mkDerivation (finalAttrs: { ]; cmakeFlags = [ + # The standalone build FetchContents its dependencies. + (lib.cmakeBool "MIOPEN_STANDALONE_BUILD" false) "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" supportedTargets}" "-DGPU_TARGETS=${lib.concatStringsSep ";" supportedTargets}" "-DGPU_ARCHS=${lib.concatStringsSep ";" supportedTargets}" @@ -228,6 +221,8 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeBool "MIOPEN_USE_COMPOSABLEKERNEL" withComposableKernel) (lib.cmakeBool "MIOPEN_USE_HIPRTC" true) (lib.cmakeBool "MIOPEN_USE_COMGR" true) + # hipconv's cdna4 kernels fail with clang 24 ("reference to __host__ variable in __device__ function"). + (lib.cmakeBool "MIOPEN_USE_HIPCONV" false) "-DCMAKE_HIP_COMPILER_ROCM_ROOT=${clr}" # Manually define CMAKE_INSTALL_ # See: https://github.com/NixOS/nixpkgs/pull/197838 @@ -242,6 +237,14 @@ stdenv.mkDerivation (finalAttrs: { ]; postPatch = '' + # Keep the rocmClangStdenv compiler instead of MIOpen's ClangToolChain.cmake. + substituteInPlace CMakeLists.txt \ + --replace-fail 'if(NOT CMAKE_TOOLCHAIN_FILE AND NOT DEFINED ENV{CMAKE_TOOLCHAIN_FILE})' 'if(FALSE)' + + # ROCm 10 clang and C++20 add warnings throughout; drop -Werror like composable_kernel. + substituteInPlace cmake/EnableCompilerWarnings.cmake \ + --replace-fail ' -Werror' ' -Wno-error' + substituteInPlace cmake/ClangTidy.cmake \ --replace-fail 'macro(enable_clang_tidy)' 'macro(enable_clang_tidy) endmacro() @@ -249,10 +252,13 @@ stdenv.mkDerivation (finalAttrs: { --replace-fail 'function(clang_tidy_check TARGET)' 'function(clang_tidy_check TARGET) return()' - patchShebangs test src/composable_kernel fin utils install_deps.cmake + patchShebangs test fin utils install_deps.cmake + # Runtime hiprtc compilation finds ROCm headers only through ROCM_PATH; default it. substituteInPlace src/comgr.cpp \ - --replace-fail '"/opt/rocm"' '"${hiprtcCompileRocmPath}"' + --replace-fail 'auto rocm_path = env::value(ROCM_PATH);' 'auto rocm_path = env::value(ROCM_PATH); + if(rocm_path.empty()) + rocm_path = "${hiprtcCompileRocmPath}";' '' + linkKDBsTo "src/kernels" + '' diff --git a/pkgs/development/rocm-modules/10/miopen/extend-miopen-isa-compatibility.patch b/pkgs/development/rocm-modules/10/miopen/extend-miopen-isa-compatibility.patch new file mode 100644 index 0000000000000..eff7f1bda61bb --- /dev/null +++ b/pkgs/development/rocm-modules/10/miopen/extend-miopen-isa-compatibility.patch @@ -0,0 +1,40 @@ +diff --git a/src/hip/handlehip.cpp b/src/hip/handlehip.cpp +--- a/src/hip/handlehip.cpp 2026-09-23 21:21:51.170790313 -0700 ++++ b/src/hip/handlehip.cpp 2026-09-23 21:21:51.190325176 -0700 +@@ -217,8 +217,35 @@ + { + hipDeviceProp_t props{}; + (void)hipGetDeviceProperties(&props, device); +- const std::string name(props.gcnArchName); ++ std::string name(props.gcnArchName); + MIOPEN_LOG_NQI("Raw device name: " << name); ++ ++ // Coerce device name so MIOpen selects a compatible ISA's kernels on ++ // GPUs that share a binary-compatible base (e.g. gfx906/MI50 -> gfx900). ++ // Ported from GZGavinZhao's "Extend MIOpen ISA compatibility" onto ++ // ROCm 10 (get_device_name now (void)-casts hipGetDeviceProperties). ++ size_t loc = std::string::npos; ++ if((loc = name.find("gfx103")) != std::string::npos) ++ { ++ size_t offset = std::char_traits::length("gfx103"); ++ name.at(loc + offset) = '0'; ++ } ++ else if((loc = name.find("gfx101")) != std::string::npos) ++ { ++ size_t offset = std::char_traits::length("gfx101"); ++ name.at(loc + offset) = '0'; ++ } ++ else if((loc = name.find("gfx90")) != std::string::npos) ++ { ++ size_t offset = std::char_traits::length("gfx90"); ++ char ver = name.at(loc + offset); ++ if(ver == '2' || ver == '6' || ver == '9' || ver == 'c') ++ { ++ name.at(loc + offset) = '0'; ++ } ++ } ++ ++ MIOPEN_LOG_NQI("Coerced device name: " << name); + return name; // NOLINT (performance-no-automatic-move) + } + diff --git a/pkgs/development/rocm-modules/miopen/kdbs.nix b/pkgs/development/rocm-modules/10/miopen/kdbs.nix similarity index 100% rename from pkgs/development/rocm-modules/miopen/kdbs.nix rename to pkgs/development/rocm-modules/10/miopen/kdbs.nix diff --git a/pkgs/development/rocm-modules/miopen/skip-preexisting-dbs.patch b/pkgs/development/rocm-modules/10/miopen/skip-preexisting-dbs.patch similarity index 100% rename from pkgs/development/rocm-modules/miopen/skip-preexisting-dbs.patch rename to pkgs/development/rocm-modules/10/miopen/skip-preexisting-dbs.patch diff --git a/pkgs/development/rocm-modules/miopen/test-frugally-deep-model-loading.cpp b/pkgs/development/rocm-modules/10/miopen/test-frugally-deep-model-loading.cpp similarity index 100% rename from pkgs/development/rocm-modules/miopen/test-frugally-deep-model-loading.cpp rename to pkgs/development/rocm-modules/10/miopen/test-frugally-deep-model-loading.cpp diff --git a/pkgs/development/rocm-modules/miopen/test-frugally-deep-model-loading.nix b/pkgs/development/rocm-modules/10/miopen/test-frugally-deep-model-loading.nix similarity index 100% rename from pkgs/development/rocm-modules/miopen/test-frugally-deep-model-loading.nix rename to pkgs/development/rocm-modules/10/miopen/test-frugally-deep-model-loading.nix diff --git a/pkgs/development/rocm-modules/miopen/test-runtime-compilation.nix b/pkgs/development/rocm-modules/10/miopen/test-runtime-compilation.nix similarity index 100% rename from pkgs/development/rocm-modules/miopen/test-runtime-compilation.nix rename to pkgs/development/rocm-modules/10/miopen/test-runtime-compilation.nix diff --git a/pkgs/development/rocm-modules/miopen/update.sh b/pkgs/development/rocm-modules/10/miopen/update.sh similarity index 100% rename from pkgs/development/rocm-modules/miopen/update.sh rename to pkgs/development/rocm-modules/10/miopen/update.sh diff --git a/pkgs/development/rocm-modules/rccl/default.nix b/pkgs/development/rocm-modules/10/rccl/default.nix similarity index 84% rename from pkgs/development/rocm-modules/rccl/default.nix rename to pkgs/development/rocm-modules/10/rccl/default.nix index 1dbcd0c84945c..2269b178b9283 100644 --- a/pkgs/development/rocm-modules/rccl/default.nix +++ b/pkgs/development/rocm-modules/10/rccl/default.nix @@ -5,11 +5,10 @@ rocmUpdateScript, cmake, rocm-cmake, - rocm-smi, + amdsmi, rocm-core, pkg-config, clr, - mscclpp, perl, hipify, python3, @@ -40,7 +39,7 @@ in # infiniband ib_peer_mem support isn't in the mainline kernel but is carried by some distros stdenv.mkDerivation (finalAttrs: { pname = "rccl${clr.gpuArchSuffix}"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -51,15 +50,19 @@ stdenv.mkDerivation (finalAttrs: { patches = [ ./rccl-test-missing-iomanip.diff - ./fix_hw_reg_hw_id_gt_gfx10.patch ]; src = fetchFromGitHub { owner = "ROCm"; - repo = "rccl"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-A1IQYIDWqu3JLiPQ70G52s1/0ZweQxFlgMUH81qJWmU="; + repo = "rocm-systems"; + tag = "therock-${finalAttrs.version}"; + sparseCheckout = [ + "projects/rccl" + "shared" + ]; + hash = "sha256-OkX15/P1wQ9E8QfAOklXvxmVw700kvIyi6CwdorqNhA="; }; + sourceRoot = "${finalAttrs.src.name}/projects/rccl"; requiredSystemFeatures = [ "big-parallel" ]; # Very resource intensive LTO @@ -75,13 +78,13 @@ stdenv.mkDerivation (finalAttrs: { ]; buildInputs = [ - rocm-smi + # Headers only; RCCL dlopens amd_smi at runtime. + amdsmi fmt gtest roctracer rocprofiler rocprofiler-register - mscclpp ] ++ lib.optionals buildTests [ chrpath @@ -95,10 +98,6 @@ stdenv.mkDerivation (finalAttrs: { "-DROCM_PATCH_VERSION=${rocm-core.ROCM_LIBPATCH_VERSION}" "-DROCM_VERSION=${rocm-core.ROCM_LIBPATCH_VERSION}" "-DBUILD_BFD=OFF" # Can't get it to detect bfd.h - "-DENABLE_MSCCL_KERNEL=ON" - # FIXME: this is still running a download because if(NOT mscclpp_nccl_FOUND) is commented out T_T - "-DENABLE_MSCCLPP=OFF" - #"-DMSCCLPP_ROOT=${mscclpp}" # Manually define CMAKE_INSTALL_ # See: https://github.com/NixOS/nixpkgs/pull/197838 "-DCMAKE_INSTALL_BINDIR=bin" @@ -121,10 +120,6 @@ stdenv.mkDerivation (finalAttrs: { env.LDFLAGS = "${san}"; postPatch = '' patchShebangs src tools - substituteInPlace CMakeLists.txt \ - --replace-fail '${"\${HOST_OS_ID}"}' '"ubuntu"' \ - --replace-fail 'target_include_directories(rccl PRIVATE ''${ROCM_SMI_INCLUDE_DIR})' \ - 'target_include_directories(rccl PRIVATE ''${ROCM_SMI_INCLUDE_DIRS})' ''; postInstall = diff --git a/pkgs/development/rocm-modules/rccl/rccl-test-missing-iomanip.diff b/pkgs/development/rocm-modules/10/rccl/rccl-test-missing-iomanip.diff similarity index 100% rename from pkgs/development/rocm-modules/rccl/rccl-test-missing-iomanip.diff rename to pkgs/development/rocm-modules/10/rccl/rccl-test-missing-iomanip.diff diff --git a/pkgs/development/rocm-modules/rdc/default.nix b/pkgs/development/rocm-modules/10/rdc/default.nix similarity index 91% rename from pkgs/development/rocm-modules/rdc/default.nix rename to pkgs/development/rocm-modules/10/rdc/default.nix index 8c5debc4dec47..fe03b7f0510fd 100644 --- a/pkgs/development/rocm-modules/rdc/default.nix +++ b/pkgs/development/rocm-modules/10/rdc/default.nix @@ -49,7 +49,7 @@ let in stdenv.mkDerivation (finalAttrs: { pname = "rdc"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -64,19 +64,17 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rdc" "shared" ]; - hash = "sha256-SmySauRxFnEQJVTjGYf4TpmQclTwZG2RZrk3u6ko5Qo="; + hash = "sha256-tcov375DXHX1L/HhACevulzBOhq7Gp08j8SDEuVgPYU="; }; sourceRoot = "${finalAttrs.src.name}/projects/rdc"; patches = [ - # https://github.com/ROCm/rocm-systems/pull/2423 - ./fix-cmake-cxxflags.patch - # https://github.com/ROCm/rocm-systems/pull/2424 + # Find libcap through pkg-config (https://github.com/ROCm/rocm-systems/pull/2424, closed) ./fix-libcap-pkgconfig.patch ]; diff --git a/pkgs/development/rocm-modules/rdc/fix-libcap-pkgconfig.patch b/pkgs/development/rocm-modules/10/rdc/fix-libcap-pkgconfig.patch similarity index 100% rename from pkgs/development/rocm-modules/rdc/fix-libcap-pkgconfig.patch rename to pkgs/development/rocm-modules/10/rdc/fix-libcap-pkgconfig.patch diff --git a/pkgs/development/rocm-modules/rocalution/default.nix b/pkgs/development/rocm-modules/10/rocalution/default.nix similarity index 87% rename from pkgs/development/rocm-modules/rocalution/default.nix rename to pkgs/development/rocm-modules/10/rocalution/default.nix index 8fd50e6fc589b..a08359d89b146 100644 --- a/pkgs/development/rocm-modules/rocalution/default.nix +++ b/pkgs/development/rocm-modules/10/rocalution/default.nix @@ -22,7 +22,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocalution"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -39,10 +39,16 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; - repo = "rocALUTION"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-yPM26e8tGNpPScIriAPRb+6OZfdpX4PgE0E9bmc3FkU="; + # rocALUTION moved into the rocm-libraries monorepo during the TheRock 7.x series + repo = "rocm-libraries"; + tag = "therock-${finalAttrs.version}"; + sparseCheckout = [ + "projects/rocalution" + "shared" + ]; + hash = "sha256-peElY9WF9GbITUkeUwW0Ys8UYrUeXQ3Go7uWYGvMZBY="; }; + sourceRoot = "${finalAttrs.src.name}/projects/rocalution"; nativeBuildInputs = [ cmake diff --git a/pkgs/development/rocm-modules/rocblas/default.nix b/pkgs/development/rocm-modules/10/rocblas/base.nix similarity index 74% rename from pkgs/development/rocm-modules/rocblas/default.nix rename to pkgs/development/rocm-modules/10/rocblas/base.nix index 0e9d0485a2c6b..478616b76bab0 100644 --- a/pkgs/development/rocm-modules/rocblas/default.nix +++ b/pkgs/development/rocm-modules/10/rocblas/base.nix @@ -7,7 +7,6 @@ cmake, rocm-cmake, clr, - diffutils, python3, tensile, boost, @@ -23,7 +22,7 @@ hipblas-common, hipblaslt, python3Packages, - rocm-smi, + amdsmi, pkg-config, removeReferencesTo, buildTensile ? true, @@ -40,17 +39,17 @@ let in stdenv.mkDerivation (finalAttrs: { pname = "rocblas${clr.gpuArchSuffix}"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + rev = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocblas" "shared" ]; - hash = "sha256-wrjcr2ASSF+bk5atjvKfIYSbg+vevo/a2W2ca9Nft/4="; + hash = "sha256-G6vo78dbgP02zQJKsAuFPoncy2rsGkenZWrfvj4mD8M="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocblas"; @@ -89,16 +88,27 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optionals (buildTests || buildBenchmarks) [ gtest gfortran - rocm-smi + # clients/CMakeLists.txt: find_package(amd_smi CONFIG REQUIRED) + amdsmi ] ++ lib.optionals (buildTensile || buildTests || buildBenchmarks) [ python3Packages.pyyaml ]; env.CXXFLAGS = "-fopenmp -I${lib.getDev boost}/include -I${hipblas-common}/include -I${roctracer}/include"; - # Fails to link tests with undefined symbol: cblas_* + # Fails to link tests with undefined symbol: cblas_* (cblas comes from amd-blis). + # cblas needs an explicit -L: rocBLAS compiles with the unwrapped rocm-toolchain + # clang, so buildInput lib dirs are not injected into the clang-linker-wrapper + # host-link path the way the nixpkgs cc-wrapper would. With LLVM 24 the rocm-cmake + # `rocm_check_target_ids` probe (run before find_package(BLAS)) does a full + # `--hip-link`, and CMake seeds CMAKE_EXE_LINKER_FLAGS from $LDFLAGS, so a bare + # `-lcblas` makes that probe's link fail ("unable to find library -lcblas"), which + # empties the supported-target list and aborts with "Unsupported target ". + # Only builds with tests/benchmarks hit this; the Tensile shards build with them off. env.LDFLAGS = - "-Wl,--as-needed -lzstd" + lib.optionalString (buildTests || buildBenchmarks) " -lcblas"; + "-Wl,--as-needed" + + lib.optionalString buildTensile " -lzstd" + + lib.optionalString (buildTests || buildBenchmarks) " -L${amd-blis}/lib -lcblas"; env.TENSILE_ROCM_ASSEMBLER_PATH = "${stdenv.cc}/bin/clang++"; cmakeFlags = [ @@ -139,15 +149,6 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeBool "Tensile_LAZY_LIBRARY_LOADING" tensileLazyLib) ]; - patches = [ - (fetchpatch { - name = "Extend-rocBLAS-HIP-ISA-compatibility.patch"; - url = "https://github.com/GZGavinZhao/rocm-libraries/commit/49f21f3cfe7eb4b8ac724eef81fa2cae97a3c22e.patch"; - hash = "sha256-vAVVpTwt49lGHu2YopR1X68v5LwFOjUYuSC4ucBpFGg="; - relative = "projects/rocblas"; - }) - ]; - # Pass $NIX_BUILD_CORES to Tensile postPatch = '' substituteInPlace cmake/build-options.cmake \ @@ -159,17 +160,11 @@ stdenv.mkDerivation (finalAttrs: { substituteInPlace clients/CMakeLists.txt \ --replace-fail "if ( NOT WIN32 )" "if(OFF)" \ --replace-fail "else() # WIN32" "elseif(OFF)" - '' - # Fixes sh: line 1: /usr/bin/diff: No such file or directory - # /build/source/clients/gtest/../include/testing_logging.hpp:1117: Failure - + lib.optionalString buildTests '' - substituteInPlace clients/include/testing_logging.hpp \ - --replace-fail "/usr/bin/diff" "${lib.getExe' diffutils "diff"}" ''; postInstall = - # tensile isn't needed at runtime and pulls in ~400MB of python deps - '' + # Tensile is only needed while generating kernels. + lib.optionalString buildTensile '' remove-references-to -t ${tensile} \ "$out/lib/librocblas.so."* '' @@ -184,13 +179,21 @@ stdenv.mkDerivation (finalAttrs: { cp "$out/bin/"*.{yaml,txt} "$test/bin" '' + '' - if [ -d $out/bin ]; then - rm $out/bin/*.{yaml,txt} || true - rmdir $out/bin - fi + # The rocBLAS library output keeps no bin/ (clients live in $test / + # $benchmark). ROCm 10 also installs a bin/rocblas/ CTest scaffolding dir + # alongside the client yaml/txt, so remove the whole bin/ tree rather than + # rmdir'ing (which fails on the non-empty directory). + rm -rf $out/bin ''; passthru = { + # Read by ./default.nix to decide whether the build can be sharded. + inherit + buildTensile + tensileSepArch + tensileLazyLib + gpuTargets + ; amdgpu_targets = gpuTargets'; updateScript = rocmUpdateScript { inherit finalAttrs; }; }; @@ -204,5 +207,6 @@ stdenv.mkDerivation (finalAttrs: { license = lib.licenses.mit; teams = [ lib.teams.rocm ]; platforms = lib.platforms.linux; + broken = true; # this base package shouldn't be built directly }; }) diff --git a/pkgs/development/rocm-modules/10/rocblas/default.nix b/pkgs/development/rocm-modules/10/rocblas/default.nix new file mode 100644 index 0000000000000..bd731d100bcc7 --- /dev/null +++ b/pkgs/development/rocm-modules/10/rocblas/default.nix @@ -0,0 +1,95 @@ +# One Tensile shard per GPU architecture. With separate architectures and lazy +# loading, librocblas.so opens lib/rocblas/library// at runtime, so the +# shards join by directory merge. Other layouts use ./base.nix directly. +{ + lib, + clr, + rocblas_base, + ... +}@args: + +let + base = rocblas_base.override ( + builtins.removeAttrs args [ + "lib" + "clr" + "rocblas_base" + ] + ); + inherit (base.passthru) + buildTensile + tensileSepArch + tensileLazyLib + gpuTargets + ; + archList = gpuTargets; + headArch = lib.head archList; + tailArchs = lib.drop 1 archList; + shardTensile = buildTensile && tensileSepArch && tensileLazyLib && lib.length archList > 1; + + # One architecture's lazy Tensile library; everything else is dropped. + mkTensileShard = + arch: + (base.override { + gpuTargets = [ arch ]; + buildTests = false; + buildBenchmarks = false; + }).overrideAttrs + (old: { + pname = "rocblas-tensile-${arch}"; + meta = (unbreak old).meta; + outputs = [ "out" ]; + doCheck = false; + postInstall = (old.postInstall or "") + '' + keep="$(mktemp -d)" + cp -r "$out/lib/rocblas/library" "$keep/library" + rm -rf "$out"/* + mkdir -p "$out/lib/rocblas" + mv "$keep/library" "$out/lib/rocblas/library" + rm -rf "$keep" + ''; + }); + + tensileShards = map mkTensileShard tailArchs; + + # The base is hidden from Hydra; the configured public builds are usable. + unbreak = old: { + meta = old.meta // { + broken = false; + }; + }; +in + +# Other Tensile layouts cannot be merged by copying architecture directories. +if !shardTensile then + base.overrideAttrs unbreak +else + (base.override { + gpuTargets = [ headArch ]; + }).overrideAttrs + (old: { + pname = "rocblas${clr.gpuArchSuffix}"; + meta = (unbreak old).meta; + + inherit tensileShards; + disallowedReferences = tensileShards; + + # Merge the shard directories, then strip the shard store path that Tensile + # embeds in one code object's ELF metadata per architecture. It is not + # load-bearing (the unsplit build embeds its own $out in the same place), + # and remove-references-to keeps the ELF layout. disallowedReferences + # keeps the private shards out of consumers' closures. + postInstall = (old.postInstall or "") + '' + for shard in $tensileShards; do + cp -r --no-preserve=mode "$shard/lib/rocblas/library/"* "$out/lib/rocblas/library/" + done + for shard in $tensileShards; do + find "$out/lib/rocblas/library" -type f -exec remove-references-to -t "$shard" {} + + done + ''; + + passthru = (old.passthru or { }) // { + amdgpu_targets = lib.concatStringsSep ";" archList; + inherit tensileShards; + }; + }) diff --git a/pkgs/development/rocm-modules/rocblas/hiplaslt-unstable-compat.patch b/pkgs/development/rocm-modules/10/rocblas/hiplaslt-unstable-compat.patch similarity index 100% rename from pkgs/development/rocm-modules/rocblas/hiplaslt-unstable-compat.patch rename to pkgs/development/rocm-modules/10/rocblas/hiplaslt-unstable-compat.patch diff --git a/pkgs/development/rocm-modules/rocdbgapi/default.nix b/pkgs/development/rocm-modules/10/rocdbgapi/default.nix similarity index 84% rename from pkgs/development/rocm-modules/rocdbgapi/default.nix rename to pkgs/development/rocm-modules/10/rocdbgapi/default.nix index 8cceaa35137b3..c0014ac9a3640 100644 --- a/pkgs/development/rocm-modules/rocdbgapi/default.nix +++ b/pkgs/development/rocm-modules/10/rocdbgapi/default.nix @@ -47,7 +47,7 @@ let in stdenv.mkDerivation (finalAttrs: { pname = "rocdbgapi"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -60,10 +60,16 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; - repo = "ROCdbgapi"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-KqvhwfIv8pbr8WbnfAKl71fg5yxbwYcpzZcGU9Htdkc="; + # ROCdbgapi lives in the rocm-systems monorepo since ROCm 10 + repo = "rocm-systems"; + tag = "therock-${finalAttrs.version}"; + sparseCheckout = [ + "projects/rocdbgapi" + "shared" + ]; + hash = "sha256-vadmzQL3Sqtbtf7vMKCN6jabBuxnugPHDJd2yDhVDTM="; }; + sourceRoot = "${finalAttrs.src.name}/projects/rocdbgapi"; nativeBuildInputs = [ cmake diff --git a/pkgs/development/rocm-modules/rocfft/default.nix b/pkgs/development/rocm-modules/10/rocfft/default.nix similarity index 96% rename from pkgs/development/rocm-modules/rocfft/default.nix rename to pkgs/development/rocm-modules/10/rocfft/default.nix index c48529ac5a831..53ab3ae97693a 100644 --- a/pkgs/development/rocm-modules/rocfft/default.nix +++ b/pkgs/development/rocm-modules/10/rocfft/default.nix @@ -20,17 +20,17 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocfft${clr.gpuArchSuffix}"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocfft" "shared" ]; - hash = "sha256-RjWMzLX0nBA8ClweJ8YgRTn+Nzt/VUkOoSw3jMQ3IWg="; + hash = "sha256-N7bqrYrrYg9p6YnG7UcvOL7qYDPD/XwKUj7Jco57/oY="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocfft"; diff --git a/pkgs/development/rocm-modules/10/rocfft/log-every-n-aot-jobs.patch b/pkgs/development/rocm-modules/10/rocfft/log-every-n-aot-jobs.patch new file mode 100644 index 0000000000000..6b366860f5c40 --- /dev/null +++ b/pkgs/development/rocm-modules/10/rocfft/log-every-n-aot-jobs.patch @@ -0,0 +1,23 @@ +diff --git a/library/src/rocfft_aot_helper.cpp b/library/src/rocfft_aot_helper.cpp +--- a/library/src/rocfft_aot_helper.cpp 2026-09-23 08:37:25.278407528 -0700 ++++ b/library/src/rocfft_aot_helper.cpp 2026-09-23 08:37:25.298619033 -0700 +@@ -786,12 +786,19 @@ + for(size_t i = 0; i < NUM_THREADS; ++i) + { + threads.emplace_back([&queue, &gpu_archs, &rtc_helper]() { ++ int compile_count = 0; + while(true) + { + auto item = queue.pop(); + if(item.kernel_name.empty()) + break; + ++ // Emit periodic progress so the Nix builder does not time out on the ++ // long, otherwise-silent ahead-of-time kernel compile step. ++ if(++compile_count % 16 == 0) ++ std::cerr << "rocfft_aot_helper processing " << item.kernel_name ++ << std::endl ++ << std::flush; + for(const auto& gpu_arch : gpu_archs) + { + if(item.sol_arch_name.empty()) diff --git a/pkgs/development/rocm-modules/rocgdb/default.nix b/pkgs/development/rocm-modules/10/rocgdb/default.nix similarity index 92% rename from pkgs/development/rocm-modules/rocgdb/default.nix rename to pkgs/development/rocm-modules/10/rocgdb/default.nix index 918f624b673d2..4dbb291e5305f 100644 --- a/pkgs/development/rocm-modules/rocgdb/default.nix +++ b/pkgs/development/rocm-modules/10/rocgdb/default.nix @@ -23,13 +23,14 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocgdb"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "ROCgdb"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-oml/HLExnnjh7+axeWPZRWecpwK2BnzVOaGvXYhrxKs="; + # ROCgdb switched to the two-component therock-X.Y tag scheme in 10.0. + tag = "therock-${finalAttrs.version}"; + hash = "sha256-BenTuntdO+NUgzty0en2b7uaIvugISNU4rqxRG/Ka1w="; }; nativeBuildInputs = [ diff --git a/pkgs/development/rocm-modules/rocm-cmake/default.nix b/pkgs/development/rocm-modules/10/rocm-cmake/default.nix similarity index 82% rename from pkgs/development/rocm-modules/rocm-cmake/default.nix rename to pkgs/development/rocm-modules/10/rocm-cmake/default.nix index dac12d5d0fccc..1c0a5e4e7a220 100644 --- a/pkgs/development/rocm-modules/rocm-cmake/default.nix +++ b/pkgs/development/rocm-modules/10/rocm-cmake/default.nix @@ -9,13 +9,13 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocm-cmake"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-cmake"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-gY6jzIIN1pSXGbCMN6y35Q/VJgbIqWDRjD8aI/fc1L0="; + tag = "therock-${finalAttrs.version}"; + hash = "sha256-im6UO0crO0Jc27zkTsdvJYPHit8IGlw/vDPGrmP1XqY="; }; nativeBuildInputs = [ cmake ]; diff --git a/pkgs/development/rocm-modules/10/rocm-comgr/comgr-isa-compat-ccob.patch b/pkgs/development/rocm-modules/10/rocm-comgr/comgr-isa-compat-ccob.patch new file mode 100644 index 0000000000000..f2c93adf45a26 --- /dev/null +++ b/pkgs/development/rocm-modules/10/rocm-comgr/comgr-isa-compat-ccob.patch @@ -0,0 +1,97 @@ +--- a/src/comgr-compiler.cpp ++++ b/src/comgr-compiler.cpp +@@ -20,6 +20,7 @@ + #include "comgr-diagnostic-handler.h" + #include "comgr-env.h" + #include "comgr-libcxx-headers.h" ++#include "comgr-metadata.h" + #include "comgr-resource-directory.h" + #include "comgr-spirv-command.h" + #include "comgr-unbundle-command.h" +@@ -1855,17 +1856,72 @@ + size_t Index = OutputPrefix.find_last_of("."); + OutputPrefix = OutputPrefix.substr(0, Index); + ++ std::set CoEntryIds; ++ if (auto Error = OffloadBundler::GetBundleIDsInFile(InputFilePath, BundlerConfig, CoEntryIds)) { ++ if (env::shouldEmitVerboseLogs()) { ++ LogS << "Failed to get bundle IDs in " ++ << InputFilePath ++ << ", not trying to coerce compatible archs\n"; ++ LogS.flush(); ++ } ++ } ++ std::set> entry_ids_with_idents; ++ for (const auto& CoEntryId : CoEntryIds) { ++ std::string TargetIdent; ++ size_t Pos = std::string::npos; ++ for (const auto& Prefix : {"hipv4-", "hip-"}) { ++ if ((Pos = CoEntryId.find(Prefix)) == 0) { ++ TargetIdent = CoEntryId.substr(std::char_traits::length(Prefix)); ++ break; ++ } ++ } ++ ++ if (TargetIdent.empty()) { ++ continue; ++ } ++ ++ entry_ids_with_idents.emplace(CoEntryId, TargetIdent); ++ } ++ ++ // Bundler target and output names + for (StringRef Entry : ActionInfo->BundleEntryIDs) { ++ std::string CompatEntry = Entry.str(); ++ ++ std::string EntryIdent; ++ size_t Pos = std::string::npos; ++ for (const auto& Prefix : {"hipv4-", "hip-"}) { ++ if ((Pos = Entry.find(Prefix)) == 0) { ++ EntryIdent = Entry.substr(std::char_traits::length(Prefix)); ++ break; ++ } ++ } ++ ++ if (!EntryIdent.empty()) { ++ std::string BestEntry; ++ for (const auto& [CoEntry, CoIdent] : entry_ids_with_idents) { ++ if (EntryIdent == CoIdent) { ++ BestEntry = CoEntry; ++ break; ++ } else if (metadata::isCompatibleIsaName(EntryIdent, CoIdent)) { ++ BestEntry = CoEntry; ++ } ++ } ++ ++ if (!BestEntry.empty()) { ++ CompatEntry = BestEntry; ++ } ++ } ++ + // Add an output file for each target + SmallString<128> OutputFilePath = OutputDir; + sys::path::append(OutputFilePath, +- OutputPrefix + "-" + Entry + "." + FileExtension); ++ OutputPrefix + "-" + CompatEntry + "." + FileExtension); + +- BundlerConfig.TargetNames.emplace_back(Entry); ++ BundlerConfig.TargetNames.emplace_back(CompatEntry); + BundlerConfig.OutputFileNames.emplace_back(OutputFilePath); + + if (env::shouldEmitVerboseLogs()) { +- LogS << "\tBundle Entry ID: " << Entry << "\n" ++ LogS << "\tBundle (Compat)Entry ID: " << CompatEntry << "\n" + << "\tOutput Filename: " << OutputFilePath << "\n"; + LogS.flush(); + } +--- a/src/comgr-metadata.h ++++ b/src/comgr-metadata.h +@@ -37,6 +37,8 @@ + + bool isValidIsaName(llvm::StringRef IsaName); + ++bool isCompatibleIsaName(llvm::StringRef IsaName, llvm::StringRef CodeObjectIsaName); ++ + amd_comgr_status_t getElfIsaName(DataObject *DataP, std::string &IsaName); + + amd_comgr_status_t lookUpCodeObject(DataObject *DataP, diff --git a/pkgs/development/rocm-modules/rocm-comgr/default.nix b/pkgs/development/rocm-modules/10/rocm-comgr/default.nix similarity index 82% rename from pkgs/development/rocm-modules/rocm-comgr/default.nix rename to pkgs/development/rocm-modules/10/rocm-comgr/default.nix index e7663a1f7130a..fa6640d5c1f33 100644 --- a/pkgs/development/rocm-modules/rocm-comgr/default.nix +++ b/pkgs/development/rocm-modules/10/rocm-comgr/default.nix @@ -34,12 +34,12 @@ stdenv.mkDerivation (finalAttrs: { url = "https://github.com/GZGavinZhao/rocm-llvm-project/commit/7002dc04863d38c57cfd2e6fc60a1cf5a613fd8e.patch"; relative = "amd/comgr"; }) - # [Comgr] Extend ISA compatibility for CCOB - (fetchpatch { - hash = "sha256-/50I+PqxL3oaQMqg5vR7+ibUcXO1SvfXBdw/sybRt1o="; - url = "https://github.com/GZGavinZhao/rocm-llvm-project/commit/2c1e44fc3eacadcafdd4ada3e3184a092b6f26c5.patch"; - relative = "amd/comgr"; - }) + # [Comgr] Extend ISA compatibility for CCOB. + # Rebased from GZGavinZhao/rocm-llvm-project 2c1e44fc onto the LLVM 24 comgr + # (comgr-compiler.cpp's include block and unbundle() body moved). The + # OffloadBundler::GetBundleIDsInFile it calls is provided by the clang-side + # clang-add-getbundleidsinfile.diff in the llvm module. + ./comgr-isa-compat-ccob.patch # Fix: CCOB compat patch used coerced (featureless) name for output filename, # causing CLR's code_obj_map key to miss when looking up device ISA with features ./fix-ccob-compat-output-filename.patch @@ -55,7 +55,7 @@ stdenv.mkDerivation (finalAttrs: { + '' substituteInPlace src/comgr-env.cpp \ --replace-fail \ - 'return EnvLLVMPath;' \ + 'return EnvLLVMPath ? EnvLLVMPath : "";' \ 'return EnvLLVMPath ? EnvLLVMPath : "${llvm.rocm-toolchain}";' ''; diff --git a/pkgs/development/rocm-modules/rocm-comgr/fix-ccob-compat-output-filename.patch b/pkgs/development/rocm-modules/10/rocm-comgr/fix-ccob-compat-output-filename.patch similarity index 100% rename from pkgs/development/rocm-modules/rocm-comgr/fix-ccob-compat-output-filename.patch rename to pkgs/development/rocm-modules/10/rocm-comgr/fix-ccob-compat-output-filename.patch diff --git a/pkgs/development/rocm-modules/rocm-core/default.nix b/pkgs/development/rocm-modules/10/rocm-core/default.nix similarity index 81% rename from pkgs/development/rocm-modules/rocm-core/default.nix rename to pkgs/development/rocm-modules/10/rocm-core/default.nix index 861c6107935ee..d28c0668477bf 100644 --- a/pkgs/development/rocm-modules/rocm-core/default.nix +++ b/pkgs/development/rocm-modules/10/rocm-core/default.nix @@ -14,20 +14,22 @@ # only the last usage makes sense in nixpkgs let padIfSingle = s: if lib.stringLength s == 1 then "0${s}" else s; + # TheRock tags are two-component (therock-10.1); ROCm reports X.Y.Z. + rocmVersion = version: lib.versions.pad 3 version; in stdenv.mkDerivation (finalAttrs: { pname = "rocm-core"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocm-core" "shared" ]; - hash = "sha256-Y3WuDwruD5zKN2epwfUCZAGq5vgxCT27awJN8JxmOsY="; + hash = "sha256-3bEmFF4jivCslDINOTA5nIu1/nreGWZuIMYMxaUgd18="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocm-core"; @@ -37,13 +39,13 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake ]; env = { - ROCM_LIBPATCH_VERSION = "${lib.versions.major finalAttrs.version}${padIfSingle (lib.versions.minor finalAttrs.version)}${padIfSingle (lib.versions.patch finalAttrs.version)}"; + ROCM_LIBPATCH_VERSION = "${lib.versions.major (rocmVersion finalAttrs.version)}${padIfSingle (lib.versions.minor (rocmVersion finalAttrs.version))}${padIfSingle (lib.versions.patch (rocmVersion finalAttrs.version))}"; BUILD_ID = "nixpkgs-${finalAttrs.env.ROCM_LIBPATCH_VERSION}"; ROCM_BUILD_ID = "${finalAttrs.env.BUILD_ID}"; }; cmakeFlags = [ "-DROCM_LIBPATCH_VERSION=${finalAttrs.env.ROCM_LIBPATCH_VERSION}" - "-DROCM_VERSION=${finalAttrs.version}" + "-DROCM_VERSION=${rocmVersion finalAttrs.version}" "-DBUILD_ID=${finalAttrs.env.BUILD_ID}" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_LIBEXECDIR=libexec" @@ -52,7 +54,7 @@ stdenv.mkDerivation (finalAttrs: { ]; setupHook = writeText "setupHook.sh" '' - export ROCM_VERSION="${finalAttrs.version}" + export ROCM_VERSION="${rocmVersion finalAttrs.version}" export ROCM_LIBPATCH_VERSION="${finalAttrs.env.ROCM_LIBPATCH_VERSION}" export ROCM_BUILD_ID="${finalAttrs.env.ROCM_BUILD_ID}" ''; diff --git a/pkgs/development/rocm-modules/rocm-core/env-rocm-path.patch b/pkgs/development/rocm-modules/10/rocm-core/env-rocm-path.patch similarity index 100% rename from pkgs/development/rocm-modules/rocm-core/env-rocm-path.patch rename to pkgs/development/rocm-modules/10/rocm-core/env-rocm-path.patch diff --git a/pkgs/development/rocm-modules/rocm-device-libs/cmake.patch b/pkgs/development/rocm-modules/10/rocm-device-libs/cmake.patch similarity index 64% rename from pkgs/development/rocm-modules/rocm-device-libs/cmake.patch rename to pkgs/development/rocm-modules/10/rocm-device-libs/cmake.patch index 500ff37a99052..89160e66970e3 100644 --- a/pkgs/development/rocm-modules/rocm-device-libs/cmake.patch +++ b/pkgs/development/rocm-modules/10/rocm-device-libs/cmake.patch @@ -1,8 +1,6 @@ -diff --git a/cmake/Packages.cmake b/cmake/Packages.cmake -index 07c60eb..c736b3e 100644 ---- a/cmake/Packages.cmake -+++ b/cmake/Packages.cmake -@@ -12,24 +12,29 @@ set_target_properties(${target} PROPERTIES +--- a/cmake/Packages.cmake 2026-09-20 19:45:16.236395164 -0700 ++++ b/cmake/Packages.cmake 2026-09-20 19:45:16.252171984 -0700 +@@ -12,21 +12,25 @@ IMPORTED_LOCATION \"${target_path}\")") endforeach() configure_file(AMDDeviceLibsConfig.cmake.in @@ -10,20 +8,14 @@ index 07c60eb..c736b3e 100644 + lib/cmake/AMDDeviceLibs/AMDDeviceLibsConfig.cmake @ONLY) - - set(install_path_suffix "amdgcn/bitcode") - # Generate the install-tree package. --# We do not know the absolute path to the intall tree until we are installed, --# so we calculate it dynamically in AMD_DEVICE_LIBS_PREFIX_CODE and use --# relative paths in the target imports in AMD_DEVICE_LIBS_TARGET_CODE. + # We do not know the absolute path to the intall tree until we are installed, + # so we calculate it dynamically in AMD_DEVICE_LIBS_PREFIX_CODE and use + # relative paths in the target imports in AMD_DEVICE_LIBS_TARGET_CODE. -set(AMD_DEVICE_LIBS_PREFIX_CODE " +if(IS_ABSOLUTE "${CMAKE_INSTALL_PREFIX}") + set(AMD_DEVICE_LIBS_PREFIX_CODE "set(AMD_DEVICE_LIBS_PREFIX \"${CMAKE_INSTALL_PREFIX}\")") +else() -+ # We do not know the absolute path to the install tree until we are installed, -+ # so we calculate it dynamically in AMD_DEVICE_LIBS_PREFIX_CODE and use -+ # relative paths in the target imports in AMD_DEVICE_LIBS_TARGET_CODE. + set(AMD_DEVICE_LIBS_PREFIX_CODE " # Derive absolute install prefix from config file path. get_filename_component(AMD_DEVICE_LIBS_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)") @@ -37,7 +29,6 @@ index 07c60eb..c736b3e 100644 -endforeach() + endforeach() +endif() -+ set(AMD_DEVICE_LIBS_TARGET_CODE) foreach(target ${AMDGCN_LIB_LIST}) get_target_property(target_name ${target} ARCHIVE_OUTPUT_NAME) diff --git a/pkgs/development/rocm-modules/rocm-device-libs/default.nix b/pkgs/development/rocm-modules/10/rocm-device-libs/default.nix similarity index 100% rename from pkgs/development/rocm-modules/rocm-device-libs/default.nix rename to pkgs/development/rocm-modules/10/rocm-device-libs/default.nix diff --git a/pkgs/development/rocm-modules/rocm-runtime/default.nix b/pkgs/development/rocm-modules/10/rocm-runtime/default.nix similarity index 75% rename from pkgs/development/rocm-modules/rocm-runtime/default.nix rename to pkgs/development/rocm-modules/10/rocm-runtime/default.nix index 255fce0eb24ec..4bcecc40cd034 100644 --- a/pkgs/development/rocm-modules/rocm-runtime/default.nix +++ b/pkgs/development/rocm-modules/10/rocm-runtime/default.nix @@ -6,6 +6,7 @@ rocmUpdateScript, pkg-config, cmake, + python3, xxd, rocm-device-libs, rocprofiler-register, @@ -17,17 +18,17 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocm-runtime"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocr-runtime" "shared" ]; - hash = "sha256-hcyjOLMtoBX/p6r6R9Bl9635DuvI6rTn1KziHMeyYM0="; + hash = "sha256-fY6/ofaZe94ZK7An6bSHcLj0T92OCQCflnBk5onVzzo="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocr-runtime"; @@ -39,6 +40,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ pkg-config cmake + python3 # trap_handler/CMakeLists.txt: find_package(Python3 Interpreter) xxd # used by create_hsaco_ascii_file.sh llvm.rocm-toolchain ]; @@ -60,24 +62,12 @@ stdenv.mkDerivation (finalAttrs: { ]; patches = [ - # Vendored upstream PR for fix for segfault when queue allocation fails - # https://github.com/ROCm/rocm-systems/pull/2850 - ./queue-failure.patch (fetchpatch { # [PATCH] rocr: Extend HIP ISA compatibility check hash = "sha256-8r2Lb5lBfFaZC3knCxfXGcnkzNv6JxOKyJn2rD5gus4="; url = "https://github.com/GZGavinZhao/rocm-systems/commit/dcef23cf896f4dcbc7ed81abeaa4ec2208dcdd8c.patch"; relative = "projects/rocr-runtime"; }) - (fetchpatch { - # [PATCH] kfd_ioctl: fix UB due to 1 << 31 - url = "https://github.com/ROCm/ROCR-Runtime/commit/41bfc66aef437a5b349f71105fa4b907cc7e17d5.patch"; - hash = "sha256-A7VhPR3eSsmjq2cTBSjBIz9i//WiNjoXm0EsRKtF+ns="; - }) - # This causes a circular dependency, aqlprofile relies on hsa-runtime64 - # which is part of rocm-runtime - # Worked around by having rocprofiler load aqlprofile directly - ./remove-hsa-aqlprofile-dep.patch ]; postPatch = '' diff --git a/pkgs/development/rocm-modules/rocm-smi/default.nix b/pkgs/development/rocm-modules/10/rocm-smi/default.nix similarity index 94% rename from pkgs/development/rocm-modules/rocm-smi/default.nix rename to pkgs/development/rocm-modules/10/rocm-smi/default.nix index ad53094199161..35fc58c037bfa 100644 --- a/pkgs/development/rocm-modules/rocm-smi/default.nix +++ b/pkgs/development/rocm-modules/10/rocm-smi/default.nix @@ -11,17 +11,17 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocm-smi"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocm-smi-lib" "shared" ]; - hash = "sha256-Si8SbeVKUBtqk6h2QJ9ssQV68bLq6TvESrYXJuArHd8="; + hash = "sha256-t5yMLdDaylgdhreVzWBmhY5rFvNSGRs3v2bZcRQyqI0="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocm-smi-lib"; diff --git a/pkgs/development/rocm-modules/rocminfo/default.nix b/pkgs/development/rocm-modules/10/rocminfo/default.nix similarity index 90% rename from pkgs/development/rocm-modules/rocminfo/default.nix rename to pkgs/development/rocm-modules/10/rocminfo/default.nix index 1cfbe4ddc9b7e..2da6d54f403de 100644 --- a/pkgs/development/rocm-modules/rocminfo/default.nix +++ b/pkgs/development/rocm-modules/10/rocminfo/default.nix @@ -12,18 +12,18 @@ }: stdenv.mkDerivation (finalAttrs: { - version = "7.2.4"; + version = "10.1"; pname = "rocminfo"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocminfo" "shared" ]; - hash = "sha256-0esRBEXVibC2uzyonpc0ABNNHQ2NAWZrBmmg6p1zP0c="; + hash = "sha256-oK9fUtHb2qvFTpQ/9KE6LfiopDUvoreApZtsDb9aGvA="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocminfo"; diff --git a/pkgs/development/rocm-modules/rocmlir/default.nix b/pkgs/development/rocm-modules/10/rocmlir-triton/default.nix similarity index 60% rename from pkgs/development/rocm-modules/rocmlir/default.nix rename to pkgs/development/rocm-modules/10/rocmlir-triton/default.nix index 5881ec120eaf6..68fcfc3eece2d 100644 --- a/pkgs/development/rocm-modules/rocmlir/default.nix +++ b/pkgs/development/rocm-modules/10/rocmlir-triton/default.nix @@ -2,7 +2,6 @@ lib, stdenv, fetchFromGitHub, - rocmUpdateScript, cmake, rocm-cmake, clr, @@ -41,8 +40,8 @@ let throw "Unsupported ROCm LLVM platform"; in stdenv.mkDerivation (finalAttrs: { - pname = "rocmlir${suffix}"; - version = "7.2.4"; + pname = "rocmlir-triton${suffix}"; + version = "10.1"; outputs = [ "out" @@ -53,9 +52,11 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; - repo = "rocMLIR"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-1qADqYI5pilXHr/vrS9SvgmTW6KUWXNpG1G+brwD/HI="; + # Snapshot of release/rocm-rel-10.1, the branch required by MIGraphX 10.1. + # Update this revision together with MIGraphX; the repository has no release tags. + repo = "rocmlirTriton"; + rev = "f347064fea12aa0ab325e1244b65766652a2530c"; + hash = "sha256-w/eGFiXDfmY9Yog+U037mIG7wEQ9nD/m8z/2sErSuE8="; }; nativeBuildInputs = [ @@ -64,6 +65,9 @@ stdenv.mkDerivation (finalAttrs: { rocm-cmake python3Packages.python python3Packages.tomli + # mlir/lib/Dialect/Rock/utility/Bindings/CMakeLists.txt does find_package(pybind11); + # without this the (buildRockCompiler) configure fails. + python3Packages.pybind11 ]; buildInputs = [ @@ -81,9 +85,12 @@ stdenv.mkDerivation (finalAttrs: { ]; cmakeFlags = [ - (lib.cmakeFeature "LLVM_TARGETS_TO_BUILD" "AMDGPU${ - lib.optionalString (!buildRockCompiler) ";${llvmNativeTarget}" - }") + # The rock-compiler build must build the native (host) target too, not only + # AMDGPU: rocmlirTriton's librockcompiler_deps.cmake bundles the host codegen + # members (LLVMX86AsmParser/CodeGen/Desc/Disassembler/Info; Triton does host + # JIT) into the librockCompiler fat archive, so with LLVM_TARGETS_TO_BUILD=AMDGPU + # only the archive step fails with `No rule to make target '.../LLVMX86AsmParser'`. + (lib.cmakeFeature "LLVM_TARGETS_TO_BUILD" "AMDGPU;${llvmNativeTarget}") (lib.cmakeFeature "LLVM_USE_LINKER" "lld") (lib.cmakeFeature "LLVM_ENABLE_ZSTD" "FORCE_ON") (lib.cmakeFeature "LLVM_ENABLE_ZLIB" "FORCE_ON") @@ -100,6 +107,14 @@ stdenv.mkDerivation (finalAttrs: { ] ++ lib.optionals buildRockCompiler [ (lib.cmakeBool "LLVM_INCLUDE_TESTS" false) + # mlir/test declares the `check-rocmlir` lit suite with a DEPENDS on + # `ci-performance-scripts`, a target only created by mlir/utils/performance, + # which is gated behind MLIR_ENABLE_ROCM_RUNNER (= !buildRockCompiler, i.e. OFF + # here). With MLIR tests left ON, CMake's Generate step fails with `The + # dependency target "ci-performance-scripts" ... does not exist`. The + # rock-compiler build only needs librockCompiler, so turn MLIR tests off + # (LLVM_INCLUDE_TESTS above governs a different variable). + (lib.cmakeBool "MLIR_INCLUDE_TESTS" false) ] ++ lib.optionals (!buildRockCompiler) [ (lib.cmakeFeature "ROCM_TEST_CHIPSET" "gfx900") @@ -107,16 +122,21 @@ stdenv.mkDerivation (finalAttrs: { postPatch = '' patchShebangs mlir - patchShebangs external/llvm-project/mlir/lib/Dialect/GPU/AmdDeviceLibsIncGen.py - - # Fixes mlir/lib/Analysis/BufferDependencyAnalysis.cpp:41:19: error: redefinition of 'read' - substituteInPlace mlir/lib/Analysis/BufferDependencyAnalysis.cpp \ - --replace-fail "enum EffectType { read, write, unknown };" "enum class EffectType { read, write, unknown };" + patchShebangs external/llvm-project/mlir substituteInPlace mlir/utils/performance/common/CMakeLists.txt \ --replace-fail " PATHS /opt/rocm" "" ''; + # The source bundles Triton, whose external/triton/python/build_helpers.py + # symlinks the pinned in-tree LLVM into $TRITON_CACHE_PATH (= $HOME/.triton) at + # configure time. The sandbox HOME is the read-only /homeless-shelter, so give + # the build a writable HOME (and point TRITON_CACHE_PATH at it explicitly). + preConfigure = '' + export HOME="$(mktemp -d)" + export TRITON_CACHE_PATH="$HOME/.triton" + ''; + dontBuild = true; doCheck = true; @@ -146,14 +166,9 @@ stdenv.mkDerivation (finalAttrs: { patchelf --set-rpath $out/lib:$external/lib:${libPath} $out/{bin/*,lib/*.so*} ''; - passthru.updateScript = rocmUpdateScript { - inherit finalAttrs; - page = "tags"; - }; - meta = { - description = "MLIR-based convolution and GEMM kernel generator"; - homepage = "https://github.com/ROCm/rocMLIR"; + description = "Fork of rocMLIR, the MLIR-based convolution and GEMM kernel generator, used by MIGraphX"; + homepage = "https://github.com/ROCm/rocmlirTriton"; license = lib.licenses.asl20; teams = [ lib.teams.rocm ]; platforms = lib.platforms.linux; diff --git a/pkgs/development/rocm-modules/rocprim/default.nix b/pkgs/development/rocm-modules/10/rocprim/default.nix similarity index 94% rename from pkgs/development/rocm-modules/rocprim/default.nix rename to pkgs/development/rocm-modules/10/rocprim/default.nix index 577cbfb862014..07bf5ac9dcd27 100644 --- a/pkgs/development/rocm-modules/rocprim/default.nix +++ b/pkgs/development/rocm-modules/10/rocprim/default.nix @@ -15,7 +15,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocprim"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -30,12 +30,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocprim" "shared" ]; - hash = "sha256-e0mZ27OXyblcnXQGv2ex/CvWx9smw6nBbHZIijj7lP8="; + hash = "sha256-ObSLanTmi2Utv7kWM7hjnVzmNU2e4P23SB3+7Z3qO0o="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocprim"; diff --git a/pkgs/development/rocm-modules/rocprof-trace-decoder/default.nix b/pkgs/development/rocm-modules/10/rocprof-trace-decoder/default.nix similarity index 71% rename from pkgs/development/rocm-modules/rocprof-trace-decoder/default.nix rename to pkgs/development/rocm-modules/10/rocprof-trace-decoder/default.nix index 3ab1bb6446886..77eaa6dc1e31d 100644 --- a/pkgs/development/rocm-modules/rocprof-trace-decoder/default.nix +++ b/pkgs/development/rocm-modules/10/rocprof-trace-decoder/default.nix @@ -2,7 +2,8 @@ lib, stdenv, fetchFromGitHub, - rocmPackages, + rocm-comgr, + rocm-runtime, cmake, python3, nlohmann_json, @@ -11,39 +12,37 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocprof-trace-decoder"; - version = "0.1.7"; + version = "0.2.2"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - # No tags (yet?) - rev = "feeca99950c590e0b8228733405c4a1a10fa4773"; + # rocprof-trace-decoder keeps its own 0.x version, so the rocm-systems + # monorepo tag cannot be derived from finalAttrs.version like sibling packages. + rev = "therock-10.1"; sparseCheckout = [ "projects/rocprof-trace-decoder" "shared" ]; - hash = "sha256-aJhPiZf5380jj2IeCipgcTEQYogr5R19UnVwKRGnkxo="; + hash = "sha256-0cbkljtw/gZJwXPUpJuLXpQlXfR/MQgEGbLDsRdzpcw="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocprof-trace-decoder"; - patches = [ - ./use-system-dependencies.patch - # https://github.com/ROCm/rocm-systems/pull/3800 - ./fix-test-dependency.patch - ]; - strictDeps = true; nativeBuildInputs = [ cmake ]; buildInputs = [ - rocmPackages.rocm-comgr - rocmPackages.rocm-runtime + rocm-comgr + rocm-runtime ]; cmakeFlags = [ (lib.cmakeBool "BUILD_TESTS" finalAttrs.finalPackage.doCheck) + # The ATT integration tests need the pyelftools python module + # and bundled trace-data fixtures; keep the unit tests, skip integration. + (lib.cmakeBool "BUILD_INTEGRATION_TESTS" false) ]; nativeCheckInputs = [ diff --git a/pkgs/development/rocm-modules/rocprofiler-register/default.nix b/pkgs/development/rocm-modules/10/rocprofiler-register/default.nix similarity index 54% rename from pkgs/development/rocm-modules/rocprofiler-register/default.nix rename to pkgs/development/rocm-modules/10/rocprofiler-register/default.nix index 710985790d708..7effd89bd26fd 100644 --- a/pkgs/development/rocm-modules/rocprofiler-register/default.nix +++ b/pkgs/development/rocm-modules/10/rocprofiler-register/default.nix @@ -17,43 +17,20 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocprofiler-register"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocprofiler-register" "shared" ]; - hash = "sha256-XhxED3LHIjxBcSVyyEC3pgg0fyKyfKtHkF7umExSboM="; + hash = "sha256-/y+ZerbaSKyHfEttomNtmF5zccnpqsQFNw/5gjGBuyA="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocprofiler-register"; - patches = [ - (fetchpatch { - # [rocprofiler-sdk][rocprofiler-register] add CPackComponent - url = "https://github.com/ROCm/rocm-systems/commit/ef7253365c420ca486f074b9e9119a222e30fea0.patch"; - hash = "sha256-dwqvZ4AaTcOk2mSnxgHp/NbhjlD8W6KVz1H5ZF4i/Tw="; - relative = "projects/rocprofiler-register"; - }) - (fetchpatch { - # [rocprofiler-register] Fix compilation with system fmt/glog - url = "https://github.com/ROCm/rocm-systems/commit/c8ad2522083c6e00539ce5c1c22df766c20084fb.patch"; - hash = "sha256-VloRKV6kUzIfIInltx/bV1EM0FUfeQZrVAx6qgdsLyg="; - relative = "projects/rocprofiler-register"; - }) - (fetchpatch { - # fix(rocprofiler-sdk): include fmt/format.h instead of fmt/core.h for fmt::format - # fmt 12.2.0 changes the meaning of fmt/core.h so it no longer includes - # fmt::format, so this upstream commit switches to the correct header. - url = "https://github.com/ROCm/rocm-systems/commit/e2f588592ecfb0653ed5b3078753186325adf70a.patch"; - hash = "sha256-ip/s7tmUptcXMen3fyQJYKiZKwoe3SH0XqTVb0YBA7k="; - relative = "projects/rocprofiler-register"; - }) - ]; - nativeBuildInputs = [ cmake clang diff --git a/pkgs/development/rocm-modules/rocprofiler-sdk/default.nix b/pkgs/development/rocm-modules/10/rocprofiler-sdk/default.nix similarity index 53% rename from pkgs/development/rocm-modules/rocprofiler-sdk/default.nix rename to pkgs/development/rocm-modules/10/rocprofiler-sdk/default.nix index a93c5e93c4e3e..6da6fe8b92773 100644 --- a/pkgs/development/rocm-modules/rocprofiler-sdk/default.nix +++ b/pkgs/development/rocm-modules/10/rocprofiler-sdk/default.nix @@ -25,9 +25,7 @@ xz, numactl, fmt, - glog, gtest, - fetchpatch, yaml-cpp, elfio, nlohmann_json, @@ -46,7 +44,7 @@ # rocprofiler-sdk is the home of rocprofv3 stdenv.mkDerivation (finalAttrs: { pname = "rocprofiler-sdk"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -56,8 +54,8 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-7XCxu917Mgp3SQAKlTWj3ympgwOYW3aJFcOv/GhPk1c="; + tag = "therock-${finalAttrs.version}"; + hash = "sha256-UmYHC+87XIW+Z4WVd7k0MQ9baTvFlq/SgCt9Foy1mPI="; fetchSubmodules = true; sparseCheckout = [ "projects/rocprofiler-sdk" @@ -82,6 +80,9 @@ stdenv.mkDerivation (finalAttrs: { rocm-runtime rocprofiler-register aqlprofile + # rocprofiler-sdk-tool does find_package(rocprof-trace-decoder REQUIRED) at + # configure time for the ATT quick-scan feature. + rocprof-trace-decoder rocm-comgr libdrm elfutils @@ -92,7 +93,6 @@ stdenv.mkDerivation (finalAttrs: { xz numactl fmt - glog gtest yaml-cpp elfio @@ -102,70 +102,40 @@ stdenv.mkDerivation (finalAttrs: { ]; patches = [ - (fetchpatch { - # Fix missing amd_comgr linkage in pc-sampling integration test - url = "https://github.com/ROCm/rocm-systems/commit/94a4595a5d02bc066f7a32e1b2134a99a5231213.patch"; - hash = "sha256-86Fx0bKL0pvXTwVN8QJL+yzCbMYkmMaKzcU4PYcW6ig="; - relative = "projects/rocprofiler-sdk"; - }) - ] - ++ [ - # Just the missing CPackComponent reference sourced from this commit: - # https://github.com/ROCm/rocm-systems/commit/86ee7b2eb2273adaf1181ef9a6b2091465c6f0c7 - ./0001-fix-missing-CPackComponent-cmake-include.patch - ] - ++ [ - # Can be removed when a release contains the changes found in this pr: - # https://github.com/ROCm/rocm-systems/pull/4721 - ./0002-allow-using-system-yaml-dependency.patch - ./0003-allow-using-system-elfio-dependency.patch - ./0004-allow-using-system-otf2-dependency.patch - ./0005-allow-using-system-json-dependency.patch - ./0006-fix-amd-comgr-resolution.patch - ] - ++ [ - # Sourced from several commits that address issues with fmt, dropping conflicting changes no longer needed to build - # https://github.com/ROCm/rocm-systems/commit/36d9d33d90879bfbd406498011070ebd929a56b1 - # https://github.com/ROCm/rocm-systems/commit/e2f588592ecfb0653ed5b3078753186325adf70a - # https://github.com/ROCm/rocm-systems/commit/86ee7b2eb2273adaf1181ef9a6b2091465c6f0c7 (just the fmt changes) - ./0007-fix-missing-includes-and-api-changes-with-fmt-v12.2..patch - ] - ++ [ - # One new import failure added to source commit: - # https://github.com/ROCm/rocm-systems/pull/4721/changes/f7f24a54cbe55425fbefc87c7a3d0f4c85224948 - # which is also part of https://github.com/ROCm/rocm-systems/pull/4721 - ./0008-fix-compilation-errors-from-missing-includes.patch - ] - ++ [ - # Prevent a segfault on `import torch` (and other consumers that link - # librocprofiler-sdk for tracing) when OpenMP auto-discovers our - # ompt_start_tool before glog is initialized. Upstream incidentally fixes - # this by dropping glog in rocm-systems d80117889b3f - # "[rocprofiler-sdk] Migrate from glog to Abseil Logging (#4668)", which - # is too invasive (40 files + new abseil submodule) to backport. - ./0009-rocprofiler-sdk-guard-ompt-auto-start.patch + ./ompt-explicit-tool.patch ]; postPatch = '' - # NixOS' ROCm distribution does not support libomptarget yet - substituteInPlace samples/CMakeLists.txt \ - --replace-fail 'add_subdirectory(openmp_target)' '# add_subdirectory(openmp_target)' - substituteInPlace tests/CMakeLists.txt \ - --replace-fail 'add_subdirectory(openmp-tools)' '# add_subdirectory(openmp-tools)' - substituteInPlace tests/bin/CMakeLists.txt \ - --replace-fail 'add_subdirectory(openmp)' '# add_subdirectory(openmp)' - - # This requires building perfetto's trace-processor-shell via a weird external script - substituteInPlace tests/CMakeLists.txt \ - --replace-fail 'add_subdirectory(pytest-packages)' "" - - patchShebangs source/libexec/rocprofiler-sdk/rocprofiler-sdk-launch-compiler/rocprofiler-sdk-launch-compiler.sh + # NixOS' ROCm distribution does not support libomptarget yet + substituteInPlace samples/CMakeLists.txt \ + --replace-fail 'add_subdirectory(openmp_target)' '# add_subdirectory(openmp_target)' + substituteInPlace tests/CMakeLists.txt \ + --replace-fail 'add_subdirectory(openmp-tools)' '# add_subdirectory(openmp-tools)' + substituteInPlace tests/bin/CMakeLists.txt \ + --replace-fail 'add_subdirectory(openmp)' '# add_subdirectory(openmp)' + + # This requires building perfetto's trace-processor-shell via a weird external script + substituteInPlace tests/CMakeLists.txt \ + --replace-fail 'add_subdirectory(pytest-packages)' "" + + # The sources have bare system includes (`` in the output/sql + + # python-binding sources, `` in the vendored aqlprofile) + # that assume a distro-style /usr/include. nixpkgs keeps those headers in the + # packages' dev outputs, and the rocm-toolchain clang used here + # (-DCMAKE_CXX_COMPILER=clang++, unwrapped) ignores NIX_CFLAGS_COMPILE, so add + # them as a real CMake -isystem at the top of the tree. (A global + # -DCMAKE_CXX_FLAGS instead would clobber abseil's C++-standard detection.) + substituteInPlace CMakeLists.txt \ + --replace-fail 'add_subdirectory(external)' \ + 'include_directories(SYSTEM ${lib.getDev sqlite}/include ${lib.getDev libdrm}/include) + add_subdirectory(external)' + + patchShebangs source/libexec/rocprofiler-sdk/rocprofiler-sdk-launch-compiler/rocprofiler-sdk-launch-compiler.sh ''; cmakeFlags = [ (lib.cmakeBool "ROCPROFILER_BUILD_GHC_FS" false) (lib.cmakeBool "ROCPROFILER_BUILD_FMT" false) - (lib.cmakeBool "ROCPROFILER_BUILD_GLOG" false) (lib.cmakeBool "ROCPROFILER_BUILD_GTEST" false) (lib.cmakeBool "ROCPROFILER_BUILD_PYBIND11" false) (lib.cmakeBool "ROCPROFILER_BUILD_YAML_CPP" false) @@ -192,9 +162,6 @@ stdenv.mkDerivation (finalAttrs: { # building tests or samples. (lib.cmakeFeature "GPU_TARGETS" (lib.concatStringsSep ";" gpuTargets)) ]; - cxxCMakeFlags = [ - "-Wno-unused-variable" - ]; doCheck = false; # Requires GPU diff --git a/pkgs/development/rocm-modules/10/rocprofiler-sdk/ompt-explicit-tool.patch b/pkgs/development/rocm-modules/10/rocprofiler-sdk/ompt-explicit-tool.patch new file mode 100644 index 0000000000000..75f57e30e6e47 --- /dev/null +++ b/pkgs/development/rocm-modules/10/rocprofiler-sdk/ompt-explicit-tool.patch @@ -0,0 +1,76 @@ +Subject: [PATCH] Avoid unsolicited OMPT initialization + +OpenMP calls ompt_start_tool from its own initialization, which can run +inside a library constructor. Registering clients from there dlopens every +library that defines rocprofiler_configure; if one of them is still being +loaded (PyTorch's libtorch_cpu, for Kineto), glibc reruns pending +constructors and OpenBLAS reenters OpenMP initialization, which livelocks +on its init lock. Decline the tool unless one was requested through +ROCP_TOOL_LIBRARIES (as rocprofv3 does) or rocprofiler_force_configure. +Clients found by symbol still register when the HIP runtime starts; they +only miss OMPT callbacks. + +OpenMP queries ompt_start_tool only once, at startup, so attaching a +profiler to an already running process cannot enable OMPT tracing; the +other services are unaffected. + +--- a/source/lib/rocprofiler-sdk/ompt.cpp ++++ b/source/lib/rocprofiler-sdk/ompt.cpp +@@ -265,6 +265,9 @@ ompt_start_tool(unsigned int omp_version, const char* runtime_version) ROCPROFIL + ompt_start_tool_result_t* + ompt_start_tool(unsigned int omp_version, const char* runtime_version) + { ++ // Registering clients during OpenMP startup can reenter it (see above). ++ if(!::rocprofiler::registration::is_tool_requested()) return nullptr; ++ + ::rocprofiler::registration::init_logging(); + ::rocprofiler::registration::initialize(); + return rocprofiler_ompt_start_tool(omp_version, runtime_version); +--- a/source/lib/rocprofiler-sdk/registration.cpp ++++ b/source/lib/rocprofiler-sdk/registration.cpp +@@ -86,6 +86,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1039,6 +1040,16 @@ get_client_offset() + return _v; + } + ++static std::atomic forced_configure_requested{false}; ++ ++bool ++is_tool_requested() ++{ ++ if(forced_configure_requested.load(std::memory_order_acquire)) return true; ++ const auto* tools = secure_getenv("ROCP_TOOL_LIBRARIES"); ++ return tools && *tools; ++} ++ + int + get_init_status() + { +@@ -1235,6 +1246,8 @@ rocprofiler_force_configure(rocprofiler_configure_func_t configure_func) + + if(rocprofiler::registration::get_fini_status() != 0) return ROCPROFILER_STATUS_ERROR_FINALIZED; + ++ rocprofiler::registration::forced_configure_requested.store(true, std::memory_order_release); ++ + ROCP_INFO << "forcing rocprofiler configuration"; + + auto* forced_configs = rocprofiler::registration::get_forced_configures(); +--- a/source/lib/rocprofiler-sdk/registration.hpp ++++ b/source/lib/rocprofiler-sdk/registration.hpp +@@ -49,6 +49,9 @@ namespace registration + void + init_logging(); + ++bool ++is_tool_requested(); ++ + // initialize the clients + void + initialize(); diff --git a/pkgs/development/rocm-modules/rocprofiler/default.nix b/pkgs/development/rocm-modules/10/rocprofiler/default.nix similarity index 96% rename from pkgs/development/rocm-modules/rocprofiler/default.nix rename to pkgs/development/rocm-modules/10/rocprofiler/default.nix index 02500210e2d2b..358a2467e7975 100644 --- a/pkgs/development/rocm-modules/rocprofiler/default.nix +++ b/pkgs/development/rocm-modules/10/rocprofiler/default.nix @@ -44,18 +44,18 @@ let in stdenv.mkDerivation (finalAttrs: { pname = "rocprofiler"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocprofiler" "shared" ]; fetchSubmodules = true; - hash = "sha256-Wo0pymD8LsrdczdIUEEVe5x2Id//KIFkh40kliAQgWo="; + hash = "sha256-vKs+2TpbxmHZNmQK0WDRRKohUTpu/Zkc1V1b8V+lExk="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocprofiler"; diff --git a/pkgs/development/rocm-modules/rocr-debug-agent/default.nix b/pkgs/development/rocm-modules/10/rocr-debug-agent/default.nix similarity index 71% rename from pkgs/development/rocm-modules/rocr-debug-agent/default.nix rename to pkgs/development/rocm-modules/10/rocr-debug-agent/default.nix index a153ff75e2847..b134c42718a49 100644 --- a/pkgs/development/rocm-modules/rocr-debug-agent/default.nix +++ b/pkgs/development/rocm-modules/10/rocr-debug-agent/default.nix @@ -12,14 +12,20 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocr-debug-agent"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; - repo = "rocr_debug_agent"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-w2Zg4kpuKy68DkVGsBTUsjRZoV/Y/Z3Q8s0oSIR3Ask="; + # rocr_debug_agent lives in the rocm-systems monorepo since ROCm 10 + repo = "rocm-systems"; + tag = "therock-${finalAttrs.version}"; + sparseCheckout = [ + "projects/rocr-debug-agent" + "shared" + ]; + hash = "sha256-WpBG1ogF161EM3tgXnVGstyDBdCmTXQPUPnkZF1eF3A="; }; + sourceRoot = "${finalAttrs.src.name}/projects/rocr-debug-agent"; nativeBuildInputs = [ cmake diff --git a/pkgs/development/rocm-modules/rocrand/default.nix b/pkgs/development/rocm-modules/10/rocrand/default.nix similarity index 94% rename from pkgs/development/rocm-modules/rocrand/default.nix rename to pkgs/development/rocm-modules/10/rocrand/default.nix index cefff33fafd63..412b24ff7ce18 100644 --- a/pkgs/development/rocm-modules/rocrand/default.nix +++ b/pkgs/development/rocm-modules/10/rocrand/default.nix @@ -15,7 +15,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocrand${clr.gpuArchSuffix}"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -30,12 +30,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocrand" "shared" ]; - hash = "sha256-tl++h7LSEXf0jWe007+RIRwYHdB6TKPDpzipj1Emew8="; + hash = "sha256-vBNKXBOfBi+f9VaxZWaka/phgidi/lGOow+aSjBpy+4="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocrand"; diff --git a/pkgs/development/rocm-modules/rocshmem/default.nix b/pkgs/development/rocm-modules/10/rocshmem/default.nix similarity index 70% rename from pkgs/development/rocm-modules/rocshmem/default.nix rename to pkgs/development/rocm-modules/10/rocshmem/default.nix index 33c8f4cce5a46..c18d6c77da492 100644 --- a/pkgs/development/rocm-modules/rocshmem/default.nix +++ b/pkgs/development/rocm-modules/10/rocshmem/default.nix @@ -17,14 +17,20 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocshmem${clr.gpuArchSuffix}"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; - repo = "rocSHMEM"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-7TiUABwCVPvosoLdR8zN+QGiX+OD7iD+HKMLnGMmRYA="; + # rocSHMEM lives in the rocm-systems monorepo since ROCm 10 + repo = "rocm-systems"; + tag = "therock-${finalAttrs.version}"; + sparseCheckout = [ + "projects/rocshmem" + "shared" + ]; + hash = "sha256-uVUHYyJbaE5vauN1mczLf7rYNxRSD93eJDIDbzbYzHs="; }; + sourceRoot = "${finalAttrs.src.name}/projects/rocshmem"; nativeBuildInputs = [ cmake @@ -39,6 +45,15 @@ stdenv.mkDerivation (finalAttrs: { mpi ]; + # The device bitcode command does not see the HSA headers the host target gets. + postPatch = '' + substituteInPlace cmake/DeviceBitcode.cmake \ + --replace-fail \ + '-Xclang -mcode-object-version=none' \ + '-Xclang -mcode-object-version=none + -I${rocm-runtime}/include' + ''; + cmakeFlags = [ (lib.cmakeBool "CMAKE_POSITION_INDEPENDENT_CODE" true) (lib.cmakeFeature "CMAKE_CXX_COMPILER" "hipcc") diff --git a/pkgs/development/rocm-modules/rocsolver/default.nix b/pkgs/development/rocm-modules/10/rocsolver/default.nix similarity index 90% rename from pkgs/development/rocm-modules/rocsolver/default.nix rename to pkgs/development/rocm-modules/10/rocsolver/default.nix index a70d06e30efc7..d9c3a00ad3392 100644 --- a/pkgs/development/rocm-modules/rocsolver/default.nix +++ b/pkgs/development/rocm-modules/10/rocsolver/default.nix @@ -12,7 +12,8 @@ fmt, gtest, gfortran, - lapack-reference, + blas, + lapack, buildTests ? false, buildBenchmarks ? false, gpuTargets ? ( @@ -37,7 +38,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocsolver${clr.gpuArchSuffix}"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -52,12 +53,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocsolver" "shared" ]; - hash = "sha256-n+Y8RheA0UYeSfpvOw5zfwe4VAW5hsKjlCXtBceGhf0="; + hash = "sha256-hqCOQ5frigvHc21MBnjPJff6pQNm+JjzelwO8NR9dXo="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocsolver"; @@ -84,7 +85,10 @@ stdenv.mkDerivation (finalAttrs: { gtest ] ++ lib.optionals (buildTests || buildBenchmarks) [ - lapack-reference + # openblas-backed wrappers, not lapack-reference (avoids the ILP64 libblas.so.3 + # soname collision — see hipsolver). + blas + lapack ]; cmakeFlags = [ diff --git a/pkgs/development/rocm-modules/rocsparse/default.nix b/pkgs/development/rocm-modules/10/rocsparse/default.nix similarity index 97% rename from pkgs/development/rocm-modules/rocsparse/default.nix rename to pkgs/development/rocm-modules/10/rocsparse/default.nix index db7b0b156850a..a25210f1c7883 100644 --- a/pkgs/development/rocm-modules/rocsparse/default.nix +++ b/pkgs/development/rocm-modules/10/rocsparse/default.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocsparse${clr.gpuArchSuffix}"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -35,12 +35,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocsparse" "shared" ]; - hash = "sha256-hkfBTcLig39al2w8zFTSQQnouaou9wlD6VlvIyFTNMg="; + hash = "sha256-CdUH85q4ZwZh+1OwzOMvLhE0LSwkAl4RzBSjhY1xuGo="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocsparse"; diff --git a/pkgs/development/rocm-modules/rocsparse/deps.nix b/pkgs/development/rocm-modules/10/rocsparse/deps.nix similarity index 100% rename from pkgs/development/rocm-modules/rocsparse/deps.nix rename to pkgs/development/rocm-modules/10/rocsparse/deps.nix diff --git a/pkgs/development/rocm-modules/rocthrust/default.nix b/pkgs/development/rocm-modules/10/rocthrust/default.nix similarity index 93% rename from pkgs/development/rocm-modules/rocthrust/default.nix rename to pkgs/development/rocm-modules/10/rocthrust/default.nix index 653498cb85653..8e3febeddccc5 100644 --- a/pkgs/development/rocm-modules/rocthrust/default.nix +++ b/pkgs/development/rocm-modules/10/rocthrust/default.nix @@ -15,7 +15,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocthrust"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -30,12 +30,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocthrust" "shared" ]; - hash = "sha256-wHEgpmBZCYtvp+OyebrRyfoFz3WQyKWfHPrdzQVL8lY="; + hash = "sha256-VYIOMrJj+6fxuV3SkntYnPnCsyqAvLERlxrQQ5qzYJA="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocthrust"; diff --git a/pkgs/development/rocm-modules/roctracer/default.nix b/pkgs/development/rocm-modules/10/roctracer/default.nix similarity index 95% rename from pkgs/development/rocm-modules/roctracer/default.nix rename to pkgs/development/rocm-modules/10/roctracer/default.nix index 6cc979eb3648e..0fd5b25342c38 100644 --- a/pkgs/development/rocm-modules/roctracer/default.nix +++ b/pkgs/development/rocm-modules/10/roctracer/default.nix @@ -19,7 +19,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "roctracer"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -34,12 +34,12 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-systems"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/roctracer" "shared" ]; - hash = "sha256-Ps9b/MMdxXthGV96ZDg0kZGPdmn7Sy5if1a/Fjx2fEE="; + hash = "sha256-1pXWl8yUlfw5C3PFhrLxXPwHxscu1+AHx+lEqhl59vk="; }; sourceRoot = "${finalAttrs.src.name}/projects/roctracer"; diff --git a/pkgs/development/rocm-modules/rocwmma/default.nix b/pkgs/development/rocm-modules/10/rocwmma/default.nix similarity index 87% rename from pkgs/development/rocm-modules/rocwmma/default.nix rename to pkgs/development/rocm-modules/10/rocwmma/default.nix index 454cced2a0fdd..bf9c553de5115 100644 --- a/pkgs/development/rocm-modules/rocwmma/default.nix +++ b/pkgs/development/rocm-modules/10/rocwmma/default.nix @@ -5,7 +5,7 @@ rocmUpdateScript, cmake, rocm-cmake, - rocm-smi, + amdsmi, clr, openmp, gtest, @@ -19,7 +19,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "rocwmma"; - version = "7.2.4"; + version = "10.1"; outputs = [ "out" @@ -37,19 +37,15 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "projects/rocwmma" "shared" ]; - hash = "sha256-eoF8a7zknpgvDOSDzolOrdtszUJ5tC7Ur2sRShiQEO0="; + hash = "sha256-RvhZH4VVJLpj9ThF3MuvUPsAC7Y4BBTdIAReq7NyX3A="; }; sourceRoot = "${finalAttrs.src.name}/projects/rocwmma"; - patches = lib.optionals (buildTests || buildBenchmarks) [ - ./0000-dont-fetch-googletest.patch - ]; - nativeBuildInputs = [ cmake rocm-cmake @@ -60,7 +56,8 @@ stdenv.mkDerivation (finalAttrs: { openmp ] ++ lib.optionals (buildTests || buildBenchmarks) [ - rocm-smi + # rocWMMA's benchmark tests do find_package(amd_smi) + amdsmi gtest rocblas ]; @@ -74,6 +71,10 @@ stdenv.mkDerivation (finalAttrs: { "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_INCLUDEDIR=include" ] + ++ lib.optionals (buildTests || buildBenchmarks) [ + # Use nixpkgs gtest instead of the upstream FetchContent googletest download + "-DROCWMMA_USE_SYSTEM_GOOGLETEST=ON" + ] ++ lib.optionals (gpuTargets != [ ]) [ "-DGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" ] diff --git a/pkgs/development/rocm-modules/rpp/default.nix b/pkgs/development/rocm-modules/10/rpp/default.nix similarity index 53% rename from pkgs/development/rocm-modules/rpp/default.nix rename to pkgs/development/rocm-modules/10/rpp/default.nix index f43c630e470ed..00e00f47fca3e 100644 --- a/pkgs/development/rocm-modules/rpp/default.nix +++ b/pkgs/development/rocm-modules/10/rpp/default.nix @@ -19,14 +19,20 @@ stdenv.mkDerivation (finalAttrs: { pname = "rpp-${if useCPU then "cpu" else "hip"}"; - version = "7.2.4"; + version = "10.1"; src = fetchFromGitHub { owner = "ROCm"; - repo = "rpp"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-6e4JHKFC2dvtSGo9xbQKzIdUwlHB09pr5C/5xHwP3l4="; + # rpp lives in the rocm-libraries monorepo since ROCm 10 + repo = "rocm-libraries"; + tag = "therock-${finalAttrs.version}"; + sparseCheckout = [ + "projects/rpp" + "shared" + ]; + hash = "sha256-ZD3gzZhb1n5hSJ6nnYVksuoYEEy+wzaLbh02tMdv8dQ="; }; + sourceRoot = "${finalAttrs.src.name}/projects/rpp"; nativeBuildInputs = [ cmake @@ -55,11 +61,24 @@ stdenv.mkDerivation (finalAttrs: { "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" ]; - postPatch = lib.optionalString (!useCPU) '' - # Bad path - substituteInPlace CMakeLists.txt \ - --replace "COMPILER_FOR_HIP \''${ROCM_PATH}/llvm/bin/clang++" "COMPILER_FOR_HIP ${clr}/bin/hipcc" - ''; + # -fopenmp adds the toolchain include dir, which holds glibc's headers, as a + # plain -I; keep it a system dir so mm_malloc.h compiles with glibc >= 2.44. + env = lib.optionalAttrs useCPU { + CXXFLAGS = "-isystem ${stdenv.cc}/include"; + }; + + postPatch = + # api/rppdefs.h includes , so half must be a PUBLIC dependency. + '' + substituteInPlace CMakeLists.txt \ + --replace-fail 'set_target_properties(''${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)' \ + $'target_link_libraries(''${PROJECT_NAME} PUBLIC HALF::half)\nset_target_properties(''${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)' + '' + + lib.optionalString (!useCPU) '' + # Bad path + substituteInPlace CMakeLists.txt \ + --replace "COMPILER_FOR_HIP \''${ROCM_PATH}/llvm/bin/clang++" "COMPILER_FOR_HIP ${clr}/bin/hipcc" + ''; postBuild = lib.optionalString buildDocs '' python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en ../docs _build/html diff --git a/pkgs/development/rocm-modules/tensile/default.nix b/pkgs/development/rocm-modules/10/tensile/default.nix similarity index 94% rename from pkgs/development/rocm-modules/tensile/default.nix rename to pkgs/development/rocm-modules/10/tensile/default.nix index ee84ccc4eabe0..313729dee02df 100644 --- a/pkgs/development/rocm-modules/tensile/default.nix +++ b/pkgs/development/rocm-modules/10/tensile/default.nix @@ -18,18 +18,18 @@ buildPythonPackage (finalAttrs: { pname = "tensile"; - version = "7.2.4"; + version = "10.1"; pyproject = true; src = fetchFromGitHub { owner = "ROCm"; repo = "rocm-libraries"; - tag = "rocm-${finalAttrs.version}"; + tag = "therock-${finalAttrs.version}"; sparseCheckout = [ "shared/tensile" "shared" ]; - hash = "sha256-sYudPiEPGeZLmf6+3XfQDZqRXiKgRsGPucApzYwlGV8="; + hash = "sha256-OJPndaRrXoWsqrEFYRRhU8qnivb1zLigFQ2McWqMMDk="; }; sourceRoot = "${finalAttrs.src.name}/shared/tensile"; diff --git a/pkgs/development/rocm-modules/tensile/tensile-create-library-dont-copy-twice.diff b/pkgs/development/rocm-modules/10/tensile/tensile-create-library-dont-copy-twice.diff similarity index 100% rename from pkgs/development/rocm-modules/tensile/tensile-create-library-dont-copy-twice.diff rename to pkgs/development/rocm-modules/10/tensile/tensile-create-library-dont-copy-twice.diff diff --git a/pkgs/development/rocm-modules/tensile/tensile-solutionstructs-perf-fix.diff b/pkgs/development/rocm-modules/10/tensile/tensile-solutionstructs-perf-fix.diff similarity index 100% rename from pkgs/development/rocm-modules/tensile/tensile-solutionstructs-perf-fix.diff rename to pkgs/development/rocm-modules/10/tensile/tensile-solutionstructs-perf-fix.diff diff --git a/pkgs/development/rocm-modules/amdsmi/drm-struct-redefinition-fix.patch b/pkgs/development/rocm-modules/amdsmi/drm-struct-redefinition-fix.patch deleted file mode 100644 index caf23edcef57a..0000000000000 --- a/pkgs/development/rocm-modules/amdsmi/drm-struct-redefinition-fix.patch +++ /dev/null @@ -1,35 +0,0 @@ -From b8b4a6bcfe35ba9539a120cfd16573123ddd9241 Mon Sep 17 00:00:00 2001 -From: "Sv. Lockal" -Date: Mon, 15 Dec 2025 03:46:35 +0800 -Subject: [PATCH] Fix compilation with libdrm-2.4.130 - -Fix error: redefinition of 'struct drm_color_ctm_3x4'. - -drm_color_ctm_3x4 structure is now defined in https://github.com/torvalds/linux/commit/e5719e7f19009d4fbedf685fc22eec9cd8de154f#diff-4c51fb416ec7cc69566cd7b795ee57eb070aa1006ad65d6962081f039ffb2718 - -As this structure is unused and not a part of amdsmi public interface, -it is safe to remove it. ---- - include/amd_smi/impl/amdgpu_drm.h | 9 --------- - 1 file changed, 9 deletions(-) - -diff --git a/include/amd_smi/impl/amdgpu_drm.h b/include/amd_smi/impl/amdgpu_drm.h -index b56a5ac4b..0e483d13b 100644 ---- a/include/amd_smi/impl/amdgpu_drm.h -+++ b/include/amd_smi/impl/amdgpu_drm.h -@@ -1625,15 +1625,6 @@ struct drm_amdgpu_info_uq_metadata { - #define AMDGPU_FAMILY_GC_11_5_0 150 /* GC 11.5.0 */ - #define AMDGPU_FAMILY_GC_12_0_0 152 /* GC 12.0.0 */ - --/* FIXME wrong namespace! */ --struct drm_color_ctm_3x4 { -- /* -- * Conversion matrix with 3x4 dimensions in S31.32 sign-magnitude -- * (not two's complement!) format. -- */ -- __u64 matrix[12]; --}; -- - #if defined(__cplusplus) - } - #endif diff --git a/pkgs/development/rocm-modules/hipblaslt/Tensile-interning.patch b/pkgs/development/rocm-modules/hipblaslt/Tensile-interning.patch deleted file mode 100644 index acf44437520db..0000000000000 --- a/pkgs/development/rocm-modules/hipblaslt/Tensile-interning.patch +++ /dev/null @@ -1,181 +0,0 @@ -diff --git a/tensilelite/Tensile/Common/Utilities.py b/tensilelite/Tensile/Common/Utilities.py -index 0a9d9db5b3..cb9779eaac 100644 ---- a/tensilelite/Tensile/Common/Utilities.py -+++ b/tensilelite/Tensile/Common/Utilities.py -@@ -24,6 +24,7 @@ - - import functools - import math -+import operator - import os - import sys - import time -@@ -269,8 +270,20 @@ def state(obj): - - - def state_key_ordering(cls): -- def tup(obj): -- return tuple([getattr(obj, k) for k in cls.StateKeys]) -+ # Use operator.attrgetter for efficiency if __slots__ is defined -+ if hasattr(cls, '__slots__'): -+ # attrgetter is faster for slotted classes -+ getter = operator.attrgetter(*cls.StateKeys) -+ if len(cls.StateKeys) == 1: -+ # attrgetter returns scalar for single key, we need tuple -+ def tup(obj): -+ return (getter(obj),) -+ else: -+ tup = getter -+ else: -+ # Fallback for regular classes -+ def tup(obj): -+ return tuple([getattr(obj, k) for k in cls.StateKeys]) - - def lt(a, b): - return tup(a) < tup(b) -diff --git a/tensilelite/Tensile/Contractions.py b/tensilelite/Tensile/Contractions.py -index c0d4e851b1..3f2c2e98c6 100644 ---- a/tensilelite/Tensile/Contractions.py -+++ b/tensilelite/Tensile/Contractions.py -@@ -37,9 +37,60 @@ from Tensile.Toolchain.Component import Assembler - from math import ceil - - MIN_K_FOR_GSU = 32 -+ -+# Interning helpers to reduce memory usage by reusing identical objects -+_free_index_cache = {} -+def intern_free_index(isA, i=None, c=None, d=None, a=None, b=None): -+ key = (isA, i, c, d, a, b) -+ if key not in _free_index_cache: -+ obj = FreeIndex(isA, i, c, d) -+ obj.a = a -+ if b is not None: -+ obj.b = b -+ _free_index_cache[key] = obj -+ return _free_index_cache[key] -+ -+_batch_index_cache = {} -+def intern_batch_index(a=None, b=None, c=None, d=None): -+ key = (a, b, c, d) -+ if key not in _batch_index_cache: -+ obj = BatchIndex(c=c, d=d) -+ obj.a = a -+ obj.b = b -+ _batch_index_cache[key] = obj -+ return _batch_index_cache[key] -+ -+_bound_index_cache = {} -+def intern_bound_index(a=None, b=None, aMirror=False, bMirror=False): -+ key = (a, b, aMirror, bMirror) -+ if key not in _bound_index_cache: -+ obj = BoundIndex(aMirror=aMirror, bMirror=bMirror) -+ obj.a = a -+ obj.b = b -+ _bound_index_cache[key] = obj -+ return _bound_index_cache[key] -+ -+_size_mapping_cache = {} -+def intern_size_mapping(size_mapping): -+ """Intern a SizeMapping instance to reduce redundancy.""" -+ # Build hashable key from StateKeys, converting lists to tuples -+ key_parts = [] -+ for attr in size_mapping.StateKeys: -+ val = getattr(size_mapping, attr) -+ # Convert lists to tuples for hashing -+ if isinstance(val, list): -+ val = tuple(val) -+ key_parts.append(val) -+ key = tuple(key_parts) -+ -+ if key not in _size_mapping_cache: -+ _size_mapping_cache[key] = size_mapping -+ return _size_mapping_cache[key] -+ - @state_key_ordering - class FreeIndex: - StateKeys = ['isA', 'i', 'c', 'd'] -+ __slots__ = ['isA', 'i', 'c', 'd', 'a', 'b'] - - def __init__(self, isA, i=None, c=None, d=None): - self.isA = isA -@@ -50,6 +101,7 @@ class FreeIndex: - @state_key_ordering - class BatchIndex: - StateKeys = ['a', 'b', 'c', 'd'] -+ __slots__ = ['a', 'b', 'c', 'd'] - def __init__(self, a=None, b=None, c=None, d=None): - self.a = a - self.b = b -@@ -59,6 +111,7 @@ class BatchIndex: - @state_key_ordering - class BoundIndex: - StateKeys = ['a', 'b', 'aMirror', 'bMirror'] -+ __slots__ = ['a', 'b', 'aMirror', 'bMirror'] - def __init__(self, a=None, b=None, aMirror=False, bMirror=False): - self.a = a - self.b = b -@@ -107,6 +160,23 @@ class ProblemType: - for ib, ic in enumerate(d['IndexAssignmentsB']): - indices[ic].b = ib - -+ # Now intern all indices with their final state (including .a and .b) -+ for i, idx in enumerate(indices): -+ if isinstance(idx, FreeIndex): -+ indices[i] = intern_free_index(idx.isA, idx.i, idx.c, idx.d, -+ getattr(idx, 'a', None), getattr(idx, 'b', None)) -+ elif isinstance(idx, BatchIndex): -+ indices[i] = intern_batch_index(getattr(idx, 'a', None), getattr(idx, 'b', None), -+ idx.c, idx.d) -+ elif isinstance(idx, BoundIndex): -+ indices[i] = intern_bound_index(getattr(idx, 'a', None), getattr(idx, 'b', None), -+ idx.aMirror, idx.bMirror) -+ -+ # Update the lists with interned versions -+ freeIndices = [idx for idx in indices if isinstance(idx, FreeIndex)] -+ batchIndices = [idx for idx in indices if isinstance(idx, BatchIndex)] -+ boundIndices = [idx for idx in indices if isinstance(idx, BoundIndex)] -+ - for idx in indices: - assert idx is not None - idxState = state(idx) -@@ -596,6 +666,7 @@ class SizeMapping: - 'nonTemporalA', - 'nonTemporalB', - ] -+ __slots__ = StateKeys - - @classmethod - def FromOriginalState(cls, d): -@@ -751,7 +822,7 @@ class Solution: - info = cls.ReadOriginalInfo(d) - rv.libraryLogicIndex = int(info.get("SolutionIndex", -1)) - -- rv.sizeMapping = SizeMapping.FromOriginalState(d) -+ rv.sizeMapping = intern_size_mapping(SizeMapping.FromOriginalState(d)) - - rv.internalArgsSupport = InternalArgsSupport.FromOriginalState(d) - -diff --git a/tensilelite/Tensile/TensileCreateLibrary/Run.py b/tensilelite/Tensile/TensileCreateLibrary/Run.py -index 730b6b1fff..b0068563a0 100644 ---- a/tensilelite/Tensile/TensileCreateLibrary/Run.py -+++ b/tensilelite/Tensile/TensileCreateLibrary/Run.py -@@ -104,7 +104,6 @@ class KernelCodeGenResult(NamedTuple): - src: str - header: Optional[str] - name: str -- targetObjFilename: str - isa: IsaVersion - wavefrontSize: int - cuoccupancy: int -@@ -127,10 +126,9 @@ def processKernelSource(kernelWriterAssembly, data, splitGSU, kernel) -> KernelC - asmFilename = getKernelFileBase(splitGSU, kernel) - err, src = kernelWriter.getSourceFileString(kernel) - header = kernelWriter.getHeaderFileString(kernel) -- objFilename = kernel._state.get("codeObjectFile", None) - pgr = int(kernel["PrefetchGlobalRead"]) - return KernelCodeGenResult( -- err, src, header, asmFilename, objFilename, tuple(kernel["ISA"]), \ -+ err, src, header, asmFilename, tuple(kernel["ISA"]), \ - kernel["WavefrontSize"], kernel["CUOccupancy"], \ - pgr, kernel["MathClocksUnrolledLoop"] - ) diff --git a/pkgs/development/rocm-modules/hipblaslt/TensileCreateLibrary-refactor.patch b/pkgs/development/rocm-modules/hipblaslt/TensileCreateLibrary-refactor.patch deleted file mode 100644 index 1accf91426f46..0000000000000 --- a/pkgs/development/rocm-modules/hipblaslt/TensileCreateLibrary-refactor.patch +++ /dev/null @@ -1,849 +0,0 @@ -diff --git a/tensilelite/Tensile/Common/Parallel.py b/tensilelite/Tensile/Common/Parallel.py -index 1a2bf9e119..f46100c7b8 100644 ---- a/tensilelite/Tensile/Common/Parallel.py -+++ b/tensilelite/Tensile/Common/Parallel.py -@@ -22,43 +22,58 @@ - # - ################################################################################ - --import concurrent.futures --import itertools -+import multiprocessing - import os -+import re - import sys - import time -- --from joblib import Parallel, delayed -+from functools import partial -+from typing import Any, Callable - - from .Utilities import tqdm - - --def joblibParallelSupportsGenerator(): -- import joblib -- from packaging.version import Version -+def get_inherited_job_limit() -> int: -+ # 1. Check CMAKE_BUILD_PARALLEL_LEVEL (CMake 3.12+) -+ if 'CMAKE_BUILD_PARALLEL_LEVEL' in os.environ: -+ try: -+ return int(os.environ['CMAKE_BUILD_PARALLEL_LEVEL']) -+ except ValueError: -+ pass - -- joblibVer = joblib.__version__ -- return Version(joblibVer) >= Version("1.4.0") -+ # 2. Parse MAKEFLAGS for -jN -+ makeflags = os.environ.get('MAKEFLAGS', '') -+ match = re.search(r'-j\s*(\d+)', makeflags) -+ if match: -+ return int(match.group(1)) - -+ return -1 - --def CPUThreadCount(enable=True): -- from .GlobalParameters import globalParameters - -+def CPUThreadCount(enable=True): - if not enable: - return 1 -- else: -+ from .GlobalParameters import globalParameters -+ -+ # Priority order: -+ # 1. Inherited from build system (CMAKE_BUILD_PARALLEL_LEVEL or MAKEFLAGS) -+ # 2. Explicit --jobs flag -+ # 3. Auto-detect -+ inherited_limit = get_inherited_job_limit() -+ cpuThreads = inherited_limit if inherited_limit > 0 else globalParameters["CpuThreads"] -+ -+ if cpuThreads < 1: - if os.name == "nt": -- # Windows supports at most 61 workers because the scheduler uses -- # WaitForMultipleObjects directly, which has the limit (the limit -- # is actually 64, but some handles are needed for accounting). -- cpu_count = min(os.cpu_count(), 61) -+ cpuThreads = os.cpu_count() - else: -- cpu_count = len(os.sched_getaffinity(0)) -- cpuThreads = globalParameters["CpuThreads"] -- if cpuThreads == -1: -- return cpu_count -+ cpuThreads = len(os.sched_getaffinity(0)) - -- return min(cpu_count, cpuThreads) -+ if os.name == "nt": -+ # Windows supports at most 61 workers because the scheduler uses -+ # WaitForMultipleObjects directly, which has the limit (the limit -+ # is actually 64, but some handles are needed for accounting). -+ cpuThreads = min(cpuThreads, 61) -+ return max(1, cpuThreads) - - - def pcallWithGlobalParamsMultiArg(f, args, newGlobalParameters): -@@ -71,19 +86,22 @@ def pcallWithGlobalParamsSingleArg(f, arg, newGlobalParameters): - return f(arg) - - --def apply_print_exception(item, *args): -- # print(item, args) -+def OverwriteGlobalParameters(newGlobalParameters): -+ from . import GlobalParameters -+ -+ GlobalParameters.globalParameters.clear() -+ GlobalParameters.globalParameters.update(newGlobalParameters) -+ -+ -+def worker_function(args, function, multiArg): -+ """Worker function that executes in the pool process.""" - try: -- if len(args) > 0: -- func = item -- args = args[0] -- return func(*args) -+ if multiArg: -+ return function(*args) - else: -- func, item = item -- return func(item) -+ return function(args) - except Exception: - import traceback -- - traceback.print_exc() - raise - finally: -@@ -98,154 +116,121 @@ def OverwriteGlobalParameters(newGlobalParameters): - GlobalParameters.globalParameters.update(newGlobalParameters) - - --def ProcessingPool(enable=True, maxTasksPerChild=None): -- import multiprocessing -- import multiprocessing.dummy -- -- threadCount = CPUThreadCount() -- -- if (not enable) or threadCount <= 1: -- return multiprocessing.dummy.Pool(1) -- -- if multiprocessing.get_start_method() == "spawn": -- from . import GlobalParameters -- -- return multiprocessing.Pool( -- threadCount, -- initializer=OverwriteGlobalParameters, -- maxtasksperchild=maxTasksPerChild, -- initargs=(GlobalParameters.globalParameters,), -- ) -- else: -- return multiprocessing.Pool(threadCount, maxtasksperchild=maxTasksPerChild) -+def progress_logger(iterable, total, message, min_log_interval=5.0): -+ """ -+ Generator that wraps an iterable and logs progress with time-based throttling. - -+ Only logs progress if at least min_log_interval seconds have passed since last log. -+ Only prints completion message if task took >= min_log_interval seconds. - --def ParallelMap(function, objects, message="", enable=True, method=None, maxTasksPerChild=None): -+ Yields (index, item) tuples. - """ -- Generally equivalent to list(map(function, objects)), possibly executing in parallel. -- -- message: A message describing the operation to be performed. -- enable: May be set to false to disable parallelism. -- method: A function which can fetch the mapping function from a processing pool object. -- Leave blank to use .map(), other possiblities: -- - `lambda x: x.starmap` - useful if `function` takes multiple parameters. -- - `lambda x: x.imap` - lazy evaluation -- - `lambda x: x.imap_unordered` - lazy evaluation, does not preserve order of return value. -- """ -- from .GlobalParameters import globalParameters -+ start_time = time.time() -+ last_log_time = start_time -+ log_interval = 1 + (total // 100) - -- threadCount = CPUThreadCount(enable) -- pool = ProcessingPool(enable, maxTasksPerChild) -- -- if threadCount <= 1 and globalParameters["ShowProgressBar"]: -- # Provide a progress bar for single-threaded operation. -- # This works for method=None, and for starmap. -- mapFunc = map -- if method is not None: -- # itertools provides starmap which can fill in for pool.starmap. It provides imap on Python 2.7. -- # If this works, we will use it, otherwise we will fallback to the "dummy" pool for single threaded -- # operation. -- try: -- mapFunc = method(itertools) -- except NameError: -- mapFunc = None -- -- if mapFunc is not None: -- return list(mapFunc(function, tqdm(objects, message))) -- -- mapFunc = pool.map -- if method: -- mapFunc = method(pool) -- -- objects = zip(itertools.repeat(function), objects) -- function = apply_print_exception -- -- countMessage = "" -- try: -- countMessage = " for {} tasks".format(len(objects)) -- except TypeError: -- pass -+ for idx, item in enumerate(iterable): -+ if idx % log_interval == 0: -+ current_time = time.time() -+ if (current_time - last_log_time) >= min_log_interval: -+ print(f"{message}\t{idx+1: 5d}/{total: 5d}") -+ last_log_time = current_time -+ yield idx, item - -- if message != "": -- message += ": " -+ elapsed = time.time() - start_time -+ final_idx = idx + 1 if 'idx' in locals() else 0 - -- print("{0}Launching {1} threads{2}...".format(message, threadCount, countMessage)) -- sys.stdout.flush() -- currentTime = time.time() -- rv = mapFunc(function, objects) -- totalTime = time.time() - currentTime -- print("{0}Done. ({1:.1f} secs elapsed)".format(message, totalTime)) -- sys.stdout.flush() -- pool.close() -- return rv -+ if elapsed >= min_log_interval or last_log_time > start_time: -+ print(f"{message} done in {elapsed:.1f}s!\t{final_idx: 5d}/{total: 5d}") - - --def ParallelMapReturnAsGenerator(function, objects, message="", enable=True, multiArg=True): -- from .GlobalParameters import globalParameters -+def imap_with_progress(pool, func, iterable, total, message, chunksize): -+ results = [] -+ for _, result in progress_logger(pool.imap(func, iterable, chunksize=chunksize), total, message): -+ results.append(result) -+ return results - -- threadCount = CPUThreadCount(enable) -- print("{0}Launching {1} threads...".format(message, threadCount)) - -- if threadCount <= 1 and globalParameters["ShowProgressBar"]: -- # Provide a progress bar for single-threaded operation. -- callFunc = lambda args: function(*args) if multiArg else lambda args: function(args) -- return [callFunc(args) for args in tqdm(objects, message)] -+def _ParallelMap_generator(worker, objects, objLen, message, chunksize, threadCount, globalParameters, maxtasksperchild): -+ # separate fn because yield makes the entire fn a generator even if unreachable -+ ctx = multiprocessing.get_context('forkserver' if os.name != 'nt' else 'spawn') - -- with concurrent.futures.ProcessPoolExecutor(max_workers=threadCount) as executor: -- resultFutures = (executor.submit(function, *arg if multiArg else arg) for arg in objects) -- for result in concurrent.futures.as_completed(resultFutures): -- yield result.result() -+ with ctx.Pool(processes=threadCount, maxtasksperchild=maxtasksperchild, -+ initializer=OverwriteGlobalParameters, initargs=(globalParameters,)) as pool: -+ for _, result in progress_logger(pool.imap_unordered(worker, objects, chunksize=chunksize), objLen, message): -+ yield result - - - def ParallelMap2( -- function, objects, message="", enable=True, multiArg=True, return_as="list", procs=None -+ function: Callable, -+ objects: Any, -+ message: str = "", -+ enable: bool = True, -+ multiArg: bool = True, -+ minChunkSize: int = 1, -+ maxWorkers: int = -1, -+ maxtasksperchild: int = 1024, -+ return_as: str = "list" - ): -+ """Executes a function over a list of objects in parallel or sequentially. -+ -+ This function is generally equivalent to ``list(map(function, objects))``. However, it provides -+ additional functionality to run in parallel, depending on the 'enable' flag and available CPU -+ threads. -+ -+ Args: -+ function: The function to apply to each item in 'objects'. If 'multiArg' is True, 'function' -+ should accept multiple arguments. -+ objects: An iterable of objects to be processed by 'function'. If 'multiArg' is True, each -+ item in 'objects' should be an iterable of arguments for 'function'. -+ message: Optional; a message describing the operation. Default is an empty string. -+ enable: Optional; if False, disables parallel execution and runs sequentially. Default is True. -+ multiArg: Optional; if True, treats each item in 'objects' as multiple arguments for -+ 'function'. Default is True. -+ return_as: Optional; "list" (default) or "generator_unordered" for streaming results -+ -+ Returns: -+ A list or generator containing the results of applying **function** to each item in **objects**. - """ -- Generally equivalent to list(map(function, objects)), possibly executing in parallel. -+ from .GlobalParameters import globalParameters - -- message: A message describing the operation to be performed. -- enable: May be set to false to disable parallelism. -- multiArg: True if objects represent multiple arguments -- (differentiates multi args vs single collection arg) -- """ -- if return_as in ("generator", "generator_unordered") and not joblibParallelSupportsGenerator(): -- return ParallelMapReturnAsGenerator(function, objects, message, enable, multiArg) -+ threadCount = CPUThreadCount(enable) - -- from .GlobalParameters import globalParameters -+ if not hasattr(objects, "__len__"): -+ objects = list(objects) - -- threadCount = procs if procs else CPUThreadCount(enable) -+ objLen = len(objects) -+ if objLen == 0: -+ return [] if return_as == "list" else iter([]) - -- threadCount = CPUThreadCount(enable) -+ f = (lambda x: function(*x)) if multiArg else function -+ if objLen == 1: -+ print(f"{message}: (1 task)") -+ result = [f(x) for x in objects] -+ return result if return_as == "list" else iter(result) - -- if threadCount <= 1 and globalParameters["ShowProgressBar"]: -- # Provide a progress bar for single-threaded operation. -- return [function(*args) if multiArg else function(args) for args in tqdm(objects, message)] -+ extra_message = ( -+ f": {threadCount} thread(s)" + f", {objLen} tasks" -+ if objLen -+ else "" -+ ) - -- countMessage = "" -- try: -- countMessage = " for {} tasks".format(len(objects)) -- except TypeError: -- pass -- -- if message != "": -- message += ": " -- print("{0}Launching {1} threads{2}...".format(message, threadCount, countMessage)) -- sys.stdout.flush() -- currentTime = time.time() -- -- pcall = pcallWithGlobalParamsMultiArg if multiArg else pcallWithGlobalParamsSingleArg -- pargs = zip(objects, itertools.repeat(globalParameters)) -- -- if joblibParallelSupportsGenerator(): -- rv = Parallel(n_jobs=threadCount, timeout=99999, return_as=return_as)( -- delayed(pcall)(function, a, params) for a, params in pargs -- ) -+ print(f"ParallelMap {message}{extra_message}") -+ -+ if threadCount <= 1: -+ result = [f(x) for x in objects] -+ return result if return_as == "list" else iter(result) -+ -+ if maxWorkers > 0: -+ threadCount = min(maxWorkers, threadCount) -+ -+ chunksize = max(minChunkSize, objLen // 2000) -+ worker = partial(worker_function, function=function, multiArg=multiArg) -+ if return_as == "generator_unordered": -+ # yield results as they complete without buffering -+ return _ParallelMap_generator(worker, objects, objLen, message, chunksize, threadCount, globalParameters, maxtasksperchild) - else: -- rv = Parallel(n_jobs=threadCount, timeout=99999)( -- delayed(pcall)(function, a, params) for a, params in pargs -- ) -- -- totalTime = time.time() - currentTime -- print("{0}Done. ({1:.1f} secs elapsed)".format(message, totalTime)) -- sys.stdout.flush() -- return rv -+ ctx = multiprocessing.get_context('forkserver' if os.name != 'nt' else 'spawn') -+ with ctx.Pool(processes=threadCount, maxtasksperchild=maxtasksperchild, -+ initializer=OverwriteGlobalParameters, initargs=(globalParameters,)) as pool: -+ return list(imap_with_progress(pool, worker, objects, objLen, message, chunksize)) -diff --git a/tensilelite/Tensile/CustomKernels.py b/tensilelite/Tensile/CustomKernels.py -index ffceb636f5..127b3386a1 100644 ---- a/tensilelite/Tensile/CustomKernels.py -+++ b/tensilelite/Tensile/CustomKernels.py -@@ -24,7 +24,9 @@ - - from . import CUSTOM_KERNEL_PATH - from Tensile.Common.ValidParameters import checkParametersAreValid, validParameters, newMIValidParameters -+from Tensile.CustomYamlLoader import DEFAULT_YAML_LOADER - -+from functools import lru_cache - import yaml - - import os -@@ -58,10 +60,13 @@ def getCustomKernelConfigAndAssembly(name, directory=CUSTOM_KERNEL_PATH): - - return (config, assembly) - -+# getCustomKernelConfig will get called repeatedly on the same file -+# 20x logic loading speedup for aquavanjaram_Cijk_Ailk_Bljk_F8NH_HHS_BH_Bias_HAS_SAB_SAV_freesize_custom_GSUs -+@lru_cache - def readCustomKernelConfig(name, directory=CUSTOM_KERNEL_PATH): - rawConfig, _ = getCustomKernelConfigAndAssembly(name, directory) - try: -- return yaml.safe_load(rawConfig)["custom.config"] -+ return yaml.load(rawConfig, Loader=DEFAULT_YAML_LOADER)["custom.config"] - except yaml.scanner.ScannerError as e: - raise RuntimeError("Failed to read configuration for custom kernel: {0}\nDetails:\n{1}".format(name, e)) - -diff --git a/tensilelite/Tensile/CustomYamlLoader.py b/tensilelite/Tensile/CustomYamlLoader.py -index e03f456fbe..ed7510f2ce 100644 ---- a/tensilelite/Tensile/CustomYamlLoader.py -+++ b/tensilelite/Tensile/CustomYamlLoader.py -@@ -1,6 +1,7 @@ - # Copyright © Advanced Micro Devices, Inc., or its affiliates. - # SPDX-License-Identifier: MIT - -+import sys - import yaml - from pathlib import Path - -@@ -70,7 +71,7 @@ def parse_scalar(loader: yaml.Loader): - elif is_float(value_lower): - return float(value_lower) - -- return value -+ return sys.intern(value) - - def load_yaml_stream(yaml_path: Path, loader_type: yaml.Loader): - with open(yaml_path, 'r') as f: -diff --git a/tensilelite/Tensile/TensileCreateLibrary/Run.py b/tensilelite/Tensile/TensileCreateLibrary/Run.py -index 22d19851a3..348068b3bf 100644 ---- a/tensilelite/Tensile/TensileCreateLibrary/Run.py -+++ b/tensilelite/Tensile/TensileCreateLibrary/Run.py -@@ -26,8 +26,10 @@ import rocisa - - import functools - import glob -+import gc - import itertools - import os -+import resource - import shutil - from pathlib import Path - from timeit import default_timer as timer -@@ -78,6 +80,25 @@ from Tensile.Utilities.Decorators.Timing import timing - from .ParseArguments import parseArguments - - -+def getMemoryUsage(): -+ """Get peak and current memory usage in MB.""" -+ rusage = resource.getrusage(resource.RUSAGE_SELF) -+ peak_memory_mb = rusage.ru_maxrss / 1024 # KB to MB on Linux -+ -+ # Get current memory from /proc/self/status -+ current_memory_mb = 0 -+ try: -+ with open('/proc/self/status') as f: -+ for line in f: -+ if line.startswith('VmRSS:'): -+ current_memory_mb = int(line.split()[1]) / 1024 # KB to MB -+ break -+ except: -+ current_memory_mb = peak_memory_mb # Fallback -+ -+ return (peak_memory_mb, current_memory_mb) -+ -+ - class KernelCodeGenResult(NamedTuple): - err: int - src: str -@@ -115,6 +136,29 @@ def processKernelSource(kernelWriterAssembly, data, outOptions, splitGSU, kernel - ) - - -+def processAndAssembleKernelTCL(kernelWriterAssembly, rocisa_data, outOptions, splitGSU, kernel, assemblyTmpPath, assembler): -+ """ -+ Pipeline function for TCL mode that: -+ 1. Generates kernel source -+ 2. Writes .s file to disk -+ 3. Assembles to .o file -+ 4. Deletes .s file -+ """ -+ result = processKernelSource(kernelWriterAssembly, rocisa_data, outOptions, splitGSU, kernel) -+ return writeAndAssembleKernel(result, assemblyTmpPath, assembler) -+ -+ -+def writeMasterSolutionLibrary(name_lib_tuple, newLibraryDir, splitGSU, libraryFormat): -+ """ -+ Write a master solution library to disk. -+ Module-level function to support multiprocessing. -+ """ -+ name, lib = name_lib_tuple -+ filename = os.path.join(newLibraryDir, name) -+ lib.applyNaming(splitGSU) -+ LibraryIO.write(filename, state(lib), libraryFormat) -+ -+ - def removeInvalidSolutionsAndKernels(results, kernels, solutions, errorTolerant, printLevel: bool, splitGSU: bool): - removeKernels = [] - removeKernelNames = [] -@@ -189,6 +233,24 @@ def writeAssembly(asmPath: Union[Path, str], result: KernelCodeGenResult): - return path, isa, wfsize, minResult - - -+def writeAndAssembleKernel(result: KernelCodeGenResult, asmPath: Union[Path, str], assembler): -+ """Write assembly file and immediately assemble it to .o file""" -+ if result.err: -+ printExit(f"Failed to build kernel {result.name} because it has error code {result.err}") -+ -+ path = Path(asmPath) / f"{result.name}.s" -+ with open(path, "w", encoding="utf-8") as f: -+ f.write(result.src) -+ -+ # Assemble .s -> .o -+ assembler(isaToGfx(result.isa), result.wavefrontSize, str(path), str(path.with_suffix(".o"))) -+ -+ # Delete assembly file immediately to save disk space -+ path.unlink() -+ -+ return KernelMinResult(result.err, result.cuoccupancy, result.pgr, result.mathclk) -+ -+ - def writeHelpers( - outputPath, kernelHelperObjs, KERNEL_HELPER_FILENAME_CPP, KERNEL_HELPER_FILENAME_H - ): -@@ -272,14 +334,15 @@ def writeSolutionsAndKernels( - numAsmKernels = len(asmKernels) - numKernels = len(asmKernels) - assert numKernels == numAsmKernels, "Only assembly kernels are supported in TensileLite" -- asmIter = zip( -- itertools.repeat(kernelWriterAssembly), -- itertools.repeat(rocisa.rocIsa.getInstance().getData()), -- itertools.repeat(outOptions), -- itertools.repeat(splitGSU), -- asmKernels -+ -+ processKernelFn = functools.partial( -+ processKernelSource, -+ kernelWriterAssembly=kernelWriterAssembly, -+ data=rocisa.rocIsa.getInstance().getData(), -+ outOptions=outOptions, -+ splitGSU=splitGSU - ) -- asmResults = ParallelMap2(processKernelSource, asmIter, "Generating assembly kernels", return_as="list") -+ asmResults = ParallelMap2(processKernelFn, asmKernels, "Generating assembly kernels", return_as="list", multiArg=False) - removeInvalidSolutionsAndKernels( - asmResults, asmKernels, solutions, errorTolerant, getVerbosity(), splitGSU - ) -@@ -287,19 +350,21 @@ def writeSolutionsAndKernels( - asmResults, asmKernels, solutions, splitGSU - ) - -- def assemble(ret): -- p, isa, wavefrontsize, _ = ret -- asmToolchain.assembler(isaToGfx(isa), wavefrontsize, str(p), str(p.with_suffix(".o"))) -- -- unaryWriteAssembly = functools.partial(writeAssembly, assemblyTmpPath) -- compose = lambda *F: functools.reduce(lambda f, g: lambda x: f(g(x)), F) -+ # Use functools.partial to bind assemblyTmpPath and assembler -+ writeAndAssembleFn = functools.partial( -+ writeAndAssembleKernel, -+ asmPath=assemblyTmpPath, -+ assembler=asmToolchain.assembler -+ ) - ret = ParallelMap2( -- compose(assemble, unaryWriteAssembly), -+ writeAndAssembleFn, - asmResults, - "Writing assembly kernels", - return_as="list", - multiArg=False, - ) -+ del asmResults -+ gc.collect() - - writeHelpers(outputPath, kernelHelperObjs, KERNEL_HELPER_FILENAME_CPP, KERNEL_HELPER_FILENAME_H) - srcKernelFile = Path(outputPath) / "Kernels.cpp" -@@ -376,40 +441,35 @@ def writeSolutionsAndKernelsTCL( - - uniqueAsmKernels = [k for k in asmKernels if not k.duplicate] - -- def assemble(ret, removeTemporaries: bool): -- asmPath, isa, wavefrontsize, result = ret -- asmToolchain.assembler(isaToGfx(isa), wavefrontsize, str(asmPath), str(asmPath.with_suffix(".o"))) -- if removeTemporaries: -- asmPath.unlink() -- return result -- -- unaryAssemble = functools.partial(assemble, removeTemporaries=removeTemporaries) -- - outOptions = rocisa.rocIsa.getInstance().getOutputOptions() - outOptions.outputNoComment = not disableAsmComments - -- unaryProcessKernelSource = functools.partial( -- processKernelSource, -+ processKernelFn = functools.partial( -+ processAndAssembleKernelTCL, - kernelWriterAssembly, - rocisa.rocIsa.getInstance().getData(), - outOptions, - splitGSU, -+ assemblyTmpPath=assemblyTmpPath, -+ assembler=asmToolchain.assembler - ) - -- unaryWriteAssembly = functools.partial(writeAssembly, assemblyTmpPath) -- compose = lambda *F: functools.reduce(lambda f, g: lambda x: f(g(x)), F) -- ret = ParallelMap2( -- compose(unaryAssemble, unaryWriteAssembly, unaryProcessKernelSource), -+ results = ParallelMap2( -+ processKernelFn, - uniqueAsmKernels, - "Generating assembly kernels", - multiArg=False, - return_as="list" - ) -+ del processKernelFn -+ gc.collect() -+ - passPostKernelInfoToSolution( -- ret, uniqueAsmKernels, solutions, splitGSU -+ results, uniqueAsmKernels, solutions, splitGSU - ) -- # result.src is very large so let garbage collector know to clean up -- del ret -+ del results -+ gc.collect() -+ - buildAssemblyCodeObjectFiles( - asmToolchain.linker, - asmToolchain.bundler, -@@ -508,6 +568,15 @@ def generateKernelHelperObjects(solutions: List[Solution], cxxCompiler: str, isa - return sorted(khos, key=sortByEnum, reverse=True) # Ensure that we write Enum kernel helpers are first in list - - -+def libraryIter(lib: MasterSolutionLibrary): -+ if len(lib.solutions): -+ for i, s in enumerate(lib.solutions.items()): -+ yield (i, *s) -+ else: -+ for _, lazyLib in lib.lazyLibraries.items(): -+ yield from libraryIter(lazyLib) -+ -+ - @timing - def generateLogicDataAndSolutions(logicFiles, args, assembler: Assembler, isaInfoMap): - -@@ -523,26 +592,23 @@ def generateLogicDataAndSolutions(logicFiles, args, assembler: Assembler, isaInf - printSolutionRejectionReason = True - printIndexAssignmentInfo = False - -- fIter = zip( -- logicFiles, -- itertools.repeat(assembler), -- itertools.repeat(splitGSU), -- itertools.repeat(printSolutionRejectionReason), -- itertools.repeat(printIndexAssignmentInfo), -- itertools.repeat(isaInfoMap), -- itertools.repeat(args["LazyLibraryLoading"]), -+ parseLogicFn = functools.partial( -+ LibraryIO.parseLibraryLogicFile, -+ assembler=assembler, -+ splitGSU=splitGSU, -+ printSolutionRejectionReason=printSolutionRejectionReason, -+ printIndexAssignmentInfo=printIndexAssignmentInfo, -+ isaInfoMap=isaInfoMap, -+ lazyLibraryLoading=args["LazyLibraryLoading"] - ) - -- def libraryIter(lib: MasterSolutionLibrary): -- if len(lib.solutions): -- for i, s in enumerate(lib.solutions.items()): -- yield (i, *s) -- else: -- for _, lazyLib in lib.lazyLibraries.items(): -- yield from libraryIter(lazyLib) -- - for library in ParallelMap2( -- LibraryIO.parseLibraryLogicFile, fIter, "Loading Logics...", return_as="generator_unordered" -+ parseLogicFn, logicFiles, "Loading Logics...", -+ return_as="generator_unordered", -+ minChunkSize=24, -+ maxWorkers=32, -+ maxtasksperchild=1, -+ multiArg=False, - ): - _, architectureName, _, _, _, newLibrary = library - -@@ -554,6 +620,9 @@ def generateLogicDataAndSolutions(logicFiles, args, assembler: Assembler, isaInf - else: - masterLibraries[architectureName] = newLibrary - masterLibraries[architectureName].version = args["CodeObjectVersion"] -+ del library, newLibrary -+ -+ gc.collect() - - # Sort masterLibraries to make global soln index values deterministic - solnReIndex = 0 -@@ -751,6 +820,9 @@ def run(): - ) - stop_wsk = timer() - print(f"Time to generate kernels (s): {(stop_wsk-start_wsk):3.2f}") -+ numKernelHelperObjs = len(kernelHelperObjs) -+ del kernelWriterAssembly, kernelHelperObjs -+ gc.collect() - - archs = [ # is this really different than the other archs above? - isaToGfx(arch) -@@ -768,13 +840,10 @@ def run(): - if kName not in solDict: - solDict["%s"%kName] = kernel - -- def writeMsl(name, lib): -- filename = os.path.join(newLibraryDir, name) -- lib.applyNaming(splitGSU) -- LibraryIO.write(filename, state(lib), arguments["LibraryFormat"]) -- - filename = os.path.join(newLibraryDir, "TensileLiteLibrary_lazy_Mapping") - LibraryIO.write(filename, libraryMapping, "msgpack") -+ del libraryMapping -+ gc.collect() - - start_msl = timer() - for archName, newMasterLibrary in masterLibraries.items(): -@@ -791,12 +860,22 @@ def run(): - kName = getKeyNoInternalArgs(s.originalSolution, splitGSU) - s.sizeMapping.CUOccupancy = solDict["%s"%kName]["CUOccupancy"] - -- ParallelMap2(writeMsl, -+ writeFn = functools.partial( -+ writeMasterSolutionLibrary, -+ newLibraryDir=newLibraryDir, -+ splitGSU=splitGSU, -+ libraryFormat=arguments["LibraryFormat"] -+ ) -+ -+ ParallelMap2(writeFn, - newMasterLibrary.lazyLibraries.items(), - "Writing master solution libraries", -+ multiArg=False, - return_as="list") - stop_msl = timer() - print(f"Time to write master solution libraries (s): {(stop_msl-start_msl):3.2f}") -+ del masterLibraries, solutions, kernels, solDict -+ gc.collect() - - if not arguments["KeepBuildTmp"]: - buildTmp = Path(arguments["OutputPath"]).parent / "library" / "build_tmp" -@@ -813,8 +892,11 @@ def run(): - print("") - - stop = timer() -+ peak_memory_mb, current_memory_mb = getMemoryUsage() - - print(f"Total time (s): {(stop-start):3.2f}") - print(f"Total kernels processed: {numKernels}") - print(f"Kernels processed per second: {(numKernels/(stop-start)):3.2f}") -- print(f"KernelHelperObjs: {len(kernelHelperObjs)}") -+ print(f"KernelHelperObjs: {numKernelHelperObjs}") -+ print(f"Peak memory usage (MB): {peak_memory_mb:,.1f}") -+ print(f"Current memory usage (MB): {current_memory_mb:,.1f}") -diff --git a/tensilelite/Tensile/TensileMergeLibrary.py b/tensilelite/Tensile/TensileMergeLibrary.py -index e33c617b6f..ba163e9918 100644 ---- a/tensilelite/Tensile/TensileMergeLibrary.py -+++ b/tensilelite/Tensile/TensileMergeLibrary.py -@@ -303,8 +303,7 @@ def avoidRegressions(originalDir, incrementalDir, outputPath, forceMerge, noEff= - logicsFiles[origFile] = origFile - logicsFiles[incFile] = incFile - -- iters = zip(logicsFiles.keys()) -- logicsList = ParallelMap2(loadData, iters, "Loading Logics...", return_as="list") -+ logicsList = ParallelMap2(loadData, logicsFiles.keys(), "Loading Logics...", return_as="list", multiArg=False) - logicsDict = {} - for i, _ in enumerate(logicsList): - logicsDict[logicsList[i][0]] = logicsList[i][1] -diff --git a/tensilelite/Tensile/TensileUpdateLibrary.py b/tensilelite/Tensile/TensileUpdateLibrary.py -index 5ff265d0ed..c1803a6349 100644 ---- a/tensilelite/Tensile/TensileUpdateLibrary.py -+++ b/tensilelite/Tensile/TensileUpdateLibrary.py -@@ -26,7 +26,7 @@ from . import LibraryIO - from .Tensile import addCommonArguments, argUpdatedGlobalParameters - - from .Common import assignGlobalParameters, print1, restoreDefaultGlobalParameters, HR, \ -- globalParameters, architectureMap, ensurePath, ParallelMap, __version__ -+ globalParameters, architectureMap, ensurePath, ParallelMap2, __version__ - - import argparse - import copy -@@ -149,7 +149,7 @@ def TensileUpdateLibrary(userArgs): - for logicFile in logicFiles: - print("# %s" % logicFile) - fIter = zip(logicFiles, itertools.repeat(args.logic_path), itertools.repeat(outputPath)) -- libraries = ParallelMap(UpdateLogic, fIter, "Updating logic files", method=lambda x: x.starmap) -+ libraries = ParallelMap2(UpdateLogic, fIter, "Updating logic files", multiArg=True, return_as="list") - - - def main(): -diff --git a/tensilelite/Tensile/Toolchain/Assembly.py b/tensilelite/Tensile/Toolchain/Assembly.py -index a8b91e8d62..265e1d532c 100644 ---- a/tensilelite/Tensile/Toolchain/Assembly.py -+++ b/tensilelite/Tensile/Toolchain/Assembly.py -@@ -30,7 +30,7 @@ import subprocess - from pathlib import Path - from typing import List, Union, NamedTuple - --from Tensile.Common import print2 -+from Tensile.Common import print1, print2 - from Tensile.Common.Architectures import isaToGfx - from ..SolutionStructs import Solution - -@@ -92,8 +92,26 @@ def buildAssemblyCodeObjectFiles( - if coName: - coFileMap[asmDir / (coName + extCoRaw)].add(str(asmDir / (kernel["BaseName"] + extObj))) - -+ # Build reference count map for .o files to handle shared object files -+ # (.o files from kernels marked .duplicate in TensileCreateLibrary) -+ objFileRefCount = collections.Counter() -+ for coFileRaw, objFiles in coFileMap.items(): -+ for objFile in objFiles: -+ objFileRefCount[objFile] += 1 -+ -+ sharedObjFiles = {objFile: count for objFile, count in objFileRefCount.items() if count > 1} -+ if sharedObjFiles: -+ print1(f"Found {len(sharedObjFiles)} .o files shared across multiple code objects:") -+ - for coFileRaw, objFiles in coFileMap.items(): - linker(objFiles, str(coFileRaw)) -+ -+ # Delete .o files after linking once usage count reaches 0 -+ for objFile in objFiles: -+ objFileRefCount[objFile] -= 1 -+ if objFileRefCount[objFile] == 0: -+ Path(objFile).unlink() -+ - coFile = destDir / coFileRaw.name.replace(extCoRaw, extCo) - if compress: - bundler.compress(str(coFileRaw), str(coFile), gfx) -diff --git a/tensilelite/Tensile/Toolchain/Component.py b/tensilelite/Tensile/Toolchain/Component.py -index 67fa35e2d8..dde83af4c3 100644 ---- a/tensilelite/Tensile/Toolchain/Component.py -+++ b/tensilelite/Tensile/Toolchain/Component.py -@@ -355,6 +355,7 @@ class Linker(Component): - when invoking the linker, LLVM allows the provision of arguments via a "response file" - Reference: https://llvm.org/docs/CommandLine.html#response-files - """ -+ # FIXME: this prevents threading as clang_args.txt is overwritten - with open(Path.cwd() / "clang_args.txt", "wt") as file: - file.write(" ".join(srcPaths).replace('\\', '\\\\') if os_name == "nt" else " ".join(srcPaths)) - return [*(self.default_args), "-o", destPath, "@clang_args.txt"] -diff --git a/tensilelite/requirements.txt b/tensilelite/requirements.txt -index 60c4c11445..5c8fd66a88 100644 ---- a/tensilelite/requirements.txt -+++ b/tensilelite/requirements.txt -@@ -2,8 +2,6 @@ dataclasses; python_version == '3.6' - packaging - pyyaml - msgpack --joblib>=1.4.0; python_version >= '3.8' --joblib>=1.1.1; python_version < '3.8' - simplejson - ujson - orjson diff --git a/pkgs/development/rocm-modules/hipblaslt/parallel-buildSourceCodeObjectFile.diff b/pkgs/development/rocm-modules/hipblaslt/parallel-buildSourceCodeObjectFile.diff deleted file mode 100644 index 019e7a6123b16..0000000000000 --- a/pkgs/development/rocm-modules/hipblaslt/parallel-buildSourceCodeObjectFile.diff +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/tensilelite/Tensile/Toolchain/Source.py b/tensilelite/Tensile/Toolchain/Source.py -index c9862e6c..dfa5ba40 100644 ---- a/tensilelite/Tensile/Toolchain/Source.py -+++ b/tensilelite/Tensile/Toolchain/Source.py -@@ -102,6 +102,7 @@ def buildSourceCodeObjectFiles( - coPaths= [] - - objPath = str(tmpObjDir / objFilename) -+ compiler.default_args += ["-parallel-jobs=8"] - compiler(str(includeDir), cmdlineArchs, str(kernelPath), objPath) - - for target in bundler.targets(objPath): diff --git a/pkgs/development/rocm-modules/llvm/clang-log-jobs.diff b/pkgs/development/rocm-modules/llvm/clang-log-jobs.diff deleted file mode 100644 index 3a3a712c8bbaf..0000000000000 --- a/pkgs/development/rocm-modules/llvm/clang-log-jobs.diff +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp -index 06f5e7e7e335..8407d664886a 100644 ---- a/lib/Driver/Compilation.cpp -+++ b/lib/Driver/Compilation.cpp -@@ -340,6 +340,9 @@ private: - void Compilation::ExecuteJobs(const JobList &Jobs, - FailingCommandList &FailingCommands, - bool LogOnly) const { -+ // If >1 job, log as each job finishes so can see progress while building many offloads -+ const bool logJobs = Jobs.size() > 1; -+ auto start_time = std::chrono::steady_clock::now(); - // According to UNIX standard, driver need to continue compiling all the - // inputs on the command line even one of them failed. - // In all but CLMode, execute all the jobs unless the necessary inputs for the -@@ -364,11 +367,25 @@ void Compilation::ExecuteJobs(const JobList &Jobs, - - JS.setJobState(Next, JobScheduler::JS_RUN); - auto Work = [&, Next]() { -+ auto job_start_time = std::chrono::steady_clock::now(); - const Command *FailingCommand = nullptr; - if (int Res = ExecuteCommand(*Next, FailingCommand, LogOnly)) { - FailingCommands.push_back(std::make_pair(Res, FailingCommand)); - JS.setJobState(Next, JobScheduler::JS_FAIL); - } else { -+ if (logJobs && Next) { -+ auto now = std::chrono::steady_clock::now(); -+ auto job_duration = std::chrono::duration_cast(now - job_start_time).count(); -+ auto duration = std::chrono::duration_cast(now - start_time).count(); -+ if (duration > 10 && job_duration > 0) { -+ if (Next->getOutputFilenames().empty()) -+ if (Next->getExecutable()) llvm::errs() << "Job completed: " << Next->getExecutable() << "\n"; -+ else (llvm::errs() << "Job completed: "), Next->Print(llvm::errs(), "\n", true); -+ else -+ llvm::errs() << "Job completed: " << Next->getOutputFilenames().front().c_str() << "\n"; -+ } -+ } -+ - JS.setJobState(Next, JobScheduler::JS_DONE); - } - }; diff --git a/pkgs/development/rocm-modules/rccl/fix_hw_reg_hw_id_gt_gfx10.patch b/pkgs/development/rocm-modules/rccl/fix_hw_reg_hw_id_gt_gfx10.patch deleted file mode 100644 index c69000814a8a6..0000000000000 --- a/pkgs/development/rocm-modules/rccl/fix_hw_reg_hw_id_gt_gfx10.patch +++ /dev/null @@ -1,33 +0,0 @@ -fix: __trace_hwreg should use HW_REG_HW_ID1 for all gfx10/11/12 -diff --git a/src/device/common.h b/src/device/common.h -index c6c61021..742885f4 100644 ---- a/src/device/common.h -+++ b/src/device/common.h -@@ -26,8 +26,9 @@ - { __atomic_store_n((DST), (SRC), __ATOMIC_SEQ_CST); } - #endif - --#if defined(__gfx1100__) || defined(__gfx1101__) || defined(__gfx1102__) || defined(__gfx1200__) || defined(__gfx1201__) --#define __trace_hwreg() -+#if defined(__GFX10__) || defined(__GFX11__) || defined(__GFX12__) -+#define __trace_hwreg() \ -+ asm volatile ("s_getreg_b32 %0, hwreg(HW_REG_HW_ID1)" : "=s" (collTrace->data_0)); - #else - #define __trace_hwreg() \ - asm volatile ("s_getreg_b32 %0, hwreg(HW_REG_HW_ID)" : "=s" (collTrace->data_0)); -diff --git a/tools/JitterBench/Common.hpp b/tools/JitterBench/Common.hpp -index bad12a1b..b59856a8 100644 ---- a/tools/JitterBench/Common.hpp -+++ b/tools/JitterBench/Common.hpp -@@ -43,9 +43,9 @@ THE SOFTWARE. - #endif - - // Macro for collecting HW_REG_HW_ID --#if defined(__gfx1100__) || defined(__gfx1101__) || defined(__gfx1102__) || defined(__NVCC__) -+#if defined(__GFX10__) || defined(__GFX11__) || defined(__GFX12__) - #define GetHwId(val) \ -- val = 0 -+ asm volatile ("s_getreg_b32 %0, hwreg(HW_REG_HW_ID1)" : "=s" (val)); - #else - #define GetHwId(val) \ - asm volatile ("s_getreg_b32 %0, hwreg(HW_REG_HW_ID)" : "=s" (val)); diff --git a/pkgs/development/rocm-modules/rdc/fix-cmake-cxxflags.patch b/pkgs/development/rocm-modules/rdc/fix-cmake-cxxflags.patch deleted file mode 100644 index bf7f3dbb0eef4..0000000000000 --- a/pkgs/development/rocm-modules/rdc/fix-cmake-cxxflags.patch +++ /dev/null @@ -1,217 +0,0 @@ -From 92f25181dbf722cb749e445851580df4ea779299 Mon Sep 17 00:00:00 2001 -From: Luna Nova -Date: Sun, 21 Dec 2025 08:01:08 -0800 -Subject: [PATCH 1/2] fix(rdc): set CMAKE_CXX_FLAGS after project() to avoid - clobbering env - -CMAKE_CXX_FLAGS' initial value is set from $CXXFLAGS on project() call -so the previous location ignored CXXFLAGS from env or CMake toolchain -config. - -Ref: https://cmake.org/cmake/help/v4.2/variable/CMAKE_LANG_FLAGS_INIT.html -Fixes: 874a7b438f ("CMAKE - Fix build types") ---- - CMakeLists.txt | 48 +++++++++++++++++++------------------ - 1 file changed, 25 insertions(+), 23 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 907c9fbff42..8b386c7be3d 100755 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -55,29 +55,6 @@ set_property( - PROPERTY STRINGS "Debug" "Release" "RelWithDebInfo" "MinSizeRel" - ) - --# Set compile flags --set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -m64 -msse -msse2") --set(CMAKE_CXX_FLAGS_DEBUG -- "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb -DDEBUG" -- CACHE STRING -- "Flags for Debug builds" --) --set(CMAKE_CXX_FLAGS_RELEASE -- "${CMAKE_CXX_FLAGS_RELEASE} -O2 -s -DNDEBUG" -- CACHE STRING -- "Flags for Release builds" --) --set(CMAKE_CXX_FLAGS_RELWITHDEBINFO -- "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g -DNDEBUG" -- CACHE STRING -- "Flags for RelWithDebInfo builds" --) --set(CMAKE_CXX_FLAGS_MINSIZEREL -- "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG" -- CACHE STRING -- "Flags for MinSizeRel builds" --) -- - set(CMAKE_MODULE_PATH - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/" - CACHE INTERNAL -@@ -155,6 +132,31 @@ project(${RDC} VERSION "${VERSION_STRING}" HOMEPAGE_URL "https://github.com/Rade - # this must go after project() - include(GNUInstallDirs) - -+# NB: CMAKE__FLAGS are initialized from environment (CXXFLAGS et al.) -+# during project(). Setting them before project() discards env and toolchain -+# defaults. Cf. CMAKE__FLAGS_INIT for toolchain overrides. -+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -m64 -msse -msse2") -+set(CMAKE_CXX_FLAGS_DEBUG -+ "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb -DDEBUG" -+ CACHE STRING -+ "Flags for Debug builds" -+) -+set(CMAKE_CXX_FLAGS_RELEASE -+ "${CMAKE_CXX_FLAGS_RELEASE} -O2 -s -DNDEBUG" -+ CACHE STRING -+ "Flags for Release builds" -+) -+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO -+ "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g -DNDEBUG" -+ CACHE STRING -+ "Flags for RelWithDebInfo builds" -+) -+set(CMAKE_CXX_FLAGS_MINSIZEREL -+ "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG" -+ CACHE STRING -+ "Flags for MinSizeRel builds" -+) -+ - set(COMMON_DIR "${CMAKE_CURRENT_SOURCE_DIR}/common") - - set(GRPC_ROOT_DEFAULT "/usr") - -From 0c8710c3570963b29c709b1cd1f78b15fd73a950 Mon Sep 17 00:00:00 2001 -From: Luna Nova -Date: Sun, 21 Dec 2025 08:13:04 -0800 -Subject: [PATCH 2/2] fix(rdc): don't reimplement CMake default build type flag - logic - -The previous approach was overly complicated and added nothing. CMake already defaults -similar flags for each of the default supported build types. -Additionally, the previous flags broke AArch64 as -m64 -msse are incompatible. -It's not necessary to explicitly set this with modern toolchains. - -Fixes: 874a7b438f ("CMAKE - Fix build types") -Fixes: bc7f01e992 ("Initial RDC commit") ---- - CMakeLists.txt | 25 +--------------------- - example/CMakeLists.txt | 26 ++--------------------- - tests/example/CMakeLists.txt | 24 +-------------------- - 3 files changed, 4 insertions(+), 71 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8b386c7be3d..251fcddd653 100755 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -132,30 +132,7 @@ project(${RDC} VERSION "${VERSION_STRING}" HOMEPAGE_URL "https://github.com/Rade - # this must go after project() - include(GNUInstallDirs) - --# NB: CMAKE__FLAGS are initialized from environment (CXXFLAGS et al.) --# during project(). Setting them before project() discards env and toolchain --# defaults. Cf. CMAKE__FLAGS_INIT for toolchain overrides. --set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -m64 -msse -msse2") --set(CMAKE_CXX_FLAGS_DEBUG -- "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb -DDEBUG" -- CACHE STRING -- "Flags for Debug builds" --) --set(CMAKE_CXX_FLAGS_RELEASE -- "${CMAKE_CXX_FLAGS_RELEASE} -O2 -s -DNDEBUG" -- CACHE STRING -- "Flags for Release builds" --) --set(CMAKE_CXX_FLAGS_RELWITHDEBINFO -- "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g -DNDEBUG" -- CACHE STRING -- "Flags for RelWithDebInfo builds" --) --set(CMAKE_CXX_FLAGS_MINSIZEREL -- "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG" -- CACHE STRING -- "Flags for MinSizeRel builds" --) -+add_compile_options(-Wall -Wextra) - - set(COMMON_DIR "${CMAKE_CURRENT_SOURCE_DIR}/common") - -diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt -index 378a2005818..7c51307ec38 100755 ---- a/example/CMakeLists.txt -+++ b/example/CMakeLists.txt -@@ -31,30 +31,6 @@ cmake_minimum_required(VERSION 3.15) - option(CMAKE_VERBOSE_MAKEFILE "Enable verbose output" ON) - option(CMAKE_EXPORT_COMPILE_COMMANDS "Export compile commands for linters and autocompleters" ON) - --# Set compile flags --set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -m64 -msse -msse2") --set(CMAKE_CXX_FLAGS_DEBUG -- "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb -DDEBUG" -- CACHE STRING -- "Flags for Debug builds" --) --# note: no '-s' here unlike other CMakeLists.txt --set(CMAKE_CXX_FLAGS_RELEASE -- "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG" -- CACHE STRING -- "Flags for Release builds" --) --set(CMAKE_CXX_FLAGS_RELWITHDEBINFO -- "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g -DNDEBUG" -- CACHE STRING -- "Flags for RelWithDebInfo builds" --) --set(CMAKE_CXX_FLAGS_MINSIZEREL -- "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG" -- CACHE STRING -- "Flags for MinSizeRel builds" --) -- - set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use") - set(CMAKE_CXX_STANDARD_REQUIRED ON) - set(CMAKE_CXX_EXTENSIONS OFF) -@@ -66,6 +42,8 @@ endif() - - project(RDC_example) - -+add_compile_options(-Wall -Wextra) -+ - # provides cmake_print_variables(VAR) - include(CMakePrintHelpers) - -diff --git a/tests/example/CMakeLists.txt b/tests/example/CMakeLists.txt -index d5614f387bd..13c2f3857a1 100755 ---- a/tests/example/CMakeLists.txt -+++ b/tests/example/CMakeLists.txt -@@ -22,29 +22,7 @@ message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") - message(" Cmake Example Lib ") - message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") - --# Set compile flags --set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -m64 -msse -msse2") --set(CMAKE_CXX_FLAGS_DEBUG -- "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb -DDEBUG" -- CACHE STRING -- "Flags for Debug builds" --) --# note: no '-s' here unlike other CMakeLists.txt --set(CMAKE_CXX_FLAGS_RELEASE -- "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG" -- CACHE STRING -- "Flags for Release builds" --) --set(CMAKE_CXX_FLAGS_RELWITHDEBINFO -- "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g -DNDEBUG" -- CACHE STRING -- "Flags for RelWithDebInfo builds" --) --set(CMAKE_CXX_FLAGS_MINSIZEREL -- "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG" -- CACHE STRING -- "Flags for MinSizeRel builds" --) -+add_compile_options(-Wall -Wextra) - - # Required Defines first: - diff --git a/pkgs/development/rocm-modules/rocfft/log-every-n-aot-jobs.patch b/pkgs/development/rocm-modules/rocfft/log-every-n-aot-jobs.patch deleted file mode 100644 index 266f495d3e7c0..0000000000000 --- a/pkgs/development/rocm-modules/rocfft/log-every-n-aot-jobs.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/library/src/rocfft_aot_helper.cpp b/library/src/rocfft_aot_helper.cpp -index f0a889f4..452eb37f 100644 ---- a/library/src/rocfft_aot_helper.cpp -+++ b/library/src/rocfft_aot_helper.cpp -@@ -771,26 +771,22 @@ int main(int argc, char** argv) - for(size_t i = 0; i < NUM_THREADS; ++i) - { - threads.emplace_back([&queue, &gpu_archs]() { -+ int compile_count = 0; - while(true) - { - auto item = queue.pop(); - if(item.kernel_name.empty()) - break; - -+ if(++compile_count % 16 == 0) -+ std::cerr << "rocfft_aot_helper processing " << item.kernel_name << std::endl << std::flush; - for(const auto& gpu_arch : gpu_archs) - { -- if(item.sol_arch_name.empty()) -+ if(item.sol_arch_name.empty() || gpu_arch.find(item.sol_arch_name) != std::string::npos) - { - RTCCache::cached_compile( - item.kernel_name, gpu_arch, item.generate_src, generator_sum()); - } -- else if(gpu_arch.find(item.sol_arch_name) != std::string::npos) -- { -- // std::cout << "arch: " << gpu_arch -- // << ", solution-kernel: " << item.kernel_name << std::endl; -- RTCCache::cached_compile( -- item.kernel_name, gpu_arch, item.generate_src, generator_sum()); -- } - } - } - }); diff --git a/pkgs/development/rocm-modules/rocm-bandwidth-test/default.nix b/pkgs/development/rocm-modules/rocm-bandwidth-test/default.nix deleted file mode 100644 index f3f1b67095381..0000000000000 --- a/pkgs/development/rocm-modules/rocm-bandwidth-test/default.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitHub, - rocmPackages, - cmake, -}: - -stdenv.mkDerivation (finalAttrs: { - pname = "rocm-bandwidth-test"; - version = "6.3.3"; - - src = fetchFromGitHub { - owner = "ROCm"; - repo = "rocm_bandwidth_test"; - tag = "rocm-${finalAttrs.version}"; - hash = "sha256-dHyfYpRB13wUvim152nZ61McZOQ1zUZFx4dUo2vVqZM="; - }; - - __structuredAttrs = true; - strictDeps = true; - - nativeBuildInputs = [ - cmake - ]; - - buildInputs = [ rocmPackages.rocm-runtime ]; - - cmakeFlags = [ - (lib.cmakeFeature "ROCT_INC_DIR" "${rocmPackages.rocm-runtime}/include/libhsakmt") - ]; - - meta = { - description = "Bandwidth test for AMD GPUs supported by ROCm"; - homepage = "https://github.com/ROCm/rocm_bandwidth_test"; - changelog = "https://github.com/ROCm/rocm_bandwidth_test/releases/tag/${finalAttrs.src.tag}"; - license = lib.licenses.mit; - mainProgram = "rocm-bandwidth-test"; - maintainers = with lib.maintainers; [ fangpen ]; - teams = [ lib.teams.rocm ]; - platforms = [ "x86_64-linux" ]; - }; -}) diff --git a/pkgs/development/rocm-modules/rocm-runtime/queue-failure.patch b/pkgs/development/rocm-modules/rocm-runtime/queue-failure.patch deleted file mode 100644 index f9087144bc229..0000000000000 --- a/pkgs/development/rocm-modules/rocm-runtime/queue-failure.patch +++ /dev/null @@ -1,71 +0,0 @@ -From b7717446c85d08b2d7c0c60ba3ac0eff11ee6120 Mon Sep 17 00:00:00 2001 -From: Luna Nova -Date: Tue, 20 Jan 2026 12:55:45 -0800 -Subject: [PATCH 1/2] rocm-runtime: fix crash in QueueCreate due to trying to - free non allocated scratch - -if (scratch.main_queue_base != nullptr) before calling ReleaseQueueMainScratch -because ReleaseQueueMainScratch is only valid if main_queue_base is set -and the scope guard can fire for an error allocating the queue. ---- - .../runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp -index 01b01fe869..83db40dacc 100644 ---- a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp -+++ b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp -@@ -1792,7 +1792,9 @@ hsa_status_t GpuAgent::QueueCreate(size_t size, hsa_queue_type32_t queue_type, u - scratch.main_queue_base = nullptr; - scratch.main_queue_process_offset = 0; - -- MAKE_NAMED_SCOPE_GUARD(scratchGuard, [&]() { ReleaseQueueMainScratch(scratch); }); -+ MAKE_NAMED_SCOPE_GUARD(scratchGuard, [&]() { -+ if (scratch.main_queue_base != nullptr) ReleaseQueueMainScratch(scratch); -+ }); - - if (scratch.main_size != 0) { - AcquireQueueMainScratch(scratch); --- -2.52.0 - - -From 9c1746cd76a703e4d2321dc2ffe85fc61bfd2f21 Mon Sep 17 00:00:00 2001 -From: Luna Nova -Date: Tue, 20 Jan 2026 13:00:32 -0800 -Subject: [PATCH 2/2] rocm-runtime: log for errors in QueueCreate - ---- - .../runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp -index 83db40dacc..ae68732eb5 100644 ---- a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp -+++ b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp -@@ -1799,6 +1799,9 @@ hsa_status_t GpuAgent::QueueCreate(size_t size, hsa_queue_type32_t queue_type, u - if (scratch.main_size != 0) { - AcquireQueueMainScratch(scratch); - if (scratch.main_queue_base == nullptr) { -+ LogPrint(HSA_AMD_LOG_FLAG_INFO, -+ "Failed to allocate scratch memory for queue, size=%zu, node=%u", -+ scratch.main_size, node_id()); - return HSA_STATUS_ERROR_OUT_OF_RESOURCES; - } - } -@@ -1827,7 +1830,11 @@ hsa_status_t GpuAgent::QueueCreate(size_t size, hsa_queue_type32_t queue_type, u - node_id())); - } - -- if (!shared_queue) return HSA_STATUS_ERROR_OUT_OF_RESOURCES; -+ if (!shared_queue) { -+ LogPrint(HSA_AMD_LOG_FLAG_INFO, -+ "Failed to allocate shared queue descriptor memory, node=%u", node_id()); -+ return HSA_STATUS_ERROR_OUT_OF_RESOURCES; -+ } - - auto aql_queue = new AqlQueue(shared_queue, this, size, node_id(), scratch, event_callback, data, - flags); --- -2.52.0 - diff --git a/pkgs/development/rocm-modules/rocm-runtime/remove-hsa-aqlprofile-dep.patch b/pkgs/development/rocm-modules/rocm-runtime/remove-hsa-aqlprofile-dep.patch deleted file mode 100644 index b8ed57d049bc9..0000000000000 --- a/pkgs/development/rocm-modules/rocm-runtime/remove-hsa-aqlprofile-dep.patch +++ /dev/null @@ -1,27 +0,0 @@ -libhsa-amd-aqlprofile64 library is unfree -Bug: https://github.com/ROCm/ROCm/issues/1781 ---- a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp -+++ b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp -@@ -1333,11 +1333,6 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const { - setFlag(HSA_EXTENSION_AMD_PC_SAMPLING); - } - -- if (os::LibHandle lib = os::LoadLib(kAqlProfileLib)) { -- os::CloseLib(lib); -- setFlag(HSA_EXTENSION_AMD_AQLPROFILE); -- } -- - setFlag(HSA_EXTENSION_AMD_PROFILER); - - break; ---- a/runtime/hsa-runtime/core/runtime/hsa.cpp -+++ b/runtime/hsa-runtime/core/runtime/hsa.cpp -@@ -490,7 +490,7 @@ hsa_status_t hsa_system_get_major_extension_table(uint16_t extension, uint16_t v - return HSA_STATUS_SUCCESS; - } - -- if (extension == HSA_EXTENSION_AMD_AQLPROFILE) { -+ if (0) { - if (version_major != hsa_ven_amd_aqlprofile_VERSION_MAJOR) { - debug_print("aqlprofile API incompatible ver %d, current ver %d\n", - version_major, hsa_ven_amd_aqlprofile_VERSION_MAJOR); diff --git a/pkgs/development/rocm-modules/rocprof-trace-decoder/fix-test-dependency.patch b/pkgs/development/rocm-modules/rocprof-trace-decoder/fix-test-dependency.patch deleted file mode 100644 index 7278ec688094a..0000000000000 --- a/pkgs/development/rocm-modules/rocprof-trace-decoder/fix-test-dependency.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt -index a923cadce53..95a4d3a807f 100644 ---- a/test/CMakeLists.txt -+++ b/test/CMakeLists.txt -@@ -186,7 +186,9 @@ if(BUILD_INTEGRATION_TESTS) - WORKING_DIRECTORY - ${TEST_BIN_DIR} - FIXTURES_REQUIRED -- unpack_data) -+ unpack_data -+ DEPENDS -+ ${DATA}_execute) - endif() - endforeach(DATA) - endif() diff --git a/pkgs/development/rocm-modules/rocprof-trace-decoder/use-system-dependencies.patch b/pkgs/development/rocm-modules/rocprof-trace-decoder/use-system-dependencies.patch deleted file mode 100644 index 1f821a1110882..0000000000000 --- a/pkgs/development/rocm-modules/rocprof-trace-decoder/use-system-dependencies.patch +++ /dev/null @@ -1,81 +0,0 @@ -diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt -index a923cad..53b0f49 100644 ---- a/test/CMakeLists.txt -+++ b/test/CMakeLists.txt -@@ -34,13 +34,7 @@ if(DISABLE_COMGR) - endif() - - if(NOT APPLE AND BUILD_INTEGRATION_TESTS) -- # Add nlohmann JSON as an external dependency -- include(FetchContent) -- FetchContent_Declare( -- json -- GIT_REPOSITORY https://github.com/nlohmann/json.git -- GIT_TAG v3.11.3) -- FetchContent_MakeAvailable(json) -+ find_package(nlohmann_json REQUIRED) - - add_subdirectory(att-tool) - endif() -diff --git a/test/att-tool/CMakeLists.txt b/test/att-tool/CMakeLists.txt -index 208af16..acd161f 100644 ---- a/test/att-tool/CMakeLists.txt -+++ b/test/att-tool/CMakeLists.txt -@@ -1,7 +1,7 @@ - # - # ATT decoder wrapper library for use by the rocprofv3 tool - # --find_library(COMGR REQUIRED NAMES amd_comgr HINTS /opt/rocm/lib) -+find_library(COMGR REQUIRED NAMES amd_comgr) - - set(ATT_TOOL_SOURCE_FILES - waitcnt/analysis.cpp -@@ -19,8 +19,11 @@ set(ATT_TOOL_SOURCE_FILES - - set(DECODER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../source/) - --set(INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../include/ ${DECODER_SRC} ${CMAKE_CURRENT_SOURCE_DIR} ${json_SOURCE_DIR}/include /opt/rocm/include) --set(LINK_LIBS ${COMGR} pthread) -+set(INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../include/ ${DECODER_SRC} ${CMAKE_CURRENT_SOURCE_DIR}) -+find_path(COMGR_INCLUDE_DIR REQUIRED NAMES amd_comgr.h PATH_SUFFIXES amd_comgr) -+find_path(HSA_INCLUDE_DIR REQUIRED NAMES hsa/amd_hsa_elf.h) -+set(LINK_LIBS ${COMGR} pthread nlohmann_json::nlohmann_json) -+list(APPEND INCLUDE_DIRS ${COMGR_INCLUDE_DIR} ${HSA_INCLUDE_DIR}) - - # Sources re-globbed only for sanitizer builds - file(GLOB ATT_DECODER_V3_FILES -diff --git a/test/att-tool/sdk/disassembly.hpp b/test/att-tool/sdk/disassembly.hpp -index c054143..ec3d6d2 100644 ---- a/test/att-tool/sdk/disassembly.hpp -+++ b/test/att-tool/sdk/disassembly.hpp -@@ -22,7 +22,7 @@ - - #pragma once - --#include -+#include - #include - - #include -diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt -index 8adafc0..9501efe 100644 ---- a/test/unit/CMakeLists.txt -+++ b/test/unit/CMakeLists.txt -@@ -9,16 +9,7 @@ project(att-decoder-unit-tests LANGUAGES CXX) - set(CMAKE_CXX_STANDARD 17) - set(CMAKE_CXX_STANDARD_REQUIRED ON) - --# Fetch GoogleTest --include(FetchContent) --FetchContent_Declare( -- googletest -- GIT_REPOSITORY https://github.com/google/googletest.git -- GIT_TAG v1.14.0) --set(INSTALL_GTEST -- OFF -- CACHE BOOL "" FORCE) --FetchContent_MakeAvailable(googletest) -+find_package(GTest REQUIRED) - - enable_testing() - diff --git a/pkgs/development/rocm-modules/rocprofiler-sdk/0001-fix-missing-CPackComponent-cmake-include.patch b/pkgs/development/rocm-modules/rocprofiler-sdk/0001-fix-missing-CPackComponent-cmake-include.patch deleted file mode 100644 index 1e65ac7a76ee5..0000000000000 --- a/pkgs/development/rocm-modules/rocprofiler-sdk/0001-fix-missing-CPackComponent-cmake-include.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 5ae420cc204d0afb1ad388ddbceec237a4164569 Mon Sep 17 00:00:00 2001 -From: Anund -Date: Sun, 11 Oct 2026 17:28:05 +1100 -Subject: [PATCH 1/8] fix missing CPackComponent cmake include - ---- - cmake/rocprofiler_config_packaging.cmake | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/cmake/rocprofiler_config_packaging.cmake b/cmake/rocprofiler_config_packaging.cmake -index 84c2ecf230..55d9f58f38 100644 ---- a/cmake/rocprofiler_config_packaging.cmake -+++ b/cmake/rocprofiler_config_packaging.cmake -@@ -126,6 +126,8 @@ endif() - list(APPEND _DEB_PACKAGE_DEPENDS ${ROCPROFILER_CPACK_DEBIAN_PACKAGE_DEPENDS}) - list(APPEND _RPM_PACKAGE_REQUIRES ${ROCPROFILER_CPACK_RPM_PACKAGE_REQUIRES}) - -+include(CPackComponent) -+ - foreach(COMPONENT_GROUP ${ROCPROFILER_COMPONENT_GROUPS}) - set(_DEP "${COMPONENT_DEP_${COMPONENT_GROUP}}") - set(_NAME "${COMPONENT_NAME_${COMPONENT_GROUP}}") --- -2.55.0 - diff --git a/pkgs/development/rocm-modules/rocprofiler-sdk/0002-allow-using-system-yaml-dependency.patch b/pkgs/development/rocm-modules/rocprofiler-sdk/0002-allow-using-system-yaml-dependency.patch deleted file mode 100644 index 3fa335a25eb9a..0000000000000 --- a/pkgs/development/rocm-modules/rocprofiler-sdk/0002-allow-using-system-yaml-dependency.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 0477671140ffc3d1b50e1cca69f107b51112faa8 Mon Sep 17 00:00:00 2001 -From: Anund -Date: Sun, 11 Oct 2026 17:29:27 +1100 -Subject: [PATCH 2/8] allow using system yaml dependency - ---- - cmake/rocprofiler_options.cmake | 2 ++ - external/CMakeLists.txt | 29 +++++++++++++++++------------ - 2 files changed, 19 insertions(+), 12 deletions(-) - -diff --git a/cmake/rocprofiler_options.cmake b/cmake/rocprofiler_options.cmake -index 08d1032635..faee11049f 100644 ---- a/cmake/rocprofiler_options.cmake -+++ b/cmake/rocprofiler_options.cmake -@@ -65,6 +65,8 @@ rocprofiler_add_option(ROCPROFILER_BUILD_PYBIND11 - "Enable building pybind11 library internally" ON) - rocprofiler_add_option(ROCPROFILER_BUILD_GOTCHA - "Enable building gotcha library internally" ON) -+rocprofiler_add_option(ROCPROFILER_BUILD_YAML_CPP -+ "Enable building yaml-cpp library internally" ON) - if(ROCPROFILER_BUILD_TESTS) - rocprofiler_add_option( - ROCPROFILER_BUILD_GTEST -diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt -index 5bee3dc032..cab59c07bd 100644 ---- a/external/CMakeLists.txt -+++ b/external/CMakeLists.txt -@@ -131,20 +131,25 @@ if(NOT TARGET PTL::ptl-static) - add_subdirectory(ptl EXCLUDE_FROM_ALL) - endif() - --rocprofiler_checkout_git_submodule( -- RECURSIVE -- RELATIVE_PATH external/yaml-cpp -- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} -- REPO_URL https://github.com/jbeder/yaml-cpp.git -- REPO_BRANCH "master") -+if(ROCPROFILER_BUILD_YAML_CPP) -+ rocprofiler_checkout_git_submodule( -+ RECURSIVE -+ RELATIVE_PATH external/yaml-cpp -+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} -+ REPO_URL https://github.com/jbeder/yaml-cpp.git -+ REPO_BRANCH "master") - --add_subdirectory(yaml-cpp EXCLUDE_FROM_ALL) -+ add_subdirectory(yaml-cpp EXCLUDE_FROM_ALL) - --target_link_libraries(rocprofiler-sdk-yaml-cpp -- INTERFACE $) --target_include_directories( -- rocprofiler-sdk-yaml-cpp -- INTERFACE $) -+ target_link_libraries(rocprofiler-sdk-yaml-cpp -+ INTERFACE $) -+ target_include_directories( -+ rocprofiler-sdk-yaml-cpp -+ INTERFACE $) -+else() -+ find_package(yaml-cpp 0.8.0 REQUIRED) -+ target_link_libraries(rocprofiler-sdk-yaml-cpp INTERFACE yaml-cpp::yaml-cpp) -+endif() - - # checkout submodule if not already checked out or clone repo if no .gitmodules file - rocprofiler_checkout_git_submodule( --- -2.55.0 - diff --git a/pkgs/development/rocm-modules/rocprofiler-sdk/0003-allow-using-system-elfio-dependency.patch b/pkgs/development/rocm-modules/rocprofiler-sdk/0003-allow-using-system-elfio-dependency.patch deleted file mode 100644 index 702f380edb420..0000000000000 --- a/pkgs/development/rocm-modules/rocprofiler-sdk/0003-allow-using-system-elfio-dependency.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 27cec58fefe73c26ccca212ebbc002a0b9c1bfa5 Mon Sep 17 00:00:00 2001 -From: Anund -Date: Sun, 11 Oct 2026 17:29:50 +1100 -Subject: [PATCH 3/8] allow using system elfio dependency - ---- - cmake/rocprofiler_options.cmake | 2 ++ - external/CMakeLists.txt | 33 +++++++++++++++++++-------------- - 2 files changed, 21 insertions(+), 14 deletions(-) - -diff --git a/cmake/rocprofiler_options.cmake b/cmake/rocprofiler_options.cmake -index faee11049f..a09af6c2c9 100644 ---- a/cmake/rocprofiler_options.cmake -+++ b/cmake/rocprofiler_options.cmake -@@ -67,6 +67,8 @@ rocprofiler_add_option(ROCPROFILER_BUILD_GOTCHA - "Enable building gotcha library internally" ON) - rocprofiler_add_option(ROCPROFILER_BUILD_YAML_CPP - "Enable building yaml-cpp library internally" ON) -+rocprofiler_add_option(ROCPROFILER_BUILD_ELFIO -+ "Enable building ELFIO library internally" ON) - if(ROCPROFILER_BUILD_TESTS) - rocprofiler_add_option( - ROCPROFILER_BUILD_GTEST -diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt -index cab59c07bd..a75229edf3 100644 ---- a/external/CMakeLists.txt -+++ b/external/CMakeLists.txt -@@ -201,20 +201,25 @@ target_link_libraries( - INTERFACE $) - - # ELFIO --rocprofiler_checkout_git_submodule( -- RECURSIVE -- RELATIVE_PATH external/elfio -- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} -- REPO_URL https://github.com/serge1/ELFIO.git -- REPO_BRANCH "Release_3.12") -- --set(ELFIO_BUILD_EXAMPLES OFF) --set(ELFIO_BUILD_TESTS OFF) --add_subdirectory(elfio EXCLUDE_FROM_ALL) --if(TARGET rocprofiler-sdk-elfio) -- get_target_property(ELFIO_INCLUDE_DIR elfio::elfio INTERFACE_INCLUDE_DIRECTORIES) -- target_include_directories(rocprofiler-sdk-elfio SYSTEM -- INTERFACE ${ELFIO_INCLUDE_DIR}) -+if(ROCPROFILER_BUILD_ELFIO) -+ rocprofiler_checkout_git_submodule( -+ RECURSIVE -+ RELATIVE_PATH external/elfio -+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} -+ REPO_URL https://github.com/serge1/ELFIO.git -+ REPO_BRANCH "Release_3.12") -+ -+ set(ELFIO_BUILD_EXAMPLES OFF) -+ set(ELFIO_BUILD_TESTS OFF) -+ add_subdirectory(elfio EXCLUDE_FROM_ALL) -+ if(TARGET rocprofiler-sdk-elfio) -+ get_target_property(ELFIO_INCLUDE_DIR elfio::elfio INTERFACE_INCLUDE_DIRECTORIES) -+ target_include_directories(rocprofiler-sdk-elfio SYSTEM -+ INTERFACE ${ELFIO_INCLUDE_DIR}) -+ endif() -+else() -+ find_package(elfio REQUIRED GLOBAL) -+ target_link_libraries(rocprofiler-sdk-elfio INTERFACE elfio::elfio) - endif() - - # --- -2.55.0 - diff --git a/pkgs/development/rocm-modules/rocprofiler-sdk/0004-allow-using-system-otf2-dependency.patch b/pkgs/development/rocm-modules/rocprofiler-sdk/0004-allow-using-system-otf2-dependency.patch deleted file mode 100644 index 61a2888f79f8c..0000000000000 --- a/pkgs/development/rocm-modules/rocprofiler-sdk/0004-allow-using-system-otf2-dependency.patch +++ /dev/null @@ -1,54 +0,0 @@ -From d2c8a5872c8d2af1bc8c203ad75f7c1c83cfb919 Mon Sep 17 00:00:00 2001 -From: Anund -Date: Sun, 11 Oct 2026 17:30:13 +1100 -Subject: [PATCH 4/8] allow using system otf2 dependency - ---- - cmake/rocprofiler_options.cmake | 2 ++ - external/CMakeLists.txt | 17 +++++++++-------- - 2 files changed, 11 insertions(+), 8 deletions(-) - -diff --git a/cmake/rocprofiler_options.cmake b/cmake/rocprofiler_options.cmake -index a09af6c2c9..19e092df06 100644 ---- a/cmake/rocprofiler_options.cmake -+++ b/cmake/rocprofiler_options.cmake -@@ -69,6 +69,8 @@ rocprofiler_add_option(ROCPROFILER_BUILD_YAML_CPP - "Enable building yaml-cpp library internally" ON) - rocprofiler_add_option(ROCPROFILER_BUILD_ELFIO - "Enable building ELFIO library internally" ON) -+rocprofiler_add_option(ROCPROFILER_BUILD_OTF2 -+ "Enable building OTF2 library internally" ON) - if(ROCPROFILER_BUILD_TESTS) - rocprofiler_add_option( - ROCPROFILER_BUILD_GTEST -diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt -index a75229edf3..e1be3df85e 100644 ---- a/external/CMakeLists.txt -+++ b/external/CMakeLists.txt -@@ -225,14 +225,15 @@ endif() - # - # OTF2 - # --add_subdirectory(otf2) -- --rocprofiler_checkout_git_submodule( -- RECURSIVE -- RELATIVE_PATH external/json -- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} -- REPO_URL https://github.com/nlohmann/json.git -- REPO_BRANCH "develop") -+if(ROCPROFILER_BUILD_OTF2) -+ add_subdirectory(otf2) -+else() -+ find_package(PkgConfig REQUIRED) -+ pkg_check_modules(OTF2 REQUIRED IMPORTED_TARGET otf2) -+ add_library(otf2 INTERFACE) -+ add_library(otf2::otf2 ALIAS otf2) -+ target_link_libraries(otf2 INTERFACE PkgConfig::OTF2) -+endif() - - # - # JSON --- -2.55.0 - diff --git a/pkgs/development/rocm-modules/rocprofiler-sdk/0005-allow-using-system-json-dependency.patch b/pkgs/development/rocm-modules/rocprofiler-sdk/0005-allow-using-system-json-dependency.patch deleted file mode 100644 index b6cb539682c45..0000000000000 --- a/pkgs/development/rocm-modules/rocprofiler-sdk/0005-allow-using-system-json-dependency.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 3c42b2a8491b44fa58940fcd44b45c64f1b43cf1 Mon Sep 17 00:00:00 2001 -From: Anund -Date: Sun, 11 Oct 2026 17:30:36 +1100 -Subject: [PATCH 5/8] allow using system json dependency - ---- - cmake/rocprofiler_options.cmake | 2 ++ - external/CMakeLists.txt | 17 +++++++++++++++++ - 2 files changed, 19 insertions(+) - -diff --git a/cmake/rocprofiler_options.cmake b/cmake/rocprofiler_options.cmake -index 19e092df06..b7a7a6cbdd 100644 ---- a/cmake/rocprofiler_options.cmake -+++ b/cmake/rocprofiler_options.cmake -@@ -71,6 +71,8 @@ rocprofiler_add_option(ROCPROFILER_BUILD_ELFIO - "Enable building ELFIO library internally" ON) - rocprofiler_add_option(ROCPROFILER_BUILD_OTF2 - "Enable building OTF2 library internally" ON) -+rocprofiler_add_option(ROCPROFILER_BUILD_JSON -+ "Enable building JSON library internally" ON) - if(ROCPROFILER_BUILD_TESTS) - rocprofiler_add_option( - ROCPROFILER_BUILD_GTEST -diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt -index e1be3df85e..a282232f22 100644 ---- a/external/CMakeLists.txt -+++ b/external/CMakeLists.txt -@@ -243,6 +243,23 @@ target_include_directories( - rocprofiler-sdk-json SYSTEM - INTERFACE $) - -+if(ROCPROFILER_BUILD_JSON) -+ rocprofiler_checkout_git_submodule( -+ RECURSIVE -+ RELATIVE_PATH external/json -+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} -+ REPO_URL https://github.com/nlohmann/json.git -+ REPO_BRANCH "develop") -+ -+ add_subdirectory(json) -+ target_include_directories( -+ rocprofiler-sdk-json SYSTEM -+ INTERFACE $) -+else() -+ find_package(nlohmann_json REQUIRED GLOBAL) -+ target_link_libraries(rocprofiler-sdk-json INTERFACE nlohmann_json::nlohmann_json) -+endif() -+ - # - # SQLite3 - # --- -2.55.0 - diff --git a/pkgs/development/rocm-modules/rocprofiler-sdk/0006-fix-amd-comgr-resolution.patch b/pkgs/development/rocm-modules/rocprofiler-sdk/0006-fix-amd-comgr-resolution.patch deleted file mode 100644 index 03103ec734619..0000000000000 --- a/pkgs/development/rocm-modules/rocprofiler-sdk/0006-fix-amd-comgr-resolution.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 9977c287e106d9c494546212a3544e238363e219 Mon Sep 17 00:00:00 2001 -From: Anund -Date: Sun, 11 Oct 2026 16:52:24 +1100 -Subject: [PATCH 6/8] fix amd-comgr resolution - ---- - .../lib/att-tool/waitcnt/tests/CMakeLists.txt | 1 + - source/lib/python/utilities.cmake | 3 ++- - .../counters/tests/CMakeLists.txt | 2 ++ - .../pc_sampling/parser/tests/CMakeLists.txt | 20 ++++++++++++++----- - .../lib/rocprofiler-sdk/tests/CMakeLists.txt | 2 ++ - .../thread_trace/tests/CMakeLists.txt | 1 + - 6 files changed, 23 insertions(+), 6 deletions(-) - -diff --git a/source/lib/att-tool/waitcnt/tests/CMakeLists.txt b/source/lib/att-tool/waitcnt/tests/CMakeLists.txt -index 8a13e80cbe..48b3debc93 100644 ---- a/source/lib/att-tool/waitcnt/tests/CMakeLists.txt -+++ b/source/lib/att-tool/waitcnt/tests/CMakeLists.txt -@@ -10,6 +10,7 @@ target_link_libraries( - rocprofiler-sdk::rocprofiler-sdk-common-library - rocprofiler-sdk::rocprofiler-sdk-glog - rocprofiler-sdk::rocprofiler-sdk-static-library -+ rocprofiler-sdk::rocprofiler-sdk-amd-comgr - GTest::gtest - GTest::gtest_main) - target_sources(att-decoder-waitcnt-test PRIVATE att_decoder_waitcnt_test.cpp) -diff --git a/source/lib/python/utilities.cmake b/source/lib/python/utilities.cmake -index 1bc9171a3e..21bc9cfb3d 100644 ---- a/source/lib/python/utilities.cmake -+++ b/source/lib/python/utilities.cmake -@@ -209,7 +209,8 @@ function(rocprofiler_rocpd_python_bindings _VERSION) - rocprofiler-sdk::rocprofiler-sdk-gotcha - rocprofiler-sdk::rocprofiler-sdk-dw - rocprofiler-sdk::rocprofiler-sdk-static-library -- rocprofiler-sdk::rocprofiler-sdk-rocpd-library) -+ rocprofiler-sdk::rocprofiler-sdk-rocpd-library -+ rocprofiler-sdk::rocprofiler-sdk-amd-comgr) - - # if "Development" is specified instead of "Development.Module", we need to link to - # python libraries -diff --git a/source/lib/rocprofiler-sdk/counters/tests/CMakeLists.txt b/source/lib/rocprofiler-sdk/counters/tests/CMakeLists.txt -index 5e0d73e0f0..38251a7acc 100644 ---- a/source/lib/rocprofiler-sdk/counters/tests/CMakeLists.txt -+++ b/source/lib/rocprofiler-sdk/counters/tests/CMakeLists.txt -@@ -51,6 +51,7 @@ target_sources( - target_link_libraries( - counter_test_constants - PRIVATE rocprofiler-sdk::rocprofiler-sdk-common-library -+ rocprofiler-sdk::rocprofiler-sdk-amd-comgr - rocprofiler-sdk::rocprofiler-sdk-static-library - rocprofiler-sdk::rocprofiler-sdk-hip - rocprofiler-sdk::rocprofiler-sdk-hsa-runtime) -@@ -73,6 +74,7 @@ target_link_libraries( - rocprofiler-sdk::rocprofiler-sdk-hsa-runtime - rocprofiler-sdk::rocprofiler-sdk-hip - rocprofiler-sdk::rocprofiler-sdk-common-library -+ rocprofiler-sdk::rocprofiler-sdk-amd-comgr - rocprofiler-sdk::rocprofiler-sdk-static-library - GTest::gtest - GTest::gtest_main) -diff --git a/source/lib/rocprofiler-sdk/pc_sampling/parser/tests/CMakeLists.txt b/source/lib/rocprofiler-sdk/pc_sampling/parser/tests/CMakeLists.txt -index 1c512054d6..3bb64572e1 100644 ---- a/source/lib/rocprofiler-sdk/pc_sampling/parser/tests/CMakeLists.txt -+++ b/source/lib/rocprofiler-sdk/pc_sampling/parser/tests/CMakeLists.txt -@@ -30,7 +30,9 @@ target_include_directories(pcs_gfx9_test PRIVATE ${PCTEST_INCLUDE_DIR}) - target_link_libraries( - pcs_gfx9_test - PRIVATE rocprofiler-sdk::rocprofiler-sdk-common-library -- rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest -+ rocprofiler-sdk::rocprofiler-sdk-amd-comgr -+ rocprofiler-sdk::rocprofiler-sdk-static-library -+ GTest::gtest - GTest::gtest_main) - - gtest_add_tests( -@@ -52,7 +54,9 @@ target_include_directories(pcs_id_test PRIVATE ${PCTEST_INCLUDE_DIR}) - target_link_libraries( - pcs_id_test - PRIVATE rocprofiler-sdk::rocprofiler-sdk-common-library -- rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest -+ rocprofiler-sdk::rocprofiler-sdk-amd-comgr -+ rocprofiler-sdk::rocprofiler-sdk-static-library -+ GTest::gtest - GTest::gtest_main) - - gtest_add_tests( -@@ -75,7 +79,9 @@ target_include_directories(pcs_bench_test PRIVATE ${PCTEST_INCLUDE_DIR}) - target_link_libraries( - pcs_bench_test - PRIVATE rocprofiler-sdk::rocprofiler-sdk-common-library -- rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest -+ rocprofiler-sdk::rocprofiler-sdk-amd-comgr -+ rocprofiler-sdk::rocprofiler-sdk-static-library -+ GTest::gtest - GTest::gtest_main) - - add_executable(pcs_thread_test) -@@ -88,7 +94,9 @@ target_include_directories(pcs_thread_test PRIVATE ${PCTEST_INCLUDE_DIR}) - target_link_libraries( - pcs_thread_test - PRIVATE rocprofiler-sdk::rocprofiler-sdk-common-library -- rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest -+ rocprofiler-sdk::rocprofiler-sdk-amd-comgr -+ rocprofiler-sdk::rocprofiler-sdk-static-library -+ GTest::gtest - GTest::gtest_main) - - gtest_add_tests( -@@ -111,7 +119,9 @@ target_include_directories(pcs_gfx12_test PRIVATE ${PCTEST_INCLUDE_DIR}) - target_link_libraries( - pcs_gfx12_test - PRIVATE rocprofiler-sdk::rocprofiler-sdk-common-library -- rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest -+ rocprofiler-sdk::rocprofiler-sdk-amd-comgr -+ rocprofiler-sdk::rocprofiler-sdk-static-library -+ GTest::gtest - GTest::gtest_main) - - gtest_add_tests( -diff --git a/source/lib/rocprofiler-sdk/tests/CMakeLists.txt b/source/lib/rocprofiler-sdk/tests/CMakeLists.txt -index d71aa7c297..70dfe3376d 100644 ---- a/source/lib/rocprofiler-sdk/tests/CMakeLists.txt -+++ b/source/lib/rocprofiler-sdk/tests/CMakeLists.txt -@@ -28,6 +28,7 @@ target_sources(rocprofiler-sdk-lib-tests PRIVATE ${rocprofiler_lib_sources} - target_link_libraries( - rocprofiler-sdk-lib-tests - PRIVATE rocprofiler-sdk::rocprofiler-sdk-static-library -+ rocprofiler-sdk::rocprofiler-sdk-amd-comgr - rocprofiler-sdk::rocprofiler-sdk-common-library - rocprofiler-sdk::counter-test-constants - rocprofiler-sdk::rocprofiler-sdk-hsa-runtime -@@ -59,6 +60,7 @@ target_sources(rocprofiler-sdk-lib-tests-shared PRIVATE ${rocprofiler_shared_lib - target_link_libraries( - rocprofiler-sdk-lib-tests-shared - PRIVATE rocprofiler-sdk::rocprofiler-sdk-shared-library -+ rocprofiler-sdk::rocprofiler-sdk-amd-comgr - rocprofiler-sdk::rocprofiler-sdk-common-library - rocprofiler-sdk::rocprofiler-sdk-hsa-runtime - rocprofiler-sdk::rocprofiler-sdk-drm -diff --git a/source/lib/rocprofiler-sdk/thread_trace/tests/CMakeLists.txt b/source/lib/rocprofiler-sdk/thread_trace/tests/CMakeLists.txt -index 62acae39fb..7e867ba0a7 100644 ---- a/source/lib/rocprofiler-sdk/thread_trace/tests/CMakeLists.txt -+++ b/source/lib/rocprofiler-sdk/thread_trace/tests/CMakeLists.txt -@@ -14,6 +14,7 @@ target_link_libraries( - rocprofiler-sdk::rocprofiler-sdk-glog - rocprofiler-sdk::rocprofiler-sdk-hsa-runtime - rocprofiler-sdk::rocprofiler-sdk-hip -+ rocprofiler-sdk::rocprofiler-sdk-amd-comgr - rocprofiler-sdk::rocprofiler-sdk-common-library - GTest::gtest - GTest::gtest_main --- -2.55.0 - diff --git a/pkgs/development/rocm-modules/rocprofiler-sdk/0007-fix-missing-includes-and-api-changes-with-fmt-v12.2..patch b/pkgs/development/rocm-modules/rocprofiler-sdk/0007-fix-missing-includes-and-api-changes-with-fmt-v12.2..patch deleted file mode 100644 index 970e2a89b67d4..0000000000000 --- a/pkgs/development/rocm-modules/rocprofiler-sdk/0007-fix-missing-includes-and-api-changes-with-fmt-v12.2..patch +++ /dev/null @@ -1,260 +0,0 @@ -From eb68d5d6dcdb085dc3d8d18576fee7cf998f6512 Mon Sep 17 00:00:00 2001 -From: Anund -Date: Sun, 11 Oct 2026 16:59:59 +1100 -Subject: [PATCH 7/8] fix missing includes and api changes with fmt v12.2.0 - ---- - source/lib/common/logging.cpp | 1 + - source/lib/output/generateRocpd.cpp | 1 + - source/lib/output/generateStats.cpp | 1 + - source/lib/output/metadata.cpp | 1 - - source/lib/output/metadata.hpp | 2 +- - source/lib/output/sql/common.hpp | 1 + - source/lib/python/rocpd/libpyrocpd.cpp | 1 + - source/lib/python/rocpd/source/serialization/sql.cpp | 3 +++ - source/lib/python/rocpd/source/sql_generator.hpp | 3 +++ - source/lib/rocprofiler-sdk-tool/tool.cpp | 3 ++- - source/lib/rocprofiler-sdk/counters/tests/device_counting.cpp | 1 + - source/lib/rocprofiler-sdk/counters/tests/dimension.cpp | 1 + - source/lib/rocprofiler-sdk/hip/details/format.hpp | 4 ++-- - source/lib/rocprofiler-sdk/hsa/aql_packet.cpp | 2 +- - source/lib/rocprofiler-sdk/hsa/details/fmt.hpp | 3 +++ - source/lib/rocprofiler-sdk/ompt.cpp | 2 +- - .../pc_sampling/parser/pc_record_interface.cpp | 2 ++ - source/lib/tests/common/parse.cpp | 1 + - 18 files changed, 26 insertions(+), 7 deletions(-) - -diff --git a/source/lib/common/logging.cpp b/source/lib/common/logging.cpp -index 6c07322b06..24aecbc23d 100644 ---- a/source/lib/common/logging.cpp -+++ b/source/lib/common/logging.cpp -@@ -25,6 +25,7 @@ - #include "lib/common/filesystem.hpp" - - #include -+#include - #include - #include - -diff --git a/source/lib/output/generateRocpd.cpp b/source/lib/output/generateRocpd.cpp -index 564a9bd45f..65d9a5d7cf 100644 ---- a/source/lib/output/generateRocpd.cpp -+++ b/source/lib/output/generateRocpd.cpp -@@ -56,6 +56,7 @@ - #include - - #include -+#include - #include - #include - -diff --git a/source/lib/output/generateStats.cpp b/source/lib/output/generateStats.cpp -index 22c1a7f425..3860be129b 100644 ---- a/source/lib/output/generateStats.cpp -+++ b/source/lib/output/generateStats.cpp -@@ -33,6 +33,7 @@ - #include - - #include -+#include - - #include - #include -diff --git a/source/lib/output/metadata.cpp b/source/lib/output/metadata.cpp -index abe9e00b50..f68d46de5b 100644 ---- a/source/lib/output/metadata.cpp -+++ b/source/lib/output/metadata.cpp -@@ -41,7 +41,6 @@ - #include - #include - --#include - #include - - #include -diff --git a/source/lib/output/metadata.hpp b/source/lib/output/metadata.hpp -index 069401f962..a283896f29 100644 ---- a/source/lib/output/metadata.hpp -+++ b/source/lib/output/metadata.hpp -@@ -45,7 +45,7 @@ - #include - #include - --#include -+#include - - #include - #include -diff --git a/source/lib/output/sql/common.hpp b/source/lib/output/sql/common.hpp -index 40fb8df9a8..97f96e06c4 100644 ---- a/source/lib/output/sql/common.hpp -+++ b/source/lib/output/sql/common.hpp -@@ -29,6 +29,7 @@ - #include "lib/common/units.hpp" - - #include -+#include - #include - - #include -diff --git a/source/lib/python/rocpd/libpyrocpd.cpp b/source/lib/python/rocpd/libpyrocpd.cpp -index 009afd694b..8ad4eb3458 100644 ---- a/source/lib/python/rocpd/libpyrocpd.cpp -+++ b/source/lib/python/rocpd/libpyrocpd.cpp -@@ -55,6 +55,7 @@ - #include - - #include -+#include - #include - #include - #include -diff --git a/source/lib/python/rocpd/source/serialization/sql.cpp b/source/lib/python/rocpd/source/serialization/sql.cpp -index d10e878be5..9192abc45b 100644 ---- a/source/lib/python/rocpd/source/serialization/sql.cpp -+++ b/source/lib/python/rocpd/source/serialization/sql.cpp -@@ -23,6 +23,9 @@ - #include "lib/python/rocpd/source/serialization/sql.hpp" - #include "lib/output/sql/common.hpp" - -+#include -+#include -+ - namespace cereal - { - SQLite3InputArchive::SQLite3InputArchive(sqlite3* conn, -diff --git a/source/lib/python/rocpd/source/sql_generator.hpp b/source/lib/python/rocpd/source/sql_generator.hpp -index 6284857afb..881ad23a72 100644 ---- a/source/lib/python/rocpd/source/sql_generator.hpp -+++ b/source/lib/python/rocpd/source/sql_generator.hpp -@@ -38,6 +38,9 @@ - #include - #include - -+#include -+#include -+ - namespace rocpd - { - namespace tool = ::rocprofiler::tool; -diff --git a/source/lib/rocprofiler-sdk-tool/tool.cpp b/source/lib/rocprofiler-sdk-tool/tool.cpp -index 7b03fa3eb8..6ddb2274e5 100644 ---- a/source/lib/rocprofiler-sdk-tool/tool.cpp -+++ b/source/lib/rocprofiler-sdk-tool/tool.cpp -@@ -78,7 +78,8 @@ - #include - #include - --#include -+#include -+#include - - #include - #include -diff --git a/source/lib/rocprofiler-sdk/counters/tests/device_counting.cpp b/source/lib/rocprofiler-sdk/counters/tests/device_counting.cpp -index 9587b219f3..d82a6ec40b 100644 ---- a/source/lib/rocprofiler-sdk/counters/tests/device_counting.cpp -+++ b/source/lib/rocprofiler-sdk/counters/tests/device_counting.cpp -@@ -39,6 +39,7 @@ - #include - - #include -+#include - #include - #include - #include -diff --git a/source/lib/rocprofiler-sdk/counters/tests/dimension.cpp b/source/lib/rocprofiler-sdk/counters/tests/dimension.cpp -index 387c167bd0..22fcda9bf7 100644 ---- a/source/lib/rocprofiler-sdk/counters/tests/dimension.cpp -+++ b/source/lib/rocprofiler-sdk/counters/tests/dimension.cpp -@@ -39,6 +39,7 @@ - #include - - #include -+#include - #include - #include - #include -diff --git a/source/lib/rocprofiler-sdk/hip/details/format.hpp b/source/lib/rocprofiler-sdk/hip/details/format.hpp -index f65cf016a6..46f734d65d 100644 ---- a/source/lib/rocprofiler-sdk/hip/details/format.hpp -+++ b/source/lib/rocprofiler-sdk/hip/details/format.hpp -@@ -31,8 +31,8 @@ - #include - #include - --#include "fmt/core.h" --#include "fmt/ranges.h" -+#include -+#include - - #define ROCP_SDK_HIP_FORMATTER(TYPE, ...) \ - template <> \ -diff --git a/source/lib/rocprofiler-sdk/hsa/aql_packet.cpp b/source/lib/rocprofiler-sdk/hsa/aql_packet.cpp -index f1c0c3a56e..389a182e9d 100644 ---- a/source/lib/rocprofiler-sdk/hsa/aql_packet.cpp -+++ b/source/lib/rocprofiler-sdk/hsa/aql_packet.cpp -@@ -21,7 +21,7 @@ - // THE SOFTWARE. - - #include "lib/rocprofiler-sdk/hsa/aql_packet.hpp" --#include -+#include - #include - #include - #include "lib/common/logging.hpp" -diff --git a/source/lib/rocprofiler-sdk/hsa/details/fmt.hpp b/source/lib/rocprofiler-sdk/hsa/details/fmt.hpp -index c136a2739c..f0d7d9e94f 100644 ---- a/source/lib/rocprofiler-sdk/hsa/details/fmt.hpp -+++ b/source/lib/rocprofiler-sdk/hsa/details/fmt.hpp -@@ -22,6 +22,9 @@ - - #include "lib/rocprofiler-sdk/hsa/queue.hpp" - -+#include -+#include -+ - namespace fmt - { - template <> -diff --git a/source/lib/rocprofiler-sdk/ompt.cpp b/source/lib/rocprofiler-sdk/ompt.cpp -index a9ccc571c8..0d7166465a 100644 ---- a/source/lib/rocprofiler-sdk/ompt.cpp -+++ b/source/lib/rocprofiler-sdk/ompt.cpp -@@ -31,7 +31,7 @@ - #include - #include - --#include -+#include - #include - #include - -diff --git a/source/lib/rocprofiler-sdk/pc_sampling/parser/pc_record_interface.cpp b/source/lib/rocprofiler-sdk/pc_sampling/parser/pc_record_interface.cpp -index 8d418df50e..a4163529c1 100644 ---- a/source/lib/rocprofiler-sdk/pc_sampling/parser/pc_record_interface.cpp -+++ b/source/lib/rocprofiler-sdk/pc_sampling/parser/pc_record_interface.cpp -@@ -24,6 +24,8 @@ - - #include "lib/common/utility.hpp" - -+#include -+ - template <> - uint64_t - PCSamplingParserContext::alloc( -diff --git a/source/lib/tests/common/parse.cpp b/source/lib/tests/common/parse.cpp -index 5e3b63c85f..ccfc0912bc 100644 ---- a/source/lib/tests/common/parse.cpp -+++ b/source/lib/tests/common/parse.cpp -@@ -23,6 +23,7 @@ - #include - - #include -+#include - #include - - #include --- -2.55.0 - diff --git a/pkgs/development/rocm-modules/rocprofiler-sdk/0008-fix-compilation-errors-from-missing-includes.patch b/pkgs/development/rocm-modules/rocprofiler-sdk/0008-fix-compilation-errors-from-missing-includes.patch deleted file mode 100644 index ab694273ab2c2..0000000000000 --- a/pkgs/development/rocm-modules/rocprofiler-sdk/0008-fix-compilation-errors-from-missing-includes.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 3346d7d75513445c19f04a9e972216522752e469 Mon Sep 17 00:00:00 2001 -From: Anund -Date: Sun, 11 Oct 2026 17:00:20 +1100 -Subject: [PATCH 8/8] fix compilation errors from missing includes - ---- - source/lib/att-tool/att_lib_wrapper.hpp | 2 ++ - source/lib/att-tool/wave.hpp | 1 + - source/lib/rocprofiler-sdk-rocpd/sql.cpp | 1 + - source/lib/rocprofiler-sdk/counters/metrics.cpp | 1 + - source/lib/rocprofiler-sdk/counters/metrics.hpp | 1 + - source/lib/rocprofiler-sdk/tests/status.cpp | 1 + - 6 files changed, 7 insertions(+) - -diff --git a/source/lib/att-tool/att_lib_wrapper.hpp b/source/lib/att-tool/att_lib_wrapper.hpp -index e7e58c5991..7dcd000a43 100644 ---- a/source/lib/att-tool/att_lib_wrapper.hpp -+++ b/source/lib/att-tool/att_lib_wrapper.hpp -@@ -28,9 +28,11 @@ - #include - - #include -+#include - #include - #include - #include -+#include - #include - - namespace rocprofiler -diff --git a/source/lib/att-tool/wave.hpp b/source/lib/att-tool/wave.hpp -index 1a7b1adda6..65686d8ea3 100644 ---- a/source/lib/att-tool/wave.hpp -+++ b/source/lib/att-tool/wave.hpp -@@ -29,6 +29,7 @@ - #include "waitcnt/analysis.hpp" - #include "wstates.hpp" - -+#include - #include - #include - #include -diff --git a/source/lib/rocprofiler-sdk-rocpd/sql.cpp b/source/lib/rocprofiler-sdk-rocpd/sql.cpp -index b052ec51c3..7e8742686e 100644 ---- a/source/lib/rocprofiler-sdk-rocpd/sql.cpp -+++ b/source/lib/rocprofiler-sdk-rocpd/sql.cpp -@@ -39,6 +39,7 @@ - #include - - #include -+#include - #include - #include - -diff --git a/source/lib/rocprofiler-sdk/counters/metrics.cpp b/source/lib/rocprofiler-sdk/counters/metrics.cpp -index 201ae4fd25..4780a0ba31 100644 ---- a/source/lib/rocprofiler-sdk/counters/metrics.cpp -+++ b/source/lib/rocprofiler-sdk/counters/metrics.cpp -@@ -45,6 +45,7 @@ - #include // for dladdr - #include - #include -+#include - #include - #include - -diff --git a/source/lib/rocprofiler-sdk/counters/metrics.hpp b/source/lib/rocprofiler-sdk/counters/metrics.hpp -index 7915bc8805..a893c2c9b3 100644 ---- a/source/lib/rocprofiler-sdk/counters/metrics.hpp -+++ b/source/lib/rocprofiler-sdk/counters/metrics.hpp -@@ -35,6 +35,7 @@ - #include - #include - #include -+#include - - namespace rocprofiler - { -diff --git a/source/lib/rocprofiler-sdk/tests/status.cpp b/source/lib/rocprofiler-sdk/tests/status.cpp -index a5a492101d..b01f511b99 100644 ---- a/source/lib/rocprofiler-sdk/tests/status.cpp -+++ b/source/lib/rocprofiler-sdk/tests/status.cpp -@@ -25,6 +25,7 @@ - - #include - -+#include - #include - - TEST(rocprofiler_lib, error_string) --- -2.55.0 - diff --git a/pkgs/development/rocm-modules/rocprofiler-sdk/0009-rocprofiler-sdk-guard-ompt-auto-start.patch b/pkgs/development/rocm-modules/rocprofiler-sdk/0009-rocprofiler-sdk-guard-ompt-auto-start.patch deleted file mode 100644 index 147d79483318e..0000000000000 --- a/pkgs/development/rocm-modules/rocprofiler-sdk/0009-rocprofiler-sdk-guard-ompt-auto-start.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 502d2df0ddd84f0f2fa718b9a02ee0f01f36dac1 Mon Sep 17 00:00:00 2001 -From: Luna Nova -Date: Tue, 2 Jun 2026 01:31:05 -0700 -Subject: [PATCH] [rocprofiler-sdk] don't auto-start OMPT tool before glog is - initialized - -The OpenMP runtime resolves its weak ompt_start_tool to the strong symbol we -export and calls it during OpenMP init. That can fire from an unrelated -library's constructor (observed: OpenBLAS calling omp_get_num_places) while -librocprofiler-sdk is still being dlopen'd. init_logging() then dereferences -glog's gflags FLAGS_vmodule, whose backing pointer is still null until glog's -static initializers run, and the process segfaults on `import torch`. - -The init order is not reliably fixable from here: a dependency cycle among the -ROCm libraries makes the loader run our constructors before libglog's, so a -flag set by our own constructor does not imply glog is ready. Instead gate the -tool start on glog itself, by testing whether gflags has populated FLAGS_vmodule -yet; reading the raw pointer is safe even before construction. It is read via an -asm label because the gflags header only exposes it as a reference, which the -compiler assumes is never null. Declining (nullptr) when glog is not yet ready -is a valid OMPT "no tool" response; deliberate profiling (rocprofv3 preloads the -tool early, before such constructors) is unaffected. ---- - source/lib/rocprofiler-sdk/ompt.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/source/lib/rocprofiler-sdk/ompt.cpp b/source/lib/rocprofiler-sdk/ompt.cpp -index a9ccc57..3231087 100644 ---- a/source/lib/rocprofiler-sdk/ompt.cpp -+++ b/source/lib/rocprofiler-sdk/ompt.cpp -@@ -199,6 +199,8 @@ finalize_ompt() - } // namespace ompt - } // namespace rocprofiler - -+extern void* const rocprofiler_glog_vmodule_flag asm("_ZN3fLS13FLAGS_vmoduleB5cxx11E"); -+ - extern "C" { - - rocprofiler_status_t -@@ -245,6 +247,8 @@ ompt_start_tool(unsigned int omp_version, const char* runtime_version) ROCPROFIL - ompt_start_tool_result_t* - ompt_start_tool(unsigned int omp_version, const char* runtime_version) - { -+ if(rocprofiler_glog_vmodule_flag == nullptr) return nullptr; -+ - ::rocprofiler::registration::init_logging(); - ::rocprofiler::registration::initialize(); - return rocprofiler_ompt_start_tool(omp_version, runtime_version); --- -2.54.0 diff --git a/pkgs/development/rocm-modules/rocwmma/0000-dont-fetch-googletest.patch b/pkgs/development/rocm-modules/rocwmma/0000-dont-fetch-googletest.patch deleted file mode 100644 index fa47a3c42249b..0000000000000 --- a/pkgs/development/rocm-modules/rocwmma/0000-dont-fetch-googletest.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt -index 0d00883..86ce282 100644 ---- a/test/CMakeLists.txt -+++ b/test/CMakeLists.txt -@@ -30,30 +30,6 @@ cmake_dependent_option( ROCWMMA_BUILD_VALIDATION_TESTS "Build validation tests" - cmake_dependent_option( ROCWMMA_BUILD_BENCHMARK_TESTS "Build benchmarking tests" OFF "ROCWMMA_BUILD_TESTS" OFF ) - cmake_dependent_option( ROCWMMA_BUILD_EXTENDED_TESTS "Build extended test parameter coverage" OFF "ROCWMMA_BUILD_TESTS" OFF ) - --# Test/benchmark requires additional dependencies --include( FetchContent ) -- --FetchContent_Declare( -- googletest -- GIT_REPOSITORY https://github.com/google/googletest.git -- GIT_TAG release-1.12.1 --) --FetchContent_GetProperties(googletest) --if(NOT googletest_POPULATED) -- -- # Fetch the content using default details -- FetchContent_Populate(googletest) -- # Save the shared libs setting, then force to static libs -- set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS}) -- set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Build SHARED libraries" FORCE) -- -- # Add gtest targets as static libs -- add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) -- -- # Restore shared libs setting -- set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_OLD} CACHE INTERNAL "Build SHARED libraries" FORCE) --endif() -- - set(ROCWMMA_TEST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) - set(ROCWMMA_COMMON_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/hip_device.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rocwmma_gtest_main.cpp) diff --git a/pkgs/development/rocm-modules/update.nix b/pkgs/development/rocm-modules/update.nix index 7ffc5f9a7e6cb..71b281e816fa0 100644 --- a/pkgs/development/rocm-modules/update.nix +++ b/pkgs/development/rocm-modules/update.nix @@ -1,6 +1,12 @@ { lib, writeScript, + # Newest major this set accepts; a newer major goes into a new rocmPackages_X. + maxMajor ? 7, + # Tag prefixes this set's versions are published under (rocm-X.Y.Z, therock-X.Y[.Z]). + tagPrefixes ? [ "rocm" ], + # Attribute path of the package set, for update-source-version. + setName ? "rocmPackages", }: { @@ -8,10 +14,17 @@ name ? finalAttrs.pname, owner ? finalAttrs.src.owner, repo ? finalAttrs.src.repo, - page ? "releases?per_page=10", - # input: array of [ { tag_name: "rocm-6.x.x", }, ... ]. some entries may have bad names like rocm-test-date we want to skip - # output: first tag_name/name that's a proper version if any - filter ? "map(.tag_name // .name) | map(select(test(\"^rocm-[0-9]+\\\\.[0-9]+(\\\\.[0-9]+)?$\"))) | first | ltrimstr(\"rocm-\")", + page ? "releases?per_page=100", + # input: array of [ { tag_name: "rocm-7.2.4", }, { tag_name: "therock-10.1" }, ... ]. some entries + # may have bad names like rocm-test-date we want to skip + # output: the highest proper version with an accepted prefix and major <= maxMajor, if any. + # Releases are not ordered by version (a rocm-7.2.x maintenance release can follow therock-10.1). + filter ? lib.concatStringsSep " | " [ + "map(.tag_name // .name)" + "map(select(test(\"^(${lib.concatStringsSep "|" tagPrefixes})-[0-9]+\\\\.[0-9]+(\\\\.[0-9]+)?$\")) | sub(\"^(${lib.concatStringsSep "|" tagPrefixes})-\"; \"\"))" + "map(select((split(\".\")[0] | tonumber) <= ${toString maxMajor}))" + "sort_by(split(\".\") | map(tonumber)) | last // empty" + ], }: let @@ -23,14 +36,21 @@ let #!nix-shell -i bash -p curl jq common-updater-scripts set -euo pipefail - fetch_releases() { + fetch_releases() ( local api_url="https://api.github.com/repos/${owner}/${repo}/${page}" - if [ "${page}" = "releases" ]; then - api_url="$api_url?per_page=4" + local headers + headers="$(mktemp)" + trap 'rm -f "$headers"' EXIT + local -a auth=() + if [[ -n "''${GITHUB_TOKEN:-}" ]]; then + auth=(-H "Authorization: Bearer $GITHUB_TOKEN") fi - >&2 echo $api_url - curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL "$api_url" - } + while [[ -n "$api_url" ]]; do + curl "''${auth[@]}" -fsSL --dump-header "$headers" "$api_url" || return + printf '\n' + api_url="$(tr -d '\r' < "$headers" | sed -nE 's/^link:.*<([^>]+)>; rel="next".*/\1/ip')" + done + ) find_valid_version() { local releases="$1" @@ -40,7 +60,7 @@ let echo "$releases" | jq -r 'if type == "array" then . else [.] end | ${filter}' } - releases="$(fetch_releases)" + releases="$(fetch_releases | jq -s 'map(if type == "array" then . else [.] end) | add')" version="$(find_valid_version "$releases")" if [ -z "$version" ]; then @@ -52,12 +72,12 @@ let >&2 echo parsed version "$version_arr" from "$version" - if (( ''${version_arr[0]} > 7 )); then - echo "'rocmPackages.${pname}' is already at its maximum allowed version.''\nAny further upgrades should go into 'rocmPackages_X.${pname}'." >&2 + if (( ''${version_arr[0]} > ${toString maxMajor} )); then + echo "'${setName}.${pname}' is already at its maximum allowed version.''\nAny further upgrades should go into 'rocmPackages_X.${pname}'." >&2 exit 1 fi - update-source-version rocmPackages.${pname} "$version" --ignore-same-hash + update-source-version ${setName}.${pname} "$version" --ignore-same-hash ''; in [ updateScript ] diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e85402023569b..8df1eb142aee6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1854,7 +1854,8 @@ with pkgs; dvtm-unstable = callPackage ../tools/misc/dvtm/unstable.nix { }; - rocmPackages = recurseIntoAttrs (callPackage ../development/rocm-modules { }); + rocmPackages = recurseIntoAttrs rocmPackages_10; + rocmPackages_10 = callPackage ../development/rocm-modules/10 { }; tsm-client-withGui = callPackage ../by-name/ts/tsm-client/package.nix { enableGui = true; };