Skip to contentSkip to conversation

net/iavf: fix performance drop

PATCH Applied Wenzhuo Lu 3 participants 12 messages Apr 26, 2021 – Apr 29, 2021 Network drivers

lore
Share & tools
lore

Wenzhuo Lu

author
#0 lore raw

PATCH 1/1 net/iavf: fix performance drop

AVX2 and SSE don't have the offload path.
Not necessary doing any check. Or the scalar path
will be chosen.

Fixes eff56a7b9f97 ("net/iavf: add offload path for Rx AVX512")
---
 drivers/net/iavf/iavf_rxtx.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/iavf/iavf_rxtx.c +5 -7
index 3f3cf63..0ba19dbf 100644
@@ -2401,13 +2401,11 @@
 	check_ret = iavf_rx_vec_dev_check(dev);
 	if (check_ret >= 0 &&
 	    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-		if (check_ret == IAVF_VECTOR_PATH) {
-			use_sse = true;
-			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)
-				use_avx2 = true;
-		}
+		use_sse = true;
+		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)
+			use_avx2 = true;
 
 #ifdef CC_AVX512_SUPPORT
 		if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
Signature · 1 line
1.9.3
#1 lore raw
Quoted 34 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Wenzhuo Lu
Sent: Monday, April 26, 2021 1:30 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>
Subject: [dpdk-dev] [PATCH] net/iavf: fix performance drop

AVX2 and SSE don't have the offload path.
Not necessary doing any check. Or the scalar path will be chosen.

Fixes eff56a7b9f97 ("net/iavf: add offload path for Rx AVX512")
---
 drivers/net/iavf/iavf_rxtx.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/iavf/iavf_rxtx.c index renamed from drivers/net/iavf/iavf_rxtx.c +0 -0

3f3cf63..0ba19dbf 100644

drivers/net/iavf/iavf_rxtx.c +0 -4
@@ -2401,13 +2401,11 @@
 	check_ret = iavf_rx_vec_dev_check(dev);
 	if (check_ret >= 0 &&
 	    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-		if (check_ret == IAVF_VECTOR_PATH) {
-			use_sse = true;
-			if ((rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1 ||
-			     rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1)

&&

drivers/net/iavf/iavf_rxtx.c +0 -1
-			    rte_vect_get_max_simd_bitwidth() >=

RTE_VECT_SIMD_256)

drivers/net/iavf/iavf_rxtx.c line 2408

Quoted 7 lines
drivers/net/iavf/iavf_rxtx.c +5 -2
-				use_avx2 = true;
-		}
+		use_sse = true;
+		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)
+			use_avx2 = true;

Not sure if the right path will be selected when avx512 is not true, (CC_AVX512_SUPPORT is disable) while check_ret is IAVF_VECTOR_OFFLOAD_PATH?

Currently we have

if (!use_sse && !use_avx2 && !use_avx512)

	goto normal;

Should we also add below check?

if (!use_avx512 && check_ret == IAVF_VECTOR_OFFLOAD_PATH)
goto normal;

Quoted 5 lines

#ifdef CC_AVX512_SUPPORT
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
--
1.9.3

#2 lore raw
Quoted 11 lines

drivers/net/iavf/iavf_rxtx.c line 2408

Quoted 5 lines
drivers/net/iavf/iavf_rxtx.c +5 -0
+use_sse = true;
+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)
+use_avx2 = true;

Not sure if the right path will be selected when avx512 is not true, (CC_AVX512_SUPPORT is disable) while check_ret is IAVF_VECTOR_OFFLOAD_PATH?

Quoted 8 lines

Currently we have

if (!use_sse && !use_avx2 && !use_avx512) goto normal;

Should we also add below check?

if (!use_avx512 && check_ret == IAVF_VECTOR_OFFLOAD_PATH)
goto normal;

Not necessary. As explained in the commit log, AVX2 and SSE support the offload features. The purpose of this patch is to let AVX2 be chosen when offload needed and AVX512 disable.

