New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1325 - ARM Aarch64 + Clang/LLVM 3.5 will not compile with vectorization
ARM Aarch64 + Clang/LLVM 3.5 will not compile with vectorization
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Core - vectorization
3.3 (current stable)
ARM - NEON Linux
: Normal Unknown
Assigned To: Nobody
:
Depends on:
Blocks: 3.3
  Show dependency treegraph
 
Reported: 2016-10-11 09:40 UTC by Emil Fresk
Modified: 2016-10-12 14:56 UTC (History)
4 users (show)



Attachments
Workaround clang 3.5 issue (1.12 KB, patch)
2016-10-12 11:44 UTC, Gael Guennebaud
no flags Details | Diff
Workaround clang 3.5 issue (1.71 KB, patch)
2016-10-12 11:51 UTC, Gael Guennebaud
no flags Details | Diff

Description Emil Fresk 2016-10-11 09:40:54 UTC
* Sniped from the forum post about the same problem, but put here for official handling *

I am testing latest Eigen on an ODROID-C2 board (ARM Aarch64) and I am getting the following error when compiling with Clang 3.5.0:

"""
In file included from .../eigen3/Eigen/Core:355:
.../eigen3/Eigen/src/Core/arch/NEON/Complex.h:286:35: error: statement expression not allowed at file scope
static uint64x2_t p2ul_CONJ_XOR = vld1q_u64( p2ul_conj_XOR_DATA );
                                  ^
/usr/include/clang/3.5.0/include/arm_neon.h:7624:39: note: expanded from macro 'vld1q_u64'
#define vld1q_u64(__p0) __extension__ ({ \
                                      ^
1 error generated.
"""

It seems that there is a problem when instantiating the vectorization macros that sadly I am not enough familiar with to suggest a fix.
This error is not present in 3.2.xx.
Also, in https://github.com/tensorflow/tensorflow/issues/3065 they have a workaround for this problem.
Comment 1 Gael Guennebaud 2016-10-12 10:38:17 UTC
This comes from a fix of bug 1240. The problem is more likely on clang side, and I believe it works fine with a more recent clang version.

An easy fix is to enable the old code for clang only.
Comment 2 Gael Guennebaud 2016-10-12 11:44:18 UTC
Created attachment 745 [details]
Workaround clang 3.5 issue

Could you try the attached patch and confirm that it does the trick.

Thanks.
Comment 3 Gael Guennebaud 2016-10-12 11:51:11 UTC
Created attachment 746 [details]
Workaround clang 3.5 issue
Comment 4 Emil Fresk 2016-10-12 14:18:10 UTC
Hi Gael!

Thank you, I will give this a try tonight.

Just so you know, I tested this (without the patch) with the latest "devel" (3.8.1) and the error is still present there:

"""
In file included from .../eigen3/Eigen/Core:355:
.../eigen3/Eigen/src/Core/arch/NEON/Complex.h:286:35: error: statement expression not allowed at file scope
static uint64x2_t p2ul_CONJ_XOR = vld1q_u64( p2ul_conj_XOR_DATA );
                                  ^
/usr/lib/llvm-3.8/bin/../lib/clang/3.8.1/include/arm_neon.h:7624:39: note: expanded from macro 'vld1q_u64'
#define vld1q_u64(__p0) __extension__ ({ \
                                      ^
1 error generated.
"""

So its not only a clang 3.5 problem.
Comment 5 Gael Guennebaud 2016-10-12 14:25:36 UTC
ok, good to known.
Comment 6 Emil Fresk 2016-10-12 14:48:52 UTC
I gave the patch a try and it fixes the problem on both 3.5 and 3.8.1.
Thank you for the quick fix Gael!
Comment 7 Gael Guennebaud 2016-10-12 14:56:55 UTC
Alright.

https://bitbucket.org/eigen/eigen/commits/b5beb4800686/

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