Search code examples
c++visual-studiovisual-c++intrinsicsavx512

Usage of __AVX512F__ in Visual Studio for compiling code


I want to use __AVX512F__ to compile specific parts of the code.

   #ifndef __AVX512F__
       #undef flag1
   #endif

To use the flag I right clicked on my visual studio project and set the enable enhanced instruction set. Even though I was using an AVX512 machine the flag1 was still getting undefined. I then also tried to set the flag __AVX512F__ in preprocessor directives after right clicking my proj file. But that also didnt work.

Should I do anything else to make this work and am I missing something here?


Solution

  • Thanks All. The AVX512F seems to be set irrespective of the machine configuration(processor supporting AVX512) if the compiler supports AVX512 and Enable Enhanced Instruction Set :Advanced Vector Extensions 512 (/arch:AVX512) is set. To use the flags and use those flags defined based on I needed to set that option across all those project files in the solution