New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1240 - Initializing Packets fails to compile on ARM DS-5 5.20
Initializing Packets fails to compile on ARM DS-5 5.20
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Core - vectorization
unspecified
ARM - NEON Windows
: Normal Compilation Problem
Assigned To: Nobody
:
Depends on:
Blocks: 3.3
  Show dependency treegraph
 
Reported: 2016-06-03 15:56 UTC by seantempleton
Modified: 2016-06-10 13:39 UTC (History)
4 users (show)



Attachments
Compile error fix in PacketMath.h (6.00 KB, text/plain)
2016-06-03 15:56 UTC, seantempleton
no flags Details

Description seantempleton 2016-06-03 15:56:49 UTC
Created attachment 712 [details]
Compile error fix in PacketMath.h

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);
                                    ^

I am currently using version 3.0.5 but trying the latest code it has the same problem. Whenever this is fixed, I will be updating to the latest version.
Comment 1 Christoph Hertzberg 2016-06-06 13:53:20 UTC
Could you try switching to the other definition of EIGEN_INIT_NEON_PACKET2/EIGEN_INIT_NEON_PACKET4 (in the current devel version, either line 54-55 or 58-59 in src/Core/arch/NEON/PacketMath.h). If that works, tell us which branch works and a flag which can detect your compiler.
Comment 2 seantempleton 2016-06-06 14:02:39 UTC
The LLVM branch gives me a warning "extra braces are nonstandard" and the same error, too many initializer values.
Comment 3 Christoph Hertzberg 2016-06-06 14:08:31 UTC
Ok, would have been too easy :D
Do you have any documentation how to initialize a vector of 2/4 elements properly with your compiler?
If nothing helps, we may have to resort to storing the values in a stack-local array then load them into the actual Packet. (This would require adapting every call of EIGEN_INIT_NEON_PACKET#)
Comment 4 seantempleton 2016-06-06 14:52:31 UTC
I sure would like easy. :)

There is this page on initializing vectors, though I wasn't sure if that was specific to the armcc compiler or not.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472k/chr1360928368293.html

I'm not sure if you saw it or not, but I did attach a patch that works for me. It uses the load functions here
http://infocenter.arm.com/help/topic/com.arm.doc.dui0472k/chr1360928371756.html
Comment 5 Gael Guennebaud 2016-06-06 20:18:50 UTC
According to the neon guide, using loads is indeed the recommended way to go.

Then, I would also use loads for the 2x cases too.
Comment 6 Gael Guennebaud 2016-06-09 21:09:55 UTC
Applied:
https://bitbucket.org/eigen/eigen/commits/2e8706a5cc31/

and also use load for the 2d case:
https://bitbucket.org/eigen/eigen/commits/3d1962c9b176/
Summary:     Bug 1240: Remove any assumption on NEON vector types.
Comment 7 seantempleton 2016-06-10 13:39:24 UTC
Excellent! Thanks Gael!

Note You need to log in before you can comment on or make changes to this bug.