Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
9cf3a16
Revert "Adding softlink with MajorVersion number for pciutils"
renjithravindrankannath Sep 16, 2025
ab30646
Enabling py-torch 2.9, 2.10 and ci build on rocm
renjithravindrankannath Mar 2, 2026
ceb9991
Update spack.yaml for py-torch +rocm ci
renjithravindrankannath Mar 2, 2026
d4a5286
Add torch_specs in ci
renjithravindrankannath Mar 3, 2026
c9f43ff
Removing exclude
renjithravindrankannath Mar 3, 2026
2b9f046
Removing py-keras backend=torch from exclution
renjithravindrankannath Mar 3, 2026
7de3afa
require llvm-amdgpu@7.0: or above when the spec has both llvm@20 and …
renjithravindrankannath Mar 4, 2026
879f26c
Updating dependency since llvm@20: is used for @0.45:
renjithravindrankannath Mar 6, 2026
41abbed
Adding hwloc~rocm dependency for llvmlite@0.45:
renjithravindrankannath Mar 9, 2026
5437d05
Dependents can find libamdhip64.so when importing torch or running co…
renjithravindrankannath Mar 10, 2026
2674f52
Limiting ci build to py-torch temporarily
renjithravindrankannath Mar 11, 2026
211b910
Enabling part of the torch_specs
renjithravindrankannath Mar 11, 2026
f77cfba
Temporarily disabling py-kornia
renjithravindrankannath Mar 11, 2026
2a54149
Temporarily disabling py-gpytorch, py-lightning, py-pytorch-lightning…
renjithravindrankannath Mar 11, 2026
ae2fa59
Disabling ci for py-botorch and enabling for py-gpytorch
renjithravindrankannath Mar 12, 2026
5052029
Limiting ci build to py-torch temporarily
renjithravindrankannath Mar 11, 2026
29b180c
Resolving concretization failure
renjithravindrankannath Mar 13, 2026
f6e2b95
To find libamdhip64.so at runtime
renjithravindrankannath Mar 16, 2026
5f07872
To fix aotriton/dtypes.h' file not found failure
renjithravindrankannath Mar 16, 2026
16ff315
indented block after 'for' statement
renjithravindrankannath Mar 16, 2026
5c3badf
Style error fix
renjithravindrankannath Mar 16, 2026
20905b2
Avoids undeclared identifier errors in attention.hip
renjithravindrankannath Mar 17, 2026
99e7a90
Correcting patch
renjithravindrankannath Mar 17, 2026
327b497
flash/mem_eff attention requires AOTriton USE_MEM_EFF_ATTENTION and n…
renjithravindrankannath Mar 17, 2026
944b58b
Updating patch to make compatible for 2.9 and 2.10
renjithravindrankannath Mar 18, 2026
0ef34f9
Removing patch and adding changed in recipe using filter_file
renjithravindrankannath Mar 18, 2026
a5dcdf2
[@spackbot] updating style on behalf of renjithravindrankannath
renjithravindrankannath Mar 18, 2026
588bb54
Stlye check fix
Mar 18, 2026
4a8f234
style check failure correction
renjithravindrankannath Mar 20, 2026
473884c
pre/style check failure correction
renjithravindrankannath Mar 20, 2026
bc74398
[@spackbot] updating style on behalf of renjithravindrankannath
renjithravindrankannath Mar 20, 2026
6656f56
Build failure fix
renjithravindrankannath Mar 20, 2026
ac9addb
Style check failure fix
renjithravindrankannath Mar 20, 2026
4413d9f
restricting patch to 2.9
renjithravindrankannath Mar 25, 2026
89f184c
Update in aotriton dependency for version 2.11
renjithravindrankannath Apr 22, 2026
adc5b1a
Adding changes from PR 4205 temporarily to check ci build
renjithravindrankannath Apr 24, 2026
37699fd
[@spackbot] updating style on behalf of renjithravindrankannath
renjithravindrankannath Apr 24, 2026
a00eb67
Removing patch since aotriton is updated
renjithravindrankannath Apr 27, 2026
53960ae
Revert "Merge branch 'develop' into py-torch-2.9-2.10-rocm"
renjithravindrankannath Apr 27, 2026
75d3209
Reapply "Merge branch 'develop' into py-torch-2.9-2.10-rocm"
renjithravindrankannath Apr 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .ci/gitlab/configs/linux/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ ci:
- wrf
build-job:
tags: [ "spack", "huge" ]
# 24h for long ROCm/ML rebuilds; GitLab project/runner max must allow this
timeout: 1440 minutes
variables:
CI_JOB_SIZE: huge
SPACK_BUILD_JOBS: "12"
Expand Down
19 changes: 18 additions & 1 deletion repos/spack_repo/builtin/packages/aotriton/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Aotriton(CMakePackage):
depends_on("pkgconfig", type="build")

