shepmaster / cupid

Get information about the x86 and x86_64 processor
MIT License
34 stars 9 forks source link

[bug?] AVX / AVX2 /.. support #10

Open gnzlbg opened 6 years ago

gnzlbg commented 6 years ago

The cupid library returns whether the CPU avx flag is enabled or not. This only denotes whether the CPU supports AVX, but not wether an user-space program can use it.

For that to happen the OS must also support saving and restoring the SSE and AVX registers on a context-switch. A short explanation of how to detect this is given here.

I don't know if the current behavior is intended or unintended (it seems to be doing the naive thing only), but I just wanted to point it out because the run-time feature detection in the stdsimd crate answers the question "can the feature be used here?" which in some cases (avx, avx2, avx512) might lead to different answers than the cupid crate.