4 ms·
Thanks, that's an important caveat! > Meanwhile xsimd (https://github.com/xtensor-stack/xsimd https://github.com/xtensor-stack/xsimd) has the feature level as
by spacechild1 2y ago
Thanks, that's an important caveat!
> Meanwhile xsimd (https://github.com/xtensor-stack/xsimd https://github.com/xtensor-stack/xsimd) has the feature level as a template parameter on its vector objects
That's pretty cool because you can write function templates and instantiate different versions that you can select at runtime.
- vblanco 2y agoYeah thts the fun of it, you create your kernel/function so that the simd level is a template parameter, and then you can use simple branching like: if(supports<avx512>){ myAlgo<avx512>(); } else{ myAlgo<avx>(); } Ive also used it for benchmarking to see if my code scales to different simd widths well and its a huge help
- dyaroshev 2y agoFYI: You don't want to do this. `supports<avx512>` is an expensive check. You really want to put this check in a static.
- spacechild1 2y agoI guess this was just pseudo-code. Of course you don't want to do a runtime feature check over and over again.