Skip to contentSkip to conversation

fix build error on lower version GCC

PATCH Superseded Leyi Rong 4 participants 15 messages Nov 3, 2020

Subsystems (2)
lore
Share & tools
lore

Leyi Rong

author
#0 lore raw

cover fix build error on lower version GCC

These two patches fix the build error when -march=skylake-avx512 is not supported on lower version GCC in both ice and iavf PMD.

Leyi Rong (2):
net/ice: fix build error on lower version GCC
net/iavf: fix build error on lower version GCC

 drivers/net/iavf/meson.build | 21 +++++++++++++++------
 drivers/net/ice/meson.build  | 21 +++++++++++++++------
 2 files changed, 30 insertions(+), 12 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/2 net/ice: fix build error on lower version GCC

Fix the build error when -march=skylake-avx512 is not supported on lower version GCC.

Fixes ef5d52dae5e2 ("net/ice: add AVX512 vector path")
---
 drivers/net/ice/meson.build | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/net/ice/meson.build +15 -6
index 7d54a49236..ec8933aa1a 100644
@@ -46,12 +46,21 @@ if arch_subdir == 'x86'
 
 	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', '-mavx512bw'])
+		if cc.has_argument('-march=skylake-avx512')
+			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', '-mavx512bw'])
+		else
+			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, '-mavx512f', '-mavx512bw'])
+		endif
 		objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c')
 	endif
 endif
Signature · 1 line
2.17.1
#2 lore raw

Re: [dpdk-dev] [PATCH 1/2] net/ice: fix build error on lower version GCC

Quoted 29 lines · Leyi Rong

Fix the build error when -march=skylake-avx512 is not supported on lower version GCC.

Fixes ef5d52dae5e2 ("net/ice: add AVX512 vector path")
---
 drivers/net/ice/meson.build | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/net/ice/meson.build +5 -6
index 7d54a49236..ec8933aa1a 100644
@@ -46,12 +46,21 @@ if arch_subdir == 'x86'
 
 	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', '-mavx512bw'])
+		if cc.has_argument('-march=skylake-avx512')
+			ice_avx512_lib = static_library('ice_avx512_lib',
+					      'ice_rxtx_vec_avx512.c',
+					      dependencies: [static_rte_ethdev,
+						static_rte_kvargs, static_rte_hash],

drivers/net/ice/meson.build if arch_subdir == 'x86' · line 63

Quoted 10 lines
drivers/net/ice/meson.build +10 -0
+					      include_directories: includes,
+					      c_args: [cflags, '-march=skylake-avx512', '-mavx512f', '-mavx512bw'])
+		else
+			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, '-mavx512f', '-mavx512bw'])
+		endif

Rather than duplicating the whole static_library call, you can just do:

	avx512_cflags = [cflags, '-mavx512f', '-mavx512bw']
	if cc.has_argument('-march=skylake-avx512')
		avx512_cflags += '-march=skylake-avx512'
	endif

and then use avx512_cflags inside a single static_library call. Much shorter code.

/Bruce

Quoted 6 lines
drivers/net/ice/meson.build +0 -0
 		objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c')
 	endif
 endif
Signature · 1 line
2.17.1
author
#3 lore raw

Re: [dpdk-dev] [PATCH 1/2] net/ice: fix build error on lower version GCC

Quoted 56 lines

-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Tuesday, November 3, 2020 9:28 PM
To: Rong, Leyi <[email protected]>
Cc: Zhang, Qi Z <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/2] net/ice: fix build error on lower version GCC

Quoted 15 lines · Leyi Rong

Fix the build error when -march=skylake-avx512 is not supported on lower version GCC.

Fixes ef5d52dae5e2 ("net/ice: add AVX512 vector path")
---
 drivers/net/ice/meson.build | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/net/ice/meson.build +0 -0
index 7d54a49236..ec8933aa1a 100644

drivers/net/ice/meson.build if arch_subdir == 'x86' · line 54

Quoted 9 lines
drivers/net/ice/meson.build +0 -6
@@ -46,12 +46,21 @@ if arch_subdir == 'x86'
 
 	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', '-mavx512bw'])

drivers/net/ice/meson.build if arch_subdir == 'x86'

