Skip to content

Commit ef7a402

Browse files
bruce-richardsondavid-marchand
authored andcommitted
drivers: use common AVX512 build checks
Replace per-driver checks for AVX-512 with the standard variables from config/x86. Signed-off-by: Bruce Richardson <[email protected]> Acked-by: David Marchand <[email protected]>
1 parent 979f59d commit ef7a402

File tree

8 files changed

+36
-138
lines changed

8 files changed

+36
-138
lines changed

drivers/common/idpf/meson.build

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,9 @@ sources = files(
1616
)
1717

1818
if arch_subdir == 'x86'
19-
idpf_avx512_cpu_support = (
20-
cc.get_define('__AVX512F__', args: machine_args) != '' and
21-
cc.get_define('__AVX512BW__', args: machine_args) != '' and
22-
cc.get_define('__AVX512DQ__', args: machine_args) != ''
23-
)
24-
25-
idpf_avx512_cc_support = (
26-
not machine_args.contains('-mno-avx512f') and
27-
cc.has_argument('-mavx512f') and
28-
cc.has_argument('-mavx512bw') and
29-
cc.has_argument('-mavx512dq')
30-
)
31-
32-
if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true
19+
if cc_has_avx512
3320
cflags += ['-DCC_AVX512_SUPPORT']
34-
avx512_args = [cflags, '-mavx512f', '-mavx512bw', '-mavx512dq']
21+
avx512_args = cflags + cc_avx512_flags
3522
if cc.has_argument('-march=skylake-avx512')
3623
avx512_args += '-march=skylake-avx512'
3724
endif

drivers/event/dlb2/meson.build

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,47 +22,19 @@ sources = files(
2222
'dlb2_selftest.c',
2323
)
2424

25-
# compile AVX512 version if:
26-
# we are building 64-bit binary (checked above) AND binutils
27-
# can generate proper code
25+
if target_has_avx512
26+
cflags += '-DCC_AVX512_SUPPORT'
27+
sources += files('dlb2_avx512.c')
2828

29-
if binutils_ok
30-
31-
# compile AVX512 version if either:
32-
# a. we have AVX512VL supported in minimum instruction set
33-
# baseline
34-
# b. it's not minimum instruction set, but supported by
35-
# compiler
36-
#
37-
# in former case, just add avx512 C file to files list
38-
# in latter case, compile c file to static lib, using correct
39-
# compiler flags, and then have the .o file from static lib
40-
# linked into main lib.
41-
42-
# check if all required flags already enabled (variant a).
43-
dlb2_avx512_on = false
44-
if cc.get_define('__AVX512VL__', args: machine_args) != ''
45-
dlb2_avx512_on = true
46-
endif
47-
48-
if dlb2_avx512_on == true
49-
50-
sources += files('dlb2_avx512.c')
51-
cflags += '-DCC_AVX512_SUPPORT'
52-
53-
elif cc.has_multi_arguments('-mavx512vl')
54-
55-
cflags += '-DCC_AVX512_SUPPORT'
56-
avx512_tmplib = static_library('avx512_tmp',
29+
elif cc_has_avx512
30+
cflags += '-DCC_AVX512_SUPPORT'
31+
avx512_tmplib = static_library('avx512_tmp',
5732
'dlb2_avx512.c',
5833
dependencies: [static_rte_eal, static_rte_eventdev],
59-
c_args: cflags + ['-mavx512vl'])
60-
objs += avx512_tmplib.extract_objects('dlb2_avx512.c')
61-
else
62-
sources += files('dlb2_sse.c')
63-
endif
34+
c_args: cflags + cc_avx512_flags)
35+
objs += avx512_tmplib.extract_objects('dlb2_avx512.c')
6436
else
65-
sources += files('dlb2_sse.c')
37+
sources += files('dlb2_sse.c')
6638
endif
6739

6840
headers = files('rte_pmd_dlb2.h')

drivers/net/cpfl/meson.build

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,8 @@ sources = files(
2222
'cpfl_rules.c',
2323
)
2424

25-
if arch_subdir == 'x86'
26-
cpfl_avx512_cpu_support = (
27-
cc.get_define('__AVX512F__', args: machine_args) != '' and
28-
cc.get_define('__AVX512BW__', args: machine_args) != '' and
29-
cc.get_define('__AVX512DQ__', args: machine_args) != ''
30-
)
31-
32-
cpfl_avx512_cc_support = (
33-
not machine_args.contains('-mno-avx512f') and
34-
cc.has_argument('-mavx512f') and
35-
cc.has_argument('-mavx512bw') and
36-
cc.has_argument('-mavx512dq')
37-
)
38-
39-
if cpfl_avx512_cpu_support == true or cpfl_avx512_cc_support == true
40-
cflags += ['-DCC_AVX512_SUPPORT']
41-
endif
25+
if arch_subdir == 'x86' and cc_has_avx512
26+
cflags += ['-DCC_AVX512_SUPPORT']
4227
endif
4328

4429
if dpdk_conf.has('RTE_HAS_JANSSON')

drivers/net/i40e/meson.build

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,9 @@ if arch_subdir == 'x86'
5757
c_args: [cflags, '-mavx2'])
5858
objs += i40e_avx2_lib.extract_objects('i40e_rxtx_vec_avx2.c')
5959

60-
i40e_avx512_cpu_support = (
61-
cc.get_define('__AVX512F__', args: machine_args) != '' and
62-
cc.get_define('__AVX512BW__', args: machine_args) != '')
63-
64-
i40e_avx512_cc_support = (
65-
not machine_args.contains('-mno-avx512f') and
66-
cc.has_argument('-mavx512f') and
67-
cc.has_argument('-mavx512bw'))
68-
69-
if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true
60+
if cc_has_avx512
7061
cflags += ['-DCC_AVX512_SUPPORT']
71-
avx512_args = [cflags, '-mavx512f', '-mavx512bw']
62+
avx512_args = cflags + cc_avx512_flags
7263
if cc.has_argument('-march=skylake-avx512')
7364
avx512_args += '-march=skylake-avx512'
7465
endif

drivers/net/iavf/meson.build

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,9 @@ if arch_subdir == 'x86'
3939
c_args: [cflags, '-mavx2'])
4040
objs += iavf_avx2_lib.extract_objects('iavf_rxtx_vec_avx2.c')
4141

42-
iavf_avx512_cpu_support = (
43-
cc.get_define('__AVX512F__', args: machine_args) != '' and
44-
cc.get_define('__AVX512BW__', args: machine_args) != '')
45-
46-
iavf_avx512_cc_support = (
47-
not machine_args.contains('-mno-avx512f') and
48-
cc.has_argument('-mavx512f') and
49-
cc.has_argument('-mavx512bw'))
50-
51-
if iavf_avx512_cpu_support == true or iavf_avx512_cc_support == true
42+
if cc_has_avx512
5243
cflags += ['-DCC_AVX512_SUPPORT']
53-
avx512_args = [cflags, '-mavx512f', '-mavx512bw']
44+
avx512_args = cflags + cc_avx512_flags
5445
if cc.has_argument('-march=skylake-avx512')
5546
avx512_args += '-march=skylake-avx512'
5647
endif

drivers/net/ice/meson.build

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,9 @@ if arch_subdir == 'x86'
3535
c_args: [cflags, '-mavx2'])
3636
objs += ice_avx2_lib.extract_objects('ice_rxtx_vec_avx2.c')
3737

38-
ice_avx512_cpu_support = (
39-
cc.get_define('__AVX512F__', args: machine_args) != '' and
40-
cc.get_define('__AVX512BW__', args: machine_args) != ''
41-
)
42-
43-
ice_avx512_cc_support = (
44-
not machine_args.contains('-mno-avx512f') and
45-
cc.has_argument('-mavx512f') and
46-
cc.has_argument('-mavx512bw')
47-
)
48-
49-
if ice_avx512_cpu_support == true or ice_avx512_cc_support == true
38+
if cc_has_avx512
5039
cflags += ['-DCC_AVX512_SUPPORT']
51-
avx512_args = [cflags, '-mavx512f', '-mavx512bw']
40+
avx512_args = cflags + cc_avx512_flags
5241
if cc.has_argument('-march=skylake-avx512')
5342
avx512_args += '-march=skylake-avx512'
5443
endif

drivers/net/idpf/meson.build

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,6 @@ sources = files(
1414
'idpf_rxtx.c',
1515
)
1616

17-
if arch_subdir == 'x86'
18-
idpf_avx512_cpu_support = (
19-
cc.get_define('__AVX512F__', args: machine_args) != '' and
20-
cc.get_define('__AVX512BW__', args: machine_args) != '' and
21-
cc.get_define('__AVX512DQ__', args: machine_args) != ''
22-
)
23-
24-
idpf_avx512_cc_support = (
25-
not machine_args.contains('-mno-avx512f') and
26-
cc.has_argument('-mavx512f') and
27-
cc.has_argument('-mavx512bw') and
28-
cc.has_argument('-mavx512dq')
29-
)
30-
31-
if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true
32-
cflags += ['-DCC_AVX512_SUPPORT']
33-
endif
17+
if arch_subdir == 'x86'and cc_has_avx512
18+
cflags += ['-DCC_AVX512_SUPPORT']
3419
endif

drivers/net/virtio/meson.build

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,21 @@ sources += files(
2424
deps += ['kvargs', 'bus_pci']
2525

2626
if arch_subdir == 'x86'
27-
if not machine_args.contains('-mno-avx512f')
28-
if cc.has_argument('-mavx512f') and cc.has_argument('-mavx512vl') and cc.has_argument('-mavx512bw')
29-
cflags += ['-DCC_AVX512_SUPPORT']
30-
virtio_avx512_lib = static_library('virtio_avx512_lib',
31-
'virtio_rxtx_packed.c',
32-
dependencies: [static_rte_ethdev,
33-
static_rte_kvargs, static_rte_bus_pci],
34-
include_directories: includes,
35-
c_args: [cflags, '-mavx512f', '-mavx512bw', '-mavx512vl'])
36-
objs += virtio_avx512_lib.extract_objects('virtio_rxtx_packed.c')
37-
if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0'))
38-
cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA'
39-
elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0'))
40-
cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA'
41-
elif (toolchain == 'icc' and cc.version().version_compare('>=16.0.0'))
42-
cflags += '-DVIRTIO_ICC_UNROLL_PRAGMA'
43-
endif
27+
if cc_has_avx512
28+
cflags += ['-DCC_AVX512_SUPPORT']
29+
virtio_avx512_lib = static_library('virtio_avx512_lib',
30+
'virtio_rxtx_packed.c',
31+
dependencies: [static_rte_ethdev,
32+
static_rte_kvargs, static_rte_bus_pci],
33+
include_directories: includes,
34+
c_args: cflags + cc_avx512_flags)
35+
objs += virtio_avx512_lib.extract_objects('virtio_rxtx_packed.c')
36+
if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0'))
37+
cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA'
38+
elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0'))
39+
cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA'
40+
elif (toolchain == 'icc' and cc.version().version_compare('>=16.0.0'))
41+
cflags += '-DVIRTIO_ICC_UNROLL_PRAGMA'
4442
endif
4543
endif
4644
sources += files('virtio_rxtx_simple_sse.c')

0 commit comments

Comments
 (0)