#3 lore raw
Quoted 23 lines

-----Original Message-----
From: Lu, Wenzhuo <[email protected]>
Sent: 2021年4月27日 9:51
To: Zhang, Qi Z <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH] net/iavf: fix performance drop

Quoted 15 lines

drivers/net/iavf/iavf_rxtx.c line 2408

Quoted 5 lines
drivers/net/iavf/iavf_rxtx.c +5 -0
+use_sse = true;
+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)
+use_avx2 = true;

Not sure if the right path will be selected when avx512 is not true, (CC_AVX512_SUPPORT is disable) while check_ret is IAVF_VECTOR_OFFLOAD_PATH?

Currently we have

if (!use_sse && !use_avx2 && !use_avx512) goto normal;

Quoted 7 lines
Quoted 4 lines

Should we also add below check?

if (!use_avx512 && check_ret == IAVF_VECTOR_OFFLOAD_PATH)
goto normal;

Not necessary. As explained in the commit log, AVX2 and SSE support the offload features. The purpose of this patch is to let AVX2 be chosen when offload needed and AVX512 disable.

OK, now I understand it, I will suggest to change the commit log.

From
AVX2 and SSE don't have the offload path.

To
AVX2 and SSE Tx path already support offloads but can't selected.

If you agree, will apply above during change during patch merge.

#4 lore raw
Quoted 25 lines
Quoted 15 lines
Quoted 15 lines

drivers/net/iavf/iavf_rxtx.c line 2408

Quoted 5 lines
drivers/net/iavf/iavf_rxtx.c +5 -0
+use_sse = true;
+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)
+use_avx2 = true;

Not sure if the right path will be selected when avx512 is not true, (CC_AVX512_SUPPORT is disable) while check_ret is IAVF_VECTOR_OFFLOAD_PATH?

Currently we have

if (!use_sse && !use_avx2 && !use_avx512) goto normal;

Quoted 7 lines
Quoted 4 lines

Should we also add below check?

if (!use_avx512 && check_ret == IAVF_VECTOR_OFFLOAD_PATH)
goto normal;

Not necessary. As explained in the commit log, AVX2 and SSE support the offload features. The purpose of this patch is to let AVX2 be chosen when offload needed and AVX512 disable.

OK, now I understand it, I will suggest to change the commit log.

Quoted 7 lines

From
AVX2 and SSE don't have the offload path.

To
AVX2 and SSE Tx path already support offloads but can't selected.

If you agree, will apply above during change during patch merge.

Sure. Thanks for that.

#5 lore raw
In reply to Zhang, Qi Z
Quoted 31 lines · Qi Z
Quoted 23 lines

-----Original Message-----
From: Lu, Wenzhuo <[email protected]>
Sent: 2021年4月27日 9:51
To: Zhang, Qi Z <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH] net/iavf: fix performance drop

Quoted 15 lines

drivers/net/iavf/iavf_rxtx.c line 2408

Quoted 5 lines
drivers/net/iavf/iavf_rxtx.c +5 -0
+use_sse = true;
+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)
+use_avx2 = true;

Not sure if the right path will be selected when avx512 is not true, (CC_AVX512_SUPPORT is disable) while check_ret is IAVF_VECTOR_OFFLOAD_PATH?

Currently we have

if (!use_sse && !use_avx2 && !use_avx512) goto normal;

Quoted 7 lines
Quoted 4 lines

Should we also add below check?

if (!use_avx512 && check_ret == IAVF_VECTOR_OFFLOAD_PATH)
goto normal;

Not necessary. As explained in the commit log, AVX2 and SSE support the offload features. The purpose of this patch is to let AVX2 be chosen when offload needed and AVX512 disable.

Quoted 8 lines

OK, now I understand it, I will suggest to change the commit log.

From
AVX2 and SSE don't have the offload path.

To
AVX2 and SSE Tx path already support offloads but can't selected.

Isn't this related to the _Rx_ path?

