Bugzilla – Attachment 712 Details for
Bug 1240
Initializing Packets fails to compile on ARM DS-5 5.20
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
This bugzilla service is closed. All entries have been migrated to
https://gitlab.com/libeigen/eigen
Compile error fix in PacketMath.h
packets.patch (text/plain), 6.00 KB, created by
seantempleton
on 2016-06-03 15:56:49 UTC
(
hide
)
Description:
Compile error fix in PacketMath.h
Filename:
MIME Type:
Creator:
seantempleton
Created:
2016-06-03 15:56:49 UTC
Size:
6.00 KB
patch
obsolete
># HG changeset patch ># User Sean Templeton <seantempleton@outlook.com> ># Date 1464969095 18000 ># Fri Jun 03 10:51:35 2016 -0500 ># Node ID fe231dfb961fa911b6b1eccd8716a2378c9eb70b ># Parent 101d62fb8a15477b17c15d0d68ec0906ded4ff03 >Fix compile errors initializing packets on ARM DS-5 5.20 > >The ARM DS-5 5.20 compiler fails compiling with the following errors: > >"src/Core/arch/NEON/PacketMath.h", line 113: Error: #146: too many initializer values > Packet4f countdown = EIGEN_INIT_NEON_PACKET4(0, 1, 2, 3); > ^ >"src/Core/arch/NEON/PacketMath.h", line 118: Error: #146: too many initializer values > Packet4i countdown = EIGEN_INIT_NEON_PACKET4(0, 1, 2, 3); > ^ >"src/Core/arch/NEON/Complex.h", line 30: Error: #146: too many initializer values > static uint32x4_t p4ui_CONJ_XOR = EIGEN_INIT_NEON_PACKET4(0x00000000, 0x80000000, 0x00000000, 0x80000000); > ^ >"src/Core/arch/NEON/Complex.h", line 31: Error: #146: too many initializer values > static uint32x2_t p2ui_CONJ_XOR = EIGEN_INIT_NEON_PACKET2(0x00000000, 0x80000000); > ^ > >The vectors are implemented as two doubles, hence the too many initializer values error. >Changed the code to use intrinsic load functions which all compilers >implementing NEON should have. > >diff --git a/Eigen/src/Core/arch/NEON/Complex.h b/Eigen/src/Core/arch/NEON/Complex.h >--- a/Eigen/src/Core/arch/NEON/Complex.h >+++ b/Eigen/src/Core/arch/NEON/Complex.h >@@ -9,18 +9,19 @@ > > #ifndef EIGEN_COMPLEX_NEON_H > #define EIGEN_COMPLEX_NEON_H > > namespace Eigen { > > namespace internal { > >-static uint32x4_t p4ui_CONJ_XOR = EIGEN_INIT_NEON_PACKET4(0x00000000, 0x80000000, 0x00000000, 0x80000000); >-static uint32x2_t p2ui_CONJ_XOR = EIGEN_INIT_NEON_PACKET2(0x00000000, 0x80000000); >+const uint32_t conj_XOR_DATA[] = { 0x00000000, 0x80000000, 0x00000000, 0x80000000 }; >+static uint32x4_t p4ui_CONJ_XOR = vld1q_u32( conj_XOR_DATA ); >+static uint32x2_t p2ui_CONJ_XOR = vld1_u32( conj_XOR_DATA ); > > //---------- float ---------- > struct Packet2cf > { > EIGEN_STRONG_INLINE Packet2cf() {} > EIGEN_STRONG_INLINE explicit Packet2cf(const Packet4f& a) : v(a) {} > Packet4f v; > }; >diff --git a/Eigen/src/Core/arch/NEON/PacketMath.h b/Eigen/src/Core/arch/NEON/PacketMath.h >--- a/Eigen/src/Core/arch/NEON/PacketMath.h >+++ b/Eigen/src/Core/arch/NEON/PacketMath.h >@@ -46,25 +46,22 @@ typedef uint32x4_t Packet4ui; > #define _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(NAME,X) \ > const Packet4f p4f_##NAME = vreinterpretq_f32_u32(pset1<int>(X)) > > #define _EIGEN_DECLARE_CONST_Packet4i(NAME,X) \ > const Packet4i p4i_##NAME = pset1<Packet4i>(X) > > #if EIGEN_COMP_LLVM && !EIGEN_COMP_CLANG > //Special treatment for Apple's llvm-gcc, its NEON packet types are unions >- #define EIGEN_INIT_NEON_PACKET2(X, Y) {{X, Y}} >- #define EIGEN_INIT_NEON_PACKET4(X, Y, Z, W) {{X, Y, Z, W}} >+ #define EIGEN_INIT_NEON_PACKET2D(X, Y) {{X, Y}} > #else > //Default initializer for packets >- #define EIGEN_INIT_NEON_PACKET2(X, Y) {X, Y} >- #define EIGEN_INIT_NEON_PACKET4(X, Y, Z, W) {X, Y, Z, W} >+ #define EIGEN_INIT_NEON_PACKET2D(X, Y) {X, Y} > #endif > >- > // arm64 does have the pld instruction. If available, let's trust the __builtin_prefetch built-in function > // which available on LLVM and GCC (at least) > #if EIGEN_HAS_BUILTIN(__builtin_prefetch) || EIGEN_COMP_GNUC > #define EIGEN_ARM_PREFETCH(ADDR) __builtin_prefetch(ADDR); > #elif defined __pld > #define EIGEN_ARM_PREFETCH(ADDR) __pld(ADDR) > #elif !EIGEN_ARCH_ARM64 > #define EIGEN_ARM_PREFETCH(ADDR) __asm__ __volatile__ ( " pld [%[addr]]\n" :: [addr] "r" (ADDR) : "cc" ); >@@ -117,22 +114,24 @@ EIGEN_STRONG_INLINE void vst1_f32 > template<> struct unpacket_traits<Packet4f> { typedef float type; enum {size=4, alignment=Aligned16}; typedef Packet4f half; }; > template<> struct unpacket_traits<Packet4i> { typedef int type; enum {size=4, alignment=Aligned16}; typedef Packet4i half; }; > > template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) { return vdupq_n_f32(from); } > template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(const int& from) { return vdupq_n_s32(from); } > > template<> EIGEN_STRONG_INLINE Packet4f plset<Packet4f>(const float& a) > { >- Packet4f countdown = EIGEN_INIT_NEON_PACKET4(0, 1, 2, 3); >+ const float32_t f[] = {0, 1, 2, 3}; >+ Packet4f countdown = vld1q_f32(f); > return vaddq_f32(pset1<Packet4f>(a), countdown); > } > template<> EIGEN_STRONG_INLINE Packet4i plset<Packet4i>(const int& a) > { >- Packet4i countdown = EIGEN_INIT_NEON_PACKET4(0, 1, 2, 3); >+ const int32_t i[] = {0, 1, 2, 3}; >+ Packet4i countdown = vld1q_s32(i); > return vaddq_s32(pset1<Packet4i>(a), countdown); > } > > template<> EIGEN_STRONG_INLINE Packet4f padd<Packet4f>(const Packet4f& a, const Packet4f& b) { return vaddq_f32(a,b); } > template<> EIGEN_STRONG_INLINE Packet4i padd<Packet4i>(const Packet4i& a, const Packet4i& b) { return vaddq_s32(a,b); } > > template<> EIGEN_STRONG_INLINE Packet4f psub<Packet4f>(const Packet4f& a, const Packet4f& b) { return vsubq_f32(a,b); } > template<> EIGEN_STRONG_INLINE Packet4i psub<Packet4i>(const Packet4i& a, const Packet4i& b) { return vsubq_s32(a,b); } >@@ -580,17 +579,17 @@ template<> struct packet_traits<double> > }; > > template<> struct unpacket_traits<Packet2d> { typedef double type; enum {size=2, alignment=Aligned16}; typedef Packet2d half; }; > > template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) { return vdupq_n_f64(from); } > > template<> EIGEN_STRONG_INLINE Packet2d plset<Packet2d>(const double& a) > { >- Packet2d countdown = EIGEN_INIT_NEON_PACKET2(0, 1); >+ Packet2d countdown = EIGEN_INIT_NEON_PACKET2D(0, 1); > return vaddq_f64(pset1<Packet2d>(a), countdown); > } > template<> EIGEN_STRONG_INLINE Packet2d padd<Packet2d>(const Packet2d& a, const Packet2d& b) { return vaddq_f64(a,b); } > > template<> EIGEN_STRONG_INLINE Packet2d psub<Packet2d>(const Packet2d& a, const Packet2d& b) { return vsubq_f64(a,b); } > > template<> EIGEN_STRONG_INLINE Packet2d pnegate(const Packet2d& a) { return vnegq_f64(a); } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1240
: 712