# build llvm version with mlir with the commit that matches inside the llvm-hash.txt
depends_on("aotriton-llvm@0.10", when="@0.10b")
depends_on("aotriton-llvm@0.10", when="@0.10b:")
depends_on("aotriton-llvm@0.9", when="@0.9b")
depends_on("aotriton-llvm@0.8", when="@0.8b")

Expand Down Expand Up @@ -134,4 +134,21 @@ def cmake_args(self):
args = []
args.append(self.define("AOTRITON_GPU_BUILD_TIMEOUT", 0))
args.append(self.define("AOTRITON_NOIMAGE_MODE", "ON"))
# So libaotriton_v2.so and extensions find libamdhip64.so at runtime and
# during binary cache relocation (avoids "libamdhip64.so.6 => not found").
args.append(self.define("CMAKE_INSTALL_RPATH", self.spec["hip"].prefix.lib))
args.append(self.define("CMAKE_INSTALL_RPATH_USE_LINK_PATH", True))
# So libaotriton_v2.so and extensions find shared libs at runtime and
# during binary cache relocation (avoids "=> not found" for e.g.
# libamdhip64.so.6, libz.so.1, libhsa-runtime64.so.1, libc++abi.so.1,
# libunwind.so.1).
rpath_dirs = [
self.spec["hip"].prefix.lib,
self.spec["hsa-rocr-dev"].prefix.lib,
self.spec["zlib-api"].prefix.lib,
self.spec["aotriton-llvm"].prefix.lib,
]
args.append(self.define("CMAKE_INSTALL_RPATH", rpath_dirs))
if self.spec.satisfies("@0.11b"):
args.append(self.define("AOTRITON_USE_TORCH", "OFF"))
return args
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ def cmake_args(self):
args.append(self.define("INSTANCES_ONLY", "ON"))
if self.run_tests:
args.append(self.define("BUILD_TESTING", "ON"))
elif self.spec.satisfies("@:6.1"):
else:
args.append(self.define("BUILD_TESTING", "OFF"))
if self.spec.satisfies("@:6.1"):
args.append(self.define("INSTANCES_ONLY", "ON"))
if self.spec.satisfies("@:5.7"):
args.append(self.define("CMAKE_CXX_FLAGS", "-O3"))
Expand Down
2 changes: 1 addition & 1 deletion repos/spack_repo/builtin/packages/hipblaslt/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def url_for_version(self, version):

depends_on("cmake@3.25.2:", type="build", when="@6.2.0:")
depends_on("python@3.7:")
depends_on("python@3.8:3.13.2", when="@6.4:")
depends_on("python@3.8:3.13", when="@6.4:")

