Hacker News new | ask | show | jobs
by doctorsher 467 days ago
I am interested in the CPU intrinsics detection in a single header file, if you don’t mind dropping the link.
2 comments

https://zolk3ri.name/cgit/cpudetect/about/ (direct link to the header file: https://zolk3ri.name/cgit/cpudetect/tree/cpudetect.h)

If you are unsure about something, or it misses something you'd like added, feel free to e-mail the author. I am in touch with him at times and he seems friendly.

I remember he wanted to implement more than just detecting CPU instructions, but he did not want to make it bloated with checking for cache sizes and whatnot (can't remember the details).

Here is the code I use to detect available CPU features at runtime and dispatch the correct kernels - https://github.com/ashvardanian/StringZilla/blob/main/c/lib....

There are also several AVX-512 kernels for different CPU generations, so it’s obviously longer than just checking for AVX.