logoalt Hacker News

derefryesterday at 11:56 PM2 repliesview on HN

Only if the end-user is the one compiling the software, on the same very system they'll be running it on. Which is true of GPU shader kernels, due to how GPU drivers work; but isn't generally true of CPU object code (unless you're on Gentoo.)

What you'd actually want is a matrix of variant implementations burned into the binary, with runtime (or process-boot-time) hardware detection that swaps symbols out to point to the correct variant.


Replies

dwattttttoday at 4:10 AM

If you want the library to perform that selection, you also need the "correct" / most efficient implementation to be independent of your workload. I'm not that familiar with SIMD performance characteristics, but I wouldn't be surprised if that's not always the case.

show 1 reply
adgjlsfhk1today at 6:52 AM

This is one of the nice things about JIT languages. you defer the compiler time decisions to runtime and this get to choose based on what the user has