diff --git a/cmake/external/eigen.cmake b/cmake/external/eigen.cmake index 31280a768b3a89d22308ee48752ed2525ae977d2..12ccf5df27cae6f0846edc0552d099c764e5f686 100644 --- a/cmake/external/eigen.cmake +++ b/cmake/external/eigen.cmake @@ -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}) diff --git a/paddle/phi/infermeta/multiary.cc b/paddle/phi/infermeta/multiary.cc index 5cd480f425a7266c5340b36ef4f02a52fdadfa4c..73e0ff975d9f0af736b5fbb95010b272399664ef 100644 --- a/paddle/phi/infermeta/multiary.cc +++ b/paddle/phi/infermeta/multiary.cc @@ -2231,7 +2231,7 @@ void MultiDotInferMeta(const std::vector& 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(2), diff --git a/patches/eigen/Complex.h.patch b/patches/eigen/Complex.h.patch new file mode 100644 index 0000000000000000000000000000000000000000..140e4ba84094007d62f38863de52dd5c79303fd7 --- /dev/null +++ b/patches/eigen/Complex.h.patch @@ -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; + };