Quoted 5 lines
drivers/net/ice/meson.build +5 -0
+		if cc.has_argument('-march=skylake-avx512')
+			ice_avx512_lib = static_library('ice_avx512_lib',
+					      'ice_rxtx_vec_avx512.c',
+					      dependencies: [static_rte_ethdev,
+						static_rte_kvargs,

static_rte_hash],

drivers/net/ice/meson.build if arch_subdir == 'x86' · line 55

Quoted 2 lines
drivers/net/ice/meson.build +2 -0
+					      include_directories: includes,
+					      c_args: [cflags, '-march=skylake-

avx512', '-mavx512f', '-mavx512bw'])

drivers/net/ice/meson.build if arch_subdir == 'x86'

Quoted 5 lines
drivers/net/ice/meson.build +5 -0
+		else
+			ice_avx512_lib = static_library('ice_avx512_lib',
+					      'ice_rxtx_vec_avx512.c',
+					      dependencies: [static_rte_ethdev,
+						static_rte_kvargs,

static_rte_hash],

drivers/net/ice/meson.build if arch_subdir == 'x86' · line 62

Quoted 2 lines
drivers/net/ice/meson.build +2 -0
+					      include_directories: includes,
+					      c_args: [cflags, '-mavx512f', '-

mavx512bw'])

drivers/net/ice/meson.build if arch_subdir == 'x86' · line 63

Quoted 1 line
drivers/net/ice/meson.build +1 -0
+		endif

Rather than duplicating the whole static_library call, you can just do:

Quoted 9 lines
	avx512_cflags = [cflags, '-mavx512f', '-mavx512bw']
	if cc.has_argument('-march=skylake-avx512')
		avx512_cflags += '-march=skylake-avx512'
	endif

and then use avx512_cflags inside a single static_library call. Much shorter code.

/Bruce

Many thanks~
Fixed in v2 patches.

Leyi

Quoted 6 lines
Quoted 6 lines
drivers/net/ice/meson.build +0 -1
 		objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c')
 	endif
 endif
--

2.17.1

author
#4 lore raw

PATCH 2/2 net/iavf: fix build error on lower version GCC

In reply to Leyi Rong

Fix the build error when -march=skylake-avx512 is not supported on lower version GCC.

Fixes e0dcec9074c3 ("net/iavf: enable AVX512 for legacy Rx")
---
 drivers/net/iavf/meson.build | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/net/iavf/meson.build +15 -6
index e257f5a6e1..ee0a882126 100644
@@ -46,12 +46,21 @@ if arch_subdir == 'x86'
 
 	if iavf_avx512_cpu_support == true or iavf_avx512_cc_support == true
 		cflags += ['-DCC_AVX512_SUPPORT']
-		iavf_avx512_lib = static_library('iavf_avx512_lib',
-				'iavf_rxtx_vec_avx512.c',
-				dependencies: [static_rte_ethdev,
-					static_rte_kvargs, static_rte_hash],
-				include_directories: includes,
-				c_args: [cflags, '-mavx512f', '-mavx512bw', '-march=skylake-avx512'])
+		if cc.has_argument('-march=skylake-avx512')
+			iavf_avx512_lib = static_library('iavf_avx512_lib',
+					'iavf_rxtx_vec_avx512.c',
+					dependencies: [static_rte_ethdev,
+						static_rte_kvargs, static_rte_hash],
+					include_directories: includes,
+					c_args: [cflags, '-mavx512f', '-mavx512bw', '-march=skylake-avx512'])
+		else
+			iavf_avx512_lib = static_library('iavf_avx512_lib',
+					'iavf_rxtx_vec_avx512.c',
+					dependencies: [static_rte_ethdev,
+						static_rte_kvargs, static_rte_hash],
+					include_directories: includes,
+					c_args: [cflags, '-mavx512f', '-mavx512bw'])
+		endif
 		objs += iavf_avx512_lib.extract_objects('iavf_rxtx_vec_avx512.c')
 	endif
 endif
Signature · 1 line
2.17.1
author
#5 lore raw

v2 cover fix build error on lower version GCC

In reply to Leyi Rong

These two patches fix the build error when -march=skylake-avx512 is not supported on lower version GCC in both ice and iavf PMD.

---
v2:
- Simplify the judgement by extracting the avx512_args.

Leyi Rong (2):
net/ice: fix build error on lower version GCC
net/iavf: fix build error on lower version GCC

 drivers/net/iavf/meson.build |  8 ++++++--
 drivers/net/ice/meson.build  | 14 +++++++++-----
 2 files changed, 15 insertions(+), 7 deletions(-)
Signature · 1 line
2.17.1
author
#6 lore raw

PATCH v2 1/2 net/ice: fix build error on lower version GCC

Fix the build error when -march=skylake-avx512 is not supported on lower version GCC.

Fixes ef5d52dae5e2 ("net/ice: add AVX512 vector path")
---
 drivers/net/ice/meson.build | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/ice/meson.build +9 -5
index 7d54a49236..47d21678c2 100644
@@ -46,12 +46,16 @@ if arch_subdir == 'x86'
 
 	if ice_avx512_cpu_support == true or ice_avx512_cc_support == true
 		cflags += ['-DCC_AVX512_SUPPORT']
+		avx512_args = [cflags, '-mavx512f', '-mavx512bw']
+		if cc.has_argument('-march=skylake-avx512')
+			avx512_args += '-march=skylake-avx512'
+		endif
 		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', '-mavx512bw'])
+				'ice_rxtx_vec_avx512.c',
+				dependencies: [static_rte_ethdev,
+				static_rte_kvargs, static_rte_hash],
+				include_directories: includes,
+				c_args: avx512_args)
 		objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c')
 	endif
 endif
Signature · 1 line
2.17.1
#8 lore raw

Re: [dpdk-dev] [PATCH v2 1/2] net/ice: fix build error on lower version GCC

Quoted 10 lines · Bruce Richardson
Quoted 6 lines · Leyi Rong

Fix the build error when -march=skylake-avx512 is not supported on lower version GCC.

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

Squashed into relevant commit in next-net, thanks.

Indentation added to match 'ice' while merging.

#9 lore raw

Re: [dpdk-dev] [PATCH v2 1/2] net/ice: fix build error on lower version GCC

Quoted 7 lines · Ferruh Yigit
Quoted 6 lines · Bruce Richardson
Quoted 5 lines · Leyi Rong

Fix the build error when -march=skylake-avx512 is not supported on lower version GCC.

Fixes ef5d52dae5e2 ("net/ice: add AVX512 vector path")
Quoted 9 lines
Quoted 4 lines
Quoted 1 line

Squashed into relevant commit in next-net, thanks.

Indentation added to match 'ice' while merging.

Hi Ali,

Can you please test the build of next-net/main one more time?

Thanks,
ferruh

#10 lore raw

Re: [dpdk-dev] [PATCH v2 1/2] net/ice: fix build error on lower version GCC

Quoted 22 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, November 3, 2020 5:37 PM
To: Bruce Richardson <[email protected]>; Leyi Rong <[email protected]>; Ali Alnubani <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] net/ice: fix build error on lower version GCC

Quoted 12 lines · Ferruh Yigit
Quoted 10 lines · Bruce Richardson
Quoted 6 lines · Leyi Rong

Fix the build error when -march=skylake-avx512 is not supported on lower version GCC.

Fixes ef5d52dae5e2 ("net/ice: add AVX512 vector path")
Quoted 9 lines
Quoted 4 lines

Squashed into relevant commit in next-net, thanks.

Indentation added to match 'ice' while merging.

Hi Ali,

Can you please test the build of next-net/main one more time?

Build is passing on "5b5f87681 app/testpmd: fix max Rx packet length for VLAN packets".

Thanks,
Ali

#11 lore raw

Re: [dpdk-dev] [PATCH v2 1/2] net/ice: fix build error on lower version GCC

Quoted 27 lines · Ali Alnubani
Quoted 27 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, November 3, 2020 5:37 PM
To: Bruce Richardson <[email protected]>; Leyi Rong <[email protected]>; Ali Alnubani <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] net/ice: fix build error on lower version GCC

Quoted 16 lines · Ferruh Yigit
Quoted 10 lines · Bruce Richardson
Quoted 6 lines · Leyi Rong

Fix the build error when -march=skylake-avx512 is not supported on lower version GCC.

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

Squashed into relevant commit in next-net, thanks.

Indentation added to match 'ice' while merging.

Quoted 7 lines
Quoted 4 lines

Hi Ali,

Can you please test the build of next-net/main one more time?

Build is passing on "5b5f87681 app/testpmd: fix max Rx packet length for VLAN packets".

Thanks.

author
#12 lore raw

PATCH v2 2/2 net/iavf: fix build error on lower version GCC

In reply to Leyi Rong

Fix the build error when -march=skylake-avx512 is not supported on lower version GCC.

Fixes e0dcec9074c3 ("net/iavf: enable AVX512 for legacy Rx")
---
 drivers/net/iavf/meson.build | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/iavf/meson.build +6 -2
index e257f5a6e1..099b6a725d 100644
@@ -46,12 +46,16 @@ if arch_subdir == 'x86'
 
 	if iavf_avx512_cpu_support == true or iavf_avx512_cc_support == true
 		cflags += ['-DCC_AVX512_SUPPORT']
+		avx512_args = [cflags, '-mavx512f', '-mavx512bw']
+		if cc.has_argument('-march=skylake-avx512')
+			avx512_args += '-march=skylake-avx512'
+		endif
 		iavf_avx512_lib = static_library('iavf_avx512_lib',
 				'iavf_rxtx_vec_avx512.c',
 				dependencies: [static_rte_ethdev,
-					static_rte_kvargs, static_rte_hash],
+				static_rte_kvargs, static_rte_hash],
 				include_directories: includes,
-				c_args: [cflags, '-mavx512f', '-mavx512bw', '-march=skylake-avx512'])
+				c_args: avx512_args)
 		objs += iavf_avx512_lib.extract_objects('iavf_rxtx_vec_avx512.c')
 	endif
 endif