Quoted 2 lines

If you agree, will apply above during change during patch merge.

#6 lore raw
Quoted 43 lines

-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Wednesday, April 28, 2021 7:32 PM
To: Zhang, Qi Z <[email protected]>; Lu, Wenzhuo <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH] net/iavf: fix performance drop

Quoted 33 lines · Qi Z
Quoted 23 lines

-----Original Message-----
From: Lu, Wenzhuo <[email protected]>
Sent: 2021年4月27日 9:51
To: Zhang, Qi Z <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH] net/iavf: fix performance drop

Quoted 15 lines

drivers/net/iavf/iavf_rxtx.c line 2408

Quoted 5 lines
drivers/net/iavf/iavf_rxtx.c +5 -0
+use_sse = true;
+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)
+use_avx2 = true;

Not sure if the right path will be selected when avx512 is not true, (CC_AVX512_SUPPORT is disable) while check_ret is IAVF_VECTOR_OFFLOAD_PATH?

Currently we have

if (!use_sse && !use_avx2 && !use_avx512) goto normal;

Quoted 7 lines
Quoted 4 lines

Should we also add below check?

if (!use_avx512 && check_ret == IAVF_VECTOR_OFFLOAD_PATH)
goto normal;

Not necessary. As explained in the commit log, AVX2 and SSE support the offload features. The purpose of this patch is to let AVX2 be chosen when offload needed and AVX512 disable.

OK, now I understand it, I will suggest to change the commit log.

Quoted 8 lines
Quoted 6 lines

From
AVX2 and SSE don't have the offload path.

To
AVX2 and SSE Tx path already support offloads but can't selected.

Isn't this related to the _Rx_ path?

Yes, it should be Rx Path.

Quoted 3 lines
Quoted 3 lines

If you agree, will apply above during change during patch merge.

Acked-by on v1 1/1 Applied
#7 lore raw
In reply to Wenzhuo Lu
Quoted 11 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Wenzhuo Lu
Sent: Monday, April 26, 2021 1:30 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>
Subject: [dpdk-dev] [PATCH] net/iavf: fix performance drop

AVX2 and SSE don't have the offload path.
Not necessary doing any check. Or the scalar path will be chosen.

AVX2 and SSE Tx path already support offloads but can't be selected. The patch remove the unnecessary check or the scalar path will always be chosen.

Quoted 4 lines
Fixes eff56a7b9f97 ("net/iavf: add offload path for Rx AVX512")

Applied to dpdk-next-net-intel after refined commit log.

Thanks
Qi

#8 lore raw
In reply to Wenzhuo Lu
Quoted 3 lines · Wenzhuo Lu

AVX2 and SSE don't have the offload path.
Not necessary doing any check. Or the scalar path
will be chosen.

Hi Wenzhuo,

The fix by not changing Rx implementation, but making sure correct Rx path selected, right? Can you please clarify this in the commit log?

So the performance drop fixed for whoever have the vector path supported and offloads enabled, can be good to highlight in the patch title, otherwise it is too generic.

Quoted 3 lines
Fixes eff56a7b9f97 ("net/iavf: add offload path for Rx AVX512")

I am not clear what caused the performance drop.
Before above patch, vector path was not supporting the offloads and scalar path should be selected. After above patch, still scalar path selected, although vector path supports offloads, but for both before and after scalar path is selected, so why/when the performance drop happens?
Can you please clarify in the commit log, how to reproduce performance drop?

Quoted 29 lines
---
 drivers/net/iavf/iavf_rxtx.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/iavf/iavf_rxtx.c +5 -7
index 3f3cf63..0ba19dbf 100644
@@ -2401,13 +2401,11 @@
 	check_ret = iavf_rx_vec_dev_check(dev);
 	if (check_ret >= 0 &&
 	    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-		if (check_ret == IAVF_VECTOR_PATH) {
-			use_sse = true;
-			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)
-				use_avx2 = true;
-		}
+		use_sse = true;
+		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)
+			use_avx2 = true;
 
 #ifdef CC_AVX512_SUPPORT
 		if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
