AliceVision icon indicating copy to clipboard operation
AliceVision copied to clipboard

Add option to compile Eigen with alignment enabled

Open p12tic opened this issue 1 year ago • 0 comments

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.

p12tic avatar Jul 25 '22 23:07 p12tic