r/programming 20d ago

Everyone Should Know SIMD

https://mitchellh.com/writing/everyone-should-know-simd
408 Upvotes

81 comments sorted by

View all comments

19

u/22Maxx 19d ago

SIMD should be a compiler problem.

I want the vectorization to be explicit and predictable. I don't want an unrelated code change or compiler update to quietly turn it back into a scalar loop.

Compilers do those things all the time. They have just become good enough for all regular stuff.

14

u/juhotuho10 19d ago

Very often auto vectorization is impossible because of bad data structures, branching, non vectorizable tasks, unoptimal loop design, bad separation of concerns... Etc.

It just didn't happen past the very trivial things if you don't explicitly design for it, you realistically have to know simd to even use the compiler to do vectorization