[dpdk-dev,7/7] eal/x86: compile memcpy for dynamic dispatch
Checks
Commit Message
The rte_memcpy instruction can be compiled for SSE, AVX2 or AVX512F
instruction sets. If the baseline instruciton set level used for the
compile is not AVX512, then the function to be used when rte_memcpy is
called should be selected at runtime, which means the different
implementations should be compiled for the different instruction set
levels, irrespective of the baseline level.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/librte_eal/common/arch/x86/meson.build | 25 +++++++++++++++++++++++++
lib/librte_eal/linuxapp/eal/meson.build | 1 +
2 files changed, 26 insertions(+)
@@ -31,3 +31,28 @@
eal_common_arch_sources = files('rte_spinlock.c', 'rte_cpuflags.c',
'rte_cycles.c', 'rte_memcpy.c', 'rte_memcpy_sse.c')
+eal_common_arch_objs = []
+
+if dpdk_conf.has('RTE_MACHINE_CPUFLAG_AVX512F')
+ eal_common_arch_sources += files('rte_memcpy_avx512f.c',
+ 'rte_memcpy_avx2.c')
+else # no avx512f instruction set guaranteed
+ # check if compiler supports
+ if cc.has_argument('-mavx512f')
+ avx512_tmplib = static_library('memcpy_avx512_tmp',
+ 'rte_memcpy_avx512f.c',
+ c_args: '-mavx512f')
+ eal_common_arch_objs += avx512_tmplib.extract_objects(
+ 'rte_memcpy_avx512f.c')
+ endif
+ # check for mandatory AVX2 support
+ if dpdk_conf.has('RTE_MACHINE_CPUFLAG_AVX2')
+ eal_common_arch_sources += files('rte_memcpy_avx2.c')
+ elif cc.has_argument('-mavx2')
+ avx2_tmplib = static_library('memcpy_avx2_tmp',
+ 'rte_memcpy_avx2.c',
+ c_args: '-mavx2')
+ eal_common_arch_objs += avx2_tmplib.extract_objects(
+ 'rte_memcpy_avx2.c')
+ endif
+endif
@@ -62,6 +62,7 @@ endif
version_map = join_paths(meson.current_source_dir(), 'rte_eal_version.map')
eal_lib = library('rte_eal', sources, eal_common_sources, eal_common_arch_sources,
+ objects: eal_common_arch_objs,
dependencies: dependency('threads'),
include_directories : eal_inc,
version: lib_version,