Skip to content

Linking modules compiled for different SIMD instruction sets

Benoit Jacob said:

"On the occasion of this API break, have you discussed resolving the "link different SIMD code paths e.g. AVX2/AVX512 without ODR violations"? Resolving that in the case Eigen requires one of the following:

(1) Either breaking API (so now might be a good time to revive the topic)

(2) Or relying on certain nonstandard toolchain features (symbol multi-versioning, GCC6+ but only available in much more recent Clang and I don't know about other toolchains ; so if you chose that route, that would fold into discussions of what compilers you want to continue supporting going forward).

(3) Or, I guess, consistently opening/closing an anonymous namespace around every opening/closing of namespace Eigen, so that all Eigen symbols get internal linkage. This would probably result in large binary code size increases for some users, some of whom might be able to partially recover smaller binart sizes by enabling some identical-code-folding (ICF) linker feature.

(In a non-headers-only library, there would be an option (4) to just build all the code paths and internally handle the runtime dispatch to the appropriate one, but Eigen's expression-templates API makes it a non-starter)."

Edited by Antonio Sánchez