4 ms·
Hardly. Autovectorization is rarely performed as a percentage of all the cases where it’s theoretically possible, not reliably done (no guarantees - even if it
by ComputerGuru 3y ago
Hardly. Autovectorization is rarely performed as a percentage of all the cases where it’s theoretically possible, not reliably done (no guarantees - even if it AVs today, the same code may not AV tomorrow), and not something you want your actual hot path to rely on. AV is nice for “incidental” speedups to general code. No serious library touting SIMD acceleration will consider AV sufficient for the core hot loop.
- kolbe 3y ago> Autovectorization is rarely performed as a percentage of all the cases where it’s theoretically possible, This is not my experience. Do you have some justification for this statement? I've found myself far more impressed by autovectorization than disappointed by it. I've found that code most people think is autovectorizable actually violates scalar contracts. But if you write clear code whose scalar implementation won't introduce UB if autovectorized, the compiler is really good. Here's my go-to example. Agner Fog's VCL is a well-respected library. It has vectorized versions of all sorts of useful mathematitical functions. For fun, I rewrote his `exp(x)` function using his exact algorithm, but in scalar code, and it autovectorized, and benchmarks the same. https://godbolt.org/z/TK637PTh7 https://godbolt.org/z/TK637PTh7