Skip to content

Commit e860204

Browse files
author
trixirt
authored
Merge pull request #7 from jmontleon/fix-ppc64le-builds
Fix ppc64le builds
2 parents f26f19a + 5332a7f commit e860204

File tree

4 files changed

+143
-10
lines changed

4 files changed

+143
-10
lines changed

do-not-force-Werror-on-Pooling.patch

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
From 7308e5359edc9e9ebd8466ee7ab0f48be1583a3f Mon Sep 17 00:00:00 2001
2+
From: Nikita Shulga <[email protected]>
3+
Date: Fri, 28 Jul 2023 07:08:59 -0700
4+
Subject: [PATCH] Do not force -Werror on Pooling.cpp
5+
6+
As new versions of compilers are likely find new types of violation s as shown in https://github.com/pytorch/pytorch/issues/105728
7+
---
8+
caffe2/CMakeLists.txt | 2 --
9+
1 file changed, 2 deletions(-)
10+
11+
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
12+
index cc6ecdc7415f67..955bc67e2299c9 100644
13+
--- a/caffe2/CMakeLists.txt
14+
+++ b/caffe2/CMakeLists.txt
15+
@@ -530,8 +530,6 @@ endif()
16+
# Required workaround for LLVM 9 includes.
17+
if(NOT MSVC)
18+
set_source_files_properties(${TORCH_SRC_DIR}/csrc/jit/tensorexpr/llvm_jit.cpp PROPERTIES COMPILE_FLAGS -Wno-noexcept-type)
19+
- # Force -Werror on several files
20+
- set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/../aten/src/ATen/native/mkldnn/Pooling.cpp PROPERTIES COMPILE_FLAGS "-Werror")
21+
endif()
22+
# Disable certain warnings for GCC-9.X
23+
if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0.0))

