* [PATCH v1 1/8] config/x86: add global defines for checking AVX-512
2024-09-30 17:50 [PATCH v1 0/8] centralize AVX-512 feature detection Bruce Richardson
@ 2024-09-30 17:50 ` Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 2/8] event/dlb2: use global AVX-512 variables Bruce Richardson
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Bruce Richardson @ 2024-09-30 17:50 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, Konstantin Ananyev
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.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/x86/meson.build | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/config/x86/meson.build b/config/x86/meson.build
index 8087b9ae91..f973878371 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -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
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 2/8] event/dlb2: use global AVX-512 variables
2024-09-30 17:50 [PATCH v1 0/8] centralize AVX-512 feature detection Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 1/8] config/x86: add global defines for checking AVX-512 Bruce Richardson
@ 2024-09-30 17:50 ` Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 3/8] common/idpf: " Bruce Richardson
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Bruce Richardson @ 2024-09-30 17:50 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, Abdullah Sevincer
Replace per-driver checks for AVX-512 with the standard variables from
config/x86.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/event/dlb2/meson.build | 42 ++++++++--------------------------
1 file changed, 9 insertions(+), 33 deletions(-)
diff --git a/drivers/event/dlb2/meson.build b/drivers/event/dlb2/meson.build
index 515d1795fe..34131fd18b 100644
--- a/drivers/event/dlb2/meson.build
+++ b/drivers/event/dlb2/meson.build
@@ -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')
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 3/8] common/idpf: use global AVX-512 variables
2024-09-30 17:50 [PATCH v1 0/8] centralize AVX-512 feature detection Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 1/8] config/x86: add global defines for checking AVX-512 Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 2/8] event/dlb2: use global AVX-512 variables Bruce Richardson
@ 2024-09-30 17:50 ` Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 4/8] net/cpfl: " Bruce Richardson
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Bruce Richardson @ 2024-09-30 17:50 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, Jingjing Wu
Replace per-driver checks for AVX-512 with the standard variables from
config/x86.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/common/idpf/meson.build | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/drivers/common/idpf/meson.build b/drivers/common/idpf/meson.build
index 80c8906f80..1cf215186c 100644
--- a/drivers/common/idpf/meson.build
+++ b/drivers/common/idpf/meson.build
@@ -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
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 4/8] net/cpfl: use global AVX-512 variables
2024-09-30 17:50 [PATCH v1 0/8] centralize AVX-512 feature detection Bruce Richardson
` (2 preceding siblings ...)
2024-09-30 17:50 ` [PATCH v1 3/8] common/idpf: " Bruce Richardson
@ 2024-09-30 17:50 ` Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 5/8] net/i40e: " Bruce Richardson
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Bruce Richardson @ 2024-09-30 17:50 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson
Replace per-driver checks for AVX-512 with the standard variables from
config/x86.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/cpfl/meson.build | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/drivers/net/cpfl/meson.build b/drivers/net/cpfl/meson.build
index e4e0e269bd..87fcfe0bb1 100644
--- a/drivers/net/cpfl/meson.build
+++ b/drivers/net/cpfl/meson.build
@@ -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')
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 5/8] net/i40e: use global AVX-512 variables
2024-09-30 17:50 [PATCH v1 0/8] centralize AVX-512 feature detection Bruce Richardson
` (3 preceding siblings ...)
2024-09-30 17:50 ` [PATCH v1 4/8] net/cpfl: " Bruce Richardson
@ 2024-09-30 17:50 ` Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 6/8] net/iavf: " Bruce Richardson
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Bruce Richardson @ 2024-09-30 17:50 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson
Replace per-driver checks for AVX-512 with the standard variables from
config/x86.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/i40e/meson.build | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index 80171b9dc6..ef7b1f5d34 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -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
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 6/8] net/iavf: use global AVX-512 variables
2024-09-30 17:50 [PATCH v1 0/8] centralize AVX-512 feature detection Bruce Richardson
` (4 preceding siblings ...)
2024-09-30 17:50 ` [PATCH v1 5/8] net/i40e: " Bruce Richardson
@ 2024-09-30 17:50 ` Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 7/8] net/ice: " Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 8/8] net/idpf: " Bruce Richardson
7 siblings, 0 replies; 9+ messages in thread
From: Bruce Richardson @ 2024-09-30 17:50 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, Jingjing Wu
Replace per-driver checks for AVX-512 with the standard variables from
config/x86.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/iavf/meson.build | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/net/iavf/meson.build b/drivers/net/iavf/meson.build
index 83aebd5596..27d104cc12 100644
--- a/drivers/net/iavf/meson.build
+++ b/drivers/net/iavf/meson.build
@@ -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
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 7/8] net/ice: use global AVX-512 variables
2024-09-30 17:50 [PATCH v1 0/8] centralize AVX-512 feature detection Bruce Richardson
` (5 preceding siblings ...)
2024-09-30 17:50 ` [PATCH v1 6/8] net/iavf: " Bruce Richardson
@ 2024-09-30 17:50 ` Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 8/8] net/idpf: " Bruce Richardson
7 siblings, 0 replies; 9+ messages in thread
From: Bruce Richardson @ 2024-09-30 17:50 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson
Replace per-driver checks for AVX-512 with the standard variables from
config/x86.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/ice/meson.build | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ice/meson.build b/drivers/net/ice/meson.build
index b7f2188e62..1c9dc0cc6d 100644
--- a/drivers/net/ice/meson.build
+++ b/drivers/net/ice/meson.build
@@ -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
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 8/8] net/idpf: use global AVX-512 variables
2024-09-30 17:50 [PATCH v1 0/8] centralize AVX-512 feature detection Bruce Richardson
` (6 preceding siblings ...)
2024-09-30 17:50 ` [PATCH v1 7/8] net/ice: " Bruce Richardson
@ 2024-09-30 17:50 ` Bruce Richardson
7 siblings, 0 replies; 9+ messages in thread
From: Bruce Richardson @ 2024-09-30 17:50 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, Jingjing Wu
Replace per-driver checks for AVX-512 with the standard variables from
config/x86.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/idpf/meson.build | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/drivers/net/idpf/meson.build b/drivers/net/idpf/meson.build
index cf49ef167d..34cbdc4da0 100644
--- a/drivers/net/idpf/meson.build
+++ b/drivers/net/idpf/meson.build
@@ -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
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread