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

6

u/EC36339 Jul 24 '26

Vectorization can only be done by the compiler if processing of individual homogeneous objects isn't separated by layers of runtime abstraction.

That's why data oriented programming is a thing amd why games use entity-component systems over OOP.

2

u/AresFowl44 Jul 24 '26 edited Jul 24 '26

Even then the compiler can only take you so far. In my experience it often is trivial to improve upon the compiler, because it has to be overly cautious

1

u/EC36339 Jul 24 '26

Yes, but that was never the point. First, you have to make sure vectorization isn't made completely impossible.

1

u/teerre Jul 24 '26

Are you agreeing with me?

2

u/EC36339 Jul 24 '26

Yes and no.

It is first an architecture problem. Then it becomes a compiler problem. But even then the compiler cannot necessarily solve it alone.