for ver in [
"6.0.0",
Expand Down
5 changes: 2 additions & 3 deletions repos/spack_repo/builtin/packages/miopen_hip/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import itertools
import re

from spack_repo.builtin.build_systems.cmake import CMakePackage
Expand Down Expand Up @@ -119,12 +118,12 @@ def url_for_version(self, version):
depends_on(f"rocm-cmake@{ver}:", type="build", when=f"@{ver}")
depends_on(f"hip@{ver}", when=f"@{ver}")
depends_on(f"rocm-clang-ocl@{ver}", when=f"@{ver}")
depends_on(f"rocblas@{ver}", when=f"@{ver}")
for tgt in itertools.chain(["auto"], amdgpu_targets):
for tgt in ROCmPackage.amdgpu_targets:
depends_on(
f"composable-kernel@{ver} amdgpu_target={tgt}",
when=f"@{ver} +ck amdgpu_target={tgt}",
)
depends_on(f"rocblas@{ver} amdgpu_target={tgt}", when=f"@{ver} amdgpu_target={tgt}")

for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2"]:
depends_on(f"roctracer-dev@{ver}", when=f"@{ver}")
Expand Down
4 changes: 4 additions & 0 deletions repos/spack_repo/builtin/packages/py_llvmlite/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ class PyLlvmlite(PythonPackage):
depends_on("llvm@14", when="@0.41:0.43")
depends_on("llvm@11:14", when="@0.40")
depends_on("llvm@11", when="@0.37:0.39")
# When the spec has both llvm@20 and hwloc+rocm (e.g. llvm build-depends on hwloc),
# hwloc with older rocm versions conflicts with llvm@20 while linking.
# Hence adding hwloc~rocm dependency for llvmlite@0.45:.
depends_on("hwloc ~rocm", when="@0.45:")
for t in [
"arm:",
"ppc:",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ index 9be7f37..39d0f24 100644
endif()

diff --git a/cmake/public/LoadHIP.cmake b/cmake/public/LoadHIP.cmake
index 1c0d3a2..e0de4b1 100644
index 1c0d3a2..83f9f9d 100644
--- a/cmake/public/LoadHIP.cmake
+++ b/cmake/public/LoadHIP.cmake
@@ -167,6 +167,10 @@ if(HIP_FOUND)
@@ -167,6 +167,11 @@ if(HIP_FOUND)
find_package_and_print_version(hipsolver REQUIRED)
find_package_and_print_version(hiprtc REQUIRED)

+ list(APPEND ROCM_INCLUDE ${rocthrust_INCLUDE_DIR})
+ list(APPEND ROCM_INCLUDE ${rocprim_INCLUDE_DIR})
+ list(APPEND ROCM_INCLUDE ${hipcub_INCLUDE_DIR})
+ list(APPEND ROCM_INCLUDE ${rocRAND_INCLUDE_DIR})
+ list(APPEND ROCM_INCLUDE $ENV{AOTRITON_INSTALLED_PREFIX}/include)

find_library(PYTORCH_HIP_LIBRARIES amdhip64 HINTS ${ROCM_PATH}/lib)
# TODO: miopen_LIBRARIES should return fullpath to the library file,
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
index d2d23b7..620a89f 100644
index d2d23b7ab65..620a89f65cb 100644
--- a/caffe2/CMakeLists.txt
+++ b/caffe2/CMakeLists.txt
@@ -1379,13 +1379,6 @@ if(USE_ROCM)
Expand All @@ -26,7 +26,7 @@ index d2d23b7..620a89f 100644
endif()

diff --git a/cmake/public/LoadHIP.cmake b/cmake/public/LoadHIP.cmake
index 58c74dd..d3e1ad4 100644
index 58c74ddda35..54f96871372 100644
--- a/cmake/public/LoadHIP.cmake
+++ b/cmake/public/LoadHIP.cmake
@@ -26,12 +26,6 @@ else()
Expand Down Expand Up @@ -78,7 +78,15 @@ index 58c74dd..d3e1ad4 100644
find_package_and_print_version(amd_comgr REQUIRED)
find_package_and_print_version(rocrand REQUIRED)
find_package_and_print_version(hiprand REQUIRED)
@@ -171,7 +168,11 @@ if(HIP_FOUND)
@@ -157,6 +154,7 @@ if(HIP_FOUND)
find_package_and_print_version(hipcub REQUIRED)
find_package_and_print_version(rocthrust REQUIRED)
find_package_and_print_version(hipsolver REQUIRED)
+ list(APPEND ROCM_INCLUDE_DIRS $ENV{AOTRITON_INSTALLED_PREFIX}/include)
# workaround cmake 4 build issue
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.0.0")
message(WARNING "Work around hiprtc cmake failure for cmake >= 4")
@@ -171,7 +169,11 @@ if(HIP_FOUND)
if(UNIX)
find_package_and_print_version(rccl)
find_package_and_print_version(hsa-runtime64 REQUIRED)
Expand Down
51 changes: 46 additions & 5 deletions repos/spack_repo/builtin/packages/py_torch/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage):
conflicts("+gloo+rocm")
conflicts("+rocm", when="@2.3", msg="Rocm doesn't support py-torch 2.3 release")
conflicts("+rocm", when="@2.4", msg="Rocm doesn't support py-torch 2.4 release")
conflicts("+rocm", when="@2.8", msg="Rocm doesn't support py-torch 2.8 release")
conflicts("+tensorpipe", when="+rocm ^hip@:5.1", msg="TensorPipe not supported until ROCm 5.2")
conflicts("+breakpad", when="target=ppc64:")
conflicts("+breakpad", when="target=ppc64le:")
Expand Down Expand Up @@ -328,7 +329,8 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage):
depends_on("valgrind", when="+valgrind")
with when("+rocm"):
depends_on("hsa-rocr-dev")
depends_on("hip")
depends_on("hip@7.0:", when="@2.9:")
depends_on("hip@:6.4", when="@:2.7")
depends_on("rccl", when="+nccl")
depends_on("rocprim")
depends_on("hipcub")
Expand All @@ -343,11 +345,17 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage):
depends_on("rocfft")
depends_on("rocblas")
depends_on("miopen-hip")
depends_on("composable-kernel")
depends_on("hipblaslt")
# Ensure hipblaslt version for 2.9+
depends_on("hipblaslt@7.0:", when="@2.9:")
depends_on("rocminfo")
depends_on("aotriton@0.8.1b", when="@2.5:2.6")
depends_on("aotriton@0.9.1b", when="@2.7:")
depends_on("composable-kernel@:6.3.2", when="@2.5")
depends_on("composable-kernel@6.3.2:", when="@2.6:")
depends_on("hipsparselt@7.0:", when="@2.9:")
depends_on("aotriton@0.8b", when="@2.5:2.6")
depends_on("aotriton@0.9.2b", when="@2.7")
depends_on("aotriton@0.10b", when="@2.8:2.10")
depends_on("aotriton@0.11b", when="@2.11:")

