DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice: add AVX512BW flag check both in build and runtime
@ 2020-10-27 10:19 Leyi Rong
  2020-10-27 11:57 ` Ferruh Yigit
  0 siblings, 1 reply; 9+ messages in thread
From: Leyi Rong @ 2020-10-27 10:19 UTC (permalink / raw)
  To: qi.z.zhang, ferruh.yigit, bruce.richardson, wenzhuo.lu; +Cc: dev, Leyi Rong

Intrinsic function __mm512_bsrli_epi128 should be used in
the environment which supports AVX512BW, so adds check for
this flag.

Fixes: 5dd3b8f3af34 ("net/ice: add AVX512 vector path")

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
---
 drivers/net/ice/ice_rxtx.c  | 12 ++++++++++--
 drivers/net/ice/meson.build | 13 +++++++++++--
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index f6291894cd..0785f37028 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -3007,7 +3007,8 @@ ice_set_rx_function(struct rte_eth_dev *dev)
 			}
 
 			if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512 &&
-			rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1)
+			rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
+			rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1)
 #ifdef CC_AVX512_SUPPORT
 				use_avx512 = true;
 #else
@@ -3028,11 +3029,13 @@ ice_set_rx_function(struct rte_eth_dev *dev)
 	if (ad->rx_vec_allowed) {
 		if (dev->data->scattered_rx) {
 			if (use_avx512) {
+#ifdef CC_AVX512_SUPPORT
 				PMD_DRV_LOG(NOTICE,
 					"Using AVX512 Vector Scattered Rx (port %d).",
 					dev->data->port_id);
 				dev->rx_pkt_burst =
 					ice_recv_scattered_pkts_vec_avx512;
+#endif
 			} else {
 				PMD_DRV_LOG(DEBUG,
 					"Using %sVector Scattered Rx (port %d).",
@@ -3044,11 +3047,13 @@ ice_set_rx_function(struct rte_eth_dev *dev)
 			}
 		} else {
 			if (use_avx512) {
+#ifdef CC_AVX512_SUPPORT
 				PMD_DRV_LOG(NOTICE,
 					"Using AVX512 Vector Rx (port %d).",
 					dev->data->port_id);
 				dev->rx_pkt_burst =
 					ice_recv_pkts_vec_avx512;
+#endif
 			} else {
 				PMD_DRV_LOG(DEBUG,
 					"Using %sVector Rx (port %d).",
@@ -3218,7 +3223,8 @@ ice_set_tx_function(struct rte_eth_dev *dev)
 			}
 
 			if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512 &&
-			rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1)
+			rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
+			rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1)
 #ifdef CC_AVX512_SUPPORT
 				use_avx512 = true;
 #else
@@ -3238,9 +3244,11 @@ ice_set_tx_function(struct rte_eth_dev *dev)
 
 	if (ad->tx_vec_allowed) {
 		if (use_avx512) {
+#ifdef CC_AVX512_SUPPORT
 			PMD_DRV_LOG(NOTICE, "Using AVX512 Vector Tx (port %d).",
 				    dev->data->port_id);
 			dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512;
+#endif
 		} else {
 			PMD_DRV_LOG(DEBUG, "Using %sVector Tx (port %d).",
 				    use_avx2 ? "avx2 " : "",
diff --git a/drivers/net/ice/meson.build b/drivers/net/ice/meson.build
index 514bad9b8b..7d54a49236 100644
--- a/drivers/net/ice/meson.build
+++ b/drivers/net/ice/meson.build
@@ -35,14 +35,23 @@ if arch_subdir == 'x86'
 		objs += ice_avx2_lib.extract_objects('ice_rxtx_vec_avx2.c')
 	endif
 
-	if dpdk_conf.has('RTE_MACHINE_CPUFLAG_AVX512F') or (not machine_args.contains('-mno-avx512f') and cc.has_argument('-mavx512f'))
+	ice_avx512_cpu_support = (
+		cc.get_define('__AVX512F__', args: machine_args) != '' and
+		cc.get_define('__AVX512BW__', args: machine_args) != '')
+
+	ice_avx512_cc_support = (
+		not machine_args.contains('-mno-avx512f') and
+		cc.has_argument('-mavx512f') and
+		cc.has_argument('-mavx512bw'))
+
+	if ice_avx512_cpu_support == true or ice_avx512_cc_support == true
 		cflags += ['-DCC_AVX512_SUPPORT']
 		ice_avx512_lib = static_library('ice_avx512_lib',
 				      'ice_rxtx_vec_avx512.c',
 				      dependencies: [static_rte_ethdev,
 					static_rte_kvargs, static_rte_hash],
 				      include_directories: includes,
-				      c_args: [cflags, '-march=skylake-avx512', '-mavx512f'])
+				      c_args: [cflags, '-march=skylake-avx512', '-mavx512f', '-mavx512bw'])
 		objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c')
 	endif
 endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-11-02  8:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-27 10:19 [dpdk-dev] [PATCH] net/ice: add AVX512BW flag check both in build and runtime Leyi Rong
2020-10-27 11:57 ` Ferruh Yigit
2020-10-27 12:47   ` Andrew Rybchenko
2020-10-27 13:12   ` Ali Alnubani
2020-10-27 13:27     ` Bruce Richardson
2020-10-27 15:36       ` Rong, Leyi
2020-10-27 15:57         ` Bruce Richardson
2020-10-27 13:17   ` David Marchand
2020-11-02  8:22     ` Ali Alnubani

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git