#9 lore raw
Quoted 6 lines

The fix by not changing Rx implementation, but making sure correct Rx path selected, right? Can you please clarify this in the commit log?

So the performance drop fixed for whoever have the vector path supported and offloads enabled, can be good to highlight in the patch title, otherwise it is too generic.

Yes, the implementation is not changed. It's only about the path selection. I'll clarify it.

Quoted 11 lines
Quoted 4 lines
Fixes eff56a7b9f97 ("net/iavf: add offload path for Rx AVX512")

I am not clear what caused the performance drop.
Before above patch, vector path was not supporting the offloads and scalar path should be selected. After above patch, still scalar path selected, although vector path supports offloads, but for both before and after scalar path is selected, so why/when the performance drop happens?
Can you please clarify in the commit log, how to reproduce performance drop?

Sure. I'll describe more about what's the issue.

author
#10 lore raw

PATCH 1/1 net/iavf: fix performance drop

In reply to Wenzhuo Lu

The performance drop is caused by that the RX scalar path is selected when AVX512 is disabled and some HW offload is enabled.
Actaully, the HW offload is supported by AVX2 and SSE. In this scenario AVX2 path should be chosen.

This patch removes the offload related check for SSE and AVX2 as SSE and AVX2 do support the offload features.
No implement change about the data path.

Fixes eff56a7b9f97 ("net/iavf: add offload path for Rx AVX512")
---
 drivers/net/iavf/iavf_rxtx.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/iavf/iavf_rxtx.c +5 -7
index 3f3cf63..0ba19dbf 100644
@@ -2401,13 +2401,11 @@
 	check_ret = iavf_rx_vec_dev_check(dev);
 	if (check_ret >= 0 &&
 	    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-		if (check_ret == IAVF_VECTOR_PATH) {
-			use_sse = true;
-			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)
-				use_avx2 = true;
-		}
+		use_sse = true;
+		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)
+			use_avx2 = true;
 
 #ifdef CC_AVX512_SUPPORT
 		if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
Signature · 1 line
1.9.3
Acked-by on v1 1/1 Applied
#11 lore raw
Quoted 51 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Wenzhuo Lu
Sent: Thursday, April 29, 2021 9:34 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>
Subject: [dpdk-dev] [PATCH] net/iavf: fix performance drop

The performance drop is caused by that the RX scalar path is selected when AVX512 is disabled and some HW offload is enabled.
Actaully, the HW offload is supported by AVX2 and SSE.
In this scenario AVX2 path should be chosen.

This patch removes the offload related check for SSE and AVX2 as SSE and AVX2 do support the offload features.
No implement change about the data path.

Fixes eff56a7b9f97 ("net/iavf: add offload path for Rx AVX512")
---
 drivers/net/iavf/iavf_rxtx.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/iavf/iavf_rxtx.c index renamed from drivers/net/iavf/iavf_rxtx.c +0 -0

3f3cf63..0ba19dbf 100644

drivers/net/iavf/iavf_rxtx.c +0 -4
@@ -2401,13 +2401,11 @@
 	check_ret = iavf_rx_vec_dev_check(dev);
 	if (check_ret >= 0 &&
 	    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-		if (check_ret == IAVF_VECTOR_PATH) {
-			use_sse = true;
-			if ((rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1 ||
-			     rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1)

&&

drivers/net/iavf/iavf_rxtx.c +0 -1
-			    rte_vect_get_max_simd_bitwidth() >=

RTE_VECT_SIMD_256)

drivers/net/iavf/iavf_rxtx.c +5 -3
-				use_avx2 = true;
-		}
+		use_sse = true;
+		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)
+			use_avx2 = true;
 
 #ifdef CC_AVX512_SUPPORT
 		if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
--
Quoted 1 line

1.9.3

Applied to dpdk-next-net-intel.

Thanks
Qi