This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 1240

Summary: Initializing Packets fails to compile on ARM DS-5 5.20
Product: Eigen Reporter: seantempleton
Component: Core - vectorizationAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: Compilation Problem CC: chtz, gael.guennebaud, jacob.benoit.1, markos
Priority: Normal    
Version: unspecified   
Hardware: ARM - NEON   
OS: Windows   
Whiteboard:
Bug Depends on:    
Bug Blocks: 558    
Attachments:
Description Flags
Compile error fix in PacketMath.h none

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!
Comment 8 Nobody 2019-12-04 15:54:12 UTC
-- 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/1240.