Core: Make coefficient-based product evaluator ODR-invariant

Core: Make coefficient-based product evaluator ODR-invariant

Eigen's coefficient-based product evaluator previously omitted its operand evaluator members and wrapped mixed real-complex operand evaluators conditionally based on whether SIMD packet access was enabled, and switched its dense-assignment source evaluator on the same condition. Because packet access depends on host vectorization macros, linking SIMD-enabled C++ translation units alongside CUDA sources (where host vectorization is disabled) produced conflicting struct layouts and local evaluator types for identical template specializations, violating the C++ One Definition Rule and crashing LLVM's ThinLTO debug-info verifier.

  • Store both operand evaluators unconditionally in coeff_based_product_evaluator, remove product_empty_packet_evaluator, and bind product_real_packet_evaluator as a lightweight reference adapter only during packet reads (partially reverting commit 5c560bc3; non-vectorized 64-bit Matrix4d * Vector4d evaluators grow from 24 to 40 bytes, while vectorized builds are unchanged); deduce product_real_packet_evaluator::coeff return type via decltype(auto) so evaluators omitting CoeffReturnType remain supported.
  • Use the direct single-term coefficient path unconditionally whenever the compile-time inner dimension is 1.
  • Select the destination-ordered product evaluator unconditionally in dense_assignment_source_evaluator so dense assignment loops resolve the same source evaluator type regardless of vectorization mode.
  • Verify evaluator size parity across storage orders, single-term non-vectorized evaluation, and destination-ordered assignment selection in product_evaluators, plus custom real-packet evaluators without CoeffReturnType in product_mixed_gemv.

Tested:

  • product_evaluators shards 1–4, mixingtypes shards 1–7, product_mixed_gemv shards 1–2, product_storage_order, product_assign, vectorization_logic shards 1–2
  • ThinLTO + split-DWARF mixed SIMD / CUDA host reproducer and GCC -flto -Werror=odr checks

Credit to Paul Pluzhnikov (ppluzhnikov@google.com) for diagnosing the ThinLTO ODR failure and authoring the core fix.

Edited by eigen-review-bot

Merge request reports

Loading
Loading