DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [PATCH 7/7] eal/x86: compile memcpy for dynamic dispatch
Date: Tue, 17 Oct 2017 11:41:13 +0100	[thread overview]
Message-ID: <20171017104113.175250-8-bruce.richardson@intel.com> (raw)
In-Reply-To: <20171017104113.175250-1-bruce.richardson@intel.com>

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(+)

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

  parent reply	other threads:[~2017-10-17 11:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17 10:41 [dpdk-dev] [PATCH 0/7] update dpdk-next-build to 17.11-rc1 Bruce Richardson
2017-10-17 10:41 ` [dpdk-dev] [PATCH 1/7] build: add rte_bitmap.h to eal Bruce Richardson
2017-10-17 10:41 ` [dpdk-dev] [PATCH 2/7] build: remove rte_bitmap.h from rte_sched lib Bruce Richardson
2017-10-17 10:41 ` [dpdk-dev] [PATCH 3/7] build: add gso library Bruce Richardson
2017-10-17 10:41 ` [dpdk-dev] [PATCH 4/7] eal/x86: add additional memcpy and cycles C files to build Bruce Richardson
2017-10-17 10:41 ` [dpdk-dev] [PATCH 5/7] efd: add new avx2 standalone file " Bruce Richardson
2017-10-17 10:41 ` [dpdk-dev] [PATCH 6/7] app/test-pmd: add dependency on new gso library Bruce Richardson
2017-10-17 10:41 ` Bruce Richardson [this message]
2017-10-17 11:58 ` [dpdk-dev] [PATCH 0/7] update dpdk-next-build to 17.11-rc1 Luca Boccassi
2017-10-17 13:11   ` Bruce Richardson
2017-10-17 13:14     ` Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171017104113.175250-8-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).