fallback-to-cpu_kernel-for-VSX.patch

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
diff --git a/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int16_vsx.h b/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int16_vsx.h
2+
index 7c300c8087cff2..a71f50fc7aaa30 100644
3+
--- a/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int16_vsx.h
4+
+++ b/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int16_vsx.h
5+
@@ -334,6 +334,20 @@ class Vectorized<int16_t> {
6+
DEFINE_MEMBER_OP(operator^, int16_t, vec_xor)
7+
};
8+
9+
+template <>
10+
+Vectorized<int16_t> inline operator<<(const Vectorized<int16_t>& a, const Vectorized<int16_t>& b) {
11+
+ vuint16 shift_vec0 = reinterpret_cast<vuint16>(b.vec0());
12+
+ vuint16 shift_vec1 = reinterpret_cast<vuint16>(b.vec1());
13+
+ return Vectorized<int16_t>{vec_sl(a.vec0(), shift_vec0), vec_sl(a.vec1(), shift_vec1)};
14+
+}
15+
+
16+
+template <>
17+
+Vectorized<int16_t> inline operator>>(const Vectorized<int16_t>& a, const Vectorized<int16_t>& b) {
18+
+ vuint16 shift_vec0 = reinterpret_cast<vuint16>(b.vec0());
19+
+ vuint16 shift_vec1 = reinterpret_cast<vuint16>(b.vec1()) ;
20+
+ return Vectorized<int16_t>{vec_sr(a.vec0(), shift_vec0), vec_sr(a.vec1(), shift_vec1)};
21+
+}
22+
+
23+
template <>
24+
Vectorized<int16_t> inline maximum(
25+
const Vectorized<int16_t>& a,
26+
diff --git a/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int32_vsx.h b/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int32_vsx.h
27+
index c98ab6215e6206..1b6a82df39b530 100644
28+
--- a/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int32_vsx.h
29+
+++ b/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int32_vsx.h
30+
@@ -265,6 +265,20 @@ class Vectorized<int32_t> {
31+
DEFINE_MEMBER_OP(operator^, int32_t, vec_xor)
32+
};
33+
34+
+template <>
35+
+Vectorized<int32_t> inline operator<<(const Vectorized<int32_t>& a, const Vectorized<int32_t>& b) {
36+
+ vuint32 shift_vec0 = reinterpret_cast<vuint32>(b.vec0());
37+
+ vuint32 shift_vec1 = reinterpret_cast<vuint32>(b.vec1()) ;
38+
+ return Vectorized<int32_t>{vec_sl(a.vec0(), shift_vec0), vec_sl(a.vec1(), shift_vec1)};
39+
+}
40+
+
41+
+template <>
42+
+Vectorized<int32_t> inline operator>>(const Vectorized<int32_t>& a, const Vectorized<int32_t>& b) {
43+
+ vuint32 shift_vec0 = reinterpret_cast<vuint32>(b.vec0());
44+
+ vuint32 shift_vec1 = reinterpret_cast<vuint32>(b.vec1()) ;
45+
+ return Vectorized<int32_t>{vec_sr(a.vec0(), shift_vec0), vec_sr(a.vec1(), shift_vec1)};
46+
+}
47+
+
48+
template <>
49+
Vectorized<int32_t> inline maximum(
50+
const Vectorized<int32_t>& a,
51+
diff --git a/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int64_vsx.h b/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int64_vsx.h
52+
index a4171026a2b99f..a7a376ee16ec54 100644
53+
--- a/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int64_vsx.h
54+
+++ b/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int64_vsx.h
55+
@@ -217,6 +217,20 @@ class Vectorized<int64_t> {
56+
DEFINE_MEMBER_OP(operator^, int64_t, vec_xor)
57+
};
58+
59+
+template <>
60+
+Vectorized<int64_t> inline operator<<(const Vectorized<int64_t>& a, const Vectorized<int64_t>& b) {
61+
+ vuint64 shift_vec0 = reinterpret_cast<vuint64>(b.vec0());
62+
+ vuint64 shift_vec1 = reinterpret_cast<vuint64>(b.vec1()) ;
63+
+ return Vectorized<int64_t>{vec_sl(a.vec0(), shift_vec0), vec_sl(a.vec1(), shift_vec1)};
64+
+}
65+
+
66+
+template <>
67+
+Vectorized<int64_t> inline operator>>(const Vectorized<int64_t>& a, const Vectorized<int64_t>& b) {
68+
+ vuint64 shift_vec0 = reinterpret_cast<vuint64>(b.vec0());
69+
+ vuint64 shift_vec1 = reinterpret_cast<vuint64>(b.vec1()) ;
70+
+ return Vectorized<int64_t>{vec_sr(a.vec0(), shift_vec0), vec_sr(a.vec1(), shift_vec1)};
71+
+}
72+
+
73+
template <>
74+
Vectorized<int64_t> inline maximum(
75+
const Vectorized<int64_t>& a,

fix-cpuinfo-implicit-syscall.patch

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
commit 9319defe0ec044dddb3ecec80a798935716807fb
2+
Author: Jason Montleon <[email protected]>
3+
Date: Fri Aug 4 11:06:20 2023 -0400
4+
5+
Fix implicit syscall on ppc64le and aarch64
6+
7+
diff --git a/third_party/cpuinfo/src/api.c b/third_party/cpuinfo/src/api.c
8+
index f91b421..a560938 100644
9+
--- a/third_party/cpuinfo/src/api.c
10+
+++ b/third_party/cpuinfo/src/api.c
11+
@@ -1,3 +1,4 @@
12+
+#define _GNU_SOURCE
13+
#include <stdbool.h>
14+
#include <stddef.h>
15+

pytorch.spec

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
%global debug_package %{nil}
2-
%global _clang_lto_cflags -flto=thin
2+
3+
%bcond_with python
4+
%bcond_with toolchain_clang
5+
%bcond_without cpuinfo
6+
7+
%if %{with toolchain_clang}
38
%global toolchain clang
9+
%global _clang_lto_cflags -flto=thin
10+
%else
11+
%global toolchain gcc
12+
%endif
413

514
Summary: An AI/ML python package
615
Name: pytorch
716
License: TBD
8-
# Version: 2.0.1.gitf81f9093 - broken download
917
Version: 2.0.1
10-
Release: 6%{?dist}
18+
Release: 7%{?dist}
1119

1220
URL: https://github.com/pytorch/pytorch
1321
Source0: %{url}/releases/download/v%{version}/%{name}-v%{version}.tar.gz
1422
Patch0: 0001-Include-stdexcept.patch
1523
Patch1: 0001-Include-stdint.h.patch
16-
# Patch2: fix-cpuinfo-implicit-syscall.patch - missing from commit
17-
18-
%bcond_without cpuinfo
19-
%bcond_with python
24+
Patch2: fix-cpuinfo-implicit-syscall.patch
25+
Patch3: do-not-force-Werror-on-Pooling.patch
26+
Patch4: fallback-to-cpu_kernel-for-VSX.patch
2027

2128
%if 0%{?fedora}
2229
BuildRequires: blas-static
@@ -119,8 +126,13 @@ ulimit -n 2048
119126
%{_includedir}/cpuinfo.h
120127
%endif
121128

129+
%if %{without cpuinfo}
122130
%{_libdir}/libclog.a
123-
131+
%else
132+
%ifarch x86_64 aarch64
133+
%{_libdir}/libclog.a
134+
%endif
135+
%endif
124136

125137
%ifarch x86_64 aarch64
126138
# pthreadpool
@@ -137,9 +149,13 @@ ulimit -n 2048
137149
%{_includedir}/torch
138150
%{_includedir}/caffe2
139151

140-
# FIXME: coming from third_party
141-
# cpuinfo
152+
%if %{without cpuinfo}
153+
%{_libdir}/libclog.a
154+
%else
155+
%ifarch x86_64 aarch64
142156
%{_includedir}/clog.h
157+
%endif
158+
%endif
143159

144160
# FP16
145161
%{_includedir}/fp16.h
@@ -163,6 +179,10 @@ ulimit -n 2048
163179
%endif
164180

165181
%changelog
182+
* Sat Aug 05 2023 Jason Montleon <[email protected]> - 2.0.1-7
183+
- Fix ppc64le builds
184+
- Add option to build with gcc or clang, default to gcc for sake of ppc64le
185+
166186
* Sat Aug 05 2023 Tom Rix <[email protected]> - 2.0.1-6
167187
- Use cpuinfo, sleef
168188

0 commit comments

Comments
 (0)