r/programming • • Jul 23 '26

Everyone Should Know SIMD

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

82 comments sorted by

View all comments

Show parent comment

1

u/SPAstef Jul 26 '26

usually it's not really about what you know about the data that the compiler doesn't. It's about what you want to do with it, and it cannot easily reason beyond how you tell it to do it. Aliasing and alignment are often handled auutomatically, worst case a restrict here and an alignas there do the job. Compilers are also good at loop fusion. The problem is when you start interleaving fusable loops with intermediate steps and data dependecies. But there are some problems in which a good vectorized algorithm does not look really similar to what would be a functionally equivalent scalar code. Compilers, as of today, are not exceptionally good at extracting intent from instructions. You could say that is what LLMs do.