From 498d7bdd704878ff20130ff86b73d5ed3adb9561 Mon Sep 17 00:00:00 2001
From: Akrit Kumar Behera <84931167+akritkbehera@users.noreply.github.com>
Date: Tue, 2 Jun 2026 22:24:37 +0200
Subject: [PATCH 1/3] Update library link in comgr.spec
Built PY3_TORCH_ROCM successfully
Revert COMGR and update missing xml in pytorch-rocm
---
comgr.spec | 2 +-
pip/torch-rocm.file | 12 +++++++++---
.../tools/py3-torch-rocm/pytorch-rocm-links.xml | 5 +++++
3 files changed, 15 insertions(+), 4 deletions(-)
create mode 100644 scram-tools.file/tools/py3-torch-rocm/pytorch-rocm-links.xml
diff --git a/comgr.spec b/comgr.spec
index 67b2b68a149..cbb00a6b026 100644
--- a/comgr.spec
+++ b/comgr.spec
@@ -33,4 +33,4 @@ sed -E -i -e 's@\s[^ ]*libLLVM.so(\.[0-9]+)+git\s@ @' %{_builddir}/build-comgr/C
make -C %{_builddir}/build-comgr %{makeprocesses} VERBOSE=1
%install
-make -C %{_builddir}/build-comgr install VERBOSE=1
+make -C %{_builddir}/build-comgr install VERBOSE=1
\ No newline at end of file
diff --git a/pip/torch-rocm.file b/pip/torch-rocm.file
index 8754ec31f3f..768a5a7786a 100644
--- a/pip/torch-rocm.file
+++ b/pip/torch-rocm.file
@@ -1,5 +1,8 @@
## INCLUDE rocm-flags
-Requires: rocm xz aotriton
+Requires: xz aotriton hip comgr rocr-runtime amdsmi
+Requires: rocrand miopen hiprand rocblas hipblas hipblas-common hipblaslt
+Requires: hipfft hipsparse rocprim hipcub rocthrust hipsolver rocsolver hipsparselt
+Requires: rocprofiler roctracer rccl rocm-core
%define pip_name torch
%define PipPreBuildPy \
@@ -10,8 +13,11 @@ Requires: rocm xz aotriton
export PYTHON_EXECUTABLE=$(which python3); \
export NUMPY_EXPERIMENTAL_DTYPE_API=1 \
export USE_ROCM=ON; \
- export ROCM_PATH=${ROCM_ROOT}; \
- export ROCM_SOURCE_DIR=${ROCM_ROOT}; \
+ export CMAKE_CXX_FLAGS="-I$ROCM_CORE_ROOT/include -I$HIPBLASLT_ROOT/include -I$HIPBLAS_COMMON_ROOT/include -I$ROCTRACER_ROOT/include"\
+ export HIP_DEVICE_LIB_PATH=${ROCM_LLVM_ROOT}/amdgcn/bitcode \
+ export HIP_DEVICE_LIB_PATH=${ROCM_LLVM_ROOT}/amdgcn/bitcode \
+ export ROCM_PATH=${HIP_ROOT}; \
+ export ROCM_SOURCE_DIR=${HIP_ROOT}; \
export AMDGPU_TARGETS="$(echo '%{rocm_archs}' | sed -e 's/,/ /g')"; \
export PYTORCH_ROCM_ARCH="%{rocm_archs}"; \
mkdir -p %{_builddir}/pkgconfig; \
diff --git a/scram-tools.file/tools/py3-torch-rocm/pytorch-rocm-links.xml b/scram-tools.file/tools/py3-torch-rocm/pytorch-rocm-links.xml
new file mode 100644
index 00000000000..431c303a8ee
--- /dev/null
+++ b/scram-tools.file/tools/py3-torch-rocm/pytorch-rocm-links.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
From f90476321d8ef3cb25e22ec70eca29546fc4567d Mon Sep 17 00:00:00 2001
From: akritkbehera
Date: Thu, 4 Jun 2026 12:54:07 +0200
Subject: [PATCH 2/3] Clean ROCM Version, Fix Build Requires
---
aqlprofile.spec | 2 +-
comgr.spec | 3 ++-
hip.spec | 3 ++-
hipblas-common.spec | 2 +-
hipfft.spec | 2 +-
hiprand.spec | 2 +-
hipsolver.spec | 2 +-
hipsparse.spec | 2 +-
hipsparselt.spec | 2 +-
miopen.spec | 2 +-
pip/orjson.file | 2 +-
pip/pymongo.file | 3 ++-
pip/uv.file | 3 ++-
rocfft.spec | 2 +-
rocm-llvm.spec | 3 ++-
rocm-offload.spec | 4 ++--
rocprim.spec | 2 +-
rocprofiler-compute.spec | 3 ++-
rocprofiler.spec | 3 ++-
rocrand.spec | 2 +-
rocsolver.spec | 2 +-
rocsparse.spec | 2 +-
rocthrust.spec | 2 +-
23 files changed, 31 insertions(+), 24 deletions(-)
diff --git a/aqlprofile.spec b/aqlprofile.spec
index cd9e0d098fd..4bd1921d395 100644
--- a/aqlprofile.spec
+++ b/aqlprofile.spec
@@ -1,5 +1,5 @@
## INCLUDE rocm-config
-### RPM external aqlprofile %{rocm_version}
+### RPM external aqlprofile %{rocm_version_num}
Source: %{rocm_systems_source}
Requires: rocm-core rocr-runtime
diff --git a/comgr.spec b/comgr.spec
index cbb00a6b026..0432a3eb0e0 100644
--- a/comgr.spec
+++ b/comgr.spec
@@ -1,7 +1,8 @@
## INCLUDE rocm-config
### RPM external comgr %{rocm_version_num}
Source0: https://github.com/ROCm/llvm-project/archive/refs/tags/rocm-%{realversion}.tar.gz
-Requires: rocm-llvm rocm-core zlib zstd cmake ninja libxml2
+BuildRequires: cmake ninja
+Requires: rocm-llvm rocm-core zlib zstd libxml2
Patch0: 0001-comgr-link-with-static-llvm
%prep
diff --git a/hip.spec b/hip.spec
index 0edb60a9dd7..01d52391772 100644
--- a/hip.spec
+++ b/hip.spec
@@ -5,7 +5,8 @@
## INITENV SET HIP_CLANG_PATH ${ROCM_LLVM_ROOT}/lib/llvm/bin
## INITENV HIP_PLATFORM amd
Source0: https://github.com/ROCm/rocm-systems/archive/refs/tags/rocm-%{realversion}.tar.gz
-Requires: rocm-llvm rocm-core rocr-runtime rocprofiler-register numactl py3-CppHeaderParser python3 comgr
+BuildRequires: py3-CppHeaderParser
+Requires: rocm-llvm rocm-core rocr-runtime rocprofiler-register numactl python3 comgr
Provides: perl(URI::Escape)
%prep
%setup -q -n rocm-systems-rocm-%{realversion}
diff --git a/hipblas-common.spec b/hipblas-common.spec
index 2f435a9a110..244fef42767 100644
--- a/hipblas-common.spec
+++ b/hipblas-common.spec
@@ -1,3 +1,3 @@
## INCLUDE rocm-config
-### RPM external hipblas-common %{rocm_version}
+### RPM external hipblas-common %{rocm_version_num}
## INCLUDE rocm-libraries-build-new
diff --git a/hipfft.spec b/hipfft.spec
index 10756cd8a68..68d4e1f9260 100644
--- a/hipfft.spec
+++ b/hipfft.spec
@@ -1,4 +1,4 @@
## INCLUDE rocm-config
-### RPM external hipfft %{rocm_version}
+### RPM external hipfft %{rocm_version_num}
Requires: rocfft
## INCLUDE rocm-libraries-build-new
diff --git a/hiprand.spec b/hiprand.spec
index 9d58cc8084e..38b6f253e50 100644
--- a/hiprand.spec
+++ b/hiprand.spec
@@ -1,4 +1,4 @@
## INCLUDE rocm-config
-### RPM external hiprand %{rocm_version}
+### RPM external hiprand %{rocm_version_num}
Requires: rocrand comgr
## INCLUDE rocm-libraries-build-new
diff --git a/hipsolver.spec b/hipsolver.spec
index 56b23fb884c..19775a87985 100644
--- a/hipsolver.spec
+++ b/hipsolver.spec
@@ -1,4 +1,4 @@
## INCLUDE rocm-config
-### RPM external hipsolver %{rocm_version}
+### RPM external hipsolver %{rocm_version_num}
Requires: rocblas rocsparse rocr-runtime rocsolver
## INCLUDE rocm-libraries-build-new
diff --git a/hipsparse.spec b/hipsparse.spec
index bc9210391ba..aaa341246ad 100644
--- a/hipsparse.spec
+++ b/hipsparse.spec
@@ -1,4 +1,4 @@
## INCLUDE rocm-config
-### RPM external hipsparse %{rocm_version}
+### RPM external hipsparse %{rocm_version_num}
Requires: rocprim rocsparse
## INCLUDE rocm-libraries-build-new
diff --git a/hipsparselt.spec b/hipsparselt.spec
index 335971c4b5e..bc5b2c8303d 100644
--- a/hipsparselt.spec
+++ b/hipsparselt.spec
@@ -1,5 +1,5 @@
## INCLUDE rocm-config
-### RPM external hipsparselt %{rocm_version}
+### RPM external hipsparselt %{rocm_version_num}
Source0: https://github.com/ROCm/rocm-libraries/archive/refs/tags/%{rocm_version}.tar.gz
Requires: hipsparse msgpack-cxx rocm-core rocm-smi-lib rocminfo roctracer rocr-runtime rocm-cmake boost
Requires: py3-joblib py3-PyYAML py3-msgpack py3-packaging rocm-llvm python3 comgr
diff --git a/miopen.spec b/miopen.spec
index 0ea96f6ecbf..5f9a16755ec 100644
--- a/miopen.spec
+++ b/miopen.spec
@@ -1,5 +1,5 @@
## INCLUDE rocm-config
-### RPM external miopen %{rocm_version}
+### RPM external miopen %{rocm_version_num}
Source0: https://github.com/ROCm/rocm-libraries/archive/refs/tags/%{rocm_version}.tar.gz
Source1: https://raw.githubusercontent.com/suruoxi/half/refs/heads/master/include/half.hpp
Requires: hip rocm-core rocm-cmake rocr-runtime rocminfo python3 roctracer sqlite hipblaslt hipblas rocblas rocrand bz2lib hipblas
diff --git a/pip/orjson.file b/pip/orjson.file
index 4e18af03f52..4f7fb83c907 100644
--- a/pip/orjson.file
+++ b/pip/orjson.file
@@ -1,2 +1,2 @@
-Requires: py3-maturin py3-puccinialin rust py3-tomli
+BuildRequires: py3-maturin py3-puccinialin rust py3-tomli
%define PipPreBuild export CARGO_HOME=%{_tmppath}/cargo_home
diff --git a/pip/pymongo.file b/pip/pymongo.file
index 5c5355a6bc3..082c115f21b 100644
--- a/pip/pymongo.file
+++ b/pip/pymongo.file
@@ -1,2 +1,3 @@
-Requires: py3-hatchling py3-dnspython rust py3-cargo py3-hatch-requirements-txt
+BuildRequires: py3-hatchling py3-hatch-requirements-txt
+Requires: py3-dnspython
%define PipPreBuild export CARGO_HOME=%{_tmppath}/cargo_home
diff --git a/pip/uv.file b/pip/uv.file
index a653192d920..c38725a0e03 100644
--- a/pip/uv.file
+++ b/pip/uv.file
@@ -1,2 +1,3 @@
Provides: libbz2.so.1()(64bit)
-Requires: py3-maturin py3-puccinialin py3-cargo bz2lib
+Requires: bz2lib
+BuildRequires: py3-maturin py3-cargo
diff --git a/rocfft.spec b/rocfft.spec
index 61c6894e987..3ed0c2dd9fe 100644
--- a/rocfft.spec
+++ b/rocfft.spec
@@ -1,5 +1,5 @@
## INCLUDE rocm-config
-### RPM external rocfft %{rocm_version}
+### RPM external rocfft %{rocm_version_num}
Requires: hiprand rocm-llvm
Requires: hip rocm-core rocm-llvm rocr-runtime rocm-cmake comgr
%define cmake_args -DROCFFT_BUILD_OFFLINE_TUNER=OFF -DROCFFT_KERNEL_CACHE_ENABLE=OFF
diff --git a/rocm-llvm.spec b/rocm-llvm.spec
index 254c5b3fb4e..9c99e3a1bd6 100644
--- a/rocm-llvm.spec
+++ b/rocm-llvm.spec
@@ -8,7 +8,8 @@
Source0: git+https://github.com/ROCm/llvm-project?obj=amd-staging/%{rocm_version}&export=%{n}-%{realversion}&output=/source.tar.gz
Source1: %{rocm_systems_source}
-Requires: cmake ninja rocm-core rocm-cmake libxml2 zlib rocprofiler-register
+BuildRequires: cmake
+Requires: ninja rocm-core rocm-cmake libxml2 zlib rocprofiler-register
%prep
%setup -q -n %{n}-%{realversion}
diff --git a/rocm-offload.spec b/rocm-offload.spec
index 3a3a48af645..e995be45f86 100644
--- a/rocm-offload.spec
+++ b/rocm-offload.spec
@@ -1,8 +1,8 @@
### RPM external rocm-offload 7.10
Source0: https://github.com/ROCm/llvm-project/archive/refs/tags/therock-7.10.tar.gz
-
-Requires: rocm-core python3 cmake rocm-llvm rocr-runtime
+BuildRequires: cmake
+Requires: rocm-core python3 rocm-llvm rocr-runtime
%prep
%setup -q -n llvm-project-therock-%{realversion}
diff --git a/rocprim.spec b/rocprim.spec
index f9603ffc665..7ff7d903158 100644
--- a/rocprim.spec
+++ b/rocprim.spec
@@ -1,4 +1,4 @@
## INCLUDE rocm-config
-### RPM external rocprim %{rocm_version}
+### RPM external rocprim %{rocm_version_num}
Requires: rocm-core comgr
## INCLUDE rocm-libraries-build-new
diff --git a/rocprofiler-compute.spec b/rocprofiler-compute.spec
index 3b858981163..1187ea01ea7 100644
--- a/rocprofiler-compute.spec
+++ b/rocprofiler-compute.spec
@@ -1,7 +1,8 @@
## INCLUDE rocm-config
### RPM external rocprofiler-compute %{rocm_version_num}
Source: %{rocm_systems_source}
-Requires: rocm-core rocm-llvm rocr-runtime python3 cmake rocm-cmake rocprofiler roctracer hip libxml2 rocm-rocprofiler-sdk
+BuildRequires: cmake
+Requires: rocm-core rocm-llvm rocr-runtime python3 rocm-cmake rocprofiler roctracer hip libxml2 rocm-rocprofiler-sdk
Requires: py3-astunparse py3-colorlover py3-kaleido py3-matplotlib
Requires: py3-numpy py3-pandas py3-pandas
Requires: py3-plotext py3-plotille py3-pymongo
diff --git a/rocprofiler.spec b/rocprofiler.spec
index 9ae97c85e6b..26f7d29391f 100644
--- a/rocprofiler.spec
+++ b/rocprofiler.spec
@@ -2,7 +2,8 @@
### RPM external rocprofiler %{rocm_version_num}
Source: %{rocm_systems_source}
#Source1: https://github.com/google/perfetto/archive/eb5ef24c58d13cec289d733d03f0f3f0ed321b12.tar.gz
-Requires: rocm-core rocr-runtime python3 rocm-cmake aqlprofile hip numactl libxml2 roctracer py3-lxml py3-barectf py3-PyYAML comgr
+BuildRequires: py3-barectf
+Requires: rocm-core rocr-runtime python3 rocm-cmake aqlprofile hip numactl libxml2 roctracer py3-lxml py3-PyYAML comgr
%prep
%setup -q -n rocm-systems
diff --git a/rocrand.spec b/rocrand.spec
index 2e13987d0cc..c736a0008d9 100644
--- a/rocrand.spec
+++ b/rocrand.spec
@@ -1,4 +1,4 @@
## INCLUDE rocm-config
Requires: comgr
-### RPM external rocrand %{rocm_version}
+### RPM external rocrand %{rocm_version_num}
## INCLUDE rocm-libraries-build-new
diff --git a/rocsolver.spec b/rocsolver.spec
index 712abe3d995..8d69e9c3209 100644
--- a/rocsolver.spec
+++ b/rocsolver.spec
@@ -1,4 +1,4 @@
## INCLUDE rocm-config
-### RPM external rocsolver %{rocm_version}
+### RPM external rocsolver %{rocm_version_num}
Requires: hip rocblas rocsparse fmt rocprim
## INCLUDE rocm-libraries-build-new
diff --git a/rocsparse.spec b/rocsparse.spec
index df23c885dce..206f3f1d1e9 100644
--- a/rocsparse.spec
+++ b/rocsparse.spec
@@ -1,5 +1,5 @@
## INCLUDE rocm-config
-### RPM external rocsparse %{rocm_version}
+### RPM external rocsparse %{rocm_version_num}
## INCLUDE rocm-config
Source0: https://github.com/ROCm/rocSPARSE/archive/refs/tags/rocm-%{rocm_version_num}.tar.gz
Requires: rocprim rocblas
diff --git a/rocthrust.spec b/rocthrust.spec
index 62746e3d723..dfb97d3a7d9 100644
--- a/rocthrust.spec
+++ b/rocthrust.spec
@@ -1,4 +1,4 @@
## INCLUDE rocm-config
-### RPM external rocthrust %{rocm_version}
+### RPM external rocthrust %{rocm_version_num}
Requires: rocprim
## INCLUDE rocm-libraries-build-new
From 53949d1298c8adf599f09920f4198e59299b34af Mon Sep 17 00:00:00 2001
From: Cms Build
Date: Wed, 10 Jun 2026 21:29:17 +0200
Subject: [PATCH 3/3] Clean some spec files
---
hipsparselt.spec | 6 +++---
miopen.spec | 8 ++++----
rocprofiler.spec | 2 +-
roctracer.spec | 1 +
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/hipsparselt.spec b/hipsparselt.spec
index bc5b2c8303d..82604b0cc5e 100644
--- a/hipsparselt.spec
+++ b/hipsparselt.spec
@@ -1,16 +1,16 @@
## INCLUDE rocm-config
### RPM external hipsparselt %{rocm_version_num}
-Source0: https://github.com/ROCm/rocm-libraries/archive/refs/tags/%{rocm_version}.tar.gz
+Source0: %{rocm_libraries_source}
Requires: hipsparse msgpack-cxx rocm-core rocm-smi-lib rocminfo roctracer rocr-runtime rocm-cmake boost
Requires: py3-joblib py3-PyYAML py3-msgpack py3-packaging rocm-llvm python3 comgr
%prep
-%setup -q -n rocm-libraries-%{realversion}
+%setup -q -n rocm-libraries
%build
CMAKE_ARGS=(
-B %{_builddir}/build
- -S %{_builddir}/rocm-libraries-%{realversion}/projects/%{n}
+ -S %{_builddir}/rocm-libraries/projects/%{n}
-DCMAKE_CXX_COMPILER=${ROCM_LLVM_ROOT}/lib/llvm/bin/clang++
-DCMAKE_INSTALL_PREFIX=%{i}
-DCMAKE_PREFIX_PATH="%{cmake_prefix_path}"
diff --git a/miopen.spec b/miopen.spec
index 5f9a16755ec..f87e0a03d07 100644
--- a/miopen.spec
+++ b/miopen.spec
@@ -1,12 +1,12 @@
## INCLUDE rocm-config
### RPM external miopen %{rocm_version_num}
-Source0: https://github.com/ROCm/rocm-libraries/archive/refs/tags/%{rocm_version}.tar.gz
+Source0: %{rocm_libraries_source}
Source1: https://raw.githubusercontent.com/suruoxi/half/refs/heads/master/include/half.hpp
Requires: hip rocm-core rocm-cmake rocr-runtime rocminfo python3 roctracer sqlite hipblaslt hipblas rocblas rocrand bz2lib hipblas
Requires: json hipblas-common boost zstd google-test opencl rocm-llvm comgr
%prep
-%setup -q -n rocm-libraries-%{realversion}
+%setup -q -n rocm-libraries
cp %{_sourcedir}/half.hpp %{_builddir}
%build
@@ -15,7 +15,7 @@ cp %{_sourcedir}/half.hpp %{_builddir}/half-include/half/
CMAKE_ARGS=(
-B %{_builddir}/build
- -S %{_builddir}/rocm-libraries-%{realversion}/projects/%{n}
+ -S %{_builddir}/rocm-libraries/projects/%{n}
-DCMAKE_CXX_COMPILER=${ROCM_LLVM_ROOT}/bin/amdclang++
-DCMAKE_INSTALL_PREFIX=%{i}
-DCMAKE_PREFIX_PATH="%{cmake_prefix_path}"
@@ -32,7 +32,7 @@ CMAKE_ARGS=(
-DHALF_INCLUDE_DIR=%{_builddir}/half-include
-DBUILD_TESTING=OFF
)
-sed -i '827,830d' %{_builddir}/rocm-libraries-%{realversion}/projects/%{n}/CMakeLists.txt
+sed -i '827,830d' %{_builddir}/rocm-libraries/projects/%{n}/CMakeLists.txt
cmake "${CMAKE_ARGS[@]}"
make -C %{_builddir}/build %{makeprocesses}
diff --git a/rocprofiler.spec b/rocprofiler.spec
index 26f7d29391f..db4c05ae085 100644
--- a/rocprofiler.spec
+++ b/rocprofiler.spec
@@ -2,7 +2,7 @@
### RPM external rocprofiler %{rocm_version_num}
Source: %{rocm_systems_source}
#Source1: https://github.com/google/perfetto/archive/eb5ef24c58d13cec289d733d03f0f3f0ed321b12.tar.gz
-BuildRequires: py3-barectf
+BuildRequires: py3-barectf py3-CppHeaderParser
Requires: rocm-core rocr-runtime python3 rocm-cmake aqlprofile hip numactl libxml2 roctracer py3-lxml py3-PyYAML comgr
%prep
diff --git a/roctracer.spec b/roctracer.spec
index 1536c19af53..cd3c8ef3b8c 100644
--- a/roctracer.spec
+++ b/roctracer.spec
@@ -2,6 +2,7 @@
### RPM external roctracer %{rocm_version_num}
Source: %{rocm_systems_source}
Requires: rocr-runtime hip comgr
+BuildRequires: py3-CppHeaderParser
%prep
%setup -q -n rocm-systems