depends_on("mpi", when="+mpi")
depends_on("ucc", when="+ucc")
depends_on("ucx", when="+ucc")
Expand Down Expand Up @@ -591,6 +599,17 @@ def patch(self):
"torch_global_deps PROPERTIES LINKER_LANGUAGE CXX",
"caffe2/CMakeLists.txt",
)
if self.spec.satisfies("@2.5:+rocm"):
filter_file(
"find_library(ROCM_ROCTX_LIB roctx64 HINTS ${ROCM_PATH}/lib)",
"find_library(ROCM_ROCTX_LIB roctx64 HINTS ${ROCM_PATH}/lib)\n"
"if(DEFINED ENV{ROCTRACER_INCLUDE_DIR})\n"
" set(ROCTRACER_INCLUDE_DIR $ENV{ROCTRACER_INCLUDE_DIR} CACHE PATH "
'"Roctracer include directory" FORCE)\n'
"endif()",
"cmake/public/LoadHIP.cmake",
string=True,
)
if self.spec.satisfies("@2.1:2.7+rocm"):
filter_file(
"${ROCM_INCLUDE_DIRS}/rocm-core/rocm_version.h",
Expand Down Expand Up @@ -688,6 +707,11 @@ def enable_or_disable(variant, keyword="USE", var=None):

enable_or_disable("rocm")
if "+rocm" in self.spec:
# So libtorch_hip.so and dependents find ROCm/runtime libs at runtime and
# during binary cache relocation (avoids "=> not found" for e.g.
# libamdhip64.so.6, libhsa-runtime64.so.1).
for lib_dir in [self.spec["hip"].prefix.lib, self.spec["hsa-rocr-dev"].prefix.lib]:
env.append_flags("LDFLAGS", "-Wl,-rpath," + lib_dir)
env.set("PYTORCH_ROCM_ARCH", ";".join(self.spec.variants["amdgpu_target"].value))
env.set("HSA_PATH", self.spec["hsa-rocr-dev"].prefix)
env.set("ROCBLAS_PATH", self.spec["rocblas"].prefix)
Expand All @@ -708,6 +732,7 @@ def enable_or_disable(variant, keyword="USE", var=None):
if self.spec.satisfies("@2.5:"):
env.set("TORCHINDUCTOR_CK_DIR", self.spec["composable-kernel"].prefix)
env.set("AOTRITON_INSTALLED_PREFIX", self.spec["aotriton"].prefix)
env.prepend_path("CPATH", self.spec["aotriton"].prefix.include)
if self.spec.satisfies("^hip@5.2.0:"):
env.set("CMAKE_MODULE_PATH", self.spec["hip"].prefix.lib.cmake.hip)

Expand Down Expand Up @@ -824,6 +849,22 @@ def enable_or_disable(variant, keyword="USE", var=None):

def setup_run_environment(self, env: EnvironmentModifications) -> None:
self.torch_cuda_arch_list(env)
if "+rocm" in self.spec:
env.prepend_path("LD_LIBRARY_PATH", self.spec["hip"].prefix.lib)

def setup_dependent_build_environment(self, env, dependent_spec):
if "+rocm" in self.spec:
env.prepend_path("LD_LIBRARY_PATH", self.spec["hip"].prefix.lib)
# PyTorch headers (e.g. c10/util/complex.h) include <thrust/complex.h>;
# dependents need rocthrust include so HIP device builds can find it.
env.set("THRUST_PATH", self.spec["rocthrust"].prefix)
env.prepend_path("CPATH", self.spec["rocthrust"].prefix.include)

def setup_dependent_run_environment(self, env, dependent_spec):
"""So dependents (e.g. py-torch-nvidia-apex, py-torchaudio) can find
libamdhip64.so when importing torch or running code that uses ROCm."""
if "+rocm" in self.spec:
env.prepend_path("LD_LIBRARY_PATH", self.spec["hip"].prefix.lib)

@run_before("install")
def build_amd(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class RocmValidationSuite(CMakePackage):
depends_on("googletest")
depends_on("doxygen", type="build")
depends_on("libdrm", when="@6.4:")
depends_on("pciutils+shared", when="@6.4:")
depends_on("pciutils+shared", type="build", when="@6.4:")

def setup_build_environment(self, env: EnvironmentModifications) -> None:
spec = self.spec
Expand Down
37 changes: 17 additions & 20 deletions stacks/ml-linux-x86_64/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ spack:
- py-keras backend=jax
- py-keras backend=torch
- torch_specs:
- py-botorch
- py-gpytorch
- py-kornia
- py-lightning
- py-pytorch-lightning
- py-segmentation-models-pytorch
- py-timm
#- py-botorch
#- py-gpytorch
#- py-kornia
#- py-lightning
#- py-pytorch-lightning
#- py-segmentation-models-pytorch
#- py-timm
- py-torch
- py-torch-geometric
- py-torch-nvidia-apex
- py-torchaudio
- py-torchgeo
- py-torchmetrics
- py-torchvision
- py-vector-quantize-pytorch
#- py-torch-geometric
#- py-torch-nvidia-apex
#- py-torchaudio
#- py-torchgeo
#- py-torchmetrics
#- py-torchvision
#- py-vector-quantize-pytorch
- scikit_learn_specs:
- py-scikit-learn
- tensorboard_specs:
Expand Down Expand Up @@ -113,15 +113,11 @@ spack:
- $jax_specs
- matrix:
- [$keras_specs]
exclude:
- py-keras backend=torch
# Does not yet support Spack-installed ROCm
# - $torch_specs
- $torch_specs
- $scikit_learn_specs
- $tensorboard_specs
- $tensorflow_specs
# Does not yet support Spack-installed ROCm
# - $xgboost_specs
- $xgboost_specs
override:
packages:
all:
Expand All @@ -139,6 +135,7 @@ spack:
- target=x86_64_v3
- ~cuda
- +rocm
- ~distributed
- amdgpu_target=gfx90a
- ~flash_attention
- "%c,cxx=gcc"
Expand Down
Loading