Skip to content

Commit edd3f4b

Browse files
bruce-richardsondavid-marchand
authored andcommitted
member: use common AVX512 build handling
Use the support for building AVX512 code present in lib/meson.build rather than reimplementing it in the library meson.build file. Signed-off-by: Bruce Richardson <[email protected]> Acked-by: Konstantin Ananyev <[email protected]>
1 parent 7ae40e5 commit edd3f4b

File tree

1 file changed

+7
-39
lines changed

1 file changed

+7
-39
lines changed

lib/member/meson.build

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -20,44 +20,12 @@ sources = files(
2020

2121
deps += ['hash', 'ring']
2222

23-
# compile AVX512 version if:
24-
if dpdk_conf.has('RTE_ARCH_X86_64') and binutils_ok
25-
# compile AVX512 version if either:
26-
# a. we have AVX512 supported in minimum instruction set
27-
# baseline
28-
# b. it's not minimum instruction set, but supported by
29-
# compiler
30-
#
31-
# in former case, just add avx512 C file to files list
32-
# in latter case, compile c file to static lib, using correct
33-
# compiler flags, and then have the .o file from static lib
34-
# linked into main lib.
35-
36-
member_avx512_args = cc_avx512_flags
37-
if not is_ms_compiler
38-
member_avx512_args += '-mavx512ifma'
39-
endif
40-
41-
# check if all required flags already enabled
42-
sketch_avx512_flags = ['__AVX512F__', '__AVX512DQ__', '__AVX512IFMA__']
43-
44-
sketch_avx512_on = true
45-
foreach f:sketch_avx512_flags
46-
if cc.get_define(f, args: machine_args) == ''
47-
sketch_avx512_on = false
48-
endif
49-
endforeach
50-
51-
if sketch_avx512_on == true
52-
cflags += ['-DCC_AVX512_SUPPORT']
53-
sources += files('rte_member_sketch_avx512.c')
54-
elif cc.has_multi_arguments(member_avx512_args)
55-
sketch_avx512_tmp = static_library('sketch_avx512_tmp',
56-
'rte_member_sketch_avx512.c',
57-
include_directories: includes,
58-
dependencies: [static_rte_eal, static_rte_hash],
59-
c_args: cflags + member_avx512_args)
60-
objs += sketch_avx512_tmp.extract_objects('rte_member_sketch_avx512.c')
61-
cflags += ['-DCC_AVX512_SUPPORT']
23+
# compile AVX512 version if we have avx512 on MSVC or the 'ifma' flag on GCC/Clang
24+
if dpdk_conf.has('RTE_ARCH_X86_64')
25+
if is_ms_compiler
26+
sources_avx512 += files('rte_member_sketch_avx512.c')
27+
elif cc.has_argument('-mavx512ifma')
28+
sources_avx512 += files('rte_member_sketch_avx512.c')
29+
cflags_avx512 += '-mavx512ifma'
6230
endif
6331
endif

0 commit comments

Comments
 (0)