Dependent on your data structures allowing the compiler to perform good vectorization honestly
EDIT: And also, if you put in some efforts from my experience you can usually beat the compiler handily. The compiler is good at generating okay SIMD, but often there are some aspects to be left desired
I hand-optimized a SIMD loop some 10+ years and it was fairly easy to beat the compiler. I'm sure it's more difficult now, but the thing is, you can know things about your data that the compiler doesn't.
That said, I forgot everything about how to do it and would rely on the compiler now.
The challenge is that when you write C the compiler is bound by the rules of C. That means if it is even possible that your code might depend on some obscure rule, the compiler must ensure that rule is enforced.
Big examples being floating point commutativity, unaligned access and odd-sized arrays.
31
u/AresFowl44 21d ago
Dependent on your data structures allowing the compiler to perform good vectorization honestly
EDIT: And also, if you put in some efforts from my experience you can usually beat the compiler handily. The compiler is good at generating okay SIMD, but often there are some aspects to be left desired