New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 871 - gcc fail to compile PacketMath.h
gcc fail to compile PacketMath.h
Status: NEW
Product: Eigen
Classification: Unclassified
Component: General
unspecified
ARM - NEON All
: Normal Compilation Problem
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-30 12:25 UTC by phil.wang
Modified: 2014-09-01 11:47 UTC (History)
4 users (show)



Attachments

Description phil.wang 2014-08-30 12:25:36 UTC
In file included from ../eigen/Eigen/Core:293:0,
                 from ../eigen/Eigen/Dense:1,

../eigen/Eigen/src/Core/arch/NEON/PacketMath.h:55:45: error: missing binary operator before token "("
 #if (defined(__has_builtin) && __has_builtin(__builtin_prefetch)) || defined(__GNUC__)

I am using arm-linux-gcc 4.8.
Comment 1 Jitse Niesen 2014-08-31 01:16:53 UTC
According to http://stackoverflow.com/questions/25584920/how-to-fix-error-in-eigen-for-arm-neon , this is the same issue as discussed on the mailing list in the thread starting at http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2013/11/msg00011.html , but it looks like the solution proposed by Christoph in http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2013/11/msg00048.html was never acted on. Time to revisit this?
Comment 2 phil.wang 2014-08-31 05:04:48 UTC
I modified PacketMath.h according to msg00048, and it did pass compiling. However, the output assembly code was not as I expected.

Example code:
Eigen::Vector4f X, Y;
// X = ...
// Y = ...
X = X + Y;

There were four fadds instead of one vadd.

(In reply to Jitse Niesen from comment #1)
> According to
> http://stackoverflow.com/questions/25584920/how-to-fix-error-in-eigen-for-
> arm-neon , this is the same issue as discussed on the mailing list in the
> thread starting at
> http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2013/11/msg00011.
> html , but it looks like the solution proposed by Christoph in
> http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2013/11/msg00048.
> html was never acted on. Time to revisit this?
Comment 3 Gael Guennebaud 2014-09-01 11:00:09 UTC
I applied the needed changes:

https://bitbucket.org/eigen/eigen/commits/7829fa7c91cf/
https://bitbucket.org/eigen/eigen/commits/e6b961139761/


@phil.wang, make sure you compiled with neon enabled, for instance with "-mfpu=neon -mcpu=cortex-a8".
Comment 4 phil.wang 2014-09-01 11:47:26 UTC
I have a file name eigen-neon-example.cpp:

https://gist.github.com/Phillip-Wang/f729b26ab61dadc2a865

I compile it with arm-linux-gcc, with flags "-mfpu=neon -mcpu=cortex-a8".
Output assembly shows that addition between Eigen::Vector4f has not been parallelized.

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