New user self-registration is disabled due to spam. Please email eigen-core-team @ if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 1240 - Initializing Packets fails to compile on ARM DS-5 5.20
Summary: Initializing Packets fails to compile on ARM DS-5 5.20
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - vectorization (show other bugs)
Version: unspecified
Hardware: ARM - NEON Windows
: Normal Compilation Problem
Assignee: 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)

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.

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
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

and also use load for the 2d case:
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.