Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix_gcc12_error #52007

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cmake/external/eigen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ elseif(LINUX)
endif()
endif()

if(CMAKE_COMPILER_IS_GNUCC)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpfullversion -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
string(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${GCC_VERSION})
list(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR)
list(GET GCC_VERSION_COMPONENTS 1 GCC_MINOR)
set(GCC_VERSION "${GCC_MAJOR}.${GCC_MINOR}")
if(GCC_VERSION GREATER_EQUAL "12.0")
file(TO_NATIVE_PATH ${PADDLE_SOURCE_DIR}/patches/eigen/Complex.h.patch
complex_header)
set(EIGEN_PATCH_COMMAND
patch -d ${EIGEN_SOURCE_DIR}/Eigen/src/Core/arch/SSE/ <
${complex_header})
endif()
endif()

set(EIGEN_INCLUDE_DIR ${EIGEN_SOURCE_DIR})
include_directories(${EIGEN_INCLUDE_DIR})

Expand Down
2 changes: 1 addition & 1 deletion paddle/phi/infermeta/multiary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,7 @@ void MultiDotInferMeta(const std::vector<const MetaTensor*>& x,
: phi::make_ddim({first_dim[0], last_dim[1]});
}

auto width = first_dim[1];
auto width = first_dim.at(1);
for (size_t i = 1; i < n - 1; i++) {
PADDLE_ENFORCE_EQ(inputs_dims[i].size(),
static_cast<size_t>(2),
Expand Down
13 changes: 13 additions & 0 deletions patches/eigen/Complex.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Eigen/src/Core/arch/SSE/Complex.h b/Eigen/src/Core/arch/SSE/Complex.h
index f6f1b8c..2f4e7d1 100644
--- a/Eigen/src/Core/arch/SSE/Complex.h
+++ b/Eigen/src/Core/arch/SSE/Complex.h
@@ -17,7 +17,7 @@ namespace internal {
//---------- float ----------
struct Packet2cf
{
- EIGEN_STRONG_INLINE Packet2cf() {}
+ EIGEN_STRONG_INLINE Packet2cf() :v(_mm_setzero_ps()) {}
EIGEN_STRONG_INLINE explicit Packet2cf(const __m128& a) : v(a) {}
__m128 v;
};