4 ms·
Runtime feature detection need not be rare nor hard, it's a few dozen lines of boilerplate. You can even write your code just once: see https://github.com/googl
by janwas 3y ago
Runtime feature detection need not be rare nor hard, it's a few dozen lines of boilerplate. You can even write your code just once: see https://github.com/google/highway#examples https://github.com/google/highway#examples.
- IshKebab 3y agoThat's still hard, given the tiny benefit it would give to 99% of code. Maybe modern tooling (e.g. Cargo) will lower the barrier so that it becomes less rare, but in C++ it's definitely not worth the effort for the vast vast vast majority of projects.
- cmrdporcupine 3y agoUnfortunately Rust is way behind on getting SIMD intrinsics out there. Anything AVX512 is nightly (unstable) only still.
- janwas 3y agoWow, I find "vast vast vast" hard to believe. If we don't have loops where a lot of CPU time is spent, why even write in C++? I admittedly focus more on libraries, but quite a large number of them are already vectorized. I would venture that a sizable fraction of CPU time, even in 'normal' non-HPC context, uses SIMD indirectly. Think image/video decompression, browser handshakes/rendering, image editing, etc.
- IshKebab 3y ago> If we don't have loops where a lot of CPU time is spent, why even write in C++? Because it isn't just hot or autovectorisable loops that are faster in C++; everything is faster. Function calls, member accesses, arithmetic, etc. Even loops are normally not very hot and not autovectorisable. You're right that things like audio/image processing, compression etc. benefits from SIMD but that is in the 1%. Those are libraries that have already been written. The vast vast majority of people are not writing audio codecs or whatever.
- kolbe 3y ago> Those are libraries that have already been written. Written using SIMD. > The vast vast majority of people are not writing audio codecs or whatever. Or HPC, or finance, or json parsing, or PDE solving, or gaming.... All off these (and more) benefit from AVX512. Why are you going so far out of your way to be dismissive of this?