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 1115 - Static alignment is still disabled altogether on ARM
Summary: Static alignment is still disabled altogether on ARM
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - vectorization (show other bugs)
Version: 3.3 (current stable)
Hardware: ARM - NEON All
: Normal Performance Problem
Assignee: Nobody
Depends on:
Reported: 2015-11-17 17:04 UTC by Benoit Jacob
Modified: 2015-11-18 16:00 UTC (History)
4 users (show)

Enable static alignment on ARM (1.62 KB, patch)
2015-11-17 17:04 UTC, Benoit Jacob
no flags Details | Diff

Description Benoit Jacob 2015-11-17 17:04:54 UTC
Created attachment 626 [details]
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.

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.
Comment 1 Gael Guennebaud 2015-11-18 06:21:45 UTC
I guess that you successfully tested it with such recent compilers. So I'm ok with it, but we could perhaps enable ARM for gcc>=4.8 only to be safe, as we know it will break arm+gccc-old, with old>=4.4 (I don't know for 4.5, 4.6, and 4.7)
Comment 2 Benoit Jacob 2015-11-18 15:59:48 UTC
Good tip, thanks! I pushed something like this:

Here, all the toolchains we seem to be using seem to pass, but I don't know if that includes any toolchain based on GCC < 4.8. I still enabled alignment on 4.7, because I know it's been used in Android NDK until recently (Android 4.4 I think) and so I would be very surprised if alignment were still broken there, and I suppose some people still care about performance with this toolchain. GCC <= 4.6 remain without static alignment.

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