Signature · 1 line
2.17.1
Acked-by on v2 2/2
#13 lore raw

Re: [dpdk-dev] [PATCH v2 2/2] net/iavf: fix build error on lower version GCC

Quoted 17 lines · Leyi Rong

Fix the build error when -march=skylake-avx512 is not supported on lower version GCC.

Fixes e0dcec9074c3 ("net/iavf: enable AVX512 for legacy Rx")
---
 drivers/net/iavf/meson.build | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/iavf/meson.build +0 -0
index e257f5a6e1..099b6a725d 100644
@@ -46,12 +46,16 @@ if arch_subdir == 'x86'
 
 	if iavf_avx512_cpu_support == true or iavf_avx512_cc_support == true

drivers/net/iavf/meson.build if arch_subdir == 'x86' · line 56

Quoted 10 lines
drivers/net/iavf/meson.build +5 -1
 		cflags += ['-DCC_AVX512_SUPPORT']
+		avx512_args = [cflags, '-mavx512f', '-mavx512bw']
+		if cc.has_argument('-march=skylake-avx512')
+			avx512_args += '-march=skylake-avx512'
+		endif
 		iavf_avx512_lib = static_library('iavf_avx512_lib',
 				'iavf_rxtx_vec_avx512.c',
 				dependencies: [static_rte_ethdev,
-					static_rte_kvargs, static_rte_hash],
+				static_rte_kvargs, static_rte_hash],

