Fix missing Detection for AVX OS Support #4325
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
A Fix for Issue #4323, where now in addition to the CPU Capabilities, the OS Support is also queried when checking for AVX/AVX2/AVX512 availability.
This is done by an additional check to the XCR_XFEATURE Register using the xgetbv instruction. Since this is not present on some older CPU's, we first need to check for it's availability with CPUID EAX=1 for bits 26 and 27 in ECX.
Tested on my System with an i7 7800X and Win8.1 (with support for AVX/AVX2 but not for AVX512), where avx/avx2 are still enabled, but avx-512 is now correctly disabled. Might require further testing on machines where AVX512 is confirmed to work as well as on linux.