5 ms·
It also seems like Clickhouse could offer runtime detection of AVX and dispatch to the optimized functions in that case.
by vlmutolo 3y ago
It also seems like Clickhouse could offer runtime detection of AVX and dispatch to the optimized functions in that case.
- zX41ZdbW 3y agoYes, here is the article about the techniques: https://maksimkita.com/blog/cpu-dispatch-in-clickhouse.html https://maksimkita.com/blog/cpu-dispatch-in-clickhouse.html
- rpep 3y agoIt’s considerably more onerous than just compiling to a single/multiple microarchitecture(s) though. Plus when you do this, you need to split out this code to be conditionally compiled so that you can support other architectures like ARM.
- janwas 3y agoHere is an example on how to do this using github.com/google/highway: https://gcc.godbolt.org/z/zP7MYe9Yf https://gcc.godbolt.org/z/zP7MYe9Yf You write the code only once and do not have to worry about any #pragma/conditional compilation. Just copy-paste about a dozen lines of boilerplate, link with the Highway library, and done. Disclosure: I am the main author; happy to discuss.