From patchwork Tue Oct 17 10:41:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 30478 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 09F211B811; Tue, 17 Oct 2017 13:02:29 +0200 (CEST) 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) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2017 04:02:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,390,1503385200"; d="scan'208";a="324143430" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.223]) by fmsmga004.fm.intel.com with ESMTP; 17 Oct 2017 04:02:23 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Date: Tue, 17 Oct 2017 11:41:13 +0100 Message-Id: <20171017104113.175250-8-bruce.richardson@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171017104113.175250-1-bruce.richardson@intel.com> References: <20171017104113.175250-1-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH 7/7] eal/x86: compile memcpy for dynamic dispatch X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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,