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, removeproduct_empty_packet_evaluator, and bindproduct_real_packet_evaluatoras a lightweight reference adapter only during packet reads (partially reverting commit 5c560bc3; non-vectorized 64-bitMatrix4d * Vector4devaluators grow from 24 to 40 bytes, while vectorized builds are unchanged); deduceproduct_real_packet_evaluator::coeffreturn type viadecltype(auto)so evaluators omittingCoeffReturnTyperemain 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_evaluatorso 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 withoutCoeffReturnTypeinproduct_mixed_gemv.
Tested:
product_evaluatorsshards 1–4,mixingtypesshards 1–7,product_mixed_gemvshards 1–2,product_storage_order,product_assign,vectorization_logicshards 1–2- ThinLTO + split-DWARF mixed SIMD / CUDA host reproducer and GCC
-flto -Werror=odrchecks
Credit to Paul Pluzhnikov (ppluzhnikov@google.com) for diagnosing the ThinLTO ODR failure and authoring the core fix.