logoalt Hacker News

drob518yesterday at 5:40 AM1 replyview on HN

I’m always shocked at what the compiler is able to deduce wrt vectorization. When it works, it’s magical.


Replies

dwatttttyesterday at 9:32 AM

In the abstract, it's the inverse of the argument that "configuration formats should be programming languages"; the more general something can be, the less you can assume about it.

A way to express the operations you want, without unintentionally expressing operations you don't want, would be much easier to auto-vectorise. I'm not familiar enough with SIMD to give examples, but if a transformation would preserve the operations you want, but observably be different to what you coded, I assume it's not eligible (unless you enable flags that allow a compiler to perform optimisations that produce code that's not quite what you wrote).

show 1 reply