The package rpms/python-torch.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s): https://src.fedoraproject.org/cgit/rpms/python-torch.git/commit/?id=4b6de8a4... https://src.fedoraproject.org/cgit/rpms/python-torch.git/commit/?id=d4bfc263... https://src.fedoraproject.org/cgit/rpms/python-torch.git/commit/?id=48192fa1....
Change: +ExclusiveArch: x86_64 +%ifarch x86_64 +ExclusiveArch: x86_64 aarch64
Thanks.
Full change: ============
commit eebdce8bf9fed587c9836679ece64d5385c6c085 Author: Tom Rix trix@redhat.com Date: Wed Jun 5 10:10:27 2024 -0600
Add pocketfft source
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index 9027aa5..31a05a6 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ /FP16-0a92994.tar.gz /psimd-072586a.tar.gz /pthreadpool-4fe0e1e.tar.gz +/pocketfft-076cb3d.tar.gz diff --git a/sources b/sources index d81526a..0a8bb3b 100644 --- a/sources +++ b/sources @@ -16,3 +16,4 @@ SHA512 (FXdiv-63058ef.tar.gz) = da33eab4d006645f383a1f24fc3e747db3aeb0613219297e SHA512 (FP16-0a92994.tar.gz) = 3f094f242425ea37de274eb8539dc5f8ab0c13fd5325d14180ef12e9c04e6002a110d086c4c667f7c8054af337deab096d59482eb95cc8a632c3c412b48e89d1 SHA512 (psimd-072586a.tar.gz) = a18faea093423dd9fe19ece8b228e011dccce0a2a22222f777ea19b023a13173966d4a8aea01147e8fc58de5d39cffcedeb2221a1572ae52bd5aba1295f86a94 SHA512 (pthreadpool-4fe0e1e.tar.gz) = 764d81219f2bf1f056983b5c2576f377aeef37f0f2282e74f81bfe1eac5353e175603f80a6647c96165b24ebdcb7bc2189a376e8577ce4319d82679c33750451 +SHA512 (pocketfft-076cb3d.tar.gz) = a5dc5348b2079377787384722bf31be0cc6eed3bfacbf8a7fc3a4bc5d65832deb0da47686c12795c7e925286a3b43f6b5368ee380ddbe839c36edd106f1321a9
commit baa9e0a4be6d20e58dd6dc2977fef769befdb6e6 Author: Tom Rix trix@redhat.com Date: Wed Jun 5 10:09:47 2024 -0600
Add pthreadpool source
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index bd8798d..9027aa5 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ /FXdiv-63058ef.tar.gz /FP16-0a92994.tar.gz /psimd-072586a.tar.gz +/pthreadpool-4fe0e1e.tar.gz diff --git a/sources b/sources index d9d737d..d81526a 100644 --- a/sources +++ b/sources @@ -15,3 +15,4 @@ SHA512 (xnnpack-fcbf55a.tar.gz) = 8063e27686f7b71cfba05b0c004c46db4506638689ffb1 SHA512 (FXdiv-63058ef.tar.gz) = da33eab4d006645f383a1f24fc3e747db3aeb0613219297ec0ae69aa2617f07ba050ebd6a64a8cbde6d25481f176d0ec3b9753a95d1fbcead2136595f3e50e97 SHA512 (FP16-0a92994.tar.gz) = 3f094f242425ea37de274eb8539dc5f8ab0c13fd5325d14180ef12e9c04e6002a110d086c4c667f7c8054af337deab096d59482eb95cc8a632c3c412b48e89d1 SHA512 (psimd-072586a.tar.gz) = a18faea093423dd9fe19ece8b228e011dccce0a2a22222f777ea19b023a13173966d4a8aea01147e8fc58de5d39cffcedeb2221a1572ae52bd5aba1295f86a94 +SHA512 (pthreadpool-4fe0e1e.tar.gz) = 764d81219f2bf1f056983b5c2576f377aeef37f0f2282e74f81bfe1eac5353e175603f80a6647c96165b24ebdcb7bc2189a376e8577ce4319d82679c33750451
commit f6b57f12e30b673ca2cbe4cf28358e2e38b769e2 Author: Tom Rix trix@redhat.com Date: Wed Jun 5 10:09:03 2024 -0600
Add psimd source
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index 8f7df09..bd8798d 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ /xnnpack-fcbf55a.tar.gz /FXdiv-63058ef.tar.gz /FP16-0a92994.tar.gz +/psimd-072586a.tar.gz diff --git a/sources b/sources index 96e0e0e..d9d737d 100644 --- a/sources +++ b/sources @@ -14,3 +14,4 @@ SHA512 (pytorch-v2.3.0.tar.gz) = 0c2ffc7bf2fd86070e9958c34eca1f03a0248a011ac6ffa SHA512 (xnnpack-fcbf55a.tar.gz) = 8063e27686f7b71cfba05b0c004c46db4506638689ffb112f013b3886de58653b60ca5487978c3f96275c17bb1136883ca4c93ddb2241a2c31925a950cb51759 SHA512 (FXdiv-63058ef.tar.gz) = da33eab4d006645f383a1f24fc3e747db3aeb0613219297ec0ae69aa2617f07ba050ebd6a64a8cbde6d25481f176d0ec3b9753a95d1fbcead2136595f3e50e97 SHA512 (FP16-0a92994.tar.gz) = 3f094f242425ea37de274eb8539dc5f8ab0c13fd5325d14180ef12e9c04e6002a110d086c4c667f7c8054af337deab096d59482eb95cc8a632c3c412b48e89d1 +SHA512 (psimd-072586a.tar.gz) = a18faea093423dd9fe19ece8b228e011dccce0a2a22222f777ea19b023a13173966d4a8aea01147e8fc58de5d39cffcedeb2221a1572ae52bd5aba1295f86a94
commit 765195f06ffe966aad39b29ae4ed932a3f5d1eb1 Author: Tom Rix trix@redhat.com Date: Wed Jun 5 10:08:22 2024 -0600
Add FP16 source
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index b96e2d3..8f7df09 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /pytorch-v2.3.0.tar.gz /xnnpack-fcbf55a.tar.gz /FXdiv-63058ef.tar.gz +/FP16-0a92994.tar.gz diff --git a/sources b/sources index 5e89a7e..96e0e0e 100644 --- a/sources +++ b/sources @@ -13,3 +13,4 @@ SHA512 (pytorch-97ff6cf.tar.gz) = 105ebcba298558fe833f90e7e40b003d35a74609e777f9 SHA512 (pytorch-v2.3.0.tar.gz) = 0c2ffc7bf2fd86070e9958c34eca1f03a0248a011ac6ffaeb69f65306ff856edd5359986f02af25888433187e6d7f29b60edded092e2ac30c8cec49023166eda SHA512 (xnnpack-fcbf55a.tar.gz) = 8063e27686f7b71cfba05b0c004c46db4506638689ffb112f013b3886de58653b60ca5487978c3f96275c17bb1136883ca4c93ddb2241a2c31925a950cb51759 SHA512 (FXdiv-63058ef.tar.gz) = da33eab4d006645f383a1f24fc3e747db3aeb0613219297ec0ae69aa2617f07ba050ebd6a64a8cbde6d25481f176d0ec3b9753a95d1fbcead2136595f3e50e97 +SHA512 (FP16-0a92994.tar.gz) = 3f094f242425ea37de274eb8539dc5f8ab0c13fd5325d14180ef12e9c04e6002a110d086c4c667f7c8054af337deab096d59482eb95cc8a632c3c412b48e89d1
commit 4471806aa61bf7be62ee13967829317437257159 Author: Tom Rix trix@redhat.com Date: Wed Jun 5 10:07:36 2024 -0600
Add FXdiv source
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index ee12cc0..b96e2d3 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ /pytorch-97ff6cf.tar.gz /pytorch-v2.3.0.tar.gz /xnnpack-fcbf55a.tar.gz +/FXdiv-63058ef.tar.gz diff --git a/sources b/sources index 2a8a2b9..5e89a7e 100644 --- a/sources +++ b/sources @@ -12,3 +12,4 @@ SHA512 (libnop-910b558.tar.gz) = 74c5324eaa1b6b2ac8dfef94c835b5c5b044625f8e5efe3 SHA512 (pytorch-97ff6cf.tar.gz) = 105ebcba298558fe833f90e7e40b003d35a74609e777f9dc4c47f5668c884f603455113ac0ff252a62b83c81137ae66ceb1a862d351203925dcfc3dcf9f73580 SHA512 (pytorch-v2.3.0.tar.gz) = 0c2ffc7bf2fd86070e9958c34eca1f03a0248a011ac6ffaeb69f65306ff856edd5359986f02af25888433187e6d7f29b60edded092e2ac30c8cec49023166eda SHA512 (xnnpack-fcbf55a.tar.gz) = 8063e27686f7b71cfba05b0c004c46db4506638689ffb112f013b3886de58653b60ca5487978c3f96275c17bb1136883ca4c93ddb2241a2c31925a950cb51759 +SHA512 (FXdiv-63058ef.tar.gz) = da33eab4d006645f383a1f24fc3e747db3aeb0613219297ec0ae69aa2617f07ba050ebd6a64a8cbde6d25481f176d0ec3b9753a95d1fbcead2136595f3e50e97
commit 40ea768df85d0b15f6f5f195347a38a7a575cebc Author: Tom Rix trix@redhat.com Date: Wed Jun 5 10:06:40 2024 -0600
Add xnnpack source
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index 5038800..ee12cc0 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ /libnop-910b558.tar.gz /pytorch-97ff6cf.tar.gz /pytorch-v2.3.0.tar.gz +/xnnpack-fcbf55a.tar.gz diff --git a/sources b/sources index 10cd24e..2a8a2b9 100644 --- a/sources +++ b/sources @@ -11,3 +11,4 @@ SHA512 (v1.41.0.tar.gz) = bb08a1970a10e8d9571ffea3d021643de30ec212cd51317b98d6cf SHA512 (libnop-910b558.tar.gz) = 74c5324eaa1b6b2ac8dfef94c835b5c5b044625f8e5efe3522470b1ecc4798ff43d344a013cee2f6901e83267c6167072947b754e63f1552ae7044cffe234c36 SHA512 (pytorch-97ff6cf.tar.gz) = 105ebcba298558fe833f90e7e40b003d35a74609e777f9dc4c47f5668c884f603455113ac0ff252a62b83c81137ae66ceb1a862d351203925dcfc3dcf9f73580 SHA512 (pytorch-v2.3.0.tar.gz) = 0c2ffc7bf2fd86070e9958c34eca1f03a0248a011ac6ffaeb69f65306ff856edd5359986f02af25888433187e6d7f29b60edded092e2ac30c8cec49023166eda +SHA512 (xnnpack-fcbf55a.tar.gz) = 8063e27686f7b71cfba05b0c004c46db4506638689ffb112f013b3886de58653b60ca5487978c3f96275c17bb1136883ca4c93ddb2241a2c31925a950cb51759
commit 4b6de8a49d373bb1948d33047386ecbdd94c84e1 Author: Tom Rix trix@redhat.com Date: Wed Jun 5 10:04:12 2024 -0600
Do not build aarch on anything newer than F41
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 29dd8c0..e3f7f13 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -188,7 +188,13 @@ Patch104: 0001-use-any-hip.patch Patch105: 0001-disable-use-of-aotriton.patch %endif
+# Do not claim aarch64 on anything newer than F41 +%if 0%{?fedora} > 40 ExclusiveArch: x86_64 aarch64 +%else +ExclusiveArch: x86_64 +%endif + %global toolchain gcc %global _lto_cflags %nil
commit 8f0c68e4dda59fe95b0d9947825ca08101b01195 Author: Tom Rix trix@redhat.com Date: Tue May 21 06:36:59 2024 -0600
Start tracking upstream 2.4
Replace fmt and FXdiv patches with sed These patches do not apply to gitcommit. Some other changes that do not exist in ToT commented out.
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index b65a11c..29dd8c0 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -6,12 +6,14 @@ # So pre releases can be tried %bcond_with gitcommit %if %{with gitcommit} -# git tag v2.3.0-rc12 -%global commit0 97ff6cfd9c86c5c09d7ce775ab64ec5c99230f5d +# ToT +%global commit0 b36e01801b89a516f4271f796773d5f4b43f1186 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) -%global date0 20240408 -%endif +%global date0 20240521 +%global pypi_version 2.4.0 +%else %global pypi_version 2.3.0 +%endif
# For -test subpackage # suitable only for local testing @@ -159,8 +161,6 @@ Source50: https://github.com/mreineck/pocketfft/archive/%%7Bpf_commit%7D/pocke %endif
Patch0: 0001-no-third_party-foxi.patch -Patch1: 0001-no-third_party-fmt.patch -Patch2: 0001-no-third_party-FXdiv.patch Patch3: 0001-Stub-in-kineto-ActivityType.patch Patch5: 0001-disable-submodule-search.patch
@@ -168,12 +168,16 @@ Patch5: 0001-disable-submodule-search.patch Patch6: 0001-reenable-foxi-linking.patch %endif
+# Bring some patches forward +%if %{without gitcommit} # https://github.com/pytorch/pytorch/pull/123384 Patch7: 0001-Reenable-dim-for-python-3.12.patch
# Dynamo/Inductor on 3.12 Patch8: 0001-dynamo-3.12-enable-dynamo-on-3.12-enable-most-dynamo.patch +%endif
+%if %{with rocm} # ROCm patches # https://github.com/pytorch/pytorch/pull/120551 Patch100: 0001-Optionally-use-hipblaslt.patch @@ -182,6 +186,7 @@ Patch102: 0001-silence-an-assert.patch Patch103: 0001-can-not-use-with-c-files.patch Patch104: 0001-use-any-hip.patch Patch105: 0001-disable-use-of-aotriton.patch +%endif
ExclusiveArch: x86_64 aarch64 %global toolchain gcc @@ -328,6 +333,9 @@ Provides: bundled(pthreadpool) Provides: bundled(pocketfft) %endif
+# For convience +Provides: pytorch + %description PyTorch is a Python package that provides two high-level features:
@@ -456,11 +464,13 @@ cp -r pocketfft-*/* third_party/pocketfft/ %endif
%if %{with opencv} +%if %{without gitcommit} # Reduce requirements, *FOUND is not set sed -i -e 's/USE_OPENCV AND OpenCV_FOUND AND USE_FFMPEG AND FFMPEG_FOUND/USE_OPENCV AND USE_FFMPEG/' caffe2/video/CMakeLists.txt sed -i -e 's/USE_OPENCV AND OpenCV_FOUND/USE_OPENCV/' caffe2/image/CMakeLists.txt sed -i -e 's/STATUS/FATAL/' caffe2/image/CMakeLists.txt %endif +%endif
%if 0%{?rhel} # In RHEL but too old @@ -474,6 +484,21 @@ sed -i -e '/fsspec/d' setup.py # Connected to USE_FLASH_ATTENTION, since this is off, do not need it sed -i -e '/aotriton.cmake/d' cmake/Dependencies.cmake
+# No third_party fmt, use system +sed -i -e 's@fmt::fmt-header-only@fmt@' CMakeLists.txt +sed -i -e 's@fmt::fmt-header-only@fmt@' c10/CMakeLists.txt +sed -i -e 's@fmt::fmt-header-only@fmt@' torch/CMakeLists.txt +sed -i -e 's@fmt::fmt-header-only@fmt@' cmake/Dependencies.cmake +sed -i -e 's@add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt)@#add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt)@' cmake/Dependencies.cmake +sed -i -e 's@set_target_properties(fmt-header-only PROPERTIES INTERFACE_COMPILE_FEATURES "")@#set_target_properties(fmt-header-only PROPERTIES INTERFACE_COMPILE_FEATURES "")@' cmake/Dependencies.cmake +sed -i -e 's@list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only)@#list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only)@' cmake/Dependencies.cmake + +# No third_party FXdiv +%if %{with xnnpack} +sed -i -e 's@if(NOT TARGET fxdiv)@if(MSVC AND USE_XNNPACK)@' caffe2/CMakeLists.txt +sed -i -e 's@TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv)@#TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv)@' caffe2/CMakeLists.txt +%endif + # Release comes fully loaded with third party src # Remove what we can # @@ -567,10 +592,12 @@ mkdir third_party/pocketfft mkdir third_party/valgrind-headers cp %{_includedir}/valgrind/* third_party/valgrind-headers
+%if %{without gitcommit} # Remove unneeded OpenCL files that confuse the lincense scanner rm caffe2/contrib/opencl/OpenCL/cl.hpp rm caffe2/mobile/contrib/libopencl-stub/include/CL/*.h rm caffe2/mobile/contrib/libopencl-stub/include/CL/*.hpp +%endif
%if %{with rocm} # hipify
commit aa3ab781d0d5e5207e056945805716e6b1e707a9 Author: Tom Rix trix@redhat.com Date: Sat May 18 13:05:15 2024 -0400
Roll ROCm support claim back to f40
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index e8f451b..b65a11c 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -21,8 +21,8 @@ %bcond_with test
%ifarch x86_64 -# ROCm support came in F41 -%if 0%{?fedora} > 40 +# ROCm support came in F40 +%if 0%{?fedora} > 39 %bcond_without rocm %else %bcond_with rocm
commit 64cda83196afabe324dff36e3b601735f49d92dd Author: Tom Rix trix@redhat.com Date: Thu May 16 14:07:10 2024 -0600
Add cuda arches to build for
Suggested-by: Steve Royer sroyer@redhat.com Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index c371814..e8f451b 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -681,6 +681,8 @@ export BUILD_CAFFE2=ON export CUDACXX=/usr/local/cuda/bin/nvcc export CPLUS_INCLUDE_PATH=/usr/local/cuda/include export USE_CUDA=ON +# The arches to build for +export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" %endif %endif
commit 34c6e67d31fed7c8844b1c9591c07747c299c9e4 Author: Tom Rix trix@redhat.com Date: Mon May 6 19:28:22 2024 -0600
Fill in missing packages on F40 and F39 with third_party.
These packages are in Fedora, just not in the old releases.
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index f9e4c70..c371814 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -68,6 +68,18 @@ %bcond_with xnnpack %endif
+%if 0%{?fedora} > 39 +%bcond_without pthreadpool +%else +%bcond_with pthreadpool +%endif + +%if 0%{?fedora} > 39 +%bcond_without pocketfft +%else +%bcond_with pocketfft +%endif + # For testing cuda %ifarch x86_64 %bcond_with cuda @@ -119,6 +131,33 @@ Source21: https://github.com/libuv/libuv/archive/refs/tags/v1.41.0.tar.gz Source22: https://github.com/google/libnop/archive/%%7Bnop_commit%7D/libnop-%%7Bnop_sc... %endif
+%if %{without xnnpack} +%global xnn_commit fcbf55af6cf28a4627bcd1f703ab7ad843f0f3a2 +%global xnn_scommit %(c=%{xnn_commit}; echo ${c:0:7}) +Source30: https://github.com/google/xnnpack/archive/%%7Bxnn_commit%7D/xnnpack-%%7Bxnn_... +%global fx_commit 63058eff77e11aa15bf531df5dd34395ec3017c8 +%global fx_scommit %(c=%{fx_commit}; echo ${c:0:7}) +Source31: https://github.com/Maratyszcza/fxdiv/archive/%%7Bfx_commit%7D/FXdiv-%%7Bfx_s... +%global fp_commit 0a92994d729ff76a58f692d3028ca1b64b145d91 +%global fp_scommit %(c=%{fp_commit}; echo ${c:0:7}) +Source32: https://github.com/Maratyszcza/FP16/archive/%%7Bfp_commit%7D/FP16-%%7Bfp_sco... +%global ps_commit 072586a71b55b7f8c584153d223e95687148a900 +%global ps_scommit %(c=%{ps_commit}; echo ${c:0:7}) +Source33: https://github.com/Maratyszcza/psimd/archive/%%7Bps_commit%7D/psimd-%%7Bps_s... +%endif + +%if %{without pthreadpool} +%global pt_commit 4fe0e1e183925bf8cfa6aae24237e724a96479b8 +%global pt_scommit %(c=%{pt_commit}; echo ${c:0:7}) +Source40: https://github.com/Maratyszcza/pthreadpool/archive/%%7Bpt_commit%7D/pthreadp... +%endif + +%if %{without pocketfft} +%global pf_commit 076cb3d2536b7c5d0629093ad886e10ac05f3623 +%global pf_scommit %(c=%{pf_commit}; echo ${c:0:7}) +Source50: https://github.com/mreineck/pocketfft/archive/%%7Bpf_commit%7D/pocketfft-%%7... +%endif + Patch0: 0001-no-third_party-foxi.patch Patch1: 0001-no-third_party-fmt.patch Patch2: 0001-no-third_party-FXdiv.patch @@ -175,16 +214,18 @@ BuildRequires: protobuf-devel BuildRequires: sleef-devel BuildRequires: valgrind-devel
-# These packages came in F40 -%if 0%{?fedora} > 39 -BuildRequires: FP16-devel -BuildRequires: fxdiv-devel +%if %{with pocketfft} BuildRequires: pocketfft-devel -BuildRequires: psimd-devel +%endif + +%if %{with pthreadpool} BuildRequires: pthreadpool-devel %endif
%if %{with xnnpack} +BuildRequires: FP16-devel +BuildRequires: fxdiv-devel +BuildRequires: psimd-devel BuildRequires: xnnpack-devel = 0.0^git20240229.fcbf55a %endif
@@ -265,7 +306,27 @@ Provides: bundled(libnop) Provides: bundled(libuv) = 1.41.0 %endif
+# These are already in Fedora +%if %{without xnnpack} +# BSD-3-Clause +Provides: bundled(xnnpack) +# MIT +Provides: bundled(FP16) +# MIT +Provides: bundled(fxdiv) +# MIT +Provides: bundled(psimd) +%endif + +%if %{without pthreadpool} +# BSD-2-Clause +Provides: bundled(pthreadpool) +%endif
+%if %{without pocketfft} +# BSD-3-Clause +Provides: bundled(pocketfft) +%endif
%description PyTorch is a Python package that provides two high-level features: @@ -339,27 +400,61 @@ cp %{SOURCE100} . rm -rf %{pypi_name}.egg-info
tar xf %{SOURCE1} +rm -rf third_party/flatbuffers/* cp -r flatbuffers-23.3.3/* third_party/flatbuffers/
tar xf %{SOURCE2} +rm -rf third_party/pybind11/* cp -r pybind11-2.11.1/* third_party/pybind11/
%if %{with cuda} tar xf %{SOURCE10} +rm -rf third_party/cudnn_frontend/* cp -r cudnn-frontend-%{cuf_ver}/* third_party/cudnn_frontend/ tar xf %{SOURCE11} +rm -rf third_party/cutlass/* cp -r cutlass-%{cul_ver}/* third_party/cutlass/ %endif
%if %{with tensorpipe} tar xf %{SOURCE20} +rm -rf third_party/tensorpipe/* cp -r tensorpipe-*/* third_party/tensorpipe/ tar xf %{SOURCE21} +rm -rf third_party/tensorpipe/third_party/libuv/* cp -r libuv-*/* third_party/tensorpipe/third_party/libuv/ tar xf %{SOURCE22} +rm -rf third_party/tensorpipe/third_party/libnop/* cp -r libnop-*/* third_party/tensorpipe/third_party/libnop/ %endif
+%if %{without xnnpack} +tar xf %{SOURCE30} +rm -rf third_party/XNNPACK/* +cp -r XNNPACK-*/* third_party/XNNPACK/ +tar xf %{SOURCE31} +rm -rf third_party/FXdiv/* +cp -r FXdiv-*/* third_party/FXdiv/ +tar xf %{SOURCE32} +rm -rf third_party/FP16/* +cp -r FP16-*/* third_party/FP16/ +tar xf %{SOURCE33} +rm -rf third_party/psimd/* +cp -r psimd-*/* third_party/psimd/ +%endif + +%if %{without pthreadpool} +tar xf %{SOURCE40} +rm -rf third_party/pthreadpool/* +cp -r pthreadpool-*/* third_party/pthreadpool/ +%endif + +%if %{without pocketfft} +tar xf %{SOURCE50} +rm -rf third_party/pocketfft/* +cp -r pocketfft-*/* third_party/pocketfft/ +%endif + %if %{with opencv} # Reduce requirements, *FOUND is not set sed -i -e 's/USE_OPENCV AND OpenCV_FOUND AND USE_FFMPEG AND FFMPEG_FOUND/USE_OPENCV AND USE_FFMPEG/' caffe2/video/CMakeLists.txt @@ -406,6 +501,21 @@ mv third_party/cutlass . mv third_party/tensorpipe . %endif
+%if %{without xnnpack} +mv third_party/XNNPACK . +mv third_party/FXdiv . +mv third_party/FP16 . +mv third_party/psimd . +%endif + +%if %{without pthreadpool} +mv third_party/pthreadpool . +%endif + +%if %{without pocketfft} +mv third_party/pocketfft . +%endif + %if %{with test} mv third_party/googletest . %endif @@ -427,13 +537,31 @@ mv cutlass third_party mv tensorpipe third_party %endif
+%if %{without xnnpack} +mv XNNPACK third_party +mv FXdiv third_party +mv FP16 third_party +mv psimd third_party +%endif + +%if %{without pthreadpool} +mv pthreadpool third_party +%endif + +%if %{without pocketfft} +mv pocketfft third_party +%endif + %if %{with test} mv googletest third_party %endif
+%if %{with pocketfft} # # Fake out pocketfft, and system header will be used mkdir third_party/pocketfft +%endif + # # Use the system valgrind headers mkdir third_party/valgrind-headers @@ -527,18 +655,21 @@ export USE_ROCM=OFF export USE_SYSTEM_CPUINFO=ON export USE_SYSTEM_SLEEF=ON export USE_SYSTEM_EIGEN_INSTALL=ON -export USE_SYSTEM_FP16=ON -export USE_SYSTEM_PTHREADPOOL=ON -export USE_SYSTEM_PSIMD=ON -export USE_SYSTEM_FXDIV=ON export USE_SYSTEM_ONNX=ON export USE_SYSTEM_PYBIND11=OFF export USE_SYSTEM_LIBS=OFF export USE_TENSORPIPE=OFF +export USE_XNNPACK=ON + +%if %{with pthreadpool} +export USE_SYSTEM_PTHREADPOOL=ON +%endif
%if %{with xnnpack} +export USE_SYSTEM_FP16=ON +export USE_SYSTEM_FXDIV=ON +export USE_SYSTEM_PSIMD=ON export USE_SYSTEM_XNNPACK=ON -export USE_XNNPACK=ON %endif
%if %{with caffe2}
commit 5d1bd21efdaaa70acf3190c4779bd7d5eb844f65 Author: Tom Rix trix@redhat.com Date: Sun May 5 15:43:38 2024 -0400
Collect the buildrequires that depend on F40 together.
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 02bdeff..f9e4c70 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -155,8 +155,6 @@ BuildRequires: fmt-devel %if %{with caffe2} BuildRequires: foxi-devel %endif -BuildRequires: FP16-devel -BuildRequires: fxdiv-devel BuildRequires: gcc-c++ BuildRequires: gcc-gfortran %if %{with distributed} @@ -173,12 +171,19 @@ BuildRequires: openmpi-devel %endif %endif BuildRequires: openblas-devel -BuildRequires: pocketfft-devel BuildRequires: protobuf-devel -BuildRequires: pthreadpool-devel -BuildRequires: psimd-devel BuildRequires: sleef-devel BuildRequires: valgrind-devel + +# These packages came in F40 +%if 0%{?fedora} > 39 +BuildRequires: FP16-devel +BuildRequires: fxdiv-devel +BuildRequires: pocketfft-devel +BuildRequires: psimd-devel +BuildRequires: pthreadpool-devel +%endif + %if %{with xnnpack} BuildRequires: xnnpack-devel = 0.0^git20240229.fcbf55a %endif
commit c3a7e33a0692497dde38161763fa84e82cf4b8b4 Author: Tom Rix trix@redhat.com Date: Sun May 5 15:29:24 2024 -0400
Improve fedora conditional use versions.
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index da0f59e..02bdeff 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -21,7 +21,8 @@ %bcond_with test
%ifarch x86_64 -%if 0%{?fedora} +# ROCm support came in F41 +%if 0%{?fedora} > 40 %bcond_without rocm %else %bcond_with rocm @@ -34,28 +35,39 @@ %global rocm_default_gpu default %bcond_without rocm_loop
-# For testing caffe2 -%if 0%{?fedora} +# Caffe2 support came in F41 +%if 0%{?fedora} > 40 %bcond_without caffe2 %else %bcond_with caffe2 %endif
-# For testing distributed +# Distributed support came in F41 +%if 0%{?fedora} > 40 %bcond_without distributed # For testing distributed+rccl etc. %bcond_without rccl %bcond_with gloo %bcond_without mpi %bcond_without tensorpipe +%else +%bcond_with distributed +%endif
-# For testing openvs -%if 0%{?fedora} +# OpenCV support came in F41 +%if 0%{?fedora} > 40 %bcond_without opencv %else %bcond_with opencv %endif
+# Do no confuse xnnpack versions +%if 0%{?fedora} > 40 +%bcond_without xnnpack +%else +%bcond_with xnnpack +%endif + # For testing cuda %ifarch x86_64 %bcond_with cuda @@ -105,7 +117,6 @@ Source21: https://github.com/libuv/libuv/archive/refs/tags/v1.41.0.tar.gz %global nop_commit 910b55815be16109f04f4180e9adee14fb4ce281 %global nop_scommit %(c=%{nop_commit}; echo ${c:0:7}) Source22: https://github.com/google/libnop/archive/%%7Bnop_commit%7D/libnop-%%7Bnop_sc... - %endif
Patch0: 0001-no-third_party-foxi.patch @@ -141,7 +152,9 @@ BuildRequires: cmake BuildRequires: cpuinfo-devel BuildRequires: eigen3-devel BuildRequires: fmt-devel +%if %{with caffe2} BuildRequires: foxi-devel +%endif BuildRequires: FP16-devel BuildRequires: fxdiv-devel BuildRequires: gcc-c++ @@ -166,7 +179,9 @@ BuildRequires: pthreadpool-devel BuildRequires: psimd-devel BuildRequires: sleef-devel BuildRequires: valgrind-devel +%if %{with xnnpack} BuildRequires: xnnpack-devel = 0.0^git20240229.fcbf55a +%endif
BuildRequires: python3-devel BuildRequires: python3dist(filelock) @@ -512,11 +527,14 @@ export USE_SYSTEM_PTHREADPOOL=ON export USE_SYSTEM_PSIMD=ON export USE_SYSTEM_FXDIV=ON export USE_SYSTEM_ONNX=ON -export USE_SYSTEM_XNNPACK=ON export USE_SYSTEM_PYBIND11=OFF export USE_SYSTEM_LIBS=OFF export USE_TENSORPIPE=OFF + +%if %{with xnnpack} +export USE_SYSTEM_XNNPACK=ON export USE_XNNPACK=ON +%endif
%if %{with caffe2} export BUILD_CAFFE2=ON
commit 237cc5742ff4de6a98917b38ace95f1ec5824fa0 Author: Tom Rix trix@redhat.com Date: Thu May 2 18:07:56 2024 -0600
Enable dynamo on 3.12
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/0001-dynamo-3.12-enable-dynamo-on-3.12-enable-most-dynamo.patch b/0001-dynamo-3.12-enable-dynamo-on-3.12-enable-most-dynamo.patch new file mode 100644 index 0000000..0ce5b1f --- /dev/null +++ b/0001-dynamo-3.12-enable-dynamo-on-3.12-enable-most-dynamo.patch @@ -0,0 +1,226 @@ +From b9d45eb1cc90696a4de76676221219e24423c709 Mon Sep 17 00:00:00 2001 +From: William Wen williamwen@meta.com +Date: Wed, 3 Apr 2024 17:58:46 -0700 +Subject: [PATCH] [dynamo, 3.12] enable dynamo on 3.12, enable most dynamo + unittests on 3.12 (#123216) + +Pull Request resolved: https://github.com/pytorch/pytorch/pull/123216 +Approved by: https://github.com/jansel, https://github.com/malfet +--- + test/dynamo/test_autograd_function.py | 3 ++ + test/dynamo/test_misc.py | 63 +++++++++++++++++++++++++ + test/functorch/test_eager_transforms.py | 7 ++- + test/run_test.py | 3 -- + torch/__init__.py | 5 +- + torch/_dynamo/eval_frame.py | 4 +- + torch/_dynamo/test_case.py | 8 +--- + 7 files changed, 74 insertions(+), 19 deletions(-) + +diff --git a/test/dynamo/test_autograd_function.py b/test/dynamo/test_autograd_function.py +index d23fec607afa..bc5ebc767038 100644 +--- a/test/dynamo/test_autograd_function.py ++++ b/test/dynamo/test_autograd_function.py +@@ -2,6 +2,8 @@ + + import copy + import math ++import sys ++import unittest + + import torch + +@@ -528,6 +530,7 @@ class AutogradFunctionTests(torch._dynamo.test_case.TestCase): + # I pulled all of these test cases from test_autograd.py + # In the future, we should make the Dynamo test suite actually + # run on test_autograd.py (it's disabled right now) and delete these. ++ @unittest.skipIf(sys.version_info >= (3, 12), "invalid free in 3.12+") + def test_smoke_from_test_autograd(self): + class Func(torch.autograd.Function): + @staticmethod +diff --git a/test/dynamo/test_misc.py b/test/dynamo/test_misc.py +index a73de8b1c7e9..8f54e0564e6b 100644 +--- a/test/dynamo/test_misc.py ++++ b/test/dynamo/test_misc.py +@@ -9760,6 +9760,69 @@ fn + lambda mod: mod, + ) + ++ @xfailIfPy311 ++ def test_outside_linear_module_free(self): ++ # Compared to test_linear_module_free, the linear ++ # layer is not the code object that is directly compiled. ++ def model_inp_ctr(): ++ fc = torch.nn.Linear(100, 100) ++ ++ class Mod(torch.nn.Module): ++ def __init__(self): ++ super().__init__() ++ self.fc_ref = fc ++ ++ def forward(self, x): ++ return fc(x[0]) ++ ++ # return fc to keep it alive in _test_compile_model_free ++ return Mod(), (torch.randn(100, 100), fc) ++ ++ self._test_compile_model_free(model_inp_ctr, lambda mod: mod.fc_ref) ++ ++ @unittest.skipIf(sys.version_info >= (3, 12), "leaks in 3.12+") ++ def test_parameter_free(self): ++ def model_inp_ctr(): ++ param = torch.nn.Parameter(torch.randn(100, 100)) ++ ++ class Mod(torch.nn.Module): ++ def __init__(self): ++ super().__init__() ++ self.param = param ++ ++ def forward(self, x): ++ return self.param * x[0] ++ ++ # return param to keep it alive in _test_compile_model_free ++ return Mod(), (torch.randn(100, 100), param) ++ ++ self._test_compile_model_free(model_inp_ctr, lambda mod: mod.param) ++ ++ def test_raises_importerror1(self): ++ @torch.compile(backend="eager") ++ def fn(x): ++ try: ++ import some_module_that_surely_does_not_exist ++ ++ return ++ except ImportError: ++ pass ++ return x.sin() ++ ++ x = torch.randn(8) ++ self.assertEqual(fn(x), x.sin()) ++ ++ def test_raises_importerror2(self): ++ @torch.compile(backend="eager") ++ def fn(x): ++ import some_module_that_surely_does_not_exist ++ ++ return x + 1 ++ ++ x = torch.randn(8) ++ with self.assertRaises(ImportError): ++ fn(x) ++ + def test_dynamo_cache_move_to_front(self): + class Mod(torch.nn.Module): + def __init__(self): +diff --git a/test/functorch/test_eager_transforms.py b/test/functorch/test_eager_transforms.py +index 09415cf8f48e..60790ec06059 100644 +--- a/test/functorch/test_eager_transforms.py ++++ b/test/functorch/test_eager_transforms.py +@@ -4762,8 +4762,7 @@ class TestCompileTransforms(TestCase): + # Triton only supports GPU with SM70 or later. + @expectedFailureIf((IS_ARM64 and not IS_MACOS) or + IS_WINDOWS or +- (TEST_CUDA and not SM70OrLater) or +- (sys.version_info >= (3, 12))) ++ (TEST_CUDA and not SM70OrLater)) + def test_compile_vmap_hessian(self, device): + # The model and inputs are a smaller version + # of code at benchmark repo: +@@ -4792,8 +4791,8 @@ class TestCompileTransforms(TestCase): + actual = opt_fn(params_and_buffers, x) + self.assertEqual(actual, expected) + +- # torch.compile is not supported on Windows or on Python 3.12+ +- @expectedFailureIf(IS_WINDOWS or (sys.version_info >= (3, 12))) ++ # torch.compile is not supported on Windows ++ @expectedFailureIf(IS_WINDOWS) + @torch._dynamo.config.patch(suppress_errors=False) + @torch._dynamo.config.patch(capture_func_transforms=True) + @skipIfTorchDynamo("Do not test torch.compile on top of torch.compile") +diff --git a/test/run_test.py b/test/run_test.py +index e86af9623042..ebb14df4167d 100755 +--- a/test/run_test.py ++++ b/test/run_test.py +@@ -74,7 +74,6 @@ sys.path.remove(str(REPO_ROOT)) + RERUN_DISABLED_TESTS = os.getenv("PYTORCH_TEST_RERUN_DISABLED_TESTS", "0") == "1" + DISTRIBUTED_TEST_PREFIX = "distributed" + INDUCTOR_TEST_PREFIX = "inductor" +-DYNAMO_TEST_PREFIX = "dynamo" + + + # Note [ROCm parallel CI testing] +@@ -324,7 +323,6 @@ JIT_EXECUTOR_TESTS = [ + ] + + INDUCTOR_TESTS = [test for test in TESTS if test.startswith(INDUCTOR_TEST_PREFIX)] +-DYNAMO_TESTS = [test for test in TESTS if test.startswith(DYNAMO_TEST_PREFIX)] + DISTRIBUTED_TESTS = [test for test in TESTS if test.startswith(DISTRIBUTED_TEST_PREFIX)] + TORCH_EXPORT_TESTS = [test for test in TESTS if test.startswith("export")] + FUNCTORCH_TESTS = [test for test in TESTS if test.startswith("functorch")] +@@ -1361,7 +1359,6 @@ def get_selected_tests(options) -> List[str]: + # these tests failing in Python 3.12 temporarily disabling + if sys.version_info >= (3, 12): + options.exclude.extend(INDUCTOR_TESTS) +- options.exclude.extend(DYNAMO_TESTS) + options.exclude.extend( + [ + "functorch/test_dims", +diff --git a/torch/__init__.py b/torch/__init__.py +index d381712b4a35..26cdffe81d29 100644 +--- a/torch/__init__.py ++++ b/torch/__init__.py +@@ -1861,9 +1861,8 @@ def compile(model: Optional[Callable] = None, *, + + """ + _C._log_api_usage_once("torch.compile") +- # Temporary until we get proper support for python 3.12 +- if sys.version_info >= (3, 12): +- raise RuntimeError("Dynamo is not supported on Python 3.12+") ++ if sys.version_info >= (3, 13): ++ raise RuntimeError("Dynamo is not supported on Python 3.13+") + + # Decorator mode + if model is None: +diff --git a/torch/_dynamo/eval_frame.py b/torch/_dynamo/eval_frame.py +index 53ab0df3a947..0a80eeea99ed 100644 +--- a/torch/_dynamo/eval_frame.py ++++ b/torch/_dynamo/eval_frame.py +@@ -589,8 +589,8 @@ class _NullDecorator(contextlib.nullcontext): # type: ignore[type-arg] + + + def check_if_dynamo_supported(): +- if sys.version_info >= (3, 12): +- raise RuntimeError("Python 3.12+ not yet supported for torch.compile") ++ if sys.version_info >= (3, 13): ++ raise RuntimeError("Python 3.13+ not yet supported for torch.compile") + + + def is_dynamo_supported(): +diff --git a/torch/_dynamo/test_case.py b/torch/_dynamo/test_case.py +index e3cbef09eaae..297ea6e2bc2a 100644 +--- a/torch/_dynamo/test_case.py ++++ b/torch/_dynamo/test_case.py +@@ -1,7 +1,6 @@ + import contextlib + import importlib + import logging +-import sys + + import torch + import torch.testing +@@ -20,12 +19,7 @@ log = logging.getLogger(__name__) + def run_tests(needs=()): + from torch.testing._internal.common_utils import run_tests + +- if ( +- TEST_WITH_TORCHDYNAMO +- or IS_WINDOWS +- or TEST_WITH_CROSSREF +- or sys.version_info >= (3, 12) +- ): ++ if TEST_WITH_TORCHDYNAMO or IS_WINDOWS or TEST_WITH_CROSSREF: + return # skip testing + + if isinstance(needs, str): +-- +2.44.0 + diff --git a/python-torch.spec b/python-torch.spec index 5c4640f..da0f59e 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -121,6 +121,9 @@ Patch6: 0001-reenable-foxi-linking.patch # https://github.com/pytorch/pytorch/pull/123384 Patch7: 0001-Reenable-dim-for-python-3.12.patch
+# Dynamo/Inductor on 3.12 +Patch8: 0001-dynamo-3.12-enable-dynamo-on-3.12-enable-most-dynamo.patch + # ROCm patches # https://github.com/pytorch/pytorch/pull/120551 Patch100: 0001-Optionally-use-hipblaslt.patch
commit f28581bb0c0c8183df95efab7f6c73256386ff74 Author: Tom Rix trix@redhat.com Date: Thu May 2 11:07:50 2024 -0400
Disable dwz with ROCm
Work around a problem with running out of memory and thrashing the build machine. Eanble opencv for Fedora
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index a490e36..5c4640f 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -50,13 +50,22 @@ %bcond_without tensorpipe
# For testing openvs +%if 0%{?fedora} +%bcond_without opencv +%else %bcond_with opencv +%endif
# For testing cuda %ifarch x86_64 %bcond_with cuda %endif
+# Disable dwz with rocm because memory can be exhausted +%if %{with rocm} +%define _find_debuginfo_dwz_opts %{nil} +%endif + Name: python-%{pypi_name} %if %{with gitcommit} Version: %{pypi_version}^git%{date0}.%{shortcommit0}
commit 89597ed77ceb6d3639d7a19b41ae96b024038585 Author: Tom Rix trix@redhat.com Date: Tue Apr 30 12:42:36 2024 -0600
Update sources
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index 6c78a8d..5038800 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /v1.41.0.tar.gz /libnop-910b558.tar.gz /pytorch-97ff6cf.tar.gz +/pytorch-v2.3.0.tar.gz diff --git a/sources b/sources index b9570c2..10cd24e 100644 --- a/sources +++ b/sources @@ -10,3 +10,4 @@ SHA512 (tensorpipe-52791a2.tar.gz) = 1e5faf17a7236c5506c08cb28be16069b11bb929bbc SHA512 (v1.41.0.tar.gz) = bb08a1970a10e8d9571ffea3d021643de30ec212cd51317b98d6cf0cfe55d6877992921fb01d1188a6d466687335b77885685d924f8cb7200a0bec30eee05c65 SHA512 (libnop-910b558.tar.gz) = 74c5324eaa1b6b2ac8dfef94c835b5c5b044625f8e5efe3522470b1ecc4798ff43d344a013cee2f6901e83267c6167072947b754e63f1552ae7044cffe234c36 SHA512 (pytorch-97ff6cf.tar.gz) = 105ebcba298558fe833f90e7e40b003d35a74609e777f9dc4c47f5668c884f603455113ac0ff252a62b83c81137ae66ceb1a862d351203925dcfc3dcf9f73580 +SHA512 (pytorch-v2.3.0.tar.gz) = 0c2ffc7bf2fd86070e9958c34eca1f03a0248a011ac6ffaeb69f65306ff856edd5359986f02af25888433187e6d7f29b60edded092e2ac30c8cec49023166eda
commit bc28f10c5b9bf98d19d2c56f7d740d3cab008297 Author: Tom Rix trix@redhat.com Date: Tue Apr 30 12:02:09 2024 -0600
Initial 2.3 release
Also enable rccl
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 96a34f7..a490e36 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -4,16 +4,12 @@ %global forgeurl https://github.com/pytorch/pytorch
# So pre releases can be tried -%bcond_without gitcommit +%bcond_with gitcommit %if %{with gitcommit} # git tag v2.3.0-rc12 %global commit0 97ff6cfd9c86c5c09d7ce775ab64ec5c99230f5d %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) %global date0 20240408 -%else -%global commit0 975d4284250170602db60adfda5eb1664a3b8acc -%global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) -%global date0 20240307 %endif %global pypi_version 2.3.0
@@ -48,7 +44,7 @@ # For testing distributed %bcond_without distributed # For testing distributed+rccl etc. -%bcond_with rccl +%bcond_without rccl %bcond_with gloo %bcond_without mpi %bcond_without tensorpipe @@ -62,7 +58,11 @@ %endif
Name: python-%{pypi_name} +%if %{with gitcommit} Version: %{pypi_version}^git%{date0}.%{shortcommit0} +%else +Version: %{pypi_version} +%endif Release: %autorelease Summary: PyTorch AI/ML framework # See license.txt for license details @@ -73,8 +73,7 @@ URL: https://pytorch.org/ Source0: %{forgeurl}/archive/%{commit0}/pytorch-%{shortcommit0}.tar.gz Source100: pyproject.toml %else -Source0: %{forgeurl}/archive/%{commit0}/pytorch-%{shortcommit0}.tar.gz -Source100: pyproject.toml +Source0: %{forgeurl}/releases/download/v%{version}/pytorch-v%{version}.tar.gz %endif Source1: https://github.com/google/flatbuffers/archive/refs/tags/v23.3.3.tar.gz Source2: https://github.com/pybind/pybind11/archive/refs/tags/v2.11.1.tar.gz @@ -296,12 +295,16 @@ Requires: python3-%{pypi_name}%{?_isa} = %{version}-%{release}
%prep
+%if %{with gitcommit} %autosetup -p1 -n pytorch-%{commit0} +# Overwrite with a git checkout of the pyproject.toml +cp %{SOURCE100} . +%else +%autosetup -p1 -n pytorch-v%{version} +%endif
# Remove bundled egg-info rm -rf %{pypi_name}.egg-info -# Overwrite with a git checkout of the pyproject.toml -cp %{SOURCE100} .
tar xf %{SOURCE1} cp -r flatbuffers-23.3.3/* third_party/flatbuffers/
commit df5f2eac43b3205fb00e414ff39a542c3a86b311 Author: Tom Rix trix@redhat.com Date: Mon Apr 15 12:17:47 2024 -0600
Use the system gloo
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index da7915b..96a34f7 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -524,6 +524,7 @@ export TP_BUILD_LIBUV=OFF
%if %{with gloo} export USE_GLOO=ON +export USE_SYSTEM_GLOO=ON %endif %if %{with mpi} export USE_MPI=ON
commit fad8e2643a347823475385584fa9aeae0505282c Author: Tom Rix trix@redhat.com Date: Wed Apr 10 18:20:02 2024 -0600
v2.3.0-rc12
And turn on distributed parts that work.
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index cad15bf..6c78a8d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /tensorpipe-52791a2.tar.gz /v1.41.0.tar.gz /libnop-910b558.tar.gz +/pytorch-97ff6cf.tar.gz diff --git a/python-torch.spec b/python-torch.spec index 1b83697..da7915b 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -6,10 +6,10 @@ # So pre releases can be tried %bcond_without gitcommit %if %{with gitcommit} -# git tag v2.3.0-rc7 -%global commit0 4bb5cb51e6ceeb4b0b70b439c7b92168855f146f +# git tag v2.3.0-rc12 +%global commit0 97ff6cfd9c86c5c09d7ce775ab64ec5c99230f5d %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) -%global date0 20240402 +%global date0 20240408 %else %global commit0 975d4284250170602db60adfda5eb1664a3b8acc %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) @@ -46,12 +46,12 @@ %endif
# For testing distributed -%bcond_with distributed +%bcond_without distributed # For testing distributed+rccl etc. %bcond_with rccl %bcond_with gloo -%bcond_with mpi -%bcond_with tensorpipe +%bcond_without mpi +%bcond_without tensorpipe
# For testing openvs %bcond_with opencv diff --git a/sources b/sources index 72835ff..b9570c2 100644 --- a/sources +++ b/sources @@ -9,3 +9,4 @@ SHA512 (pytorch-4bb5cb5.tar.gz) = 430ae996ddee560537787646ae9f7aa01498f37c99c2e3 SHA512 (tensorpipe-52791a2.tar.gz) = 1e5faf17a7236c5506c08cb28be16069b11bb929bbca64ed9745ce4277d46739186ab7d6597da7437d90ed2d166d4c37ef2f3bceabe8083ef3adbb0e8e5f227e SHA512 (v1.41.0.tar.gz) = bb08a1970a10e8d9571ffea3d021643de30ec212cd51317b98d6cf0cfe55d6877992921fb01d1188a6d466687335b77885685d924f8cb7200a0bec30eee05c65 SHA512 (libnop-910b558.tar.gz) = 74c5324eaa1b6b2ac8dfef94c835b5c5b044625f8e5efe3522470b1ecc4798ff43d344a013cee2f6901e83267c6167072947b754e63f1552ae7044cffe234c36 +SHA512 (pytorch-97ff6cf.tar.gz) = 105ebcba298558fe833f90e7e40b003d35a74609e777f9dc4c47f5668c884f603455113ac0ff252a62b83c81137ae66ceb1a862d351203925dcfc3dcf9f73580
commit 3d98ae877ea611631645e8fb89df726da704c10a Author: Tom Rix trix@redhat.com Date: Sat Apr 6 07:08:52 2024 -0600
Update to 2.3-rc7
Patch the dim issue needed for torchrl Stage tensorpipe thirdparty needed for distributed.
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index 96d43c4..cad15bf 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,7 @@ /v2.11.1.tar.gz /pytorch-6a89a75.tar.gz /pytorch-74832f1.tar.gz +/pytorch-4bb5cb5.tar.gz +/tensorpipe-52791a2.tar.gz +/v1.41.0.tar.gz +/libnop-910b558.tar.gz diff --git a/0001-Reenable-dim-for-python-3.12.patch b/0001-Reenable-dim-for-python-3.12.patch new file mode 100644 index 0000000..138b5d4 --- /dev/null +++ b/0001-Reenable-dim-for-python-3.12.patch @@ -0,0 +1,115 @@ +From ee3fb343a376cdba6f4ce188cac90023f13e2aea Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Thu, 4 Apr 2024 14:21:38 -0600 +Subject: [PATCH] Reenable dim for python 3.12 + +In 3.12: + +_PyArg_Parser added an element to the start of the structure. +So existing positional initialization is off. Switch to element +initialization. + +_Py_CODEUNIT changed to from an int to a union, but relevant_op +is passed an int for the return of decoder.opcode, so the parameter +type is wrong, switch it to int. + +The opcode PRECALL was removed, so reduce its handling to 3.11 + +Signed-off-by: Tom Rix trix@redhat.com +--- + functorch/csrc/dim/dim.cpp | 24 +++++------------------- + functorch/csrc/dim/minpybind.h | 4 ++-- + 2 files changed, 7 insertions(+), 21 deletions(-) + +diff --git a/functorch/csrc/dim/dim.cpp b/functorch/csrc/dim/dim.cpp +index 4cc027504c77..e48b0d58081f 100644 +--- a/functorch/csrc/dim/dim.cpp ++++ b/functorch/csrc/dim/dim.cpp +@@ -6,20 +6,6 @@ + + #include <torch/csrc/utils/python_compat.h> + +- +-// Many APIs have changed/don't exist anymore +-#if IS_PYTHON_3_12_PLUS +- +-#include "dim.h" +- +-// Re-enable this some day +-PyObject* Dim_init() { +- PyErr_SetString(PyExc_RuntimeError, "First class dim doesn't work with python 3.12"); +- return nullptr; +-} +- +-#else +- + #include "minpybind.h" + #include <frameobject.h> + #include <opcode.h> +@@ -441,7 +427,7 @@ static PyObject* DimList_bind(DimList *self, + PY_BEGIN + mpy::handle sizes; + static const char * const _keywords[] = {"sizes", nullptr}; +- static _PyArg_Parser parser = {"O", _keywords, 0}; ++ static _PyArg_Parser parser = { .format = "O", .keywords = _keywords}; + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &parser, &sizes)) { + return nullptr; + } +@@ -465,7 +451,7 @@ static PyObject* DimList_bind_len(DimList *self, + PY_BEGIN + int size; + static const char * const _keywords[] = {"N", nullptr}; +- static _PyArg_Parser parser = {"i", _keywords, 0}; ++ static _PyArg_Parser parser = { .format = "i", .keywords = _keywords}; + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &parser, &size)) { + return nullptr; + } +@@ -1468,7 +1454,7 @@ PyTypeObject Tensor::Type = { + + // dim() -------------------- + +-static bool relevant_op(_Py_CODEUNIT c) { ++static bool relevant_op(int c) { + switch(c) { + case STORE_NAME: + case STORE_GLOBAL: +@@ -1587,7 +1573,7 @@ static PyObject* _dims(PyObject *self, + auto c = mpy::obj<PyCodeObject>::steal(PyFrame_GetCode(f.ptr())); + auto lasti = PyFrame_GetLasti(f.ptr()); + auto decoder = PyInstDecoder(c.ptr(), lasti); +- #if IS_PYTHON_3_11_PLUS ++ #if IS_PYTHON_3_11 + // When py3.11 adapts bytecode lasti points to the precall + // rather than the call instruction after it + if (decoder.opcode() == PRECALL) { +@@ -3268,4 +3254,4 @@ PyObject* Dim_init() { + } + } + +-#endif ++ +diff --git a/functorch/csrc/dim/minpybind.h b/functorch/csrc/dim/minpybind.h +index de82b5af95a4..d76d4828bf80 100644 +--- a/functorch/csrc/dim/minpybind.h ++++ b/functorch/csrc/dim/minpybind.h +@@ -621,7 +621,7 @@ struct vector_args { + PyObject *dummy = NULL; + _PyArg_ParseStackAndKeywords((PyObject*const*)args, nargs, kwnames.ptr(), _parser, &dummy, &dummy, &dummy, &dummy, &dummy); + #else +- _PyArg_Parser* _parser = new _PyArg_Parser{NULL, &names_buf[0], fname_cstr, 0}; ++ _PyArg_Parser* _parser = new _PyArg_Parser{ .keywords = &names_buf[0], .fname = fname_cstr}; + std::unique_ptr<PyObject*[]> buf(new PyObject*[names.size()]); + _PyArg_UnpackKeywords((PyObject*const*)args, nargs, NULL, kwnames.ptr(), _parser, required, (Py_ssize_t)values.size() - kwonly, 0, &buf[0]); + #endif +@@ -706,7 +706,7 @@ inline object handle::call_vector(vector_args args) { + #define MPY_PARSE_ARGS_KWNAMES(fmt, FORALL_ARGS) \ + static const char * const kwlist[] = { FORALL_ARGS(MPY_ARGS_NAME) nullptr}; \ + FORALL_ARGS(MPY_ARGS_DECLARE) \ +- static _PyArg_Parser parser = {fmt, kwlist, 0}; \ ++ static _PyArg_Parser parser = { .format = fmt, .keywords = kwlist}; \ + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &parser, FORALL_ARGS(MPY_ARGS_POINTER) nullptr)) { \ + throw mpy::exception_set(); \ + } +-- +2.44.0 + diff --git a/python-torch.spec b/python-torch.spec index f26f395..1b83697 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -6,10 +6,10 @@ # So pre releases can be tried %bcond_without gitcommit %if %{with gitcommit} -# git tag v2.3.0-rc6 -%global commit0 74832f12fae2e1bc51bf1f9971dcd12c90a971f5 +# git tag v2.3.0-rc7 +%global commit0 4bb5cb51e6ceeb4b0b70b439c7b92168855f146f %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) -%global date0 20242213 +%global date0 20240402 %else %global commit0 975d4284250170602db60adfda5eb1664a3b8acc %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) @@ -47,6 +47,11 @@
# For testing distributed %bcond_with distributed +# For testing distributed+rccl etc. +%bcond_with rccl +%bcond_with gloo +%bcond_with mpi +%bcond_with tensorpipe
# For testing openvs %bcond_with opencv @@ -81,6 +86,20 @@ Source10: https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v%%7Bcu Source11: https://github.com/NVIDIA/cutlass/archive/refs/tags/v%%7Bcul_ver%7D.tar.gz %endif
+%if %{with tensorpipe} +# Developement on tensorpipe has stopped, repo made read only July 1, 2023, this is the last commit +%global tp_commit 52791a2fd214b2a9dc5759d36725909c1daa7f2e +%global tp_scommit %(c=%{tp_commit}; echo ${c:0:7}) +Source20: https://github.com/pytorch/tensorpipe/archive/%%7Btp_commit%7D/tensorpipe-%%... +# The old libuv tensorpipe uses +Source21: https://github.com/libuv/libuv/archive/refs/tags/v1.41.0.tar.gz +# Developement afaik on libnop has stopped, this is the last commit +%global nop_commit 910b55815be16109f04f4180e9adee14fb4ce281 +%global nop_scommit %(c=%{nop_commit}; echo ${c:0:7}) +Source22: https://github.com/google/libnop/archive/%%7Bnop_commit%7D/libnop-%%7Bnop_sc... + +%endif + Patch0: 0001-no-third_party-foxi.patch Patch1: 0001-no-third_party-fmt.patch Patch2: 0001-no-third_party-FXdiv.patch @@ -91,6 +110,9 @@ Patch5: 0001-disable-submodule-search.patch Patch6: 0001-reenable-foxi-linking.patch %endif
+# https://github.com/pytorch/pytorch/pull/123384 +Patch7: 0001-Reenable-dim-for-python-3.12.patch + # ROCm patches # https://github.com/pytorch/pytorch/pull/120551 Patch100: 0001-Optionally-use-hipblaslt.patch @@ -114,19 +136,23 @@ BuildRequires: fxdiv-devel BuildRequires: gcc-c++ BuildRequires: gcc-gfortran %if %{with distributed} +%if %{with gloo} BuildRequires: gloo-devel %endif +%endif BuildRequires: ninja-build BuildRequires: onnx-devel BuildRequires: libomp-devel +%if %{with distributed} +%if %{with mpi} +BuildRequires: openmpi-devel +%endif +%endif BuildRequires: openblas-devel BuildRequires: pocketfft-devel BuildRequires: protobuf-devel BuildRequires: pthreadpool-devel BuildRequires: psimd-devel -BuildRequires: python3-numpy -BuildRequires: python3-pyyaml -BuildRequires: python3-typing-extensions BuildRequires: sleef-devel BuildRequires: valgrind-devel BuildRequires: xnnpack-devel = 0.0^git20240229.fcbf55a @@ -135,9 +161,11 @@ BuildRequires: python3-devel BuildRequires: python3dist(filelock) BuildRequires: python3dist(jinja2) BuildRequires: python3dist(networkx) +BuildRequires: python3dist(numpy) +BuildRequires: python3dist(pyyaml) BuildRequires: python3dist(setuptools) -BuildRequires: python3dist(typing-extensions) BuildRequires: python3dist(sphinx) +BuildRequires: python3dist(typing-extensions)
%if 0%{?fedora} BuildRequires: python3-pybind11 @@ -160,8 +188,10 @@ BuildRequires: rocblas-devel BuildRequires: rocrand-devel BuildRequires: rocfft-devel %if %{with distributed} +%if %{with rccl} BuildRequires: rccl-devel %endif +%endif BuildRequires: rocprim-devel BuildRequires: rocm-cmake BuildRequires: rocm-comgr-devel @@ -186,13 +216,23 @@ BuildRequires: google-benchmark-devel
Requires: python3dist(dill)
+# For convience +Provides: pytorch + # Apache-2.0 Provides: bundled(flatbuffers) = 22.3.3 # MIT Provides: bundled(miniz) = 2.1.0 Provides: bundled(pybind11) = 2.11.1 -# For convience -Provides: pytorch + +%if %{with tensorpipe} +# BSD-3-Clause +Provides: bundled(tensorpipe) +# Apache-2.0 +Provides: bundled(libnop) +# MIT AND CC-BY-4.0 AND ISC AND BSD-2-Clause +Provides: bundled(libuv) = 1.41.0 +%endif
@@ -276,6 +316,15 @@ tar xf %{SOURCE11} cp -r cutlass-%{cul_ver}/* third_party/cutlass/ %endif
+%if %{with tensorpipe} +tar xf %{SOURCE20} +cp -r tensorpipe-*/* third_party/tensorpipe/ +tar xf %{SOURCE21} +cp -r libuv-*/* third_party/tensorpipe/third_party/libuv/ +tar xf %{SOURCE22} +cp -r libnop-*/* third_party/tensorpipe/third_party/libnop/ +%endif + %if %{with opencv} # Reduce requirements, *FOUND is not set sed -i -e 's/USE_OPENCV AND OpenCV_FOUND AND USE_FFMPEG AND FFMPEG_FOUND/USE_OPENCV AND USE_FFMPEG/' caffe2/video/CMakeLists.txt @@ -318,6 +367,10 @@ mv third_party/cudnn_frontend . mv third_party/cutlass . %endif
+%if %{with tensorpipe} +mv third_party/tensorpipe . +%endif + %if %{with test} mv third_party/googletest . %endif @@ -335,6 +388,10 @@ mv cudnn_frontend third_party mv cutlass third_party %endif
+%if %{with tensorpipe} +mv tensorpipe third_party +%endif + %if %{with test} mv googletest third_party %endif @@ -417,11 +474,14 @@ export USE_CUDA=OFF export USE_FBGEMM=OFF export USE_FLASH_ATTENTION=OFF export USE_GOLD_LINKER=OFF +export USE_GLOO=OFF export USE_ITT=OFF export USE_KINETO=OFF export USE_LITE_INTERPRETER_PROFILER=OFF export USE_LITE_PROTO=OFF +export USE_MAGMA=OFF export USE_MKLDNN=OFF +export USE_MPI=OFF export USE_NCCL=OFF export USE_NNPACK=OFF export USE_NUMPY=ON @@ -457,6 +517,17 @@ export USE_CUDA=ON
%if %{with distributed} export USE_DISTRIBUTED=ON +%if %{with tensorpipe} +export USE_TENSORPIPE=ON +export TP_BUILD_LIBUV=OFF +%endif + +%if %{with gloo} +export USE_GLOO=ON +%endif +%if %{with mpi} +export USE_MPI=ON +%endif %endif
%if %{with opencv} diff --git a/sources b/sources index 0c21ff2..72835ff 100644 --- a/sources +++ b/sources @@ -5,3 +5,7 @@ SHA512 (v23.3.3.tar.gz) = 4066c94f2473c7ea16917d29a613e16f840a329089c88e0bdbdb99 SHA512 (v2.11.1.tar.gz) = ed1512ff0bca3bc0a45edc2eb8c77f8286ab9389f6ff1d5cb309be24bc608abbe0df6a7f5cb18c8f80a3bfa509058547c13551c3cd6a759af708fd0cdcdd9e95 SHA512 (pytorch-6a89a75.tar.gz) = 6978acc6f37d7c5adc71517a6f379c7133b2bbd040189deddba7753acde41f6ddba2e9f2e397928e89c776d6a5458b8a74f8e04beb312d71fd30b072687ba98f SHA512 (pytorch-74832f1.tar.gz) = bd553bfbbb422d353bbbf616c201251b2517b905e2621fa05bfe3d97726b078caad377583adccdc0cca234235a11fcb4730a93e834907b2ca4c06d552b2a2683 +SHA512 (pytorch-4bb5cb5.tar.gz) = 430ae996ddee560537787646ae9f7aa01498f37c99c2e3fe4c5f66ee732ee3fe4ecf337fdf857bc0c7fe27634af75cee3ce576bbe2576463b81e27dbbfacf6ef +SHA512 (tensorpipe-52791a2.tar.gz) = 1e5faf17a7236c5506c08cb28be16069b11bb929bbca64ed9745ce4277d46739186ab7d6597da7437d90ed2d166d4c37ef2f3bceabe8083ef3adbb0e8e5f227e +SHA512 (v1.41.0.tar.gz) = bb08a1970a10e8d9571ffea3d021643de30ec212cd51317b98d6cf0cfe55d6877992921fb01d1188a6d466687335b77885685d924f8cb7200a0bec30eee05c65 +SHA512 (libnop-910b558.tar.gz) = 74c5324eaa1b6b2ac8dfef94c835b5c5b044625f8e5efe3522470b1ecc4798ff43d344a013cee2f6901e83267c6167072947b754e63f1552ae7044cffe234c36
commit b131897b0f68746765808d958184eaa05dee4dc0 Author: Tom Rix trix@redhat.com Date: Sun Mar 31 13:55:42 2024 -0600
Provide pytorch as a convience
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 568e7b3..f26f395 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -186,12 +186,14 @@ BuildRequires: google-benchmark-devel
Requires: python3dist(dill)
- # Apache-2.0 Provides: bundled(flatbuffers) = 22.3.3 # MIT Provides: bundled(miniz) = 2.1.0 Provides: bundled(pybind11) = 2.11.1 +# For convience +Provides: pytorch +
%description
commit f35f3f7fe84a920dc9bd9ac4afbbe4cfe4413d66 Author: Tom Rix trix@redhat.com Date: Wed Mar 27 16:08:38 2024 -0600
Update to 2.3-rc6
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index 7a720eb..96d43c4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /v23.3.3.tar.gz /v2.11.1.tar.gz /pytorch-6a89a75.tar.gz +/pytorch-74832f1.tar.gz diff --git a/python-torch.spec b/python-torch.spec index 4807121..568e7b3 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -6,10 +6,10 @@ # So pre releases can be tried %bcond_without gitcommit %if %{with gitcommit} -# git tag v2.3.0-rc2 -%global commit0 6a89a753b1556fe8558582c452fdba083f6ec01a +# git tag v2.3.0-rc6 +%global commit0 74832f12fae2e1bc51bf1f9971dcd12c90a971f5 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) -%global date0 20240313 +%global date0 20242213 %else %global commit0 975d4284250170602db60adfda5eb1664a3b8acc %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) @@ -180,11 +180,13 @@ Requires: rocm-rpm-macros-modules BuildRequires: opencv-devel %endif
- %if %{with test} BuildRequires: google-benchmark-devel %endif
+Requires: python3dist(dill) + + # Apache-2.0 Provides: bundled(flatbuffers) = 22.3.3 # MIT diff --git a/sources b/sources index c12deda..0c21ff2 100644 --- a/sources +++ b/sources @@ -4,3 +4,4 @@ SHA512 (pytorch-975d428.tar.gz) = a02195b18d832db9a739c3eeecd0cd0c8868d8b92e4a2f SHA512 (v23.3.3.tar.gz) = 4066c94f2473c7ea16917d29a613e16f840a329089c88e0bdbdb999aef3442ba00abfd2aa92266fa9c067e399dc88e6f0ccac40dc151378857e665638e78bbf0 SHA512 (v2.11.1.tar.gz) = ed1512ff0bca3bc0a45edc2eb8c77f8286ab9389f6ff1d5cb309be24bc608abbe0df6a7f5cb18c8f80a3bfa509058547c13551c3cd6a759af708fd0cdcdd9e95 SHA512 (pytorch-6a89a75.tar.gz) = 6978acc6f37d7c5adc71517a6f379c7133b2bbd040189deddba7753acde41f6ddba2e9f2e397928e89c776d6a5458b8a74f8e04beb312d71fd30b072687ba98f +SHA512 (pytorch-74832f1.tar.gz) = bd553bfbbb422d353bbbf616c201251b2517b905e2621fa05bfe3d97726b078caad377583adccdc0cca234235a11fcb4730a93e834907b2ca4c06d552b2a2683
commit a0fd504b6acada38f189d560a52787ad6edeecc9 Author: Tom Rix trix@redhat.com Date: Fri Mar 22 15:43:54 2024 -0600
Remove conditional around the rocm patches
Suggested-by: Tim Flink tflink@redhat.com Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index f43e5e5..4807121 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -91,7 +91,7 @@ Patch5: 0001-disable-submodule-search.patch Patch6: 0001-reenable-foxi-linking.patch %endif
-%if %{with rocm} +# ROCm patches # https://github.com/pytorch/pytorch/pull/120551 Patch100: 0001-Optionally-use-hipblaslt.patch Patch101: 0001-cuda-hip-signatures.patch @@ -99,7 +99,6 @@ Patch102: 0001-silence-an-assert.patch Patch103: 0001-can-not-use-with-c-files.patch Patch104: 0001-use-any-hip.patch Patch105: 0001-disable-use-of-aotriton.patch -%endif
ExclusiveArch: x86_64 aarch64 %global toolchain gcc
commit 307001f4812a70c50e4124234580e414abe4d83e Author: Tom Rix trix@redhat.com Date: Fri Mar 22 13:43:35 2024 -0600
Split the ROCm gpu families out into subpackages.
The main package was getting too big.
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 07a47eb..f43e5e5 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -214,20 +214,31 @@ 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 python3-%{pypi_name}-devel -Summary: Libraries and headers for %{name} -Requires: python3-%{pypi_name}%{?_isa} = %{version}-%{release} +%if %{with rocm} +%package -n python3-%{pypi_name}-rocm-gfx8 +Summary: %{name} for ROCm gfx8
-%description -n python3-%{pypi_name}-devel +%description -n python3-%{pypi_name}-rocm-gfx8 %{summary}
-%if %{with rocm} -%package -n python3-%{pypi_name}-rocm -Summary: %{name} for ROCm -Requires: python3-%{pypi_name}%{?_isa} = %{version}-%{release} +%package -n python3-%{pypi_name}-rocm-gfx9 +Summary: %{name} for ROCm gfx9
-%description -n python3-%{pypi_name}-rocm +%description -n python3-%{pypi_name}-rocm-gfx9 %{summary} + +%package -n python3-%{pypi_name}-rocm-gfx10 +Summary: %{name} for ROCm gfx10 + +%description -n python3-%{pypi_name}-rocm-gfx10 +%{summary} + +%package -n python3-%{pypi_name}-rocm-gfx11 +Summary: %{name} for ROCm gfx11 + +%description -n python3-%{pypi_name}-rocm-gfx11 +%{summary} + %endif
%if %{with test} @@ -550,11 +561,23 @@ done %if %{with caffe2} %{python3_sitearch}/caffe2 %endif + %if %{with rocm} -%if %{with rocm_loop} -%{_libdir}/rocm/gfx*/bin/* -%{_libdir}/rocm/gfx*/lib64/* -%endif +%files -n python3-%{pypi_name}-rocm-gfx8 +%{_libdir}/rocm/gfx8/bin/* +%{_libdir}/rocm/gfx8/lib64/* + +%files -n python3-%{pypi_name}-rocm-gfx9 +%{_libdir}/rocm/gfx9/bin/* +%{_libdir}/rocm/gfx9/lib64/* + +%files -n python3-%{pypi_name}-rocm-gfx10 +%{_libdir}/rocm/gfx10/bin/* +%{_libdir}/rocm/gfx10/lib64/* + +%files -n python3-%{pypi_name}-rocm-gfx11 +%{_libdir}/rocm/gfx11/bin/* +%{_libdir}/rocm/gfx11/lib64/* %endif
%changelog
commit c12477f1bc0e921fcb8100958daf4f2bebee081f Author: Tom Rix trix@redhat.com Date: Thu Mar 21 04:52:35 2024 -0600
Update the source to 2.3-rc2
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index 612c3df..7a720eb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /pytorch-975d428.tar.gz /v23.3.3.tar.gz /v2.11.1.tar.gz +/pytorch-6a89a75.tar.gz diff --git a/sources b/sources index 37652db..c12deda 100644 --- a/sources +++ b/sources @@ -3,3 +3,4 @@ SHA512 (pytorch-v2.1.2.tar.gz) = b7305407ad9dda877d277a0e7009f65f6d69f39370f2231 SHA512 (pytorch-975d428.tar.gz) = a02195b18d832db9a739c3eeecd0cd0c8868d8b92e4a2fca42e4bdd20735f0745d84573df28d9ae1db014cf79ffd005a8409b3e8bb92f9db2a446f784ef46ff4 SHA512 (v23.3.3.tar.gz) = 4066c94f2473c7ea16917d29a613e16f840a329089c88e0bdbdb999aef3442ba00abfd2aa92266fa9c067e399dc88e6f0ccac40dc151378857e665638e78bbf0 SHA512 (v2.11.1.tar.gz) = ed1512ff0bca3bc0a45edc2eb8c77f8286ab9389f6ff1d5cb309be24bc608abbe0df6a7f5cb18c8f80a3bfa509058547c13551c3cd6a759af708fd0cdcdd9e95 +SHA512 (pytorch-6a89a75.tar.gz) = 6978acc6f37d7c5adc71517a6f379c7133b2bbd040189deddba7753acde41f6ddba2e9f2e397928e89c776d6a5458b8a74f8e04beb312d71fd30b072687ba98f
commit 94fcbda00f37584b812d03f7e6735ec14410c68a Merge: d95ea06 cc26884 Author: Tom Rix trix@redhat.com Date: Thu Mar 21 04:39:57 2024 -0600
Merge branch 'rhel-test' of ssh://pkgs.fedoraproject.org/rpms/python-torch into rawhide
Enable ROCm
Signed-off-by: Tom Rix trix@redhat.com
commit cc2688494a77a3e3a05f66d5728a34f736a5c1d8 Author: Tom Rix trix@redhat.com Date: Tue Mar 19 20:00:51 2024 -0600
Add roctracer
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 181382d..07a47eb 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -35,8 +35,8 @@ %bcond_with hipblaslt # Which families gpu build for %global rocm_gpu_list gfx8 gfx9 gfx10 gfx11 -%global rocm_default_gpu gfx9 -%bcond_with rocm_loop +%global rocm_default_gpu default +%bcond_without rocm_loop
# For testing caffe2 %if 0%{?fedora} @@ -172,6 +172,7 @@ BuildRequires: rocm-runtime-devel BuildRequires: rocm-rpm-macros BuildRequires: rocm-rpm-macros-modules BuildRequires: rocthrust-devel +BuildRequires: roctracer-devel
Requires: rocm-rpm-macros-modules %endif
commit 74a2fd1d898282cee4274fffef1c5a738c253af6 Author: Tom Rix trix@redhat.com Date: Tue Mar 19 14:53:39 2024 -0400
Better disabling of aotriton
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/0001-disable-use-of-aotriton.patch b/0001-disable-use-of-aotriton.patch new file mode 100644 index 0000000..34a1704 --- /dev/null +++ b/0001-disable-use-of-aotriton.patch @@ -0,0 +1,46 @@ +From 33d48f71db7530f00dbd8cff281b65aa8b355b2a Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Tue, 19 Mar 2024 11:32:37 -0400 +Subject: [PATCH] disable use of aotriton + +--- + aten/src/ATen/native/transformers/cuda/sdp_utils.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/aten/src/ATen/native/transformers/cuda/sdp_utils.cpp b/aten/src/ATen/native/transformers/cuda/sdp_utils.cpp +index 96b839820efd..2d3dd0cb4b0f 100644 +--- a/aten/src/ATen/native/transformers/cuda/sdp_utils.cpp ++++ b/aten/src/ATen/native/transformers/cuda/sdp_utils.cpp +@@ -21,9 +21,11 @@ + #include <cmath> + #include <functional> + ++#ifdef USE_FLASH_ATTENTION + #if USE_ROCM + #include <aotriton/flash.h> + #endif ++#endif + + /** + * Note [SDPA Runtime Dispatch] +@@ -183,6 +185,7 @@ bool check_sm_version(cudaDeviceProp * dprops) { + } + + bool check_flash_attention_hardware_support(sdp_params const& params, bool debug) { ++#ifdef USE_FLASH_ATTENTION + // Check that the gpu is capable of running flash attention + using sm80 = SMVersion<8, 0>; + using sm90 = SMVersion<9, 0>; +@@ -211,6 +214,9 @@ bool check_flash_attention_hardware_support(sdp_params const& params, bool debug + } + #endif + return true; ++#else ++ return false; ++#endif + } + + bool check_mem_efficient_hardware_support(sdp_params const& params, bool debug) { +-- +2.44.0 + diff --git a/python-torch.spec b/python-torch.spec index 7f9c596..181382d 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -98,6 +98,7 @@ Patch101: 0001-cuda-hip-signatures.patch Patch102: 0001-silence-an-assert.patch Patch103: 0001-can-not-use-with-c-files.patch Patch104: 0001-use-any-hip.patch +Patch105: 0001-disable-use-of-aotriton.patch %endif
ExclusiveArch: x86_64 aarch64 @@ -278,8 +279,6 @@ sed -i -e '/fsspec/d' setup.py # A new dependency # Connected to USE_FLASH_ATTENTION, since this is off, do not need it sed -i -e '/aotriton.cmake/d' cmake/Dependencies.cmake -# sed -i -e '/aotriton/d' aten/src/ATen/native/transformers/cuda/sdp_utils.cpp -rm aten/src/ATen/native/transformers/cuda/sdp_utils.cpp
# Release comes fully loaded with third party src # Remove what we can
commit 5a5c58f298c41ccb079d81d7fb25407586445723 Author: Tom Rix trix@redhat.com Date: Tue Mar 19 08:14:22 2024 -0400
Fix ROCm build
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 313f013..7f9c596 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -26,7 +26,7 @@
%ifarch x86_64 %if 0%{?fedora} -%bcond_with rocm +%bcond_without rocm %else %bcond_with rocm %endif @@ -35,8 +35,8 @@ %bcond_with hipblaslt # Which families gpu build for %global rocm_gpu_list gfx8 gfx9 gfx10 gfx11 -%global rocm_default_gpu default -%bcond_without rocm_loop +%global rocm_default_gpu gfx9 +%bcond_with rocm_loop
# For testing caffe2 %if 0%{?fedora} @@ -49,7 +49,7 @@ %bcond_with distributed
# For testing openvs -%bcond_without opencv +%bcond_with opencv
# For testing cuda %ifarch x86_64 @@ -265,7 +265,6 @@ cp -r cutlass-%{cul_ver}/* third_party/cutlass/ sed -i -e 's/USE_OPENCV AND OpenCV_FOUND AND USE_FFMPEG AND FFMPEG_FOUND/USE_OPENCV AND USE_FFMPEG/' caffe2/video/CMakeLists.txt sed -i -e 's/USE_OPENCV AND OpenCV_FOUND/USE_OPENCV/' caffe2/image/CMakeLists.txt sed -i -e 's/STATUS/FATAL/' caffe2/image/CMakeLists.txt -cat caffe2/image/CMakeLists.txt %endif
%if 0%{?rhel} @@ -276,6 +275,12 @@ sed -i -e '/sympy/d' setup.py sed -i -e '/fsspec/d' setup.py %endif
+# A new dependency +# Connected to USE_FLASH_ATTENTION, since this is off, do not need it +sed -i -e '/aotriton.cmake/d' cmake/Dependencies.cmake +# sed -i -e '/aotriton/d' aten/src/ATen/native/transformers/cuda/sdp_utils.cpp +rm aten/src/ATen/native/transformers/cuda/sdp_utils.cpp + # Release comes fully loaded with third party src # Remove what we can # @@ -396,6 +401,7 @@ export INTERN_BUILD_MOBILE=OFF export USE_DISTRIBUTED=OFF export USE_CUDA=OFF export USE_FBGEMM=OFF +export USE_FLASH_ATTENTION=OFF export USE_GOLD_LINKER=OFF export USE_ITT=OFF export USE_KINETO=OFF @@ -460,9 +466,11 @@ export BUILD_TEST=ON %if %{with rocm}
export USE_ROCM=ON -export HIP_PATH=%{_prefix} -export ROCM_PATH=%{_prefix} -export DEVICE_LIB_PATH=%{clang_resource_dir}/amdgcn/bitcode +export HIP_PATH=`hipconfig -p` +export ROCM_PATH=`hipconfig -R` +export HIP_CLANG_PATH=`hipconfig -l` +RESOURCE_DIR=`${HIP_CLANG_PATH}/clang -print-resource-dir` +export DEVICE_LIB_PATH=${RESOURCE_DIR}/amdgcn/bitcode
gpu=%{rocm_default_gpu} module load rocm/$gpu @@ -493,9 +501,11 @@ done %if %{with rocm}
export USE_ROCM=ON -export HIP_PATH=%{_prefix} -export ROCM_PATH=%{_prefix} -export DEVICE_LIB_PATH=%{clang_resource_dir}/amdgcn/bitcode +export HIP_PATH=`hipconfig -p` +export ROCM_PATH=`hipconfig -R` +export HIP_CLANG_PATH=`hipconfig -l` +RESOURCE_DIR=`${HIP_CLANG_PATH}/clang -print-resource-dir` +export DEVICE_LIB_PATH=${RESOURCE_DIR}/amdgcn/bitcode
gpu=%{rocm_default_gpu} module load rocm/$gpu @@ -541,9 +551,11 @@ done %{python3_sitearch}/caffe2 %endif %if %{with rocm} +%if %{with rocm_loop} %{_libdir}/rocm/gfx*/bin/* %{_libdir}/rocm/gfx*/lib64/* %endif +%endif
%changelog %autochangelog
commit d95ea061ca1fa120587c7496cea1e815e7e4cbc1 Author: Tom Rix trix@redhat.com Date: Sat Mar 16 16:16:44 2024 -0400
Disable opencv
Linking problem with gdal
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 3fbab79..5975969 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -48,7 +48,7 @@ %bcond_with distributed
# For testing openvs -%bcond_without opencv +%bcond_with opencv
# For testing cuda %ifarch x86_64
commit 6989951b26a6532106a941846464a8d6fa28e073 Author: Tom Rix trix@redhat.com Date: Sat Mar 16 15:39:58 2024 -0400
Update to 2.3.0-rc2
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 3fbab79..313f013 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -4,11 +4,12 @@ %global forgeurl https://github.com/pytorch/pytorch
# So pre releases can be tried -%bcond_with gitcommit +%bcond_without gitcommit %if %{with gitcommit} -%global commit0 975d4284250170602db60adfda5eb1664a3b8acc +# git tag v2.3.0-rc2 +%global commit0 6a89a753b1556fe8558582c452fdba083f6ec01a %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) -%global date0 20240307 +%global date0 20240313 %else %global commit0 975d4284250170602db60adfda5eb1664a3b8acc %global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
commit 78b817618e9093f96987517e22b7868363a9e6c5 Author: Tom Rix trix@redhat.com Date: Sat Mar 16 07:38:18 2024 -0400
Sources for pybind11
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index 5f41933..612c3df 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /pytorch-v2.1.2.tar.gz /pytorch-975d428.tar.gz /v23.3.3.tar.gz +/v2.11.1.tar.gz diff --git a/sources b/sources index 8264585..37652db 100644 --- a/sources +++ b/sources @@ -2,3 +2,4 @@ SHA512 (pytorch-v2.1.0.tar.gz) = 59421bf6cea6661d61ed66ab16526e3a07162e70e53381c SHA512 (pytorch-v2.1.2.tar.gz) = b7305407ad9dda877d277a0e7009f65f6d69f39370f2231b8bb8c6a9b711022d2129febdb00f5c83751b6664e01000fe2d30c5e5c13757de89fb8b2b99197a28 SHA512 (pytorch-975d428.tar.gz) = a02195b18d832db9a739c3eeecd0cd0c8868d8b92e4a2fca42e4bdd20735f0745d84573df28d9ae1db014cf79ffd005a8409b3e8bb92f9db2a446f784ef46ff4 SHA512 (v23.3.3.tar.gz) = 4066c94f2473c7ea16917d29a613e16f840a329089c88e0bdbdb999aef3442ba00abfd2aa92266fa9c067e399dc88e6f0ccac40dc151378857e665638e78bbf0 +SHA512 (v2.11.1.tar.gz) = ed1512ff0bca3bc0a45edc2eb8c77f8286ab9389f6ff1d5cb309be24bc608abbe0df6a7f5cb18c8f80a3bfa509058547c13551c3cd6a759af708fd0cdcdd9e95
commit 650e5d21514606770c1f6910e83912d41eff5bf9 Author: Tom Rix trix@redhat.com Date: Sat Mar 16 07:37:39 2024 -0400
Sources for flatbuffers
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index b7ab044..5f41933 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /pytorch-v2.1.0.tar.gz /pytorch-v2.1.2.tar.gz /pytorch-975d428.tar.gz +/v23.3.3.tar.gz diff --git a/sources b/sources index 6f96f49..8264585 100644 --- a/sources +++ b/sources @@ -1,3 +1,4 @@ SHA512 (pytorch-v2.1.0.tar.gz) = 59421bf6cea6661d61ed66ab16526e3a07162e70e53381cbd5987042917610ec993d2f151fb086f0f98e5a396fe69e82bbc76f840bebffe4ebe7f50458c3aa44 SHA512 (pytorch-v2.1.2.tar.gz) = b7305407ad9dda877d277a0e7009f65f6d69f39370f2231b8bb8c6a9b711022d2129febdb00f5c83751b6664e01000fe2d30c5e5c13757de89fb8b2b99197a28 SHA512 (pytorch-975d428.tar.gz) = a02195b18d832db9a739c3eeecd0cd0c8868d8b92e4a2fca42e4bdd20735f0745d84573df28d9ae1db014cf79ffd005a8409b3e8bb92f9db2a446f784ef46ff4 +SHA512 (v23.3.3.tar.gz) = 4066c94f2473c7ea16917d29a613e16f840a329089c88e0bdbdb999aef3442ba00abfd2aa92266fa9c067e399dc88e6f0ccac40dc151378857e665638e78bbf0
commit 013c9ee8e6163f486844bc0efbb86748be4c3158 Author: Tom Rix trix@redhat.com Date: Sat Mar 16 07:35:56 2024 -0400
Source for 2.3
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index 3f2501f..b7ab044 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /pytorch-v2.1.0.tar.gz /pytorch-v2.1.2.tar.gz +/pytorch-975d428.tar.gz diff --git a/sources b/sources index 90b1128..6f96f49 100644 --- a/sources +++ b/sources @@ -1,2 +1,3 @@ SHA512 (pytorch-v2.1.0.tar.gz) = 59421bf6cea6661d61ed66ab16526e3a07162e70e53381cbd5987042917610ec993d2f151fb086f0f98e5a396fe69e82bbc76f840bebffe4ebe7f50458c3aa44 SHA512 (pytorch-v2.1.2.tar.gz) = b7305407ad9dda877d277a0e7009f65f6d69f39370f2231b8bb8c6a9b711022d2129febdb00f5c83751b6664e01000fe2d30c5e5c13757de89fb8b2b99197a28 +SHA512 (pytorch-975d428.tar.gz) = a02195b18d832db9a739c3eeecd0cd0c8868d8b92e4a2fca42e4bdd20735f0745d84573df28d9ae1db014cf79ffd005a8409b3e8bb92f9db2a446f784ef46ff4
commit 9c54f7253139fd48b3e243ab223d1dea9e1e4d0e Author: Tom Rix trix@redhat.com Date: Sat Mar 16 07:34:21 2024 -0400
Update to 2.3 beta
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/next/pyproject.toml b/pyproject.toml similarity index 100% rename from next/pyproject.toml rename to pyproject.toml
commit a2a745f76669f491ca2975e1dec7dc8ca7c51458 Author: Tom Rix trix@redhat.com Date: Fri Mar 15 12:02:53 2024 -0400
Enable caffe2
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 5c6b771..3fbab79 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -37,22 +37,19 @@ %global rocm_default_gpu default %bcond_without rocm_loop
-%bcond_with foxi # For testing caffe2 %if 0%{?fedora} -# need foxi-devel -%if %{with foxi} %bcond_without caffe2 %else %bcond_with caffe2 %endif -%else -%bcond_with caffe2 -%endif
# For testing distributed %bcond_with distributed
+# For testing openvs +%bcond_without opencv + # For testing cuda %ifarch x86_64 %bcond_with cuda @@ -102,19 +99,15 @@ Patch103: 0001-can-not-use-with-c-files.patch Patch104: 0001-use-any-hip.patch %endif
-# Limit to these because they are well behaved with clang ExclusiveArch: x86_64 aarch64 -%if 0%{?fedora} -%global toolchain clang -%else -# RHEL does not do clang well, nor lto +%global toolchain gcc %global _lto_cflags %nil -%endif
BuildRequires: cmake BuildRequires: cpuinfo-devel BuildRequires: eigen3-devel BuildRequires: fmt-devel +BuildRequires: foxi-devel BuildRequires: FP16-devel BuildRequires: fxdiv-devel BuildRequires: gcc-c++ @@ -181,12 +174,11 @@ BuildRequires: rocthrust-devel Requires: rocm-rpm-macros-modules %endif
-%if %{with foxi} -%if %{with caffe2} -BuildRequires: foxi-devel -%endif +%if %{with opencv} +BuildRequires: opencv-devel %endif
+ %if %{with test} BuildRequires: google-benchmark-devel %endif @@ -446,6 +438,10 @@ export USE_CUDA=ON export USE_DISTRIBUTED=ON %endif
+%if %{with opencv} +export USE_OPENCV=ON +%endif + %if %{with test} export BUILD_TEST=ON %endif
commit dc89ef898a61f95864cc1cf6db28df680d3b03f6 Author: Tom Rix trix@redhat.com Date: Tue Mar 12 10:05:39 2024 -0400
Prep for 2.3 changeover
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/next/0001-Optionally-use-hipblaslt.patch b/0001-Optionally-use-hipblaslt.patch similarity index 100% rename from next/0001-Optionally-use-hipblaslt.patch rename to 0001-Optionally-use-hipblaslt.patch diff --git a/0001-Prepare-pytorch-cmake-for-fedora.patch b/0001-Prepare-pytorch-cmake-for-fedora.patch deleted file mode 100644 index cf1e843..0000000 --- a/0001-Prepare-pytorch-cmake-for-fedora.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 24cf0294a67d89ad70367940eea872162b44482c Mon Sep 17 00:00:00 2001 -From: Tom Rix trix@redhat.com -Date: Sat, 23 Sep 2023 10:18:52 -0700 -Subject: [PATCH] Prepare pytorch cmake for fedora - -Use the system fmt -Remove foxi use -Remove warnings/errors for clang 17 -fxdiv is not a library -build type is RelWithDebInfo -use system pthreadpool - -Signed-off-by: Tom Rix trix@redhat.com ---- - CMakeLists.txt | 6 +++--- - .../native/quantized/cpu/qnnpack/CMakeLists.txt | 3 --- - c10/CMakeLists.txt | 2 +- - caffe2/CMakeLists.txt | 6 +----- - cmake/Dependencies.cmake | 16 +--------------- - test/cpp/tensorexpr/CMakeLists.txt | 2 +- - torch/CMakeLists.txt | 2 +- - 7 files changed, 8 insertions(+), 29 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3a48eaf4e2..902ee70fd1 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -682,7 +682,7 @@ set(CAFFE2_ALLOWLIST "" CACHE STRING "A allowlist file of files that one should - # Set default build type - if(NOT CMAKE_BUILD_TYPE) - message(STATUS "Build type not set - defaulting to Release") -- set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build from: Debug Release RelWithDebInfo MinSizeRel Coverage." FORCE) -+ set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build from: Debug Release RelWithDebInfo MinSizeRel Coverage." FORCE) - endif() - - # The below means we are cross compiling for arm64 or x86_64 on MacOSX -@@ -917,8 +917,8 @@ if(NOT MSVC) - string(APPEND CMAKE_LINKER_FLAGS_DEBUG " -fno-omit-frame-pointer -O0") - append_cxx_flag_if_supported("-fno-math-errno" CMAKE_CXX_FLAGS) - append_cxx_flag_if_supported("-fno-trapping-math" CMAKE_CXX_FLAGS) -- append_cxx_flag_if_supported("-Werror=format" CMAKE_CXX_FLAGS) -- append_cxx_flag_if_supported("-Werror=cast-function-type" CMAKE_CXX_FLAGS) -+# append_cxx_flag_if_supported("-Werror=format" CMAKE_CXX_FLAGS) -+# append_cxx_flag_if_supported("-Werror=cast-function-type" CMAKE_CXX_FLAGS) - else() - # skip unwanted includes from windows.h - add_compile_definitions(WIN32_LEAN_AND_MEAN) -diff --git a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt -index fd6b7ff551..218c8e9b2a 100644 ---- a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt -+++ b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt -@@ -393,10 +393,7 @@ elseif(NOT TARGET fxdiv AND USE_SYSTEM_FXDIV) - if(NOT FXDIV_HDR) - message(FATAL_ERROR "Cannot find fxdiv") - endif() -- add_library(fxdiv STATIC "${FXDIV_HDR}") -- set_property(TARGET fxdiv PROPERTY LINKER_LANGUAGE C) - endif() --target_link_libraries(pytorch_qnnpack PRIVATE fxdiv) - - # ---[ Configure psimd - if(NOT TARGET psimd AND NOT USE_SYSTEM_PSIMD) -diff --git a/c10/CMakeLists.txt b/c10/CMakeLists.txt -index feebad7cbb..7c029cd88d 100644 ---- a/c10/CMakeLists.txt -+++ b/c10/CMakeLists.txt -@@ -87,7 +87,7 @@ endif() - if(${USE_GLOG}) - target_link_libraries(c10 PUBLIC glog::glog) - endif() --target_link_libraries(c10 PRIVATE fmt::fmt-header-only) -+target_link_libraries(c10 PRIVATE fmt) - - find_package(Backtrace) - if(Backtrace_FOUND) -diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt -index 74d0d55719..b975d388a7 100644 ---- a/caffe2/CMakeLists.txt -+++ b/caffe2/CMakeLists.txt -@@ -107,7 +107,7 @@ endif() - # Note: the folders that are being commented out have not been properly - # addressed yet. - --if(NOT MSVC AND USE_XNNPACK) -+if(NOT MSVC AND USE_XNNPACK AND NOT USE_SYSTEM_FXDIV) - if(NOT TARGET fxdiv) - set(FXDIV_BUILD_TESTS OFF CACHE BOOL "") - set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "") -@@ -1022,10 +1022,6 @@ elseif(USE_CUDA) - endif() - endif() - --if(NOT MSVC AND USE_XNNPACK) -- TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv) --endif() -- - # ========================================================== - # formerly-libtorch flags - # ========================================================== -diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake -index c3abce52e4..21b40f3a88 100644 ---- a/cmake/Dependencies.cmake -+++ b/cmake/Dependencies.cmake -@@ -1555,7 +1555,6 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX) - set_target_properties(onnx_proto PROPERTIES CXX_STANDARD 17) - endif() - endif() -- add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/foxi EXCLUDE_FROM_ALL) - - add_definitions(-DONNX_NAMESPACE=${ONNX_NAMESPACE}) - if(NOT USE_SYSTEM_ONNX) -@@ -1588,8 +1587,6 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX) - message("-- Found onnx: ${ONNX_LIBRARY} ${ONNX_PROTO_LIBRARY}") - list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx) - endif() -- include_directories(${FOXI_INCLUDE_DIRS}) -- list(APPEND Caffe2_DEPENDENCY_LIBS foxi_loader) - # Recover the build shared libs option. - set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS}) - endif() -@@ -1834,18 +1831,7 @@ endif() - # - 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 "") -- --list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only) -+list(APPEND Caffe2_DEPENDENCY_LIBS fmt) - set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE) - - # ---[ Kineto -diff --git a/test/cpp/tensorexpr/CMakeLists.txt b/test/cpp/tensorexpr/CMakeLists.txt -index 7dff70630d..90b1003591 100644 ---- a/test/cpp/tensorexpr/CMakeLists.txt -+++ b/test/cpp/tensorexpr/CMakeLists.txt -@@ -54,7 +54,7 @@ target_include_directories(tutorial_tensorexpr PRIVATE ${ATen_CPU_INCLUDE}) - # pthreadpool header. For some build environment we need add the dependency - # explicitly. - if(USE_PTHREADPOOL) -- target_link_libraries(test_tensorexpr PRIVATE pthreadpool_interface) -+ target_link_libraries(test_tensorexpr PRIVATE pthreadpool) - endif() - if(USE_CUDA) - target_link_libraries(test_tensorexpr PRIVATE -diff --git a/torch/CMakeLists.txt b/torch/CMakeLists.txt -index 62ee4c12a9..8d5375f320 100644 ---- a/torch/CMakeLists.txt -+++ b/torch/CMakeLists.txt -@@ -84,7 +84,7 @@ set(TORCH_PYTHON_LINK_LIBRARIES - python::python - pybind::pybind11 - shm -- fmt::fmt-header-only -+ fmt - ATEN_CPU_FILES_GEN_LIB) - - if(USE_ASAN AND TARGET Sanitizer::address) --- -2.42.1 - diff --git a/next/0001-Regenerate-flatbuffer-header.patch b/0001-Regenerate-flatbuffer-header.patch similarity index 100% rename from next/0001-Regenerate-flatbuffer-header.patch rename to 0001-Regenerate-flatbuffer-header.patch diff --git a/next/0001-Stub-in-kineto-ActivityType.patch b/0001-Stub-in-kineto-ActivityType.patch similarity index 100% rename from next/0001-Stub-in-kineto-ActivityType.patch rename to 0001-Stub-in-kineto-ActivityType.patch diff --git a/0001-add-rocm_version-fallback.patch b/0001-add-rocm_version-fallback.patch deleted file mode 100644 index 25a0c67..0000000 --- a/0001-add-rocm_version-fallback.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 1d35a0b1f5cb39fd0c44a486157dc739a02c71b6 Mon Sep 17 00:00:00 2001 -From: Tom Rix trix@redhat.com -Date: Wed, 20 Dec 2023 11:23:18 -0500 -Subject: [PATCH] add rocm_version fallback - -Signed-off-by: Tom Rix trix@redhat.com ---- - torch/utils/hipify/cuda_to_hip_mappings.py | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/torch/utils/hipify/cuda_to_hip_mappings.py b/torch/utils/hipify/cuda_to_hip_mappings.py -index 73586440e7..9354057a39 100644 ---- a/torch/utils/hipify/cuda_to_hip_mappings.py -+++ b/torch/utils/hipify/cuda_to_hip_mappings.py -@@ -57,6 +57,18 @@ if os.path.isfile(rocm_version_h): - if match: - patch = int(match.group(1)) - rocm_version = (major, minor, patch) -+else: -+ try: -+ hip_version = subprocess.check_output(["hipconfig", "--version"]).decode("utf-8") -+ hip_split = hip_version.split('.') -+ rocm_version = (int(hip_split[0]), int(hip_split[1]), 0) -+ except subprocess.CalledProcessError: -+ print(f"Warning: hipconfig --version failed") -+ except (FileNotFoundError, PermissionError, NotADirectoryError): -+ # Do not print warning. This is okay. This file can also be imported for non-ROCm builds. -+ pass -+ -+ - - # List of math functions that should be replaced inside device code only. - MATH_TRANSPILATIONS = collections.OrderedDict( --- -2.43.0 - diff --git a/next/0001-can-not-use-with-c-files.patch b/0001-can-not-use-with-c-files.patch similarity index 100% rename from next/0001-can-not-use-with-c-files.patch rename to 0001-can-not-use-with-c-files.patch diff --git a/next/0001-cuda-hip-signatures.patch b/0001-cuda-hip-signatures.patch similarity index 100% rename from next/0001-cuda-hip-signatures.patch rename to 0001-cuda-hip-signatures.patch diff --git a/0001-disable-as-needed-for-libtorch.patch b/0001-disable-as-needed-for-libtorch.patch deleted file mode 100644 index 392140a..0000000 --- a/0001-disable-as-needed-for-libtorch.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 06499575b177a218846f0e43ff4bc77d245f207f Mon Sep 17 00:00:00 2001 -From: Tom Rix trix@redhat.com -Date: Fri, 1 Dec 2023 09:38:05 -0500 -Subject: [PATCH] disable as-needed for libtorch - -Signed-off-by: Tom Rix trix@redhat.com ---- - caffe2/CMakeLists.txt | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt -index b975d388a7..5e9fd3b3f3 100644 ---- a/caffe2/CMakeLists.txt -+++ b/caffe2/CMakeLists.txt -@@ -914,6 +914,10 @@ if(HAVE_SOVERSION) - VERSION ${TORCH_VERSION} SOVERSION ${TORCH_SOVERSION}) - endif() - -+# Disable global as-needed -+set_target_properties(torch PROPERTIES LINK_FLAGS -Wl,--no-as-needed) -+ -+ - if(USE_ROCM) - filter_list(__caffe2_hip_srcs_cpp Caffe2_HIP_SRCS "\.(cu|hip)$") - set_source_files_properties(${__caffe2_hip_srcs_cpp} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1) --- -2.42.1 - diff --git a/next/0001-disable-submodule-search.patch b/0001-disable-submodule-search.patch similarity index 100% rename from next/0001-disable-submodule-search.patch rename to 0001-disable-submodule-search.patch diff --git a/next/0001-no-third_party-FXdiv.patch b/0001-no-third_party-FXdiv.patch similarity index 100% rename from next/0001-no-third_party-FXdiv.patch rename to 0001-no-third_party-FXdiv.patch diff --git a/next/0001-no-third_party-fmt.patch b/0001-no-third_party-fmt.patch similarity index 100% rename from next/0001-no-third_party-fmt.patch rename to 0001-no-third_party-fmt.patch diff --git a/next/0001-no-third_party-foxi.patch b/0001-no-third_party-foxi.patch similarity index 100% rename from next/0001-no-third_party-foxi.patch rename to 0001-no-third_party-foxi.patch diff --git a/0001-python-torch-link-with-python.patch b/0001-python-torch-link-with-python.patch deleted file mode 100644 index d52f034..0000000 --- a/0001-python-torch-link-with-python.patch +++ /dev/null @@ -1,27 +0,0 @@ -From cef92207b79ad53e3fcc1b0e22ba91cb9422968c Mon Sep 17 00:00:00 2001 -From: Tom Rix trix@redhat.com -Date: Sat, 18 Nov 2023 09:38:52 -0500 -Subject: [PATCH] python-torch link with python - -Signed-off-by: Tom Rix trix@redhat.com ---- - torch/CMakeLists.txt | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/torch/CMakeLists.txt b/torch/CMakeLists.txt -index 8d5375f320..6f8c7b65c4 100644 ---- a/torch/CMakeLists.txt -+++ b/torch/CMakeLists.txt -@@ -312,6 +312,9 @@ add_dependencies(torch_python torch_python_stubs) - add_dependencies(torch_python flatbuffers) - - -+# Unresolved syms in -lpython -+target_link_libraries(torch_python PUBLIC ${PYTHON_LIBRARIES}) -+ - if(USE_PRECOMPILED_HEADERS) - target_precompile_headers(torch_python PRIVATE - "$<$<COMPILE_LANGUAGE:CXX>:ATen/ATen.h>") --- -2.42.1 - diff --git a/0001-python-torch-remove-ubuntu-specific-linking.patch b/0001-python-torch-remove-ubuntu-specific-linking.patch deleted file mode 100644 index 6d9bd24..0000000 --- a/0001-python-torch-remove-ubuntu-specific-linking.patch +++ /dev/null @@ -1,33 +0,0 @@ -From f70ef37d0b3c780fd17be199e66a81ffa679f93e Mon Sep 17 00:00:00 2001 -From: Tom Rix trix@redhat.com -Date: Sat, 18 Nov 2023 12:05:43 -0500 -Subject: [PATCH] python-torch remove ubuntu specific linking - -Signed-off-by: Tom Rix trix@redhat.com ---- - CMakeLists.txt | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 86c34984b2..f7c4a7b05f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -479,9 +479,12 @@ option(BUILD_EXECUTORCH "Master flag to build Executorch" ON) - # This is a fix for a rare build issue on Ubuntu: - # symbol lookup error: miniconda3/envs/pytorch-py3.7/lib/libmkl_intel_lp64.so: undefined symbol: mkl_blas_dsyrk - # https://software.intel.com/en-us/articles/symbol-lookup-error-when-linking-i... --if(LINUX) -- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed") --endif() -+ -+# This is not ubuntu! -+# if(LINUX) -+# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed") -+# endif() -+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed") - - if(MSVC) - set(CMAKE_NINJA_CMCLDEPS_RC OFF) --- -2.42.1 - diff --git a/0001-pytorch-use-SO-version-by-default.patch b/0001-pytorch-use-SO-version-by-default.patch deleted file mode 100644 index b70d6ec..0000000 --- a/0001-pytorch-use-SO-version-by-default.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 527d1ce24a06a14788ca5fc2411985d7c1cb2923 Mon Sep 17 00:00:00 2001 -From: Tom Rix trix@redhat.com -Date: Fri, 13 Oct 2023 05:35:19 -0700 -Subject: [PATCH] pytorch use SO version by default - -Signed-off-by: Tom Rix trix@redhat.com ---- - CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 902ee70fd1..86c34984b2 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -340,7 +340,7 @@ option(USE_TBB "Use TBB (Deprecated)" OFF) - cmake_dependent_option( - USE_SYSTEM_TBB "Use system-provided Intel TBB." OFF "USE_TBB" OFF) - option(ONNX_ML "Enable traditional ONNX ML API." ON) --option(HAVE_SOVERSION "Whether to add SOVERSION to the shared objects" OFF) -+option(HAVE_SOVERSION "Whether to add SOVERSION to the shared objects" ON) - option(BUILD_LIBTORCH_CPU_WITH_DEBUG "Enable RelWithDebInfo for libtorch_cpu target only" OFF) - cmake_dependent_option(USE_CCACHE "Attempt using CCache to wrap the compilation" ON "UNIX" OFF) - option(WERROR "Build with -Werror supported by the compiler" OFF) --- -2.42.1 - diff --git a/next/0001-reenable-foxi-linking.patch b/0001-reenable-foxi-linking.patch similarity index 100% rename from next/0001-reenable-foxi-linking.patch rename to 0001-reenable-foxi-linking.patch diff --git a/next/0001-silence-an-assert.patch b/0001-silence-an-assert.patch similarity index 100% rename from next/0001-silence-an-assert.patch rename to 0001-silence-an-assert.patch diff --git a/0001-torch-sane-version.patch b/0001-torch-sane-version.patch deleted file mode 100644 index cb1211a..0000000 --- a/0001-torch-sane-version.patch +++ /dev/null @@ -1,32 +0,0 @@ -From c47c6e202d60ccac15aa36698bd4788415a9416b Mon Sep 17 00:00:00 2001 -From: Tom Rix trix@redhat.com -Date: Sat, 25 Nov 2023 16:46:17 -0500 -Subject: [PATCH] torch sane version - ---- - tools/generate_torch_version.py | 1 + - version.txt | 2 +- - 2 files changed, 2 insertions(+), 1 deletion(-) - -diff --git a/tools/generate_torch_version.py b/tools/generate_torch_version.py -index d90d3646ab..11d5bbeba5 100644 ---- a/tools/generate_torch_version.py -+++ b/tools/generate_torch_version.py -@@ -42,6 +42,7 @@ def get_tag(pytorch_root: Union[str, Path]) -> str: - def get_torch_version(sha: Optional[str] = None) -> str: - pytorch_root = Path(__file__).parent.parent - version = open(pytorch_root / "version.txt").read().strip() -+ return version - - if os.getenv("PYTORCH_BUILD_VERSION"): - assert os.getenv("PYTORCH_BUILD_NUMBER") is not None -diff --git a/version.txt b/version.txt -index ecaf4eea7c..7ec1d6db40 100644 ---- a/version.txt -+++ b/version.txt -@@ -1,1 +1,1 @@ --2.1.0a0 -+2.1.2 --- -2.42.1 - diff --git a/next/0001-use-any-hip.patch b/0001-use-any-hip.patch similarity index 100% rename from next/0001-use-any-hip.patch rename to 0001-use-any-hip.patch diff --git a/0002-Regenerate-flatbuffer-header.patch b/0002-Regenerate-flatbuffer-header.patch deleted file mode 100644 index 662a7c5..0000000 --- a/0002-Regenerate-flatbuffer-header.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 587a8b10bd3f7a68275356ee6eb6bb43ed711ba2 Mon Sep 17 00:00:00 2001 -From: Tom Rix trix@redhat.com -Date: Fri, 29 Sep 2023 06:19:29 -0700 -Subject: [PATCH 2/6] Regenerate flatbuffer header - -For this error -torch/csrc/jit/serialization/mobile_bytecode_generated.h:12:41: -error: static assertion failed: Non-compatible flatbuffers version included - 12 | FLATBUFFERS_VERSION_MINOR == 3 && - -PyTorch is expecting 23.3.3, what f38 has -Rawhide is at 23.5.26 - -Regenerate with -flatc --cpp --gen-mutable --no-prefix --scoped-enums mobile_bytecode.fbs - -Signed-off-by: Tom Rix trix@redhat.com ---- - torch/csrc/jit/serialization/mobile_bytecode_generated.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/torch/csrc/jit/serialization/mobile_bytecode_generated.h b/torch/csrc/jit/serialization/mobile_bytecode_generated.h -index cffe8bc7a6..83575e4c19 100644 ---- a/torch/csrc/jit/serialization/mobile_bytecode_generated.h -+++ b/torch/csrc/jit/serialization/mobile_bytecode_generated.h -@@ -9,8 +9,8 @@ - // Ensure the included flatbuffers.h is the same version as when this file was - // generated, otherwise it may not be compatible. - static_assert(FLATBUFFERS_VERSION_MAJOR == 23 && -- FLATBUFFERS_VERSION_MINOR == 3 && -- FLATBUFFERS_VERSION_REVISION == 3, -+ FLATBUFFERS_VERSION_MINOR == 5 && -+ FLATBUFFERS_VERSION_REVISION == 26, - "Non-compatible flatbuffers version included"); - - namespace torch { --- -2.41.0 - diff --git a/0003-Stub-in-kineto-ActivityType.patch b/0003-Stub-in-kineto-ActivityType.patch deleted file mode 100644 index 0823acb..0000000 --- a/0003-Stub-in-kineto-ActivityType.patch +++ /dev/null @@ -1,73 +0,0 @@ -From bb52aeacc6dfab2355249b7b5beb72c2761ec319 Mon Sep 17 00:00:00 2001 -From: Tom Rix trix@redhat.com -Date: Fri, 29 Sep 2023 06:25:23 -0700 -Subject: [PATCH 3/6] Stub in kineto ActivityType - -There is an error with kineto is not used, the shim still -requires the ActivityTYpe.h header to get the enum Activity type. -So cut-n-paste just enough of the header in to do this. - -Signed-off-by: Tom Rix trix@redhat.com ---- - torch/csrc/profiler/kineto_shim.h | 44 +++++++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - -diff --git a/torch/csrc/profiler/kineto_shim.h b/torch/csrc/profiler/kineto_shim.h -index 2a410719a1..7d6525befd 100644 ---- a/torch/csrc/profiler/kineto_shim.h -+++ b/torch/csrc/profiler/kineto_shim.h -@@ -12,7 +12,51 @@ - #undef USE_KINETO - #endif - -+#ifdef USE_KINETO - #include <ActivityType.h> -+#else -+namespace libkineto { -+// copied from header -+/* -+ * Copyright (c) Meta Platforms, Inc. and affiliates. -+ * All rights reserved. -+ * -+ * This source code is licensed under the BSD-style license found in the -+ * LICENSE file in the root directory of this source tree. -+ */ -+ -+// Note : All activity types are not enabled by default. Please add them -+// at correct position in the enum -+enum class ActivityType { -+ // Activity types enabled by default -+ CPU_OP = 0, // cpu side ops -+ USER_ANNOTATION, -+ GPU_USER_ANNOTATION, -+ GPU_MEMCPY, -+ GPU_MEMSET, -+ CONCURRENT_KERNEL, // on-device kernels -+ EXTERNAL_CORRELATION, -+ CUDA_RUNTIME, // host side cuda runtime events -+ CUDA_DRIVER, // host side cuda driver events -+ CPU_INSTANT_EVENT, // host side point-like events -+ PYTHON_FUNCTION, -+ OVERHEAD, // CUPTI induced overhead events sampled from its overhead API. -+ -+ // Optional Activity types -+ CUDA_SYNC, // synchronization events between runtime and kernels -+ GLOW_RUNTIME, // host side glow runtime events -+ MTIA_RUNTIME, // host side MTIA runtime events -+ CUDA_PROFILER_RANGE, // CUPTI Profiler range for performance metrics -+ MTIA_CCP_EVENTS, // MTIA ondevice CCP events -+ HPU_OP, // HPU host side runtime event -+ XPU_RUNTIME, // host side xpu runtime events -+ -+ ENUM_COUNT, // This is to add buffer and not used for any profiling logic. Add your new type before it. -+ OPTIONAL_ACTIVITY_TYPE_START = CUDA_SYNC, -+}; -+} -+ -+#endif - - #include <torch/csrc/Export.h> - #include <torch/csrc/profiler/api.h> --- -2.41.0 - diff --git a/0004-torch-python-3.12-changes.patch b/0004-torch-python-3.12-changes.patch deleted file mode 100644 index bdcec7f..0000000 --- a/0004-torch-python-3.12-changes.patch +++ /dev/null @@ -1,45 +0,0 @@ -From fcf3cd70229cdc729d05ddab081ac886c9db6bd7 Mon Sep 17 00:00:00 2001 -From: Tom Rix trix@redhat.com -Date: Fri, 29 Sep 2023 13:58:28 -0700 -Subject: [PATCH] torch python 3.12 changes - -Signed-off-by: Tom Rix trix@redhat.com ---- - functorch/csrc/dim/dim.cpp | 6 ++++++ - torch/csrc/dynamo/cpython_defs.h | 2 +- - 2 files changed, 7 insertions(+), 1 deletion(-) - -diff --git a/functorch/csrc/dim/dim.cpp b/functorch/csrc/dim/dim.cpp -index b611dc3e8c2..c7009478aee 100644 ---- a/functorch/csrc/dim/dim.cpp -+++ b/functorch/csrc/dim/dim.cpp -@@ -10,7 +10,13 @@ - // Many APIs have changed/don't exist anymore - #if IS_PYTHON_3_12_PLUS - -+#include "dim.h" -+ - // Re-enable this some day -+PyObject* Dim_init() { -+ PyErr_SetString(PyExc_RuntimeError, "First class dim doesn't work with python 3.12"); -+ return nullptr; -+} - - #else - -diff --git a/torch/csrc/dynamo/cpython_defs.h b/torch/csrc/dynamo/cpython_defs.h -index f0a0e1a88e2..f58becd246e 100644 ---- a/torch/csrc/dynamo/cpython_defs.h -+++ b/torch/csrc/dynamo/cpython_defs.h -@@ -6,7 +6,7 @@ - // should go in cpython_defs.c. Copying is required when, e.g., - // we need to call internal CPython functions that are not exposed. - --#if IS_PYTHON_3_11_PLUS && !(IS_PYTHON_3_12_PLUS) -+#if IS_PYTHON_3_11_PLUS - - #include <internal/pycore_frame.h> - --- -2.43.0 - diff --git a/0005-disable-submodule-search.patch b/0005-disable-submodule-search.patch deleted file mode 100644 index 1b5509f..0000000 --- a/0005-disable-submodule-search.patch +++ /dev/null @@ -1,25 +0,0 @@ -From fc0d4ce06fecbd2bcd10fb13c515dc6625260870 Mon Sep 17 00:00:00 2001 -From: Tom Rix trix@redhat.com -Date: Fri, 29 Sep 2023 17:21:13 -0700 -Subject: [PATCH 5/6] disable submodule search - ---- - setup.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/setup.py b/setup.py -index 17bf16b89a..b8c8ae5506 100644 ---- a/setup.py -+++ b/setup.py -@@ -452,7 +452,7 @@ def mirror_files_into_torchgen(): - def build_deps(): - report("-- Building version " + version) - -- check_submodules() -+ # check_submodules() - check_pydep("yaml", "pyyaml") - - build_caffe2( --- -2.41.0 - diff --git a/python-torch.spec b/python-torch.spec index e989c16..5c6b771 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -4,17 +4,17 @@ %global forgeurl https://github.com/pytorch/pytorch
# So pre releases can be tried -%bcond_without gitcommit +%bcond_with gitcommit %if %{with gitcommit} -# The top of tree ~3/7/24 %global commit0 975d4284250170602db60adfda5eb1664a3b8acc %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) - -%global pypi_version 2.3.0 +%global date0 20240307 %else -%global pypi_version 2.1.2 - +%global commit0 975d4284250170602db60adfda5eb1664a3b8acc +%global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) +%global date0 20240307 %endif +%global pypi_version 2.3.0
# For -test subpackage # suitable only for local testing @@ -37,9 +37,6 @@ %global rocm_default_gpu default %bcond_without rocm_loop
-# For testing openmp -%bcond_without openmp - %bcond_with foxi # For testing caffe2 %if 0%{?fedora} @@ -62,7 +59,7 @@ %endif
Name: python-%{pypi_name} -Version: %{pypi_version} +Version: %{pypi_version}^git%{date0}.%{shortcommit0} Release: %autorelease Summary: PyTorch AI/ML framework # See license.txt for license details @@ -73,7 +70,8 @@ URL: https://pytorch.org/ Source0: %{forgeurl}/archive/%{commit0}/pytorch-%{shortcommit0}.tar.gz Source100: pyproject.toml %else -Source0: %{forgeurl}/releases/download/v%{version}/pytorch-v%{version}.tar.gz +Source0: %{forgeurl}/archive/%{commit0}/pytorch-%{shortcommit0}.tar.gz +Source100: pyproject.toml %endif Source1: https://github.com/google/flatbuffers/archive/refs/tags/v23.3.3.tar.gz Source2: https://github.com/pybind/pybind11/archive/refs/tags/v2.11.1.tar.gz @@ -85,8 +83,6 @@ Source10: https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v%%7Bcu Source11: https://github.com/NVIDIA/cutlass/archive/refs/tags/v%%7Bcul_ver%7D.tar.gz %endif
-%if %{with gitcommit} - Patch0: 0001-no-third_party-foxi.patch Patch1: 0001-no-third_party-fmt.patch Patch2: 0001-no-third_party-FXdiv.patch @@ -104,37 +100,6 @@ Patch101: 0001-cuda-hip-signatures.patch Patch102: 0001-silence-an-assert.patch Patch103: 0001-can-not-use-with-c-files.patch Patch104: 0001-use-any-hip.patch - -%endif - -%else -# Misc cmake changes that would be difficult to upstream -# * Use the system fmt -# * Remove foxi use -# * Remove warnings/errors for clang 17 -# * fxdiv is not a library on Fedora -Patch0: 0001-Prepare-pytorch-cmake-for-fedora.patch -# https://github.com/pytorch/pytorch/pull/111048 -Patch2: 0003-Stub-in-kineto-ActivityType.patch -# PyTorch has not fully baked 3.12 support because 3.12 is so new -Patch3: 0004-torch-python-3.12-changes.patch -# Short circuit looking for things that can not be downloade by mock -Patch4: 0005-disable-submodule-search.patch -# libtorch_python.so: undefined symbols: Py* -Patch6: 0001-python-torch-link-with-python.patch -# E: unused-direct-shlib-dependency libshm.so.2.1.0 libtorch.so.2.1 -# turn on as-needed globally -Patch7: 0001-python-torch-remove-ubuntu-specific-linking.patch -# Tries to use git and is confused by tarball -Patch8: 0001-torch-sane-version.patch -# libtorch is a wrapper so turn off as-needed locally -# resolves this rpmlint -# E: shared-library-without-dependency-information libtorch.so.2.1.0 -# causes these -# E: unused-direct-shlib-dependency libtorch.so.2.1.0 libtorch_cpu.so.2.1 -# etc. -# As a wrapper library, this should be the expected behavior. -Patch9: 0001-disable-as-needed-for-libtorch.patch %endif
# Limit to these because they are well behaved with clang @@ -159,6 +124,7 @@ BuildRequires: gloo-devel %endif BuildRequires: ninja-build BuildRequires: onnx-devel +BuildRequires: libomp-devel BuildRequires: openblas-devel BuildRequires: pocketfft-devel BuildRequires: protobuf-devel @@ -169,11 +135,7 @@ BuildRequires: python3-pyyaml BuildRequires: python3-typing-extensions BuildRequires: sleef-devel BuildRequires: valgrind-devel -%if %{with gitcommit} BuildRequires: xnnpack-devel = 0.0^git20240229.fcbf55a -%else -BuildRequires: xnnpack-devel = 0.0^git20221221.51a9875 -%endif
BuildRequires: python3-devel BuildRequires: python3dist(filelock) @@ -189,12 +151,7 @@ BuildRequires: python3dist(fsspec) BuildRequires: python3dist(sympy) %endif
-%if %{with openmp} -BuildRequires: libomp-devel -%endif - %if %{with rocm} -BuildRequires: compiler-rt BuildRequires: hipblas-devel %if %{with hipblaslt} BuildRequires: hipblaslt-devel @@ -204,7 +161,6 @@ BuildRequires: hipfft-devel BuildRequires: hiprand-devel BuildRequires: hipsparse-devel BuildRequires: hipsolver-devel -BuildRequires: lld BuildRequires: miopen-devel BuildRequires: rocblas-devel BuildRequires: rocrand-devel @@ -291,7 +247,6 @@ Requires: python3-%{pypi_name}%{?_isa} = %{version}-%{release}
%prep
-%if %{with gitcommit} %autosetup -p1 -n pytorch-%{commit0}
# Remove bundled egg-info @@ -299,11 +254,6 @@ rm -rf %{pypi_name}.egg-info # Overwrite with a git checkout of the pyproject.toml cp %{SOURCE100} .
-%else -%autosetup -p1 -n pytorch-v%{version} - -%endif - tar xf %{SOURCE1} cp -r flatbuffers-23.3.3/* third_party/flatbuffers/
@@ -462,7 +412,7 @@ export USE_MKLDNN=OFF export USE_NCCL=OFF export USE_NNPACK=OFF export USE_NUMPY=ON -export USE_OPENMP=OFF +export USE_OPENMP=ON export USE_PYTORCH_QNNPACK=OFF export USE_QNNPACK=OFF export USE_ROCM=OFF @@ -496,10 +446,6 @@ export USE_CUDA=ON export USE_DISTRIBUTED=ON %endif
-%if %{with openmp} -export USE_OPENMP=ON -%endif - %if %{with test} export BUILD_TEST=ON %endif @@ -602,8 +548,6 @@ done %{_libdir}/rocm/gfx*/lib64/* %endif
- - %changelog %autochangelog
commit 61a50519621a39c782767c149f40ae591e5ca2ed Author: Tom Rix trix@redhat.com Date: Sun Mar 10 06:00:00 2024 -0700
Do not remove the empty files
py.typed files are supposed to be empty. Keep the install simple, just use it.
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 2ce32ff..e989c16 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -581,8 +581,7 @@ done
%endif
-# rm empty files -find %{buildroot} -type f -empty -delete +# Do not remote the empty files
%files -n python3-%{pypi_name}
commit a8493742cfa47561f896c49d4e846f35402f19eb Author: Tom Rix trix@redhat.com Date: Sat Mar 9 10:16:50 2024 -0800
Update RHEL CUDA
diff --git a/python-torch.spec b/python-torch.spec index b9f4860..2ce32ff 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -79,8 +79,10 @@ Source1: https://github.com/google/flatbuffers/archive/refs/tags/v23.3.3. Source2: https://github.com/pybind/pybind11/archive/refs/tags/v2.11.1.tar.gz
%if %{with cuda} -Source10: https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v1.0.3.tar.gz -Source11: https://github.com/NVIDIA/cutlass/archive/refs/tags/v3.3.0.tar.gz +%global cuf_ver 1.1.2 +Source10: https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v%%7Bcuf_ver%7D.t... +%global cul_ver 3.4.1 +Source11: https://github.com/NVIDIA/cutlass/archive/refs/tags/v%%7Bcul_ver%7D.tar.gz %endif
%if %{with gitcommit} @@ -310,9 +312,9 @@ cp -r pybind11-2.11.1/* third_party/pybind11/
%if %{with cuda} tar xf %{SOURCE10} -cp -r cudnn-frontend-1.0.3/* third_party/cudnn_frontend/ +cp -r cudnn-frontend-%{cuf_ver}/* third_party/cudnn_frontend/ tar xf %{SOURCE11} -cp -r cutlass-3.3.0/* third_party/cutlass/ +cp -r cutlass-%{cul_ver}/* third_party/cutlass/ %endif
%if %{with opencv}
commit edfbfff0d91fd1bc053ab579b553b651d5b52441 Author: Tom Rix trix@redhat.com Date: Fri Mar 8 10:29:29 2024 -0500
Update to ToT
ROCm is broken in fedora, disable it use. xnnpack needs updating
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 4529d29..b9f4860 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -6,8 +6,8 @@ # So pre releases can be tried %bcond_without gitcommit %if %{with gitcommit} -# The top of tree ~2/28/24 -%global commit0 3cfed0122829540444911c271ce5480832ea3526 +# The top of tree ~3/7/24 +%global commit0 975d4284250170602db60adfda5eb1664a3b8acc %global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%global pypi_version 2.3.0 @@ -25,7 +25,7 @@
%ifarch x86_64 %if 0%{?fedora} -%bcond_without rocm +%bcond_with rocm %else %bcond_with rocm %endif @@ -144,7 +144,6 @@ ExclusiveArch: x86_64 aarch64 %global _lto_cflags %nil %endif
-BuildRequires: clang-devel BuildRequires: cmake BuildRequires: cpuinfo-devel BuildRequires: eigen3-devel @@ -169,7 +168,7 @@ BuildRequires: python3-typing-extensions BuildRequires: sleef-devel BuildRequires: valgrind-devel %if %{with gitcommit} -BuildRequires: xnnpack-devel = 0.0^git20231127.d9cce34 +BuildRequires: xnnpack-devel = 0.0^git20240229.fcbf55a %else BuildRequires: xnnpack-devel = 0.0^git20221221.51a9875 %endif
commit 5f5921382a44f1c72eca8cadeadb7b01c6fd0916 Author: Tom Rix trix@redhat.com Date: Tue Mar 5 09:02:32 2024 -0500
Remove empty files
diff --git a/python-torch.spec b/python-torch.spec index 67da9de..4529d29 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -65,7 +65,7 @@ Name: python-%{pypi_name} Version: %{pypi_version} Release: %autorelease Summary: PyTorch AI/ML framework -# See below for details +# See license.txt for license details License: BSD-3-Clause AND BSD-2-Clause AND 0BSD AND Apache-2.0 AND MIT AND BSL-1.0 AND GPL-3.0-or-later AND Zlib
URL: https://pytorch.org/ @@ -580,6 +580,10 @@ done
%endif
+# rm empty files +find %{buildroot} -type f -empty -delete + + %files -n python3-%{pypi_name} %license LICENSE %doc README.md @@ -599,7 +603,6 @@ done %endif
-# See license.txt for license details
%changelog %autochangelog
commit 525a349094797df60a2d049c8c5320d5e7026e9d Author: Tom Rix trix@redhat.com Date: Mon Mar 4 09:42:28 2024 -0500
Switch to autochangelog
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index e98624c..67da9de 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -602,67 +602,5 @@ done # See license.txt for license details
%changelog -* Fri Jan 26 2024 Fedora Release Engineering releng@fedoraproject.org - 2.1.2-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Mon Jan 22 2024 Fedora Release Engineering releng@fedoraproject.org - 2.1.2-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Wed Dec 27 2023 Tom Rix trix@redhat.com - 2.1.2-1 -- Update to 2.1.2 -- Stop versioning *.so's - 2.1.2's version is wrong -- Stub in caffe2 to test in flight package - -* Wed Dec 27 2023 Tom Rix trix@redhat.com - 2.1.0-13 -- Stub in openmp to test in openmp - -* Wed Dec 20 2023 Tom Rix trix@redhat.com - 2.1.0-12 -- Stub in rocm to test in flight packages - -* Wed Dec 13 2023 Tom Rix trix@redhat.com - 2.1.0-11 -- Move unversioned *.so's to main package - -* Fri Dec 1 2023 Tom Rix trix@redhat.com - 2.1.0-10 -- Disable gold linker -- Remove python requires -- Change to openblas, remove -lgfortran fixes -- Manually add -pie to linking options - -* Fri Nov 24 2023 Tom Rix trix@redhat.com - 2.1.0-9 -- Enable debug build -- Remove Khronos licensed files from source -- Use 0BSD license identifier -- Generate lists directories, python and header files -- Add a -test subpackage - -* Wed Nov 15 2023 Tom Rix trix@redhat.com - 2.1.0-8 -- Address review comments - -* Thu Nov 2 2023 Tom Rix trix@redhat.com - 2.1.0-7 -- Address review comments -- remove pyproject option - -* Thu Oct 19 2023 Tom Rix trix@redhat.com - 2.1.0-6 -- Address review comments - -* Wed Oct 18 2023 Tom Rix trix@redhat.com - 2.1.0-5 -- Address review comments - -* Sat Oct 14 2023 Tom Rix trix@redhat.com - 2.1.0-4 -- Use gloo, xnnpack -- Find missing build_bundled.py -- Add pyproject option - -* Thu Oct 12 2023 Tom Rix trix@redhat.com - 2.1.0-3 -- Address review comments -- Force so versioning on - -* Mon Oct 9 2023 Tom Rix trix@redhat.com - 2.1.0-2 -- Use the 2.1 release -- Reduce USE_SYSTEM_LIBS to parts -- Remove almost all of third_party/ -- Remove py2rpm generated noise - -* Sat Sep 30 2023 Tom Rix trix@redhat.com - 2.1.0-1 -- Initial package. +%autochangelog
commit b2eaedd0c2a55f49b33fcbe78822ece22d1fd4bd Author: Tom Rix trix@redhat.com Date: Sun Mar 3 07:31:08 2024 -0500
Update hipblaslt patch
Upstream add some more things to change
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/next/0001-Optionally-use-hipblaslt.patch b/next/0001-Optionally-use-hipblaslt.patch index 029d98c..56434a7 100644 --- a/next/0001-Optionally-use-hipblaslt.patch +++ b/next/0001-Optionally-use-hipblaslt.patch @@ -1,4 +1,4 @@ -From 186728c9f4de720547fa3d1b7951c7d5563ad3c7 Mon Sep 17 00:00:00 2001 +From d77e05d90df006322cda021f1a8affdcc2c7eaef Mon Sep 17 00:00:00 2001 From: Tom Rix trix@redhat.com Date: Fri, 23 Feb 2024 08:27:30 -0500 Subject: [PATCH] Optionally use hipblaslt @@ -10,21 +10,30 @@ Convert the checks for ROCM_VERSION >= 507000 to HIPBLASLT checks
Signed-off-by: Tom Rix trix@redhat.com --- - aten/src/ATen/cuda/CUDABlas.cpp | 5 +++-- + aten/src/ATen/cuda/CUDABlas.cpp | 7 ++++--- aten/src/ATen/cuda/CUDABlas.h | 2 +- aten/src/ATen/cuda/CUDAContextLight.h | 4 ++-- aten/src/ATen/cuda/CublasHandlePool.cpp | 4 ++-- aten/src/ATen/cuda/tunable/TunableGemm.h | 6 +++--- - aten/src/ATen/native/cuda/Blas.cpp | 10 ++++++---- + aten/src/ATen/native/cuda/Blas.cpp | 14 ++++++++------ cmake/Dependencies.cmake | 3 +++ cmake/public/LoadHIP.cmake | 4 ++-- - 8 files changed, 22 insertions(+), 16 deletions(-) + 8 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/aten/src/ATen/cuda/CUDABlas.cpp b/aten/src/ATen/cuda/CUDABlas.cpp -index 0a3de5f9d77..b67031e88a7 100644 +index d534ec5a178..e815463f630 100644 --- a/aten/src/ATen/cuda/CUDABlas.cpp +++ b/aten/src/ATen/cuda/CUDABlas.cpp -@@ -778,7 +778,7 @@ void gemmat::BFloat16(CUDABLAS_GEMM_ARGTYPES(at::BFloat16)) { +@@ -14,7 +14,7 @@ + #include <c10/util/irange.h> + + #ifdef USE_ROCM +-#if ROCM_VERSION >= 60000 ++#ifdef HIPBLASLT + #include <hipblaslt/hipblaslt-ext.hpp> + #endif + // until hipblas has an API to accept flags, we must use rocblas here +@@ -781,7 +781,7 @@ void gemmat::BFloat16(CUDABLAS_GEMM_ARGTYPES(at::BFloat16)) { } }
@@ -33,7 +42,7 @@ index 0a3de5f9d77..b67031e88a7 100644
#if defined(USE_ROCM) && ROCM_VERSION >= 50700 && ROCM_VERSION < 60000 // only for rocm 5.7 where we first supported hipblaslt, it was difficult -@@ -909,6 +909,7 @@ class CuBlasLtMatmulPreference : public CuBlasLtDescriptor< +@@ -912,6 +912,7 @@ class CuBlasLtMatmulPreference : public CuBlasLtDescriptor< }; } // namespace
@@ -41,7 +50,7 @@ index 0a3de5f9d77..b67031e88a7 100644 template <typename Dtype> void gemm_and_bias( bool transpose_mat1, -@@ -1121,7 +1122,7 @@ template void gemm_and_bias( +@@ -1124,7 +1125,7 @@ template void gemm_and_bias( at::BFloat16* result_ptr, int64_t result_ld, GEMMAndBiasActivationEpilogue activation); @@ -86,10 +95,10 @@ index 4ec35f59a21..e28dc42034f 100644 #endif
diff --git a/aten/src/ATen/cuda/CublasHandlePool.cpp b/aten/src/ATen/cuda/CublasHandlePool.cpp -index d8ee09b1486..4510193a5cc 100644 +index 6913d2cd95e..3d4276be372 100644 --- a/aten/src/ATen/cuda/CublasHandlePool.cpp +++ b/aten/src/ATen/cuda/CublasHandlePool.cpp -@@ -28,7 +28,7 @@ namespace at::cuda { +@@ -29,7 +29,7 @@ namespace at::cuda {
namespace {
@@ -98,7 +107,7 @@ index d8ee09b1486..4510193a5cc 100644 void createCublasLtHandle(cublasLtHandle_t *handle) { TORCH_CUDABLAS_CHECK(cublasLtCreate(handle)); } -@@ -177,7 +177,7 @@ cublasHandle_t getCurrentCUDABlasHandle() { +@@ -190,7 +190,7 @@ cublasHandle_t getCurrentCUDABlasHandle() { return handle; }
@@ -139,10 +148,10 @@ index 3ba0d761277..dde1870cfbf 100644 if (env == nullptr || strcmp(env, "1") == 0) { // disallow tuning of hipblaslt with c10::complex diff --git a/aten/src/ATen/native/cuda/Blas.cpp b/aten/src/ATen/native/cuda/Blas.cpp -index 2b7ff1b502b..9ae2ccbd16d 100644 +index 29e5c5e3cf1..df56f3d7f1d 100644 --- a/aten/src/ATen/native/cuda/Blas.cpp +++ b/aten/src/ATen/native/cuda/Blas.cpp -@@ -153,7 +153,7 @@ enum class Activation { +@@ -155,7 +155,7 @@ enum class Activation { GELU, };
@@ -151,7 +160,7 @@ index 2b7ff1b502b..9ae2ccbd16d 100644 cuda::blas::GEMMAndBiasActivationEpilogue activation_to_gemm_and_blas_arg(Activation a) { switch (a) { case Activation::None: -@@ -191,6 +191,7 @@ static bool getDisableAddmmCudaLt() { +@@ -193,6 +193,7 @@ static bool getDisableAddmmCudaLt() {
#ifdef USE_ROCM static bool isSupportedHipLtROCmArch(int index) { @@ -159,7 +168,7 @@ index 2b7ff1b502b..9ae2ccbd16d 100644 hipDeviceProp_t* prop = at::cuda::getDeviceProperties(index); std::string device_arch = prop->gcnArchName; static const std::vectorstd::string archs = {"gfx90a", "gfx940", "gfx941", "gfx942"}; -@@ -201,6 +202,7 @@ static bool isSupportedHipLtROCmArch(int index) { +@@ -203,6 +204,7 @@ static bool isSupportedHipLtROCmArch(int index) { } } TORCH_CHECK(false, "Attempting to use hipBLASLt on a unsupported architecture!"); @@ -167,7 +176,7 @@ index 2b7ff1b502b..9ae2ccbd16d 100644 return false; } #endif -@@ -226,7 +228,7 @@ Tensor& addmm_out_cuda_impl(Tensor& result, const Tensor& self, const Tensor& ma +@@ -228,7 +230,7 @@ Tensor& addmm_out_cuda_impl(Tensor& result, const Tensor& self, const Tensor& ma at::ScalarType scalar_type = self.scalar_type(); c10::MaybeOwned<Tensor> self_; if (&result != &self) { @@ -176,7 +185,7 @@ index 2b7ff1b502b..9ae2ccbd16d 100644 // Strangely, if mat2 has only 1 row or column, we get // CUBLAS_STATUS_INVALID_VALUE error from cublasLtMatmulAlgoGetHeuristic. // self.dim() == 1 && result.dim() == 2 && self.sizes()[0] == mat2_sizes[1] -@@ -269,7 +271,7 @@ Tensor& addmm_out_cuda_impl(Tensor& result, const Tensor& self, const Tensor& ma +@@ -271,7 +273,7 @@ Tensor& addmm_out_cuda_impl(Tensor& result, const Tensor& self, const Tensor& ma } self__sizes = self_->sizes(); } else { @@ -185,7 +194,7 @@ index 2b7ff1b502b..9ae2ccbd16d 100644 useLtInterface = !disable_addmm_cuda_lt && result.dim() == 2 && result.is_contiguous() && isSupportedHipLtROCmArch(self.device().index()) && -@@ -320,7 +322,7 @@ Tensor& addmm_out_cuda_impl(Tensor& result, const Tensor& self, const Tensor& ma +@@ -322,7 +324,7 @@ Tensor& addmm_out_cuda_impl(Tensor& result, const Tensor& self, const Tensor& ma
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(!args.result->is_conj());
@@ -194,6 +203,24 @@ index 2b7ff1b502b..9ae2ccbd16d 100644 if (useLtInterface) { AT_DISPATCH_FLOATING_TYPES_AND2( at::ScalarType::Half, +@@ -876,7 +878,7 @@ _scaled_mm_out_cuda(const Tensor& mat1, const Tensor& mat2, + at::native::resize_output(out, {mat1_sizes[0], mat2_sizes[1]}); + at::native::resize_output(amax, {}); + +-#if !defined(USE_ROCM) && !defined(_MSC_VER) || (defined(USE_ROCM) && ROCM_VERSION >= 60000) ++#if !defined(USE_ROCM) && !defined(_MSC_VER) || (defined(USE_ROCM) && defined(HIPBLASLT)) + cublasCommonArgs args(mat1, mat2, out); + const auto out_dtype_ = args.result->scalar_type(); + TORCH_CHECK(args.transa == 't' && args.transb == 'n', "Only multiplication of row-major and column-major matrices is supported by cuBLASLt"); +@@ -906,7 +908,7 @@ _scaled_mm_out_cuda(const Tensor& mat1, const Tensor& mat2, + TORCH_CHECK(false, "_scaled_mm_out_cuda is not compiled for this platform."); + #endif + +-#if defined(USE_ROCM) && ROCM_VERSION >= 60000 ++#if defined(USE_ROCM) && defined(HIPBLASLT) + // rocm's hipblaslt does not yet support amax, so calculate separately + auto out_float32 = out.to(kFloat); + out_float32.abs_(); diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index b7ffbeb07dc..2b6c3678984 100644 --- a/cmake/Dependencies.cmake diff --git a/python-torch.spec b/python-torch.spec index 5272677..e98624c 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -6,8 +6,8 @@ # So pre releases can be tried %bcond_without gitcommit %if %{with gitcommit} -# The top of tree ~2/22/24 -%global commit0 5c5b71b6eebae76d744261715231093e62f0d090 +# The top of tree ~2/28/24 +%global commit0 3cfed0122829540444911c271ce5480832ea3526 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%global pypi_version 2.3.0 @@ -40,12 +40,18 @@ # For testing openmp %bcond_without openmp
+%bcond_with foxi # For testing caffe2 %if 0%{?fedora} +# need foxi-devel +%if %{with foxi} %bcond_without caffe2 %else %bcond_with caffe2 %endif +%else +%bcond_with caffe2 +%endif
# For testing distributed %bcond_with distributed @@ -182,23 +188,33 @@ BuildRequires: python3dist(fsspec) BuildRequires: python3dist(sympy) %endif
+%if %{with openmp} +BuildRequires: libomp-devel +%endif + %if %{with rocm} +BuildRequires: compiler-rt BuildRequires: hipblas-devel %if %{with hipblaslt} BuildRequires: hipblaslt-devel %endif BuildRequires: hipcub-devel BuildRequires: hipfft-devel +BuildRequires: hiprand-devel BuildRequires: hipsparse-devel BuildRequires: hipsolver-devel +BuildRequires: lld BuildRequires: miopen-devel BuildRequires: rocblas-devel +BuildRequires: rocrand-devel +BuildRequires: rocfft-devel %if %{with distributed} BuildRequires: rccl-devel %endif BuildRequires: rocprim-devel BuildRequires: rocm-cmake BuildRequires: rocm-comgr-devel +BuildRequires: rocm-core-devel BuildRequires: rocm-hip-devel BuildRequires: rocm-runtime-devel BuildRequires: rocm-rpm-macros @@ -208,9 +224,11 @@ BuildRequires: rocthrust-devel Requires: rocm-rpm-macros-modules %endif
+%if %{with foxi} %if %{with caffe2} BuildRequires: foxi-devel %endif +%endif
%if %{with test} BuildRequires: google-benchmark-devel
commit bbdb0aa112c49d8b84cbcd2b5fbcddbc09a0113b Author: Tom Rix trix@redhat.com Date: Thu Feb 29 11:07:25 2024 -0500
Generalize rocm build
diff --git a/license.txt b/license.txt new file mode 100644 index 0000000..0503793 --- /dev/null +++ b/license.txt @@ -0,0 +1,350 @@ +# +# License Details +# Main license BSD 3-Clause +# +# Apache-2.0 +# android/libs/fbjni/LICENSE +# android/libs/fbjni/CMakeLists.txt +# android/libs/fbjni/build.gradle +# android/libs/fbjni/cxx/fbjni/ByteBuffer.cpp +# android/libs/fbjni/cxx/fbjni/ByteBuffer.h +# android/libs/fbjni/cxx/fbjni/Context.h +# android/libs/fbjni/cxx/fbjni/File.h +# android/libs/fbjni/cxx/fbjni/JThread.h +# android/libs/fbjni/cxx/fbjni/NativeRunnable.h +# android/libs/fbjni/cxx/fbjni/OnLoad.cpp +# android/libs/fbjni/cxx/fbjni/ReadableByteChannel.cpp +# android/libs/fbjni/cxx/fbjni/ReadableByteChannel.h +# android/libs/fbjni/cxx/fbjni/detail/Boxed.h +# android/libs/fbjni/cxx/fbjni/detail/Common.h +# android/libs/fbjni/cxx/fbjni/detail/CoreClasses-inl.h +# android/libs/fbjni/cxx/fbjni/detail/CoreClasses.h +# android/libs/fbjni/cxx/fbjni/detail/Environment.cpp +# android/libs/fbjni/cxx/fbjni/detail/Environment.h +# android/libs/fbjni/cxx/fbjni/detail/Exceptions.cpp +# android/libs/fbjni/cxx/fbjni/detail/Exceptions.h +# android/libs/fbjni/cxx/fbjni/detail/FbjniApi.h +# android/libs/fbjni/cxx/fbjni/detail/Hybrid.cpp +# android/libs/fbjni/cxx/fbjni/detail/Hybrid.h +# android/libs/fbjni/cxx/fbjni/detail/Iterator-inl.h +# android/libs/fbjni/cxx/fbjni/detail/Iterator.h +# android/libs/fbjni/cxx/fbjni/detail/JWeakReference.h +# android/libs/fbjni/cxx/fbjni/detail/Log.h +# android/libs/fbjni/cxx/fbjni/detail/Meta-forward.h +# android/libs/fbjni/cxx/fbjni/detail/Meta-inl.h +# android/libs/fbjni/cxx/fbjni/detail/Meta.cpp +# android/libs/fbjni/cxx/fbjni/detail/Meta.h +# android/libs/fbjni/cxx/fbjni/detail/MetaConvert.h +# android/libs/fbjni/cxx/fbjni/detail/ReferenceAllocators-inl.h +# android/libs/fbjni/cxx/fbjni/detail/ReferenceAllocators.h +# android/libs/fbjni/cxx/fbjni/detail/References-forward.h +# android/libs/fbjni/cxx/fbjni/detail/References-inl.h +# android/libs/fbjni/cxx/fbjni/detail/References.cpp +# android/libs/fbjni/cxx/fbjni/detail/References.h +# android/libs/fbjni/cxx/fbjni/detail/Registration-inl.h +# android/libs/fbjni/cxx/fbjni/detail/Registration.h +# android/libs/fbjni/cxx/fbjni/detail/SimpleFixedString.h +# android/libs/fbjni/cxx/fbjni/detail/TypeTraits.h +# android/libs/fbjni/cxx/fbjni/detail/utf8.cpp +# android/libs/fbjni/cxx/fbjni/detail/utf8.h +# android/libs/fbjni/cxx/fbjni/fbjni.cpp +# android/libs/fbjni/cxx/fbjni/fbjni.h +# android/libs/fbjni/cxx/lyra/cxa_throw.cpp +# android/libs/fbjni/cxx/lyra/lyra.cpp +# android/libs/fbjni/cxx/lyra/lyra.h +# android/libs/fbjni/cxx/lyra/lyra_breakpad.cpp +# android/libs/fbjni/cxx/lyra/lyra_exceptions.cpp +# android/libs/fbjni/cxx/lyra/lyra_exceptions.h +# android/libs/fbjni/gradle.properties +# android/libs/fbjni/gradle/android-tasks.gradle +# android/libs/fbjni/gradle/release.gradle +# android/libs/fbjni/gradlew +# android/libs/fbjni/gradlew.bat +# android/libs/fbjni/host.gradle +# android/libs/fbjni/java/com/facebook/jni/CppException.java +# android/libs/fbjni/java/com/facebook/jni/CppSystemErrorException.java +# android/libs/fbjni/java/com/facebook/jni/DestructorThread.java +# android/libs/fbjni/java/com/facebook/jni/HybridClassBase.java +# android/libs/fbjni/java/com/facebook/jni/HybridData.java +# android/libs/fbjni/java/com/facebook/jni/IteratorHelper.java +# android/libs/fbjni/java/com/facebook/jni/MapIteratorHelper.java +# android/libs/fbjni/java/com/facebook/jni/NativeRunnable.java +# android/libs/fbjni/java/com/facebook/jni/ThreadScopeSupport.java +# android/libs/fbjni/java/com/facebook/jni/UnknownCppException.java +# android/libs/fbjni/java/com/facebook/jni/annotations/DoNotStrip.java +# android/libs/fbjni/scripts/android-setup.sh +# android/libs/fbjni/scripts/run-host-tests.sh +# android/libs/fbjni/settings.gradle +# android/libs/fbjni/test/BaseFBJniTests.java +# android/libs/fbjni/test/ByteBufferTests.java +# android/libs/fbjni/test/DocTests.java +# android/libs/fbjni/test/FBJniTests.java +# android/libs/fbjni/test/HybridTests.java +# android/libs/fbjni/test/IteratorTests.java +# android/libs/fbjni/test/PrimitiveArrayTests.java +# android/libs/fbjni/test/ReadableByteChannelTests.java +# android/libs/fbjni/test/jni/CMakeLists.txt +# android/libs/fbjni/test/jni/byte_buffer_tests.cpp +# android/libs/fbjni/test/jni/doc_tests.cpp +# android/libs/fbjni/test/jni/expect.h +# android/libs/fbjni/test/jni/fbjni_onload.cpp +# android/libs/fbjni/test/jni/fbjni_tests.cpp +# android/libs/fbjni/test/jni/hybrid_tests.cpp +# android/libs/fbjni/test/jni/inter_dso_exception_test_1/Test.cpp +# android/libs/fbjni/test/jni/inter_dso_exception_test_1/Test.h +# android/libs/fbjni/test/jni/inter_dso_exception_test_2/Test.cpp +# android/libs/fbjni/test/jni/inter_dso_exception_test_2/Test.h +# android/libs/fbjni/test/jni/iterator_tests.cpp +# android/libs/fbjni/test/jni/modified_utf8_test.cpp +# android/libs/fbjni/test/jni/no_rtti.cpp +# android/libs/fbjni/test/jni/no_rtti.h +# android/libs/fbjni/test/jni/primitive_array_tests.cpp +# android/libs/fbjni/test/jni/readable_byte_channel_tests.cpp +# android/libs/fbjni/test/jni/simple_fixed_string_tests.cpp +# android/libs/fbjni/test/jni/utf16toUTF8_test.cpp +# android/pytorch_android/host/build.gradle +# aten/src/ATen/cuda/llvm_basic.cpp +# aten/src/ATen/cuda/llvm_complex.cpp +# aten/src/ATen/native/quantized/cpu/qnnpack/confu.yaml +# aten/src/ATen/native/quantized/cpu/qnnpack/src/requantization/gemmlowp-neon.c +# aten/src/ATen/native/quantized/cpu/qnnpack/src/requantization/gemmlowp-scalar.h +# aten/src/ATen/native/quantized/cpu/qnnpack/src/requantization/gemmlowp-sse.h +# aten/src/ATen/nnapi/codegen.py +# aten/src/ATen/nnapi/NeuralNetworks.h +# aten/src/ATen/nnapi/nnapi_wrapper.cpp +# aten/src/ATen/nnapi/nnapi_wrapper.h +# binaries/benchmark_args.h +# binaries/benchmark_helper.cc +# binaries/benchmark_helper.h +# binaries/compare_models_torch.cc +# binaries/convert_and_benchmark.cc +# binaries/convert_caffe_image_db.cc +# binaries/convert_db.cc +# binaries/convert_encoded_to_raw_leveldb.cc +# binaries/convert_image_to_tensor.cc +# binaries/core_overhead_benchmark.cc +# binaries/core_overhead_benchmark_gpu.cc +# binaries/db_throughput.cc +# binaries/dump_operator_names.cc +# binaries/inspect_gpu.cc +# binaries/load_benchmark_torch.cc +# binaries/make_cifar_db.cc +# binaries/make_image_db.cc +# binaries/make_mnist_db.cc +# binaries/optimize_for_mobile.cc +# binaries/parallel_info.cc +# binaries/predictor_verifier.cc +# binaries/print_core_object_sizes_gpu.cc +# binaries/print_registered_core_operators.cc +# binaries/run_plan.cc +# binaries/run_plan_mpi.cc +# binaries/speed_benchmark.cc +# binaries/speed_benchmark_torch.cc +# binaries/split_db.cc +# binaries/tsv_2_proto.cc +# binaries/tutorial_blob.cc +# binaries/zmq_feeder.cc +# c10/test/util/small_vector_test.cpp +# c10/util/FunctionRef.h +# c10/util/SmallVector.cpp +# c10/util/SmallVector.h +# c10/util/llvmMathExtras.h +# c10/util/sparse_bitset.h +# caffe2/contrib/aten/gen_op.py +# caffe2/contrib/fakelowp/fp16_fc_acc_op.cc +# caffe2/contrib/fakelowp/fp16_fc_acc_op.h +# caffe2/contrib/gloo/allgather_ops.cc +# caffe2/contrib/gloo/allgather_ops.h +# caffe2/contrib/gloo/reduce_scatter_ops.cc +# caffe2/contrib/gloo/reduce_scatter_ops.h +# caffe2/core/hip/common_miopen.h +# caffe2/core/hip/common_miopen.hip +# caffe2/core/net_async_tracing.cc +# caffe2/core/net_async_tracing.h +# caffe2/core/net_async_tracing_test.cc +# caffe2/experiments/operators/fully_connected_op_decomposition.cc +# caffe2/experiments/operators/fully_connected_op_decomposition.h +# caffe2/experiments/operators/fully_connected_op_decomposition_gpu.cc +# caffe2/experiments/operators/fully_connected_op_prune.cc +# caffe2/experiments/operators/fully_connected_op_prune.h +# caffe2/experiments/operators/fully_connected_op_sparse.cc +# caffe2/experiments/operators/fully_connected_op_sparse.h +# caffe2/experiments/operators/funhash_op.cc +# caffe2/experiments/operators/funhash_op.h +# caffe2/experiments/operators/sparse_funhash_op.cc +# caffe2/experiments/operators/sparse_funhash_op.h +# caffe2/experiments/operators/sparse_matrix_reshape_op.cc +# caffe2/experiments/operators/sparse_matrix_reshape_op.h +# caffe2/experiments/operators/tt_contraction_op.cc +# caffe2/experiments/operators/tt_contraction_op.h +# caffe2/experiments/operators/tt_contraction_op_gpu.cc +# caffe2/experiments/operators/tt_pad_op.cc +# caffe2/experiments/operators/tt_pad_op.h +# caffe2/experiments/python/SparseTransformer.py +# caffe2/experiments/python/convnet_benchmarks.py +# caffe2/experiments/python/device_reduce_sum_bench.py +# caffe2/experiments/python/funhash_op_test.py +# caffe2/experiments/python/net_construct_bench.py +# caffe2/experiments/python/sparse_funhash_op_test.py +# caffe2/experiments/python/sparse_reshape_op_test.py +# caffe2/experiments/python/tt_contraction_op_test.py +# caffe2/experiments/python/tt_pad_op_test.py +# caffe2/mobile/contrib/libvulkan-stub/include/vulkan/vk_platform.h +# caffe2/mobile/contrib/libvulkan-stub/include/vulkan/vulkan.h +# caffe2/mobile/contrib/nnapi/NeuralNetworks.h +# caffe2/mobile/contrib/nnapi/dlnnapi.c +# caffe2/mobile/contrib/nnapi/nnapi_benchmark.cc +# caffe2/observers/profile_observer.cc +# caffe2/observers/profile_observer.h +# caffe2/operators/hip/conv_op_miopen.hip +# caffe2/operators/hip/local_response_normalization_op_miopen.hip +# caffe2/operators/hip/pool_op_miopen.hip +# caffe2/operators/hip/spatial_batch_norm_op_miopen.hip +# caffe2/operators/quantized/int8_utils.h +# caffe2/operators/stump_func_op.cc +# caffe2/operators/stump_func_op.cu +# caffe2/operators/stump_func_op.h +# caffe2/operators/unique_ops.cc +# caffe2/operators/unique_ops.cu +# caffe2/operators/unique_ops.h +# caffe2/operators/upsample_op.cc +# caffe2/operators/upsample_op.h +# caffe2/opt/fusion.h +# caffe2/python/layers/label_smooth.py +# caffe2/python/mint/static/css/simple-sidebar.css +# caffe2/python/modeling/get_entry_from_blobs.py +# caffe2/python/modeling/get_entry_from_blobs_test.py +# caffe2/python/modeling/gradient_clipping_test.py +# caffe2/python/operator_test/unique_ops_test.py +# caffe2/python/operator_test/upsample_op_test.py +# caffe2/python/operator_test/weight_scale_test.py +# caffe2/python/pybind_state_int8.cc +# caffe2/python/transformations.py +# caffe2/python/transformations_test.py +# caffe2/quantization/server/batch_matmul_dnnlowp_op.cc +# caffe2/quantization/server/batch_matmul_dnnlowp_op.h +# caffe2/quantization/server/compute_equalization_scale_test.py +# caffe2/quantization/server/elementwise_linear_dnnlowp_op.cc +# caffe2/quantization/server/elementwise_linear_dnnlowp_op.h +# caffe2/quantization/server/elementwise_sum_relu_op.cc +# caffe2/quantization/server/fb_fc_packed_op.cc +# caffe2/quantization/server/fb_fc_packed_op.h +# caffe2/quantization/server/fbgemm_fp16_pack_op.cc +# caffe2/quantization/server/fbgemm_fp16_pack_op.h +# caffe2/quantization/server/fully_connected_fake_lowp_op.cc +# caffe2/quantization/server/fully_connected_fake_lowp_op.h +# caffe2/quantization/server/int8_gen_quant_params_min_max_test.py +# caffe2/quantization/server/int8_gen_quant_params_test.py +# caffe2/quantization/server/int8_quant_scheme_blob_fill_test.py +# caffe2/quantization/server/spatial_batch_norm_relu_op.cc +# caffe2/sgd/weight_scale_op.cc +# caffe2/sgd/weight_scale_op.h +# caffe2/utils/bench_utils.h +# functorch/examples/maml_omniglot/maml-omniglot-higher.py +# functorch/examples/maml_omniglot/maml-omniglot-ptonly.py +# functorch/examples/maml_omniglot/maml-omniglot-transforms.py +# functorch/examples/maml_omniglot/support/omniglot_loaders.py +# modules/detectron/group_spatial_softmax_op.cc +# modules/detectron/group_spatial_softmax_op.cu +# modules/detectron/group_spatial_softmax_op.h +# modules/detectron/ps_roi_pool_op.cc +# modules/detectron/ps_roi_pool_op.h +# modules/detectron/roi_pool_f_op.cc +# modules/detectron/roi_pool_f_op.cu +# modules/detectron/roi_pool_f_op.h +# modules/detectron/sample_as_op.cc +# modules/detectron/sample_as_op.cu +# modules/detectron/sample_as_op.h +# modules/detectron/select_smooth_l1_loss_op.cc +# modules/detectron/select_smooth_l1_loss_op.cu +# modules/detectron/select_smooth_l1_loss_op.h +# modules/detectron/sigmoid_cross_entropy_loss_op.cc +# modules/detectron/sigmoid_cross_entropy_loss_op.cu +# modules/detectron/sigmoid_cross_entropy_loss_op.h +# modules/detectron/sigmoid_focal_loss_op.cc +# modules/detectron/sigmoid_focal_loss_op.cu +# modules/detectron/sigmoid_focal_loss_op.h +# modules/detectron/smooth_l1_loss_op.cc +# modules/detectron/smooth_l1_loss_op.cu +# modules/detectron/smooth_l1_loss_op.h +# modules/detectron/softmax_focal_loss_op.cc +# modules/detectron/softmax_focal_loss_op.cu +# modules/detectron/softmax_focal_loss_op.h +# modules/detectron/spatial_narrow_as_op.cc +# modules/detectron/spatial_narrow_as_op.cu +# modules/detectron/spatial_narrow_as_op.h +# modules/detectron/upsample_nearest_op.cc +# modules/detectron/upsample_nearest_op.h +# modules/module_test/module_test_dynamic.cc +# modules/rocksdb/rocksdb.cc +# scripts/apache_header.txt +# scripts/apache_python.txt +# torch/distributions/lkj_cholesky.py +# +# Apache 2.0 AND BSD 2-Clause +# caffe2/operators/deform_conv_op.cu +# +# Apache 2.0 AND BSD 2-Clause AND MIT +# modules/detectron/ps_roi_pool_op.cu +# +# Apache 2.0 AND BSD 2-Clause +# modules/detectron/upsample_nearest_op.cu +# +# BSD 0-Clause +# torch/csrc/utils/pythoncapi_compat.h +# +# BSD 2-Clause +# aten/src/ATen/native/quantized/cpu/qnnpack/deps/clog/LICENSE +# caffe2/image/transform_gpu.cu +# caffe2/image/transform_gpu.h +# +# BSL-1.0 +# c10/util/flat_hash_map.h +# c10/util/hash.h +# c10/util/Optional.h +# c10/util/order_preserving_flat_hash_map.h +# c10/util/strong_type.h +# c10/util/variant.h +# +# GPL-3.0-or-later AND MIT +# c10/util/reverse_iterator.h +# +# Khronos +# These files are for OpenCL, an unused option +# Replace them later, as-needed with the opencl-headers.rpm +# +# caffe2/contrib/opencl/OpenCL/cl.hpp +# caffe2/mobile/contrib/libopencl-stub/include/CL/cl.h +# caffe2/mobile/contrib/libopencl-stub/include/CL/cl.hpp +# caffe2/mobile/contrib/libopencl-stub/include/CL/cl_ext.h +# caffe2/mobile/contrib/libopencl-stub/include/CL/cl_gl.h +# caffe2/mobile/contrib/libopencl-stub/include/CL/cl_gl_ext.h +# caffe2/mobile/contrib/libopencl-stub/include/CL/cl_platform.h +# caffe2/mobile/contrib/libopencl-stub/include/CL/opencl.h +# +# MIT +# android/libs/fbjni/googletest-CMakeLists.txt.in +# c10/util/BFloat16-math.h +# caffe2/mobile/contrib/libvulkan-stub/include/libvulkan-stub.h +# caffe2/mobile/contrib/libvulkan-stub/src/libvulkan-stub.c +# caffe2/onnx/torch_ops/defs.cc +# cmake/Modules_CUDA_fix/upstream/FindCUDA/make2cmake.cmake +# cmake/Modules_CUDA_fix/upstream/FindCUDA/parse_cubin.cmake +# cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake +# functorch/einops/_parsing.py +# test/functorch/test_parsing.py +# test/functorch/test_rearrange.py +# third_party/miniz-2.1.0/LICENSE +# third_party/miniz-2.1.0/miniz.c +# tools/coverage_plugins_package/setup.py +# torch/_appdirs.py +# torch/utils/hipify/hipify_python.py +# +# Public Domain +# caffe2/mobile/contrib/libopencl-stub/LICENSE +# caffe2/utils/murmur_hash3.cc +# caffe2/utils/murmur_hash3.h +# +# Zlib +# aten/src/ATen/native/cpu/avx_mathfun.h + diff --git a/python-torch.spec b/python-torch.spec index 6c71ba6..5272677 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -32,12 +32,20 @@ %endif # hipblaslt is in development %bcond_with hipblaslt +# Which families gpu build for +%global rocm_gpu_list gfx8 gfx9 gfx10 gfx11 +%global rocm_default_gpu default +%bcond_without rocm_loop
# For testing openmp %bcond_without openmp
# For testing caffe2 +%if 0%{?fedora} +%bcond_without caffe2 +%else %bcond_with caffe2 +%endif
# For testing distributed %bcond_with distributed @@ -243,6 +251,15 @@ Requires: python3-%{pypi_name}%{?_isa} = %{version}-%{release} %description -n python3-%{pypi_name}-devel %{summary}
+%if %{with rocm} +%package -n python3-%{pypi_name}-rocm +Summary: %{name} for ROCm +Requires: python3-%{pypi_name}%{?_isa} = %{version}-%{release} + +%description -n python3-%{pypi_name}-rocm +%{summary} +%endif + %if %{with test} %package -n python3-%{pypi_name}-test Summary: Tests for %{name} @@ -254,6 +271,7 @@ Requires: python3-%{pypi_name}%{?_isa} = %{version}-%{release}
%prep + %if %{with gitcommit} %autosetup -p1 -n pytorch-%{commit0}
@@ -262,13 +280,6 @@ rm -rf %{pypi_name}.egg-info # Overwrite with a git checkout of the pyproject.toml cp %{SOURCE100} .
-%if %{with rocm} -# hipify -./tools/amd_build/build_amd.py -# Fedora installs to /usr/include, not /usr/include/rocm-core -sed -i -e 's@rocm-core/rocm_version.h@rocm_version.h@' aten/src/ATen/hip/tunable/TunableGemm.h -%endif - %else %autosetup -p1 -n pytorch-v%{version}
@@ -360,6 +371,13 @@ rm caffe2/contrib/opencl/OpenCL/cl.hpp rm caffe2/mobile/contrib/libopencl-stub/include/CL/*.h rm caffe2/mobile/contrib/libopencl-stub/include/CL/*.hpp
+%if %{with rocm} +# hipify +./tools/amd_build/build_amd.py +# Fedora installs to /usr/include, not /usr/include/rocm-core +sed -i -e 's@rocm-core/rocm_version.h@rocm_version.h@' aten/src/ATen/hip/tunable/TunableGemm.h +%endif + %if %{with cuda} # build complains about not being able to build -pie without -fPIC sed -i -e 's@string(APPEND CMAKE_CUDA_FLAGS " -D_GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI}")@string(APPEND CMAKE_CUDA_FLAGS " -fPIC -D_GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI}")@' CMakeLists.txt @@ -406,20 +424,29 @@ export MAX_JOBS=$COMPILE_JOBS export CMAKE_EXE_LINKER_FLAGS=-pie
export BUILD_CUSTOM_PROTOBUF=OFF +export BUILD_NVFUSER=OFF export BUILD_SHARED_LIBS=ON +export BUILD_TEST=OFF export CMAKE_BUILD_TYPE=RelWithDebInfo export CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON export CAFFE2_LINK_LOCAL_PROTOBUF=OFF +export INTERN_BUILD_MOBILE=OFF +export USE_DISTRIBUTED=OFF +export USE_CUDA=OFF export USE_FBGEMM=OFF export USE_GOLD_LINKER=OFF export USE_ITT=OFF export USE_KINETO=OFF export USE_LITE_INTERPRETER_PROFILER=OFF +export USE_LITE_PROTO=OFF export USE_MKLDNN=OFF +export USE_NCCL=OFF export USE_NNPACK=OFF export USE_NUMPY=ON +export USE_OPENMP=OFF export USE_PYTORCH_QNNPACK=OFF export USE_QNNPACK=OFF +export USE_ROCM=OFF export USE_SYSTEM_CPUINFO=ON export USE_SYSTEM_SLEEF=ON export USE_SYSTEM_EIGEN_INSTALL=ON @@ -436,47 +463,26 @@ export USE_XNNPACK=ON
%if %{with caffe2} export BUILD_CAFFE2=ON -export INTERN_BUILD_MOBILE=OFF -export USE_LITE_PROTO=OFF +%endif + +%if %{with cuda} +%if %{without rocm} +export CUDACXX=/usr/local/cuda/bin/nvcc +export CPLUS_INCLUDE_PATH=/usr/local/cuda/include +export USE_CUDA=ON +%endif %endif
%if %{with distributed} export USE_DISTRIBUTED=ON -%else -export USE_DISTRIBUTED=OFF %endif
- %if %{with openmp} export USE_OPENMP=ON -%else -export USE_OPENMP=OFF -%endif - -%if %{with rocm} -export USE_ROCM=ON -export USE_NCCL=OFF -export BUILD_NVFUSER=OFF -export HIP_PATH=%{_prefix} -export ROCM_PATH=%{_prefix} -export DEVICE_LIB_PATH=/usr/lib/clang/17/amdgcn/bitcode -%else -export USE_ROCM=OFF -%endif - -%if %{with cuda} -export CUDACXX=/usr/local/cuda/bin/nvcc -export CPLUS_INCLUDE_PATH=/usr/local/cuda/include -export USE_CUDA=ON -export USE_NCCL=OFF -%else -export USE_CUDA=OFF %endif
%if %{with test} export BUILD_TEST=ON -%else -export BUILD_TEST=OFF %endif
# Why we are using py3_ vs pyproject_ @@ -487,509 +493,95 @@ export BUILD_TEST=OFF # Adding pip to build requires does not fix # # See BZ 2244862 -%py3_build
-%install + %if %{with rocm} + export USE_ROCM=ON export HIP_PATH=%{_prefix} export ROCM_PATH=%{_prefix} -export DEVICE_LIB_PATH=/usr/lib/clang/17/amdgcn/bitcode +export DEVICE_LIB_PATH=%{clang_resource_dir}/amdgcn/bitcode + +gpu=%{rocm_default_gpu} +module load rocm/$gpu +export PYTORCH_ROCM_ARCH=$ROCM_GPUS +%py3_build +mv build build-${gpu} +module purge + +%if %{with rocm_loop} +for gpu in %{rocm_gpu_list} +do + module load rocm/$gpu + export PYTORCH_ROCM_ARCH=$ROCM_GPUS + %py3_build + mv build build-${gpu} + module purge +done %endif
-%py3_install +%else
-# empty files -rm %{buildroot}%{python3_sitearch}/torch/py.typed -rm %{buildroot}%{python3_sitearch}/torch/ao/quantization/backend_config/observation_type.py -rm %{buildroot}%{python3_sitearch}/torch/ao/quantization/backend_config/__pycache__/observation_type.*.pyc -rm %{buildroot}%{python3_sitearch}/torch/cuda/error.py -rm %{buildroot}%{python3_sitearch}/torch/cuda/__pycache__/error.*.pyc -rm %{buildroot}%{python3_sitearch}/torch/include/ATen/cudnn/Exceptions.h +%py3_build
-%if %{with caffe2} -# Remove test data -rm -rf %{buildroot}%{python3_sitearch}/caffe2/python/serialized_test/data/* %endif
-# exec permission -for f in `find %{buildroot}%{python3_sitearch} -name '*.py'`; do - if [ ! -x $f ]; then - sed -i '1{@^#!/usr/bin@d}' $f - fi -done - -# shebangs -%py3_shebang_fix %{buildroot}%{python3_sitearch} - -# Programatically create the list of dirs -echo "s|%{buildroot}%{python3_sitearch}|%%dir %%{python3_sitearch}|g" > br.sed -find %{buildroot}%{python3_sitearch} -mindepth 1 -type d > dirs.files -sed -i -f br.sed dirs.files -cat dirs.files > main.files +%install
-# Similar for the python files -find %{buildroot}%{python3_sitearch} -type f -name "*.py" -o -name "*.pyc" -o -name "*.pyi" > py.files -echo "s|%{buildroot}%{python3_sitearch}|%%{python3_sitearch}|g" > br.sed -sed -i -f br.sed py.files -cat py.files >> main.files +%if %{with rocm}
-# devel files, headers and such -find %{buildroot}%{python3_sitearch} -type f -name "*.h" -o -name "*.hpp" -o -name "*.cuh" -o -name "*.cpp" -o -name "*.cu" > devel.files -sed -i -f br.sed devel.files +export USE_ROCM=ON +export HIP_PATH=%{_prefix} +export ROCM_PATH=%{_prefix} +export DEVICE_LIB_PATH=%{clang_resource_dir}/amdgcn/bitcode + +gpu=%{rocm_default_gpu} +module load rocm/$gpu +export PYTORCH_ROCM_ARCH=$ROCM_GPUS +mv build-${gpu} build +%py3_install +mv build build-${gpu} +module purge + +%if %{with rocm_loop} +for gpu in %{rocm_gpu_list} +do + module load rocm/$gpu + export PYTORCH_ROCM_ARCH=$ROCM_GPUS + mv build-${gpu} build + # need to customize the install location, so replace py3_install + %{__python3} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} --prefix /usr/lib64/rocm/${gpu} %{?*} + rm -rfv %{buildroot}/usr/lib/rocm/${gpu}/bin/__pycache__ + mv build build-${gpu} + module purge +done +%endif
-# -# Main package -##% dir % {python3_sitearch}/torch*.egg-info +%else +%py3_install
-%files -n python3-%{pypi_name} -f main.files +%endif
+%files -n python3-%{pypi_name} %license LICENSE -%doc README.md - -# bins +%doc README.md %{_bindir}/convert-caffe2-to-onnx %{_bindir}/convert-onnx-to-caffe2 %{_bindir}/torchrun -%{python3_sitearch}/torch/bin/torch_shm_manager - -# libs -%{python3_sitearch}/functorch/_C.cpython*.so -%{python3_sitearch}/torch/_C.cpython*.so -%{python3_sitearch}/torch/lib/libc10.so -%{python3_sitearch}/torch/lib/libshm.so -%{python3_sitearch}/torch/lib/libtorch.so -%{python3_sitearch}/torch/lib/libtorch_cpu.so -%{python3_sitearch}/torch/lib/libtorch_global_deps.so -%{python3_sitearch}/torch/lib/libtorch_python.so -%if %{with rocm} -%{python3_sitearch}/torch/lib/libc10_hip.so -%{python3_sitearch}/torch/lib/libcaffe2_nvrtc.so -%{python3_sitearch}/torch/lib/libtorch_hip.so -%endif -%if %{with cuda} -%{python3_sitearch}/torch/lib/libc10_cuda.so -%{python3_sitearch}/torch/lib/libcaffe2_nvrtc.so -%{python3_sitearch}/torch/lib/libtorch_cuda.so -%{python3_sitearch}/torch/lib/libtorch_cuda_linalg.so -%endif +%{python3_sitearch}/%{pypi_name} +%{python3_sitearch}/%{pypi_name}-*.egg-info +%{python3_sitearch}/functorch +%{python3_sitearch}/torchgen %if %{with caffe2} -%{python3_sitearch}/torch/lib/libcaffe2_observers.so -%{python3_sitearch}/caffe2/python/caffe2_pybind11_state.cpython*.so -%if %{without rocm} -%{python3_sitearch}/torch/lib/libcaffe2_detectron_ops.so -%else -%{python3_sitearch}/torch/lib/libcaffe2_detectron_ops_hip.so -%{python3_sitearch}/caffe2/python/caffe2_pybind11_state_hip.cpython*.so -%endif -%endif - -# misc -%{python3_sitearch}/torch/utils/model_dump/{*.js,*.mjs,*.html} -%{python3_sitearch}/torchgen/packaged/ATen/native/*.yaml -%{python3_sitearch}/torchgen/packaged/autograd/{*.md,*.yaml} -%if %{with gitcommit} -%{python3_sitearch}/torch/_export/serde/schema.yaml -%if 0%{?fedora} -%{python3_sitearch}/torch/distributed/pipeline/sync/_balance/py.typed -%{python3_sitearch}/torch/distributed/pipeline/sync/py.typed +%{python3_sitearch}/caffe2 %endif +%if %{with rocm} +%{_libdir}/rocm/gfx*/bin/* +%{_libdir}/rocm/gfx*/lib64/* %endif
-# egg -%{python3_sitearch}/torch*.egg-info/* - -# excludes -# bazel build cruft -%exclude %{python3_sitearch}/torchgen/packaged/autograd/{BUILD.bazel,build.bzl} - -# -# devel package -# -%files -n python3-%{pypi_name}-devel -f devel.files - -# devel cmake -%{python3_sitearch}/torch/share/cmake/{ATen,Caffe2,Torch}/*.cmake -%{python3_sitearch}/torch/share/cmake/Caffe2/public/*.cmake -%{python3_sitearch}/torch/share/cmake/Caffe2/Modules_CUDA_fix/*.cmake -%{python3_sitearch}/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/*.cmake -%{python3_sitearch}/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/*.cmake - -# devel misc -%{python3_sitearch}/torchgen/packaged/ATen/templates/RegisterDispatchDefinitions.ini -%{python3_sitearch}/torchgen/packaged/autograd/templates/annotated_fn_args.py.in - -%if %{with test} -%files -n python3-%{pypi_name}-test - -# test bins -%{python3_sitearch}/torch/bin/test_api -%{python3_sitearch}/torch/bin/test_edge_op_registration -%{python3_sitearch}/torch/bin/test_jit -%{python3_sitearch}/torch/bin/test_lazy -%{python3_sitearch}/torch/bin/test_tensorexpr -%{python3_sitearch}/torch/bin/tutorial_tensorexpr - -# test libs -# Unversioned - not ment for release -%{python3_sitearch}/torch/lib/libbackend_with_compiler.so -%{python3_sitearch}/torch/lib/libjitbackend_test.so -%{python3_sitearch}/torch/lib/libtorchbind_test.so - -# tests -%{python3_sitearch}/torch/test/* - -%endif
-# -# License Details -# Main license BSD 3-Clause -# -# Apache-2.0 -# android/libs/fbjni/LICENSE -# android/libs/fbjni/CMakeLists.txt -# android/libs/fbjni/build.gradle -# android/libs/fbjni/cxx/fbjni/ByteBuffer.cpp -# android/libs/fbjni/cxx/fbjni/ByteBuffer.h -# android/libs/fbjni/cxx/fbjni/Context.h -# android/libs/fbjni/cxx/fbjni/File.h -# android/libs/fbjni/cxx/fbjni/JThread.h -# android/libs/fbjni/cxx/fbjni/NativeRunnable.h -# android/libs/fbjni/cxx/fbjni/OnLoad.cpp -# android/libs/fbjni/cxx/fbjni/ReadableByteChannel.cpp -# android/libs/fbjni/cxx/fbjni/ReadableByteChannel.h -# android/libs/fbjni/cxx/fbjni/detail/Boxed.h -# android/libs/fbjni/cxx/fbjni/detail/Common.h -# android/libs/fbjni/cxx/fbjni/detail/CoreClasses-inl.h -# android/libs/fbjni/cxx/fbjni/detail/CoreClasses.h -# android/libs/fbjni/cxx/fbjni/detail/Environment.cpp -# android/libs/fbjni/cxx/fbjni/detail/Environment.h -# android/libs/fbjni/cxx/fbjni/detail/Exceptions.cpp -# android/libs/fbjni/cxx/fbjni/detail/Exceptions.h -# android/libs/fbjni/cxx/fbjni/detail/FbjniApi.h -# android/libs/fbjni/cxx/fbjni/detail/Hybrid.cpp -# android/libs/fbjni/cxx/fbjni/detail/Hybrid.h -# android/libs/fbjni/cxx/fbjni/detail/Iterator-inl.h -# android/libs/fbjni/cxx/fbjni/detail/Iterator.h -# android/libs/fbjni/cxx/fbjni/detail/JWeakReference.h -# android/libs/fbjni/cxx/fbjni/detail/Log.h -# android/libs/fbjni/cxx/fbjni/detail/Meta-forward.h -# android/libs/fbjni/cxx/fbjni/detail/Meta-inl.h -# android/libs/fbjni/cxx/fbjni/detail/Meta.cpp -# android/libs/fbjni/cxx/fbjni/detail/Meta.h -# android/libs/fbjni/cxx/fbjni/detail/MetaConvert.h -# android/libs/fbjni/cxx/fbjni/detail/ReferenceAllocators-inl.h -# android/libs/fbjni/cxx/fbjni/detail/ReferenceAllocators.h -# android/libs/fbjni/cxx/fbjni/detail/References-forward.h -# android/libs/fbjni/cxx/fbjni/detail/References-inl.h -# android/libs/fbjni/cxx/fbjni/detail/References.cpp -# android/libs/fbjni/cxx/fbjni/detail/References.h -# android/libs/fbjni/cxx/fbjni/detail/Registration-inl.h -# android/libs/fbjni/cxx/fbjni/detail/Registration.h -# android/libs/fbjni/cxx/fbjni/detail/SimpleFixedString.h -# android/libs/fbjni/cxx/fbjni/detail/TypeTraits.h -# android/libs/fbjni/cxx/fbjni/detail/utf8.cpp -# android/libs/fbjni/cxx/fbjni/detail/utf8.h -# android/libs/fbjni/cxx/fbjni/fbjni.cpp -# android/libs/fbjni/cxx/fbjni/fbjni.h -# android/libs/fbjni/cxx/lyra/cxa_throw.cpp -# android/libs/fbjni/cxx/lyra/lyra.cpp -# android/libs/fbjni/cxx/lyra/lyra.h -# android/libs/fbjni/cxx/lyra/lyra_breakpad.cpp -# android/libs/fbjni/cxx/lyra/lyra_exceptions.cpp -# android/libs/fbjni/cxx/lyra/lyra_exceptions.h -# android/libs/fbjni/gradle.properties -# android/libs/fbjni/gradle/android-tasks.gradle -# android/libs/fbjni/gradle/release.gradle -# android/libs/fbjni/gradlew -# android/libs/fbjni/gradlew.bat -# android/libs/fbjni/host.gradle -# android/libs/fbjni/java/com/facebook/jni/CppException.java -# android/libs/fbjni/java/com/facebook/jni/CppSystemErrorException.java -# android/libs/fbjni/java/com/facebook/jni/DestructorThread.java -# android/libs/fbjni/java/com/facebook/jni/HybridClassBase.java -# android/libs/fbjni/java/com/facebook/jni/HybridData.java -# android/libs/fbjni/java/com/facebook/jni/IteratorHelper.java -# android/libs/fbjni/java/com/facebook/jni/MapIteratorHelper.java -# android/libs/fbjni/java/com/facebook/jni/NativeRunnable.java -# android/libs/fbjni/java/com/facebook/jni/ThreadScopeSupport.java -# android/libs/fbjni/java/com/facebook/jni/UnknownCppException.java -# android/libs/fbjni/java/com/facebook/jni/annotations/DoNotStrip.java -# android/libs/fbjni/scripts/android-setup.sh -# android/libs/fbjni/scripts/run-host-tests.sh -# android/libs/fbjni/settings.gradle -# android/libs/fbjni/test/BaseFBJniTests.java -# android/libs/fbjni/test/ByteBufferTests.java -# android/libs/fbjni/test/DocTests.java -# android/libs/fbjni/test/FBJniTests.java -# android/libs/fbjni/test/HybridTests.java -# android/libs/fbjni/test/IteratorTests.java -# android/libs/fbjni/test/PrimitiveArrayTests.java -# android/libs/fbjni/test/ReadableByteChannelTests.java -# android/libs/fbjni/test/jni/CMakeLists.txt -# android/libs/fbjni/test/jni/byte_buffer_tests.cpp -# android/libs/fbjni/test/jni/doc_tests.cpp -# android/libs/fbjni/test/jni/expect.h -# android/libs/fbjni/test/jni/fbjni_onload.cpp -# android/libs/fbjni/test/jni/fbjni_tests.cpp -# android/libs/fbjni/test/jni/hybrid_tests.cpp -# android/libs/fbjni/test/jni/inter_dso_exception_test_1/Test.cpp -# android/libs/fbjni/test/jni/inter_dso_exception_test_1/Test.h -# android/libs/fbjni/test/jni/inter_dso_exception_test_2/Test.cpp -# android/libs/fbjni/test/jni/inter_dso_exception_test_2/Test.h -# android/libs/fbjni/test/jni/iterator_tests.cpp -# android/libs/fbjni/test/jni/modified_utf8_test.cpp -# android/libs/fbjni/test/jni/no_rtti.cpp -# android/libs/fbjni/test/jni/no_rtti.h -# android/libs/fbjni/test/jni/primitive_array_tests.cpp -# android/libs/fbjni/test/jni/readable_byte_channel_tests.cpp -# android/libs/fbjni/test/jni/simple_fixed_string_tests.cpp -# android/libs/fbjni/test/jni/utf16toUTF8_test.cpp -# android/pytorch_android/host/build.gradle -# aten/src/ATen/cuda/llvm_basic.cpp -# aten/src/ATen/cuda/llvm_complex.cpp -# aten/src/ATen/native/quantized/cpu/qnnpack/confu.yaml -# aten/src/ATen/native/quantized/cpu/qnnpack/src/requantization/gemmlowp-neon.c -# aten/src/ATen/native/quantized/cpu/qnnpack/src/requantization/gemmlowp-scalar.h -# aten/src/ATen/native/quantized/cpu/qnnpack/src/requantization/gemmlowp-sse.h -# aten/src/ATen/nnapi/codegen.py -# aten/src/ATen/nnapi/NeuralNetworks.h -# aten/src/ATen/nnapi/nnapi_wrapper.cpp -# aten/src/ATen/nnapi/nnapi_wrapper.h -# binaries/benchmark_args.h -# binaries/benchmark_helper.cc -# binaries/benchmark_helper.h -# binaries/compare_models_torch.cc -# binaries/convert_and_benchmark.cc -# binaries/convert_caffe_image_db.cc -# binaries/convert_db.cc -# binaries/convert_encoded_to_raw_leveldb.cc -# binaries/convert_image_to_tensor.cc -# binaries/core_overhead_benchmark.cc -# binaries/core_overhead_benchmark_gpu.cc -# binaries/db_throughput.cc -# binaries/dump_operator_names.cc -# binaries/inspect_gpu.cc -# binaries/load_benchmark_torch.cc -# binaries/make_cifar_db.cc -# binaries/make_image_db.cc -# binaries/make_mnist_db.cc -# binaries/optimize_for_mobile.cc -# binaries/parallel_info.cc -# binaries/predictor_verifier.cc -# binaries/print_core_object_sizes_gpu.cc -# binaries/print_registered_core_operators.cc -# binaries/run_plan.cc -# binaries/run_plan_mpi.cc -# binaries/speed_benchmark.cc -# binaries/speed_benchmark_torch.cc -# binaries/split_db.cc -# binaries/tsv_2_proto.cc -# binaries/tutorial_blob.cc -# binaries/zmq_feeder.cc -# c10/test/util/small_vector_test.cpp -# c10/util/FunctionRef.h -# c10/util/SmallVector.cpp -# c10/util/SmallVector.h -# c10/util/llvmMathExtras.h -# c10/util/sparse_bitset.h -# caffe2/contrib/aten/gen_op.py -# caffe2/contrib/fakelowp/fp16_fc_acc_op.cc -# caffe2/contrib/fakelowp/fp16_fc_acc_op.h -# caffe2/contrib/gloo/allgather_ops.cc -# caffe2/contrib/gloo/allgather_ops.h -# caffe2/contrib/gloo/reduce_scatter_ops.cc -# caffe2/contrib/gloo/reduce_scatter_ops.h -# caffe2/core/hip/common_miopen.h -# caffe2/core/hip/common_miopen.hip -# caffe2/core/net_async_tracing.cc -# caffe2/core/net_async_tracing.h -# caffe2/core/net_async_tracing_test.cc -# caffe2/experiments/operators/fully_connected_op_decomposition.cc -# caffe2/experiments/operators/fully_connected_op_decomposition.h -# caffe2/experiments/operators/fully_connected_op_decomposition_gpu.cc -# caffe2/experiments/operators/fully_connected_op_prune.cc -# caffe2/experiments/operators/fully_connected_op_prune.h -# caffe2/experiments/operators/fully_connected_op_sparse.cc -# caffe2/experiments/operators/fully_connected_op_sparse.h -# caffe2/experiments/operators/funhash_op.cc -# caffe2/experiments/operators/funhash_op.h -# caffe2/experiments/operators/sparse_funhash_op.cc -# caffe2/experiments/operators/sparse_funhash_op.h -# caffe2/experiments/operators/sparse_matrix_reshape_op.cc -# caffe2/experiments/operators/sparse_matrix_reshape_op.h -# caffe2/experiments/operators/tt_contraction_op.cc -# caffe2/experiments/operators/tt_contraction_op.h -# caffe2/experiments/operators/tt_contraction_op_gpu.cc -# caffe2/experiments/operators/tt_pad_op.cc -# caffe2/experiments/operators/tt_pad_op.h -# caffe2/experiments/python/SparseTransformer.py -# caffe2/experiments/python/convnet_benchmarks.py -# caffe2/experiments/python/device_reduce_sum_bench.py -# caffe2/experiments/python/funhash_op_test.py -# caffe2/experiments/python/net_construct_bench.py -# caffe2/experiments/python/sparse_funhash_op_test.py -# caffe2/experiments/python/sparse_reshape_op_test.py -# caffe2/experiments/python/tt_contraction_op_test.py -# caffe2/experiments/python/tt_pad_op_test.py -# caffe2/mobile/contrib/libvulkan-stub/include/vulkan/vk_platform.h -# caffe2/mobile/contrib/libvulkan-stub/include/vulkan/vulkan.h -# caffe2/mobile/contrib/nnapi/NeuralNetworks.h -# caffe2/mobile/contrib/nnapi/dlnnapi.c -# caffe2/mobile/contrib/nnapi/nnapi_benchmark.cc -# caffe2/observers/profile_observer.cc -# caffe2/observers/profile_observer.h -# caffe2/operators/hip/conv_op_miopen.hip -# caffe2/operators/hip/local_response_normalization_op_miopen.hip -# caffe2/operators/hip/pool_op_miopen.hip -# caffe2/operators/hip/spatial_batch_norm_op_miopen.hip -# caffe2/operators/quantized/int8_utils.h -# caffe2/operators/stump_func_op.cc -# caffe2/operators/stump_func_op.cu -# caffe2/operators/stump_func_op.h -# caffe2/operators/unique_ops.cc -# caffe2/operators/unique_ops.cu -# caffe2/operators/unique_ops.h -# caffe2/operators/upsample_op.cc -# caffe2/operators/upsample_op.h -# caffe2/opt/fusion.h -# caffe2/python/layers/label_smooth.py -# caffe2/python/mint/static/css/simple-sidebar.css -# caffe2/python/modeling/get_entry_from_blobs.py -# caffe2/python/modeling/get_entry_from_blobs_test.py -# caffe2/python/modeling/gradient_clipping_test.py -# caffe2/python/operator_test/unique_ops_test.py -# caffe2/python/operator_test/upsample_op_test.py -# caffe2/python/operator_test/weight_scale_test.py -# caffe2/python/pybind_state_int8.cc -# caffe2/python/transformations.py -# caffe2/python/transformations_test.py -# caffe2/quantization/server/batch_matmul_dnnlowp_op.cc -# caffe2/quantization/server/batch_matmul_dnnlowp_op.h -# caffe2/quantization/server/compute_equalization_scale_test.py -# caffe2/quantization/server/elementwise_linear_dnnlowp_op.cc -# caffe2/quantization/server/elementwise_linear_dnnlowp_op.h -# caffe2/quantization/server/elementwise_sum_relu_op.cc -# caffe2/quantization/server/fb_fc_packed_op.cc -# caffe2/quantization/server/fb_fc_packed_op.h -# caffe2/quantization/server/fbgemm_fp16_pack_op.cc -# caffe2/quantization/server/fbgemm_fp16_pack_op.h -# caffe2/quantization/server/fully_connected_fake_lowp_op.cc -# caffe2/quantization/server/fully_connected_fake_lowp_op.h -# caffe2/quantization/server/int8_gen_quant_params_min_max_test.py -# caffe2/quantization/server/int8_gen_quant_params_test.py -# caffe2/quantization/server/int8_quant_scheme_blob_fill_test.py -# caffe2/quantization/server/spatial_batch_norm_relu_op.cc -# caffe2/sgd/weight_scale_op.cc -# caffe2/sgd/weight_scale_op.h -# caffe2/utils/bench_utils.h -# functorch/examples/maml_omniglot/maml-omniglot-higher.py -# functorch/examples/maml_omniglot/maml-omniglot-ptonly.py -# functorch/examples/maml_omniglot/maml-omniglot-transforms.py -# functorch/examples/maml_omniglot/support/omniglot_loaders.py -# modules/detectron/group_spatial_softmax_op.cc -# modules/detectron/group_spatial_softmax_op.cu -# modules/detectron/group_spatial_softmax_op.h -# modules/detectron/ps_roi_pool_op.cc -# modules/detectron/ps_roi_pool_op.h -# modules/detectron/roi_pool_f_op.cc -# modules/detectron/roi_pool_f_op.cu -# modules/detectron/roi_pool_f_op.h -# modules/detectron/sample_as_op.cc -# modules/detectron/sample_as_op.cu -# modules/detectron/sample_as_op.h -# modules/detectron/select_smooth_l1_loss_op.cc -# modules/detectron/select_smooth_l1_loss_op.cu -# modules/detectron/select_smooth_l1_loss_op.h -# modules/detectron/sigmoid_cross_entropy_loss_op.cc -# modules/detectron/sigmoid_cross_entropy_loss_op.cu -# modules/detectron/sigmoid_cross_entropy_loss_op.h -# modules/detectron/sigmoid_focal_loss_op.cc -# modules/detectron/sigmoid_focal_loss_op.cu -# modules/detectron/sigmoid_focal_loss_op.h -# modules/detectron/smooth_l1_loss_op.cc -# modules/detectron/smooth_l1_loss_op.cu -# modules/detectron/smooth_l1_loss_op.h -# modules/detectron/softmax_focal_loss_op.cc -# modules/detectron/softmax_focal_loss_op.cu -# modules/detectron/softmax_focal_loss_op.h -# modules/detectron/spatial_narrow_as_op.cc -# modules/detectron/spatial_narrow_as_op.cu -# modules/detectron/spatial_narrow_as_op.h -# modules/detectron/upsample_nearest_op.cc -# modules/detectron/upsample_nearest_op.h -# modules/module_test/module_test_dynamic.cc -# modules/rocksdb/rocksdb.cc -# scripts/apache_header.txt -# scripts/apache_python.txt -# torch/distributions/lkj_cholesky.py -# -# Apache 2.0 AND BSD 2-Clause -# caffe2/operators/deform_conv_op.cu -# -# Apache 2.0 AND BSD 2-Clause AND MIT -# modules/detectron/ps_roi_pool_op.cu -# -# Apache 2.0 AND BSD 2-Clause -# modules/detectron/upsample_nearest_op.cu -# -# BSD 0-Clause -# torch/csrc/utils/pythoncapi_compat.h -# -# BSD 2-Clause -# aten/src/ATen/native/quantized/cpu/qnnpack/deps/clog/LICENSE -# caffe2/image/transform_gpu.cu -# caffe2/image/transform_gpu.h -# -# BSL-1.0 -# c10/util/flat_hash_map.h -# c10/util/hash.h -# c10/util/Optional.h -# c10/util/order_preserving_flat_hash_map.h -# c10/util/strong_type.h -# c10/util/variant.h -# -# GPL-3.0-or-later AND MIT -# c10/util/reverse_iterator.h -# -# Khronos -# These files are for OpenCL, an unused option -# Replace them later, as-needed with the opencl-headers.rpm -# -# caffe2/contrib/opencl/OpenCL/cl.hpp -# caffe2/mobile/contrib/libopencl-stub/include/CL/cl.h -# caffe2/mobile/contrib/libopencl-stub/include/CL/cl.hpp -# caffe2/mobile/contrib/libopencl-stub/include/CL/cl_ext.h -# caffe2/mobile/contrib/libopencl-stub/include/CL/cl_gl.h -# caffe2/mobile/contrib/libopencl-stub/include/CL/cl_gl_ext.h -# caffe2/mobile/contrib/libopencl-stub/include/CL/cl_platform.h -# caffe2/mobile/contrib/libopencl-stub/include/CL/opencl.h -# -# MIT -# android/libs/fbjni/googletest-CMakeLists.txt.in -# c10/util/BFloat16-math.h -# caffe2/mobile/contrib/libvulkan-stub/include/libvulkan-stub.h -# caffe2/mobile/contrib/libvulkan-stub/src/libvulkan-stub.c -# caffe2/onnx/torch_ops/defs.cc -# cmake/Modules_CUDA_fix/upstream/FindCUDA/make2cmake.cmake -# cmake/Modules_CUDA_fix/upstream/FindCUDA/parse_cubin.cmake -# cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake -# functorch/einops/_parsing.py -# test/functorch/test_parsing.py -# test/functorch/test_rearrange.py -# third_party/miniz-2.1.0/LICENSE -# third_party/miniz-2.1.0/miniz.c -# tools/coverage_plugins_package/setup.py -# torch/_appdirs.py -# torch/utils/hipify/hipify_python.py -# -# Public Domain -# caffe2/mobile/contrib/libopencl-stub/LICENSE -# caffe2/utils/murmur_hash3.cc -# caffe2/utils/murmur_hash3.h -# -# Zlib -# aten/src/ATen/native/cpu/avx_mathfun.h +# See license.txt for license details
%changelog * Fri Jan 26 2024 Fedora Release Engineering releng@fedoraproject.org - 2.1.2-3
commit d1b282f7c4b12c80f02ffbedb497e67a643f878f Author: Tom Rix trix@redhat.com Date: Mon Feb 26 07:14:51 2024 -0500
optional hipblaslt
diff --git a/python-torch.spec b/python-torch.spec index d1dbbd4..6c71ba6 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -30,6 +30,8 @@ %bcond_with rocm %endif %endif +# hipblaslt is in development +%bcond_with hipblaslt
# For testing openmp %bcond_without openmp @@ -80,10 +82,13 @@ Patch6: 0001-reenable-foxi-linking.patch %endif
%if %{with rocm} -Patch100: 0001-cuda-hip-signatures.patch -Patch101: 0001-silence-an-assert.patch -Patch102: 0001-can-not-use-with-c-files.patch -Patch103: 0001-use-any-hip.patch +# https://github.com/pytorch/pytorch/pull/120551 +Patch100: 0001-Optionally-use-hipblaslt.patch +Patch101: 0001-cuda-hip-signatures.patch +Patch102: 0001-silence-an-assert.patch +Patch103: 0001-can-not-use-with-c-files.patch +Patch104: 0001-use-any-hip.patch + %endif
%else @@ -171,7 +176,9 @@ BuildRequires: python3dist(sympy)
%if %{with rocm} BuildRequires: hipblas-devel +%if %{with hipblaslt} BuildRequires: hipblaslt-devel +%endif BuildRequires: hipcub-devel BuildRequires: hipfft-devel BuildRequires: hipsparse-devel @@ -480,7 +487,7 @@ export BUILD_TEST=OFF # Adding pip to build requires does not fix # # See BZ 2244862 -%py3_build +%py3_build
%install %if %{with rocm} @@ -490,7 +497,7 @@ export ROCM_PATH=%{_prefix} export DEVICE_LIB_PATH=/usr/lib/clang/17/amdgcn/bitcode %endif
-%py3_install +%py3_install
# empty files rm %{buildroot}%{python3_sitearch}/torch/py.typed
commit 7a89201199c27b37e89b3931efa283526db909c6 Author: Tom Rix trix@redhat.com Date: Sat Feb 24 07:39:48 2024 -0500
add --with hipblaslt option
diff --git a/next/0001-Optionally-use-hipblaslt.patch b/next/0001-Optionally-use-hipblaslt.patch new file mode 100644 index 0000000..029d98c --- /dev/null +++ b/next/0001-Optionally-use-hipblaslt.patch @@ -0,0 +1,235 @@ +From 186728c9f4de720547fa3d1b7951c7d5563ad3c7 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Fri, 23 Feb 2024 08:27:30 -0500 +Subject: [PATCH] Optionally use hipblaslt + +The hipblaslt package is not available on Fedora. +Instead of requiring the package, make it optional. +If it is found, define the preprocessor variable HIPBLASLT +Convert the checks for ROCM_VERSION >= 507000 to HIPBLASLT checks + +Signed-off-by: Tom Rix trix@redhat.com +--- + aten/src/ATen/cuda/CUDABlas.cpp | 5 +++-- + aten/src/ATen/cuda/CUDABlas.h | 2 +- + aten/src/ATen/cuda/CUDAContextLight.h | 4 ++-- + aten/src/ATen/cuda/CublasHandlePool.cpp | 4 ++-- + aten/src/ATen/cuda/tunable/TunableGemm.h | 6 +++--- + aten/src/ATen/native/cuda/Blas.cpp | 10 ++++++---- + cmake/Dependencies.cmake | 3 +++ + cmake/public/LoadHIP.cmake | 4 ++-- + 8 files changed, 22 insertions(+), 16 deletions(-) + +diff --git a/aten/src/ATen/cuda/CUDABlas.cpp b/aten/src/ATen/cuda/CUDABlas.cpp +index 0a3de5f9d77..b67031e88a7 100644 +--- a/aten/src/ATen/cuda/CUDABlas.cpp ++++ b/aten/src/ATen/cuda/CUDABlas.cpp +@@ -778,7 +778,7 @@ void gemmat::BFloat16(CUDABLAS_GEMM_ARGTYPES(at::BFloat16)) { + } + } + +-#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && ROCM_VERSION >= 50700) ++#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && defined(HIPBLASLT)) + + #if defined(USE_ROCM) && ROCM_VERSION >= 50700 && ROCM_VERSION < 60000 + // only for rocm 5.7 where we first supported hipblaslt, it was difficult +@@ -909,6 +909,7 @@ class CuBlasLtMatmulPreference : public CuBlasLtDescriptor< + }; + } // namespace + ++#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && defined(HIPBLASLT)) + template <typename Dtype> + void gemm_and_bias( + bool transpose_mat1, +@@ -1121,7 +1122,7 @@ template void gemm_and_bias( + at::BFloat16* result_ptr, + int64_t result_ld, + GEMMAndBiasActivationEpilogue activation); +- ++#endif + void scaled_gemm( + char transa, + char transb, +diff --git a/aten/src/ATen/cuda/CUDABlas.h b/aten/src/ATen/cuda/CUDABlas.h +index eb12bb350c5..068607467dd 100644 +--- a/aten/src/ATen/cuda/CUDABlas.h ++++ b/aten/src/ATen/cuda/CUDABlas.h +@@ -82,7 +82,7 @@ void gemm_internalat::Half(CUDABLAS_GEMM_ARGTYPES(at::Half)); + template <> + void gemm_internalat::BFloat16(CUDABLAS_GEMM_ARGTYPES(at::BFloat16)); + +-#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && ROCM_VERSION >= 50700) ++#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && defined(HIPBLASLT)) + enum GEMMAndBiasActivationEpilogue { + None, + RELU, +diff --git a/aten/src/ATen/cuda/CUDAContextLight.h b/aten/src/ATen/cuda/CUDAContextLight.h +index 4ec35f59a21..e28dc42034f 100644 +--- a/aten/src/ATen/cuda/CUDAContextLight.h ++++ b/aten/src/ATen/cuda/CUDAContextLight.h +@@ -9,7 +9,7 @@ + + // cublasLT was introduced in CUDA 10.1 but we enable only for 11.1 that also + // added bf16 support +-#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && ROCM_VERSION >= 50700) ++#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && defined(HIPBLASLT)) + #include <cublasLt.h> + #endif + +@@ -82,7 +82,7 @@ TORCH_CUDA_CPP_API c10::Allocator* getCUDADeviceAllocator(); + /* Handles */ + TORCH_CUDA_CPP_API cusparseHandle_t getCurrentCUDASparseHandle(); + TORCH_CUDA_CPP_API cublasHandle_t getCurrentCUDABlasHandle(); +-#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && ROCM_VERSION >= 50700) ++#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && defined(HIPBLASLT)) + TORCH_CUDA_CPP_API cublasLtHandle_t getCurrentCUDABlasLtHandle(); + #endif + +diff --git a/aten/src/ATen/cuda/CublasHandlePool.cpp b/aten/src/ATen/cuda/CublasHandlePool.cpp +index d8ee09b1486..4510193a5cc 100644 +--- a/aten/src/ATen/cuda/CublasHandlePool.cpp ++++ b/aten/src/ATen/cuda/CublasHandlePool.cpp +@@ -28,7 +28,7 @@ namespace at::cuda { + + namespace { + +-#if defined(USE_ROCM) && ROCM_VERSION >= 50700 ++#if defined(USE_ROCM) && defined(HIPBLASLT) + void createCublasLtHandle(cublasLtHandle_t *handle) { + TORCH_CUDABLAS_CHECK(cublasLtCreate(handle)); + } +@@ -177,7 +177,7 @@ cublasHandle_t getCurrentCUDABlasHandle() { + return handle; + } + +-#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && ROCM_VERSION >= 50700) ++#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && defined(HIPBLASLT)) + cublasLtHandle_t getCurrentCUDABlasLtHandle() { + #ifdef USE_ROCM + c10::DeviceIndex device = 0; +diff --git a/aten/src/ATen/cuda/tunable/TunableGemm.h b/aten/src/ATen/cuda/tunable/TunableGemm.h +index 3ba0d761277..dde1870cfbf 100644 +--- a/aten/src/ATen/cuda/tunable/TunableGemm.h ++++ b/aten/src/ATen/cuda/tunable/TunableGemm.h +@@ -11,7 +11,7 @@ + + #include <ATen/cuda/tunable/GemmCommon.h> + #ifdef USE_ROCM +-#if ROCM_VERSION >= 50700 ++#ifdef HIPBLASLT + #include <ATen/cuda/tunable/GemmHipblaslt.h> + #endif + #include <ATen/cuda/tunable/GemmRocblas.h> +@@ -166,7 +166,7 @@ class GemmTunableOp : public TunableOp<GemmParams<T>, StreamTimer> { + } + #endif + +-#if defined(USE_ROCM) && ROCM_VERSION >= 50700 ++#if defined(USE_ROCM) && defined(HIPBLASLT) + static const char *env = std::getenv("PYTORCH_TUNABLEOP_HIPBLASLT_ENABLED"); + if (env == nullptr || strcmp(env, "1") == 0) { + // disallow tuning of hipblaslt with c10::complex +@@ -240,7 +240,7 @@ class GemmStridedBatchedTunableOp : public TunableOp<GemmStridedBatchedParams<T> + } + #endif + +-#if defined(USE_ROCM) && ROCM_VERSION >= 50700 ++#if defined(USE_ROCM) && defined(HIPBLASLT) + static const char *env = std::getenv("PYTORCH_TUNABLEOP_HIPBLASLT_ENABLED"); + if (env == nullptr || strcmp(env, "1") == 0) { + // disallow tuning of hipblaslt with c10::complex +diff --git a/aten/src/ATen/native/cuda/Blas.cpp b/aten/src/ATen/native/cuda/Blas.cpp +index 2b7ff1b502b..9ae2ccbd16d 100644 +--- a/aten/src/ATen/native/cuda/Blas.cpp ++++ b/aten/src/ATen/native/cuda/Blas.cpp +@@ -153,7 +153,7 @@ enum class Activation { + GELU, + }; + +-#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && ROCM_VERSION >= 50700) ++#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && defined(HIPBLASLT)) + cuda::blas::GEMMAndBiasActivationEpilogue activation_to_gemm_and_blas_arg(Activation a) { + switch (a) { + case Activation::None: +@@ -191,6 +191,7 @@ static bool getDisableAddmmCudaLt() { + + #ifdef USE_ROCM + static bool isSupportedHipLtROCmArch(int index) { ++#if defined(HIPBLASLT) + hipDeviceProp_t* prop = at::cuda::getDeviceProperties(index); + std::string device_arch = prop->gcnArchName; + static const std::vectorstd::string archs = {"gfx90a", "gfx940", "gfx941", "gfx942"}; +@@ -201,6 +202,7 @@ static bool isSupportedHipLtROCmArch(int index) { + } + } + TORCH_CHECK(false, "Attempting to use hipBLASLt on a unsupported architecture!"); ++#endif + return false; + } + #endif +@@ -226,7 +228,7 @@ Tensor& addmm_out_cuda_impl(Tensor& result, const Tensor& self, const Tensor& ma + at::ScalarType scalar_type = self.scalar_type(); + c10::MaybeOwned<Tensor> self_; + if (&result != &self) { +-#if (defined(CUDA_VERSION) && CUDA_VERSION >= 11040 && !defined(_MSC_VER)) || defined(USE_ROCM) && ROCM_VERSION >= 50700 ++#if (defined(CUDA_VERSION) && CUDA_VERSION >= 11040 && !defined(_MSC_VER)) || defined(USE_ROCM) && defined(HIPBLASLT) + // Strangely, if mat2 has only 1 row or column, we get + // CUBLAS_STATUS_INVALID_VALUE error from cublasLtMatmulAlgoGetHeuristic. + // self.dim() == 1 && result.dim() == 2 && self.sizes()[0] == mat2_sizes[1] +@@ -269,7 +271,7 @@ Tensor& addmm_out_cuda_impl(Tensor& result, const Tensor& self, const Tensor& ma + } + self__sizes = self_->sizes(); + } else { +-#if defined(USE_ROCM) && ROCM_VERSION >= 50700 ++#if defined(USE_ROCM) && defined(HIPBLASLT) + useLtInterface = !disable_addmm_cuda_lt && + result.dim() == 2 && result.is_contiguous() && + isSupportedHipLtROCmArch(self.device().index()) && +@@ -320,7 +322,7 @@ Tensor& addmm_out_cuda_impl(Tensor& result, const Tensor& self, const Tensor& ma + + TORCH_INTERNAL_ASSERT_DEBUG_ONLY(!args.result->is_conj()); + +-#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && ROCM_VERSION >= 50700) ++#if (!defined(USE_ROCM) && !defined(_MSC_VER)) || (defined(USE_ROCM) && defined(HIPBLASLT)) + if (useLtInterface) { + AT_DISPATCH_FLOATING_TYPES_AND2( + at::ScalarType::Half, +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index b7ffbeb07dc..2b6c3678984 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -1273,6 +1273,9 @@ if(USE_ROCM) + if(ROCM_VERSION_DEV VERSION_GREATER_EQUAL "6.0.0") + list(APPEND HIP_CXX_FLAGS -DHIPBLAS_V2) + endif() ++ if(hipblast_FOUND) ++ list(APPEND HIP_CXX_FLAGS -DHIPBLASLT) ++ endif() + if(HIPBLASLT_CUSTOM_DATA_TYPE) + list(APPEND HIP_CXX_FLAGS -DHIPBLASLT_CUSTOM_DATA_TYPE) + endif() +diff --git a/cmake/public/LoadHIP.cmake b/cmake/public/LoadHIP.cmake +index f6ca263c5e5..53eb0b63c1a 100644 +--- a/cmake/public/LoadHIP.cmake ++++ b/cmake/public/LoadHIP.cmake +@@ -156,7 +156,7 @@ if(HIP_FOUND) + find_package_and_print_version(rocblas REQUIRED) + find_package_and_print_version(hipblas REQUIRED) + if(ROCM_VERSION_DEV VERSION_GREATER_EQUAL "5.7.0") +- find_package_and_print_version(hipblaslt REQUIRED) ++ find_package_and_print_version(hipblaslt) + endif() + find_package_and_print_version(miopen REQUIRED) + if(ROCM_VERSION_DEV VERSION_GREATER_EQUAL "4.1.0") +@@ -191,7 +191,7 @@ if(HIP_FOUND) + # roctx is part of roctracer + find_library(ROCM_ROCTX_LIB roctx64 HINTS ${ROCM_PATH}/lib) + +- if(ROCM_VERSION_DEV VERSION_GREATER_EQUAL "5.7.0") ++ if(hipblastlt_FOUND) + # check whether hipblaslt is using its own datatype + set(file "${PROJECT_BINARY_DIR}/hipblaslt_test_data_type.cc") + file(WRITE ${file} "" +-- +2.43.2 +
commit 2752e0ea1d222eb60a7ef6806613837bb7a1001e Author: Tom Rix trix@redhat.com Date: Fri Feb 23 07:33:39 2024 -0500
Cleanup combo of rocm and caffe2
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 626ca0a..d1dbbd4 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -567,9 +567,14 @@ sed -i -f br.sed devel.files %{python3_sitearch}/torch/lib/libtorch_cuda_linalg.so %endif %if %{with caffe2} -%{python3_sitearch}/torch/lib/libcaffe2_detectron_ops.so %{python3_sitearch}/torch/lib/libcaffe2_observers.so %{python3_sitearch}/caffe2/python/caffe2_pybind11_state.cpython*.so +%if %{without rocm} +%{python3_sitearch}/torch/lib/libcaffe2_detectron_ops.so +%else +%{python3_sitearch}/torch/lib/libcaffe2_detectron_ops_hip.so +%{python3_sitearch}/caffe2/python/caffe2_pybind11_state_hip.cpython*.so +%endif %endif
# misc
commit d4bfc263df0f1a472fa9167fe01e9ce5188d25b8 Author: Tom Rix trix@redhat.com Date: Thu Feb 22 12:04:15 2024 -0500
get caffe2 building
diff --git a/next/0001-reenable-foxi-linking.patch b/next/0001-reenable-foxi-linking.patch new file mode 100644 index 0000000..8e39795 --- /dev/null +++ b/next/0001-reenable-foxi-linking.patch @@ -0,0 +1,25 @@ +From 58ccda271e8f51c3fa5b7518cf6ee52ce204fd37 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Thu, 22 Feb 2024 09:28:11 -0500 +Subject: [PATCH] reenable foxi linking + +--- + cmake/Dependencies.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index 42fbf80f6e8..bc3a2dc6fee 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -1604,7 +1604,7 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX) + list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx) + endif() + # include_directories(${FOXI_INCLUDE_DIRS}) +-# list(APPEND Caffe2_DEPENDENCY_LIBS foxi_loader) ++ list(APPEND Caffe2_DEPENDENCY_LIBS foxi_loader) + # Recover the build shared libs option. + set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS}) + endif() +-- +2.43.2 + diff --git a/python-torch.spec b/python-torch.spec index b5eaef4..626ca0a 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -6,8 +6,8 @@ # So pre releases can be tried %bcond_without gitcommit %if %{with gitcommit} -# The top of tree ~2/18/24 -%global commit0 372d078f361e726bb4ac0884ac334b04c58179ef +# The top of tree ~2/22/24 +%global commit0 5c5b71b6eebae76d744261715231093e62f0d090 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%global pypi_version 2.3.0 @@ -23,9 +23,13 @@ # /usr/lib64/python3.12/site-packages/torch/bin/test_api, test_lazy %bcond_with test
-# For testing rocm -# Not viable on 2.1.2, use --with gitcommit +%ifarch x86_64 +%if 0%{?fedora} +%bcond_without rocm +%else %bcond_with rocm +%endif +%endif
# For testing openmp %bcond_without openmp @@ -37,13 +41,9 @@ %bcond_with distributed
# For testing cuda +%ifarch x86_64 %bcond_with cuda -# Which cuda ? Look at your /usr/local/cuda-<ver>, this is mine -# Which has problems with 2.1.2 .. -%global cuda_ver 12.3 -# Which arch ? Who knows, pick something yourself or go with native -%global cuda_arch native - +%endif
Name: python-%{pypi_name} Version: %{pypi_version} @@ -75,6 +75,10 @@ Patch2: 0001-no-third_party-FXdiv.patch Patch3: 0001-Stub-in-kineto-ActivityType.patch Patch5: 0001-disable-submodule-search.patch
+%if %{with caffe2} +Patch6: 0001-reenable-foxi-linking.patch +%endif + %if %{with rocm} Patch100: 0001-cuda-hip-signatures.patch Patch101: 0001-silence-an-assert.patch @@ -137,11 +141,7 @@ BuildRequires: ninja-build BuildRequires: onnx-devel BuildRequires: openblas-devel BuildRequires: pocketfft-devel -%if %{with caffe2} -BuildRequires: protobuf-lite-devel -%else BuildRequires: protobuf-devel -%endif BuildRequires: pthreadpool-devel BuildRequires: psimd-devel BuildRequires: python3-numpy @@ -430,7 +430,7 @@ export USE_XNNPACK=ON %if %{with caffe2} export BUILD_CAFFE2=ON export INTERN_BUILD_MOBILE=OFF -export USE_LITE_PROTO=ON +export USE_LITE_PROTO=OFF %endif
%if %{with distributed} @@ -500,6 +500,11 @@ rm %{buildroot}%{python3_sitearch}/torch/cuda/error.py rm %{buildroot}%{python3_sitearch}/torch/cuda/__pycache__/error.*.pyc rm %{buildroot}%{python3_sitearch}/torch/include/ATen/cudnn/Exceptions.h
+%if %{with caffe2} +# Remove test data +rm -rf %{buildroot}%{python3_sitearch}/caffe2/python/serialized_test/data/* +%endif + # exec permission for f in `find %{buildroot}%{python3_sitearch} -name '*.py'`; do if [ ! -x $f ]; then @@ -561,6 +566,11 @@ sed -i -f br.sed devel.files %{python3_sitearch}/torch/lib/libtorch_cuda.so %{python3_sitearch}/torch/lib/libtorch_cuda_linalg.so %endif +%if %{with caffe2} +%{python3_sitearch}/torch/lib/libcaffe2_detectron_ops.so +%{python3_sitearch}/torch/lib/libcaffe2_observers.so +%{python3_sitearch}/caffe2/python/caffe2_pybind11_state.cpython*.so +%endif
# misc %{python3_sitearch}/torch/utils/model_dump/{*.js,*.mjs,*.html}
commit aca80a52c146ed5e9efff0c12033c218276f8073 Author: Tom Rix trix@redhat.com Date: Tue Feb 20 11:07:12 2024 -0800
add a --with cuda option
diff --git a/next/pyproject.toml b/next/pyproject.toml new file mode 100644 index 0000000..9508ad0 --- /dev/null +++ b/next/pyproject.toml @@ -0,0 +1,154 @@ +[build-system] +requires = [ + "setuptools", + "wheel", + "astunparse", + "numpy", + "ninja", + "pyyaml", + "cmake", + "typing-extensions", + "requests", +] +# Use legacy backend to import local packages in setup.py +build-backend = "setuptools.build_meta:__legacy__" + + +[tool.black] +# Uncomment if pyproject.toml worked fine to ensure consistency with flake8 +# line-length = 120 +target-version = ["py38", "py39", "py310", "py311"] + + +[tool.ruff] +target-version = "py38" + +# NOTE: Synchoronize the ignores with .flake8 +ignore = [ + # these ignores are from flake8-bugbear; please fix! + "B007", "B008", "B017", + "B018", # Useless expression + "B019", + "B023", + "B028", # No explicit `stacklevel` keyword argument found + "B904", + "E402", + "C408", # C408 ignored because we like the dict keyword argument syntax + "E501", # E501 is not flexible enough, we're using B950 instead + "E721", + "E731", # Assign lambda expression + "E741", + "EXE001", + "F405", + "F841", + # these ignores are from flake8-logging-format; please fix! + "G101", + # these ignores are from ruff NPY; please fix! + "NPY002", + # these ignores are from ruff PERF; please fix! + "PERF203", + "PERF401", + "PERF403", + # these ignores are from PYI; please fix! + "PYI019", + "PYI024", + "PYI036", + "PYI041", + "PYI056", + "SIM102", "SIM103", "SIM112", # flake8-simplify code styles + "SIM105", # these ignores are from flake8-simplify. please fix or ignore with commented reason + "SIM108", + "SIM110", + "SIM114", # Combine `if` branches using logical `or` operator + "SIM115", + "SIM116", # Disable Use a dictionary instead of consecutive `if` statements + "SIM117", + "SIM118", + "UP006", # keep-runtime-typing + "UP007", # keep-runtime-typing +] +line-length = 120 +select = [ + "B", + "C4", + "G", + "E", + "EXE", + "F", + "SIM1", + "W", + # Not included in flake8 + "NPY", + "PERF", + "PGH004", + "PIE794", + "PIE800", + "PIE804", + "PIE807", + "PIE810", + "PLC0131", # type bivariance + "PLC0132", # type param mismatch + "PLC0205", # string as __slots__ + "PLE", + "PLR0133", # constant comparison + "PLR0206", # property with params + "PLR1722", # use sys exit + "PLW0129", # assert on string literal + "PLW0406", # import self + "PLW0711", # binary op exception + "PLW1509", # preexec_fn not safe with threads + "PLW3301", # nested min max + "PT006", # TODO: enable more PT rules + "PT022", + "PT023", + "PT024", + "PT025", + "PT026", + "PYI", + "RUF008", # mutable dataclass default + "RUF015", # access first ele in constant time + "RUF016", # type error non-integer index + "RUF017", + "TRY200", + "TRY302", + "UP", +] + +[tool.ruff.per-file-ignores] +"__init__.py" = [ + "F401", +] +"test/typing/reveal/**" = [ + "F821", +] +"test/torch_np/numpy_tests/**" = [ + "F821", +] +"test/jit/**" = [ + "PLR0133", # tests require this for JIT + "PYI", + "RUF015", + "UP", # We don't want to modify the jit test as they test specify syntax +] +"test/test_jit.py" = [ + "PLR0133", # tests require this for JIT + "PYI", + "RUF015", + "UP", # We don't want to modify the jit test as they test specify syntax +] + +"torch/onnx/**" = [ + "UP037", # ONNX does runtime type checking +] + +"torchgen/api/types/__init__.py" = [ + "F401", + "F403", +] +"torchgen/executorch/api/types/__init__.py" = [ + "F401", + "F403", +] +"torch/utils/collect_env.py" = [ + "UP", # collect_env.py needs to work with older versions of Python +] diff --git a/python-torch.spec b/python-torch.spec index 8758035..b5eaef4 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_with gitcommit +%bcond_without gitcommit %if %{with gitcommit} # The top of tree ~2/18/24 %global commit0 372d078f361e726bb4ac0884ac334b04c58179ef @@ -28,7 +28,7 @@ %bcond_with rocm
# For testing openmp -%bcond_with openmp +%bcond_without openmp
# For testing caffe2 %bcond_with caffe2 @@ -62,6 +62,11 @@ Source0: %{forgeurl}/releases/download/v%{version}/pytorch-v%{version}.ta Source1: https://github.com/google/flatbuffers/archive/refs/tags/v23.3.3.tar.gz Source2: https://github.com/pybind/pybind11/archive/refs/tags/v2.11.1.tar.gz
+%if %{with cuda} +Source10: https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v1.0.3.tar.gz +Source11: https://github.com/NVIDIA/cutlass/archive/refs/tags/v3.3.0.tar.gz +%endif + %if %{with gitcommit}
Patch0: 0001-no-third_party-foxi.patch @@ -144,7 +149,11 @@ BuildRequires: python3-pyyaml BuildRequires: python3-typing-extensions BuildRequires: sleef-devel BuildRequires: valgrind-devel +%if %{with gitcommit} +BuildRequires: xnnpack-devel = 0.0^git20231127.d9cce34 +%else BuildRequires: xnnpack-devel = 0.0^git20221221.51a9875 +%endif
BuildRequires: python3-devel BuildRequires: python3dist(filelock) @@ -264,6 +273,13 @@ cp -r flatbuffers-23.3.3/* third_party/flatbuffers/ tar xf %{SOURCE2} cp -r pybind11-2.11.1/* third_party/pybind11/
+%if %{with cuda} +tar xf %{SOURCE10} +cp -r cudnn-frontend-1.0.3/* third_party/cudnn_frontend/ +tar xf %{SOURCE11} +cp -r cutlass-3.3.0/* third_party/cutlass/ +%endif + %if %{with opencv} # Reduce requirements, *FOUND is not set sed -i -e 's/USE_OPENCV AND OpenCV_FOUND AND USE_FFMPEG AND FFMPEG_FOUND/USE_OPENCV AND USE_FFMPEG/' caffe2/video/CMakeLists.txt @@ -272,6 +288,14 @@ sed -i -e 's/STATUS/FATAL/' caffe2/image/CMakeLists.txt cat caffe2/image/CMakeLists.txt %endif
+%if 0%{?rhel} +# In RHEL but too old +sed -i -e '/typing-extensions/d' setup.py +# Need to pip these +sed -i -e '/sympy/d' setup.py +sed -i -e '/fsspec/d' setup.py +%endif + # Release comes fully loaded with third party src # Remove what we can # @@ -291,8 +315,8 @@ mv third_party/flatbuffers . mv third_party/pybind11 .
%if %{with cuda} -mv third_party/nvfuser . mv third_party/cudnn_frontend . +mv third_party/cutlass . %endif
%if %{with test} @@ -308,8 +332,8 @@ mv flatbuffers third_party mv pybind11 third_party
%if %{with cuda} -mv nvfuser third_party mv cudnn_frontend third_party +mv cutlass third_party %endif
%if %{with test} @@ -336,6 +360,33 @@ sed -i -e 's@string(APPEND CMAKE_CUDA_FLAGS " -D_GLIBCXX_USE_CXX11_ABI=${GLIBCXX
%build
+# +# 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 +# +# Real cores, No hyperthreading +COMPILE_JOBS=`cat /proc/cpuinfo | grep -m 1 'cpu cores' | awk '{ print $4 }'` +if [ ${COMPILE_JOBS}x = x ]; then + COMPILE_JOBS=1 +fi +# Take into account memmory usage per core, do not thrash real memory +%if %{with cuda} +BUILD_MEM=4 +%else +BUILD_MEM=2 +%endif +MEM_KB=0 +MEM_KB=`cat /proc/meminfo | grep MemTotal | awk '{ print $2 }'` +MEM_MB=`eval "expr ${MEM_KB} / 1024"` +MEM_GB=`eval "expr ${MEM_MB} / 1024"` +COMPILE_JOBS_MEM=`eval "expr 1 + ${MEM_GB} / ${BUILD_MEM}"` +if [ "$COMPILE_JOBS_MEM" -lt "$COMPILE_JOBS" ]; then + COMPILE_JOBS=$COMPILE_JOBS_MEM +fi +export MAX_JOBS=$COMPILE_JOBS + # For debugging setup.py # export SETUPTOOLS_SCM_DEBUG=1
@@ -408,6 +459,7 @@ export USE_ROCM=OFF
%if %{with cuda} export CUDACXX=/usr/local/cuda/bin/nvcc +export CPLUS_INCLUDE_PATH=/usr/local/cuda/include export USE_CUDA=ON export USE_NCCL=OFF %else @@ -503,6 +555,12 @@ sed -i -f br.sed devel.files %{python3_sitearch}/torch/lib/libcaffe2_nvrtc.so %{python3_sitearch}/torch/lib/libtorch_hip.so %endif +%if %{with cuda} +%{python3_sitearch}/torch/lib/libc10_cuda.so +%{python3_sitearch}/torch/lib/libcaffe2_nvrtc.so +%{python3_sitearch}/torch/lib/libtorch_cuda.so +%{python3_sitearch}/torch/lib/libtorch_cuda_linalg.so +%endif
# misc %{python3_sitearch}/torch/utils/model_dump/{*.js,*.mjs,*.html} @@ -510,9 +568,11 @@ sed -i -f br.sed devel.files %{python3_sitearch}/torchgen/packaged/autograd/{*.md,*.yaml} %if %{with gitcommit} %{python3_sitearch}/torch/_export/serde/schema.yaml +%if 0%{?fedora} %{python3_sitearch}/torch/distributed/pipeline/sync/_balance/py.typed %{python3_sitearch}/torch/distributed/pipeline/sync/py.typed %endif +%endif
# egg %{python3_sitearch}/torch*.egg-info/*
commit b8381c9f2de47146c2e1ec0c2be66cf7841158d5 Author: Tom Rix trix@redhat.com Date: Mon Feb 19 14:59:29 2024 -0500
use third party pybind11
diff --git a/python-torch.spec b/python-torch.spec index 4939a2c..8758035 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -55,11 +55,12 @@ License: BSD-3-Clause AND BSD-2-Clause AND 0BSD AND Apache-2.0 AND MIT AN URL: https://pytorch.org/ %if %{with gitcommit} Source0: %{forgeurl}/archive/%{commit0}/pytorch-%{shortcommit0}.tar.gz -Source2: pyproject.toml +Source100: pyproject.toml %else Source0: %{forgeurl}/releases/download/v%{version}/pytorch-v%{version}.tar.gz %endif Source1: https://github.com/google/flatbuffers/archive/refs/tags/v23.3.3.tar.gz +Source2: https://github.com/pybind/pybind11/archive/refs/tags/v2.11.1.tar.gz
%if %{with gitcommit}
@@ -243,7 +244,7 @@ Requires: python3-%{pypi_name}%{?_isa} = %{version}-%{release} # Remove bundled egg-info rm -rf %{pypi_name}.egg-info # Overwrite with a git checkout of the pyproject.toml -cp %{SOURCE2} . +cp %{SOURCE100} .
%if %{with rocm} # hipify @@ -260,6 +261,9 @@ sed -i -e 's@rocm-core/rocm_version.h@rocm_version.h@' aten/src/ATen/hip/tunable tar xf %{SOURCE1} cp -r flatbuffers-23.3.3/* third_party/flatbuffers/
+tar xf %{SOURCE2} +cp -r pybind11-2.11.1/* third_party/pybind11/ + %if %{with opencv} # Reduce requirements, *FOUND is not set sed -i -e 's/USE_OPENCV AND OpenCV_FOUND AND USE_FFMPEG AND FFMPEG_FOUND/USE_OPENCV AND USE_FFMPEG/' caffe2/video/CMakeLists.txt @@ -312,10 +316,6 @@ mv cudnn_frontend third_party mv googletest third_party %endif
- - - - # # Fake out pocketfft, and system header will be used mkdir third_party/pocketfft
commit e0659660cdb6bb31b56bb12f71a88fc2ba0b3ca3 Author: Tom Rix trix@redhat.com Date: Mon Feb 19 07:27:26 2024 -0800
Try to get cuda going on rhel
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 3c7fdc2..4939a2c 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -36,6 +36,15 @@ # For testing distributed %bcond_with distributed
+# For testing cuda +%bcond_with cuda +# Which cuda ? Look at your /usr/local/cuda-<ver>, this is mine +# Which has problems with 2.1.2 .. +%global cuda_ver 12.3 +# Which arch ? Who knows, pick something yourself or go with native +%global cuda_arch native + + Name: python-%{pypi_name} Version: %{pypi_version} Release: %autorelease @@ -99,9 +108,11 @@ Patch9: 0001-disable-as-needed-for-libtorch.patch
# Limit to these because they are well behaved with clang ExclusiveArch: x86_64 aarch64 -# RHEL does not do clang well %if 0%{?fedora} %global toolchain clang +%else +# RHEL does not do clang well, nor lto +%global _lto_cflags %nil %endif
BuildRequires: clang-devel @@ -275,6 +286,11 @@ mv third_party/flatbuffers .
mv third_party/pybind11 .
+%if %{with cuda} +mv third_party/nvfuser . +mv third_party/cudnn_frontend . +%endif + %if %{with test} mv third_party/googletest . %endif @@ -287,6 +303,11 @@ mv miniz-2.1.0 third_party mv flatbuffers third_party mv pybind11 third_party
+%if %{with cuda} +mv nvfuser third_party +mv cudnn_frontend third_party +%endif + %if %{with test} mv googletest third_party %endif @@ -308,6 +329,11 @@ rm caffe2/contrib/opencl/OpenCL/cl.hpp rm caffe2/mobile/contrib/libopencl-stub/include/CL/*.h rm caffe2/mobile/contrib/libopencl-stub/include/CL/*.hpp
+%if %{with cuda} +# build complains about not being able to build -pie without -fPIC +sed -i -e 's@string(APPEND CMAKE_CUDA_FLAGS " -D_GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI}")@string(APPEND CMAKE_CUDA_FLAGS " -fPIC -D_GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI}")@' CMakeLists.txt +%endif + %build
# For debugging setup.py @@ -326,7 +352,6 @@ export BUILD_SHARED_LIBS=ON export CMAKE_BUILD_TYPE=RelWithDebInfo export CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON export CAFFE2_LINK_LOCAL_PROTOBUF=OFF -export USE_CUDA=OFF export USE_FBGEMM=OFF export USE_GOLD_LINKER=OFF export USE_ITT=OFF @@ -381,6 +406,14 @@ export DEVICE_LIB_PATH=/usr/lib/clang/17/amdgcn/bitcode export USE_ROCM=OFF %endif
+%if %{with cuda} +export CUDACXX=/usr/local/cuda/bin/nvcc +export USE_CUDA=ON +export USE_NCCL=OFF +%else +export USE_CUDA=OFF +%endif + %if %{with test} export BUILD_TEST=ON %else
commit 22dc36f37e6bdcbefebbca187413ae89f2393702 Author: Tom Rix trix@redhat.com Date: Sun Feb 18 13:02:05 2024 -0800
Start building for RHEL
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 2ca5f0f..3c7fdc2 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -46,11 +46,11 @@ License: BSD-3-Clause AND BSD-2-Clause AND 0BSD AND Apache-2.0 AND MIT AN URL: https://pytorch.org/ %if %{with gitcommit} Source0: %{forgeurl}/archive/%{commit0}/pytorch-%{shortcommit0}.tar.gz -Source1: pyproject.toml -Source2: https://github.com/google/flatbuffers/archive/refs/tags/v23.3.3.tar.gz +Source2: pyproject.toml %else Source0: %{forgeurl}/releases/download/v%{version}/pytorch-v%{version}.tar.gz %endif +Source1: https://github.com/google/flatbuffers/archive/refs/tags/v23.3.3.tar.gz
%if %{with gitcommit}
@@ -74,8 +74,6 @@ Patch103: 0001-use-any-hip.patch # * Remove warnings/errors for clang 17 # * fxdiv is not a library on Fedora Patch0: 0001-Prepare-pytorch-cmake-for-fedora.patch -# Use Fedora's fmt -Patch1: 0002-Regenerate-flatbuffer-header.patch # https://github.com/pytorch/pytorch/pull/111048 Patch2: 0003-Stub-in-kineto-ActivityType.patch # PyTorch has not fully baked 3.12 support because 3.12 is so new @@ -101,16 +99,16 @@ Patch9: 0001-disable-as-needed-for-libtorch.patch
# Limit to these because they are well behaved with clang ExclusiveArch: x86_64 aarch64 +# RHEL does not do clang well +%if 0%{?fedora} %global toolchain clang +%endif
BuildRequires: clang-devel BuildRequires: cmake BuildRequires: cpuinfo-devel BuildRequires: eigen3-devel BuildRequires: fmt-devel -%if %{without gitcommit} -BuildRequires: flatbuffers-devel -%endif BuildRequires: FP16-devel BuildRequires: fxdiv-devel BuildRequires: gcc-c++ @@ -130,7 +128,6 @@ BuildRequires: protobuf-devel BuildRequires: pthreadpool-devel BuildRequires: psimd-devel BuildRequires: python3-numpy -BuildRequires: python3-pybind11 BuildRequires: python3-pyyaml BuildRequires: python3-typing-extensions BuildRequires: sleef-devel @@ -139,14 +136,18 @@ BuildRequires: xnnpack-devel = 0.0^git20221221.51a9875
BuildRequires: python3-devel BuildRequires: python3dist(filelock) -BuildRequires: python3dist(fsspec) BuildRequires: python3dist(jinja2) BuildRequires: python3dist(networkx) BuildRequires: python3dist(setuptools) -BuildRequires: python3dist(sympy) BuildRequires: python3dist(typing-extensions) BuildRequires: python3dist(sphinx)
+%if 0%{?fedora} +BuildRequires: python3-pybind11 +BuildRequires: python3dist(fsspec) +BuildRequires: python3dist(sympy) +%endif + %if %{with rocm} BuildRequires: hipblas-devel BuildRequires: hipblaslt-devel @@ -181,7 +182,9 @@ BuildRequires: google-benchmark-devel
# Apache-2.0 Provides: bundled(flatbuffers) = 22.3.3 +# MIT Provides: bundled(miniz) = 2.1.0 +Provides: bundled(pybind11) = 2.11.1
%description @@ -229,10 +232,7 @@ Requires: python3-%{pypi_name}%{?_isa} = %{version}-%{release} # Remove bundled egg-info rm -rf %{pypi_name}.egg-info # Overwrite with a git checkout of the pyproject.toml -cp %{SOURCE1} . - -tar xf %{SOURCE2} -cp -r flatbuffers-23.3.3/* third_party/flatbuffers/ +cp %{SOURCE2} .
%if %{with rocm} # hipify @@ -246,6 +246,8 @@ sed -i -e 's@rocm-core/rocm_version.h@rocm_version.h@' aten/src/ATen/hip/tunable
%endif
+tar xf %{SOURCE1} +cp -r flatbuffers-23.3.3/* third_party/flatbuffers/
%if %{with opencv} # Reduce requirements, *FOUND is not set @@ -268,25 +270,29 @@ mv third_party/miniz-2.1.0 . # setup.py depends on this script mv third_party/build_bundled.py .
+# Need the just untarred flatbuffers/flatbuffers.h +mv third_party/flatbuffers . + +mv third_party/pybind11 . + %if %{with test} mv third_party/googletest . %endif
-%if %{with gitcommit} -mv third_party/flatbuffers . -%endif - # Remove everything rm -rf third_party/* # Put stuff back mv build_bundled.py third_party mv miniz-2.1.0 third_party +mv flatbuffers third_party +mv pybind11 third_party + %if %{with test} mv googletest third_party %endif -%if %{with gitcommit} -mv flatbuffers third_party -%endif + + +
# @@ -329,10 +335,19 @@ export USE_LITE_INTERPRETER_PROFILER=OFF export USE_MKLDNN=OFF export USE_NNPACK=OFF export USE_NUMPY=ON - export USE_PYTORCH_QNNPACK=OFF export USE_QNNPACK=OFF -export USE_SYSTEM_LIBS=ON +export USE_SYSTEM_CPUINFO=ON +export USE_SYSTEM_SLEEF=ON +export USE_SYSTEM_EIGEN_INSTALL=ON +export USE_SYSTEM_FP16=ON +export USE_SYSTEM_PTHREADPOOL=ON +export USE_SYSTEM_PSIMD=ON +export USE_SYSTEM_FXDIV=ON +export USE_SYSTEM_ONNX=ON +export USE_SYSTEM_XNNPACK=ON +export USE_SYSTEM_PYBIND11=OFF +export USE_SYSTEM_LIBS=OFF export USE_TENSORPIPE=OFF export USE_XNNPACK=ON
commit 177874e18b4ddbd6b728ec6172a7afb71dfbd38f Author: Tom Rix trix@redhat.com Date: Sun Feb 18 11:41:24 2024 -0500
Update the next patchset
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/next/0001-no-third_party-fmt.patch b/next/0001-no-third_party-fmt.patch index f2a82f8..6e82af2 100644 --- a/next/0001-no-third_party-fmt.patch +++ b/next/0001-no-third_party-fmt.patch @@ -1,4 +1,4 @@ -From c46146dc31ed3dc0ebb6ca28c01330db8ba5d4f2 Mon Sep 17 00:00:00 2001 +From 2ce255b75760a0a513fb1706629b416f76a5c822 Mon Sep 17 00:00:00 2001 From: Tom Rix trix@redhat.com Date: Sat, 3 Feb 2024 08:16:04 -0500 Subject: [PATCH] no third_party fmt @@ -10,23 +10,23 @@ Subject: [PATCH] no third_party fmt 3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/c10/CMakeLists.txt b/c10/CMakeLists.txt -index cb81556ff2..7529b2aec9 100644 +index 1f742f4c176..4fa08913bdd 100644 --- a/c10/CMakeLists.txt +++ b/c10/CMakeLists.txt @@ -87,7 +87,7 @@ endif() if(C10_USE_GLOG) - target_link_libraries(c10 PUBLIC glog::glog) + target_link_libraries(c10 PUBLIC glog::glog) endif() -target_link_libraries(c10 PRIVATE fmt::fmt-header-only) +target_link_libraries(c10 PRIVATE fmt)
if(C10_USE_NUMA) - target_include_directories(c10 PRIVATE ${Numa_INCLUDE_DIR}) + message(STATUS "NUMA paths:") diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake -index 8310f29e01..c99d0d762a 100644 +index 6f5a2d5feff..42fbf80f6e8 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake -@@ -1834,7 +1834,7 @@ endif() +@@ -1837,7 +1837,7 @@ endif() # set(TEMP_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE) @@ -35,7 +35,7 @@ index 8310f29e01..c99d0d762a 100644
# Disable compiler feature checks for `fmt`. # -@@ -1843,9 +1843,9 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt) +@@ -1846,9 +1846,9 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt) # 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. @@ -48,7 +48,7 @@ index 8310f29e01..c99d0d762a 100644
# ---[ Kineto diff --git a/torch/CMakeLists.txt b/torch/CMakeLists.txt -index 24903a207e..3a7751dc00 100644 +index 97a72eed55b..9e5014d1980 100644 --- a/torch/CMakeLists.txt +++ b/torch/CMakeLists.txt @@ -80,7 +80,7 @@ set(TORCH_PYTHON_LINK_LIBRARIES @@ -61,5 +61,5 @@ index 24903a207e..3a7751dc00 100644
if(USE_ASAN AND TARGET Sanitizer::address) -- -2.43.0 +2.43.2
commit 63a004872ddf0b3da36480d2e6a3d41d75cc7136 Author: Tom Rix trix@redhat.com Date: Sun Feb 18 11:27:33 2024 -0500
Update gitcommit to 2/18/24
Fix a rocm_version.h error Try bundling flatbuffers
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 5f4e2e0..2ca5f0f 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -6,8 +6,8 @@ # So pre releases can be tried %bcond_with gitcommit %if %{with gitcommit} -# The top of tree ~2/6/24 -%global commit0 064610d8ac53f3f5916a1dc8b43acbeeb2469c11 +# The top of tree ~2/18/24 +%global commit0 372d078f361e726bb4ac0884ac334b04c58179ef %global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%global pypi_version 2.3.0 @@ -47,6 +47,7 @@ URL: https://pytorch.org/ %if %{with gitcommit} Source0: %{forgeurl}/archive/%{commit0}/pytorch-%{shortcommit0}.tar.gz Source1: pyproject.toml +Source2: https://github.com/google/flatbuffers/archive/refs/tags/v23.3.3.tar.gz %else Source0: %{forgeurl}/releases/download/v%{version}/pytorch-v%{version}.tar.gz %endif @@ -57,7 +58,6 @@ Patch0: 0001-no-third_party-foxi.patch Patch1: 0001-no-third_party-fmt.patch Patch2: 0001-no-third_party-FXdiv.patch Patch3: 0001-Stub-in-kineto-ActivityType.patch -Patch4: 0001-Regenerate-flatbuffer-header.patch Patch5: 0001-disable-submodule-search.patch
%if %{with rocm} @@ -108,7 +108,9 @@ BuildRequires: cmake BuildRequires: cpuinfo-devel BuildRequires: eigen3-devel BuildRequires: fmt-devel +%if %{without gitcommit} BuildRequires: flatbuffers-devel +%endif BuildRequires: FP16-devel BuildRequires: fxdiv-devel BuildRequires: gcc-c++ @@ -177,8 +179,11 @@ BuildRequires: foxi-devel BuildRequires: google-benchmark-devel %endif
+# Apache-2.0 +Provides: bundled(flatbuffers) = 22.3.3 Provides: bundled(miniz) = 2.1.0
+ %description PyTorch is a Python package that provides two high-level features:
@@ -226,14 +231,22 @@ rm -rf %{pypi_name}.egg-info # Overwrite with a git checkout of the pyproject.toml cp %{SOURCE1} .
+tar xf %{SOURCE2} +cp -r flatbuffers-23.3.3/* third_party/flatbuffers/ + %if %{with rocm} # hipify ./tools/amd_build/build_amd.py +# Fedora installs to /usr/include, not /usr/include/rocm-core +sed -i -e 's@rocm-core/rocm_version.h@rocm_version.h@' aten/src/ATen/hip/tunable/TunableGemm.h %endif
%else %autosetup -p1 -n pytorch-v%{version}
+%endif + + %if %{with opencv} # Reduce requirements, *FOUND is not set sed -i -e 's/USE_OPENCV AND OpenCV_FOUND AND USE_FFMPEG AND FFMPEG_FOUND/USE_OPENCV AND USE_FFMPEG/' caffe2/video/CMakeLists.txt @@ -259,6 +272,10 @@ mv third_party/build_bundled.py . mv third_party/googletest . %endif
+%if %{with gitcommit} +mv third_party/flatbuffers . +%endif + # Remove everything rm -rf third_party/* # Put stuff back @@ -267,6 +284,11 @@ mv miniz-2.1.0 third_party %if %{with test} mv googletest third_party %endif +%if %{with gitcommit} +mv flatbuffers third_party +%endif + + # # Fake out pocketfft, and system header will be used mkdir third_party/pocketfft @@ -280,8 +302,6 @@ rm caffe2/contrib/opencl/OpenCL/cl.hpp rm caffe2/mobile/contrib/libopencl-stub/include/CL/*.h rm caffe2/mobile/contrib/libopencl-stub/include/CL/*.hpp
-%endif - %build
# For debugging setup.py
commit 23da14880071cfe45b97fc123948bb081a9001cf Author: Tom Rix trix@redhat.com Date: Sun Feb 11 08:56:16 2024 -0500
Update gitcommit to recent ToT
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index 92e2d6c..5f4e2e0 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -6,8 +6,8 @@ # So pre releases can be tried %bcond_with gitcommit %if %{with gitcommit} -# The top of tree ~2/1/24 -%global commit0 a43c28368c184ba1bf964f4fb99bec300917e2f4 +# The top of tree ~2/6/24 +%global commit0 064610d8ac53f3f5916a1dc8b43acbeeb2469c11 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%global pypi_version 2.3.0 @@ -442,6 +442,8 @@ sed -i -f br.sed devel.files %{python3_sitearch}/torchgen/packaged/autograd/{*.md,*.yaml} %if %{with gitcommit} %{python3_sitearch}/torch/_export/serde/schema.yaml +%{python3_sitearch}/torch/distributed/pipeline/sync/_balance/py.typed +%{python3_sitearch}/torch/distributed/pipeline/sync/py.typed %endif
# egg
commit 37b51a85cc8e6855a274ed92842059d2412c0c3e Author: Tom Rix trix@redhat.com Date: Thu Feb 8 09:51:39 2024 -0500
Add --with distributed
Start testing the distributed options
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index b164f97..92e2d6c 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -33,6 +33,9 @@ # For testing caffe2 %bcond_with caffe2
+# For testing distributed +%bcond_with distributed + Name: python-%{pypi_name} Version: %{pypi_version} Release: %autorelease @@ -110,7 +113,9 @@ BuildRequires: FP16-devel BuildRequires: fxdiv-devel BuildRequires: gcc-c++ BuildRequires: gcc-gfortran +%if %{with distributed} BuildRequires: gloo-devel +%endif BuildRequires: ninja-build BuildRequires: onnx-devel BuildRequires: openblas-devel @@ -149,6 +154,9 @@ BuildRequires: hipsparse-devel BuildRequires: hipsolver-devel BuildRequires: miopen-devel BuildRequires: rocblas-devel +%if %{with distributed} +BuildRequires: rccl-devel +%endif BuildRequires: rocprim-devel BuildRequires: rocm-cmake BuildRequires: rocm-comgr-devel @@ -287,23 +295,12 @@ rm caffe2/mobile/contrib/libopencl-stub/include/CL/*.hpp # Manually set this hardening flag export CMAKE_EXE_LINKER_FLAGS=-pie
-%if %{with caffe2} -export BUILD_CAFFE2=ON -export INTERN_BUILD_MOBILE=OFF -export USE_LITE_PROTO=ON -%endif export BUILD_CUSTOM_PROTOBUF=OFF export BUILD_SHARED_LIBS=ON -%if %{with test} -export BUILD_TEST=ON -%else -export BUILD_TEST=OFF -%endif export CMAKE_BUILD_TYPE=RelWithDebInfo export CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON export CAFFE2_LINK_LOCAL_PROTOBUF=OFF export USE_CUDA=OFF -export USE_DISTRIBUTED=OFF export USE_FBGEMM=OFF export USE_GOLD_LINKER=OFF export USE_ITT=OFF @@ -312,14 +309,32 @@ export USE_LITE_INTERPRETER_PROFILER=OFF export USE_MKLDNN=OFF export USE_NNPACK=OFF export USE_NUMPY=ON + +export USE_PYTORCH_QNNPACK=OFF +export USE_QNNPACK=OFF +export USE_SYSTEM_LIBS=ON +export USE_TENSORPIPE=OFF +export USE_XNNPACK=ON + +%if %{with caffe2} +export BUILD_CAFFE2=ON +export INTERN_BUILD_MOBILE=OFF +export USE_LITE_PROTO=ON +%endif + +%if %{with distributed} +export USE_DISTRIBUTED=ON +%else +export USE_DISTRIBUTED=OFF +%endif + + %if %{with openmp} export USE_OPENMP=ON %else export USE_OPENMP=OFF %endif
-export USE_PYTORCH_QNNPACK=OFF -export USE_QNNPACK=OFF %if %{with rocm} export USE_ROCM=ON export USE_NCCL=OFF @@ -330,9 +345,12 @@ export DEVICE_LIB_PATH=/usr/lib/clang/17/amdgcn/bitcode %else export USE_ROCM=OFF %endif -export USE_SYSTEM_LIBS=ON -export USE_TENSORPIPE=OFF -export USE_XNNPACK=ON + +%if %{with test} +export BUILD_TEST=ON +%else +export BUILD_TEST=OFF +%endif
# Why we are using py3_ vs pyproject_ #
commit 1bcf75f50a235043bf3924333af1e92b1b339875 Author: Tom Rix trix@redhat.com Date: Sun Feb 4 07:39:22 2024 -0500
A working --with gitcommit --with rocm
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/next/0001-use-any-hip.patch b/next/0001-use-any-hip.patch new file mode 100644 index 0000000..dca86ea --- /dev/null +++ b/next/0001-use-any-hip.patch @@ -0,0 +1,34 @@ +From 4248211ce9a9de81bb3ade5d421ba709b19ead08 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Sat, 3 Feb 2024 15:01:28 -0500 +Subject: [PATCH] use any hip + +--- + cmake/public/LoadHIP.cmake | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cmake/public/LoadHIP.cmake b/cmake/public/LoadHIP.cmake +index 1abeb06228..28458c4146 100644 +--- a/cmake/public/LoadHIP.cmake ++++ b/cmake/public/LoadHIP.cmake +@@ -30,7 +30,7 @@ endif() + message("Building PyTorch for GPU arch: ${PYTORCH_ROCM_ARCH}") + + # Add HIP to the CMAKE Module Path +-set(CMAKE_MODULE_PATH ${ROCM_PATH}/lib/cmake/hip ${CMAKE_MODULE_PATH}) ++set(CMAKE_MODULE_PATH ${ROCM_PATH}/lib64/cmake/hip ${CMAKE_MODULE_PATH}) + + macro(find_package_and_print_version PACKAGE_NAME) + find_package("${PACKAGE_NAME}" ${ARGN}) +@@ -38,7 +38,7 @@ macro(find_package_and_print_version PACKAGE_NAME) + endmacro() + + # Find the HIP Package +-find_package_and_print_version(HIP 1.0) ++find_package_and_print_version(HIP MODULE) + + if(HIP_FOUND) + set(PYTORCH_FOUND_HIP TRUE) +-- +2.43.0 + diff --git a/python-torch.spec b/python-torch.spec index a99d278..b164f97 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -61,6 +61,7 @@ Patch5: 0001-disable-submodule-search.patch Patch100: 0001-cuda-hip-signatures.patch Patch101: 0001-silence-an-assert.patch Patch102: 0001-can-not-use-with-c-files.patch +Patch103: 0001-use-any-hip.patch %endif
%else @@ -325,6 +326,7 @@ export USE_NCCL=OFF export BUILD_NVFUSER=OFF export HIP_PATH=%{_prefix} export ROCM_PATH=%{_prefix} +export DEVICE_LIB_PATH=/usr/lib/clang/17/amdgcn/bitcode %else export USE_ROCM=OFF %endif @@ -343,6 +345,13 @@ export USE_XNNPACK=ON %py3_build
%install +%if %{with rocm} +export USE_ROCM=ON +export HIP_PATH=%{_prefix} +export ROCM_PATH=%{_prefix} +export DEVICE_LIB_PATH=/usr/lib/clang/17/amdgcn/bitcode +%endif + %py3_install
# empty files @@ -403,6 +412,11 @@ sed -i -f br.sed devel.files %{python3_sitearch}/torch/lib/libtorch_cpu.so %{python3_sitearch}/torch/lib/libtorch_global_deps.so %{python3_sitearch}/torch/lib/libtorch_python.so +%if %{with rocm} +%{python3_sitearch}/torch/lib/libc10_hip.so +%{python3_sitearch}/torch/lib/libcaffe2_nvrtc.so +%{python3_sitearch}/torch/lib/libtorch_hip.so +%endif
# misc %{python3_sitearch}/torch/utils/model_dump/{*.js,*.mjs,*.html}
commit 66733ffbd29de89807f3222b181ac4c9d9d990eb Author: Tom Rix trix@redhat.com Date: Sat Feb 3 11:31:23 2024 -0500
Prepare for the next release
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/next/0001-Regenerate-flatbuffer-header.patch b/next/0001-Regenerate-flatbuffer-header.patch new file mode 100644 index 0000000..4eec491 --- /dev/null +++ b/next/0001-Regenerate-flatbuffer-header.patch @@ -0,0 +1,39 @@ +From 5b8e51b24513fa851eeff42f23d942bde301e321 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Fri, 29 Sep 2023 06:19:29 -0700 +Subject: [PATCH] Regenerate flatbuffer header + +For this error +torch/csrc/jit/serialization/mobile_bytecode_generated.h:12:41: +error: static assertion failed: Non-compatible flatbuffers version included + 12 | FLATBUFFERS_VERSION_MINOR == 3 && + +PyTorch is expecting 23.3.3, what f38 has +Rawhide is at 23.5.26 + +Regenerate with +flatc --cpp --gen-mutable --no-prefix --scoped-enums mobile_bytecode.fbs + +Signed-off-by: Tom Rix trix@redhat.com +--- + torch/csrc/jit/serialization/mobile_bytecode_generated.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/torch/csrc/jit/serialization/mobile_bytecode_generated.h b/torch/csrc/jit/serialization/mobile_bytecode_generated.h +index cffe8bc7a6..83575e4c19 100644 +--- a/torch/csrc/jit/serialization/mobile_bytecode_generated.h ++++ b/torch/csrc/jit/serialization/mobile_bytecode_generated.h +@@ -9,8 +9,8 @@ + // Ensure the included flatbuffers.h is the same version as when this file was + // generated, otherwise it may not be compatible. + static_assert(FLATBUFFERS_VERSION_MAJOR == 23 && +- FLATBUFFERS_VERSION_MINOR == 3 && +- FLATBUFFERS_VERSION_REVISION == 3, ++ FLATBUFFERS_VERSION_MINOR == 5 && ++ FLATBUFFERS_VERSION_REVISION == 26, + "Non-compatible flatbuffers version included"); + + namespace torch { +-- +2.43.0 + diff --git a/next/0001-Stub-in-kineto-ActivityType.patch b/next/0001-Stub-in-kineto-ActivityType.patch new file mode 100644 index 0000000..f088645 --- /dev/null +++ b/next/0001-Stub-in-kineto-ActivityType.patch @@ -0,0 +1,73 @@ +From 3ef82b814179da571b2478f61d4279717ab0b23a Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Fri, 29 Sep 2023 06:25:23 -0700 +Subject: [PATCH] Stub in kineto ActivityType + +There is an error with kineto is not used, the shim still +requires the ActivityTYpe.h header to get the enum Activity type. +So cut-n-paste just enough of the header in to do this. + +Signed-off-by: Tom Rix trix@redhat.com +--- + torch/csrc/profiler/kineto_shim.h | 44 +++++++++++++++++++++++++++++++ + 1 file changed, 44 insertions(+) + +diff --git a/torch/csrc/profiler/kineto_shim.h b/torch/csrc/profiler/kineto_shim.h +index e92cbf003d..68985ab7d0 100644 +--- a/torch/csrc/profiler/kineto_shim.h ++++ b/torch/csrc/profiler/kineto_shim.h +@@ -12,7 +12,51 @@ + #undef USE_KINETO + #endif + ++#ifdef USE_KINETO + #include <ActivityType.h> ++#else ++namespace libkineto { ++// copied from header ++/* ++ * Copyright (c) Meta Platforms, Inc. and affiliates. ++ * All rights reserved. ++ * ++ * This source code is licensed under the BSD-style license found in the ++ * LICENSE file in the root directory of this source tree. ++ */ ++ ++// Note : All activity types are not enabled by default. Please add them ++// at correct position in the enum ++enum class ActivityType { ++ // Activity types enabled by default ++ CPU_OP = 0, // cpu side ops ++ USER_ANNOTATION, ++ GPU_USER_ANNOTATION, ++ GPU_MEMCPY, ++ GPU_MEMSET, ++ CONCURRENT_KERNEL, // on-device kernels ++ EXTERNAL_CORRELATION, ++ CUDA_RUNTIME, // host side cuda runtime events ++ CUDA_DRIVER, // host side cuda driver events ++ CPU_INSTANT_EVENT, // host side point-like events ++ PYTHON_FUNCTION, ++ OVERHEAD, // CUPTI induced overhead events sampled from its overhead API. ++ ++ // Optional Activity types ++ CUDA_SYNC, // synchronization events between runtime and kernels ++ GLOW_RUNTIME, // host side glow runtime events ++ MTIA_RUNTIME, // host side MTIA runtime events ++ CUDA_PROFILER_RANGE, // CUPTI Profiler range for performance metrics ++ MTIA_CCP_EVENTS, // MTIA ondevice CCP events ++ HPU_OP, // HPU host side runtime event ++ XPU_RUNTIME, // host side xpu runtime events ++ ++ ENUM_COUNT, // This is to add buffer and not used for any profiling logic. Add your new type before it. ++ OPTIONAL_ACTIVITY_TYPE_START = CUDA_SYNC, ++}; ++} ++ ++#endif + + #include <torch/csrc/Export.h> + #include <torch/csrc/profiler/api.h> +-- +2.43.0 + diff --git a/next/0001-can-not-use-with-c-files.patch b/next/0001-can-not-use-with-c-files.patch new file mode 100644 index 0000000..719737c --- /dev/null +++ b/next/0001-can-not-use-with-c-files.patch @@ -0,0 +1,25 @@ +From a5dff521691a17701b5a02ec75e84cfe1bf605f7 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Sat, 3 Feb 2024 06:41:49 -0500 +Subject: [PATCH] can not use with c files + +--- + cmake/Dependencies.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index 4dd8042058..5f91f3ffab 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -1269,7 +1269,7 @@ if(USE_ROCM) + list(APPEND HIP_CXX_FLAGS -Wno-duplicate-decl-specifier) + list(APPEND HIP_CXX_FLAGS -DCAFFE2_USE_MIOPEN) + list(APPEND HIP_CXX_FLAGS -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_HIP) +- list(APPEND HIP_CXX_FLAGS -std=c++17) ++# list(APPEND HIP_CXX_FLAGS -std=c++17) + if(ROCM_VERSION_DEV VERSION_GREATER_EQUAL "6.0.0") + list(APPEND HIP_CXX_FLAGS -DHIPBLAS_V2) + endif() +-- +2.43.0 + diff --git a/next/0001-cuda-hip-signatures.patch b/next/0001-cuda-hip-signatures.patch new file mode 100644 index 0000000..a258737 --- /dev/null +++ b/next/0001-cuda-hip-signatures.patch @@ -0,0 +1,42 @@ +From 214dc959acc809e1959643272c344ee5335d5a69 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Thu, 1 Feb 2024 11:29:47 -0500 +Subject: [PATCH] cuda - hip signatures + +--- + aten/src/ATen/cuda/detail/LazyNVRTC.cpp | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/aten/src/ATen/cuda/detail/LazyNVRTC.cpp b/aten/src/ATen/cuda/detail/LazyNVRTC.cpp +index 1b85e7776e..bb6f88783a 100644 +--- a/aten/src/ATen/cuda/detail/LazyNVRTC.cpp ++++ b/aten/src/ATen/cuda/detail/LazyNVRTC.cpp +@@ -134,8 +134,13 @@ nvrtcResult nvrtcCreateProgram(nvrtcProgram *prog, + const char *src, + const char *name, + int numHeaders, ++#if !defined(USE_ROCM) + const char * const *headers, + const char * const *includeNames) { ++#else ++ const char **headers, ++ const char **includeNames) { ++#endif + auto fn = reinterpret_cast<decltype(&nvrtcCreateProgram)>(getNVRTCLibrary().sym(__func__)); + if (!fn) + throw std::runtime_error("Can't get nvrtcCreateProgram"); +@@ -150,7 +155,11 @@ NVRTC_STUB2(nvrtcGetPTX, nvrtcProgram, char *); + NVRTC_STUB2(nvrtcGetCUBINSize, nvrtcProgram, size_t *); + NVRTC_STUB2(nvrtcGetCUBIN, nvrtcProgram, char *); + #endif ++#if !defined(USE_ROCM) + NVRTC_STUB3(nvrtcCompileProgram, nvrtcProgram, int, const char * const *); ++#else ++NVRTC_STUB3(nvrtcCompileProgram, nvrtcProgram, int, const char **); ++#endif + _STUB_1(NVRTC, nvrtcGetErrorString, const char *, nvrtcResult); + NVRTC_STUB2(nvrtcGetProgramLogSize,nvrtcProgram, size_t*); + NVRTC_STUB2(nvrtcGetProgramLog, nvrtcProgram, char *); +-- +2.43.0 + diff --git a/next/0001-disable-submodule-search.patch b/next/0001-disable-submodule-search.patch new file mode 100644 index 0000000..b830fa6 --- /dev/null +++ b/next/0001-disable-submodule-search.patch @@ -0,0 +1,25 @@ +From e0b0ea90ecc0dbefc6aef2650e88ba88260935b9 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Fri, 29 Sep 2023 17:21:13 -0700 +Subject: [PATCH] disable submodule search + +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 0fd886d945..e397df8fb6 100644 +--- a/setup.py ++++ b/setup.py +@@ -458,7 +458,7 @@ def mirror_files_into_torchgen(): + def build_deps(): + report("-- Building version " + version) + +- check_submodules() ++ # check_submodules() + check_pydep("yaml", "pyyaml") + + build_caffe2( +-- +2.43.0 + diff --git a/next/0001-no-third_party-FXdiv.patch b/next/0001-no-third_party-FXdiv.patch new file mode 100644 index 0000000..71404e3 --- /dev/null +++ b/next/0001-no-third_party-FXdiv.patch @@ -0,0 +1,54 @@ +From b3b307add5724ee5730f161e16594fa702f34a19 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Sat, 3 Feb 2024 08:20:28 -0500 +Subject: [PATCH] no third_party FXdiv + +--- + caffe2/CMakeLists.txt | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt +index b2f3adbfae..80a5625c8d 100644 +--- a/caffe2/CMakeLists.txt ++++ b/caffe2/CMakeLists.txt +@@ -110,15 +110,15 @@ endif() + # Note: the folders that are being commented out have not been properly + # addressed yet. + +-if(NOT MSVC AND USE_XNNPACK) +- if(NOT TARGET fxdiv) +- set(FXDIV_BUILD_TESTS OFF CACHE BOOL "") +- set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "") +- add_subdirectory( +- "${FXDIV_SOURCE_DIR}" +- "${CMAKE_BINARY_DIR}/FXdiv") +- endif() +-endif() ++#if(NOT MSVC AND USE_XNNPACK) ++# if(NOT TARGET fxdiv) ++# set(FXDIV_BUILD_TESTS OFF CACHE BOOL "") ++# set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "") ++# add_subdirectory( ++# "${FXDIV_SOURCE_DIR}" ++# "${CMAKE_BINARY_DIR}/FXdiv") ++# endif() ++#endif() + + add_subdirectory(core) + add_subdirectory(serialize) +@@ -1081,9 +1081,9 @@ if(USE_XPU) + target_compile_definitions(torch_xpu PRIVATE USE_XPU) + endif() + +-if(NOT MSVC AND USE_XNNPACK) +- TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv) +-endif() ++#if(NOT MSVC AND USE_XNNPACK) ++# TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv) ++#endif() + + # ========================================================== + # formerly-libtorch flags +-- +2.43.0 + diff --git a/next/0001-no-third_party-fmt.patch b/next/0001-no-third_party-fmt.patch new file mode 100644 index 0000000..f2a82f8 --- /dev/null +++ b/next/0001-no-third_party-fmt.patch @@ -0,0 +1,65 @@ +From c46146dc31ed3dc0ebb6ca28c01330db8ba5d4f2 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Sat, 3 Feb 2024 08:16:04 -0500 +Subject: [PATCH] no third_party fmt + +--- + c10/CMakeLists.txt | 2 +- + cmake/Dependencies.cmake | 6 +++--- + torch/CMakeLists.txt | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/c10/CMakeLists.txt b/c10/CMakeLists.txt +index cb81556ff2..7529b2aec9 100644 +--- a/c10/CMakeLists.txt ++++ b/c10/CMakeLists.txt +@@ -87,7 +87,7 @@ endif() + if(C10_USE_GLOG) + target_link_libraries(c10 PUBLIC glog::glog) + endif() +-target_link_libraries(c10 PRIVATE fmt::fmt-header-only) ++target_link_libraries(c10 PRIVATE fmt) + + if(C10_USE_NUMA) + target_include_directories(c10 PRIVATE ${Numa_INCLUDE_DIR}) +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index 8310f29e01..c99d0d762a 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -1834,7 +1834,7 @@ endif() + # + 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) ++# add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt) + + # Disable compiler feature checks for `fmt`. + # +@@ -1843,9 +1843,9 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt) + # 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 "") ++# set_target_properties(fmt-header-only PROPERTIES INTERFACE_COMPILE_FEATURES "") + +-list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only) ++# list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only) + set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE) + + # ---[ Kineto +diff --git a/torch/CMakeLists.txt b/torch/CMakeLists.txt +index 24903a207e..3a7751dc00 100644 +--- a/torch/CMakeLists.txt ++++ b/torch/CMakeLists.txt +@@ -80,7 +80,7 @@ set(TORCH_PYTHON_LINK_LIBRARIES + python::python + pybind::pybind11 + shm +- fmt::fmt-header-only ++ fmt + ATEN_CPU_FILES_GEN_LIB) + + if(USE_ASAN AND TARGET Sanitizer::address) +-- +2.43.0 + diff --git a/next/0001-no-third_party-foxi.patch b/next/0001-no-third_party-foxi.patch new file mode 100644 index 0000000..ba1ec40 --- /dev/null +++ b/next/0001-no-third_party-foxi.patch @@ -0,0 +1,36 @@ +From 8cb61cf9282102ac225645fcc9fb4a1bb7cb15a2 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Sat, 3 Feb 2024 08:11:55 -0500 +Subject: [PATCH] no third_party foxi + +--- + cmake/Dependencies.cmake | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index 5f91f3ffab..8e1461af81 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -1567,7 +1567,7 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX) + set_target_properties(onnx_proto PROPERTIES CXX_STANDARD 17) + endif() + endif() +- add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/foxi EXCLUDE_FROM_ALL) ++ # add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/foxi EXCLUDE_FROM_ALL) + + add_definitions(-DONNX_NAMESPACE=${ONNX_NAMESPACE}) + if(NOT USE_SYSTEM_ONNX) +@@ -1600,8 +1600,8 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX) + message("-- Found onnx: ${ONNX_LIBRARY} ${ONNX_PROTO_LIBRARY}") + list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx) + endif() +- include_directories(${FOXI_INCLUDE_DIRS}) +- list(APPEND Caffe2_DEPENDENCY_LIBS foxi_loader) ++# include_directories(${FOXI_INCLUDE_DIRS}) ++# list(APPEND Caffe2_DEPENDENCY_LIBS foxi_loader) + # Recover the build shared libs option. + set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS}) + endif() +-- +2.43.0 + diff --git a/next/0001-silence-an-assert.patch b/next/0001-silence-an-assert.patch new file mode 100644 index 0000000..0b20dcf --- /dev/null +++ b/next/0001-silence-an-assert.patch @@ -0,0 +1,25 @@ +From 04dd33db93b852fdfd7ea408813080b2e2026650 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Sat, 3 Feb 2024 06:41:20 -0500 +Subject: [PATCH] silence an assert + +--- + aten/src/ATen/native/cuda/IndexKernel.cu | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/aten/src/ATen/native/cuda/IndexKernel.cu b/aten/src/ATen/native/cuda/IndexKernel.cu +index 657c0c77b3..b406aa6687 100644 +--- a/aten/src/ATen/native/cuda/IndexKernel.cu ++++ b/aten/src/ATen/native/cuda/IndexKernel.cu +@@ -249,7 +249,7 @@ void index_put_kernel_quantized_cuda(TensorIterator& iter, const IntArrayRef ind + + gpu_index_kernel(iter, index_size, index_stride, [inv_scale, zero_point, qmin, qmax]C10_DEVICE(char* const out_data, const char* const in_data, const int64_t offset) { + int64_t qvalue = static_cast<int64_t>(zero_point + nearbyintf(*(float*)in_data * inv_scale)); +- qvalue = std::clamp(qvalue, qmin, qmax); ++ //qvalue = std::clamp(qvalue, qmin, qmax); + *(scalar_t*)(out_data + offset) = static_cast<scalar_t>(qvalue); + }); + }); +-- +2.43.0 + diff --git a/python-torch.spec b/python-torch.spec index 4b28ca7..a99d278 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -1,5 +1,4 @@ %global pypi_name torch -%global pypi_version 2.1.2
# Where the src comes from %global forgeurl https://github.com/pytorch/pytorch @@ -7,9 +6,14 @@ # So pre releases can be tried %bcond_with gitcommit %if %{with gitcommit} -# The top of the 2.1.0 branch - update to whatever.. -%global commit0 1841d54370d167365d15f0ac78efc2c56cdf43ab +# The top of tree ~2/1/24 +%global commit0 a43c28368c184ba1bf964f4fb99bec300917e2f4 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) + +%global pypi_version 2.3.0 +%else +%global pypi_version 2.1.2 + %endif
# For -test subpackage @@ -20,6 +24,7 @@ %bcond_with test
# For testing rocm +# Not viable on 2.1.2, use --with gitcommit %bcond_with rocm
# For testing openmp @@ -29,8 +34,8 @@ %bcond_with caffe2
Name: python-%{pypi_name} -Version: 2.1.2 -Release: 3%{?dist} +Version: %{pypi_version} +Release: %autorelease Summary: PyTorch AI/ML framework # See below for details License: BSD-3-Clause AND BSD-2-Clause AND 0BSD AND Apache-2.0 AND MIT AND BSL-1.0 AND GPL-3.0-or-later AND Zlib @@ -42,13 +47,23 @@ Source1: pyproject.toml %else Source0: %{forgeurl}/releases/download/v%{version}/pytorch-v%{version}.tar.gz %endif + +%if %{with gitcommit} + +Patch0: 0001-no-third_party-foxi.patch +Patch1: 0001-no-third_party-fmt.patch +Patch2: 0001-no-third_party-FXdiv.patch +Patch3: 0001-Stub-in-kineto-ActivityType.patch +Patch4: 0001-Regenerate-flatbuffer-header.patch +Patch5: 0001-disable-submodule-search.patch + %if %{with rocm} -# Public version is references the /opt install location -# Replace it with one that uses the system install location -Source100: LoadHIP.cmake -Patch100: 0001-add-rocm_version-fallback.patch +Patch100: 0001-cuda-hip-signatures.patch +Patch101: 0001-silence-an-assert.patch +Patch102: 0001-can-not-use-with-c-files.patch %endif
+%else # Misc cmake changes that would be difficult to upstream # * Use the system fmt # * Remove foxi use @@ -78,6 +93,7 @@ Patch8: 0001-torch-sane-version.patch # etc. # As a wrapper library, this should be the expected behavior. Patch9: 0001-disable-as-needed-for-libtorch.patch +%endif
# Limit to these because they are well behaved with clang ExclusiveArch: x86_64 aarch64 @@ -111,7 +127,7 @@ BuildRequires: python3-pyyaml BuildRequires: python3-typing-extensions BuildRequires: sleef-devel BuildRequires: valgrind-devel -BuildRequires: xnnpack-devel +BuildRequires: xnnpack-devel = 0.0^git20221221.51a9875
BuildRequires: python3-devel BuildRequires: python3dist(filelock) @@ -125,10 +141,12 @@ BuildRequires: python3dist(sphinx)
%if %{with rocm} BuildRequires: hipblas-devel +BuildRequires: hipblaslt-devel BuildRequires: hipcub-devel BuildRequires: hipfft-devel BuildRequires: hipsparse-devel BuildRequires: hipsolver-devel +BuildRequires: miopen-devel BuildRequires: rocblas-devel BuildRequires: rocprim-devel BuildRequires: rocm-cmake @@ -198,16 +216,15 @@ Requires: python3-%{pypi_name}%{?_isa} = %{version}-%{release} rm -rf %{pypi_name}.egg-info # Overwrite with a git checkout of the pyproject.toml cp %{SOURCE1} . -%else -%autosetup -p1 -n pytorch-v%{version}
%if %{with rocm} -cp %{SOURCE100} cmake/public - # hipify -./tools/amd_build/build_amd.py +./tools/amd_build/build_amd.py %endif
+%else +%autosetup -p1 -n pytorch-v%{version} + %if %{with opencv} # Reduce requirements, *FOUND is not set sed -i -e 's/USE_OPENCV AND OpenCV_FOUND AND USE_FFMPEG AND FFMPEG_FOUND/USE_OPENCV AND USE_FFMPEG/' caffe2/video/CMakeLists.txt @@ -307,6 +324,7 @@ export USE_ROCM=ON export USE_NCCL=OFF export BUILD_NVFUSER=OFF export HIP_PATH=%{_prefix} +export ROCM_PATH=%{_prefix} %else export USE_ROCM=OFF %endif @@ -390,6 +408,9 @@ sed -i -f br.sed devel.files %{python3_sitearch}/torch/utils/model_dump/{*.js,*.mjs,*.html} %{python3_sitearch}/torchgen/packaged/ATen/native/*.yaml %{python3_sitearch}/torchgen/packaged/autograd/{*.md,*.yaml} +%if %{with gitcommit} +%{python3_sitearch}/torch/_export/serde/schema.yaml +%endif
# egg %{python3_sitearch}/torch*.egg-info/*
commit f79fcb50df523692f4bf558901c9fc049d326ac5 Author: Fedora Release Engineering releng@fedoraproject.org Date: Fri Jan 26 11:53:23 2024 +0000
Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
diff --git a/python-torch.spec b/python-torch.spec index 1bcc901..4b28ca7 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -30,7 +30,7 @@
Name: python-%{pypi_name} Version: 2.1.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: PyTorch AI/ML framework # See below for details License: BSD-3-Clause AND BSD-2-Clause AND 0BSD AND Apache-2.0 AND MIT AND BSL-1.0 AND GPL-3.0-or-later AND Zlib @@ -787,6 +787,9 @@ sed -i -f br.sed devel.files # aten/src/ATen/native/cpu/avx_mathfun.h
%changelog +* Fri Jan 26 2024 Fedora Release Engineering releng@fedoraproject.org - 2.1.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Mon Jan 22 2024 Fedora Release Engineering releng@fedoraproject.org - 2.1.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
commit ec56ef465068e4dfa7a74690e64271dc3cbe4e4a Author: Fedora Release Engineering releng@fedoraproject.org Date: Mon Jan 22 08:19:43 2024 +0000
Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
diff --git a/python-torch.spec b/python-torch.spec index 810f499..1bcc901 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -30,7 +30,7 @@
Name: python-%{pypi_name} Version: 2.1.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: PyTorch AI/ML framework # See below for details License: BSD-3-Clause AND BSD-2-Clause AND 0BSD AND Apache-2.0 AND MIT AND BSL-1.0 AND GPL-3.0-or-later AND Zlib @@ -787,6 +787,9 @@ sed -i -f br.sed devel.files # aten/src/ATen/native/cpu/avx_mathfun.h
%changelog +* Mon Jan 22 2024 Fedora Release Engineering releng@fedoraproject.org - 2.1.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Wed Dec 27 2023 Tom Rix trix@redhat.com - 2.1.2-1 - Update to 2.1.2 - Stop versioning *.so's - 2.1.2's version is wrong
commit 35c2fb5e815a98250d74a8a42a5b9b8cede3ada8 Author: Tom Rix trix@redhat.com Date: Sat Dec 30 11:39:26 2023 -0500
Remove debugging cruft
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index e62a1cf..810f499 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -262,7 +262,7 @@ rm caffe2/mobile/contrib/libopencl-stub/include/CL/*.hpp # export SETUPTOOLS_SCM_DEBUG=1
# For verbose cmake output -export VERBOSE=ON +# export VERBOSE=ON # For verbose linking # export CMAKE_SHARED_LINKER_FLAGS=-Wl,--verbose
@@ -324,8 +324,6 @@ export USE_XNNPACK=ON # See BZ 2244862 %py3_build
-false - %install %py3_install
commit a2e90804f06c0b61fe3cc4ff10230426281ba5a3 Author: Tom Rix trix@redhat.com Date: Sat Dec 30 11:19:48 2023 -0500
Update to 2.1.2
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore index f9b2e47..3f2501f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /pytorch-v2.1.0.tar.gz +/pytorch-v2.1.2.tar.gz diff --git a/0001-torch-sane-version.patch b/0001-torch-sane-version.patch index 210b3bc..cb1211a 100644 --- a/0001-torch-sane-version.patch +++ b/0001-torch-sane-version.patch @@ -24,9 +24,9 @@ diff --git a/version.txt b/version.txt index ecaf4eea7c..7ec1d6db40 100644 --- a/version.txt +++ b/version.txt -@@ -1 +1 @@ +@@ -1,1 +1,1 @@ -2.1.0a0 -+2.1.0 ++2.1.2 -- 2.42.1
diff --git a/0004-torch-python-3.12-changes.patch b/0004-torch-python-3.12-changes.patch index 94204a0..bdcec7f 100644 --- a/0004-torch-python-3.12-changes.patch +++ b/0004-torch-python-3.12-changes.patch @@ -1,15 +1,34 @@ -From dcd60ab193aca8811e1283003cbcca4946c6b48e Mon Sep 17 00:00:00 2001 +From fcf3cd70229cdc729d05ddab081ac886c9db6bd7 Mon Sep 17 00:00:00 2001 From: Tom Rix trix@redhat.com Date: Fri, 29 Sep 2023 13:58:28 -0700 -Subject: [PATCH 4/6] torch python 3.12 changes +Subject: [PATCH] torch python 3.12 changes
Signed-off-by: Tom Rix trix@redhat.com --- + functorch/csrc/dim/dim.cpp | 6 ++++++ torch/csrc/dynamo/cpython_defs.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + 2 files changed, 7 insertions(+), 1 deletion(-)
+diff --git a/functorch/csrc/dim/dim.cpp b/functorch/csrc/dim/dim.cpp +index b611dc3e8c2..c7009478aee 100644 +--- a/functorch/csrc/dim/dim.cpp ++++ b/functorch/csrc/dim/dim.cpp +@@ -10,7 +10,13 @@ + // Many APIs have changed/don't exist anymore + #if IS_PYTHON_3_12_PLUS + ++#include "dim.h" ++ + // Re-enable this some day ++PyObject* Dim_init() { ++ PyErr_SetString(PyExc_RuntimeError, "First class dim doesn't work with python 3.12"); ++ return nullptr; ++} + + #else + diff --git a/torch/csrc/dynamo/cpython_defs.h b/torch/csrc/dynamo/cpython_defs.h -index f0a0e1a88e..f58becd246 100644 +index f0a0e1a88e2..f58becd246e 100644 --- a/torch/csrc/dynamo/cpython_defs.h +++ b/torch/csrc/dynamo/cpython_defs.h @@ -6,7 +6,7 @@ @@ -22,5 +41,5 @@ index f0a0e1a88e..f58becd246 100644 #include <internal/pycore_frame.h>
-- -2.41.0 +2.43.0
diff --git a/python-torch.spec b/python-torch.spec index 4d342e4..e62a1cf 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -1,5 +1,5 @@ %global pypi_name torch -%global pypi_version 2.1.0 +%global pypi_version 2.1.2
# Where the src comes from %global forgeurl https://github.com/pytorch/pytorch @@ -22,9 +22,15 @@ # For testing rocm %bcond_with rocm
+# For testing openmp +%bcond_with openmp + +# For testing caffe2 +%bcond_with caffe2 + Name: python-%{pypi_name} -Version: 2.1.0 -Release: 12%{?dist} +Version: 2.1.2 +Release: 1%{?dist} Summary: PyTorch AI/ML framework # See below for details License: BSD-3-Clause AND BSD-2-Clause AND 0BSD AND Apache-2.0 AND MIT AND BSL-1.0 AND GPL-3.0-or-later AND Zlib @@ -57,8 +63,6 @@ Patch2: 0003-Stub-in-kineto-ActivityType.patch Patch3: 0004-torch-python-3.12-changes.patch # Short circuit looking for things that can not be downloade by mock Patch4: 0005-disable-submodule-search.patch -# Fedora requires versioned so's -Patch5: 0001-pytorch-use-SO-version-by-default.patch # libtorch_python.so: undefined symbols: Py* Patch6: 0001-python-torch-link-with-python.patch # E: unused-direct-shlib-dependency libshm.so.2.1.0 libtorch.so.2.1 @@ -94,7 +98,11 @@ BuildRequires: ninja-build BuildRequires: onnx-devel BuildRequires: openblas-devel BuildRequires: pocketfft-devel +%if %{with caffe2} +BuildRequires: protobuf-lite-devel +%else BuildRequires: protobuf-devel +%endif BuildRequires: pthreadpool-devel BuildRequires: psimd-devel BuildRequires: python3-numpy @@ -104,6 +112,17 @@ BuildRequires: python3-typing-extensions BuildRequires: sleef-devel BuildRequires: valgrind-devel BuildRequires: xnnpack-devel + +BuildRequires: python3-devel +BuildRequires: python3dist(filelock) +BuildRequires: python3dist(fsspec) +BuildRequires: python3dist(jinja2) +BuildRequires: python3dist(networkx) +BuildRequires: python3dist(setuptools) +BuildRequires: python3dist(sympy) +BuildRequires: python3dist(typing-extensions) +BuildRequires: python3dist(sphinx) + %if %{with rocm} BuildRequires: hipblas-devel BuildRequires: hipcub-devel @@ -123,15 +142,13 @@ BuildRequires: rocthrust-devel Requires: rocm-rpm-macros-modules %endif
-BuildRequires: python3-devel -BuildRequires: python3dist(filelock) -BuildRequires: python3dist(fsspec) -BuildRequires: python3dist(jinja2) -BuildRequires: python3dist(networkx) -BuildRequires: python3dist(setuptools) -BuildRequires: python3dist(sympy) -BuildRequires: python3dist(typing-extensions) -BuildRequires: python3dist(sphinx) +%if %{with caffe2} +BuildRequires: foxi-devel +%endif + +%if %{with test} +BuildRequires: google-benchmark-devel +%endif
Provides: bundled(miniz) = 2.1.0
@@ -191,6 +208,14 @@ cp %{SOURCE100} cmake/public ./tools/amd_build/build_amd.py %endif
+%if %{with opencv} +# Reduce requirements, *FOUND is not set +sed -i -e 's/USE_OPENCV AND OpenCV_FOUND AND USE_FFMPEG AND FFMPEG_FOUND/USE_OPENCV AND USE_FFMPEG/' caffe2/video/CMakeLists.txt +sed -i -e 's/USE_OPENCV AND OpenCV_FOUND/USE_OPENCV/' caffe2/image/CMakeLists.txt +sed -i -e 's/STATUS/FATAL/' caffe2/image/CMakeLists.txt +cat caffe2/image/CMakeLists.txt +%endif + # Release comes fully loaded with third party src # Remove what we can # @@ -226,13 +251,8 @@ cp %{_includedir}/valgrind/* third_party/valgrind-headers
# Remove unneeded OpenCL files that confuse the lincense scanner rm caffe2/contrib/opencl/OpenCL/cl.hpp -rm caffe2/mobile/contrib/libopencl-stub/include/CL/cl.h -rm caffe2/mobile/contrib/libopencl-stub/include/CL/cl.hpp -rm caffe2/mobile/contrib/libopencl-stub/include/CL/cl_ext.h -rm caffe2/mobile/contrib/libopencl-stub/include/CL/cl_gl.h -rm caffe2/mobile/contrib/libopencl-stub/include/CL/cl_gl_ext.h -rm caffe2/mobile/contrib/libopencl-stub/include/CL/cl_platform.h -rm caffe2/mobile/contrib/libopencl-stub/include/CL/opencl.h +rm caffe2/mobile/contrib/libopencl-stub/include/CL/*.h +rm caffe2/mobile/contrib/libopencl-stub/include/CL/*.hpp
%endif
@@ -242,13 +262,18 @@ rm caffe2/mobile/contrib/libopencl-stub/include/CL/opencl.h # export SETUPTOOLS_SCM_DEBUG=1
# For verbose cmake output -# export VERBOSE=ON +export VERBOSE=ON # For verbose linking # export CMAKE_SHARED_LINKER_FLAGS=-Wl,--verbose
# Manually set this hardening flag export CMAKE_EXE_LINKER_FLAGS=-pie
+%if %{with caffe2} +export BUILD_CAFFE2=ON +export INTERN_BUILD_MOBILE=OFF +export USE_LITE_PROTO=ON +%endif export BUILD_CUSTOM_PROTOBUF=OFF export BUILD_SHARED_LIBS=ON %if %{with test} @@ -269,7 +294,12 @@ export USE_LITE_INTERPRETER_PROFILER=OFF export USE_MKLDNN=OFF export USE_NNPACK=OFF export USE_NUMPY=ON +%if %{with openmp} +export USE_OPENMP=ON +%else export USE_OPENMP=OFF +%endif + export USE_PYTORCH_QNNPACK=OFF export USE_QNNPACK=OFF %if %{with rocm} @@ -294,6 +324,8 @@ export USE_XNNPACK=ON # See BZ 2244862 %py3_build
+false + %install %py3_install
@@ -315,28 +347,6 @@ done # shebangs %py3_shebang_fix %{buildroot}%{python3_sitearch}
-# Remove copies of the *.so's -# -# *.so should be symlinks, not copies -# there is a copy of *.so.x.y.z to *.so and *.so.x.y -# remove the copies and do the link -# -%global lib_list c10 shm torch torch_cpu torch_global_deps torch_python -{ - cd %{buildroot}%{python3_sitearch}/torch/lib - for l in %{lib_list} - do - long_name=lib${l}.so.%{version} - short_name=${long_name%.*} - devel_name=lib${l}.so - rm ${short_name} - rm ${devel_name} - ln -s ${long_name} ${short_name} - ln -s ${long_name} ${devel_name} - done - cd - -} - # Programatically create the list of dirs echo "s|%{buildroot}%{python3_sitearch}|%%dir %%{python3_sitearch}|g" > br.sed find %{buildroot}%{python3_sitearch} -mindepth 1 -type d > dirs.files @@ -371,16 +381,6 @@ sed -i -f br.sed devel.files # libs %{python3_sitearch}/functorch/_C.cpython*.so %{python3_sitearch}/torch/_C.cpython*.so -%{python3_sitearch}/torch/lib/libc10.so.* -%{python3_sitearch}/torch/lib/libshm.so.* -%{python3_sitearch}/torch/lib/libtorch.so.* -%{python3_sitearch}/torch/lib/libtorch_cpu.so.* -%{python3_sitearch}/torch/lib/libtorch_global_deps.so.* -%{python3_sitearch}/torch/lib/libtorch_python.so.* - -# devel libs -# Normal python 'import torch' expects these libs -# https://bugzilla.redhat.com/show_bug.cgi?id=2253018 %{python3_sitearch}/torch/lib/libc10.so %{python3_sitearch}/torch/lib/libshm.so %{python3_sitearch}/torch/lib/libtorch.so @@ -789,6 +789,14 @@ sed -i -f br.sed devel.files # aten/src/ATen/native/cpu/avx_mathfun.h
%changelog +* Wed Dec 27 2023 Tom Rix trix@redhat.com - 2.1.2-1 +- Update to 2.1.2 +- Stop versioning *.so's - 2.1.2's version is wrong +- Stub in caffe2 to test in flight package + +* Wed Dec 27 2023 Tom Rix trix@redhat.com - 2.1.0-13 +- Stub in openmp to test in openmp + * Wed Dec 20 2023 Tom Rix trix@redhat.com - 2.1.0-12 - Stub in rocm to test in flight packages
diff --git a/sources b/sources index 9d3d165..90b1128 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (pytorch-v2.1.0.tar.gz) = 59421bf6cea6661d61ed66ab16526e3a07162e70e53381cbd5987042917610ec993d2f151fb086f0f98e5a396fe69e82bbc76f840bebffe4ebe7f50458c3aa44 +SHA512 (pytorch-v2.1.2.tar.gz) = b7305407ad9dda877d277a0e7009f65f6d69f39370f2231b8bb8c6a9b711022d2129febdb00f5c83751b6664e01000fe2d30c5e5c13757de89fb8b2b99197a28
commit ba89707404cb66de4862e6262f36ba4f5e83985d Author: Tom Rix trix@redhat.com Date: Wed Dec 20 16:07:51 2023 -0500
Stub in rocm to test in flight packages
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/0001-add-rocm_version-fallback.patch b/0001-add-rocm_version-fallback.patch new file mode 100644 index 0000000..25a0c67 --- /dev/null +++ b/0001-add-rocm_version-fallback.patch @@ -0,0 +1,36 @@ +From 1d35a0b1f5cb39fd0c44a486157dc739a02c71b6 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Wed, 20 Dec 2023 11:23:18 -0500 +Subject: [PATCH] add rocm_version fallback + +Signed-off-by: Tom Rix trix@redhat.com +--- + torch/utils/hipify/cuda_to_hip_mappings.py | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/torch/utils/hipify/cuda_to_hip_mappings.py b/torch/utils/hipify/cuda_to_hip_mappings.py +index 73586440e7..9354057a39 100644 +--- a/torch/utils/hipify/cuda_to_hip_mappings.py ++++ b/torch/utils/hipify/cuda_to_hip_mappings.py +@@ -57,6 +57,18 @@ if os.path.isfile(rocm_version_h): + if match: + patch = int(match.group(1)) + rocm_version = (major, minor, patch) ++else: ++ try: ++ hip_version = subprocess.check_output(["hipconfig", "--version"]).decode("utf-8") ++ hip_split = hip_version.split('.') ++ rocm_version = (int(hip_split[0]), int(hip_split[1]), 0) ++ except subprocess.CalledProcessError: ++ print(f"Warning: hipconfig --version failed") ++ except (FileNotFoundError, PermissionError, NotADirectoryError): ++ # Do not print warning. This is okay. This file can also be imported for non-ROCm builds. ++ pass ++ ++ + + # List of math functions that should be replaced inside device code only. + MATH_TRANSPILATIONS = collections.OrderedDict( +-- +2.43.0 + diff --git a/LoadHIP.cmake b/LoadHIP.cmake new file mode 100644 index 0000000..c8cc884 --- /dev/null +++ b/LoadHIP.cmake @@ -0,0 +1,66 @@ +set(PYTORCH_FOUND_HIP TRUE) + +torch_hip_get_arch_list(PYTORCH_ROCM_ARCH) +if(PYTORCH_ROCM_ARCH STREQUAL "") + message(FATAL_ERROR "No GPU arch specified for ROCm build. Please use PYTORCH_ROCM_ARCH environment variable to specify GPU archs to build for.") +endif() + + +find_package(ROCM CONFIG REQUIRED) + +set(CMAKE_MODULE_PATH "/usr/lib64/cmake/hip" ${CMAKE_MODULE_PATH}) + +# Find the HIP Package +find_package(HIP MODULE REQUIRED) +message("HIP Version: ${HIP_VERSION}") + +math(EXPR TORCH_HIP_VERSION "(${HIP_VERSION_MAJOR} * 100) + ${HIP_VERSION_MINOR}") +math(EXPR ROCM_VERSION_DEV_INT "(${HIP_VERSION_MAJOR} * 1000) + ${HIP_VERSION_MINOR} * 100") + + +set(CMAKE_HCC_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) +set(CMAKE_HCC_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) +### Remove setting of Flags when FindHIP.CMake PR #558 is accepted.### + +find_package(hsa-runtime64 REQUIRED) +find_package(amd_comgr REQUIRED) +find_package(rocrand REQUIRED) +find_package(hiprand REQUIRED) +find_package(rocblas REQUIRED) +find_package(hipblas REQUIRED) +find_package(miopen REQUIRED) +find_package(hipfft REQUIRED) +find_package(hipsparse REQUIRED) +#find_package(rccl) +find_package(rocprim REQUIRED) +find_package(hipcub REQUIRED) +find_package(rocthrust REQUIRED) +find_package(hipsolver REQUIRED) + +set(hip_library_name amdhip64) +message("HIP library name: ${hip_library_name}") + +# TODO: hip_hcc has an interface include flag "-hc" which is only +# recognizable by hcc, but not gcc and clang. Right now in our +# setup, hcc is only used for linking, but it should be used to +# compile the *_hip.cc files as well. +find_library(PYTORCH_HIP_HCC_LIBRARIES ${hip_library_name} HINTS /usr/lib64) +# TODO: miopen_LIBRARIES should return fullpath to the library file, +# however currently it's just the lib name +if(TARGET ${miopen_LIBRARIES}) + set(PYTORCH_MIOPEN_LIBRARIES ${miopen_LIBRARIES}) +else() + find_library(PYTORCH_MIOPEN_LIBRARIES ${miopen_LIBRARIES} HINTS /usr/lib64) +endif() +# TODO: rccl_LIBRARIES should return fullpath to the library file, +# however currently it's just the lib name +# if(TARGET ${rccl_LIBRARIES}) +# set(PYTORCH_RCCL_LIBRARIES ${rccl_LIBRARIES}) +# else() +# find_library(PYTORCH_RCCL_LIBRARIES ${rccl_LIBRARIES} HINTS /usr/lib64) +# endif() +# hiprtc is part of HIP +find_library(ROCM_HIPRTC_LIB ${hip_library_name} HINTS /usr/lib64) +# roctx is part of roctracer +# find_library(ROCM_ROCTX_LIB roctx64 HINTS /usr/lib64) + diff --git a/python-torch.spec b/python-torch.spec index ea111ea..4d342e4 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -19,9 +19,12 @@ # /usr/lib64/python3.12/site-packages/torch/bin/test_api, test_lazy %bcond_with test
+# For testing rocm +%bcond_with rocm + Name: python-%{pypi_name} Version: 2.1.0 -Release: 11%{?dist} +Release: 12%{?dist} Summary: PyTorch AI/ML framework # See below for details License: BSD-3-Clause AND BSD-2-Clause AND 0BSD AND Apache-2.0 AND MIT AND BSL-1.0 AND GPL-3.0-or-later AND Zlib @@ -33,6 +36,12 @@ Source1: pyproject.toml %else Source0: %{forgeurl}/releases/download/v%{version}/pytorch-v%{version}.tar.gz %endif +%if %{with rocm} +# Public version is references the /opt install location +# Replace it with one that uses the system install location +Source100: LoadHIP.cmake +Patch100: 0001-add-rocm_version-fallback.patch +%endif
# Misc cmake changes that would be difficult to upstream # * Use the system fmt @@ -95,6 +104,24 @@ BuildRequires: python3-typing-extensions BuildRequires: sleef-devel BuildRequires: valgrind-devel BuildRequires: xnnpack-devel +%if %{with rocm} +BuildRequires: hipblas-devel +BuildRequires: hipcub-devel +BuildRequires: hipfft-devel +BuildRequires: hipsparse-devel +BuildRequires: hipsolver-devel +BuildRequires: rocblas-devel +BuildRequires: rocprim-devel +BuildRequires: rocm-cmake +BuildRequires: rocm-comgr-devel +BuildRequires: rocm-hip-devel +BuildRequires: rocm-runtime-devel +BuildRequires: rocm-rpm-macros +BuildRequires: rocm-rpm-macros-modules +BuildRequires: rocthrust-devel + +Requires: rocm-rpm-macros-modules +%endif
BuildRequires: python3-devel BuildRequires: python3dist(filelock) @@ -157,6 +184,13 @@ cp %{SOURCE1} . %else %autosetup -p1 -n pytorch-v%{version}
+%if %{with rocm} +cp %{SOURCE100} cmake/public + +# hipify +./tools/amd_build/build_amd.py +%endif + # Release comes fully loaded with third party src # Remove what we can # @@ -238,7 +272,14 @@ export USE_NUMPY=ON export USE_OPENMP=OFF export USE_PYTORCH_QNNPACK=OFF export USE_QNNPACK=OFF +%if %{with rocm} +export USE_ROCM=ON +export USE_NCCL=OFF +export BUILD_NVFUSER=OFF +export HIP_PATH=%{_prefix} +%else export USE_ROCM=OFF +%endif export USE_SYSTEM_LIBS=ON export USE_TENSORPIPE=OFF export USE_XNNPACK=ON @@ -748,6 +789,9 @@ sed -i -f br.sed devel.files # aten/src/ATen/native/cpu/avx_mathfun.h
%changelog +* Wed Dec 20 2023 Tom Rix trix@redhat.com - 2.1.0-12 +- Stub in rocm to test in flight packages + * Wed Dec 13 2023 Tom Rix trix@redhat.com - 2.1.0-11 - Move unversioned *.so's to main package
commit 547fc540d2b79dd718a61fb1a7c922ceecb90dde Author: Tom Rix trix@redhat.com Date: Thu Dec 14 07:07:37 2023 -0500
Move unversioned *.so's to main package
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/python-torch.spec b/python-torch.spec index fd8182b..ea111ea 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -21,7 +21,7 @@
Name: python-%{pypi_name} Version: 2.1.0 -Release: 10%{?dist} +Release: 11%{?dist} Summary: PyTorch AI/ML framework # See below for details License: BSD-3-Clause AND BSD-2-Clause AND 0BSD AND Apache-2.0 AND MIT AND BSL-1.0 AND GPL-3.0-or-later AND Zlib @@ -337,6 +337,16 @@ sed -i -f br.sed devel.files %{python3_sitearch}/torch/lib/libtorch_global_deps.so.* %{python3_sitearch}/torch/lib/libtorch_python.so.*
+# devel libs +# Normal python 'import torch' expects these libs +# https://bugzilla.redhat.com/show_bug.cgi?id=2253018 +%{python3_sitearch}/torch/lib/libc10.so +%{python3_sitearch}/torch/lib/libshm.so +%{python3_sitearch}/torch/lib/libtorch.so +%{python3_sitearch}/torch/lib/libtorch_cpu.so +%{python3_sitearch}/torch/lib/libtorch_global_deps.so +%{python3_sitearch}/torch/lib/libtorch_python.so + # misc %{python3_sitearch}/torch/utils/model_dump/{*.js,*.mjs,*.html} %{python3_sitearch}/torchgen/packaged/ATen/native/*.yaml @@ -354,14 +364,6 @@ sed -i -f br.sed devel.files # %files -n python3-%{pypi_name}-devel -f devel.files
-# devel libs -%{python3_sitearch}/torch/lib/libc10.so -%{python3_sitearch}/torch/lib/libshm.so -%{python3_sitearch}/torch/lib/libtorch.so -%{python3_sitearch}/torch/lib/libtorch_cpu.so -%{python3_sitearch}/torch/lib/libtorch_global_deps.so -%{python3_sitearch}/torch/lib/libtorch_python.so - # devel cmake %{python3_sitearch}/torch/share/cmake/{ATen,Caffe2,Torch}/*.cmake %{python3_sitearch}/torch/share/cmake/Caffe2/public/*.cmake @@ -746,6 +748,9 @@ sed -i -f br.sed devel.files # aten/src/ATen/native/cpu/avx_mathfun.h
%changelog +* Wed Dec 13 2023 Tom Rix trix@redhat.com - 2.1.0-11 +- Move unversioned *.so's to main package + * Fri Dec 1 2023 Tom Rix trix@redhat.com - 2.1.0-10 - Disable gold linker - Remove python requires
commit 48192fa108ef9dfb82ed2bc9300f1b692b1b0ede Author: Tom Rix trix@redhat.com Date: Sat Dec 2 15:19:42 2023 -0500
Initial import
Signed-off-by: Tom Rix trix@redhat.com
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f9b2e47 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/pytorch-v2.1.0.tar.gz diff --git a/0001-Prepare-pytorch-cmake-for-fedora.patch b/0001-Prepare-pytorch-cmake-for-fedora.patch new file mode 100644 index 0000000..cf1e843 --- /dev/null +++ b/0001-Prepare-pytorch-cmake-for-fedora.patch @@ -0,0 +1,169 @@ +From 24cf0294a67d89ad70367940eea872162b44482c Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Sat, 23 Sep 2023 10:18:52 -0700 +Subject: [PATCH] Prepare pytorch cmake for fedora + +Use the system fmt +Remove foxi use +Remove warnings/errors for clang 17 +fxdiv is not a library +build type is RelWithDebInfo +use system pthreadpool + +Signed-off-by: Tom Rix trix@redhat.com +--- + CMakeLists.txt | 6 +++--- + .../native/quantized/cpu/qnnpack/CMakeLists.txt | 3 --- + c10/CMakeLists.txt | 2 +- + caffe2/CMakeLists.txt | 6 +----- + cmake/Dependencies.cmake | 16 +--------------- + test/cpp/tensorexpr/CMakeLists.txt | 2 +- + torch/CMakeLists.txt | 2 +- + 7 files changed, 8 insertions(+), 29 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3a48eaf4e2..902ee70fd1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -682,7 +682,7 @@ set(CAFFE2_ALLOWLIST "" CACHE STRING "A allowlist file of files that one should + # Set default build type + if(NOT CMAKE_BUILD_TYPE) + message(STATUS "Build type not set - defaulting to Release") +- set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build from: Debug Release RelWithDebInfo MinSizeRel Coverage." FORCE) ++ set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build from: Debug Release RelWithDebInfo MinSizeRel Coverage." FORCE) + endif() + + # The below means we are cross compiling for arm64 or x86_64 on MacOSX +@@ -917,8 +917,8 @@ if(NOT MSVC) + string(APPEND CMAKE_LINKER_FLAGS_DEBUG " -fno-omit-frame-pointer -O0") + append_cxx_flag_if_supported("-fno-math-errno" CMAKE_CXX_FLAGS) + append_cxx_flag_if_supported("-fno-trapping-math" CMAKE_CXX_FLAGS) +- append_cxx_flag_if_supported("-Werror=format" CMAKE_CXX_FLAGS) +- append_cxx_flag_if_supported("-Werror=cast-function-type" CMAKE_CXX_FLAGS) ++# append_cxx_flag_if_supported("-Werror=format" CMAKE_CXX_FLAGS) ++# append_cxx_flag_if_supported("-Werror=cast-function-type" CMAKE_CXX_FLAGS) + else() + # skip unwanted includes from windows.h + add_compile_definitions(WIN32_LEAN_AND_MEAN) +diff --git a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt +index fd6b7ff551..218c8e9b2a 100644 +--- a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt ++++ b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt +@@ -393,10 +393,7 @@ elseif(NOT TARGET fxdiv AND USE_SYSTEM_FXDIV) + if(NOT FXDIV_HDR) + message(FATAL_ERROR "Cannot find fxdiv") + endif() +- add_library(fxdiv STATIC "${FXDIV_HDR}") +- set_property(TARGET fxdiv PROPERTY LINKER_LANGUAGE C) + endif() +-target_link_libraries(pytorch_qnnpack PRIVATE fxdiv) + + # ---[ Configure psimd + if(NOT TARGET psimd AND NOT USE_SYSTEM_PSIMD) +diff --git a/c10/CMakeLists.txt b/c10/CMakeLists.txt +index feebad7cbb..7c029cd88d 100644 +--- a/c10/CMakeLists.txt ++++ b/c10/CMakeLists.txt +@@ -87,7 +87,7 @@ endif() + if(${USE_GLOG}) + target_link_libraries(c10 PUBLIC glog::glog) + endif() +-target_link_libraries(c10 PRIVATE fmt::fmt-header-only) ++target_link_libraries(c10 PRIVATE fmt) + + find_package(Backtrace) + if(Backtrace_FOUND) +diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt +index 74d0d55719..b975d388a7 100644 +--- a/caffe2/CMakeLists.txt ++++ b/caffe2/CMakeLists.txt +@@ -107,7 +107,7 @@ endif() + # Note: the folders that are being commented out have not been properly + # addressed yet. + +-if(NOT MSVC AND USE_XNNPACK) ++if(NOT MSVC AND USE_XNNPACK AND NOT USE_SYSTEM_FXDIV) + if(NOT TARGET fxdiv) + set(FXDIV_BUILD_TESTS OFF CACHE BOOL "") + set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "") +@@ -1022,10 +1022,6 @@ elseif(USE_CUDA) + endif() + endif() + +-if(NOT MSVC AND USE_XNNPACK) +- TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv) +-endif() +- + # ========================================================== + # formerly-libtorch flags + # ========================================================== +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index c3abce52e4..21b40f3a88 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -1555,7 +1555,6 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX) + set_target_properties(onnx_proto PROPERTIES CXX_STANDARD 17) + endif() + endif() +- add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/foxi EXCLUDE_FROM_ALL) + + add_definitions(-DONNX_NAMESPACE=${ONNX_NAMESPACE}) + if(NOT USE_SYSTEM_ONNX) +@@ -1588,8 +1587,6 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX) + message("-- Found onnx: ${ONNX_LIBRARY} ${ONNX_PROTO_LIBRARY}") + list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx) + endif() +- include_directories(${FOXI_INCLUDE_DIRS}) +- list(APPEND Caffe2_DEPENDENCY_LIBS foxi_loader) + # Recover the build shared libs option. + set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS}) + endif() +@@ -1834,18 +1831,7 @@ endif() + # + 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 "") +- +-list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only) ++list(APPEND Caffe2_DEPENDENCY_LIBS fmt) + set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE) + + # ---[ Kineto +diff --git a/test/cpp/tensorexpr/CMakeLists.txt b/test/cpp/tensorexpr/CMakeLists.txt +index 7dff70630d..90b1003591 100644 +--- a/test/cpp/tensorexpr/CMakeLists.txt ++++ b/test/cpp/tensorexpr/CMakeLists.txt +@@ -54,7 +54,7 @@ target_include_directories(tutorial_tensorexpr PRIVATE ${ATen_CPU_INCLUDE}) + # pthreadpool header. For some build environment we need add the dependency + # explicitly. + if(USE_PTHREADPOOL) +- target_link_libraries(test_tensorexpr PRIVATE pthreadpool_interface) ++ target_link_libraries(test_tensorexpr PRIVATE pthreadpool) + endif() + if(USE_CUDA) + target_link_libraries(test_tensorexpr PRIVATE +diff --git a/torch/CMakeLists.txt b/torch/CMakeLists.txt +index 62ee4c12a9..8d5375f320 100644 +--- a/torch/CMakeLists.txt ++++ b/torch/CMakeLists.txt +@@ -84,7 +84,7 @@ set(TORCH_PYTHON_LINK_LIBRARIES + python::python + pybind::pybind11 + shm +- fmt::fmt-header-only ++ fmt + ATEN_CPU_FILES_GEN_LIB) + + if(USE_ASAN AND TARGET Sanitizer::address) +-- +2.42.1 + diff --git a/0001-disable-as-needed-for-libtorch.patch b/0001-disable-as-needed-for-libtorch.patch new file mode 100644 index 0000000..392140a --- /dev/null +++ b/0001-disable-as-needed-for-libtorch.patch @@ -0,0 +1,28 @@ +From 06499575b177a218846f0e43ff4bc77d245f207f Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Fri, 1 Dec 2023 09:38:05 -0500 +Subject: [PATCH] disable as-needed for libtorch + +Signed-off-by: Tom Rix trix@redhat.com +--- + caffe2/CMakeLists.txt | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt +index b975d388a7..5e9fd3b3f3 100644 +--- a/caffe2/CMakeLists.txt ++++ b/caffe2/CMakeLists.txt +@@ -914,6 +914,10 @@ if(HAVE_SOVERSION) + VERSION ${TORCH_VERSION} SOVERSION ${TORCH_SOVERSION}) + endif() + ++# Disable global as-needed ++set_target_properties(torch PROPERTIES LINK_FLAGS -Wl,--no-as-needed) ++ ++ + if(USE_ROCM) + filter_list(__caffe2_hip_srcs_cpp Caffe2_HIP_SRCS "\.(cu|hip)$") + set_source_files_properties(${__caffe2_hip_srcs_cpp} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1) +-- +2.42.1 + diff --git a/0001-python-torch-link-with-python.patch b/0001-python-torch-link-with-python.patch new file mode 100644 index 0000000..d52f034 --- /dev/null +++ b/0001-python-torch-link-with-python.patch @@ -0,0 +1,27 @@ +From cef92207b79ad53e3fcc1b0e22ba91cb9422968c Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Sat, 18 Nov 2023 09:38:52 -0500 +Subject: [PATCH] python-torch link with python + +Signed-off-by: Tom Rix trix@redhat.com +--- + torch/CMakeLists.txt | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/torch/CMakeLists.txt b/torch/CMakeLists.txt +index 8d5375f320..6f8c7b65c4 100644 +--- a/torch/CMakeLists.txt ++++ b/torch/CMakeLists.txt +@@ -312,6 +312,9 @@ add_dependencies(torch_python torch_python_stubs) + add_dependencies(torch_python flatbuffers) + + ++# Unresolved syms in -lpython ++target_link_libraries(torch_python PUBLIC ${PYTHON_LIBRARIES}) ++ + if(USE_PRECOMPILED_HEADERS) + target_precompile_headers(torch_python PRIVATE + "$<$<COMPILE_LANGUAGE:CXX>:ATen/ATen.h>") +-- +2.42.1 + diff --git a/0001-python-torch-remove-ubuntu-specific-linking.patch b/0001-python-torch-remove-ubuntu-specific-linking.patch new file mode 100644 index 0000000..6d9bd24 --- /dev/null +++ b/0001-python-torch-remove-ubuntu-specific-linking.patch @@ -0,0 +1,33 @@ +From f70ef37d0b3c780fd17be199e66a81ffa679f93e Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Sat, 18 Nov 2023 12:05:43 -0500 +Subject: [PATCH] python-torch remove ubuntu specific linking + +Signed-off-by: Tom Rix trix@redhat.com +--- + CMakeLists.txt | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 86c34984b2..f7c4a7b05f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -479,9 +479,12 @@ option(BUILD_EXECUTORCH "Master flag to build Executorch" ON) + # This is a fix for a rare build issue on Ubuntu: + # symbol lookup error: miniconda3/envs/pytorch-py3.7/lib/libmkl_intel_lp64.so: undefined symbol: mkl_blas_dsyrk + # https://software.intel.com/en-us/articles/symbol-lookup-error-when-linking-i... +-if(LINUX) +- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed") +-endif() ++ ++# This is not ubuntu! ++# if(LINUX) ++# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed") ++# endif() ++set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed") + + if(MSVC) + set(CMAKE_NINJA_CMCLDEPS_RC OFF) +-- +2.42.1 + diff --git a/0001-pytorch-use-SO-version-by-default.patch b/0001-pytorch-use-SO-version-by-default.patch new file mode 100644 index 0000000..b70d6ec --- /dev/null +++ b/0001-pytorch-use-SO-version-by-default.patch @@ -0,0 +1,26 @@ +From 527d1ce24a06a14788ca5fc2411985d7c1cb2923 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Fri, 13 Oct 2023 05:35:19 -0700 +Subject: [PATCH] pytorch use SO version by default + +Signed-off-by: Tom Rix trix@redhat.com +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 902ee70fd1..86c34984b2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -340,7 +340,7 @@ option(USE_TBB "Use TBB (Deprecated)" OFF) + cmake_dependent_option( + USE_SYSTEM_TBB "Use system-provided Intel TBB." OFF "USE_TBB" OFF) + option(ONNX_ML "Enable traditional ONNX ML API." ON) +-option(HAVE_SOVERSION "Whether to add SOVERSION to the shared objects" OFF) ++option(HAVE_SOVERSION "Whether to add SOVERSION to the shared objects" ON) + option(BUILD_LIBTORCH_CPU_WITH_DEBUG "Enable RelWithDebInfo for libtorch_cpu target only" OFF) + cmake_dependent_option(USE_CCACHE "Attempt using CCache to wrap the compilation" ON "UNIX" OFF) + option(WERROR "Build with -Werror supported by the compiler" OFF) +-- +2.42.1 + diff --git a/0001-torch-sane-version.patch b/0001-torch-sane-version.patch new file mode 100644 index 0000000..210b3bc --- /dev/null +++ b/0001-torch-sane-version.patch @@ -0,0 +1,32 @@ +From c47c6e202d60ccac15aa36698bd4788415a9416b Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Sat, 25 Nov 2023 16:46:17 -0500 +Subject: [PATCH] torch sane version + +--- + tools/generate_torch_version.py | 1 + + version.txt | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tools/generate_torch_version.py b/tools/generate_torch_version.py +index d90d3646ab..11d5bbeba5 100644 +--- a/tools/generate_torch_version.py ++++ b/tools/generate_torch_version.py +@@ -42,6 +42,7 @@ def get_tag(pytorch_root: Union[str, Path]) -> str: + def get_torch_version(sha: Optional[str] = None) -> str: + pytorch_root = Path(__file__).parent.parent + version = open(pytorch_root / "version.txt").read().strip() ++ return version + + if os.getenv("PYTORCH_BUILD_VERSION"): + assert os.getenv("PYTORCH_BUILD_NUMBER") is not None +diff --git a/version.txt b/version.txt +index ecaf4eea7c..7ec1d6db40 100644 +--- a/version.txt ++++ b/version.txt +@@ -1 +1 @@ +-2.1.0a0 ++2.1.0 +-- +2.42.1 + diff --git a/0002-Regenerate-flatbuffer-header.patch b/0002-Regenerate-flatbuffer-header.patch new file mode 100644 index 0000000..662a7c5 --- /dev/null +++ b/0002-Regenerate-flatbuffer-header.patch @@ -0,0 +1,39 @@ +From 587a8b10bd3f7a68275356ee6eb6bb43ed711ba2 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Fri, 29 Sep 2023 06:19:29 -0700 +Subject: [PATCH 2/6] Regenerate flatbuffer header + +For this error +torch/csrc/jit/serialization/mobile_bytecode_generated.h:12:41: +error: static assertion failed: Non-compatible flatbuffers version included + 12 | FLATBUFFERS_VERSION_MINOR == 3 && + +PyTorch is expecting 23.3.3, what f38 has +Rawhide is at 23.5.26 + +Regenerate with +flatc --cpp --gen-mutable --no-prefix --scoped-enums mobile_bytecode.fbs + +Signed-off-by: Tom Rix trix@redhat.com +--- + torch/csrc/jit/serialization/mobile_bytecode_generated.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/torch/csrc/jit/serialization/mobile_bytecode_generated.h b/torch/csrc/jit/serialization/mobile_bytecode_generated.h +index cffe8bc7a6..83575e4c19 100644 +--- a/torch/csrc/jit/serialization/mobile_bytecode_generated.h ++++ b/torch/csrc/jit/serialization/mobile_bytecode_generated.h +@@ -9,8 +9,8 @@ + // Ensure the included flatbuffers.h is the same version as when this file was + // generated, otherwise it may not be compatible. + static_assert(FLATBUFFERS_VERSION_MAJOR == 23 && +- FLATBUFFERS_VERSION_MINOR == 3 && +- FLATBUFFERS_VERSION_REVISION == 3, ++ FLATBUFFERS_VERSION_MINOR == 5 && ++ FLATBUFFERS_VERSION_REVISION == 26, + "Non-compatible flatbuffers version included"); + + namespace torch { +-- +2.41.0 + diff --git a/0003-Stub-in-kineto-ActivityType.patch b/0003-Stub-in-kineto-ActivityType.patch new file mode 100644 index 0000000..0823acb --- /dev/null +++ b/0003-Stub-in-kineto-ActivityType.patch @@ -0,0 +1,73 @@ +From bb52aeacc6dfab2355249b7b5beb72c2761ec319 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Fri, 29 Sep 2023 06:25:23 -0700 +Subject: [PATCH 3/6] Stub in kineto ActivityType + +There is an error with kineto is not used, the shim still +requires the ActivityTYpe.h header to get the enum Activity type. +So cut-n-paste just enough of the header in to do this. + +Signed-off-by: Tom Rix trix@redhat.com +--- + torch/csrc/profiler/kineto_shim.h | 44 +++++++++++++++++++++++++++++++ + 1 file changed, 44 insertions(+) + +diff --git a/torch/csrc/profiler/kineto_shim.h b/torch/csrc/profiler/kineto_shim.h +index 2a410719a1..7d6525befd 100644 +--- a/torch/csrc/profiler/kineto_shim.h ++++ b/torch/csrc/profiler/kineto_shim.h +@@ -12,7 +12,51 @@ + #undef USE_KINETO + #endif + ++#ifdef USE_KINETO + #include <ActivityType.h> ++#else ++namespace libkineto { ++// copied from header ++/* ++ * Copyright (c) Meta Platforms, Inc. and affiliates. ++ * All rights reserved. ++ * ++ * This source code is licensed under the BSD-style license found in the ++ * LICENSE file in the root directory of this source tree. ++ */ ++ ++// Note : All activity types are not enabled by default. Please add them ++// at correct position in the enum ++enum class ActivityType { ++ // Activity types enabled by default ++ CPU_OP = 0, // cpu side ops ++ USER_ANNOTATION, ++ GPU_USER_ANNOTATION, ++ GPU_MEMCPY, ++ GPU_MEMSET, ++ CONCURRENT_KERNEL, // on-device kernels ++ EXTERNAL_CORRELATION, ++ CUDA_RUNTIME, // host side cuda runtime events ++ CUDA_DRIVER, // host side cuda driver events ++ CPU_INSTANT_EVENT, // host side point-like events ++ PYTHON_FUNCTION, ++ OVERHEAD, // CUPTI induced overhead events sampled from its overhead API. ++ ++ // Optional Activity types ++ CUDA_SYNC, // synchronization events between runtime and kernels ++ GLOW_RUNTIME, // host side glow runtime events ++ MTIA_RUNTIME, // host side MTIA runtime events ++ CUDA_PROFILER_RANGE, // CUPTI Profiler range for performance metrics ++ MTIA_CCP_EVENTS, // MTIA ondevice CCP events ++ HPU_OP, // HPU host side runtime event ++ XPU_RUNTIME, // host side xpu runtime events ++ ++ ENUM_COUNT, // This is to add buffer and not used for any profiling logic. Add your new type before it. ++ OPTIONAL_ACTIVITY_TYPE_START = CUDA_SYNC, ++}; ++} ++ ++#endif + + #include <torch/csrc/Export.h> + #include <torch/csrc/profiler/api.h> +-- +2.41.0 + diff --git a/0004-torch-python-3.12-changes.patch b/0004-torch-python-3.12-changes.patch new file mode 100644 index 0000000..94204a0 --- /dev/null +++ b/0004-torch-python-3.12-changes.patch @@ -0,0 +1,26 @@ +From dcd60ab193aca8811e1283003cbcca4946c6b48e Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Fri, 29 Sep 2023 13:58:28 -0700 +Subject: [PATCH 4/6] torch python 3.12 changes + +Signed-off-by: Tom Rix trix@redhat.com +--- + torch/csrc/dynamo/cpython_defs.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/torch/csrc/dynamo/cpython_defs.h b/torch/csrc/dynamo/cpython_defs.h +index f0a0e1a88e..f58becd246 100644 +--- a/torch/csrc/dynamo/cpython_defs.h ++++ b/torch/csrc/dynamo/cpython_defs.h +@@ -6,7 +6,7 @@ + // should go in cpython_defs.c. Copying is required when, e.g., + // we need to call internal CPython functions that are not exposed. + +-#if IS_PYTHON_3_11_PLUS && !(IS_PYTHON_3_12_PLUS) ++#if IS_PYTHON_3_11_PLUS + + #include <internal/pycore_frame.h> + +-- +2.41.0 + diff --git a/0005-disable-submodule-search.patch b/0005-disable-submodule-search.patch new file mode 100644 index 0000000..1b5509f --- /dev/null +++ b/0005-disable-submodule-search.patch @@ -0,0 +1,25 @@ +From fc0d4ce06fecbd2bcd10fb13c515dc6625260870 Mon Sep 17 00:00:00 2001 +From: Tom Rix trix@redhat.com +Date: Fri, 29 Sep 2023 17:21:13 -0700 +Subject: [PATCH 5/6] disable submodule search + +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 17bf16b89a..b8c8ae5506 100644 +--- a/setup.py ++++ b/setup.py +@@ -452,7 +452,7 @@ def mirror_files_into_torchgen(): + def build_deps(): + report("-- Building version " + version) + +- check_submodules() ++ # check_submodules() + check_pydep("yaml", "pyyaml") + + build_caffe2( +-- +2.41.0 + diff --git a/python-torch.spec b/python-torch.spec new file mode 100644 index 0000000..fd8182b --- /dev/null +++ b/python-torch.spec @@ -0,0 +1,792 @@ +%global pypi_name torch +%global pypi_version 2.1.0 + +# Where the src comes from +%global forgeurl https://github.com/pytorch/pytorch + +# So pre releases can be tried +%bcond_with gitcommit +%if %{with gitcommit} +# The top of the 2.1.0 branch - update to whatever.. +%global commit0 1841d54370d167365d15f0ac78efc2c56cdf43ab +%global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) +%endif + +# For -test subpackage +# suitable only for local testing +# Install and do something like +# export LD_LIBRARY_PATH=/usr/lib64/python3.12/site-packages/torch/lib +# /usr/lib64/python3.12/site-packages/torch/bin/test_api, test_lazy +%bcond_with test + +Name: python-%{pypi_name} +Version: 2.1.0 +Release: 10%{?dist} +Summary: PyTorch AI/ML framework +# See below for details +License: BSD-3-Clause AND BSD-2-Clause AND 0BSD AND Apache-2.0 AND MIT AND BSL-1.0 AND GPL-3.0-or-later AND Zlib + +URL: https://pytorch.org/ +%if %{with gitcommit} +Source0: %{forgeurl}/archive/%{commit0}/pytorch-%{shortcommit0}.tar.gz +Source1: pyproject.toml +%else +Source0: %{forgeurl}/releases/download/v%{version}/pytorch-v%{version}.tar.gz +%endif + +# Misc cmake changes that would be difficult to upstream +# * Use the system fmt +# * Remove foxi use +# * Remove warnings/errors for clang 17 +# * fxdiv is not a library on Fedora +Patch0: 0001-Prepare-pytorch-cmake-for-fedora.patch +# Use Fedora's fmt +Patch1: 0002-Regenerate-flatbuffer-header.patch +# https://github.com/pytorch/pytorch/pull/111048 +Patch2: 0003-Stub-in-kineto-ActivityType.patch +# PyTorch has not fully baked 3.12 support because 3.12 is so new +Patch3: 0004-torch-python-3.12-changes.patch +# Short circuit looking for things that can not be downloade by mock +Patch4: 0005-disable-submodule-search.patch +# Fedora requires versioned so's +Patch5: 0001-pytorch-use-SO-version-by-default.patch +# libtorch_python.so: undefined symbols: Py* +Patch6: 0001-python-torch-link-with-python.patch +# E: unused-direct-shlib-dependency libshm.so.2.1.0 libtorch.so.2.1 +# turn on as-needed globally +Patch7: 0001-python-torch-remove-ubuntu-specific-linking.patch +# Tries to use git and is confused by tarball +Patch8: 0001-torch-sane-version.patch +# libtorch is a wrapper so turn off as-needed locally +# resolves this rpmlint +# E: shared-library-without-dependency-information libtorch.so.2.1.0 +# causes these +# E: unused-direct-shlib-dependency libtorch.so.2.1.0 libtorch_cpu.so.2.1 +# etc. +# As a wrapper library, this should be the expected behavior. +Patch9: 0001-disable-as-needed-for-libtorch.patch + +# Limit to these because they are well behaved with clang +ExclusiveArch: x86_64 aarch64 +%global toolchain clang + +BuildRequires: clang-devel +BuildRequires: cmake +BuildRequires: cpuinfo-devel +BuildRequires: eigen3-devel +BuildRequires: fmt-devel +BuildRequires: flatbuffers-devel +BuildRequires: FP16-devel +BuildRequires: fxdiv-devel +BuildRequires: gcc-c++ +BuildRequires: gcc-gfortran +BuildRequires: gloo-devel +BuildRequires: ninja-build +BuildRequires: onnx-devel +BuildRequires: openblas-devel +BuildRequires: pocketfft-devel +BuildRequires: protobuf-devel +BuildRequires: pthreadpool-devel +BuildRequires: psimd-devel +BuildRequires: python3-numpy +BuildRequires: python3-pybind11 +BuildRequires: python3-pyyaml +BuildRequires: python3-typing-extensions +BuildRequires: sleef-devel +BuildRequires: valgrind-devel +BuildRequires: xnnpack-devel + +BuildRequires: python3-devel +BuildRequires: python3dist(filelock) +BuildRequires: python3dist(fsspec) +BuildRequires: python3dist(jinja2) +BuildRequires: python3dist(networkx) +BuildRequires: python3dist(setuptools) +BuildRequires: python3dist(sympy) +BuildRequires: python3dist(typing-extensions) +BuildRequires: python3dist(sphinx) + +Provides: bundled(miniz) = 2.1.0 + +%description +PyTorch is a Python package that provides two high-level features: + + * Tensor computation (like NumPy) with strong GPU acceleration + * Deep neural networks built on a tape-based autograd system + +You can reuse your favorite Python packages such as NumPy, SciPy, +and Cython to extend PyTorch when needed. + +%package -n python3-%{pypi_name} +Summary: %{summary} + +%description -n python3-%{pypi_name} +PyTorch is a Python package that provides two high-level features: + + * Tensor computation (like NumPy) with strong GPU acceleration + * Deep neural networks built on a tape-based autograd system + +You can reuse your favorite Python packages such as NumPy, SciPy, +and Cython to extend PyTorch when needed. + +%package -n python3-%{pypi_name}-devel +Summary: Libraries and headers for %{name} +Requires: python3-%{pypi_name}%{?_isa} = %{version}-%{release} + +%description -n python3-%{pypi_name}-devel +%{summary} + +%if %{with test} +%package -n python3-%{pypi_name}-test +Summary: Tests for %{name} +Requires: python3-%{pypi_name}%{?_isa} = %{version}-%{release} + +%description -n python3-%{pypi_name}-test +%{summary} +%endif + + +%prep +%if %{with gitcommit} +%autosetup -p1 -n pytorch-%{commit0} + +# Remove bundled egg-info +rm -rf %{pypi_name}.egg-info +# Overwrite with a git checkout of the pyproject.toml +cp %{SOURCE1} . +%else +%autosetup -p1 -n pytorch-v%{version} + +# Release comes fully loaded with third party src +# Remove what we can +# +# For 2.1 this is all but miniz-2.1.0 +# Instead of building as a library, caffe2 reaches into +# the third_party dir to compile the file. +# mimiz is licensed MIT +# https://github.com/richgel999/miniz/blob/master/LICENSE +mv third_party/miniz-2.1.0 . +# +# setup.py depends on this script +mv third_party/build_bundled.py . + +%if %{with test} +mv third_party/googletest . +%endif + +# Remove everything +rm -rf third_party/* +# Put stuff back +mv build_bundled.py third_party +mv miniz-2.1.0 third_party +%if %{with test} +mv googletest third_party +%endif +# +# Fake out pocketfft, and system header will be used +mkdir third_party/pocketfft +# +# Use the system valgrind headers +mkdir third_party/valgrind-headers +cp %{_includedir}/valgrind/* third_party/valgrind-headers + +# Remove unneeded OpenCL files that confuse the lincense scanner +rm caffe2/contrib/opencl/OpenCL/cl.hpp +rm caffe2/mobile/contrib/libopencl-stub/include/CL/cl.h +rm caffe2/mobile/contrib/libopencl-stub/include/CL/cl.hpp +rm caffe2/mobile/contrib/libopencl-stub/include/CL/cl_ext.h +rm caffe2/mobile/contrib/libopencl-stub/include/CL/cl_gl.h +rm caffe2/mobile/contrib/libopencl-stub/include/CL/cl_gl_ext.h +rm caffe2/mobile/contrib/libopencl-stub/include/CL/cl_platform.h +rm caffe2/mobile/contrib/libopencl-stub/include/CL/opencl.h + +%endif + +%build + +# For debugging setup.py +# export SETUPTOOLS_SCM_DEBUG=1 + +# For verbose cmake output +# export VERBOSE=ON +# For verbose linking +# export CMAKE_SHARED_LINKER_FLAGS=-Wl,--verbose + +# Manually set this hardening flag +export CMAKE_EXE_LINKER_FLAGS=-pie + +export BUILD_CUSTOM_PROTOBUF=OFF +export BUILD_SHARED_LIBS=ON +%if %{with test} +export BUILD_TEST=ON +%else +export BUILD_TEST=OFF +%endif +export CMAKE_BUILD_TYPE=RelWithDebInfo +export CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON +export CAFFE2_LINK_LOCAL_PROTOBUF=OFF +export USE_CUDA=OFF +export USE_DISTRIBUTED=OFF +export USE_FBGEMM=OFF +export USE_GOLD_LINKER=OFF +export USE_ITT=OFF +export USE_KINETO=OFF +export USE_LITE_INTERPRETER_PROFILER=OFF +export USE_MKLDNN=OFF +export USE_NNPACK=OFF +export USE_NUMPY=ON +export USE_OPENMP=OFF +export USE_PYTORCH_QNNPACK=OFF +export USE_QNNPACK=OFF +export USE_ROCM=OFF +export USE_SYSTEM_LIBS=ON +export USE_TENSORPIPE=OFF +export USE_XNNPACK=ON + +# Why we are using py3_ vs pyproject_ +# +# current pyproject problem with mock +# + /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_wheel.py /builddir/build/BUILD/pytorch-v2.1.0/pyproject-wheeldir +# /usr/bin/python3: No module named pip +# Adding pip to build requires does not fix +# +# See BZ 2244862 +%py3_build + +%install +%py3_install + +# empty files +rm %{buildroot}%{python3_sitearch}/torch/py.typed +rm %{buildroot}%{python3_sitearch}/torch/ao/quantization/backend_config/observation_type.py +rm %{buildroot}%{python3_sitearch}/torch/ao/quantization/backend_config/__pycache__/observation_type.*.pyc +rm %{buildroot}%{python3_sitearch}/torch/cuda/error.py +rm %{buildroot}%{python3_sitearch}/torch/cuda/__pycache__/error.*.pyc +rm %{buildroot}%{python3_sitearch}/torch/include/ATen/cudnn/Exceptions.h + +# exec permission +for f in `find %{buildroot}%{python3_sitearch} -name '*.py'`; do + if [ ! -x $f ]; then + sed -i '1{@^#!/usr/bin@d}' $f + fi +done + +# shebangs +%py3_shebang_fix %{buildroot}%{python3_sitearch} + +# Remove copies of the *.so's +# +# *.so should be symlinks, not copies +# there is a copy of *.so.x.y.z to *.so and *.so.x.y +# remove the copies and do the link +# +%global lib_list c10 shm torch torch_cpu torch_global_deps torch_python +{ + cd %{buildroot}%{python3_sitearch}/torch/lib + for l in %{lib_list} + do + long_name=lib${l}.so.%{version} + short_name=${long_name%.*} + devel_name=lib${l}.so + rm ${short_name} + rm ${devel_name} + ln -s ${long_name} ${short_name} + ln -s ${long_name} ${devel_name} + done + cd - +} + +# Programatically create the list of dirs +echo "s|%{buildroot}%{python3_sitearch}|%%dir %%{python3_sitearch}|g" > br.sed +find %{buildroot}%{python3_sitearch} -mindepth 1 -type d > dirs.files +sed -i -f br.sed dirs.files +cat dirs.files > main.files + +# Similar for the python files +find %{buildroot}%{python3_sitearch} -type f -name "*.py" -o -name "*.pyc" -o -name "*.pyi" > py.files +echo "s|%{buildroot}%{python3_sitearch}|%%{python3_sitearch}|g" > br.sed +sed -i -f br.sed py.files +cat py.files >> main.files + +# devel files, headers and such +find %{buildroot}%{python3_sitearch} -type f -name "*.h" -o -name "*.hpp" -o -name "*.cuh" -o -name "*.cpp" -o -name "*.cu" > devel.files +sed -i -f br.sed devel.files + +# +# Main package +##% dir % {python3_sitearch}/torch*.egg-info + +%files -n python3-%{pypi_name} -f main.files + +%license LICENSE +%doc README.md + +# bins +%{_bindir}/convert-caffe2-to-onnx +%{_bindir}/convert-onnx-to-caffe2 +%{_bindir}/torchrun +%{python3_sitearch}/torch/bin/torch_shm_manager + +# libs +%{python3_sitearch}/functorch/_C.cpython*.so +%{python3_sitearch}/torch/_C.cpython*.so +%{python3_sitearch}/torch/lib/libc10.so.* +%{python3_sitearch}/torch/lib/libshm.so.* +%{python3_sitearch}/torch/lib/libtorch.so.* +%{python3_sitearch}/torch/lib/libtorch_cpu.so.* +%{python3_sitearch}/torch/lib/libtorch_global_deps.so.* +%{python3_sitearch}/torch/lib/libtorch_python.so.* + +# misc +%{python3_sitearch}/torch/utils/model_dump/{*.js,*.mjs,*.html} +%{python3_sitearch}/torchgen/packaged/ATen/native/*.yaml +%{python3_sitearch}/torchgen/packaged/autograd/{*.md,*.yaml} + +# egg +%{python3_sitearch}/torch*.egg-info/* + +# excludes +# bazel build cruft +%exclude %{python3_sitearch}/torchgen/packaged/autograd/{BUILD.bazel,build.bzl} + +# +# devel package +# +%files -n python3-%{pypi_name}-devel -f devel.files + +# devel libs +%{python3_sitearch}/torch/lib/libc10.so +%{python3_sitearch}/torch/lib/libshm.so +%{python3_sitearch}/torch/lib/libtorch.so +%{python3_sitearch}/torch/lib/libtorch_cpu.so +%{python3_sitearch}/torch/lib/libtorch_global_deps.so +%{python3_sitearch}/torch/lib/libtorch_python.so + +# devel cmake +%{python3_sitearch}/torch/share/cmake/{ATen,Caffe2,Torch}/*.cmake +%{python3_sitearch}/torch/share/cmake/Caffe2/public/*.cmake +%{python3_sitearch}/torch/share/cmake/Caffe2/Modules_CUDA_fix/*.cmake +%{python3_sitearch}/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/*.cmake +%{python3_sitearch}/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/*.cmake + +# devel misc +%{python3_sitearch}/torchgen/packaged/ATen/templates/RegisterDispatchDefinitions.ini +%{python3_sitearch}/torchgen/packaged/autograd/templates/annotated_fn_args.py.in + +%if %{with test} +%files -n python3-%{pypi_name}-test + +# test bins +%{python3_sitearch}/torch/bin/test_api +%{python3_sitearch}/torch/bin/test_edge_op_registration +%{python3_sitearch}/torch/bin/test_jit +%{python3_sitearch}/torch/bin/test_lazy +%{python3_sitearch}/torch/bin/test_tensorexpr +%{python3_sitearch}/torch/bin/tutorial_tensorexpr + +# test libs +# Unversioned - not ment for release +%{python3_sitearch}/torch/lib/libbackend_with_compiler.so +%{python3_sitearch}/torch/lib/libjitbackend_test.so +%{python3_sitearch}/torch/lib/libtorchbind_test.so + +# tests +%{python3_sitearch}/torch/test/* + +%endif + +# +# License Details +# Main license BSD 3-Clause +# +# Apache-2.0 +# android/libs/fbjni/LICENSE +# android/libs/fbjni/CMakeLists.txt +# android/libs/fbjni/build.gradle +# android/libs/fbjni/cxx/fbjni/ByteBuffer.cpp +# android/libs/fbjni/cxx/fbjni/ByteBuffer.h +# android/libs/fbjni/cxx/fbjni/Context.h +# android/libs/fbjni/cxx/fbjni/File.h +# android/libs/fbjni/cxx/fbjni/JThread.h +# android/libs/fbjni/cxx/fbjni/NativeRunnable.h +# android/libs/fbjni/cxx/fbjni/OnLoad.cpp +# android/libs/fbjni/cxx/fbjni/ReadableByteChannel.cpp +# android/libs/fbjni/cxx/fbjni/ReadableByteChannel.h +# android/libs/fbjni/cxx/fbjni/detail/Boxed.h +# android/libs/fbjni/cxx/fbjni/detail/Common.h +# android/libs/fbjni/cxx/fbjni/detail/CoreClasses-inl.h +# android/libs/fbjni/cxx/fbjni/detail/CoreClasses.h +# android/libs/fbjni/cxx/fbjni/detail/Environment.cpp +# android/libs/fbjni/cxx/fbjni/detail/Environment.h +# android/libs/fbjni/cxx/fbjni/detail/Exceptions.cpp +# android/libs/fbjni/cxx/fbjni/detail/Exceptions.h +# android/libs/fbjni/cxx/fbjni/detail/FbjniApi.h +# android/libs/fbjni/cxx/fbjni/detail/Hybrid.cpp +# android/libs/fbjni/cxx/fbjni/detail/Hybrid.h +# android/libs/fbjni/cxx/fbjni/detail/Iterator-inl.h +# android/libs/fbjni/cxx/fbjni/detail/Iterator.h +# android/libs/fbjni/cxx/fbjni/detail/JWeakReference.h +# android/libs/fbjni/cxx/fbjni/detail/Log.h +# android/libs/fbjni/cxx/fbjni/detail/Meta-forward.h +# android/libs/fbjni/cxx/fbjni/detail/Meta-inl.h +# android/libs/fbjni/cxx/fbjni/detail/Meta.cpp +# android/libs/fbjni/cxx/fbjni/detail/Meta.h +# android/libs/fbjni/cxx/fbjni/detail/MetaConvert.h +# android/libs/fbjni/cxx/fbjni/detail/ReferenceAllocators-inl.h +# android/libs/fbjni/cxx/fbjni/detail/ReferenceAllocators.h +# android/libs/fbjni/cxx/fbjni/detail/References-forward.h +# android/libs/fbjni/cxx/fbjni/detail/References-inl.h +# android/libs/fbjni/cxx/fbjni/detail/References.cpp +# android/libs/fbjni/cxx/fbjni/detail/References.h +# android/libs/fbjni/cxx/fbjni/detail/Registration-inl.h +# android/libs/fbjni/cxx/fbjni/detail/Registration.h +# android/libs/fbjni/cxx/fbjni/detail/SimpleFixedString.h +# android/libs/fbjni/cxx/fbjni/detail/TypeTraits.h +# android/libs/fbjni/cxx/fbjni/detail/utf8.cpp +# android/libs/fbjni/cxx/fbjni/detail/utf8.h +# android/libs/fbjni/cxx/fbjni/fbjni.cpp +# android/libs/fbjni/cxx/fbjni/fbjni.h +# android/libs/fbjni/cxx/lyra/cxa_throw.cpp +# android/libs/fbjni/cxx/lyra/lyra.cpp +# android/libs/fbjni/cxx/lyra/lyra.h +# android/libs/fbjni/cxx/lyra/lyra_breakpad.cpp +# android/libs/fbjni/cxx/lyra/lyra_exceptions.cpp +# android/libs/fbjni/cxx/lyra/lyra_exceptions.h +# android/libs/fbjni/gradle.properties +# android/libs/fbjni/gradle/android-tasks.gradle +# android/libs/fbjni/gradle/release.gradle +# android/libs/fbjni/gradlew +# android/libs/fbjni/gradlew.bat +# android/libs/fbjni/host.gradle +# android/libs/fbjni/java/com/facebook/jni/CppException.java +# android/libs/fbjni/java/com/facebook/jni/CppSystemErrorException.java +# android/libs/fbjni/java/com/facebook/jni/DestructorThread.java +# android/libs/fbjni/java/com/facebook/jni/HybridClassBase.java +# android/libs/fbjni/java/com/facebook/jni/HybridData.java +# android/libs/fbjni/java/com/facebook/jni/IteratorHelper.java +# android/libs/fbjni/java/com/facebook/jni/MapIteratorHelper.java +# android/libs/fbjni/java/com/facebook/jni/NativeRunnable.java +# android/libs/fbjni/java/com/facebook/jni/ThreadScopeSupport.java +# android/libs/fbjni/java/com/facebook/jni/UnknownCppException.java +# android/libs/fbjni/java/com/facebook/jni/annotations/DoNotStrip.java +# android/libs/fbjni/scripts/android-setup.sh +# android/libs/fbjni/scripts/run-host-tests.sh +# android/libs/fbjni/settings.gradle +# android/libs/fbjni/test/BaseFBJniTests.java +# android/libs/fbjni/test/ByteBufferTests.java +# android/libs/fbjni/test/DocTests.java +# android/libs/fbjni/test/FBJniTests.java +# android/libs/fbjni/test/HybridTests.java +# android/libs/fbjni/test/IteratorTests.java +# android/libs/fbjni/test/PrimitiveArrayTests.java +# android/libs/fbjni/test/ReadableByteChannelTests.java +# android/libs/fbjni/test/jni/CMakeLists.txt +# android/libs/fbjni/test/jni/byte_buffer_tests.cpp +# android/libs/fbjni/test/jni/doc_tests.cpp +# android/libs/fbjni/test/jni/expect.h +# android/libs/fbjni/test/jni/fbjni_onload.cpp +# android/libs/fbjni/test/jni/fbjni_tests.cpp +# android/libs/fbjni/test/jni/hybrid_tests.cpp +# android/libs/fbjni/test/jni/inter_dso_exception_test_1/Test.cpp +# android/libs/fbjni/test/jni/inter_dso_exception_test_1/Test.h +# android/libs/fbjni/test/jni/inter_dso_exception_test_2/Test.cpp +# android/libs/fbjni/test/jni/inter_dso_exception_test_2/Test.h +# android/libs/fbjni/test/jni/iterator_tests.cpp +# android/libs/fbjni/test/jni/modified_utf8_test.cpp +# android/libs/fbjni/test/jni/no_rtti.cpp +# android/libs/fbjni/test/jni/no_rtti.h +# android/libs/fbjni/test/jni/primitive_array_tests.cpp +# android/libs/fbjni/test/jni/readable_byte_channel_tests.cpp +# android/libs/fbjni/test/jni/simple_fixed_string_tests.cpp +# android/libs/fbjni/test/jni/utf16toUTF8_test.cpp +# android/pytorch_android/host/build.gradle +# aten/src/ATen/cuda/llvm_basic.cpp +# aten/src/ATen/cuda/llvm_complex.cpp +# aten/src/ATen/native/quantized/cpu/qnnpack/confu.yaml +# aten/src/ATen/native/quantized/cpu/qnnpack/src/requantization/gemmlowp-neon.c +# aten/src/ATen/native/quantized/cpu/qnnpack/src/requantization/gemmlowp-scalar.h +# aten/src/ATen/native/quantized/cpu/qnnpack/src/requantization/gemmlowp-sse.h +# aten/src/ATen/nnapi/codegen.py +# aten/src/ATen/nnapi/NeuralNetworks.h +# aten/src/ATen/nnapi/nnapi_wrapper.cpp +# aten/src/ATen/nnapi/nnapi_wrapper.h +# binaries/benchmark_args.h +# binaries/benchmark_helper.cc +# binaries/benchmark_helper.h +# binaries/compare_models_torch.cc +# binaries/convert_and_benchmark.cc +# binaries/convert_caffe_image_db.cc +# binaries/convert_db.cc +# binaries/convert_encoded_to_raw_leveldb.cc +# binaries/convert_image_to_tensor.cc +# binaries/core_overhead_benchmark.cc +# binaries/core_overhead_benchmark_gpu.cc +# binaries/db_throughput.cc +# binaries/dump_operator_names.cc +# binaries/inspect_gpu.cc +# binaries/load_benchmark_torch.cc +# binaries/make_cifar_db.cc +# binaries/make_image_db.cc +# binaries/make_mnist_db.cc +# binaries/optimize_for_mobile.cc +# binaries/parallel_info.cc +# binaries/predictor_verifier.cc +# binaries/print_core_object_sizes_gpu.cc +# binaries/print_registered_core_operators.cc +# binaries/run_plan.cc +# binaries/run_plan_mpi.cc +# binaries/speed_benchmark.cc +# binaries/speed_benchmark_torch.cc +# binaries/split_db.cc +# binaries/tsv_2_proto.cc +# binaries/tutorial_blob.cc +# binaries/zmq_feeder.cc +# c10/test/util/small_vector_test.cpp +# c10/util/FunctionRef.h +# c10/util/SmallVector.cpp +# c10/util/SmallVector.h +# c10/util/llvmMathExtras.h +# c10/util/sparse_bitset.h +# caffe2/contrib/aten/gen_op.py +# caffe2/contrib/fakelowp/fp16_fc_acc_op.cc +# caffe2/contrib/fakelowp/fp16_fc_acc_op.h +# caffe2/contrib/gloo/allgather_ops.cc +# caffe2/contrib/gloo/allgather_ops.h +# caffe2/contrib/gloo/reduce_scatter_ops.cc +# caffe2/contrib/gloo/reduce_scatter_ops.h +# caffe2/core/hip/common_miopen.h +# caffe2/core/hip/common_miopen.hip +# caffe2/core/net_async_tracing.cc +# caffe2/core/net_async_tracing.h +# caffe2/core/net_async_tracing_test.cc +# caffe2/experiments/operators/fully_connected_op_decomposition.cc +# caffe2/experiments/operators/fully_connected_op_decomposition.h +# caffe2/experiments/operators/fully_connected_op_decomposition_gpu.cc +# caffe2/experiments/operators/fully_connected_op_prune.cc +# caffe2/experiments/operators/fully_connected_op_prune.h +# caffe2/experiments/operators/fully_connected_op_sparse.cc +# caffe2/experiments/operators/fully_connected_op_sparse.h +# caffe2/experiments/operators/funhash_op.cc +# caffe2/experiments/operators/funhash_op.h +# caffe2/experiments/operators/sparse_funhash_op.cc +# caffe2/experiments/operators/sparse_funhash_op.h +# caffe2/experiments/operators/sparse_matrix_reshape_op.cc +# caffe2/experiments/operators/sparse_matrix_reshape_op.h +# caffe2/experiments/operators/tt_contraction_op.cc +# caffe2/experiments/operators/tt_contraction_op.h +# caffe2/experiments/operators/tt_contraction_op_gpu.cc +# caffe2/experiments/operators/tt_pad_op.cc +# caffe2/experiments/operators/tt_pad_op.h +# caffe2/experiments/python/SparseTransformer.py +# caffe2/experiments/python/convnet_benchmarks.py +# caffe2/experiments/python/device_reduce_sum_bench.py +# caffe2/experiments/python/funhash_op_test.py +# caffe2/experiments/python/net_construct_bench.py +# caffe2/experiments/python/sparse_funhash_op_test.py +# caffe2/experiments/python/sparse_reshape_op_test.py +# caffe2/experiments/python/tt_contraction_op_test.py +# caffe2/experiments/python/tt_pad_op_test.py +# caffe2/mobile/contrib/libvulkan-stub/include/vulkan/vk_platform.h +# caffe2/mobile/contrib/libvulkan-stub/include/vulkan/vulkan.h +# caffe2/mobile/contrib/nnapi/NeuralNetworks.h +# caffe2/mobile/contrib/nnapi/dlnnapi.c +# caffe2/mobile/contrib/nnapi/nnapi_benchmark.cc +# caffe2/observers/profile_observer.cc +# caffe2/observers/profile_observer.h +# caffe2/operators/hip/conv_op_miopen.hip +# caffe2/operators/hip/local_response_normalization_op_miopen.hip +# caffe2/operators/hip/pool_op_miopen.hip +# caffe2/operators/hip/spatial_batch_norm_op_miopen.hip +# caffe2/operators/quantized/int8_utils.h +# caffe2/operators/stump_func_op.cc +# caffe2/operators/stump_func_op.cu +# caffe2/operators/stump_func_op.h +# caffe2/operators/unique_ops.cc +# caffe2/operators/unique_ops.cu +# caffe2/operators/unique_ops.h +# caffe2/operators/upsample_op.cc +# caffe2/operators/upsample_op.h +# caffe2/opt/fusion.h +# caffe2/python/layers/label_smooth.py +# caffe2/python/mint/static/css/simple-sidebar.css +# caffe2/python/modeling/get_entry_from_blobs.py +# caffe2/python/modeling/get_entry_from_blobs_test.py +# caffe2/python/modeling/gradient_clipping_test.py +# caffe2/python/operator_test/unique_ops_test.py +# caffe2/python/operator_test/upsample_op_test.py +# caffe2/python/operator_test/weight_scale_test.py +# caffe2/python/pybind_state_int8.cc +# caffe2/python/transformations.py +# caffe2/python/transformations_test.py +# caffe2/quantization/server/batch_matmul_dnnlowp_op.cc +# caffe2/quantization/server/batch_matmul_dnnlowp_op.h +# caffe2/quantization/server/compute_equalization_scale_test.py +# caffe2/quantization/server/elementwise_linear_dnnlowp_op.cc +# caffe2/quantization/server/elementwise_linear_dnnlowp_op.h +# caffe2/quantization/server/elementwise_sum_relu_op.cc +# caffe2/quantization/server/fb_fc_packed_op.cc +# caffe2/quantization/server/fb_fc_packed_op.h +# caffe2/quantization/server/fbgemm_fp16_pack_op.cc +# caffe2/quantization/server/fbgemm_fp16_pack_op.h +# caffe2/quantization/server/fully_connected_fake_lowp_op.cc +# caffe2/quantization/server/fully_connected_fake_lowp_op.h +# caffe2/quantization/server/int8_gen_quant_params_min_max_test.py +# caffe2/quantization/server/int8_gen_quant_params_test.py +# caffe2/quantization/server/int8_quant_scheme_blob_fill_test.py +# caffe2/quantization/server/spatial_batch_norm_relu_op.cc +# caffe2/sgd/weight_scale_op.cc +# caffe2/sgd/weight_scale_op.h +# caffe2/utils/bench_utils.h +# functorch/examples/maml_omniglot/maml-omniglot-higher.py +# functorch/examples/maml_omniglot/maml-omniglot-ptonly.py +# functorch/examples/maml_omniglot/maml-omniglot-transforms.py +# functorch/examples/maml_omniglot/support/omniglot_loaders.py +# modules/detectron/group_spatial_softmax_op.cc +# modules/detectron/group_spatial_softmax_op.cu +# modules/detectron/group_spatial_softmax_op.h +# modules/detectron/ps_roi_pool_op.cc +# modules/detectron/ps_roi_pool_op.h +# modules/detectron/roi_pool_f_op.cc +# modules/detectron/roi_pool_f_op.cu +# modules/detectron/roi_pool_f_op.h +# modules/detectron/sample_as_op.cc +# modules/detectron/sample_as_op.cu +# modules/detectron/sample_as_op.h +# modules/detectron/select_smooth_l1_loss_op.cc +# modules/detectron/select_smooth_l1_loss_op.cu +# modules/detectron/select_smooth_l1_loss_op.h +# modules/detectron/sigmoid_cross_entropy_loss_op.cc +# modules/detectron/sigmoid_cross_entropy_loss_op.cu +# modules/detectron/sigmoid_cross_entropy_loss_op.h +# modules/detectron/sigmoid_focal_loss_op.cc +# modules/detectron/sigmoid_focal_loss_op.cu +# modules/detectron/sigmoid_focal_loss_op.h +# modules/detectron/smooth_l1_loss_op.cc +# modules/detectron/smooth_l1_loss_op.cu +# modules/detectron/smooth_l1_loss_op.h +# modules/detectron/softmax_focal_loss_op.cc +# modules/detectron/softmax_focal_loss_op.cu +# modules/detectron/softmax_focal_loss_op.h +# modules/detectron/spatial_narrow_as_op.cc +# modules/detectron/spatial_narrow_as_op.cu +# modules/detectron/spatial_narrow_as_op.h +# modules/detectron/upsample_nearest_op.cc +# modules/detectron/upsample_nearest_op.h +# modules/module_test/module_test_dynamic.cc +# modules/rocksdb/rocksdb.cc +# scripts/apache_header.txt +# scripts/apache_python.txt +# torch/distributions/lkj_cholesky.py +# +# Apache 2.0 AND BSD 2-Clause +# caffe2/operators/deform_conv_op.cu +# +# Apache 2.0 AND BSD 2-Clause AND MIT +# modules/detectron/ps_roi_pool_op.cu +# +# Apache 2.0 AND BSD 2-Clause +# modules/detectron/upsample_nearest_op.cu +# +# BSD 0-Clause +# torch/csrc/utils/pythoncapi_compat.h +# +# BSD 2-Clause +# aten/src/ATen/native/quantized/cpu/qnnpack/deps/clog/LICENSE +# caffe2/image/transform_gpu.cu +# caffe2/image/transform_gpu.h +# +# BSL-1.0 +# c10/util/flat_hash_map.h +# c10/util/hash.h +# c10/util/Optional.h +# c10/util/order_preserving_flat_hash_map.h +# c10/util/strong_type.h +# c10/util/variant.h +# +# GPL-3.0-or-later AND MIT +# c10/util/reverse_iterator.h +# +# Khronos +# These files are for OpenCL, an unused option +# Replace them later, as-needed with the opencl-headers.rpm +# +# caffe2/contrib/opencl/OpenCL/cl.hpp +# caffe2/mobile/contrib/libopencl-stub/include/CL/cl.h +# caffe2/mobile/contrib/libopencl-stub/include/CL/cl.hpp +# caffe2/mobile/contrib/libopencl-stub/include/CL/cl_ext.h +# caffe2/mobile/contrib/libopencl-stub/include/CL/cl_gl.h +# caffe2/mobile/contrib/libopencl-stub/include/CL/cl_gl_ext.h +# caffe2/mobile/contrib/libopencl-stub/include/CL/cl_platform.h +# caffe2/mobile/contrib/libopencl-stub/include/CL/opencl.h +# +# MIT +# android/libs/fbjni/googletest-CMakeLists.txt.in +# c10/util/BFloat16-math.h +# caffe2/mobile/contrib/libvulkan-stub/include/libvulkan-stub.h +# caffe2/mobile/contrib/libvulkan-stub/src/libvulkan-stub.c +# caffe2/onnx/torch_ops/defs.cc +# cmake/Modules_CUDA_fix/upstream/FindCUDA/make2cmake.cmake +# cmake/Modules_CUDA_fix/upstream/FindCUDA/parse_cubin.cmake +# cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake +# functorch/einops/_parsing.py +# test/functorch/test_parsing.py +# test/functorch/test_rearrange.py +# third_party/miniz-2.1.0/LICENSE +# third_party/miniz-2.1.0/miniz.c +# tools/coverage_plugins_package/setup.py +# torch/_appdirs.py +# torch/utils/hipify/hipify_python.py +# +# Public Domain +# caffe2/mobile/contrib/libopencl-stub/LICENSE +# caffe2/utils/murmur_hash3.cc +# caffe2/utils/murmur_hash3.h +# +# Zlib +# aten/src/ATen/native/cpu/avx_mathfun.h + +%changelog +* Fri Dec 1 2023 Tom Rix trix@redhat.com - 2.1.0-10 +- Disable gold linker +- Remove python requires +- Change to openblas, remove -lgfortran fixes +- Manually add -pie to linking options + +* Fri Nov 24 2023 Tom Rix trix@redhat.com - 2.1.0-9 +- Enable debug build +- Remove Khronos licensed files from source +- Use 0BSD license identifier +- Generate lists directories, python and header files +- Add a -test subpackage + +* Wed Nov 15 2023 Tom Rix trix@redhat.com - 2.1.0-8 +- Address review comments + +* Thu Nov 2 2023 Tom Rix trix@redhat.com - 2.1.0-7 +- Address review comments +- remove pyproject option + +* Thu Oct 19 2023 Tom Rix trix@redhat.com - 2.1.0-6 +- Address review comments + +* Wed Oct 18 2023 Tom Rix trix@redhat.com - 2.1.0-5 +- Address review comments + +* Sat Oct 14 2023 Tom Rix trix@redhat.com - 2.1.0-4 +- Use gloo, xnnpack +- Find missing build_bundled.py +- Add pyproject option + +* Thu Oct 12 2023 Tom Rix trix@redhat.com - 2.1.0-3 +- Address review comments +- Force so versioning on + +* Mon Oct 9 2023 Tom Rix trix@redhat.com - 2.1.0-2 +- Use the 2.1 release +- Reduce USE_SYSTEM_LIBS to parts +- Remove almost all of third_party/ +- Remove py2rpm generated noise + +* Sat Sep 30 2023 Tom Rix trix@redhat.com - 2.1.0-1 +- Initial package. + diff --git a/sources b/sources new file mode 100644 index 0000000..9d3d165 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (pytorch-v2.1.0.tar.gz) = 59421bf6cea6661d61ed66ab16526e3a07162e70e53381cbd5987042917610ec993d2f151fb086f0f98e5a396fe69e82bbc76f840bebffe4ebe7f50458c3aa44
arch-excludes@lists.fedoraproject.org