diff --git a/0003-Add-arch-support-for-third_party.patch b/0003-Add-arch-support-for-third_party.patch new file mode 100644 index 0000000000000000000000000000000000000000..c83e32907549bdd1b8fd9d33926b7fbcfcfed885 --- /dev/null +++ b/0003-Add-arch-support-for-third_party.patch @@ -0,0 +1,81 @@ +From bf061194b75ea099a9caa19c589d7b890808742e Mon Sep 17 00:00:00 2001 +From: pangqing +Date: Tue, 25 Mar 2025 11:17:09 +0800 +Subject: [PATCH] Add sw support for third_party + +--- + third_party/benchmark/src/cycleclock.h | 2 +- + .../third_party/onnx/third_party/benchmark/src/cycleclock.h | 2 +- + third_party/onnx/third_party/benchmark/src/cycleclock.h | 2 +- + third_party/protobuf/third_party/benchmark/src/cycleclock.h | 2 +- + third_party/sleef/src/arch/helperpurec_scalar.h | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/third_party/benchmark/src/cycleclock.h b/third_party/benchmark/src/cycleclock.h +index d65d32a3..a5077a18 100644 +--- a/third_party/benchmark/src/cycleclock.h ++++ b/third_party/benchmark/src/cycleclock.h +@@ -208,7 +208,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() { + asm volatile("rdcycle %0" : "=r"(cycles)); + return cycles; + #endif +-#elif defined(__e2k__) || defined(__elbrus__) ++#elif defined(__e2k__) || defined(__elbrus__) || defined(__sw_64) + struct timeval tv; + gettimeofday(&tv, nullptr); + return static_cast(tv.tv_sec) * 1000000 + tv.tv_usec; +diff --git a/third_party/onnx-tensorrt/third_party/onnx/third_party/benchmark/src/cycleclock.h b/third_party/onnx-tensorrt/third_party/onnx/third_party/benchmark/src/cycleclock.h +index 3b376ac5..b620ad0c 100644 +--- a/third_party/onnx-tensorrt/third_party/onnx/third_party/benchmark/src/cycleclock.h ++++ b/third_party/onnx-tensorrt/third_party/onnx/third_party/benchmark/src/cycleclock.h +@@ -153,7 +153,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() { + struct timeval tv; + gettimeofday(&tv, nullptr); + return static_cast(tv.tv_sec) * 1000000 + tv.tv_usec; +-#elif defined(__mips__) ++#elif defined(__mips__) || defined(__sw_64) + // mips apparently only allows rdtsc for superusers, so we fall + // back to gettimeofday. It's possible clock_gettime would be better. + struct timeval tv; +diff --git a/third_party/onnx/third_party/benchmark/src/cycleclock.h b/third_party/onnx/third_party/benchmark/src/cycleclock.h +index d65d32a3..317912f8 100644 +--- a/third_party/onnx/third_party/benchmark/src/cycleclock.h ++++ b/third_party/onnx/third_party/benchmark/src/cycleclock.h +@@ -208,7 +208,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() { + asm volatile("rdcycle %0" : "=r"(cycles)); + return cycles; + #endif +-#elif defined(__e2k__) || defined(__elbrus__) ++#elif defined(__e2k__) || defined(__elbrus__) || defined(__sw_64) + struct timeval tv; + gettimeofday(&tv, nullptr); + return static_cast(tv.tv_sec) * 1000000 + tv.tv_usec; +diff --git a/third_party/protobuf/third_party/benchmark/src/cycleclock.h b/third_party/protobuf/third_party/benchmark/src/cycleclock.h +index 4251fe4c..a9077c36 100644 +--- a/third_party/protobuf/third_party/benchmark/src/cycleclock.h ++++ b/third_party/protobuf/third_party/benchmark/src/cycleclock.h +@@ -153,7 +153,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() { + struct timeval tv; + gettimeofday(&tv, nullptr); + return static_cast(tv.tv_sec) * 1000000 + tv.tv_usec; +-#elif defined(__mips__) ++#elif defined(__mips__) || defined(__sw_64) + // mips apparently only allows rdtsc for superusers, so we fall + // back to gettimeofday. It's possible clock_gettime would be better. + struct timeval tv; +diff --git a/third_party/sleef/src/arch/helperpurec_scalar.h b/third_party/sleef/src/arch/helperpurec_scalar.h +index e77e518f..8ae57f31 100644 +--- a/third_party/sleef/src/arch/helperpurec_scalar.h ++++ b/third_party/sleef/src/arch/helperpurec_scalar.h +@@ -54,7 +54,7 @@ + #define ENABLE_FMA_SP + //@#define ENABLE_FMA_SP + +-#if defined(__AVX2__) || defined(__aarch64__) || defined(__arm__) || defined(__powerpc64__) || defined(__zarch__) || CONFIG == 3 ++#if defined(__AVX2__) || defined(__aarch64__) || defined(__arm__) || defined(__powerpc64__) || defined(__zarch__) || defined(__sw_64) || CONFIG == 3 + #ifndef FP_FAST_FMA + #define FP_FAST_FMA + //@#define FP_FAST_FMA +-- +2.39.3 + diff --git a/pytorch.spec b/pytorch.spec index c04ea59aa98c919ed22e036fcf9f6e5e159d6002..cc6adb85178856f90fc39c1022a401458e5c40ed 100644 --- a/pytorch.spec +++ b/pytorch.spec @@ -1,4 +1,4 @@ -%define anolis_release 4 +%define anolis_release 5 %global vcu_maj 12 %global vcu_min 1 @@ -18,6 +18,7 @@ License: BSD URL: https://pytorch.org Source0: https://github.com/pytorch/pytorch/releases/download/v%{version}/pytorch-v%{version}.tar.gz Patch0: 0001-Workaround-NVCC-parse-failure-in-cast_op.patch +Patch1: 0003-Add-arch-support-for-third_party.patch BuildRequires: python3-devel cmake gcc-c++ BuildRequires: python3-typing-extensions python3-pyyaml python3-setuptools @@ -69,6 +70,7 @@ This package contains development files for pythorch. %prep %setup -q -n %{name}-v%{version} %patch0 -p1 +%patch1 -p1 %build @@ -136,6 +138,9 @@ end %{python3_sitearch}/torch/share %changelog +* Tue Mar 25 2025 pangqing - 2.0.1-5 +- Add third arch support + * Thu Nov 2 2023 Zhongling He - 2.0.1-4 - fix NVCC parse failure in cast_op