AVX512 vPMD on ice
Subsystems (2)
cover AVX512 vPMD on ice
This patchset aims to support AVX512 vPMD on ice.
Has dependency on http://patches.dpdk.org/cover/76096/
which support SIMD bitwidth selection properly.
Leyi Rong (2):
net/ice: add AVX512 vector path
net/ice: optimize Tx path on AVX512 vPMD
drivers/net/ice/ice_rxtx.c | 88 ++- drivers/net/ice/ice_rxtx.h | 11 + drivers/net/ice/ice_rxtx_vec_avx512.c | 927 ++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx_vec_common.h | 36 +- drivers/net/ice/meson.build | 13 + 5 files changed, 1050 insertions(+), 25 deletions(-) create mode 100644 drivers/net/ice/ice_rxtx_vec_avx512.c
Signature · 1 line
2.17.1
PATCH 1/2 net/ice: add AVX512 vector path
Add AVX512 support for ice PMD. This patch adds ice_rxtx_vec_avx512.c to support ice AVX512 vPMD.
This patch aims to enable AVX512 on ice vPMD. Main changes are focus on Rx path compared with AVX2 vPMD.
--- drivers/net/ice/ice_rxtx.c | 88 ++- drivers/net/ice/ice_rxtx.h | 7 + drivers/net/ice/ice_rxtx_vec_avx512.c | 824 ++++++++++++++++++++++++++ drivers/net/ice/meson.build | 13 + 4 files changed, 914 insertions(+), 18 deletions(-) create mode 100644 drivers/net/ice/ice_rxtx_vec_avx512.c
drivers/net/ice/ice_rxtx.c +70 -18
@@ -1852,6 +1852,10 @@ ice_dev_supported_ptypes_get(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 if (dev->rx_pkt_burst == ice_recv_pkts_vec || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec || +#ifdef CC_AVX512_SUPPORT + dev->rx_pkt_burst == ice_recv_pkts_vec_avx512 || + dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx512 || +#endif dev->rx_pkt_burst == ice_recv_pkts_vec_avx2 || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx2) return ptypes;
@@ -2909,6 +2913,7 @@ ice_set_rx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_rx_queue *rxq;int i; +bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {
@@ -2924,10 +2929,18 @@ ice_set_rx_function(struct rte_eth_dev *dev) } } -if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +if (rte_get_max_simd_bitwidth () >=RTE_MAX_512_SIMD && + rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) +#ifdef CC_AVX512_SUPPORT + use_avx512 = true; +#else +PMD_DRV_LOG (NOTICE , +"AVX512 is not supported in build env" ); +#endif +if (!use_avx512 && + (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 ||rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && -rte_get_max_simd_bitwidth () - >=RTE_MAX_256_SIMD ) +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) use_avx2 = true; }else {
@@ -2937,20 +2950,37 @@ ice_set_rx_function(struct rte_eth_dev *dev)if (ad->rx_vec_allowed) {if (dev->data->scattered_rx) { -PMD_DRV_LOG (DEBUG , +if (use_avx512) { +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; + }else { +PMD_DRV_LOG (DEBUG ,"Using %sVector Scattered Rx (port %d)." , use_avx2 ?"avx2 " :"" , dev->data->port_id); - dev->rx_pkt_burst = use_avx2 ? + dev->rx_pkt_burst = use_avx2 ? ice_recv_scattered_pkts_vec_avx2 : ice_recv_scattered_pkts_vec; + } }else { -PMD_DRV_LOG (DEBUG ,"Using %sVector Rx (port %d)." , +if (use_avx512) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_pkts_vec_avx512; + }else { +PMD_DRV_LOG (DEBUG , +"Using %sVector Rx (port %d)." , use_avx2 ?"avx2 " :"" , dev->data->port_id); - dev->rx_pkt_burst = use_avx2 ? - ice_recv_pkts_vec_avx2 : - ice_recv_pkts_vec; + dev->rx_pkt_burst = use_avx2 ? + ice_recv_pkts_vec_avx2 : + ice_recv_pkts_vec; + } }return ; }
@@ -2987,6 +3017,10 @@ static const struct { { ice_recv_pkts_bulk_alloc, "Scalar Bulk Alloc" }, { ice_recv_pkts, "Scalar" }, #ifdef RTE_ARCH_X86 +#ifdef CC_AVX512_SUPPORT + { ice_recv_scattered_pkts_vec_avx512, "Vector AVX512 Scattered" }, + { ice_recv_pkts_vec_avx512, "Vector AVX512" }, +#endif { ice_recv_scattered_pkts_vec_avx2, "Vector AVX2 Scattered" }, { ice_recv_pkts_vec_avx2, "Vector AVX2" }, { ice_recv_scattered_pkts_vec, "Vector SSE Scattered" },
@@ -3091,6 +3125,7 @@ ice_set_tx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_tx_queue *txq;int i; +bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {
@@ -3106,10 +3141,18 @@ ice_set_tx_function(struct rte_eth_dev *dev) } } -if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +if (rte_get_max_simd_bitwidth () >=RTE_MAX_512_SIMD && + rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) +#ifdef CC_AVX512_SUPPORT + use_avx512 = true; +#else +PMD_DRV_LOG (NOTICE , +"AVX512 is not supported in build env" ); +#endif +if (!use_avx512 && + (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 ||rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && -rte_get_max_simd_bitwidth () - >=RTE_MAX_256_SIMD ) +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) use_avx2 = true; }else {
@@ -3118,12 +3161,18 @@ ice_set_tx_function(struct rte_eth_dev *dev) }if (ad->tx_vec_allowed) { -PMD_DRV_LOG (DEBUG ,"Using %sVector Tx (port %d)." , - use_avx2 ?"avx2 " :"" , - dev->data->port_id); - dev->tx_pkt_burst = use_avx2 ? - ice_xmit_pkts_vec_avx2 : - ice_xmit_pkts_vec; +if (use_avx512) { +PMD_DRV_LOG (NOTICE ,"Using AVX512 Vector Tx (port %d)." , + dev->data->port_id); + dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512; + }else { +PMD_DRV_LOG (DEBUG ,"Using %sVector Tx (port %d)." , + use_avx2 ?"avx2 " :"" , + dev->data->port_id); + dev->tx_pkt_burst = use_avx2 ? + ice_xmit_pkts_vec_avx2 : + ice_xmit_pkts_vec; + } dev->tx_pkt_prepare =NULL ;return ;
@@ -3148,6 +3197,9 @@ static const struct { { ice_xmit_pkts_simple, "Scalar Simple" }, { ice_xmit_pkts, "Scalar" }, #ifdef RTE_ARCH_X86 +#ifdef CC_AVX512_SUPPORT + { ice_xmit_pkts_vec_avx512, "Vector AVX512" }, +#endif { ice_xmit_pkts_vec_avx2, "Vector AVX2" }, { ice_xmit_pkts_vec, "Vector SSE" }, #endif
drivers/net/ice/ice_rxtx.h +7 -0
@@ -200,6 +200,13 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t ice_recv_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_t ice_recv_scattered_pkts_vec_avx512 (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_t ice_xmit_pkts_vec_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);int ice_fdir_programming (struct ice_pf *pf,struct ice_fltr_desc *fdir_desc);int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);
drivers/net/ice/ice_rxtx_vec_avx512.c new file +824 -0
824 lines not on this page · raw message
drivers/net/ice/meson.build +13 -0
@@ -33,6 +33,19 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) 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') + if cc.has_argument('-mavx512f') and cc.has_argument('-mavx512bw') + 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']) + objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c') + endif + endif endif sources += files('ice_dcf.c',
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v1 1/2] net/ice: add AVX512 vector path
Quoted 15 lines · Leyi Rong
Add AVX512 support for ice PMD. This patch adds
ice_rxtx_vec_avx512.cto support ice AVX512 vPMD.This patch aims to enable AVX512 on ice vPMD. Main changes are focus on Rx path compared with AVX2 vPMD.
Signed-off-by Leyi Rong <[email protected]>Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/ice/ice_rxtx.c | 88 ++- drivers/net/ice/ice_rxtx.h | 7 + drivers/net/ice/ice_rxtx_vec_avx512.c | 824 ++++++++++++++++++++++++++ drivers/net/ice/meson.build | 13 + 4 files changed, 914 insertions(+), 18 deletions(-) create mode 100644 drivers/net/ice/ice_rxtx_vec_avx512.c
<snip>
drivers/net/ice/meson.build if arch_subdir == 'x86' · line 37
Quoted 1 line
drivers/net/ice/meson.build +1
-0+ if dpdk_conf.has('RTE_MACHINE_CPUFLAG_AVX512F') or not machine_args.contains('-mno-avx512f')
I think you need to split these conditions:
If the cpu flag is set, you just want to unconditionally add the file to the build list. However, if no-avx512 flag is set, you want to skip the whole block completely.
Quoted 17 lines
drivers/net/ice/meson.build +11
-0+ if cc.has_argument('-mavx512f') and cc.has_argument('-mavx512bw') + 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']) + objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c') + endif + endif endif sources += files('ice_dcf.c',Signature · 1 line
2.17.1
PATCH 2/2 net/ice: optimize Tx path on AVX512 vPMD
In reply to Leyi RongOptimize Tx path by using AVX512 instructions and vectorize the tx free bufs process.
--- drivers/net/ice/ice_rxtx.h | 4 + drivers/net/ice/ice_rxtx_vec_avx512.c | 147 ++++++++++++++++++++++---- drivers/net/ice/ice_rxtx_vec_common.h | 36 +++++-- 3 files changed, 158 insertions(+), 29 deletions(-)
drivers/net/ice/ice_rxtx.h +4 -0
@@ -88,6 +88,10 @@ struct ice_tx_entry {uint16_t last_id; }; +struct ice_vec_tx_entry { +struct rte_mbuf *mbuf; +}; +struct ice_tx_queue {uint16_t nb_tx_desc;/* number of TX descriptors */ rte_iova_t tx_ring_dma;/* TX ring DMA address */
drivers/net/ice/ice_rxtx_vec_avx512.c +125 -22
208 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_common.h +29 -7
@@ -189,16 +189,38 @@ _ice_tx_queue_release_mbufs_vec(struct ice_tx_queue *txq)* so need to free remains more carefully. */ i = txq->tx_next_dd - txq->tx_rs_thresh +1 ; -if (txq->tx_tail < i) { -for (; i < txq->nb_tx_desc; i++) { + +#ifdef CC_AVX512_SUPPORT +struct rte_eth_dev *dev = txq->vsi->adapter->eth_dev; + +if (dev->tx_pkt_burst == ice_xmit_pkts_vec_avx512) { +struct ice_vec_tx_entry *swr = (void *)txq->sw_ring; + +if (txq->tx_tail < i) { +for (; i < txq->nb_tx_desc; i++) { +rte_pktmbuf_free_seg (swr[i].mbuf); + swr[i].mbuf =NULL ; + } + i =0 ; + } +for (; i < txq->tx_tail; i++) { +rte_pktmbuf_free_seg (swr[i].mbuf); + swr[i].mbuf =NULL ; + } + } else +#endif + { +if (txq->tx_tail < i) { +for (; i < txq->nb_tx_desc; i++) { +rte_pktmbuf_free_seg (txq->sw_ring[i].mbuf); + txq->sw_ring[i].mbuf =NULL ; + } + i =0 ; + } +for (; i < txq->tx_tail; i++) {rte_pktmbuf_free_seg (txq->sw_ring[i].mbuf); txq->sw_ring[i].mbuf =NULL ; } - i =0 ; - } -for (; i < txq->tx_tail; i++) { -rte_pktmbuf_free_seg (txq->sw_ring[i].mbuf); - txq->sw_ring[i].mbuf =NULL ; } }
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v1 2/2] net/ice: optimize Tx path on AVX512 vPMD
Quoted 26 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Leyi Rong
Sent: Thursday, September 10, 2020 14:55
To: Richardson, Bruce <[email protected]>; Lu, Wenzhuo <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Rong, Leyi <[email protected]>
Subject: [dpdk-dev] [PATCH v1 2/2] net/ice: optimize Tx path on AVX512 vPMDOptimize Tx path by using AVX512 instructions and vectorize the tx free bufs process.
Signed-off-by Leyi Rong <[email protected]>Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/ice/ice_rxtx.h | 4 + drivers/net/ice/ice_rxtx_vec_avx512.c | 147 ++++++++++++++++++++++---- drivers/net/ice/ice_rxtx_vec_common.h | 36 +++++-- 3 files changed, 158 insertions(+), 29 deletions(-)drivers/net/ice/ice_rxtx_vec_avx512.c +2
-1- _mm256_set_epi64x +__m512i desc0_3 = + _mm512_set_epi64 (hi_qw3, pkt[3]->buf_physaddr + pkt[3]->data_off,
drivers/net/ice/ice_rxtx_vec_avx512.c ice_vtx(volatile struct ice_tx_desc *txdp, · line 818
Quoted 10 lines
drivers/net/ice/ice_rxtx_vec_avx512.c +2
-4hi_qw2, - pkt[2]->buf_physaddr + pkt[2]->data_off); -__m256i desc0_1 = -_mm256_set_epi64x - (hi_qw1, + pkt[2 ]->buf_physaddr + pkt[2 ]->data_off, + hi_qw1, pkt[1 ]->buf_physaddr + pkt[1 ]->data_off, hi_qw0, pkt[0]->buf_physaddr + pkt[0]->data_off);
'buf_physaddr' will be remove in 20.11, we need to use 'buf_iova' instead.
Quoted 2 lines
--
2.17.1
v2 cover AVX512 vPMD on ice
In reply to Leyi RongThis patchset aims to support AVX512 vPMD on ice.
Has dependency on http://patches.dpdk.org/cover/76096/
which support SIMD bitwidth selection properly.
---
v2:
- No internal judgement when RTE_MACHINE_CPUFLAG_AVX512F is set in meson.build.
- Add RSS hash parsing as default RXDID is set to #22.
- Use buf_iova instead of buf_physaddr, as buf_physaddr will be removed.
Leyi Rong (3):
net/ice: add AVX512 vector path
net/ice: add RSS hash parsing in AVX512 path
net/ice: optimize Tx path on AVX512 vPMD
drivers/net/ice/ice_rxtx.c | 88 ++- drivers/net/ice/ice_rxtx.h | 11 + drivers/net/ice/ice_rxtx_vec_avx512.c | 1018 +++++++++++++++++++++++++ drivers/net/ice/ice_rxtx_vec_common.h | 36 +- drivers/net/ice/meson.build | 11 + 5 files changed, 1139 insertions(+), 25 deletions(-) create mode 100644 drivers/net/ice/ice_rxtx_vec_avx512.c
Signature · 1 line
2.17.1
PATCH v2 1/3 net/ice: add AVX512 vector path
Add AVX512 support for ice PMD. This patch adds ice_rxtx_vec_avx512.c to support ice AVX512 vPMD.
This patch aims to enable AVX512 on ice vPMD. Main changes are focus on Rx path compared with AVX2 vPMD.
--- drivers/net/ice/ice_rxtx.c | 88 ++- drivers/net/ice/ice_rxtx.h | 7 + drivers/net/ice/ice_rxtx_vec_avx512.c | 824 ++++++++++++++++++++++++++ drivers/net/ice/meson.build | 11 + 4 files changed, 912 insertions(+), 18 deletions(-) create mode 100644 drivers/net/ice/ice_rxtx_vec_avx512.c
drivers/net/ice/ice_rxtx.c +70 -18
@@ -1876,6 +1876,10 @@ ice_dev_supported_ptypes_get(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 if (dev->rx_pkt_burst == ice_recv_pkts_vec || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec || +#ifdef CC_AVX512_SUPPORT + dev->rx_pkt_burst == ice_recv_pkts_vec_avx512 || + dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx512 || +#endif dev->rx_pkt_burst == ice_recv_pkts_vec_avx2 || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx2) return ptypes;
@@ -2933,6 +2937,7 @@ ice_set_rx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_rx_queue *rxq;int i; +bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {
@@ -2948,10 +2953,18 @@ ice_set_rx_function(struct rte_eth_dev *dev) } } -if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +if (rte_get_max_simd_bitwidth () >=RTE_MAX_512_SIMD && + rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) +#ifdef CC_AVX512_SUPPORT + use_avx512 = true; +#else +PMD_DRV_LOG (NOTICE , +"AVX512 is not supported in build env" ); +#endif +if (!use_avx512 && + (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 ||rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && -rte_get_max_simd_bitwidth () - >=RTE_MAX_256_SIMD ) +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) use_avx2 = true; }else {
@@ -2961,20 +2974,37 @@ ice_set_rx_function(struct rte_eth_dev *dev)if (ad->rx_vec_allowed) {if (dev->data->scattered_rx) { -PMD_DRV_LOG (DEBUG , +if (use_avx512) { +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; + }else { +PMD_DRV_LOG (DEBUG ,"Using %sVector Scattered Rx (port %d)." , use_avx2 ?"avx2 " :"" , dev->data->port_id); - dev->rx_pkt_burst = use_avx2 ? + dev->rx_pkt_burst = use_avx2 ? ice_recv_scattered_pkts_vec_avx2 : ice_recv_scattered_pkts_vec; + } }else { -PMD_DRV_LOG (DEBUG ,"Using %sVector Rx (port %d)." , +if (use_avx512) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_pkts_vec_avx512; + }else { +PMD_DRV_LOG (DEBUG , +"Using %sVector Rx (port %d)." , use_avx2 ?"avx2 " :"" , dev->data->port_id); - dev->rx_pkt_burst = use_avx2 ? - ice_recv_pkts_vec_avx2 : - ice_recv_pkts_vec; + dev->rx_pkt_burst = use_avx2 ? + ice_recv_pkts_vec_avx2 : + ice_recv_pkts_vec; + } }return ; }
@@ -3011,6 +3041,10 @@ static const struct { { ice_recv_pkts_bulk_alloc, "Scalar Bulk Alloc" }, { ice_recv_pkts, "Scalar" }, #ifdef RTE_ARCH_X86 +#ifdef CC_AVX512_SUPPORT + { ice_recv_scattered_pkts_vec_avx512, "Vector AVX512 Scattered" }, + { ice_recv_pkts_vec_avx512, "Vector AVX512" }, +#endif { ice_recv_scattered_pkts_vec_avx2, "Vector AVX2 Scattered" }, { ice_recv_pkts_vec_avx2, "Vector AVX2" }, { ice_recv_scattered_pkts_vec, "Vector SSE Scattered" },
@@ -3115,6 +3149,7 @@ ice_set_tx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_tx_queue *txq;int i; +bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {
@@ -3130,10 +3165,18 @@ ice_set_tx_function(struct rte_eth_dev *dev) } } -if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +if (rte_get_max_simd_bitwidth () >=RTE_MAX_512_SIMD && + rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) +#ifdef CC_AVX512_SUPPORT + use_avx512 = true; +#else +PMD_DRV_LOG (NOTICE , +"AVX512 is not supported in build env" ); +#endif +if (!use_avx512 && + (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 ||rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && -rte_get_max_simd_bitwidth () - >=RTE_MAX_256_SIMD ) +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) use_avx2 = true; }else {
@@ -3142,12 +3185,18 @@ ice_set_tx_function(struct rte_eth_dev *dev) }if (ad->tx_vec_allowed) { -PMD_DRV_LOG (DEBUG ,"Using %sVector Tx (port %d)." , - use_avx2 ?"avx2 " :"" , - dev->data->port_id); - dev->tx_pkt_burst = use_avx2 ? - ice_xmit_pkts_vec_avx2 : - ice_xmit_pkts_vec; +if (use_avx512) { +PMD_DRV_LOG (NOTICE ,"Using AVX512 Vector Tx (port %d)." , + dev->data->port_id); + dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512; + }else { +PMD_DRV_LOG (DEBUG ,"Using %sVector Tx (port %d)." , + use_avx2 ?"avx2 " :"" , + dev->data->port_id); + dev->tx_pkt_burst = use_avx2 ? + ice_xmit_pkts_vec_avx2 : + ice_xmit_pkts_vec; + } dev->tx_pkt_prepare =NULL ;return ;
@@ -3172,6 +3221,9 @@ static const struct { { ice_xmit_pkts_simple, "Scalar Simple" }, { ice_xmit_pkts, "Scalar" }, #ifdef RTE_ARCH_X86 +#ifdef CC_AVX512_SUPPORT + { ice_xmit_pkts_vec_avx512, "Vector AVX512" }, +#endif { ice_xmit_pkts_vec_avx2, "Vector AVX2" }, { ice_xmit_pkts_vec, "Vector SSE" }, #endif
drivers/net/ice/ice_rxtx.h +7 -0
@@ -243,6 +243,13 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t ice_recv_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_t ice_recv_scattered_pkts_vec_avx512 (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_t ice_xmit_pkts_vec_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);int ice_fdir_programming (struct ice_pf *pf,struct ice_fltr_desc *fdir_desc);int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);
drivers/net/ice/ice_rxtx_vec_avx512.c new file +824 -0
824 lines not on this page · raw message
drivers/net/ice/meson.build +11 -0
@@ -33,6 +33,17 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) 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')) + 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']) + objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c') + endif endif sources += files('ice_dcf.c',
Signature · 1 line
2.17.1
PATCH v2 2/3 net/ice: add RSS hash parsing in AVX512 path
In reply to Leyi RongSupport RSS hash parsing in AVX512 data path as the default RXDID is set to #22, that means the RSS hash field locates in the 2nd 16B of each Flex Rx descriptor.
--- drivers/net/ice/ice_rxtx_vec_avx512.c | 105 ++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 7 deletions(-)
drivers/net/ice/ice_rxtx_vec_avx512.c +98 -7
@@ -176,8 +176,8 @@ _ice_recv_raw_pkts_vec_avx512(struct ice_rx_queue *rxq,/* mask to shuffle from desc. to mbuf (4 descriptors)*/ const __m512i shuf_msk = _mm512_set4_epi32 - (/* octet 12~15, 32 bits rss */ - 15 << 24 | 14 << 16 | 13 << 8 | 12, + (/* rss hash parsed separately */ + 0xFFFFFFFF, /* octet 10~11, 16 bits vlan_macip */ /* octet 4~5, 16 bits data_len */ 11 << 24 | 10 << 16 | 5 << 8 | 4,
@@ -399,6 +399,11 @@ _ice_recv_raw_pkts_vec_avx512(struct ice_rx_queue *rxq, mb4_7 =_mm512_mask_blend_epi32 (0x1111 , mb4_7, ptype4_7); mb0_3 =_mm512_mask_blend_epi32 (0x1111 , mb0_3, ptype0_3); +__m256i mb4_5 =_mm512_extracti64x4_epi64 (mb4_7,0 ); +__m256i mb6_7 =_mm512_extracti64x4_epi64 (mb4_7,1 ); +__m256i mb0_1 =_mm512_extracti64x4_epi64 (mb0_3,0 ); +__m256i mb2_3 =_mm512_extracti64x4_epi64 (mb0_3,1 ); +/** * use permute/extract to get status content * After the operations, the packets status flags are in the
@@ -438,6 +443,97 @@ _ice_recv_raw_pkts_vec_avx512(struct ice_rx_queue *rxq,/* merge flags */ const __m256i mbuf_flags =_mm256_or_si256 (l3_l4_flags, rss_vlan_flags); + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +/** +* needs to load 2nd 16B of each desc for RSS hash parsing, +* will cause performance drop to get into this context. +*/ +if (rxq->vsi->adapter->eth_dev->data->dev_conf.rxmode.offloads & +DEV_RX_OFFLOAD_RSS_HASH ) { +/* load bottom half of every 32B desc */ +const __m128i raw_desc_bh7 = +_mm_load_si128 + ((void *)(&rxdp[7 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh6 = +_mm_load_si128 + ((void *)(&rxdp[6 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh5 = +_mm_load_si128 + ((void *)(&rxdp[5 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh4 = +_mm_load_si128 + ((void *)(&rxdp[4 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh3 = +_mm_load_si128 + ((void *)(&rxdp[3 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh2 = +_mm_load_si128 + ((void *)(&rxdp[2 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh1 = +_mm_load_si128 + ((void *)(&rxdp[1 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh0 = +_mm_load_si128 + ((void *)(&rxdp[0 ].wb.status_error1)); + +__m256i raw_desc_bh6_7 = +_mm256_inserti128_si256 + (_mm256_castsi128_si256 (raw_desc_bh6), + raw_desc_bh7,1 ); +__m256i raw_desc_bh4_5 = +_mm256_inserti128_si256 + (_mm256_castsi128_si256 (raw_desc_bh4), + raw_desc_bh5,1 ); +__m256i raw_desc_bh2_3 = +_mm256_inserti128_si256 + (_mm256_castsi128_si256 (raw_desc_bh2), + raw_desc_bh3,1 ); +__m256i raw_desc_bh0_1 = +_mm256_inserti128_si256 + (_mm256_castsi128_si256 (raw_desc_bh0), + raw_desc_bh1,1 ); + +/** +* to shift the 32b RSS hash value to the +* highest 32b of each 128b before mask +*/ +__m256i rss_hash6_7 = +_mm256_slli_epi64 (raw_desc_bh6_7,32 ); +__m256i rss_hash4_5 = +_mm256_slli_epi64 (raw_desc_bh4_5,32 ); +__m256i rss_hash2_3 = +_mm256_slli_epi64 (raw_desc_bh2_3,32 ); +__m256i rss_hash0_1 = +_mm256_slli_epi64 (raw_desc_bh0_1,32 ); + +__m256i rss_hash_msk = +_mm256_set_epi32 (0xFFFFFFFF ,0 ,0 ,0 , +0xFFFFFFFF ,0 ,0 ,0 ); + + rss_hash6_7 =_mm256_and_si256 + (rss_hash6_7, rss_hash_msk); + rss_hash4_5 =_mm256_and_si256 + (rss_hash4_5, rss_hash_msk); + rss_hash2_3 =_mm256_and_si256 + (rss_hash2_3, rss_hash_msk); + rss_hash0_1 =_mm256_and_si256 + (rss_hash0_1, rss_hash_msk); + + mb6_7 =_mm256_or_si256 (mb6_7, rss_hash6_7); + mb4_5 =_mm256_or_si256 (mb4_5, rss_hash4_5); + mb2_3 =_mm256_or_si256 (mb2_3, rss_hash2_3); + mb0_1 =_mm256_or_si256 (mb0_1, rss_hash0_1); + }/* if() on RSS hash parsing */ +#endif +/** * At this point, we have the 8 sets of flags in the low 16-bits * of each 32-bit value in vlan0.
@@ -471,11 +567,6 @@ _ice_recv_raw_pkts_vec_avx512(struct ice_rx_queue *rxq,_mm256_srli_si256 (mbuf_flags,4 ), 0x04); -const __m256i mb4_5 =_mm512_extracti64x4_epi64 (mb4_7,0 ); -const __m256i mb6_7 =_mm512_extracti64x4_epi64 (mb4_7,1 ); -const __m256i mb0_1 =_mm512_extracti64x4_epi64 (mb0_3,0 ); -const __m256i mb2_3 =_mm512_extracti64x4_epi64 (mb0_3,1 ); -/* permute to add in the rx_descriptor e.g. rss fields */ rearm6 =_mm256_permute2f128_si256 (rearm6, mb6_7,0x20 ); rearm4 =_mm256_permute2f128_si256 (rearm4, mb4_5,0x20 );
Signature · 1 line
2.17.1
PATCH v2 3/3 net/ice: optimize Tx path on AVX512 vPMD
In reply to Leyi RongOptimize Tx path by using AVX512 instructions and vectorize the tx free bufs process.
--- drivers/net/ice/ice_rxtx.h | 4 + drivers/net/ice/ice_rxtx_vec_avx512.c | 155 +++++++++++++++++++++----- drivers/net/ice/ice_rxtx_vec_common.h | 36 ++++-- 3 files changed, 162 insertions(+), 33 deletions(-)
drivers/net/ice/ice_rxtx.h +4 -0
@@ -91,6 +91,10 @@ struct ice_tx_entry {uint16_t last_id; }; +struct ice_vec_tx_entry { +struct rte_mbuf *mbuf; +}; +struct ice_tx_queue {uint16_t nb_tx_desc;/* number of TX descriptors */ rte_iova_t tx_ring_dma;/* TX ring DMA address */
drivers/net/ice/ice_rxtx_vec_avx512.c +129 -26
219 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_common.h +29 -7
@@ -189,16 +189,38 @@ _ice_tx_queue_release_mbufs_vec(struct ice_tx_queue *txq)* so need to free remains more carefully. */ i = txq->tx_next_dd - txq->tx_rs_thresh +1 ; -if (txq->tx_tail < i) { -for (; i < txq->nb_tx_desc; i++) { + +#ifdef CC_AVX512_SUPPORT +struct rte_eth_dev *dev = txq->vsi->adapter->eth_dev; + +if (dev->tx_pkt_burst == ice_xmit_pkts_vec_avx512) { +struct ice_vec_tx_entry *swr = (void *)txq->sw_ring; + +if (txq->tx_tail < i) { +for (; i < txq->nb_tx_desc; i++) { +rte_pktmbuf_free_seg (swr[i].mbuf); + swr[i].mbuf =NULL ; + } + i =0 ; + } +for (; i < txq->tx_tail; i++) { +rte_pktmbuf_free_seg (swr[i].mbuf); + swr[i].mbuf =NULL ; + } + } else +#endif + { +if (txq->tx_tail < i) { +for (; i < txq->nb_tx_desc; i++) { +rte_pktmbuf_free_seg (txq->sw_ring[i].mbuf); + txq->sw_ring[i].mbuf =NULL ; + } + i =0 ; + } +for (; i < txq->tx_tail; i++) {rte_pktmbuf_free_seg (txq->sw_ring[i].mbuf); txq->sw_ring[i].mbuf =NULL ; } - i =0 ; - } -for (; i < txq->tx_tail; i++) { -rte_pktmbuf_free_seg (txq->sw_ring[i].mbuf); - txq->sw_ring[i].mbuf =NULL ; } }
Signature · 1 line
2.17.1
v3 cover AVX512 vPMD on ice
In reply to Leyi RongThis patchset aims to support AVX512 vPMD on ice.
---
v3:
- Code rebased.
v2:
- No internal judgement when RTE_MACHINE_CPUFLAG_AVX512F is set in meson.build.
- Add RSS hash parsing as default RXDID is set to #22.
- Use buf_iova instead of buf_physaddr, as buf_physaddr will be removed.
Leyi Rong (3):
net/ice: add AVX512 vector path
net/ice: add RSS hash parsing in AVX512 path
net/ice: optimize Tx path on AVX512 vPMD
drivers/net/ice/ice_rxtx.c | 90 ++- drivers/net/ice/ice_rxtx.h | 11 + drivers/net/ice/ice_rxtx_vec_avx512.c | 1018 +++++++++++++++++++++++++ drivers/net/ice/ice_rxtx_vec_common.h | 36 +- drivers/net/ice/meson.build | 11 + 5 files changed, 1141 insertions(+), 25 deletions(-) create mode 100644 drivers/net/ice/ice_rxtx_vec_avx512.c
Signature · 1 line
2.17.1
PATCH v3 1/3 net/ice: add AVX512 vector path
Add AVX512 support for ice PMD. This patch adds ice_rxtx_vec_avx512.c to support ice AVX512 vPMD.
This patch aims to enable AVX512 on ice vPMD. Main changes are focus on Rx path compared with AVX2 vPMD.
--- drivers/net/ice/ice_rxtx.c | 90 ++- drivers/net/ice/ice_rxtx.h | 7 + drivers/net/ice/ice_rxtx_vec_avx512.c | 824 ++++++++++++++++++++++++++ drivers/net/ice/meson.build | 11 + 4 files changed, 914 insertions(+), 18 deletions(-) create mode 100644 drivers/net/ice/ice_rxtx_vec_avx512.c
drivers/net/ice/ice_rxtx.c +72 -18
@@ -1930,6 +1930,10 @@ ice_dev_supported_ptypes_get(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 if (dev->rx_pkt_burst == ice_recv_pkts_vec || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec || +#ifdef CC_AVX512_SUPPORT + dev->rx_pkt_burst == ice_recv_pkts_vec_avx512 || + dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx512 || +#endif dev->rx_pkt_burst == ice_recv_pkts_vec_avx2 || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx2) return ptypes;
@@ -2987,6 +2991,7 @@ ice_set_rx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_rx_queue *rxq;int i; +bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {
@@ -3001,9 +3006,18 @@ ice_set_rx_function(struct rte_eth_dev *dev) } } -if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && -rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) +if (rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_512 && + rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) +#ifdef CC_AVX512_SUPPORT + use_avx512 = true; +#else +PMD_DRV_LOG (NOTICE , +"AVX512 is not supported in build env" ); +#endif +if (!use_avx512 && + (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) use_avx2 = true; }else {
@@ -3013,20 +3027,37 @@ ice_set_rx_function(struct rte_eth_dev *dev)if (ad->rx_vec_allowed) {if (dev->data->scattered_rx) { -PMD_DRV_LOG (DEBUG , +if (use_avx512) { +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; + }else { +PMD_DRV_LOG (DEBUG ,"Using %sVector Scattered Rx (port %d)." , use_avx2 ?"avx2 " :"" , dev->data->port_id); - dev->rx_pkt_burst = use_avx2 ? + dev->rx_pkt_burst = use_avx2 ? ice_recv_scattered_pkts_vec_avx2 : ice_recv_scattered_pkts_vec; + } }else { -PMD_DRV_LOG (DEBUG ,"Using %sVector Rx (port %d)." , +if (use_avx512) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_pkts_vec_avx512; + }else { +PMD_DRV_LOG (DEBUG , +"Using %sVector Rx (port %d)." , use_avx2 ?"avx2 " :"" , dev->data->port_id); - dev->rx_pkt_burst = use_avx2 ? - ice_recv_pkts_vec_avx2 : - ice_recv_pkts_vec; + dev->rx_pkt_burst = use_avx2 ? + ice_recv_pkts_vec_avx2 : + ice_recv_pkts_vec; + } }return ; }
@@ -3063,6 +3094,10 @@ static const struct { { ice_recv_pkts_bulk_alloc, "Scalar Bulk Alloc" }, { ice_recv_pkts, "Scalar" }, #ifdef RTE_ARCH_X86 +#ifdef CC_AVX512_SUPPORT + { ice_recv_scattered_pkts_vec_avx512, "Vector AVX512 Scattered" }, + { ice_recv_pkts_vec_avx512, "Vector AVX512" }, +#endif { ice_recv_scattered_pkts_vec_avx2, "Vector AVX2 Scattered" }, { ice_recv_pkts_vec_avx2, "Vector AVX2" }, { ice_recv_scattered_pkts_vec, "Vector SSE Scattered" },
@@ -3167,6 +3202,7 @@ ice_set_tx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_tx_queue *txq;int i; +bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {
@@ -3181,9 +3217,18 @@ ice_set_tx_function(struct rte_eth_dev *dev) } } -if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && -rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) +if (rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_512 && + rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) +#ifdef CC_AVX512_SUPPORT + use_avx512 = true; +#else +PMD_DRV_LOG (NOTICE , +"AVX512 is not supported in build env" ); +#endif +if (!use_avx512 && + (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) use_avx2 = true; }else {
@@ -3192,12 +3237,18 @@ ice_set_tx_function(struct rte_eth_dev *dev) }if (ad->tx_vec_allowed) { -PMD_DRV_LOG (DEBUG ,"Using %sVector Tx (port %d)." , - use_avx2 ?"avx2 " :"" , - dev->data->port_id); - dev->tx_pkt_burst = use_avx2 ? - ice_xmit_pkts_vec_avx2 : - ice_xmit_pkts_vec; +if (use_avx512) { +PMD_DRV_LOG (NOTICE ,"Using AVX512 Vector Tx (port %d)." , + dev->data->port_id); + dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512; + }else { +PMD_DRV_LOG (DEBUG ,"Using %sVector Tx (port %d)." , + use_avx2 ?"avx2 " :"" , + dev->data->port_id); + dev->tx_pkt_burst = use_avx2 ? + ice_xmit_pkts_vec_avx2 : + ice_xmit_pkts_vec; + } dev->tx_pkt_prepare =NULL ;return ;
@@ -3222,6 +3273,9 @@ static const struct { { ice_xmit_pkts_simple, "Scalar Simple" }, { ice_xmit_pkts, "Scalar" }, #ifdef RTE_ARCH_X86 +#ifdef CC_AVX512_SUPPORT + { ice_xmit_pkts_vec_avx512, "Vector AVX512" }, +#endif { ice_xmit_pkts_vec_avx2, "Vector AVX2" }, { ice_xmit_pkts_vec, "Vector SSE" }, #endif
drivers/net/ice/ice_rxtx.h +7 -0
@@ -248,6 +248,13 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t ice_recv_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_t ice_recv_scattered_pkts_vec_avx512 (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_t ice_xmit_pkts_vec_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);int ice_fdir_programming (struct ice_pf *pf,struct ice_fltr_desc *fdir_desc);int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);
drivers/net/ice/ice_rxtx_vec_avx512.c new file +824 -0
824 lines not on this page · raw message
drivers/net/ice/meson.build +11 -0
@@ -33,6 +33,17 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) 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')) + 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']) + objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c') + endif endif sources += files('ice_dcf.c',
Signature · 1 line
2.17.1
PATCH v3 2/3 net/ice: add RSS hash parsing in AVX512 path
In reply to Leyi RongSupport RSS hash parsing in AVX512 data path as the default RXDID is set to #22, that means the RSS hash field locates in the 2nd 16B of each Flex Rx descriptor.
--- drivers/net/ice/ice_rxtx_vec_avx512.c | 105 ++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 7 deletions(-)
drivers/net/ice/ice_rxtx_vec_avx512.c +98 -7
@@ -176,8 +176,8 @@ _ice_recv_raw_pkts_vec_avx512(struct ice_rx_queue *rxq,/* mask to shuffle from desc. to mbuf (4 descriptors)*/ const __m512i shuf_msk = _mm512_set4_epi32 - (/* octet 12~15, 32 bits rss */ - 15 << 24 | 14 << 16 | 13 << 8 | 12, + (/* rss hash parsed separately */ + 0xFFFFFFFF, /* octet 10~11, 16 bits vlan_macip */ /* octet 4~5, 16 bits data_len */ 11 << 24 | 10 << 16 | 5 << 8 | 4,
@@ -399,6 +399,11 @@ _ice_recv_raw_pkts_vec_avx512(struct ice_rx_queue *rxq, mb4_7 =_mm512_mask_blend_epi32 (0x1111 , mb4_7, ptype4_7); mb0_3 =_mm512_mask_blend_epi32 (0x1111 , mb0_3, ptype0_3); +__m256i mb4_5 =_mm512_extracti64x4_epi64 (mb4_7,0 ); +__m256i mb6_7 =_mm512_extracti64x4_epi64 (mb4_7,1 ); +__m256i mb0_1 =_mm512_extracti64x4_epi64 (mb0_3,0 ); +__m256i mb2_3 =_mm512_extracti64x4_epi64 (mb0_3,1 ); +/** * use permute/extract to get status content * After the operations, the packets status flags are in the
@@ -438,6 +443,97 @@ _ice_recv_raw_pkts_vec_avx512(struct ice_rx_queue *rxq,/* merge flags */ const __m256i mbuf_flags =_mm256_or_si256 (l3_l4_flags, rss_vlan_flags); + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +/** +* needs to load 2nd 16B of each desc for RSS hash parsing, +* will cause performance drop to get into this context. +*/ +if (rxq->vsi->adapter->eth_dev->data->dev_conf.rxmode.offloads & +DEV_RX_OFFLOAD_RSS_HASH ) { +/* load bottom half of every 32B desc */ +const __m128i raw_desc_bh7 = +_mm_load_si128 + ((void *)(&rxdp[7 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh6 = +_mm_load_si128 + ((void *)(&rxdp[6 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh5 = +_mm_load_si128 + ((void *)(&rxdp[5 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh4 = +_mm_load_si128 + ((void *)(&rxdp[4 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh3 = +_mm_load_si128 + ((void *)(&rxdp[3 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh2 = +_mm_load_si128 + ((void *)(&rxdp[2 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh1 = +_mm_load_si128 + ((void *)(&rxdp[1 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh0 = +_mm_load_si128 + ((void *)(&rxdp[0 ].wb.status_error1)); + +__m256i raw_desc_bh6_7 = +_mm256_inserti128_si256 + (_mm256_castsi128_si256 (raw_desc_bh6), + raw_desc_bh7,1 ); +__m256i raw_desc_bh4_5 = +_mm256_inserti128_si256 + (_mm256_castsi128_si256 (raw_desc_bh4), + raw_desc_bh5,1 ); +__m256i raw_desc_bh2_3 = +_mm256_inserti128_si256 + (_mm256_castsi128_si256 (raw_desc_bh2), + raw_desc_bh3,1 ); +__m256i raw_desc_bh0_1 = +_mm256_inserti128_si256 + (_mm256_castsi128_si256 (raw_desc_bh0), + raw_desc_bh1,1 ); + +/** +* to shift the 32b RSS hash value to the +* highest 32b of each 128b before mask +*/ +__m256i rss_hash6_7 = +_mm256_slli_epi64 (raw_desc_bh6_7,32 ); +__m256i rss_hash4_5 = +_mm256_slli_epi64 (raw_desc_bh4_5,32 ); +__m256i rss_hash2_3 = +_mm256_slli_epi64 (raw_desc_bh2_3,32 ); +__m256i rss_hash0_1 = +_mm256_slli_epi64 (raw_desc_bh0_1,32 ); + +__m256i rss_hash_msk = +_mm256_set_epi32 (0xFFFFFFFF ,0 ,0 ,0 , +0xFFFFFFFF ,0 ,0 ,0 ); + + rss_hash6_7 =_mm256_and_si256 + (rss_hash6_7, rss_hash_msk); + rss_hash4_5 =_mm256_and_si256 + (rss_hash4_5, rss_hash_msk); + rss_hash2_3 =_mm256_and_si256 + (rss_hash2_3, rss_hash_msk); + rss_hash0_1 =_mm256_and_si256 + (rss_hash0_1, rss_hash_msk); + + mb6_7 =_mm256_or_si256 (mb6_7, rss_hash6_7); + mb4_5 =_mm256_or_si256 (mb4_5, rss_hash4_5); + mb2_3 =_mm256_or_si256 (mb2_3, rss_hash2_3); + mb0_1 =_mm256_or_si256 (mb0_1, rss_hash0_1); + }/* if() on RSS hash parsing */ +#endif +/** * At this point, we have the 8 sets of flags in the low 16-bits * of each 32-bit value in vlan0.
@@ -471,11 +567,6 @@ _ice_recv_raw_pkts_vec_avx512(struct ice_rx_queue *rxq,_mm256_srli_si256 (mbuf_flags,4 ), 0x04); -const __m256i mb4_5 =_mm512_extracti64x4_epi64 (mb4_7,0 ); -const __m256i mb6_7 =_mm512_extracti64x4_epi64 (mb4_7,1 ); -const __m256i mb0_1 =_mm512_extracti64x4_epi64 (mb0_3,0 ); -const __m256i mb2_3 =_mm512_extracti64x4_epi64 (mb0_3,1 ); -/* permute to add in the rx_descriptor e.g. rss fields */ rearm6 =_mm256_permute2f128_si256 (rearm6, mb6_7,0x20 ); rearm4 =_mm256_permute2f128_si256 (rearm4, mb4_5,0x20 );
Signature · 1 line
2.17.1
PATCH v3 3/3 net/ice: optimize Tx path on AVX512 vPMD
In reply to Leyi RongOptimize Tx path by using AVX512 instructions and vectorize the tx free bufs process.
--- drivers/net/ice/ice_rxtx.h | 4 + drivers/net/ice/ice_rxtx_vec_avx512.c | 155 +++++++++++++++++++++----- drivers/net/ice/ice_rxtx_vec_common.h | 36 ++++-- 3 files changed, 162 insertions(+), 33 deletions(-)
drivers/net/ice/ice_rxtx.h +4 -0
@@ -96,6 +96,10 @@ struct ice_tx_entry {uint16_t last_id; }; +struct ice_vec_tx_entry { +struct rte_mbuf *mbuf; +}; +struct ice_tx_queue {uint16_t nb_tx_desc;/* number of TX descriptors */ rte_iova_t tx_ring_dma;/* TX ring DMA address */
drivers/net/ice/ice_rxtx_vec_avx512.c +129 -26
219 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_common.h +29 -7
@@ -189,16 +189,38 @@ _ice_tx_queue_release_mbufs_vec(struct ice_tx_queue *txq)* so need to free remains more carefully. */ i = txq->tx_next_dd - txq->tx_rs_thresh +1 ; -if (txq->tx_tail < i) { -for (; i < txq->nb_tx_desc; i++) { + +#ifdef CC_AVX512_SUPPORT +struct rte_eth_dev *dev = txq->vsi->adapter->eth_dev; + +if (dev->tx_pkt_burst == ice_xmit_pkts_vec_avx512) { +struct ice_vec_tx_entry *swr = (void *)txq->sw_ring; + +if (txq->tx_tail < i) { +for (; i < txq->nb_tx_desc; i++) { +rte_pktmbuf_free_seg (swr[i].mbuf); + swr[i].mbuf =NULL ; + } + i =0 ; + } +for (; i < txq->tx_tail; i++) { +rte_pktmbuf_free_seg (swr[i].mbuf); + swr[i].mbuf =NULL ; + } + } else +#endif + { +if (txq->tx_tail < i) { +for (; i < txq->nb_tx_desc; i++) { +rte_pktmbuf_free_seg (txq->sw_ring[i].mbuf); + txq->sw_ring[i].mbuf =NULL ; + } + i =0 ; + } +for (; i < txq->tx_tail; i++) {rte_pktmbuf_free_seg (txq->sw_ring[i].mbuf); txq->sw_ring[i].mbuf =NULL ; } - i =0 ; - } -for (; i < txq->tx_tail; i++) { -rte_pktmbuf_free_seg (txq->sw_ring[i].mbuf); - txq->sw_ring[i].mbuf =NULL ; } }
Signature · 1 line
2.17.1
v4 cover AVX512 vPMD on ice
In reply to Leyi RongThis patchset aims to support AVX512 vPMD on ice.
---
v4:
- Replace buf_physaddr by buf_iova in the 1st patch to eliminate build error.
v3:
- Code rebased.
v2:
- No internal judgement when RTE_MACHINE_CPUFLAG_AVX512F is set in meson.build.
- Add RSS hash parsing as default RXDID is set to #22.
- Use buf_iova instead of buf_physaddr, as buf_physaddr will be removed.
Leyi Rong (3):
net/ice: add AVX512 vector path
net/ice: add RSS hash parsing in AVX512 path
net/ice: optimize Tx path on AVX512 vPMD
drivers/net/ice/ice_rxtx.c | 90 ++- drivers/net/ice/ice_rxtx.h | 11 + drivers/net/ice/ice_rxtx_vec_avx512.c | 1018 +++++++++++++++++++++++++ drivers/net/ice/ice_rxtx_vec_common.h | 36 +- drivers/net/ice/meson.build | 11 + 5 files changed, 1141 insertions(+), 25 deletions(-) create mode 100644 drivers/net/ice/ice_rxtx_vec_avx512.c
Signature · 1 line
2.17.1
PATCH v4 1/3 net/ice: add AVX512 vector path
Add AVX512 support for ice PMD. This patch adds ice_rxtx_vec_avx512.c to support ice AVX512 vPMD.
This patch aims to enable AVX512 on ice vPMD. Main changes are focus on Rx path compared with AVX2 vPMD.
--- drivers/net/ice/ice_rxtx.c | 90 ++- drivers/net/ice/ice_rxtx.h | 7 + drivers/net/ice/ice_rxtx_vec_avx512.c | 824 ++++++++++++++++++++++++++ drivers/net/ice/meson.build | 11 + 4 files changed, 914 insertions(+), 18 deletions(-) create mode 100644 drivers/net/ice/ice_rxtx_vec_avx512.c
drivers/net/ice/ice_rxtx.c +72 -18
@@ -1930,6 +1930,10 @@ ice_dev_supported_ptypes_get(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 if (dev->rx_pkt_burst == ice_recv_pkts_vec || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec || +#ifdef CC_AVX512_SUPPORT + dev->rx_pkt_burst == ice_recv_pkts_vec_avx512 || + dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx512 || +#endif dev->rx_pkt_burst == ice_recv_pkts_vec_avx2 || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx2) return ptypes;
@@ -2987,6 +2991,7 @@ ice_set_rx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_rx_queue *rxq;int i; +bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {
@@ -3001,9 +3006,18 @@ ice_set_rx_function(struct rte_eth_dev *dev) } } -if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && -rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) +if (rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_512 && + rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) +#ifdef CC_AVX512_SUPPORT + use_avx512 = true; +#else +PMD_DRV_LOG (NOTICE , +"AVX512 is not supported in build env" ); +#endif +if (!use_avx512 && + (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) use_avx2 = true; }else {
@@ -3013,20 +3027,37 @@ ice_set_rx_function(struct rte_eth_dev *dev)if (ad->rx_vec_allowed) {if (dev->data->scattered_rx) { -PMD_DRV_LOG (DEBUG , +if (use_avx512) { +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; + }else { +PMD_DRV_LOG (DEBUG ,"Using %sVector Scattered Rx (port %d)." , use_avx2 ?"avx2 " :"" , dev->data->port_id); - dev->rx_pkt_burst = use_avx2 ? + dev->rx_pkt_burst = use_avx2 ? ice_recv_scattered_pkts_vec_avx2 : ice_recv_scattered_pkts_vec; + } }else { -PMD_DRV_LOG (DEBUG ,"Using %sVector Rx (port %d)." , +if (use_avx512) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_pkts_vec_avx512; + }else { +PMD_DRV_LOG (DEBUG , +"Using %sVector Rx (port %d)." , use_avx2 ?"avx2 " :"" , dev->data->port_id); - dev->rx_pkt_burst = use_avx2 ? - ice_recv_pkts_vec_avx2 : - ice_recv_pkts_vec; + dev->rx_pkt_burst = use_avx2 ? + ice_recv_pkts_vec_avx2 : + ice_recv_pkts_vec; + } }return ; }
@@ -3063,6 +3094,10 @@ static const struct { { ice_recv_pkts_bulk_alloc, "Scalar Bulk Alloc" }, { ice_recv_pkts, "Scalar" }, #ifdef RTE_ARCH_X86 +#ifdef CC_AVX512_SUPPORT + { ice_recv_scattered_pkts_vec_avx512, "Vector AVX512 Scattered" }, + { ice_recv_pkts_vec_avx512, "Vector AVX512" }, +#endif { ice_recv_scattered_pkts_vec_avx2, "Vector AVX2 Scattered" }, { ice_recv_pkts_vec_avx2, "Vector AVX2" }, { ice_recv_scattered_pkts_vec, "Vector SSE Scattered" },
@@ -3167,6 +3202,7 @@ ice_set_tx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_tx_queue *txq;int i; +bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {
@@ -3181,9 +3217,18 @@ ice_set_tx_function(struct rte_eth_dev *dev) } } -if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && -rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) +if (rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_512 && + rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) +#ifdef CC_AVX512_SUPPORT + use_avx512 = true; +#else +PMD_DRV_LOG (NOTICE , +"AVX512 is not supported in build env" ); +#endif +if (!use_avx512 && + (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) use_avx2 = true; }else {
@@ -3192,12 +3237,18 @@ ice_set_tx_function(struct rte_eth_dev *dev) }if (ad->tx_vec_allowed) { -PMD_DRV_LOG (DEBUG ,"Using %sVector Tx (port %d)." , - use_avx2 ?"avx2 " :"" , - dev->data->port_id); - dev->tx_pkt_burst = use_avx2 ? - ice_xmit_pkts_vec_avx2 : - ice_xmit_pkts_vec; +if (use_avx512) { +PMD_DRV_LOG (NOTICE ,"Using AVX512 Vector Tx (port %d)." , + dev->data->port_id); + dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512; + }else { +PMD_DRV_LOG (DEBUG ,"Using %sVector Tx (port %d)." , + use_avx2 ?"avx2 " :"" , + dev->data->port_id); + dev->tx_pkt_burst = use_avx2 ? + ice_xmit_pkts_vec_avx2 : + ice_xmit_pkts_vec; + } dev->tx_pkt_prepare =NULL ;return ;
@@ -3222,6 +3273,9 @@ static const struct { { ice_xmit_pkts_simple, "Scalar Simple" }, { ice_xmit_pkts, "Scalar" }, #ifdef RTE_ARCH_X86 +#ifdef CC_AVX512_SUPPORT + { ice_xmit_pkts_vec_avx512, "Vector AVX512" }, +#endif { ice_xmit_pkts_vec_avx2, "Vector AVX2" }, { ice_xmit_pkts_vec, "Vector SSE" }, #endif
drivers/net/ice/ice_rxtx.h +7 -0
@@ -248,6 +248,13 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t ice_recv_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_t ice_recv_scattered_pkts_vec_avx512 (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_t ice_xmit_pkts_vec_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);int ice_fdir_programming (struct ice_pf *pf,struct ice_fltr_desc *fdir_desc);int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);
drivers/net/ice/ice_rxtx_vec_avx512.c new file +824 -0
824 lines not on this page · raw message
drivers/net/ice/meson.build +11 -0
@@ -34,6 +34,17 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) 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')) + 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']) + objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c') + endif endif sources += files('ice_dcf.c',
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v4 1/3] net/ice: add AVX512 vector path
Hello Leyi, Qi, Ferruh,
Quoted 23 lines · Leyi Rong
drivers/net/ice/meson.build +11
-1@@ -34,6 +34,17 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) 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')) + 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']) + objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c') + endif endif sources += files('ice_dcf.c', --
Quoted 2 lines
2.17.1
RTE_MACHINE_CPUFLAG_AVX512F can be removed.
Worth fixing before hitting the main tree.
Thanks.
Signature · 1 line
David Marchand
Re: [dpdk-dev] [PATCH v4 1/3] net/ice: add AVX512 vector path
Quoted 41 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Monday, October 26, 2020 12:24 AM
To: Rong, Leyi <[email protected]>; Zhang, Qi Z <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: Lu, Wenzhuo <[email protected]>; dev <[email protected]>; Richardson, Bruce <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v4 1/3] net/ice: add AVX512 vector pathHello Leyi, Qi, Ferruh,
drivers/net/ice/meson.build if arch_subdir == 'x86' · line 38
Quoted 10 lines · Leyi Rong
drivers/net/ice/meson.build +2
-0@@ -34,6 +34,17 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) 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')andcc.has_argument('-mavx512f'))Quoted 13 lines
drivers/net/ice/meson.build +9
-1+ 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']) + objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c') + endif endif sources += files('ice_dcf.c', --Quoted 2 lines
2.17.1
Quoted 7 lines
RTE_MACHINE_CPUFLAG_AVX512Fcan be removed.
Worth fixing before hitting the main tree.Thanks.
--
David Marchand
Hello David,
Would prefer using __AVX512F__ instead of RTE_MACHINE_CPUFLAG_AVX512F here rather than remove the RTE_MACHINE_CPUFLAG_ macro directly to check the CPU capability. So the judgment statement will be
if cc.get_define('__AVX512F__', args: machine_args) != '' or (not machine_args.contains('-mno-avx512f') and cc.has_argument('-mavx512f'))
what do you think?
Hello Ferruh,
As the patchset is already merged into dpdk-next-net, I'm going to make another patch for this if it's accepted?
Re: [dpdk-dev] [PATCH v4 1/3] net/ice: add AVX512 vector path
Quoted 5 lines · Leyi
Would prefer using
__AVX512F__instead ofRTE_MACHINE_CPUFLAG_AVX512Fhere rather than remove theRTE_MACHINE_CPUFLAG_macro directly to check the CPU capability. So the judgment statement will be
ifcc.get_define('__AVX512F__', args: machine_args)!= '' or (notmachine_args.contains('-mno-avx512f')andcc.has_argument('-mavx512f'))what do you think?
No opinion as I have yet to understand the subtleties to control enablement of avx stuff.
Bruce?
Signature · 1 line
David Marchand
Re: [dpdk-dev] [PATCH v4 1/3] net/ice: add AVX512 vector path
Quoted 11 lines · David Marchand
Quoted 5 lines · Leyi
Would prefer using
__AVX512F__instead ofRTE_MACHINE_CPUFLAG_AVX512Fhere rather than remove theRTE_MACHINE_CPUFLAG_macro directly to check the CPU capability. So the judgment statement will be
ifcc.get_define('__AVX512F__', args: machine_args)!= '' or (notmachine_args.contains('-mno-avx512f')andcc.has_argument('-mavx512f'))what do you think?
No opinion as I have yet to understand the subtleties to control enablement of avx stuff.
Bruce?
The above proposal is correct, in that we now check the compiler flags directly rather than using our own custom flags.
/Bruce
Re: [dpdk-dev] [PATCH v4 1/3] net/ice: add AVX512 vector path
In reply to Rong, LeyiQuoted 55 lines · Leyi
Quoted 41 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Monday, October 26, 2020 12:24 AM
To: Rong, Leyi <[email protected]>; Zhang, Qi Z <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: Lu, Wenzhuo <[email protected]>; dev <[email protected]>; Richardson, Bruce <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v4 1/3] net/ice: add AVX512 vector pathHello Leyi, Qi, Ferruh,
drivers/net/ice/meson.build if arch_subdir == 'x86' · line 38
Quoted 10 lines · Leyi Rong
drivers/net/ice/meson.build +2
-0@@ -34,6 +34,17 @@ if arch_subdir == 'x86' c_args: [cflags, '-mavx2']) 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')andcc.has_argument('-mavx512f'))Quoted 13 lines
drivers/net/ice/meson.build +9
-1+ 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']) + objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c') + endif endif sources += files('ice_dcf.c', --Quoted 2 lines
2.17.1
Quoted 7 lines
RTE_MACHINE_CPUFLAG_AVX512Fcan be removed.
Worth fixing before hitting the main tree.Thanks.
--
David MarchandHello David,
Would prefer using
__AVX512F__instead ofRTE_MACHINE_CPUFLAG_AVX512Fhere rather than remove theRTE_MACHINE_CPUFLAG_macro directly to check the CPU capability. So the judgment statement will be
ifcc.get_define('__AVX512F__', args: machine_args)!= '' or (notmachine_args.contains('-mno-avx512f')andcc.has_argument('-mavx512f'))
Quoted 7 lines
what do you think?
Hello Ferruh,
As the patchset is already merged into dpdk-next-net, I'm going to make another patch for this if it's accepted?
Hi Leyi,
Please make another patch, I can squash it in the next-net.
Thanks,
ferruh
Re: [dpdk-dev] [PATCH v4 1/3] net/ice: add AVX512 vector path
In reply to Leyi RongHi,
Quoted 12 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Leyi Rong
Sent: Friday, October 23, 2020 7:14 AM
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; Leyi Rong <[email protected]>; Bruce Richardson <[email protected]>
Subject: [dpdk-dev] [PATCH v4 1/3] net/ice: add AVX512 vector pathAdd AVX512 support for ice PMD. This patch adds
ice_rxtx_vec_avx512.cto support ice AVX512 vPMD.
Quoted 6 lines
This patch aims to enable AVX512 on ice vPMD. Main changes are focus on Rx path compared with AVX2 vPMD.
Signed-off-by Leyi Rong <[email protected]>Signed-off-by Bruce Richardson <[email protected]>---
This patch is causing the following build failure on CentOS 7 with gcc 4.8.5:
"""
drivers/librte_net_ice.a(net_ice_ice_rxtx.c.o): In function `ice_set_rx_function':drivers/net/ice/ice_rxtx.c:3034: undefined reference to ice_recv_scattered_pkts_vec_avx512' drivers/net/ice/ice_rxtx.c:3050: undefined reference to ice_recv_pkts_vec_avx512' drivers/librte_net_ice.a(net_ice_ice_rxtx.c.o): In function `ice_set_tx_function':drivers/net/ice/ice_rxtx.c:3243: undefined reference to `ice_xmit_pkts_vec_avx512' """
It reproduces when building with "meson --werror --buildtype=debug build && ninja -C build".
Regards,
Ali
Re: [dpdk-dev] [PATCH v4 1/3] net/ice: add AVX512 vector path
Quoted 44 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Ali Alnubani
Sent: Tuesday, October 27, 2020 10:33 AM
To: Leyi Rong <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Bruce Richardson <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v4 1/3] net/ice: add AVX512 vector pathHi,
Quoted 12 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Leyi Rong
Sent: Friday, October 23, 2020 7:14 AM
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; Leyi Rong <[email protected]>; Bruce Richardson <[email protected]>
Subject: [dpdk-dev] [PATCH v4 1/3] net/ice: add AVX512 vector pathAdd AVX512 support for ice PMD. This patch adds
ice_rxtx_vec_avx512.cto support ice AVX512 vPMD.Quoted 6 lines
This patch aims to enable AVX512 on ice vPMD. Main changes are focus on Rx path compared with AVX2 vPMD.
Signed-off-by Leyi Rong <[email protected]>Signed-off-by Bruce Richardson <[email protected]>---
This patch is causing the following build failure on CentOS 7 with gcc 4.8.5:
""" drivers/librte_net_ice.a(net_ice_ice_rxtx.c.o): In function `ice_set_rx_function':
drivers/net/ice/ice_rxtx.c:3034: undefined reference toice_recv_scattered_pkts_vec_avx512' drivers/net/ice/ice_rxtx.c:3050: undefined reference toice_recv_pkts_vec_avx512' drivers/librte_net_ice.a(net_ice_ice_rxtx.c.o): In function `ice_set_tx_function':drivers/net/ice/ice_rxtx.c:3243: undefined reference to `ice_xmit_pkts_vec_avx512'
"""
Quoted 3 lines
It reproduces when building with "meson --werror --buildtype=debug build && ninja -C build".
It's also causing the following build failure on Ubuntu 18.04 (gcc 7.5.0) and on OpenSUSE Leap 15.2 (gcc 7.5.0):
"""drivers/net/ice/ice_rxtx_vec_avx512.c: In function '_ice_recv_raw_pkts_vec_avx512':/usr/lib/gcc/x86_64-linux-gnu/7/include/avx512bwintrin.h:1831:1: error: inlining failed in call to always_inline '_mm512_shuffle_epi8': target specific option mismatch
_mm512_shuffle_epi8 (__m512i __A, __m512i __B)
^~~~~~~~~~~~~~~~~~~drivers/net/ice/ice_rxtx_vec_avx512.c:350:11: note: called from here
__m512i mb0_3 = _mm512_shuffle_epi8(raw_desc0_3, shuf_msk);
^~~~~"""
Regards,
Ali
PATCH v4 2/3 net/ice: add RSS hash parsing in AVX512 path
In reply to Leyi RongSupport RSS hash parsing in AVX512 data path as the default RXDID is set to #22, that means the RSS hash field locates in the 2nd 16B of each Flex Rx descriptor.
--- drivers/net/ice/ice_rxtx_vec_avx512.c | 105 ++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 7 deletions(-)
drivers/net/ice/ice_rxtx_vec_avx512.c +98 -7
@@ -176,8 +176,8 @@ _ice_recv_raw_pkts_vec_avx512(struct ice_rx_queue *rxq,/* mask to shuffle from desc. to mbuf (4 descriptors)*/ const __m512i shuf_msk = _mm512_set4_epi32 - (/* octet 12~15, 32 bits rss */ - 15 << 24 | 14 << 16 | 13 << 8 | 12, + (/* rss hash parsed separately */ + 0xFFFFFFFF, /* octet 10~11, 16 bits vlan_macip */ /* octet 4~5, 16 bits data_len */ 11 << 24 | 10 << 16 | 5 << 8 | 4,
@@ -399,6 +399,11 @@ _ice_recv_raw_pkts_vec_avx512(struct ice_rx_queue *rxq, mb4_7 =_mm512_mask_blend_epi32 (0x1111 , mb4_7, ptype4_7); mb0_3 =_mm512_mask_blend_epi32 (0x1111 , mb0_3, ptype0_3); +__m256i mb4_5 =_mm512_extracti64x4_epi64 (mb4_7,0 ); +__m256i mb6_7 =_mm512_extracti64x4_epi64 (mb4_7,1 ); +__m256i mb0_1 =_mm512_extracti64x4_epi64 (mb0_3,0 ); +__m256i mb2_3 =_mm512_extracti64x4_epi64 (mb0_3,1 ); +/** * use permute/extract to get status content * After the operations, the packets status flags are in the
@@ -438,6 +443,97 @@ _ice_recv_raw_pkts_vec_avx512(struct ice_rx_queue *rxq,/* merge flags */ const __m256i mbuf_flags =_mm256_or_si256 (l3_l4_flags, rss_vlan_flags); + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +/** +* needs to load 2nd 16B of each desc for RSS hash parsing, +* will cause performance drop to get into this context. +*/ +if (rxq->vsi->adapter->eth_dev->data->dev_conf.rxmode.offloads & +DEV_RX_OFFLOAD_RSS_HASH ) { +/* load bottom half of every 32B desc */ +const __m128i raw_desc_bh7 = +_mm_load_si128 + ((void *)(&rxdp[7 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh6 = +_mm_load_si128 + ((void *)(&rxdp[6 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh5 = +_mm_load_si128 + ((void *)(&rxdp[5 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh4 = +_mm_load_si128 + ((void *)(&rxdp[4 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh3 = +_mm_load_si128 + ((void *)(&rxdp[3 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh2 = +_mm_load_si128 + ((void *)(&rxdp[2 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh1 = +_mm_load_si128 + ((void *)(&rxdp[1 ].wb.status_error1)); +rte_compiler_barrier (); +const __m128i raw_desc_bh0 = +_mm_load_si128 + ((void *)(&rxdp[0 ].wb.status_error1)); + +__m256i raw_desc_bh6_7 = +_mm256_inserti128_si256 + (_mm256_castsi128_si256 (raw_desc_bh6), + raw_desc_bh7,1 ); +__m256i raw_desc_bh4_5 = +_mm256_inserti128_si256 + (_mm256_castsi128_si256 (raw_desc_bh4), + raw_desc_bh5,1 ); +__m256i raw_desc_bh2_3 = +_mm256_inserti128_si256 + (_mm256_castsi128_si256 (raw_desc_bh2), + raw_desc_bh3,1 ); +__m256i raw_desc_bh0_1 = +_mm256_inserti128_si256 + (_mm256_castsi128_si256 (raw_desc_bh0), + raw_desc_bh1,1 ); + +/** +* to shift the 32b RSS hash value to the +* highest 32b of each 128b before mask +*/ +__m256i rss_hash6_7 = +_mm256_slli_epi64 (raw_desc_bh6_7,32 ); +__m256i rss_hash4_5 = +_mm256_slli_epi64 (raw_desc_bh4_5,32 ); +__m256i rss_hash2_3 = +_mm256_slli_epi64 (raw_desc_bh2_3,32 ); +__m256i rss_hash0_1 = +_mm256_slli_epi64 (raw_desc_bh0_1,32 ); + +__m256i rss_hash_msk = +_mm256_set_epi32 (0xFFFFFFFF ,0 ,0 ,0 , +0xFFFFFFFF ,0 ,0 ,0 ); + + rss_hash6_7 =_mm256_and_si256 + (rss_hash6_7, rss_hash_msk); + rss_hash4_5 =_mm256_and_si256 + (rss_hash4_5, rss_hash_msk); + rss_hash2_3 =_mm256_and_si256 + (rss_hash2_3, rss_hash_msk); + rss_hash0_1 =_mm256_and_si256 + (rss_hash0_1, rss_hash_msk); + + mb6_7 =_mm256_or_si256 (mb6_7, rss_hash6_7); + mb4_5 =_mm256_or_si256 (mb4_5, rss_hash4_5); + mb2_3 =_mm256_or_si256 (mb2_3, rss_hash2_3); + mb0_1 =_mm256_or_si256 (mb0_1, rss_hash0_1); + }/* if() on RSS hash parsing */ +#endif +/** * At this point, we have the 8 sets of flags in the low 16-bits * of each 32-bit value in vlan0.
@@ -471,11 +567,6 @@ _ice_recv_raw_pkts_vec_avx512(struct ice_rx_queue *rxq,_mm256_srli_si256 (mbuf_flags,4 ), 0x04); -const __m256i mb4_5 =_mm512_extracti64x4_epi64 (mb4_7,0 ); -const __m256i mb6_7 =_mm512_extracti64x4_epi64 (mb4_7,1 ); -const __m256i mb0_1 =_mm512_extracti64x4_epi64 (mb0_3,0 ); -const __m256i mb2_3 =_mm512_extracti64x4_epi64 (mb0_3,1 ); -/* permute to add in the rx_descriptor e.g. rss fields */ rearm6 =_mm256_permute2f128_si256 (rearm6, mb6_7,0x20 ); rearm4 =_mm256_permute2f128_si256 (rearm4, mb4_5,0x20 );
Signature · 1 line
2.17.1
PATCH v4 3/3 net/ice: optimize Tx path on AVX512 vPMD
In reply to Leyi RongOptimize Tx path by using AVX512 instructions and vectorize the tx free bufs process.
--- drivers/net/ice/ice_rxtx.h | 4 + drivers/net/ice/ice_rxtx_vec_avx512.c | 147 ++++++++++++++++++++++---- drivers/net/ice/ice_rxtx_vec_common.h | 36 +++++-- 3 files changed, 158 insertions(+), 29 deletions(-)
drivers/net/ice/ice_rxtx.h +4 -0
@@ -96,6 +96,10 @@ struct ice_tx_entry {uint16_t last_id; }; +struct ice_vec_tx_entry { +struct rte_mbuf *mbuf; +}; +struct ice_tx_queue {uint16_t nb_tx_desc;/* number of TX descriptors */ rte_iova_t tx_ring_dma;/* TX ring DMA address */
drivers/net/ice/ice_rxtx_vec_avx512.c +125 -22
208 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_common.h +29 -7
@@ -189,16 +189,38 @@ _ice_tx_queue_release_mbufs_vec(struct ice_tx_queue *txq)* so need to free remains more carefully. */ i = txq->tx_next_dd - txq->tx_rs_thresh +1 ; -if (txq->tx_tail < i) { -for (; i < txq->nb_tx_desc; i++) { + +#ifdef CC_AVX512_SUPPORT +struct rte_eth_dev *dev = txq->vsi->adapter->eth_dev; + +if (dev->tx_pkt_burst == ice_xmit_pkts_vec_avx512) { +struct ice_vec_tx_entry *swr = (void *)txq->sw_ring; + +if (txq->tx_tail < i) { +for (; i < txq->nb_tx_desc; i++) { +rte_pktmbuf_free_seg (swr[i].mbuf); + swr[i].mbuf =NULL ; + } + i =0 ; + } +for (; i < txq->tx_tail; i++) { +rte_pktmbuf_free_seg (swr[i].mbuf); + swr[i].mbuf =NULL ; + } + } else +#endif + { +if (txq->tx_tail < i) { +for (; i < txq->nb_tx_desc; i++) { +rte_pktmbuf_free_seg (txq->sw_ring[i].mbuf); + txq->sw_ring[i].mbuf =NULL ; + } + i =0 ; + } +for (; i < txq->tx_tail; i++) {rte_pktmbuf_free_seg (txq->sw_ring[i].mbuf); txq->sw_ring[i].mbuf =NULL ; } - i =0 ; - } -for (; i < txq->tx_tail; i++) { -rte_pktmbuf_free_seg (txq->sw_ring[i].mbuf); - txq->sw_ring[i].mbuf =NULL ; } }
Signature · 1 line
2.17.1
Quoted 37 lines
-----Original Message-----
From: Rong, Leyi <[email protected]>
Sent: Friday, October 23, 2020 12:14 PM
To: Zhang, Qi Z <[email protected]>; Lu, Wenzhuo <[email protected]>; [email protected]
Cc: [email protected]; Rong, Leyi <[email protected]>
Subject: [PATCH v4 0/3] AVX512 vPMD on iceThis patchset aims to support AVX512 vPMD on ice.
---
v4:
- Replacebuf_physaddrbybuf_iovain the 1st patch to eliminate build error.v3:
- Code rebased.v2:
- No internal judgement whenRTE_MACHINE_CPUFLAG_AVX512Fis set in meson.build.
- Add RSS hash parsing as default RXDID is set to #22.
- Usebuf_iovainstead ofbuf_physaddr, asbuf_physaddrwill be removed.Leyi Rong (3):
net/ice: add AVX512 vector path
net/ice: add RSS hash parsing in AVX512 path net/ice: optimize Tx path on AVX512 vPMDdrivers/net/ice/ice_rxtx.c | 90 ++- drivers/net/ice/ice_rxtx.h | 11 + drivers/net/ice/ice_rxtx_vec_avx512.c | 1018 +++++++++++++++++++++++++ drivers/net/ice/ice_rxtx_vec_common.h | 36 +- drivers/net/ice/meson.build | 11 + 5 files changed, 1141 insertions(+), 25 deletions(-) create mode 100644
Quoted 4 lines
drivers/net/ice/ice_rxtx_vec_avx512.c--
2.17.1
Applied to dpdk-next-net-intel.
Thanks
Qi