17 hours ago
- SIMD auto-vectorization works efficiently for integer sums by processing 8 integers per loop iteration and then summing the 8 subtotals with fix-up code.
- Floating-point addition is not associative due to rounding, so compilers cannot safely regroup additions the same way, leading to scalar per-element addition even when processing 8 floats per iteration.
- Workarounds include using -Ofast or -funsafe-math-optimizations (global, risky) or using a GCC attribute to assume associativity for a specific function; std::reduce with unsequenced execution policy did not work in testing.