From ec583b0435e040155d9f0d4e11ac231cb801432c Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Thu, 21 Aug 2025 07:25:51 -0700 Subject: [PATCH 01/14] Disable aarch64 on EPEL Signed-off-by: Tom Rix --- python-torch.spec | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python-torch.spec b/python-torch.spec index 6034593..de807e5 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -114,7 +114,14 @@ Patch11: 0001-Add-cmake-variable-USE_ROCM_CK.patch # Patch12: 0001-Use-horrible-dynamo-stub.patch Patch12: 0001-Fix-compilation-and-import-torch-issues-for-cpython-.patch -ExclusiveArch: x86_64 aarch64 +# 2.8 has this problem on aarch64 +# /builddir/build/BUILD/pytorch-v2.8.0/c10/util/FunctionRef.h:45:3: error: unrecognizable insn: +# (insn 3196 3195 3197 78 (set (reg:VNx8BF 1368 [ _494 ]) +# (unspec:VNx8BF [ +# (reg:VNx8BF 1374) +# (reg:VNx8BF 1375) +# ] UNSPEC_IORF)) "/builddir/build/BUILD/pytorch-v2.8.0/aten/src/ATen/cpu/vec/sve/vec_bfloat16.h":228:31 discrim 1 -1 +ExclusiveArch: x86_64 %global toolchain gcc %global _lto_cflags %nil From 95f1f6fe22c05bf4a53479100fdfbaf48e1e90c3 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 19 Sep 2025 14:37:44 +0200 Subject: [PATCH 02/14] Rebuilt for Python 3.14.0rc3 bytecode From 89daf765fd18ce8d6ecf40a8c6f8fe275c542091 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Fri, 26 Sep 2025 14:24:46 -0700 Subject: [PATCH 03/14] Disable magma Magma is broken on ROCm 7. Signed-off-by: Tom Rix --- python-torch.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python-torch.spec b/python-torch.spec index 6034593..210aee2 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -178,7 +178,8 @@ BuildRequires: hiprand-devel BuildRequires: hipsparse-devel BuildRequires: hipsparselt-devel BuildRequires: hipsolver-devel -BuildRequires: magma-devel +# Magma is broken on ROCm 7 +# BuildRequires: magma-devel BuildRequires: miopen-devel BuildRequires: rocblas-devel BuildRequires: rocrand-devel @@ -607,7 +608,8 @@ export BUILD_TEST=ON export USE_ROCM=ON export USE_ROCM_CK=OFF -export USE_MAGMA=ON +# Magma is broken on ROCm 7 +# export USE_MAGMA=ON export HIP_PATH=`hipconfig -p` export ROCM_PATH=`hipconfig -R` RESOURCE_DIR=`%{rocmllvm_bindir}/clang -print-resource-dir` From f29cac5d83e262d22372de0576f7e89b85abab3e Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Tue, 30 Sep 2025 07:35:43 -0700 Subject: [PATCH 04/14] Update to 2.9.0-rc4 Work around ROCm 7 build issue in 2.8.0 Signed-off-by: Tom Rix --- .gitignore | 1 + python-torch.spec | 34 ++++++++++++++++++++++++++++------ sources | 1 + 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 5fda907..0986c30 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ /kineto-5e75018.tar.gz /pytorch-v2.8.0.tar.gz /v1.18.0.tar.gz +/pytorch-715dca6.tar.gz diff --git a/python-torch.spec b/python-torch.spec index 210aee2..e25a665 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -4,13 +4,13 @@ %global forgeurl https://github.com/pytorch/pytorch # So pre releases can be tried -%bcond_with gitcommit +%bcond_without gitcommit %if %{with gitcommit} -# v2.8.0-rc8 -%global commit0 a1cb3cc05d46d198467bebbb6e8fba50a325d4e7 +# v2.9.0-rc4 +%global commit0 715dca672526a20322d07c2e67772cfe4400a20f %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) -%global date0 20250723 -%global pypi_version 2.8.0 +%global date0 20250923 +%global pypi_version 2.9.0 %global flatbuffers_version 24.12.23 %global miniz_version 3.0.2 %global pybind11_version 2.13.6 @@ -108,11 +108,13 @@ Source80: https://github.com/pytorch/kineto/archive/%{ki_commit}/kineto-%{ Source90: https://github.com/onnx/onnx/archive/refs/tags/v%{ox_ver}.tar.gz %endif +%if %{with gitcommit} +%else # https://github.com/pytorch/pytorch/issues/150187 Patch11: 0001-Add-cmake-variable-USE_ROCM_CK.patch # https://github.com/pytorch/pytorch/issues/156595 -# Patch12: 0001-Use-horrible-dynamo-stub.patch Patch12: 0001-Fix-compilation-and-import-torch-issues-for-cpython-.patch +%endif ExclusiveArch: x86_64 aarch64 %global toolchain gcc @@ -200,6 +202,10 @@ BuildRequires: rocm-smi-devel BuildRequires: rocthrust-devel BuildRequires: roctracer-devel +%if %{with gitcommit} +BuildRequires: moodycamel-concurrentqueue-devel +%endif + Requires: amdsmi %endif @@ -492,6 +498,13 @@ sed -i -e 's@HIP 1.0@HIP MODULE@' cmake/public/LoadHIP.cmake # silence an assert # sed -i -e '/qvalue = std::clamp(qvalue, qmin, qmax);/d' aten/src/ATen/native/cuda/IndexKernel.cu +%endif + +%if %{with gitcommit} +# moodycamel include path needs adjusting to use the system's +sed -i -e 's@${PROJECT_SOURCE_DIR}/third_party/concurrentqueue@/usr/include/concurrentqueue@' cmake/Dependencies.cmake + + %endif %build @@ -607,7 +620,14 @@ export BUILD_TEST=ON %if %{with rocm} export USE_ROCM=ON +%if %{with gitcommit} +export USE_ROCM_CK_SDPA=OFF +export USE_ROCM_CK_GEMM=OFF +export USE_FBGEMM_GENAI=OFF +%else export USE_ROCM_CK=OFF +%endif + # Magma is broken on ROCm 7 # export USE_MAGMA=ON export HIP_PATH=`hipconfig -p` @@ -662,7 +682,9 @@ export PYTORCH_ROCM_ARCH=%{rocm_gpu_list_default} %license LICENSE %doc README.md %{_bindir}/torchrun +%if %{without gitcommit} %{_bindir}/torchfrtrace +%endif %{python3_sitearch}/%{pypi_name}* %{python3_sitearch}/functorch diff --git a/sources b/sources index 5c15ab4..0fdf299 100644 --- a/sources +++ b/sources @@ -12,3 +12,4 @@ SHA512 (v24.12.23.tar.gz) = f97762ba41b9cfef648e93932fd789324c6bb6ebc5b7aeca8185 SHA512 (kineto-5e75018.tar.gz) = 921b96a56e01d69895b79e67582d8977ed6f873573ab41557c5d026ada5d1f6365e4ed0a0c6804057c52e92510749fc58619f554a164c1ba9d8cd13e789bebd0 SHA512 (pytorch-v2.8.0.tar.gz) = 791e658eab87fb957f025558cb9f925078d2426ab7b6f60771d9841dfb691f67d905ba1330a800008efe7c938b6c69bdc52232bccfe8d4860e795a532cd69d28 SHA512 (v1.18.0.tar.gz) = 2f38664947c8d1efc40620a7c1b1953d2aa4b0a37b67c4886b86e77c1d697363c26413413ddda8eabc545892fb1bcb43afc7e93e62f0901527524a2727e1ea8d +SHA512 (pytorch-715dca6.tar.gz) = 09c9aae54fab3eb17901fc3226fece1c13f41cb8e45a2cb066021823abeb8d27c340993088e01d8e55bb37ed5f94334ec31e6c539cddfacbad157abd27c5e907 From 1509cbcd60c545c5b19d00033c4538f6763bf4cc Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 6 Oct 2025 14:27:41 -0700 Subject: [PATCH 05/14] Update to 2.9.0-rc6 aarch64 is not building, so disable. Signed-off-by: Tom Rix --- .gitignore | 1 + pyproject.toml | 139 ++++++++++++++++++++++++++++++++++------------ python-torch.spec | 11 ++-- sources | 1 + 4 files changed, 112 insertions(+), 40 deletions(-) diff --git a/.gitignore b/.gitignore index 0986c30..2918194 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ /pytorch-v2.8.0.tar.gz /v1.18.0.tar.gz /pytorch-715dca6.tar.gz +/pytorch-fd36458.tar.gz diff --git a/pyproject.toml b/pyproject.toml index ccf9c2a..925742b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,49 +1,105 @@ +# Package ###################################################################### + +[build-system] +requires = [ + # 70.1.0: min version for integrated bdist_wheel command from wheel package + # 77.0.0: min version for SPDX expression support for project.license + "setuptools>=70.1.0,<80.0", + "cmake>=3.27", + "ninja", + "numpy", + "packaging", + "pyyaml", + "requests", + "six", # dependency chain: NNPACK -> PeachPy -> six + "typing-extensions>=4.10.0", +] +build-backend = "setuptools.build_meta" + +[dependency-groups] +dev = [ + # This list should be kept in sync with the requirements-build.txt + # in PyTorch root until the project fully migrates to pyproject.toml + # after which this can be removed as it is already specified in the + # [build-system] section + "setuptools>=70.1.0,<80.0", # setuptools develop deprecated on 80.0 + "cmake>=3.27", + "ninja", + "numpy", + "packaging", + "pyyaml", + "requests", + "six", # dependency chain: NNPACK -> PeachPy -> six + "typing-extensions>=4.10.0", + + # This list should be kept in sync with the requirements.txt in + # PyTorch root until the project fully migrates to pyproject.toml + "build[uv]", + "expecttest>=0.3.0", + "filelock", + "fsspec>=0.8.5", + "hypothesis", + "jinja2", + "lintrunner; platform_machine != 's390x' and platform_machine != 'riscv64'", + "networkx>=2.5.1", + "optree>=0.13.0", + "psutil", + "sympy>=1.13.3", + "typing-extensions>=4.13.2", + "wheel", +] + [project] name = "torch" -requires-python = ">=3.9" -license = {text = "BSD-3-Clause"} +description = "Tensors and Dynamic neural networks in Python with strong GPU acceleration" +readme = "README.md" +requires-python = ">=3.10" +# TODO: change to `license = "BSD-3-Clause"` and enable PEP 639 after pinning setuptools>=77 +# FIXME: As of 2025.06.20, it is hard to ensure the minimum version of setuptools in our CI environment. +# TOML-table-based license deprecated in setuptools>=77, and the deprecation warning will be changed +# to an error on 2026.02.18. See also: https://github.com/pypa/setuptools/issues/4903 +license = { text = "BSD-3-Clause" } +authors = [{ name = "PyTorch Team", email = "packages@pytorch.org" }] +keywords = ["pytorch", "machine learning"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Mathematics", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Software Development", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Libraries :: Python Modules", + "Programming Language :: C++", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", +] dynamic = [ - "authors", - "classifiers", "entry-points", "dependencies", - "description", - "keywords", - "optional-dependencies", - "readme", "scripts", "version", ] [project.urls] -Homepage = "https://pytorch.org/" -Documentation = "https://pytorch.org/docs/" -Source = "https://github.com/pytorch/pytorch" -Forum = "https://discuss.pytorch.org/" +Homepage = "https://pytorch.org" +Repository = "https://github.com/pytorch/pytorch" +Documentation = "https://pytorch.org/docs" +"Issue Tracker" = "https://github.com/pytorch/pytorch/issues" +Forum = "https://discuss.pytorch.org" +[project.optional-dependencies] +optree = ["optree>=0.13.0"] +opt-einsum = ["opt-einsum>=3.3"] +pyyaml = ["pyyaml"] -[build-system] -requires = [ - # After 75.8.2 dropped dep disttools API. Please fix - # API temporarily restored and shim used. Please fix - # Setuptools will drop support for setup.py past 80 - # min version for recursive glob package data support - "setuptools>=62.3.0,<80.0", - "wheel", - "astunparse", - "numpy", - "ninja", - "pyyaml", - "cmake", - "typing-extensions>=4.10.0", - "requests", -] -# Use legacy backend to import local packages in setup.py -build-backend = "setuptools.build_meta:__legacy__" - - -[tool.black] -line-length = 88 +# Linter tools ################################################################# [tool.isort] src_paths = ["caffe2", "torch", "torchgen", "functorch", "test"] @@ -59,12 +115,10 @@ multi_line_output = 3 include_trailing_comma = true combine_as_imports = true - [tool.usort.known] first_party = ["caffe2", "torch", "torchgen", "functorch", "test"] standard_library = ["typing_extensions"] - [tool.ruff] line-length = 88 src = ["caffe2", "torch", "torchgen", "functorch", "test"] @@ -105,6 +159,7 @@ ignore = [ "E741", "EXE001", "F405", + "FURB122", # writelines # these ignores are from flake8-logging-format; please fix! "G101", # these ignores are from ruff NPY; please fix! @@ -127,7 +182,15 @@ ignore = [ "SIM117", "SIM118", "UP007", # keep-runtime-typing + "UP045", # keep-runtime-typing "TC006", + # TODO: Remove Python-3.10 specific suppressions + "B905", + "UP035", + "UP036", + "UP038", + "UP041", + "FURB161", ] select = [ "B", @@ -208,6 +271,10 @@ select = [ "YTT", ] +[tool.ruff.lint.pyupgrade] +# Preserve types, even if a file imports `from __future__ import annotations`. +keep-runtime-typing = true + [tool.ruff.lint.per-file-ignores] "__init__.py" = [ "F401", diff --git a/python-torch.spec b/python-torch.spec index e25a665..3dad39d 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -6,14 +6,15 @@ # So pre releases can be tried %bcond_without gitcommit %if %{with gitcommit} -# v2.9.0-rc4 -%global commit0 715dca672526a20322d07c2e67772cfe4400a20f +# v2.9.0-rc6 +%global commit0 fd364580a94079854f2f32d463c118afaefe62e0 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) -%global date0 20250923 +%global date0 20251002 %global pypi_version 2.9.0 %global flatbuffers_version 24.12.23 %global miniz_version 3.0.2 %global pybind11_version 2.13.6 +%global rc_tag -rc6 %else %global pypi_version 2.8.0 %global flatbuffers_version 24.12.23 @@ -116,7 +117,9 @@ Patch11: 0001-Add-cmake-variable-USE_ROCM_CK.patch Patch12: 0001-Fix-compilation-and-import-torch-issues-for-cpython-.patch %endif -ExclusiveArch: x86_64 aarch64 +# ExclusiveArch: x86_64 aarch64 +# aarch64 not building on 2.9.0-rc6 +ExclusiveArch: x86_64 %global toolchain gcc %global _lto_cflags %nil diff --git a/sources b/sources index 0fdf299..701e6b4 100644 --- a/sources +++ b/sources @@ -13,3 +13,4 @@ SHA512 (kineto-5e75018.tar.gz) = 921b96a56e01d69895b79e67582d8977ed6f873573ab415 SHA512 (pytorch-v2.8.0.tar.gz) = 791e658eab87fb957f025558cb9f925078d2426ab7b6f60771d9841dfb691f67d905ba1330a800008efe7c938b6c69bdc52232bccfe8d4860e795a532cd69d28 SHA512 (v1.18.0.tar.gz) = 2f38664947c8d1efc40620a7c1b1953d2aa4b0a37b67c4886b86e77c1d697363c26413413ddda8eabc545892fb1bcb43afc7e93e62f0901527524a2727e1ea8d SHA512 (pytorch-715dca6.tar.gz) = 09c9aae54fab3eb17901fc3226fece1c13f41cb8e45a2cb066021823abeb8d27c340993088e01d8e55bb37ed5f94334ec31e6c539cddfacbad157abd27c5e907 +SHA512 (pytorch-fd36458.tar.gz) = acbb7475b92ad4a8e8d779f3745da22d8438e4c5ef2d6e76d71c987789f2752c8aef7022c87c9a74640fe4f9c1f1a61a3f12a796f63b1e6be24da8e5aacf37dc From b615a5f89b4a35fc47b600ed1c75ebd5e3a21863 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 13 Oct 2025 10:17:32 -0700 Subject: [PATCH 06/14] Update to 2.9.0-rc9 Introduce pytorch-rpm-macros package. Add %pytorch_arches to the macros, set to aarch64 and x86_64 Signed-off-by: Tom Rix --- .gitignore | 1 + python-torch.spec | 43 ++++++++++++++++++++++++++++++++----------- sources | 1 + 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 2918194..2dab732 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ /v1.18.0.tar.gz /pytorch-715dca6.tar.gz /pytorch-fd36458.tar.gz +/pytorch-0fabc3b.tar.gz diff --git a/python-torch.spec b/python-torch.spec index 3dad39d..f7f7f0c 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -6,15 +6,15 @@ # So pre releases can be tried %bcond_without gitcommit %if %{with gitcommit} -# v2.9.0-rc6 -%global commit0 fd364580a94079854f2f32d463c118afaefe62e0 +# v2.9.0-rc9 +%global commit0 0fabc3ba44823f257e70ce397d989c8de5e362c1 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) -%global date0 20251002 +%global date0 20251008 %global pypi_version 2.9.0 %global flatbuffers_version 24.12.23 %global miniz_version 3.0.2 %global pybind11_version 2.13.6 -%global rc_tag -rc6 +%global rc_tag -rc9 %else %global pypi_version 2.8.0 %global flatbuffers_version 24.12.23 @@ -117,9 +117,13 @@ Patch11: 0001-Add-cmake-variable-USE_ROCM_CK.patch Patch12: 0001-Fix-compilation-and-import-torch-issues-for-cpython-.patch %endif -# ExclusiveArch: x86_64 aarch64 -# aarch64 not building on 2.9.0-rc6 -ExclusiveArch: x86_64 +%if 0%{?fedora} >= 45 +# drop aarch64 in 45 +%global pt_arches x86_64 +%else +%global pt_arches x86_64 aarch64 +%endif +ExclusiveArch: %pt_arches %global toolchain gcc %global _lto_cflags %nil @@ -137,6 +141,9 @@ BuildRequires: gloo-devel BuildRequires: json-devel BuildRequires: libomp-devel +%if %{with gitcommit} +BuildRequires: moodycamel-concurrentqueue-devel +%endif BuildRequires: numactl-devel BuildRequires: ninja-build %if %{with onnx} @@ -205,10 +212,6 @@ BuildRequires: rocm-smi-devel BuildRequires: rocthrust-devel BuildRequires: roctracer-devel -%if %{with gitcommit} -BuildRequires: moodycamel-concurrentqueue-devel -%endif - Requires: amdsmi %endif @@ -261,6 +264,14 @@ PyTorch is a Python package that provides two high-level features: You can reuse your favorite Python packages such as NumPy, SciPy, and Cython to extend PyTorch when needed. +%package -n pytorch-rpm-macros +Summary: PyTorch RPM macros +BuildArch: noarch + +%description -n pytorch-rpm-macros +This package contains PyTorch related RPM macros. + + %if %{with test} %package -n python3-%{pypi_name}-test Summary: Tests for %{name} @@ -512,6 +523,9 @@ sed -i -e 's@${PROJECT_SOURCE_DIR}/third_party/concurrentqueue@/usr/include/conc %build +# Export the arches +echo "%%pytorch_arches %pt_arches" > macros.pytorch + # # Control the number of jobs # @@ -653,6 +667,10 @@ export PYTORCH_ROCM_ARCH=%{rocm_gpu_list_default} %install +# pytorch rpm macros +install -Dpm 644 macros.pytorch \ + %{buildroot}%{_rpmmacrodir}/macros.pytorch + %if %{with rocm} export USE_ROCM=ON export USE_ROCM_CK=OFF @@ -691,6 +709,9 @@ export PYTORCH_ROCM_ARCH=%{rocm_gpu_list_default} %{python3_sitearch}/%{pypi_name}* %{python3_sitearch}/functorch +%files -n pytorch-rpm-macros +%{_rpmmacrodir}/macros.pytorch + %changelog %autochangelog diff --git a/sources b/sources index 701e6b4..89e2a95 100644 --- a/sources +++ b/sources @@ -14,3 +14,4 @@ SHA512 (pytorch-v2.8.0.tar.gz) = 791e658eab87fb957f025558cb9f925078d2426ab7b6f60 SHA512 (v1.18.0.tar.gz) = 2f38664947c8d1efc40620a7c1b1953d2aa4b0a37b67c4886b86e77c1d697363c26413413ddda8eabc545892fb1bcb43afc7e93e62f0901527524a2727e1ea8d SHA512 (pytorch-715dca6.tar.gz) = 09c9aae54fab3eb17901fc3226fece1c13f41cb8e45a2cb066021823abeb8d27c340993088e01d8e55bb37ed5f94334ec31e6c539cddfacbad157abd27c5e907 SHA512 (pytorch-fd36458.tar.gz) = acbb7475b92ad4a8e8d779f3745da22d8438e4c5ef2d6e76d71c987789f2752c8aef7022c87c9a74640fe4f9c1f1a61a3f12a796f63b1e6be24da8e5aacf37dc +SHA512 (pytorch-0fabc3b.tar.gz) = 2e87975de0bf6f3dcede168b379e1928712bca16170c2a8ee7d63459f53086c01baac05e0763e4d5d28cdaf1c7d8912225ee06adeff96ead4f6f456ee174b341 From ef01976cf4687ab7bce860c23297cf9b6d105940 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Wed, 15 Oct 2025 16:27:01 -0700 Subject: [PATCH 07/14] Update to 2.9.0 Signed-off-by: Tom Rix --- .gitignore | 1 + python-torch.spec | 25 ++----------------------- sources | 1 + 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 2dab732..444b9ca 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ /pytorch-715dca6.tar.gz /pytorch-fd36458.tar.gz /pytorch-0fabc3b.tar.gz +/pytorch-v2.9.0.tar.gz diff --git a/python-torch.spec b/python-torch.spec index f7f7f0c..0fd7ebd 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -4,7 +4,7 @@ %global forgeurl https://github.com/pytorch/pytorch # So pre releases can be tried -%bcond_without gitcommit +%bcond_with gitcommit %if %{with gitcommit} # v2.9.0-rc9 %global commit0 0fabc3ba44823f257e70ce397d989c8de5e362c1 @@ -16,7 +16,7 @@ %global pybind11_version 2.13.6 %global rc_tag -rc9 %else -%global pypi_version 2.8.0 +%global pypi_version 2.9.0 %global flatbuffers_version 24.12.23 %global miniz_version 3.0.2 %global pybind11_version 2.13.6 @@ -109,14 +109,6 @@ Source80: https://github.com/pytorch/kineto/archive/%{ki_commit}/kineto-%{ Source90: https://github.com/onnx/onnx/archive/refs/tags/v%{ox_ver}.tar.gz %endif -%if %{with gitcommit} -%else -# https://github.com/pytorch/pytorch/issues/150187 -Patch11: 0001-Add-cmake-variable-USE_ROCM_CK.patch -# https://github.com/pytorch/pytorch/issues/156595 -Patch12: 0001-Fix-compilation-and-import-torch-issues-for-cpython-.patch -%endif - %if 0%{?fedora} >= 45 # drop aarch64 in 45 %global pt_arches x86_64 @@ -141,9 +133,7 @@ BuildRequires: gloo-devel BuildRequires: json-devel BuildRequires: libomp-devel -%if %{with gitcommit} BuildRequires: moodycamel-concurrentqueue-devel -%endif BuildRequires: numactl-devel BuildRequires: ninja-build %if %{with onnx} @@ -514,13 +504,9 @@ sed -i -e 's@HIP 1.0@HIP MODULE@' cmake/public/LoadHIP.cmake %endif -%if %{with gitcommit} # moodycamel include path needs adjusting to use the system's sed -i -e 's@${PROJECT_SOURCE_DIR}/third_party/concurrentqueue@/usr/include/concurrentqueue@' cmake/Dependencies.cmake - -%endif - %build # Export the arches @@ -637,13 +623,9 @@ export BUILD_TEST=ON %if %{with rocm} export USE_ROCM=ON -%if %{with gitcommit} export USE_ROCM_CK_SDPA=OFF export USE_ROCM_CK_GEMM=OFF export USE_FBGEMM_GENAI=OFF -%else -export USE_ROCM_CK=OFF -%endif # Magma is broken on ROCm 7 # export USE_MAGMA=ON @@ -703,9 +685,6 @@ export PYTORCH_ROCM_ARCH=%{rocm_gpu_list_default} %license LICENSE %doc README.md %{_bindir}/torchrun -%if %{without gitcommit} -%{_bindir}/torchfrtrace -%endif %{python3_sitearch}/%{pypi_name}* %{python3_sitearch}/functorch diff --git a/sources b/sources index 89e2a95..05c1f96 100644 --- a/sources +++ b/sources @@ -15,3 +15,4 @@ SHA512 (v1.18.0.tar.gz) = 2f38664947c8d1efc40620a7c1b1953d2aa4b0a37b67c4886b86e7 SHA512 (pytorch-715dca6.tar.gz) = 09c9aae54fab3eb17901fc3226fece1c13f41cb8e45a2cb066021823abeb8d27c340993088e01d8e55bb37ed5f94334ec31e6c539cddfacbad157abd27c5e907 SHA512 (pytorch-fd36458.tar.gz) = acbb7475b92ad4a8e8d779f3745da22d8438e4c5ef2d6e76d71c987789f2752c8aef7022c87c9a74640fe4f9c1f1a61a3f12a796f63b1e6be24da8e5aacf37dc SHA512 (pytorch-0fabc3b.tar.gz) = 2e87975de0bf6f3dcede168b379e1928712bca16170c2a8ee7d63459f53086c01baac05e0763e4d5d28cdaf1c7d8912225ee06adeff96ead4f6f456ee174b341 +SHA512 (pytorch-v2.9.0.tar.gz) = ae989e3a7fe30f9ea90944dc25e21ca92f2a94ee40d8de974a168c292d82c16ee8920624eff91a85755469ad05473dce0f85893e3ed7794ec5c6bdd89cbd2023 From 741c412249afb0dabfb37cdc6f3bbd05ce3ec176 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Fri, 17 Oct 2025 10:05:50 -0700 Subject: [PATCH 08/14] Remove pytorch-rpm-macros package. This does not work when building on a general arch Signed-off-by: Tom Rix --- python-torch.spec | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/python-torch.spec b/python-torch.spec index 0fd7ebd..b623dc6 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -254,14 +254,6 @@ PyTorch is a Python package that provides two high-level features: You can reuse your favorite Python packages such as NumPy, SciPy, and Cython to extend PyTorch when needed. -%package -n pytorch-rpm-macros -Summary: PyTorch RPM macros -BuildArch: noarch - -%description -n pytorch-rpm-macros -This package contains PyTorch related RPM macros. - - %if %{with test} %package -n python3-%{pypi_name}-test Summary: Tests for %{name} @@ -510,7 +502,7 @@ sed -i -e 's@${PROJECT_SOURCE_DIR}/third_party/concurrentqueue@/usr/include/conc %build # Export the arches -echo "%%pytorch_arches %pt_arches" > macros.pytorch +# echo "%%pytorch_arches %pt_arches" > macros.pytorch # # Control the number of jobs @@ -650,8 +642,8 @@ export PYTORCH_ROCM_ARCH=%{rocm_gpu_list_default} %install # pytorch rpm macros -install -Dpm 644 macros.pytorch \ - %{buildroot}%{_rpmmacrodir}/macros.pytorch +# install -Dpm 644 macros.pytorch \ +# %{buildroot}%{_rpmmacrodir}/macros.pytorch %if %{with rocm} export USE_ROCM=ON @@ -688,9 +680,6 @@ export PYTORCH_ROCM_ARCH=%{rocm_gpu_list_default} %{python3_sitearch}/%{pypi_name}* %{python3_sitearch}/functorch -%files -n pytorch-rpm-macros -%{_rpmmacrodir}/macros.pytorch - %changelog %autochangelog From e0030b3ec55af789d1db27c223bb58a4c102498b Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 17 Nov 2025 14:11:32 -0800 Subject: [PATCH 09/14] Rebuild for ROCm 7.1 Signed-off-by: Tom Rix From b3977567d226ae906a3f253b8e782d47373dd578 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 24 Nov 2025 07:03:31 -0800 Subject: [PATCH 10/14] Always include onnx src Signed-off-by: Tom Rix --- python-torch.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/python-torch.spec b/python-torch.spec index b623dc6..7bd82df 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -104,10 +104,8 @@ Source70: https://github.com/yhirose/cpp-httplib/archive/%{hl_commit}/cpp- Source80: https://github.com/pytorch/kineto/archive/%{ki_commit}/kineto-%{ki_scommit}.tar.gz %endif -%if %{without onnx} %global ox_ver 1.18.0 Source90: https://github.com/onnx/onnx/archive/refs/tags/v%{ox_ver}.tar.gz -%endif %if 0%{?fedora} >= 45 # drop aarch64 in 45 From 7908450a47cf1c4210b8ab7ab0132587580e1d72 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Thu, 18 Dec 2025 13:52:00 -0800 Subject: [PATCH 11/14] Update to 2.9.1 Signed-off-by: Tom Rix --- .gitignore | 1 + python-torch.spec | 2 +- sources | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 444b9ca..c424df5 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ /pytorch-fd36458.tar.gz /pytorch-0fabc3b.tar.gz /pytorch-v2.9.0.tar.gz +/pytorch-v2.9.1.tar.gz diff --git a/python-torch.spec b/python-torch.spec index 7bd82df..e493b97 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -16,7 +16,7 @@ %global pybind11_version 2.13.6 %global rc_tag -rc9 %else -%global pypi_version 2.9.0 +%global pypi_version 2.9.1 %global flatbuffers_version 24.12.23 %global miniz_version 3.0.2 %global pybind11_version 2.13.6 diff --git a/sources b/sources index 05c1f96..9a3681f 100644 --- a/sources +++ b/sources @@ -16,3 +16,4 @@ SHA512 (pytorch-715dca6.tar.gz) = 09c9aae54fab3eb17901fc3226fece1c13f41cb8e45a2c SHA512 (pytorch-fd36458.tar.gz) = acbb7475b92ad4a8e8d779f3745da22d8438e4c5ef2d6e76d71c987789f2752c8aef7022c87c9a74640fe4f9c1f1a61a3f12a796f63b1e6be24da8e5aacf37dc SHA512 (pytorch-0fabc3b.tar.gz) = 2e87975de0bf6f3dcede168b379e1928712bca16170c2a8ee7d63459f53086c01baac05e0763e4d5d28cdaf1c7d8912225ee06adeff96ead4f6f456ee174b341 SHA512 (pytorch-v2.9.0.tar.gz) = ae989e3a7fe30f9ea90944dc25e21ca92f2a94ee40d8de974a168c292d82c16ee8920624eff91a85755469ad05473dce0f85893e3ed7794ec5c6bdd89cbd2023 +SHA512 (pytorch-v2.9.1.tar.gz) = 88de0289fa2760abd69bef505b5ae3b6d7ff176b415cbb31bbc89ce5476a3800b322a97c4490f270f8b89657aff931bf9a5516202b268e0bb8b1f63dbb87b34a From 7ddebb112b1931a495e78fba092b77e4f91022df Mon Sep 17 00:00:00 2001 From: "Alexander F. Lent" Date: Thu, 18 Dec 2025 09:08:09 -0500 Subject: [PATCH 12/14] Improve build times on non-x86 systems Signed-off-by: Alexander F. Lent --- python-torch.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python-torch.spec b/python-torch.spec index e493b97..abacce9 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -506,10 +506,15 @@ sed -i -e 's@${PROJECT_SOURCE_DIR}/third_party/concurrentqueue@/usr/include/conc # Control the number of jobs # # The build can fail if too many threads exceed the physical memory -# So count core and and memory and increase the build memory util the build succeeds +# Run at least one thread, more if CPU & memory resources are available. # +%ifarch x86_64 # Real cores, No hyperthreading COMPILE_JOBS=`cat /proc/cpuinfo | grep -m 1 'cpu cores' | awk '{ print $4 }'` +%else +# cpuinfo format varies on other arches, fall back to nproc +COMPILE_JOBS=`nproc` +%endif if [ ${COMPILE_JOBS}x = x ]; then COMPILE_JOBS=1 fi From 767d576d1df8b3041f11c86243bcf3503a6d559a Mon Sep 17 00:00:00 2001 From: "Alexander F. Lent" Date: Sat, 20 Dec 2025 21:24:48 -0500 Subject: [PATCH 13/14] Continue to support aarch64 with myself maintaining Signed-off-by: Alexander F. Lent --- python-torch.spec | 5 ----- 1 file changed, 5 deletions(-) diff --git a/python-torch.spec b/python-torch.spec index abacce9..640adb3 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -107,12 +107,7 @@ Source80: https://github.com/pytorch/kineto/archive/%{ki_commit}/kineto-%{ %global ox_ver 1.18.0 Source90: https://github.com/onnx/onnx/archive/refs/tags/v%{ox_ver}.tar.gz -%if 0%{?fedora} >= 45 -# drop aarch64 in 45 -%global pt_arches x86_64 -%else %global pt_arches x86_64 aarch64 -%endif ExclusiveArch: %pt_arches %global toolchain gcc %global _lto_cflags %nil From 294accd75d5a894c11d48bbea7a5d2dd70bebd15 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 12 Jan 2026 16:38:15 -0800 Subject: [PATCH 14/14] Fix hip device lib path is no longer needed Signed-off-by: Tom Rix --- python-torch.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python-torch.spec b/python-torch.spec index 640adb3..d3c31d7 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -621,8 +621,8 @@ export USE_FBGEMM_GENAI=OFF # export USE_MAGMA=ON export HIP_PATH=`hipconfig -p` export ROCM_PATH=`hipconfig -R` -RESOURCE_DIR=`%{rocmllvm_bindir}/clang -print-resource-dir` -export DEVICE_LIB_PATH=${RESOURCE_DIR}/amdgcn/bitcode +#RESOURCE_DIR=`%{rocmllvm_bindir}/clang -print-resource-dir` +#export DEVICE_LIB_PATH=${RESOURCE_DIR}/amdgcn/bitcode # pytorch uses clang, not hipcc export HIP_CLANG_PATH=%{rocmllvm_bindir} @@ -648,8 +648,8 @@ export USE_ROCM=ON export USE_ROCM_CK=OFF export HIP_PATH=`hipconfig -p` export ROCM_PATH=`hipconfig -R` -RESOURCE_DIR=`%{rocmllvm_bindir}/clang -print-resource-dir` -export DEVICE_LIB_PATH=${RESOURCE_DIR}/amdgcn/bitcode +# RESOURCE_DIR=`%{rocmllvm_bindir}/clang -print-resource-dir` +# export DEVICE_LIB_PATH=${RESOURCE_DIR}/amdgcn/bitcode # pytorch uses clang, not hipcc export HIP_CLANG_PATH=%{rocmllvm_bindir}