From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bruce Richardson Subject: [PATCH 7/7] eal/x86: compile memcpy for dynamic dispatch Date: Tue, 17 Oct 2017 11:41:13 +0100 Message-ID: <20171017104113.175250-8-bruce.richardson@intel.com> References: <20171017104113.175250-1-bruce.richardson@intel.com> Cc: Bruce Richardson To: dev@dpdk.org Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id D6D411B806 for ; Tue, 17 Oct 2017 13:02:24 +0200 (CEST) In-Reply-To: <20171017104113.175250-1-bruce.richardson@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- lib/librte_eal/common/arch/x86/meson.build | 25 +++++++++++++++++++++++++ lib/librte_eal/linuxapp/eal/meson.build | 1 + 2 files changed, 26 insertions(+) diff --git a/lib/librte_eal/common/arch/x86/meson.build b/lib/librte_eal/common/arch/x86/meson.build index f8815acbc..0e2e7c401 100644 --- a/lib/librte_eal/common/arch/x86/meson.build +++ b/lib/librte_eal/common/arch/x86/meson.build @@ -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 diff --git a/lib/librte_eal/linuxapp/eal/meson.build b/lib/librte_eal/linuxapp/eal/meson.build index 46ae57649..c0ceacd61 100644 --- a/lib/librte_eal/linuxapp/eal/meson.build +++ b/lib/librte_eal/linuxapp/eal/meson.build @@ -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, -- 2.13.6