Posted September 6, 20195 yr Detecting Advanced Vector Extensions (AVX) support in Visual Studio??? https://insufficientlycomplicated.wordpress.com/2011/11/07/detecting-intel-advanced-vector-extensions-avx-in-visual-studio/ The problem is that I have Visual Studio without Service Pack so _xgetbv method can't be used! Any other ways to detect if a CPU hash AVX?
September 6, 20195 yr Have you tried GetEnabledXStateFeatures? There is an example in the AVX Support Portal on how to use it. Alternatively a more simpler approach is IsProcessorFeaturePresent. Or in assembler calling CPUID... Ted.
September 6, 20195 yr 6 hours ago, CodeExplorer said: Visual Studio without Service Pack ..and any good reason NOT to install the service pack?
September 6, 20195 yr Author Thanks Ted for the good direction! Here is the working code: int isAvxSupported() { int HasAVX = 0; __asm { xor eax, eax cpuid cmp eax, 1 // does CPUID support eax = 1? jb not_supported mov eax, 1 cpuid and ecx, 402653184 // check 27 bit (OS uses XSAVE/XRSTOR) 018000000h cmp ecx, 402653184 // and 28 (AVX supported by CPU) 018000000h jne not_supported xor ecx, ecx // XFEATURE_ENABLED_MASK/XCR0 register number = 0 xgetbv // XFEATURE_ENABLED_MASK register is in edx:eax and eax, 6 // 110b cmp eax, 6 // check the AVX registers restore at context switch jne not_supported supported: mov HasAVX, 1 not_supported: mov HasAVX, 0 } return HasAVX; } I don't have AVX! https://stackoverflow.com/questions/44144763/avx-feature-detection-using-sigill-versus-cpu-probing Edited September 6, 20195 yr by CodeExplorer
September 7, 20195 yr Author 2 hours ago, Teddy Rogers said: What CPU do you have? Ted. AMD Athlon(tm) II X2 245 I know it is an very old CPU; I bought it 7 years ago! I've thought to buy new motherboard/CPU/RAM.
September 7, 20195 yr Intel Software Emulator can be used for running AVX apps on a non-AVX cpu. It emulates the unsupported instructions, so its quite slow than a native run, but better than not being able to run at all. https://software.intel.com/en-us/articles/intel-software-development-emulator
Create an account or sign in to comment