jeffamstutz / tsimd

Fundamental C++ SIMD types for Intel CPUs (sse, avx, avx2, avx512)
MIT License
343 stars 20 forks source link

mavx512bw flag #16

Open baoxingsong opened 3 years ago

baoxingsong commented 3 years ago

Dear friends,

I am having a function implemented using the avx512, avx2, sse4_1 and sse2, four versions in total using cpp. I am trying to identify if the "avx512bw", "avx2", "sse4_1", "sse2" are available in sequential using cmake and will compile the code using a GNU GCC compiler.

I noticed the flags in your code: "set(FLAGS_SSE2 "-msse2") set(FLAGS_SSE42 "-msse4.2") set(FLAGS_AVX "-mavx") set(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2") set(FLAGS_AVX512KNL "-march=knl") set(FLAGS_AVX512SKX "-march=skylake-avx512")"

I am wondering is there any way to detect the availability of avx512bw and add "-mavx512bw" into the compiler flags, please?

jeffamstutz commented 3 years ago

Hi,

The flags in the project are just used to build the examples. If you are using tsimd in your own code, then managing compiler flags to enable certain instruction sets is up to the build system for your code: tsimd doesn't have any real connection with CMake.

Are you needing to check if GCC can understand if -mavx512bw is a valid flag, or if the CPU you are building with can use it?