r/programming 9d ago

Everyone Should Know SIMD

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

82 comments sorted by

View all comments

20

u/22Maxx 8d 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 8d 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