Eigen 3.3.5 and all past versions can not be cross compiled for 64bit QNX X86 target.But can be compiled for 32bit QNX X86 target. The error is as below, /home/richard/sambashare/Eigen/src/Core/arch/SSE/PacketMath.h:198:41: error: template-id 'padd<Eigen::internal::Packet4f>' for 'Eigen::internal::Packet4f Eigen::internal::padd(const Packet4f&, const Packet4f&)' does not match any template declaration template<> EIGEN_STRONG_INLINE Packet4f padd<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_add_ps(a,b); } ^ /home/richard/sambashare/Eigen/src/Core/arch/SSE/PacketMath.h:403:50: required from here /home/richard/sambashare/Eigen/src/Core/GenericPacketMath.h:286:9: error: cannot convert 'const __vector(4) float' to 'float' in assignment { (*to) = from; } My program is as below, #include <Eigen/Dense> int main(int argc, char **argv) { return 0; } The more detailed info is as below link, https://forum.kde.org/viewtopic.php?f=74&t=154098&p=404315#p404315
Not a solution but a possible workaround: Can you compile with the following? -DEIGEN_DONT_VECTORIZE (assuming QNX takes similar parameters as g++/clang++) And do simple programs like these compile: #include <emmintrin.h> int main() { __m128 a, b; a = _mm_add_ps(a,b); }
-DEIGEN_DONT_VECTORIZE should definitely works since it is working in 32 bits mode. There seems to be something odd in the way __m128 is defined, I'm thinking about two possible workarounds: 1 - try to increase the ABI: -fabi-version=4 (not sure that's possible with QNX and this would only be a local workaround) 2 - in Eigen/src/Core/arch/SSE/PacketMath.h change line 31 from: #if (defined EIGEN_VECTORIZE_AVX) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_MINGW) && (__GXX_ABI_VERSION < 1004) to #if ((defined EIGEN_VECTORIZE_AVX) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_MINGW) && (__GXX_ABI_VERSION < 1004)) || EIGEN_OS_QNX Please even if workaround #1 works for you, try the second solution too (without -fabi-version=4) so that we can patch Eigen accordingly.
I think `__vector(4) float` has been the definition of `__m128` in gcc since this was supported. I guess the best solution would be to solve Bug 692 then (this would also make masking "-Wignored-attributes" warnings obsolete). I'm marking this as dependent, but feel free to remove this if workaround 2 suggested by Gael also works.
Correction: The definition in gcc (at least in g++-5.4) is: typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); But this also just adds an attribute to `float`
Yes, it's not how __m128 is defined, but rather how it is taken into account by the ABI. On QNX, it seems that __m128 is not distinguishable from float, just like __m128 and __m256 are not distinguishable with __GXX_ABI_VERSION < 1004.
-DEIGEN_DONT_VECTORIZE my program works. any negative effects? (In reply to Christoph Hertzberg from comment #1) > Not a solution but a possible workaround: > > Can you compile with the following? > -DEIGEN_DONT_VECTORIZE > (assuming QNX takes similar parameters as g++/clang++) > > And do simple programs like these compile: > > #include <emmintrin.h> > int main() { > __m128 a, b; > a = _mm_add_ps(a,b); > } (In reply to Christoph Hertzberg from comment #1) > Not a solution but a possible workaround: > > Can you compile with the following? > -DEIGEN_DONT_VECTORIZE > (assuming QNX takes similar parameters as g++/clang++) > > And do simple programs like these compile: > > #include <emmintrin.h> > int main() { > __m128 a, b; > a = _mm_add_ps(a,b); > }
solution 1 does not work , same error with previous one. Solution 2 works. So should i use solution 2 or just simply add -DEIGEN_DONT_VECTORIZE which one is better? (In reply to Gael Guennebaud from comment #2) > -DEIGEN_DONT_VECTORIZE should definitely works since it is working in 32 > bits mode. > > There seems to be something odd in the way __m128 is defined, I'm thinking > about two possible workarounds: > > 1 - try to increase the ABI: -fabi-version=4 (not sure that's possible with > QNX and this would only be a local workaround) > > 2 - in Eigen/src/Core/arch/SSE/PacketMath.h change line 31 from: > > #if (defined EIGEN_VECTORIZE_AVX) && (EIGEN_COMP_GNUC_STRICT || > EIGEN_COMP_MINGW) && (__GXX_ABI_VERSION < 1004) > > to > > #if ((defined EIGEN_VECTORIZE_AVX) && (EIGEN_COMP_GNUC_STRICT || > EIGEN_COMP_MINGW) && (__GXX_ABI_VERSION < 1004)) || EIGEN_OS_QNX > > Please even if workaround #1 works for you, try the second solution too > (without -fabi-version=4) so that we can patch Eigen accordingly.
`-DEIGEN_DONT_VECTORIZE` will disable (explicit) vectorization, so your code will likely run slower (auto vectorization is getting better on newer compilers, though). So solution 2 from comment #2 is the best (quick) solution.
Applied: https://bitbucket.org/eigen/eigen/commits/57eb8da60e79/ https://bitbucket.org/eigen/eigen/commits/c1dd3b016076/ (3.3)
Thank you Christoph and Gael for your great support.
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1605.