启用AVX时的Eigen 3.3编译错误

时间:2016-11-23 13:54:15

标签: c++ eigen avx eigen3

我今天克隆了Eigen(hg clone https://bitbucket.org/eigen/eigen/)以获得Eigen 3.3。我无法使用AVX扩展。添加标志 -march = native -mavx 时,我在VERBOSE=1 make check上得到以下输出(我自己的想法如下)

[  0%] Building CXX object unsupported/test/CMakeFiles/cxx11_tensor_io.dir/cxx11_tensor_io.cpp.o
cd /home/username/code/eigen/build/unsupported/test && /usr/bin/c++    -mavx -pedantic -Wall -Wextra -Wundef -Wcast-align -Wchar-subscripts -Wnon-virtual-dtor -Wunused-local-typedefs -Wpointer-arith -Wwrite-strings -Wformat-security -Wlogical-op -Wdouble-promotion -Wno-psabi -Wno-variadic-macros -Wno-long-long -fno-check-new -fno-common -fstrict-aliasing -ansi -O3 -DNDEBUG -I/home/username/code/eigen/build/unsupported/test -I/home/username/code/eigen/unsupported/test -I/home/username/code/eigen -I/home/username/code/eigen/build -I/home/username/code/eigen/unsupported/test/../../test -I/home/username/code/eigen/unsupported/test/../../unsupported -I/home/username/code/eigen/unsupported/test/../../Eigen -I/home/username/code/eigen/build/unsupported/test/../../test     -DEIGEN_TEST_MAX_SIZE=320 -DEIGEN_TEST_FUNC=cxx11_tensor_io   -o CMakeFiles/cxx11_tensor_io.dir/cxx11_tensor_io.cpp.o -c /home/username/code/eigen/unsupported/test/cxx11_tensor_io.cpp
In file included from /home/username/code/eigen/Eigen/Core:369:0,
                 from /home/username/code/eigen/Eigen/QR:11,
                 from /home/username/code/eigen/unsupported/test/../../test/main.h:256,
                 from /home/username/code/eigen/unsupported/test/cxx11_tensor_io.cpp:10:
/home/username/code/eigen/Eigen/src/Core/arch/AVX/PacketMath.h: In function ‘typename Eigen::internal::unpacket_traits<T>::type Eigen::internal::predux(const Packet&) [with Packet = __vector(8) float; typename Eigen::internal::unpacket_traits<T>::type = float]’:
/home/username/code/eigen/Eigen/src/Core/arch/AVX/PacketMath.h:398:81: error: cannot convert ‘Eigen::internal::unpacket_traits<__vector(4) float>::type {aka __vector(4) float}’ to ‘float’ in return
   return predux(_mm_add_ps(_mm256_castps256_ps128(a),_mm256_extractf128_ps(a,1)));
                                                                                 ^
/home/username/code/eigen/Eigen/src/Core/arch/AVX/PacketMath.h: In function ‘typename Eigen::internal::unpacket_traits<T>::type Eigen::internal::predux(const Packet&) [with Packet = __vector(4) double; typename Eigen::internal::unpacket_traits<T>::type = double]’:
/home/username/code/eigen/Eigen/src/Core/arch/AVX/PacketMath.h:402:81: error: cannot convert ‘Eigen::internal::unpacket_traits<__vector(2) double>::type {aka __vector(2) double}’ to ‘double’ in return
   return predux(_mm_add_pd(_mm256_castpd256_pd128(a),_mm256_extractf128_pd(a,1)));
                                                                                 ^
In file included from /home/username/code/eigen/Eigen/Core:356:0,
                 from /home/username/code/eigen/Eigen/QR:11,
                 from /home/username/code/eigen/unsupported/test/../../test/main.h:256,
                 from /home/username/code/eigen/unsupported/test/cxx11_tensor_io.cpp:10:
/home/username/code/eigen/Eigen/src/Core/GenericPacketMath.h: In instantiation of ‘typename Eigen::internal::unpacket_traits<T>::type Eigen::internal::predux(const Packet&) [with Packet = __vector(4) float; typename Eigen::internal::unpacket_traits<T>::type = __vector(4) float]’:
/home/username/code/eigen/Eigen/src/Core/arch/AVX/PacketMath.h:398:81:   required from here
/home/username/code/eigen/Eigen/src/Core/GenericPacketMath.h:324:13: error: ‘typename Eigen::internal::unpacket_traits<T>::type Eigen::internal::predux(const Packet&) [with Packet = __vector(4) float; typename Eigen::internal::unpacket_traits<T>::type = __vector(4) float]’ conflicts with a previous declaration
 { return a; }
             ^
In file included from /home/username/code/eigen/Eigen/Core:369:0,
                 from /home/username/code/eigen/Eigen/QR:11,
                 from /home/username/code/eigen/unsupported/test/../../test/main.h:256,
                 from /home/username/code/eigen/unsupported/test/cxx11_tensor_io.cpp:10:
/home/username/code/eigen/Eigen/src/Core/arch/AVX/PacketMath.h:396:38: note: previous declaration ‘typename Eigen::internal::unpacket_traits<T>::type Eigen::internal::predux(const Packet&) [with Packet = __vector(8) float; typename Eigen::internal::unpacket_traits<T>::type = float]’
 template<> EIGEN_STRONG_INLINE float predux<Packet8f>(const Packet8f& a)
                                      ^
In file included from /home/username/code/eigen/Eigen/Core:356:0,
                 from /home/username/code/eigen/Eigen/QR:11,
                 from /home/username/code/eigen/unsupported/test/../../test/main.h:256,
                 from /home/username/code/eigen/unsupported/test/cxx11_tensor_io.cpp:10:
/home/username/code/eigen/Eigen/src/Core/GenericPacketMath.h:323:91: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
 template<typename Packet> EIGEN_DEVICE_FUNC inline typename unpacket_traits<Packet>::type predux(const Packet& a)
                                                                                           ^
/home/username/code/eigen/Eigen/src/Core/GenericPacketMath.h: In instantiation of ‘typename Eigen::internal::unpacket_traits<T>::type Eigen::internal::predux(const Packet&) [with Packet = __vector(2) double; typename Eigen::internal::unpacket_traits<T>::type = __vector(2) double]’:
/home/username/code/eigen/Eigen/src/Core/arch/AVX/PacketMath.h:402:81:   required from here
/home/username/code/eigen/Eigen/src/Core/GenericPacketMath.h:324:13: error: ‘typename Eigen::internal::unpacket_traits<T>::type Eigen::internal::predux(const Packet&) [with Packet = __vector(2) double; typename Eigen::internal::unpacket_traits<T>::type = __vector(2) double]’ conflicts with a previous declaration
 { return a; }
             ^
In file included from /home/username/code/eigen/Eigen/Core:369:0,
                 from /home/username/code/eigen/Eigen/QR:11,
                 from /home/username/code/eigen/unsupported/test/../../test/main.h:256,
                 from /home/username/code/eigen/unsupported/test/cxx11_tensor_io.cpp:10:
/home/username/code/eigen/Eigen/src/Core/arch/AVX/PacketMath.h:400:39: note: previous declaration ‘typename Eigen::internal::unpacket_traits<T>::type Eigen::internal::predux(const Packet&) [with Packet = __vector(4) double; typename Eigen::internal::unpacket_traits<T>::type = double]’
 template<> EIGEN_STRONG_INLINE double predux<Packet4d>(const Packet4d& a)
                                       ^
In file included from /home/username/code/eigen/Eigen/Core:356:0,
                 from /home/username/code/eigen/Eigen/QR:11,
                 from /home/username/code/eigen/unsupported/test/../../test/main.h:256,
                 from /home/username/code/eigen/unsupported/test/cxx11_tensor_io.cpp:10:
/home/username/code/eigen/Eigen/src/Core/GenericPacketMath.h:323:91: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
 template<typename Packet> EIGEN_DEVICE_FUNC inline typename unpacket_traits<Packet>::type predux(const Packet& a)
                                                                                           ^
In file included from /home/username/code/eigen/Eigen/Core:369:0,
                 from /home/username/code/eigen/Eigen/QR:11,
                 from /home/username/code/eigen/unsupported/test/../../test/main.h:256,
                 from /home/username/code/eigen/unsupported/test/cxx11_tensor_io.cpp:10:
/home/username/code/eigen/Eigen/src/Core/arch/AVX/PacketMath.h: In function ‘typename Eigen::internal::unpacket_traits<T>::type Eigen::internal::predux(const Packet&) [with Packet = __vector(8) float; typename Eigen::internal::unpacket_traits<T>::type = float]’:
/home/username/code/eigen/Eigen/src/Core/arch/AVX/PacketMath.h:399:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/home/username/code/eigen/Eigen/src/Core/arch/AVX/PacketMath.h: In function ‘typename Eigen::internal::unpacket_traits<T>::type Eigen::internal::predux(const Packet&) [with Packet = __vector(4) double; typename Eigen::internal::unpacket_traits<T>::type = double]’:
/home/username/code/eigen/Eigen/src/Core/arch/AVX/PacketMath.h:403:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[3]: *** [unsupported/test/CMakeFiles/cxx11_tensor_io.dir/cxx11_tensor_io.cpp.o] Fehler 1
make[3]: Verzeichnis »/home/username/code/eigen/build« wird verlassen
make[2]: *** [unsupported/test/CMakeFiles/cxx11_tensor_io.dir/all] Fehler 2
make[2]: Verzeichnis »/home/username/code/eigen/build« wird verlassen
make[1]: *** [CMakeFiles/check.dir/rule] Fehler 2
make[1]: Verzeichnis »/home/username/code/eigen/build« wird verlassen
make: *** [check] Fehler 2

由于typename Eigen::internal::unpacket_traits<T>::type Eigen::internal::predux(cost Packet&)的定义存在冲突,有时包含__vector(4) float,有时包含__vector(2) float,因此可能与AVX和SSE扩展的代码存在冲突?但是,它也只发生在 -mavx 中,所以我暂时没有想法。

我没有成功用谷歌搜索(太新了?),我希望有人可以提供帮助。

0 个答案:

没有答案