logoalt Hacker News

William_BByesterday at 9:56 AM2 repliesview on HN

Could you elaborate on the dynamic dispatching features a bit more? Is that for portability?


Replies

camel-cdryesterday at 10:54 AM

Here is an example using google highway: https://godbolt.org/z/Y8vsonTb8

See how the code has only been written once, but multiple versions of the same functions where generated targeting different hardware features (e.g. SSE, AVX, AVX512). Then `HWY_DYNAMIC_DISPATCH` can be used to dynamically call the fastest one matching your CPU at runtime.

show 2 replies
ashvardanianyesterday at 12:33 PM

Here's an explanation from one of my repos: <https://github.com/ashvardanian/simsimd?tab=readme-ov-file#d...>