logoalt Hacker News

forrestthewoodstoday at 7:20 PM5 repliesview on HN

auto-vectorization is not nearly as good as you would hope it to be.

The best SIMD optimizations likely require changing your data format from AoS to SoA.


Replies

nylonstrungtoday at 7:33 PM

The one feature in Jonathan Blow's Jai language I really envy is a a single keyword to switch AoS to SoA and visa-versa at comptime

show 1 reply
ethintoday at 7:45 PM

Either this or you have to do special tricks like pairwise tree reductions and hand-unroll certain portions of loops.

raegistoday at 7:28 PM

What are AoS and SoA?

show 2 replies
formerly_proventoday at 7:30 PM

And -march=native or at least -march=x86-64-v3 or similar, alternatively identifying relevant functions and manually invoking FMV and uarch specialization via target_clones. Plus non-integer code can generally not be autovectorized in normal-math mode since FP is non-commutative.

Joker_vDtoday at 7:34 PM

Well, then I just prompt Claude and get SIMD without having to learn it /s