4 ms·
I do not understand why ubiquity or baselines should be required in order to use CPU features :) Since many years, performance-critical libraries have used run
by janwas 2y ago
I do not understand why ubiquity or baselines should be required in order to use CPU features :)
Since many years, performance-critical libraries have used runtime/dynamic dispatch.
Our github.com/google/highway intrinsics even automate this. You can write your code once and it is compiled for each instruction set, and the best codepath is selected at runtime.
- Remnant44 2y agoDynamic dispatch adds headaches to the build process; they are surmountable for sure, but in my experience the build wrangling to make it all happen is harder than the original work of rewriting your code with intrinsics! The other major problem I have with dynamic dispatch, at least for the SIMD code I've written, is that you have to do so at a fairly high level of granularity. Most optimized routines are doing as much fusion & cache tiling as possible and so the dispatch has to happen at the level of the higher-level function rather than the more array-op-like components within it. And mostly, that means you've written your (often quite complicated) procedure several times uniquely instead of simply accelerating components within it. I have not used Highway - if it dramatically simplifies the above, that's excellent!
- janwas 2y ago:) Yes indeed, no changes to the build required. Example: https://gcc.godbolt.org/z/KM3ben7ET https://gcc.godbolt.org/z/KM3ben7ET I agree dispatch should be at a reasonably high level. This hasn't been a problem in my experience, we have been able to inline together most SIMD code and dispatch infrequently.