aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-framework/tensorflow/files/0001-third_party-eigen_archive-workaround-ice-failure-whi.patch
blob: b1571ab11e06ae6831fd0c2621d52798181ac457 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
From 385074d9300c18293a42c9d8ca9fb12cbffccb80 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Mon, 16 May 2022 23:15:47 -0700
Subject: [PATCH] third_party/eigen_archive:workaround ice failure while
 building from source with gcc 7.3.1

The root cause is gcc ice issue:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89752

But we could not patch on native gcc,so try to workaround,
Refer: https://github.com/tensorflow/tensorflow/issues/25323

Upstream-Status: Inappropriate [wr-installer specific]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 ...ailure-while-building-from-source-wi.patch | 69 +++++++++++++++++++
 third_party/eigen3/workspace.bzl              |  1 +
 2 files changed, 70 insertions(+)
 create mode 100644 third_party/eigen3/0001-workaround-ice-failure-while-building-from-source-wi.patch

diff --git a/third_party/eigen3/0001-workaround-ice-failure-while-building-from-source-wi.patch b/third_party/eigen3/0001-workaround-ice-failure-while-building-from-source-wi.patch
new file mode 100644
index 00000000000..436f35fca13
--- /dev/null
+++ b/third_party/eigen3/0001-workaround-ice-failure-while-building-from-source-wi.patch
@@ -0,0 +1,69 @@
+From 035fd96026e18d61c19da038ab2b0f7a61e97799 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Mon, 19 Sep 2022 01:08:18 -0700
+Subject: [PATCH] workaround ice failure while building from source with gcc
+ 7.3.1
+
+The root cause is gcc ice issue:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89752
+
+But we could not patch on native gcc,so try to workaround,
+Refer: https://github.com/tensorflow/tensorflow/issues/25323
+
+Upstream-Status: Inappropriate [wr-installer specific]
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h | 3 ++-
+ unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h  | 9 ++++++---
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h b/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h
+index a9b281f..ec570d6 100644
+--- a/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h
++++ b/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h
+@@ -544,7 +544,8 @@ struct TensorEvaluator<const TensorImagePatchOp<Rows, Cols, ArgType>, Device>
+     EIGEN_ALIGN_MAX std::remove_const_t<CoeffReturnType> values[PacketSize];
+     EIGEN_UNROLL_LOOP
+     for (int i = 0; i < PacketSize; ++i) {
+-      values[i] = coeff(index+i);
++      Self::CoeffReturnType a = coeff(index+i);
++      values[i] = a;
+     }
+     PacketReturnType rslt = internal::pload<PacketReturnType>(values);
+     return rslt;
+diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h b/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h
+index e62397a..fcd44c3 100644
+--- a/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h
++++ b/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h
+@@ -850,8 +850,9 @@ static constexpr bool RunningOnGPU = false;
+       const Index firstIndex = firstInput(index);
+       for (Index i = 0; i < PacketSize; ++i) {
+         Op reducer(m_reducer);
+-        values[i] = internal::InnerMostDimReducer<Self, Op>::reduce(*this, firstIndex + i * num_values_to_reduce,
++        Self::CoeffReturnType a = internal::InnerMostDimReducer<Self, Op>::reduce(*this, firstIndex + i * num_values_to_reduce,
+                                                                     num_values_to_reduce, reducer);
++        values[i] = a;
+       }
+     } else if (PreservingInnerMostDims) {
+       const Index firstIndex = firstInput(index);
+@@ -864,12 +865,14 @@ static constexpr bool RunningOnGPU = false;
+         return reducer.finalizePacket(accum);
+       } else {
+         for (int i = 0; i < PacketSize; ++i) {
+-          values[i] = coeff(index + i);
++          Self::CoeffReturnType a = coeff(index + i);
++          values[i] = a;
+         }
+       }
+     } else {
+       for (int i = 0; i < PacketSize; ++i) {
+-        values[i] = coeff(index + i);
++        Self::CoeffReturnType a = coeff(index + i);
++        values[i] = a;
+       }
+     }
+     PacketReturnType rslt = internal::pload<PacketReturnType>(values);
+-- 
+2.37.1
+
diff --git a/third_party/eigen3/workspace.bzl b/third_party/eigen3/workspace.bzl
index 1380722ee67..722cfbece83 100644
--- a/third_party/eigen3/workspace.bzl
+++ b/third_party/eigen3/workspace.bzl
@@ -14,6 +14,7 @@ def repo():
     tf_http_archive(
         name = "eigen_archive",
         build_file = "//third_party/eigen3:eigen_archive.BUILD",
+        patch_file = ["//third_party/eigen3:0001-workaround-ice-failure-while-building-from-source-wi.patch"],
         sha256 = EIGEN_SHA256,
         strip_prefix = "eigen-{commit}".format(commit = EIGEN_COMMIT),
         urls = tf_mirror_urls("https://gitlab.com/libeigen/eigen/-/archive/{commit}/eigen-{commit}.tar.gz".format(commit = EIGEN_COMMIT)),
-- 
2.37.1