Choosing SSE / AVX Flag Advice

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Choosing SSE / AVX Flag Advice

Stephen McDowell
Hello,

I was originally using -march=native for non-windows, but in my attempts to support embedded architectures learned that this flag is broken and/or does nothing for many compilers (fixed for ARM in gcc 8 I think though).  Enter the glorious work of the folks at Vc: https://github.com/VcDevel/Vc/blob/master/cmake/OptimizeForArchitecture.cmake

It’s quite comprehensive, and though it may not be ready for cross-compiling (still testing that, but I have to learn how to cross compile first!), it does appear to support native optimizations for embedded architectures.  Here is my concern, the following flags are generated:

-march=haswell;-msse2;-msse3;-mssse3;-msse4.1;-msse4.2;-mavx;-mfma;-mbmi2;-mavx2;-mno-sse4a;-mno-xop;-mno-fma4;-mno-avx512f;-mno-avx512vl;-mno-avx512pf;-mno-avx512er;-mno-avx512cd;-mno-avx512dq;-mno-avx512bw

I am concerned only because these flags will be a part of the PUBLIC compile features of a library, Eigen is the main math library backend as well as there are some templated image conversion routines that use SSE2 intrinsics to operate in my library.  Having that many additional flags could ultimately lead to undesirable consequences such as command line arguments being too long?

I’m currently reworking it so that just the highest version (e.g. -mavx2) is used, but I’m not sure if I should even be worried about this.

Thanks for any thoughts!

-Stephen


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake