build: allow disabling avx512 support via compiler flag
PATCH 1/1 build: allow disabling avx512 support via compiler flag
DPDK build checks for build support for various instruction sets by checking both the target machine and the compiler for support. However, any disabling of instruction sets via compiler flags was not taken into account in many cases. For AVX512 support, check for a user-specified "no-avx512f" flag in the c_args parameter before checking if the compiler can actually build AVX512 code.
As well as providing an option for the user, this can be used to test builds without AVX512 without having to use an older compiler.
--- config/x86/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
config/x86/meson.build +2 -1
@@ -17,7 +17,8 @@ endif cc_avx512_flags = ['-mavx512f', '-mavx512vl', '-mavx512dq', '-mavx512bw'] cc_has_avx512 = false target_has_avx512 = false -if binutils_ok and cc.has_multi_arguments(cc_avx512_flags) +if (binutils_ok and cc.has_multi_arguments(cc_avx512_flags) + and '-mno-avx512f' not in get_option('c_args')) # check if compiler is working with _mm512_extracti64x4_epi64 # Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887 code = '''#include <immintrin.h>
Signature · 1 line
2.43.0
Quoted 30 lines
DPDK build checks for build support for various instruction sets by checking both the target machine and the compiler for support. However, any disabling of instruction sets via compiler flags was not taken into account in many cases. For AVX512 support, check for a user-specified "no-avx512f" flag in the
c_argsparameter before checking if the compiler can actually build AVX512 code.As well as providing an option for the user, this can be used to test builds without AVX512 without having to use an older compiler.
Signed-off-by Bruce Richardson <[email protected]>--- config/x86/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)config/x86/meson.build +2
-2@@ -17,7 +17,8 @@ endif cc_avx512_flags = ['-mavx512f', '-mavx512vl', '-mavx512dq', '-mavx512bw'] cc_has_avx512 = false target_has_avx512 = false -if binutils_ok and cc.has_multi_arguments(cc_avx512_flags) +if (binutils_ok and cc.has_multi_arguments(cc_avx512_flags) + and '-mno-avx512f' not in get_option('c_args')) # check if compiler is working with _mm512_extracti64x4_epi64 # Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887 code = '''#include <immintrin.h> --
Quoted 1 line
2.43.0
Thanks Bruce,
tested ok for me, LGTM.
Thomas Monjalon
Applied11/02/2025 18:02, Stokes, Ian:
Quoted 10 lines
Quoted 10 lines
DPDK build checks for build support for various instruction sets by checking both the target machine and the compiler for support. However, any disabling of instruction sets via compiler flags was not taken into account in many cases. For AVX512 support, check for a user-specified "no-avx512f" flag in the
c_argsparameter before checking if the compiler can actually build AVX512 code.As well as providing an option for the user, this can be used to test builds without AVX512 without having to use an older compiler.
Quoted 7 lines
Quoted 1 line
Signed-off-by Bruce Richardson <[email protected]>Thanks Bruce,
tested ok for me, LGTM.
Acked-by Ian Stokes <[email protected]>
Applied, thanks.