-
-
Notifications
You must be signed in to change notification settings - Fork 827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to compile Eigen with alignment enabled #1196
Add option to compile Eigen with alignment enabled #1196
Conversation
34c9707
to
8c9b081
Compare
8c9b081
to
7c5b54e
Compare
@fabiencastan friendly ping :-) I think this PR is good to go. |
7c5b54e
to
613c128
Compare
We should also re-evaluate if we cannot switch to C++17 nowadays. |
@fabiencastan I think just using C++17 is the cleanest solution. While I don't know where exactly AliceVision is used, but full C++17 is already supported in gcc 7.x, which is in e.g. Ubuntu 18.04 LTS already, so more than 4 years old. Similar situation is across other Linux distributions. On Windows it's rather easy to target older versions of Windows, so C++17 support should not be a problem either. |
Eigen is most optimal when using SIMD instructions which require overaligned buffers. In C++14 this is a problem because there's no built-in support for correctly aligned allocations, so this Eigen feature is currently disabled in AliceVision. C++17 solves Eigen alignment issues completely because there now exist additional overloads of operator new() which support correct allocation alignment. We can't upgrade to C++17 yet, but certain compilers added support for this feature earlier, such as -faligned-new in GCC 7.1. Therefore it makes sense to add a configuration option to allow enabling alignment support in Eigen in cases when the compiler is good enough.
613c128
to
4ae2ff6
Compare
@fabiencastan Just a friendly ping :) I think this PR can be merged. |
Eigen is most optimal when using SIMD instructions which require overaligned buffers. In C++14 this is a problem because there's no built-in support for correctly aligned allocations, so this Eigen feature is currently disabled in AliceVision. C++17 solves Eigen alignment issues completely because there now exist additional overloads of operator new() which support correct allocation alignment. We can't upgrade to C++17 yet, but certain compilers added support for this feature earlier, such as
-faligned-new
in GCC 7.1.Given the above it makes sense to add a configuration option to allow enabling alignment support in Eigen in cases when the compiler is good enough (we enable
-faligned-new
automatically). This will improve performance for people who can control the set of supported compilers.Clang also supports
-faligned-new
, but their documentation is empty and I didn't find which version of clang was the first to support the option, so I didn't add any special cases for clang yet.