This is an unnecesary whitespace change that can be dropped from the patch, and doesn't actually clean things up, since the extra indent is useful to show the continuation of the array.

drivers/net/iavf/meson.build if arch_subdir == 'x86' · line 61

Quoted 7 lines
drivers/net/iavf/meson.build +1 -1
 				include_directories: includes,
-				c_args: [cflags, '-mavx512f', '-mavx512bw', '-march=skylake-avx512'])
+				c_args: avx512_args)
 		objs += iavf_avx512_lib.extract_objects('iavf_rxtx_vec_avx512.c')
 	endif
 endif
#14 lore raw

Re: [dpdk-dev] [PATCH v2 2/2] net/iavf: fix build error on lower version GCC

Quoted 33 lines · Bruce Richardson
Quoted 17 lines · Leyi Rong

Fix the build error when -march=skylake-avx512 is not supported on lower version GCC.

Fixes e0dcec9074c3 ("net/iavf: enable AVX512 for legacy Rx")
---
  drivers/net/iavf/meson.build | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/iavf/meson.build +0 -0
index e257f5a6e1..099b6a725d 100644
@@ -46,12 +46,16 @@ if arch_subdir == 'x86'
 
  	if iavf_avx512_cpu_support == true or iavf_avx512_cc_support == true

drivers/net/iavf/meson.build if arch_subdir == 'x86' · line 56

Quoted 10 lines
drivers/net/iavf/meson.build +5 -1
  		cflags += ['-DCC_AVX512_SUPPORT']
+		avx512_args = [cflags, '-mavx512f', '-mavx512bw']
+		if cc.has_argument('-march=skylake-avx512')
+			avx512_args += '-march=skylake-avx512'
+		endif
  		iavf_avx512_lib = static_library('iavf_avx512_lib',
  				'iavf_rxtx_vec_avx512.c',
  				dependencies: [static_rte_ethdev,
-					static_rte_kvargs, static_rte_hash],
+				static_rte_kvargs, static_rte_hash],

This is an unnecesary whitespace change that can be dropped from the patch, and doesn't actually clean things up, since the extra indent is useful to show the continuation of the array.

Quoted 10 lines

drivers/net/iavf/meson.build if arch_subdir == 'x86' · line 61

Quoted 7 lines
drivers/net/iavf/meson.build +1 -1
  				include_directories: includes,
-				c_args: [cflags, '-mavx512f', '-mavx512bw', '-march=skylake-avx512'])
+				c_args: avx512_args)
  		objs += iavf_avx512_lib.extract_objects('iavf_rxtx_vec_avx512.c')
  	endif
  endif

Squashed into relevant commit in next-net, thanks.

Indentation change dropped while merging.