diff --git a/.gitignore b/.gitignore index f21a902..eed0612 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ /kineto-b2103f7.tar.gz /pytorch-v2.12.0.tar.gz /v3.0.1.tar.gz +/pytorch-v2.13.0.tar.gz diff --git a/0001-pytorch-fmt.patch b/0001-pytorch-fmt.patch new file mode 100644 index 0000000..b32ec41 --- /dev/null +++ b/0001-pytorch-fmt.patch @@ -0,0 +1,54 @@ +From afdeb01359eecc67b573bcfb4f164ec81a1c7197 Mon Sep 17 00:00:00 2001 +From: Tom Rix +Date: Mon, 17 Aug 2026 15:59:39 -0700 +Subject: [PATCH] pytorch fmt + +--- + cmake/Dependencies.cmake | 31 ------------------------------- + 1 file changed, 31 deletions(-) + +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index f7f938988c8e..d84eea5f1129 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -1635,37 +1635,6 @@ endif() + # End ATen checks + # + +-# Install `fmtlib` header. +-# This was the default behavior before version 12.0.0. +-# Since PyTorch C API depends on it, make it available for projects that +-# depend on PyTorch. +-set(FMT_INSTALL ON) +-set(TEMP_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) +-set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE) +-add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt) +- +-# Disable compiler feature checks for `fmt`. +-# +-# CMake compiles a little program to check compiler features. Some of our build +-# configurations (notably the mobile build analyzer) will populate +-# CMAKE_CXX_FLAGS in ways that break feature checks. Since we already know +-# `fmt` is compatible with a superset of the compilers that PyTorch is, it +-# shouldn't be too bad to just disable the checks. +-set_target_properties(fmt-header-only PROPERTIES INTERFACE_COMPILE_FEATURES "") +- +-# Keep fmt's header-only type layout stable across mixed C++ modes by forcing +-# one no_unique_address spelling for all translation units. +-if(MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang") +- set(_fmt_no_unique_address "[[msvc::no_unique_address]]") +-else() +- set(_fmt_no_unique_address "[[no_unique_address]]") +-endif() +-target_compile_definitions(fmt PUBLIC "FMT_NO_UNIQUE_ADDRESS=${_fmt_no_unique_address}") +-target_compile_definitions(fmt-header-only INTERFACE "FMT_NO_UNIQUE_ADDRESS=${_fmt_no_unique_address}") +-unset(_fmt_no_unique_address) +- +-list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only) +-set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE) + + # ---[ Kineto + # edge profiler depends on KinetoProfiler but it only does cpu +-- +2.55.0 + diff --git a/0001-pytorch-gloo.patch b/0001-pytorch-gloo.patch new file mode 100644 index 0000000..503cc6d --- /dev/null +++ b/0001-pytorch-gloo.patch @@ -0,0 +1,27 @@ +From 1b1962613916961fade2ddb971c9ceeee74cc5c5 Mon Sep 17 00:00:00 2001 +From: Tom Rix +Date: Mon, 17 Aug 2026 08:16:49 -0700 +Subject: [PATCH] pytorch gloo + +--- + cmake/Dependencies.cmake | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index 81b673aabcd4..f7f938988c8e 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -1277,6 +1277,10 @@ if(USE_GLOO) + if(NOT Gloo_FOUND) + message(FATAL_ERROR "Cannot find gloo") + endif() ++ set(Gloo_INCLUDE_DIRS /usr/include) ++ set(Gloo_NATIVE_LIBRARY /usr/lib64/libgloo.so) ++ set(Gloo_HIP_LIBRARY /usr/lib64/libgloo_hip.so) ++ + message("Found gloo: ${Gloo_NATIVE_LIBRARY}, cuda lib: ${Gloo_CUDA_LIBRARY}, hip lib: ${Gloo_HIP_LIBRARY}") + message("Found gloo include directories: ${Gloo_INCLUDE_DIRS}") + +-- +2.55.0 + diff --git a/0001-pytorch-xnnpack.patch b/0001-pytorch-xnnpack.patch new file mode 100644 index 0000000..03c2852 --- /dev/null +++ b/0001-pytorch-xnnpack.patch @@ -0,0 +1,40 @@ +From ff660e83955efa54188d87c40804d991e31a8618 Mon Sep 17 00:00:00 2001 +From: Tom Rix +Date: Mon, 17 Aug 2026 07:34:20 -0700 +Subject: [PATCH] pytorch xnnpack + +--- + cmake/Dependencies.cmake | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index 2baa187e69ac..81b673aabcd4 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -611,16 +611,18 @@ if(USE_XNNPACK AND NOT USE_SYSTEM_XNNPACK) + list(APPEND Caffe2_DEPENDENCY_LIBS XNNPACK microkernels-prod) + elseif(NOT TARGET XNNPACK AND USE_SYSTEM_XNNPACK) + add_library(XNNPACK SHARED IMPORTED) +- add_library(microkernels-prod SHARED IMPORTED) ++# add_library(microkernels-prod SHARED IMPORTED) + find_library(XNNPACK_LIBRARY XNNPACK) +- find_library(microkernels-prod_LIBRARY microkernels-prod) ++# find_library(microkernels-prod_LIBRARY microkernels-prod) + set_property(TARGET XNNPACK PROPERTY IMPORTED_LOCATION "${XNNPACK_LIBRARY}") +- set_property(TARGET microkernels-prod PROPERTY IMPORTED_LOCATION "${microkernels-prod_LIBRARY}") +- if(NOT XNNPACK_LIBRARY OR NOT microkernels-prod_LIBRARY) ++# set_property(TARGET microkernels-prod PROPERTY IMPORTED_LOCATION "${microkernels-prod_LIBRARY}") ++# if(NOT XNNPACK_LIBRARY OR NOT microkernels-prod_LIBRARY) ++ if(NOT XNNPACK_LIBRARY) + message(FATAL_ERROR "Cannot find XNNPACK") + endif() + message("-- Found XNNPACK: ${XNNPACK_LIBRARY}") +- list(APPEND Caffe2_DEPENDENCY_LIBS XNNPACK microkernels-prod) ++# list(APPEND Caffe2_DEPENDENCY_LIBS XNNPACK microkernels-prod) ++ list(APPEND Caffe2_DEPENDENCY_LIBS XNNPACK) + endif() + + # ---[ Vulkan deps +-- +2.55.0 + diff --git a/python-torch.spec b/python-torch.spec index 72e4a26..a27141b 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -15,7 +15,7 @@ %global miniz_version 3.0.2 %global pybind11_version 3.0.1 %else -%global pypi_version 2.12.0 +%global pypi_version 2.13.0 %global flatbuffers_version 24.12.23 %global miniz_version 3.0.2 %global pybind11_version 3.0.1 @@ -33,7 +33,7 @@ %endif # For testing distributed+rccl etc. -%bcond_with gloo +%bcond_without gloo %bcond_without mpi %bcond_without tensorpipe @@ -51,8 +51,8 @@ # In fedora, not in rhel/epel or requires a newer version %if 0%{?fedora} %bcond_without eigen3 -%bcond_with onnx -%bcond_with protobuf +%bcond_without onnx +%bcond_without protobuf %bcond_with setuptools %bcond_without sympy %else @@ -87,11 +87,15 @@ Patch2: 0001-Fix-struct.pack-polyfill-signature-mismatch-on-Pytho.patch %else Source0: %{forgeurl}/releases/download/v%{version}/pytorch-v%{version}.tar.gz +Patch1: 0001-pytorch-xnnpack.patch +Patch2: 0001-pytorch-gloo.patch +Patch3: 0001-pytorch-fmt.patch + Source1001: inject.py # Problems with python 3.15 -Patch1: 0001-Fix-functools.reduce-polyfill-signature-mismatch-on-.patch -Patch2: 0001-Fix-struct.pack-polyfill-signature-mismatch-on-Pytho.patch +# Patch1: 0001-Fix-functools.reduce-polyfill-signature-mismatch-on-.patch +# Patch2: 0001-Fix-struct.pack-polyfill-signature-mismatch-on-Pytho.patch %endif Source1: https://github.com/google/flatbuffers/archive/refs/tags/v%{flatbuffers_version}.tar.gz @@ -155,13 +159,7 @@ Source120: https://github.com/meta-pytorch/MSLK/archive/%{mslk_commit}/MSL %global pt_arches x86_64 aarch64 ExclusiveArch: %pt_arches -# Switch to clang temporarily on aarch64, GCC 16 + PyTorch 2.9.1 has problems -# See rhbz#2431943 for more info -%ifarch aarch64 -%global toolchain clang -%else %global toolchain gcc -%endif %global _lto_cflags %nil BuildRequires: cmake @@ -196,7 +194,7 @@ BuildRequires: onnx-devel BuildRequires: openmpi-devel %endif %if %{with protobuf} -BuildRequires: protobuf-devel < 4 +BuildRequires: protobuf-devel %endif BuildRequires: sleef-devel BuildRequires: valgrind-devel @@ -208,6 +206,8 @@ BuildRequires: fxdiv-devel BuildRequires: psimd-devel BuildRequires: xnnpack-devel = 0.0^git20240814.312eb7e +BuildRequires: zlib-ng-compat-static + BuildRequires: python3-devel BuildRequires: python3dist(filelock) BuildRequires: python3dist(jinja2) @@ -258,6 +258,7 @@ BuildRequires: rocm-runtime-devel BuildRequires: rocm-rpm-macros BuildRequires: rocsolver-devel BuildRequires: rocm-smi-devel +BuildRequires: rocshmem-devel BuildRequires: rocthrust-devel BuildRequires: roctracer-devel @@ -497,7 +498,7 @@ sed -i -e 's@set(USE_MIMALLOC ON)@set(USE_MIMALLOC OFF)@' CMakeLists.txt mv third_party/miniz-%{miniz_version} . # # setup.py depends on this script -mv third_party/build_bundled.py . +# mv third_party/build_bundled.py . # Need the just untarred flatbuffers/flatbuffers.h mv third_party/flatbuffers . @@ -535,7 +536,7 @@ mv third_party/googletest . # Remove everything rm -rf third_party/* # Put stuff back -mv build_bundled.py third_party +# mv build_bundled.py third_party mv miniz-%{miniz_version} third_party mv flatbuffers third_party mv pybind11 third_party @@ -625,7 +626,7 @@ sed -i -e 's@USE_MSLK_DEFAULT ON@USE_MSLK_DEFAULT OFF@' CMakeLists.txt # %ifarch x86_64 # Real cores, No hyperthreading -COMPILE_JOBS=`cat /proc/cpuinfo | grep -m 1 'cpu cores' | awk '{ print $4 }'` +COMPILE_JOBS=`lscpu -p=CORE | grep -v '^#' | sort -u |wc -l` %else # cpuinfo format varies on other arches, fall back to nproc COMPILE_JOBS=`nproc` @@ -698,7 +699,7 @@ export USE_SYSTEM_EIGEN_INSTALL=ON export USE_SYSTEM_ONNX=ON %endif export USE_SYSTEM_PYBIND11=OFF -export USE_SYSTEM_LIBS=OFF +export USE_SYSTEM_LIBS=ON export USE_SYSTEM_NCCL=OFF export USE_TENSORPIPE=OFF export USE_XNNPACK=OFF @@ -708,7 +709,7 @@ export USE_SYSTEM_CPUINFO=ON export USE_SYSTEM_FP16=ON export USE_SYSTEM_FXDIV=ON export USE_SYSTEM_PSIMD=ON -export USE_SYSTEM_XNNPACK=OFF +export USE_SYSTEM_XNNPACK=ON export USE_DISTRIBUTED=ON %if %{with tensorpipe} @@ -717,7 +718,7 @@ export TP_BUILD_LIBUV=OFF %endif %if %{with gloo} -export USE_GLOO=ON +export USE_GLOO=OFF export USE_SYSTEM_GLOO=ON %endif %if %{with mpi} @@ -741,8 +742,8 @@ export ROCM_PATH=`hipconfig -R` # pytorch uses clang, not hipcc export HIP_CLANG_PATH=%{rocmllvm_bindir} -# export PYTORCH_ROCM_ARCH=%{rocm_gpu_list_default} -export PYTORCH_ROCM_ARCH=gfx1151 +export PYTORCH_ROCM_ARCH=%{rocm_gpu_list_default} +# export PYTORCH_ROCM_ARCH=gfx1151 %endif diff --git a/sources b/sources index 29a2107..501e7d8 100644 --- a/sources +++ b/sources @@ -1,29 +1,13 @@ -SHA512 (pytorch-v2.7.0.tar.gz) = 17e875a66f1669901f5f770c9d829ba5bfa3967296cfb71550e8a92507181db742548eaf7cc9a2c478c4b91e366f27cc480e2e1bbb328db8501d30e1649839e6 -SHA512 (v23.3.3.tar.gz) = 4066c94f2473c7ea16917d29a613e16f840a329089c88e0bdbdb999aef3442ba00abfd2aa92266fa9c067e399dc88e6f0ccac40dc151378857e665638e78bbf0 -SHA512 (v2.13.6.tar.gz) = 497c25b33b09a9c42f67131ab82e35d689e8ce089dd7639be997305ff9a6d502447b79c824508c455d559e61f0186335b54dd2771d903a7c1621833930622d1a +SHA512 (pytorch-v2.13.0.tar.gz) = 8d192f2d4ef92e4f83cef86d97f4f23fceec4fd4eaa2ff1d99267250d64785317e918617ef9b80c7cb1dfa209614444b4f427caa7a48d10911cbd2caeac1655f +SHA512 (v24.12.23.tar.gz) = f97762ba41b9cfef648e93932fd789324c6bb6ebc5b7aeca8185c9ef602294b67d73aea7ae371035579a1419cbfbeba7c3e88b31b5a5848db98f5e8a03b982b1 +SHA512 (v3.0.1.tar.gz) = c17e6d6a78c38e760864b390ac2aa7df6a94ca53acb2e8be71f0d63d611b738fa20a16946c98a93fbfcad56cb0346ebf247bbe41c6f5171c6ce68397b1e5c4db SHA512 (tensorpipe-52791a2.tar.gz) = 1e5faf17a7236c5506c08cb28be16069b11bb929bbca64ed9745ce4277d46739186ab7d6597da7437d90ed2d166d4c37ef2f3bceabe8083ef3adbb0e8e5f227e SHA512 (v1.41.0.tar.gz) = bb08a1970a10e8d9571ffea3d021643de30ec212cd51317b98d6cf0cfe55d6877992921fb01d1188a6d466687335b77885685d924f8cb7200a0bec30eee05c65 SHA512 (libnop-910b558.tar.gz) = 74c5324eaa1b6b2ac8dfef94c835b5c5b044625f8e5efe3522470b1ecc4798ff43d344a013cee2f6901e83267c6167072947b754e63f1552ae7044cffe234c36 SHA512 (v1.14.2.tar.gz) = 97635bbaf6dd567c201451dfaf7815b2052fe50d9bccc97aade86cfa4a92651374d167296a5453031b2681dc302806a289bca011a9e79ddc381a17d6118971d7 -SHA512 (cpp-httplib-3b6597b.tar.gz) = 8f1090658c498d04f14fec5c2f301847b1f3360bf92b18d82927643ee04ab61a6b274733a01c7850f9c030205120d674d1d961358d49fdd15636736fb8704f55 -SHA512 (kineto-be13176.tar.gz) = 41a08c7da9eea7d12402f80a5550c9d4df79798719cc52b12a507828c8c896ba28a37c35d8adf809ca72589e1d84965d5ef6dd01f3f8dc1c803c5ed67b03a43a -SHA512 (pytorch-a1cb3cc.tar.gz) = 92bf8b2c2ef0b459406b60169ecebdc50652c75943e3d6087e4d261f6e308dbad365529561e0f07ea3f0b71790efb68b5e4ab2f44e270462097208d924dc2d95 -SHA512 (v24.12.23.tar.gz) = f97762ba41b9cfef648e93932fd789324c6bb6ebc5b7aeca8185c9ef602294b67d73aea7ae371035579a1419cbfbeba7c3e88b31b5a5848db98f5e8a03b982b1 -SHA512 (kineto-5e75018.tar.gz) = 921b96a56e01d69895b79e67582d8977ed6f873573ab41557c5d026ada5d1f6365e4ed0a0c6804057c52e92510749fc58619f554a164c1ba9d8cd13e789bebd0 -SHA512 (pytorch-v2.8.0.tar.gz) = 791e658eab87fb957f025558cb9f925078d2426ab7b6f60771d9841dfb691f67d905ba1330a800008efe7c938b6c69bdc52232bccfe8d4860e795a532cd69d28 +SHA512 (cpp-httplib-bd95e67.tar.gz) = 17c7b1d1a3750b85ebfefcc31a2fe2cb538373b140a31058d5003a018601bbde96e82bd73b99708856c0ebecd910ac4aee5420b829cb444e3aac3ee5764dcff7 +SHA512 (kineto-b2103f7.tar.gz) = 27d9f6a8b27434e83d26ed182df1fecec1d02fc26906995e44155562a730f998f527aad3d6c8a37212255c5e2f86a607a9648edf62861f56eb2ea512c4452908 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 -SHA512 (pytorch-v2.9.0.tar.gz) = ae989e3a7fe30f9ea90944dc25e21ca92f2a94ee40d8de974a168c292d82c16ee8920624eff91a85755469ad05473dce0f85893e3ed7794ec5c6bdd89cbd2023 -SHA512 (pytorch-v2.9.1.tar.gz) = 88de0289fa2760abd69bef505b5ae3b6d7ff176b415cbb31bbc89ce5476a3800b322a97c4490f270f8b89657aff931bf9a5516202b268e0bb8b1f63dbb87b34a SHA512 (v3.19.6.tar.gz) = 8f92242f2be8e1bbfba41341c87709ad91ad83b8b3e3df88bb430411541d3399295f49291fd52b50e3487b0fce33181cb4d175685fd25aac72adfaee26a612d4 SHA512 (v80.9.0.tar.gz) = e67c6c5e74691e65ecbf24fd19c1da545434ac1674f37c917f5ecc282a00bffc62d64164a885d19f177e99a3fa53db196e2be1cf0aa6811027e61d05119682da -SHA512 (pytorch-v2.10.0.tar.gz) = 64f5c62ac9ec7189ab27a787271e2d993d3230638b43792bbf6576e8ada840323d86ebfc4262d951266281623518cca5ba87f77ca61e165fef6a670fdf5b3c50 -SHA512 (pytorch-v2.11.0.tar.gz) = e67d68245a19e65737c19f97b6d4ddd72051303abb17a734e09f1ba7ecfb3bf6a5546c826820890ad0ddfb2916b1f798175f341bda0cc3c8a83b3b852b077f3b SHA512 (MSLK-3d332d1.tar.gz) = f6bd99ec7a79321692c088e622dd2ea8f1355b137014b33e75cb7ff83922fdd07ebacf5920e2e343a48fccd74315c11861ac5c2fff29e2f2481875ecb1ae57cf -SHA512 (cpp-httplib-bd95e67.tar.gz) = 17c7b1d1a3750b85ebfefcc31a2fe2cb538373b140a31058d5003a018601bbde96e82bd73b99708856c0ebecd910ac4aee5420b829cb444e3aac3ee5764dcff7 -SHA512 (kineto-7a731b6.tar.gz) = f15347cdb210b887c1c9c9e9d91556f48b5b3fc662dce0bfa6086bce38673c568f0fc385cdd1b16a742cc709d4db5798a18c6400f24bd57f6a1b4a2eaf303d47 -SHA512 (kineto-b2103f7.tar.gz) = 27d9f6a8b27434e83d26ed182df1fecec1d02fc26906995e44155562a730f998f527aad3d6c8a37212255c5e2f86a607a9648edf62861f56eb2ea512c4452908 -SHA512 (pytorch-v2.12.0.tar.gz) = 00f900945c3a7dc33fe61ece65341d7995c13f6134b714bc246f43b06f7d091b5952e8cb3febda6931cb769c96189e6b646c179ea59601ead834fb007f0788f2 -SHA512 (v3.0.1.tar.gz) = c17e6d6a78c38e760864b390ac2aa7df6a94ca53acb2e8be71f0d63d611b738fa20a16946c98a93fbfcad56cb0346ebf247bbe41c6f5171c6ce68397b1e5c4db