Static alignment is still disabled altogether on ARM
Submitted by Benoit Jacob
Assigned to Nobody
Link to original bugzilla bug (#1115)
Version: 3.3 (current stable)
Platform: ARM - NEON
Description
Created attachment 626
Enable static alignment on ARM
This code is disabling static alignment, thus vectorization of all fixed-size objects, altogether, on ARM:
// 16 byte alignment is only useful for vectorization. Since it affects the ABI, we need to enable
// 16 byte alignment on all platforms where vectorization might be enabled. In theory we could always
// enable alignment, but it can be a cause of problems on some platforms, so we just disable it in
// certain common platform (compiler+architecture combinations) to avoid these problems.
// Only static alignment is really problematic (relies on nonstandard compiler extensions that don't
// work everywhere, for example don't work on GCC/ARM), try to keep heap alignment even
// when we have to disable static alignment.
#if EIGEN_COMP_GNUC && !(EIGEN_ARCH_i386_OR_x86_64 || EIGEN_ARCH_PPC || EIGEN_ARCH_IA64)
#define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 1
#else
#define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 0
#endif
See how the whitelist of architectures there ^ does not include ARM; the comment above even refers to GCC/ARM issues.
However, this comment doesn't offer any detail on what the affected toolchain versions are, and seems to have been around here for a long time.
Given the attention that ARM has received over the past 5 years, it would be surprising if static alignment were still broken; and few people care about old compilers on ARM - while Android isn't the fastest to upgrade toolchains, it is still the case that hardly anyone seems to use GCC < 4.8 or Clang < 3.5 on Android/ARM at the moment.
On the other hand, vectorization of fixed-size objects is very important for many applications.
So, I would like to just add ARM/ARM64 in the above whitelist of architectures.
Patch attached.
Patch 626, "Enable static alignment on ARM":
eigen-arm-alignment.diff