[dpdk-dev] [PATCH] net/ice: add AVX512BW flag check both in build and runtime
Leyi Rong
leyi.rong at intel.com
Tue Oct 27 11:19:26 CET 2020
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 at 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
More information about the dev
mailing list