centralize AVX-512 feature detection
Subsystems (2)
cover centralize AVX-512 feature detection
The meson code to detect CPU and compiler support for AVX512 was duplicated across multiple drivers. Do all detection in just a single place to simplify the code.
Bruce Richardson (8):
config/x86: add global defines for checking AVX-512 event/dlb2: use global AVX-512 variables common/idpf: use global AVX-512 variables net/cpfl: use global AVX-512 variables net/i40e: use global AVX-512 variables net/iavf: use global AVX-512 variables net/ice: use global AVX-512 variables net/idpf: use global AVX-512 variables
config/x86/meson.build | 12 +++++++++- drivers/common/idpf/meson.build | 17 ++----------- drivers/event/dlb2/meson.build | 42 +++++++-------------------------- drivers/net/cpfl/meson.build | 19 ++------------- drivers/net/i40e/meson.build | 13 ++-------- drivers/net/iavf/meson.build | 13 ++-------- drivers/net/ice/meson.build | 15 ++---------- drivers/net/idpf/meson.build | 19 ++------------- 8 files changed, 32 insertions(+), 118 deletions(-)
--
2.43.0
PATCH 1/8 config/x86: add global defines for checking AVX-512
Rather than having each driver do its own checking for AVX-512 support, let's do it once in config/x86/meson.build and let all drivers re-use that result.
--- config/x86/meson.build | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
config/x86/meson.build +11 -1
@@ -16,7 +16,8 @@ endif # check if compiler is working with _mm512_extracti64x4_epi64 # Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887 -if cc.has_argument('-mavx512f') +cc_has_avx512 = false +if binutils_ok and cc.has_argument('-mavx512f') code = '''#include <immintrin.h> void test(__m512i zmm){ __m256i ymm = _mm512_extracti64x4_epi64(zmm, 0);}'''
@@ -24,6 +25,15 @@ if cc.has_argument('-mavx512f') if result == false machine_args += '-mno-avx512f' warning('Broken _mm512_extracti64x4_epi64, disabling AVX512 support') + else + cc_avx512_flags = ['-mavx512f', '-mavx512vl', '-mavx512dq', '-mavx512bw'] + cc_has_avx512 = cc.has_multi_arguments(cc_avx512_flags) + target_has_avx512 = ( + cc.get_define('__AVX512F__', args: machine_args) != '' and + cc.get_define('__AVX512BW__', args: machine_args) != '' and + cc.get_define('__AVX512DQ__', args: machine_args) != '' and + cc.get_define('__AVX512VL__', args: machine_args) != '' + ) endif endif
Signature · 1 line
2.43.0
PATCH 2/8 event/dlb2: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/event/dlb2/meson.build | 42 ++++++++-------------------------- 1 file changed, 9 insertions(+), 33 deletions(-)
drivers/event/dlb2/meson.build +9 -33
@@ -26,43 +26,19 @@ sources = files( # we are building 64-bit binary (checked above) AND binutils # can generate proper code -if binutils_ok +if target_has_avx512 + sources += files('dlb2_avx512.c') + cflags += '-DCC_AVX512_SUPPORT' - # compile AVX512 version if either: - # a. we have AVX512VL supported in minimum instruction set - # baseline - # b. it's not minimum instruction set, but supported by - # compiler - # - # in former case, just add avx512 C file to files list - # in latter case, compile c file to static lib, using correct - # compiler flags, and then have the .o file from static lib - # linked into main lib. - - # check if all required flags already enabled (variant a). - dlb2_avx512_on = false - if cc.get_define('__AVX512VL__', args: machine_args) != '' - dlb2_avx512_on = true - endif - - if dlb2_avx512_on == true - - sources += files('dlb2_avx512.c') - cflags += '-DCC_AVX512_SUPPORT' - - elif cc.has_multi_arguments('-mavx512vl') - - cflags += '-DCC_AVX512_SUPPORT' - avx512_tmplib = static_library('avx512_tmp', +elif cc_has_avx512 + cflags += '-DCC_AVX512_SUPPORT' + avx512_tmplib = static_library('avx512_tmp', 'dlb2_avx512.c', dependencies: [static_rte_eal, static_rte_eventdev], - c_args: cflags + ['-mavx512vl']) - objs += avx512_tmplib.extract_objects('dlb2_avx512.c') - else - sources += files('dlb2_sse.c') - endif + c_args: cflags + cc_avx512_flags) + objs += avx512_tmplib.extract_objects('dlb2_avx512.c') else - sources += files('dlb2_sse.c') + sources += files('dlb2_sse.c') endif headers = files('rte_pmd_dlb2.h')
Signature · 1 line
2.43.0
PATCH 3/8 common/idpf: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/common/idpf/meson.build | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
drivers/common/idpf/meson.build +2 -15
@@ -16,22 +16,9 @@ sources = files( ) if arch_subdir == 'x86' - idpf_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '' and - cc.get_define('__AVX512DQ__', args: machine_args) != '' - ) - - idpf_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw') and - cc.has_argument('-mavx512dq') - ) - - if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true + if target_has_avx512 or cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = [cflags, '-mavx512f', '-mavx512bw', '-mavx512dq'] + avx512_args = [cflags] + cc_avx512_flags if cc.has_argument('-march=skylake-avx512') avx512_args += '-march=skylake-avx512' endif
Signature · 1 line
2.43.0
PATCH 4/8 net/cpfl: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/cpfl/meson.build | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/net/cpfl/meson.build +2 -17
@@ -22,23 +22,8 @@ sources = files( 'cpfl_rules.c', ) -if arch_subdir == 'x86' - cpfl_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '' and - cc.get_define('__AVX512DQ__', args: machine_args) != '' - ) - - cpfl_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw') and - cc.has_argument('-mavx512dq') - ) - - if cpfl_avx512_cpu_support == true or cpfl_avx512_cc_support == true - cflags += ['-DCC_AVX512_SUPPORT'] - endif +if arch_subdir == 'x86' and cc_has_avx512 + cflags += ['-DCC_AVX512_SUPPORT'] endif if dpdk_conf.has('RTE_HAS_JANSSON')
Signature · 1 line
2.43.0
PATCH 5/8 net/i40e: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/i40e/meson.build | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/i40e/meson.build +2 -11
@@ -57,18 +57,9 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) objs += i40e_avx2_lib.extract_objects('i40e_rxtx_vec_avx2.c') - i40e_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '') - - i40e_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw')) - - if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true + if cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = [cflags, '-mavx512f', '-mavx512bw'] + avx512_args = cflags + cc_avx512_flags if cc.has_argument('-march=skylake-avx512') avx512_args += '-march=skylake-avx512' endif
Signature · 1 line
2.43.0
PATCH 6/8 net/iavf: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/iavf/meson.build | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/iavf/meson.build +2 -11
@@ -39,18 +39,9 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) objs += iavf_avx2_lib.extract_objects('iavf_rxtx_vec_avx2.c') - iavf_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '') - - iavf_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw')) - - if iavf_avx512_cpu_support == true or iavf_avx512_cc_support == true + if cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = [cflags, '-mavx512f', '-mavx512bw'] + avx512_args = cflags + cc_avx512_flags if cc.has_argument('-march=skylake-avx512') avx512_args += '-march=skylake-avx512' endif
Signature · 1 line
2.43.0
PATCH 7/8 net/ice: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/ice/meson.build | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/net/ice/meson.build +2 -13
@@ -35,20 +35,9 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) objs += ice_avx2_lib.extract_objects('ice_rxtx_vec_avx2.c') - ice_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '' - ) - - ice_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw') - ) - - if ice_avx512_cpu_support == true or ice_avx512_cc_support == true + if cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = [cflags, '-mavx512f', '-mavx512bw'] + avx512_args = cflags + cc_avx512_flags if cc.has_argument('-march=skylake-avx512') avx512_args += '-march=skylake-avx512' endif
Signature · 1 line
2.43.0
PATCH 8/8 net/idpf: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/idpf/meson.build | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/net/idpf/meson.build +2 -17
@@ -14,21 +14,6 @@ sources = files( 'idpf_rxtx.c', ) -if arch_subdir == 'x86' - idpf_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '' and - cc.get_define('__AVX512DQ__', args: machine_args) != '' - ) - - idpf_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw') and - cc.has_argument('-mavx512dq') - ) - - if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true - cflags += ['-DCC_AVX512_SUPPORT'] - endif +if arch_subdir == 'x86'and cc_has_avx512 + cflags += ['-DCC_AVX512_SUPPORT'] endif
Signature · 1 line
2.43.0
v2 cover centralize AVX-512 feature detection
In reply to Bruce RichardsonThe meson code to detect CPU and compiler support for AVX512 was duplicated across multiple drivers. Do all detection in just a single place to simplify the code.
v2: ensure that target_has_avx512 is always defined on x86 to fix build errors
Bruce Richardson (8):
config/x86: add global defines for checking AVX-512 event/dlb2: use global AVX-512 variables common/idpf: use global AVX-512 variables net/cpfl: use global AVX-512 variables net/i40e: use global AVX-512 variables net/iavf: use global AVX-512 variables net/ice: use global AVX-512 variables net/idpf: use global AVX-512 variables
config/x86/meson.build | 19 +++++++++++---- drivers/common/idpf/meson.build | 17 ++----------- drivers/event/dlb2/meson.build | 42 +++++++-------------------------- drivers/net/cpfl/meson.build | 19 ++------------- drivers/net/i40e/meson.build | 13 ++-------- drivers/net/iavf/meson.build | 13 ++-------- drivers/net/ice/meson.build | 15 ++---------- drivers/net/idpf/meson.build | 19 ++------------- 8 files changed, 36 insertions(+), 121 deletions(-)
--
2.43.0
PATCH v2 1/8 config/x86: add global defines for checking AVX-512
Rather than having each driver do its own checking for AVX-512 support, let's do it once in config/x86/meson.build and let all drivers re-use that result.
--- config/x86/meson.build | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
config/x86/meson.build +15 -4
@@ -14,16 +14,27 @@ if is_linux or cc.get_id() == 'gcc' endif endif -# check if compiler is working with _mm512_extracti64x4_epi64 -# Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887 -if cc.has_argument('-mavx512f') +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) + # check if compiler is working with _mm512_extracti64x4_epi64 + # Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887 code = '''#include <immintrin.h> void test(__m512i zmm){ __m256i ymm = _mm512_extracti64x4_epi64(zmm, 0);}''' - result = cc.compiles(code, args : '-mavx512f', name : 'AVX512 checking') + result = cc.compiles(code, args : cc_avx512_flags, name : 'AVX512 checking') if result == false machine_args += '-mno-avx512f' warning('Broken _mm512_extracti64x4_epi64, disabling AVX512 support') + else + cc_has_avx512 = true + target_has_avx512 = ( + cc.get_define('__AVX512F__', args: machine_args) != '' and + cc.get_define('__AVX512BW__', args: machine_args) != '' and + cc.get_define('__AVX512DQ__', args: machine_args) != '' and + cc.get_define('__AVX512VL__', args: machine_args) != '' + ) endif endif
Signature · 1 line
2.43.0
PATCH v2 2/8 event/dlb2: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/event/dlb2/meson.build | 42 ++++++++-------------------------- 1 file changed, 9 insertions(+), 33 deletions(-)
drivers/event/dlb2/meson.build +9 -33
@@ -26,43 +26,19 @@ sources = files( # we are building 64-bit binary (checked above) AND binutils # can generate proper code -if binutils_ok +if target_has_avx512 + sources += files('dlb2_avx512.c') + cflags += '-DCC_AVX512_SUPPORT' - # compile AVX512 version if either: - # a. we have AVX512VL supported in minimum instruction set - # baseline - # b. it's not minimum instruction set, but supported by - # compiler - # - # in former case, just add avx512 C file to files list - # in latter case, compile c file to static lib, using correct - # compiler flags, and then have the .o file from static lib - # linked into main lib. - - # check if all required flags already enabled (variant a). - dlb2_avx512_on = false - if cc.get_define('__AVX512VL__', args: machine_args) != '' - dlb2_avx512_on = true - endif - - if dlb2_avx512_on == true - - sources += files('dlb2_avx512.c') - cflags += '-DCC_AVX512_SUPPORT' - - elif cc.has_multi_arguments('-mavx512vl') - - cflags += '-DCC_AVX512_SUPPORT' - avx512_tmplib = static_library('avx512_tmp', +elif cc_has_avx512 + cflags += '-DCC_AVX512_SUPPORT' + avx512_tmplib = static_library('avx512_tmp', 'dlb2_avx512.c', dependencies: [static_rte_eal, static_rte_eventdev], - c_args: cflags + ['-mavx512vl']) - objs += avx512_tmplib.extract_objects('dlb2_avx512.c') - else - sources += files('dlb2_sse.c') - endif + c_args: cflags + cc_avx512_flags) + objs += avx512_tmplib.extract_objects('dlb2_avx512.c') else - sources += files('dlb2_sse.c') + sources += files('dlb2_sse.c') endif headers = files('rte_pmd_dlb2.h')
Signature · 1 line
2.43.0
PATCH v2 3/8 common/idpf: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/common/idpf/meson.build | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
drivers/common/idpf/meson.build +2 -15
@@ -16,22 +16,9 @@ sources = files( ) if arch_subdir == 'x86' - idpf_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '' and - cc.get_define('__AVX512DQ__', args: machine_args) != '' - ) - - idpf_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw') and - cc.has_argument('-mavx512dq') - ) - - if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true + if cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = [cflags, '-mavx512f', '-mavx512bw', '-mavx512dq'] + avx512_args = [cflags] + cc_avx512_flags if cc.has_argument('-march=skylake-avx512') avx512_args += '-march=skylake-avx512' endif
Signature · 1 line
2.43.0
PATCH v2 4/8 net/cpfl: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/cpfl/meson.build | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/net/cpfl/meson.build +2 -17
@@ -22,23 +22,8 @@ sources = files( 'cpfl_rules.c', ) -if arch_subdir == 'x86' - cpfl_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '' and - cc.get_define('__AVX512DQ__', args: machine_args) != '' - ) - - cpfl_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw') and - cc.has_argument('-mavx512dq') - ) - - if cpfl_avx512_cpu_support == true or cpfl_avx512_cc_support == true - cflags += ['-DCC_AVX512_SUPPORT'] - endif +if arch_subdir == 'x86' and cc_has_avx512 + cflags += ['-DCC_AVX512_SUPPORT'] endif if dpdk_conf.has('RTE_HAS_JANSSON')
Signature · 1 line
2.43.0
PATCH v2 5/8 net/i40e: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/i40e/meson.build | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/i40e/meson.build +2 -11
@@ -57,18 +57,9 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) objs += i40e_avx2_lib.extract_objects('i40e_rxtx_vec_avx2.c') - i40e_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '') - - i40e_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw')) - - if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true + if cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = [cflags, '-mavx512f', '-mavx512bw'] + avx512_args = cflags + cc_avx512_flags if cc.has_argument('-march=skylake-avx512') avx512_args += '-march=skylake-avx512' endif
Signature · 1 line
2.43.0
PATCH v2 6/8 net/iavf: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/iavf/meson.build | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/iavf/meson.build +2 -11
@@ -39,18 +39,9 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) objs += iavf_avx2_lib.extract_objects('iavf_rxtx_vec_avx2.c') - iavf_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '') - - iavf_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw')) - - if iavf_avx512_cpu_support == true or iavf_avx512_cc_support == true + if cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = [cflags, '-mavx512f', '-mavx512bw'] + avx512_args = cflags + cc_avx512_flags if cc.has_argument('-march=skylake-avx512') avx512_args += '-march=skylake-avx512' endif
Signature · 1 line
2.43.0
PATCH v2 7/8 net/ice: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/ice/meson.build | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/net/ice/meson.build +2 -13
@@ -35,20 +35,9 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) objs += ice_avx2_lib.extract_objects('ice_rxtx_vec_avx2.c') - ice_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '' - ) - - ice_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw') - ) - - if ice_avx512_cpu_support == true or ice_avx512_cc_support == true + if cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = [cflags, '-mavx512f', '-mavx512bw'] + avx512_args = cflags + cc_avx512_flags if cc.has_argument('-march=skylake-avx512') avx512_args += '-march=skylake-avx512' endif
Signature · 1 line
2.43.0
PATCH v2 8/8 net/idpf: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/idpf/meson.build | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/net/idpf/meson.build +2 -17
@@ -14,21 +14,6 @@ sources = files( 'idpf_rxtx.c', ) -if arch_subdir == 'x86' - idpf_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '' and - cc.get_define('__AVX512DQ__', args: machine_args) != '' - ) - - idpf_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw') and - cc.has_argument('-mavx512dq') - ) - - if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true - cflags += ['-DCC_AVX512_SUPPORT'] - endif +if arch_subdir == 'x86'and cc_has_avx512 + cflags += ['-DCC_AVX512_SUPPORT'] endif
Signature · 1 line
2.43.0
Quoted 17 lines · Bruce Richardson
The meson code to detect CPU and compiler support for AVX512 was duplicated across multiple drivers. Do all detection in just a single place to simplify the code.
v2: ensure that
target_has_avx512is always defined on x86 to fix build errorsBruce Richardson (8):
config/x86: add global defines for checking AVX-512 event/dlb2: use global AVX-512 variables common/idpf: use global AVX-512 variables net/cpfl: use global AVX-512 variables net/i40e: use global AVX-512 variables net/iavf: use global AVX-512 variables net/ice: use global AVX-512 variables net/idpf: use global AVX-512 variables
Quoted 9 lines
config/x86/meson.build | 19 +++++++++++---- drivers/common/idpf/meson.build | 17 ++----------- drivers/event/dlb2/meson.build | 42 +++++++-------------------------- drivers/net/cpfl/meson.build | 19 ++------------- drivers/net/i40e/meson.build | 13 ++-------- drivers/net/iavf/meson.build | 13 ++-------- drivers/net/ice/meson.build | 15 ++---------- drivers/net/idpf/meson.build | 19 ++------------- 8 files changed, 36 insertions(+), 121 deletions(-)
Thanks for this cleanup, I have two comments.
- Some drivers were going into great lenghts to check that individiual avx512 features were available.
With this series, we end up requiring support for all features to announce avx512 availability.
Are we perhaps disabling AVX512 support with some toolchains, out there, supporting only part of the set?
- Some drivers were checking for presence of -mno-avx512f in machine_args as a way to disable building any AVX512 stuff. This gets discarded with this series.
Signature · 1 line
David Marchand
Quoted 29 lines · David Marchand
Quoted 17 lines · Bruce Richardson
The meson code to detect CPU and compiler support for AVX512 was duplicated across multiple drivers. Do all detection in just a single place to simplify the code.
v2: ensure that
target_has_avx512is always defined on x86 to fix build errorsBruce Richardson (8):
config/x86: add global defines for checking AVX-512 event/dlb2: use global AVX-512 variables common/idpf: use global AVX-512 variables net/cpfl: use global AVX-512 variables net/i40e: use global AVX-512 variables net/iavf: use global AVX-512 variables net/ice: use global AVX-512 variables net/idpf: use global AVX-512 variablesQuoted 9 lines
config/x86/meson.build | 19 +++++++++++---- drivers/common/idpf/meson.build | 17 ++----------- drivers/event/dlb2/meson.build | 42 +++++++-------------------------- drivers/net/cpfl/meson.build | 19 ++------------- drivers/net/i40e/meson.build | 13 ++-------- drivers/net/iavf/meson.build | 13 ++-------- drivers/net/ice/meson.build | 15 ++---------- drivers/net/idpf/meson.build | 19 ++------------- 8 files changed, 36 insertions(+), 121 deletions(-)
Quoted 9 lines
Thanks for this cleanup, I have two comments.
- Some drivers were going into great lenghts to check that individiual avx512 features were available.
With this series, we end up requiring support for all features to announce avx512 availability.
Are we perhaps disabling AVX512 support with some toolchains, out there, supporting only part of the set?
The various AVX-512 feature sets checked for (F, BW, VL, DQ) were all introduced in the same hardware generation - all are available in gcc when using -march=skylake-avx512 or later, or -march=znver4. On the toolchain side, gcc introduced all these flags simultaneously in gcc-6 [1]. For clang/llvm, testing with godbolt for compiler errors/warnings indicates that all these 4 avx512 flags are available from clang 3.6 - the minimum we support in DPDK [2]
[1] https://gcc.gnu.org/gcc-6/changes.html
[2] https://doc.dpdk.org/guides/linux_gsg/sys_reqs.html#compilation-of-the-dpdk
Quoted 4 lines
- Some drivers were checking for presence of -mno-avx512f in
machine_argsas a way to disable building any AVX512 stuff. This gets discarded with this series.
Yes, because it should no longer be necessary. The places in the build system where we set the no-avx512f flag are reworked so that we don't have cc_has_avx512 set.
Regards,
/Bruce
Quoted 49 lines · Bruce Richardson
Quoted 29 lines · David Marchand
Quoted 17 lines · Bruce Richardson
The meson code to detect CPU and compiler support for AVX512 was duplicated across multiple drivers. Do all detection in just a single place to simplify the code.
v2: ensure that
target_has_avx512is always defined on x86 to fix build errorsBruce Richardson (8):
config/x86: add global defines for checking AVX-512 event/dlb2: use global AVX-512 variables common/idpf: use global AVX-512 variables net/cpfl: use global AVX-512 variables net/i40e: use global AVX-512 variables net/iavf: use global AVX-512 variables net/ice: use global AVX-512 variables net/idpf: use global AVX-512 variablesQuoted 9 lines
config/x86/meson.build | 19 +++++++++++---- drivers/common/idpf/meson.build | 17 ++----------- drivers/event/dlb2/meson.build | 42 +++++++-------------------------- drivers/net/cpfl/meson.build | 19 ++------------- drivers/net/i40e/meson.build | 13 ++-------- drivers/net/iavf/meson.build | 13 ++-------- drivers/net/ice/meson.build | 15 ++---------- drivers/net/idpf/meson.build | 19 ++------------- 8 files changed, 36 insertions(+), 121 deletions(-)Quoted 9 lines
Thanks for this cleanup, I have two comments.
- Some drivers were going into great lenghts to check that individiual avx512 features were available.
With this series, we end up requiring support for all features to announce avx512 availability.
Are we perhaps disabling AVX512 support with some toolchains, out there, supporting only part of the set?The various AVX-512 feature sets checked for (F, BW, VL, DQ) were all introduced in the same hardware generation - all are available in gcc when using -march=skylake-avx512 or later, or -march=znver4. On the toolchain side, gcc introduced all these flags simultaneously in gcc-6 [1]. For clang/llvm, testing with godbolt for compiler errors/warnings indicates that all these 4 avx512 flags are available from clang 3.6 - the minimum we support in DPDK [2]
Quoted 2 lines
[1] https://gcc.gnu.org/gcc-6/changes.html
[2] https://doc.dpdk.org/guides/linux_gsg/sys_reqs.html#compilation-of-the-dpdk
Perfect, thanks for the details.
Quoted 9 lines
Quoted 5 lines
- Some drivers were checking for presence of -mno-avx512f in
machine_argsas a way to disable building any AVX512 stuff. This gets discarded with this series.Yes, because it should no longer be necessary. The places in the build system where we set the no-avx512f flag are reworked so that we don't have
cc_has_avx512set.
Ok, it is clearer now.
Last comment on style:
$ git grep cc_avx512_flags drivers/ drivers/common/idpf/meson.build: avx512_args = [cflags] + cc_avx512_flags drivers/event/dlb2/meson.build: c_args: cflags + cc_avx512_flags) drivers/net/i40e/meson.build: avx512_args = cflags + cc_avx512_flags drivers/net/iavf/meson.build: avx512_args = cflags + cc_avx512_flags drivers/net/ice/meson.build: avx512_args = cflags + cc_avx512_flags
I think it is safe to remove the [] around cflags in common/idpf, right?
Do you have some cycles to send a v2 and convert lib/net and net/virtio ? Otherwise, can you do a followup patch for rc2?
Thanks.
Signature · 1 line
David Marchand
Quoted 77 lines · David Marchand
Quoted 49 lines · Bruce Richardson
Quoted 29 lines · David Marchand
Quoted 17 lines · Bruce Richardson
The meson code to detect CPU and compiler support for AVX512 was duplicated across multiple drivers. Do all detection in just a single place to simplify the code.
v2: ensure that
target_has_avx512is always defined on x86 to fix build errorsBruce Richardson (8):
config/x86: add global defines for checking AVX-512 event/dlb2: use global AVX-512 variables common/idpf: use global AVX-512 variables net/cpfl: use global AVX-512 variables net/i40e: use global AVX-512 variables net/iavf: use global AVX-512 variables net/ice: use global AVX-512 variables net/idpf: use global AVX-512 variablesQuoted 9 lines
config/x86/meson.build | 19 +++++++++++---- drivers/common/idpf/meson.build | 17 ++----------- drivers/event/dlb2/meson.build | 42 +++++++-------------------------- drivers/net/cpfl/meson.build | 19 ++------------- drivers/net/i40e/meson.build | 13 ++-------- drivers/net/iavf/meson.build | 13 ++-------- drivers/net/ice/meson.build | 15 ++---------- drivers/net/idpf/meson.build | 19 ++------------- 8 files changed, 36 insertions(+), 121 deletions(-)Quoted 9 lines
Thanks for this cleanup, I have two comments.
- Some drivers were going into great lenghts to check that individiual avx512 features were available.
With this series, we end up requiring support for all features to announce avx512 availability.
Are we perhaps disabling AVX512 support with some toolchains, out there, supporting only part of the set?The various AVX-512 feature sets checked for (F, BW, VL, DQ) were all introduced in the same hardware generation - all are available in gcc when using -march=skylake-avx512 or later, or -march=znver4. On the toolchain side, gcc introduced all these flags simultaneously in gcc-6 [1]. For clang/llvm, testing with godbolt for compiler errors/warnings indicates that all these 4 avx512 flags are available from clang 3.6 - the minimum we support in DPDK [2]
Quoted 2 lines
[1] https://gcc.gnu.org/gcc-6/changes.html
[2] https://doc.dpdk.org/guides/linux_gsg/sys_reqs.html#compilation-of-the-dpdkPerfect, thanks for the details.
Quoted 9 lines
Quoted 5 lines
- Some drivers were checking for presence of -mno-avx512f in
machine_argsas a way to disable building any AVX512 stuff. This gets discarded with this series.Yes, because it should no longer be necessary. The places in the build system where we set the no-avx512f flag are reworked so that we don't have
cc_has_avx512set.Ok, it is clearer now.
Last comment on style:
$ git grep cc_avx512_flags drivers/ drivers/common/idpf/meson.build: avx512_args = [cflags] + cc_avx512_flags drivers/event/dlb2/meson.build: c_args: cflags + cc_avx512_flags) drivers/net/i40e/meson.build: avx512_args = cflags + cc_avx512_flags drivers/net/iavf/meson.build: avx512_args = cflags + cc_avx512_flags drivers/net/ice/meson.build: avx512_args = cflags + cc_avx512_flags
Quoted 2 lines
I think it is safe to remove the [] around cflags in common/idpf, right?
Yep.
Quoted 4 lines
Do you have some cycles to send a v2 and convert lib/net and net/virtio ? Otherwise, can you do a followup patch for rc2?
I'll see what I can do today.
/Bruce
v3 cover centralize AVX-512 feature detection
In reply to Bruce RichardsonThe meson code to detect CPU and compiler support for AVX512 was duplicated across multiple components. Do all detection in just a single place to simplify the code.
v3: add in patches for net lib and virtio driver
v2: ensure that target_has_avx512 is always defined on x86 to fix build errors
Bruce Richardson (10):
config/x86: add global defines for checking AVX-512 event/dlb2: use global AVX-512 variables common/idpf: use global AVX-512 variables net/cpfl: use global AVX-512 variables net/i40e: use global AVX-512 variables net/iavf: use global AVX-512 variables net/ice: use global AVX-512 variables net/idpf: use global AVX-512 variables net/virtio: use global AVX-512 variables
net: use global AVX-512 variables
config/x86/meson.build | 19 +++++++++++---- drivers/common/idpf/meson.build | 17 ++----------- drivers/event/dlb2/meson.build | 42 +++++++-------------------------- drivers/net/cpfl/meson.build | 19 ++------------- drivers/net/i40e/meson.build | 13 ++-------- drivers/net/iavf/meson.build | 13 ++-------- drivers/net/ice/meson.build | 15 ++---------- drivers/net/idpf/meson.build | 19 ++------------- drivers/net/virtio/meson.build | 32 ++++++++++++------------- lib/net/meson.build | 40 ++++--------------------------- 10 files changed, 55 insertions(+), 174 deletions(-)
--
2.43.0
PATCH v3 1/10 config/x86: add global defines for checking AVX-512
Rather than having each driver do its own checking for AVX-512 support, let's do it once in config/x86/meson.build and let all drivers re-use that result.
--- config/x86/meson.build | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
config/x86/meson.build +15 -4
@@ -14,16 +14,27 @@ if is_linux or cc.get_id() == 'gcc' endif endif -# check if compiler is working with _mm512_extracti64x4_epi64 -# Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887 -if cc.has_argument('-mavx512f') +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) + # check if compiler is working with _mm512_extracti64x4_epi64 + # Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887 code = '''#include <immintrin.h> void test(__m512i zmm){ __m256i ymm = _mm512_extracti64x4_epi64(zmm, 0);}''' - result = cc.compiles(code, args : '-mavx512f', name : 'AVX512 checking') + result = cc.compiles(code, args : cc_avx512_flags, name : 'AVX512 checking') if result == false machine_args += '-mno-avx512f' warning('Broken _mm512_extracti64x4_epi64, disabling AVX512 support') + else + cc_has_avx512 = true + target_has_avx512 = ( + cc.get_define('__AVX512F__', args: machine_args) != '' and + cc.get_define('__AVX512BW__', args: machine_args) != '' and + cc.get_define('__AVX512DQ__', args: machine_args) != '' and + cc.get_define('__AVX512VL__', args: machine_args) != '' + ) endif endif
Signature · 1 line
2.43.0
PATCH v3 2/10 event/dlb2: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/event/dlb2/meson.build | 42 ++++++++-------------------------- 1 file changed, 9 insertions(+), 33 deletions(-)
drivers/event/dlb2/meson.build +9 -33
@@ -26,43 +26,19 @@ sources = files( # we are building 64-bit binary (checked above) AND binutils # can generate proper code -if binutils_ok +if target_has_avx512 + sources += files('dlb2_avx512.c') + cflags += '-DCC_AVX512_SUPPORT' - # compile AVX512 version if either: - # a. we have AVX512VL supported in minimum instruction set - # baseline - # b. it's not minimum instruction set, but supported by - # compiler - # - # in former case, just add avx512 C file to files list - # in latter case, compile c file to static lib, using correct - # compiler flags, and then have the .o file from static lib - # linked into main lib. - - # check if all required flags already enabled (variant a). - dlb2_avx512_on = false - if cc.get_define('__AVX512VL__', args: machine_args) != '' - dlb2_avx512_on = true - endif - - if dlb2_avx512_on == true - - sources += files('dlb2_avx512.c') - cflags += '-DCC_AVX512_SUPPORT' - - elif cc.has_multi_arguments('-mavx512vl') - - cflags += '-DCC_AVX512_SUPPORT' - avx512_tmplib = static_library('avx512_tmp', +elif cc_has_avx512 + cflags += '-DCC_AVX512_SUPPORT' + avx512_tmplib = static_library('avx512_tmp', 'dlb2_avx512.c', dependencies: [static_rte_eal, static_rte_eventdev], - c_args: cflags + ['-mavx512vl']) - objs += avx512_tmplib.extract_objects('dlb2_avx512.c') - else - sources += files('dlb2_sse.c') - endif + c_args: cflags + cc_avx512_flags) + objs += avx512_tmplib.extract_objects('dlb2_avx512.c') else - sources += files('dlb2_sse.c') + sources += files('dlb2_sse.c') endif headers = files('rte_pmd_dlb2.h')
Signature · 1 line
2.43.0
PATCH v3 3/10 common/idpf: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/common/idpf/meson.build | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
drivers/common/idpf/meson.build +2 -15
@@ -16,22 +16,9 @@ sources = files( ) if arch_subdir == 'x86' - idpf_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '' and - cc.get_define('__AVX512DQ__', args: machine_args) != '' - ) - - idpf_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw') and - cc.has_argument('-mavx512dq') - ) - - if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true + if cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = [cflags, '-mavx512f', '-mavx512bw', '-mavx512dq'] + avx512_args = cflags + cc_avx512_flags if cc.has_argument('-march=skylake-avx512') avx512_args += '-march=skylake-avx512' endif
Signature · 1 line
2.43.0
PATCH v3 4/10 net/cpfl: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/cpfl/meson.build | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/net/cpfl/meson.build +2 -17
@@ -22,23 +22,8 @@ sources = files( 'cpfl_rules.c', ) -if arch_subdir == 'x86' - cpfl_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '' and - cc.get_define('__AVX512DQ__', args: machine_args) != '' - ) - - cpfl_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw') and - cc.has_argument('-mavx512dq') - ) - - if cpfl_avx512_cpu_support == true or cpfl_avx512_cc_support == true - cflags += ['-DCC_AVX512_SUPPORT'] - endif +if arch_subdir == 'x86' and cc_has_avx512 + cflags += ['-DCC_AVX512_SUPPORT'] endif if dpdk_conf.has('RTE_HAS_JANSSON')
Signature · 1 line
2.43.0
PATCH v3 5/10 net/i40e: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/i40e/meson.build | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/i40e/meson.build +2 -11
@@ -57,18 +57,9 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) objs += i40e_avx2_lib.extract_objects('i40e_rxtx_vec_avx2.c') - i40e_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '') - - i40e_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw')) - - if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true + if cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = [cflags, '-mavx512f', '-mavx512bw'] + avx512_args = cflags + cc_avx512_flags if cc.has_argument('-march=skylake-avx512') avx512_args += '-march=skylake-avx512' endif
Signature · 1 line
2.43.0
PATCH v3 6/10 net/iavf: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/iavf/meson.build | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/iavf/meson.build +2 -11
@@ -39,18 +39,9 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) objs += iavf_avx2_lib.extract_objects('iavf_rxtx_vec_avx2.c') - iavf_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '') - - iavf_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw')) - - if iavf_avx512_cpu_support == true or iavf_avx512_cc_support == true + if cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = [cflags, '-mavx512f', '-mavx512bw'] + avx512_args = cflags + cc_avx512_flags if cc.has_argument('-march=skylake-avx512') avx512_args += '-march=skylake-avx512' endif
Signature · 1 line
2.43.0
PATCH v3 7/10 net/ice: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/ice/meson.build | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/net/ice/meson.build +2 -13
@@ -35,20 +35,9 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) objs += ice_avx2_lib.extract_objects('ice_rxtx_vec_avx2.c') - ice_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '' - ) - - ice_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw') - ) - - if ice_avx512_cpu_support == true or ice_avx512_cc_support == true + if cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = [cflags, '-mavx512f', '-mavx512bw'] + avx512_args = cflags + cc_avx512_flags if cc.has_argument('-march=skylake-avx512') avx512_args += '-march=skylake-avx512' endif
Signature · 1 line
2.43.0
PATCH v3 8/10 net/idpf: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/idpf/meson.build | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/net/idpf/meson.build +2 -17
@@ -14,21 +14,6 @@ sources = files( 'idpf_rxtx.c', ) -if arch_subdir == 'x86' - idpf_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '' and - cc.get_define('__AVX512DQ__', args: machine_args) != '' - ) - - idpf_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw') and - cc.has_argument('-mavx512dq') - ) - - if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true - cflags += ['-DCC_AVX512_SUPPORT'] - endif +if arch_subdir == 'x86'and cc_has_avx512 + cflags += ['-DCC_AVX512_SUPPORT'] endif
Signature · 1 line
2.43.0
PATCH v3 9/10 net/virtio: use global AVX-512 variables
In reply to Bruce RichardsonReplace per-driver checks for AVX-512 with the standard variables from config/x86.
--- drivers/net/virtio/meson.build | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
drivers/net/virtio/meson.build +15 -17
@@ -24,23 +24,21 @@ sources += files( deps += ['kvargs', 'bus_pci'] if arch_subdir == 'x86' - if not machine_args.contains('-mno-avx512f') - if cc.has_argument('-mavx512f') and cc.has_argument('-mavx512vl') and cc.has_argument('-mavx512bw') - cflags += ['-DCC_AVX512_SUPPORT'] - virtio_avx512_lib = static_library('virtio_avx512_lib', - 'virtio_rxtx_packed.c', - dependencies: [static_rte_ethdev, - static_rte_kvargs, static_rte_bus_pci], - include_directories: includes, - c_args: [cflags, '-mavx512f', '-mavx512bw', '-mavx512vl']) - objs += virtio_avx512_lib.extract_objects('virtio_rxtx_packed.c') - if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) - cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' - elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) - cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA' - elif (toolchain == 'icc' and cc.version().version_compare('>=16.0.0')) - cflags += '-DVIRTIO_ICC_UNROLL_PRAGMA' - endif + if cc_has_avx512 + cflags += ['-DCC_AVX512_SUPPORT'] + virtio_avx512_lib = static_library('virtio_avx512_lib', + 'virtio_rxtx_packed.c', + dependencies: [static_rte_ethdev, + static_rte_kvargs, static_rte_bus_pci], + include_directories: includes, + c_args: cflags + cc_avx512_flags) + objs += virtio_avx512_lib.extract_objects('virtio_rxtx_packed.c') + if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) + cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' + elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) + cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA' + elif (toolchain == 'icc' and cc.version().version_compare('>=16.0.0')) + cflags += '-DVIRTIO_ICC_UNROLL_PRAGMA' endif endif sources += files('virtio_rxtx_simple_sse.c')
Signature · 1 line
2.43.0
PATCH v3 10/10 net: use global AVX-512 variables
In reply to Bruce RichardsonReplace some library-specific checks for AVX-512 with the standard variables from config/x86.
--- lib/net/meson.build | 40 ++++------------------------------------ 1 file changed, 4 insertions(+), 36 deletions(-)
lib/net/meson.build +4 -36
@@ -38,25 +38,11 @@ deps += ['mbuf'] if dpdk_conf.has('RTE_ARCH_X86_64') net_crc_sse42_cpu_support = (cc.get_define('__PCLMUL__', args: machine_args) != '') - net_crc_avx512_cpu_support = ( - cc.get_define('__AVX512F__', args: machine_args) != '' and - cc.get_define('__AVX512BW__', args: machine_args) != '' and - cc.get_define('__AVX512DQ__', args: machine_args) != '' and - cc.get_define('__AVX512VL__', args: machine_args) != '' and - cc.get_define('__VPCLMULQDQ__', args: machine_args) != '' + net_crc_avx512_cpu_support = (target_has_avx512 and cc.get_define('__VPCLMULQDQ__', args: machine_args) != '' ) net_crc_sse42_cc_support = (cc.has_argument('-mpclmul') and cc.has_argument('-maes')) - net_crc_avx512_cc_support = ( - not machine_args.contains('-mno-avx512f') and - cc.has_argument('-mavx512f') and - cc.has_argument('-mavx512bw') and - cc.has_argument('-mavx512dq') and - cc.has_argument('-mavx512vl') and - cc.has_argument('-mvpclmulqdq') and - cc.has_argument('-mavx2') and - cc.has_argument('-mavx') - ) + net_crc_avx512_cc_support = (cc.has_argument('-mvpclmulqdq') and cc_has_avx512) build_static_net_crc_sse42_lib = 0 build_static_net_crc_avx512_lib = 0
@@ -69,15 +55,7 @@ if dpdk_conf.has('RTE_ARCH_X86_64') cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] elif net_crc_avx512_cc_support == true build_static_net_crc_avx512_lib = 1 - net_crc_avx512_lib_cflags = [ - '-mavx512f', - '-mavx512bw', - '-mavx512dq', - '-mavx512vl', - '-mvpclmulqdq', - '-mavx2', - '-mavx', - ] + net_crc_avx512_lib_cflags = cc_avx512_flags + ['-mvpclmulqdq'] cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] endif elif net_crc_sse42_cc_support == true
@@ -86,17 +64,7 @@ if dpdk_conf.has('RTE_ARCH_X86_64') cflags += ['-DCC_X86_64_SSE42_PCLMULQDQ_SUPPORT'] if net_crc_avx512_cc_support == true build_static_net_crc_avx512_lib = 1 - net_crc_avx512_lib_cflags = [ - '-mpclmul', - '-maes', - '-mavx512f', - '-mavx512bw', - '-mavx512dq', - '-mavx512vl', - '-mvpclmulqdq', - '-mavx2', - '-mavx', - ] + net_crc_avx512_lib_cflags = cc_avx512_flags + ['-mvpclmulqdq', '-mpclmul'] cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] endif endif
Signature · 1 line
2.43.0
Quoted 21 lines · Bruce Richardson
The meson code to detect CPU and compiler support for AVX512 was duplicated across multiple components. Do all detection in just a single place to simplify the code.
v3: add in patches for net lib and virtio driver
v2: ensure thattarget_has_avx512is always defined on x86 to fix build errorsBruce Richardson (10):
config/x86: add global defines for checking AVX-512 event/dlb2: use global AVX-512 variables common/idpf: use global AVX-512 variables net/cpfl: use global AVX-512 variables net/i40e: use global AVX-512 variables net/iavf: use global AVX-512 variables net/ice: use global AVX-512 variables net/idpf: use global AVX-512 variables net/virtio: use global AVX-512 variables
net: use global AVX-512 variables
Quoted 11 lines
config/x86/meson.build | 19 +++++++++++---- drivers/common/idpf/meson.build | 17 ++----------- drivers/event/dlb2/meson.build | 42 +++++++-------------------------- drivers/net/cpfl/meson.build | 19 ++------------- drivers/net/i40e/meson.build | 13 ++-------- drivers/net/iavf/meson.build | 13 ++-------- drivers/net/ice/meson.build | 15 ++---------- drivers/net/idpf/meson.build | 19 ++------------- drivers/net/virtio/meson.build | 32 ++++++++++++------------- lib/net/meson.build | 40 ++++--------------------------- 10 files changed, 55 insertions(+), 174 deletions(-)
Series applied, thanks Bruce.
Signature · 1 line
David Marchand