DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/hns3: fix compile error with gcc8.3 and crossfile thunderx2
@ 2021-05-19 11:47 Chengwen Feng
  2021-05-19 11:54 ` [dpdk-dev] [PATCH v2] net/hns3: fix compile error with gcc8.3 and thunderx2 Chengwen Feng
  0 siblings, 1 reply; 7+ messages in thread
From: Chengwen Feng @ 2021-05-19 11:47 UTC (permalink / raw)
  To: thomas, ferruh.yigit, david.marchand
  Cc: dev, Honnappa.Nagarahalli, jerinj, jerinjacobk, Ruifeng.Wang,
	viktorin, bruce.richardson, juraj.linkes, nd

Compile error with gcc8.3 and crossfile arm64_thunderx2_linux_gcc:
	../drivers/net/hns3/hns3_rxtx_vec_sve.c
	cc1: error: switch ‘-mcpu=armv8.1-a’ conflicts with
	‘-march=armv8.2-a’ switch [-Werror]
	../drivers/net/hns3/hns3_rxtx_vec_sve.c:5:10: fatal error:
	arm_sve.h: No such file or directory
	    5 | #include <arm_sve.h>

The root cause is that gcc8.3 supports SVE, but it doesn't support
compile ACLE[1] SVE code, and the hns3_rxtx_vec_sve.c was written
by ACLE SVE code.

This patch also filters out '-march=' '-mcpu' '-mtune' when compile
with hns3_rxtx_vec_sve.c.

[1] ACLE: Arm C Language Extensions, user should include <arm_sve.h>
when writting ACLE SVE code.

Fixes: 203fbaf8813d ("net/hns3: refactor SVE code compile method")
---
 drivers/net/hns3/meson.build | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build
index 8563d70..5f9af9b 100644
--- a/drivers/net/hns3/meson.build
+++ b/drivers/net/hns3/meson.build
@@ -39,16 +39,22 @@ if arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64')
     # compile SVE when:
     # a. support SVE in minimum instruction set baseline
     # b. it's not minimum instruction set, but compiler support
-    if cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != ''
+    if cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != '' and cc.check_header('arm_sve.h')
         cflags += ['-DCC_SVE_SUPPORT']
         sources += files('hns3_rxtx_vec_sve.c')
-    elif cc.has_argument('-march=armv8.2-a+sve')
-        cflags += ['-DCC_SVE_SUPPORT']
+    elif cc.has_argument('-march=armv8.2-a+sve') and cc.check_header('arm_sve.h')
+        sve_cflags = ['-DCC_SVE_SUPPORT']
+        foreach flag: cflags
+            # filterout -march -mcpu -mtune
+            if not (flag.startswith('-march=') or flag.startswith('-mcpu=') or flag.startswith('-mtune='))
+                sve_cflags += flag
+            endif
+        endforeach
         hns3_sve_lib = static_library('hns3_sve_lib',
                         'hns3_rxtx_vec_sve.c',
                         dependencies: [static_rte_ethdev],
                         include_directories: includes,
-                        c_args: [cflags, '-march=armv8.2-a+sve'])
+                        c_args: [sve_cflags, '-march=armv8.2-a+sve'])
         objs += hns3_sve_lib.extract_objects('hns3_rxtx_vec_sve.c')
     endif
 endif
-- 
2.8.1


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

* [dpdk-dev] [PATCH v2] net/hns3: fix compile error with gcc8.3 and thunderx2
  2021-05-19 11:47 [dpdk-dev] [PATCH] net/hns3: fix compile error with gcc8.3 and crossfile thunderx2 Chengwen Feng
@ 2021-05-19 11:54 ` Chengwen Feng
  2021-05-19 12:30   ` Ferruh Yigit
  2021-05-19 12:34   ` David Marchand
  0 siblings, 2 replies; 7+ messages in thread
From: Chengwen Feng @ 2021-05-19 11:54 UTC (permalink / raw)
  To: thomas, ferruh.yigit, david.marchand
  Cc: dev, Honnappa.Nagarahalli, jerinj, jerinjacobk, Ruifeng.Wang,
	viktorin, bruce.richardson, juraj.linkes, nd

Compile error with gcc8.3 and crossfile arm64_thunderx2_linux_gcc:
	../drivers/net/hns3/hns3_rxtx_vec_sve.c
	cc1: error: switch ‘-mcpu=armv8.1-a’ conflicts with
	‘-march=armv8.2-a’ switch [-Werror]
	../drivers/net/hns3/hns3_rxtx_vec_sve.c:5:10: fatal error:
	arm_sve.h: No such file or directory
	    5 | #include <arm_sve.h>

The root cause is that gcc8.3 supports SVE, but it doesn't support
compile ACLE[1] SVE code, and the hns3_rxtx_vec_sve.c was written
by ACLE SVE code.

This patch also filters out '-march=' '-mcpu' '-mtune' when compile
with hns3_rxtx_vec_sve.c.

[1] ACLE: Arm C Language Extensions, user should include <arm_sve.h>
when writing ACLE SVE code.

Fixes: 203fbaf8813d ("net/hns3: refactor SVE code compile method")

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
v2:
* fix check tool error
---
 drivers/net/hns3/meson.build | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build
index 8563d70..5f9af9b 100644
--- a/drivers/net/hns3/meson.build
+++ b/drivers/net/hns3/meson.build
@@ -39,16 +39,22 @@ if arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64')
     # compile SVE when:
     # a. support SVE in minimum instruction set baseline
     # b. it's not minimum instruction set, but compiler support
-    if cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != ''
+    if cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != '' and cc.check_header('arm_sve.h')
         cflags += ['-DCC_SVE_SUPPORT']
         sources += files('hns3_rxtx_vec_sve.c')
-    elif cc.has_argument('-march=armv8.2-a+sve')
-        cflags += ['-DCC_SVE_SUPPORT']
+    elif cc.has_argument('-march=armv8.2-a+sve') and cc.check_header('arm_sve.h')
+        sve_cflags = ['-DCC_SVE_SUPPORT']
+        foreach flag: cflags
+            # filterout -march -mcpu -mtune
+            if not (flag.startswith('-march=') or flag.startswith('-mcpu=') or flag.startswith('-mtune='))
+                sve_cflags += flag
+            endif
+        endforeach
         hns3_sve_lib = static_library('hns3_sve_lib',
                         'hns3_rxtx_vec_sve.c',
                         dependencies: [static_rte_ethdev],
                         include_directories: includes,
-                        c_args: [cflags, '-march=armv8.2-a+sve'])
+                        c_args: [sve_cflags, '-march=armv8.2-a+sve'])
         objs += hns3_sve_lib.extract_objects('hns3_rxtx_vec_sve.c')
     endif
 endif
-- 
2.8.1


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

* Re: [dpdk-dev] [PATCH v2] net/hns3: fix compile error with gcc8.3 and thunderx2
  2021-05-19 11:54 ` [dpdk-dev] [PATCH v2] net/hns3: fix compile error with gcc8.3 and thunderx2 Chengwen Feng
@ 2021-05-19 12:30   ` Ferruh Yigit
  2021-05-19 12:42     ` David Marchand
  2021-05-19 13:30     ` fengchengwen
  2021-05-19 12:34   ` David Marchand
  1 sibling, 2 replies; 7+ messages in thread
From: Ferruh Yigit @ 2021-05-19 12:30 UTC (permalink / raw)
  To: Chengwen Feng, thomas, david.marchand
  Cc: dev, Honnappa.Nagarahalli, jerinj, jerinjacobk, Ruifeng.Wang,
	viktorin, bruce.richardson, juraj.linkes, nd

On 5/19/2021 12:54 PM, Chengwen Feng wrote:
> Compile error with gcc8.3 and crossfile arm64_thunderx2_linux_gcc:
> 	../drivers/net/hns3/hns3_rxtx_vec_sve.c
> 	cc1: error: switch ‘-mcpu=armv8.1-a’ conflicts with
> 	‘-march=armv8.2-a’ switch [-Werror]
> 	../drivers/net/hns3/hns3_rxtx_vec_sve.c:5:10: fatal error:
> 	arm_sve.h: No such file or directory
> 	    5 | #include <arm_sve.h>
> 
> The root cause is that gcc8.3 supports SVE, but it doesn't support
> compile ACLE[1] SVE code, and the hns3_rxtx_vec_sve.c was written
> by ACLE SVE code.
> 
> This patch also filters out '-march=' '-mcpu' '-mtune' when compile
> with hns3_rxtx_vec_sve.c.
> 
> [1] ACLE: Arm C Language Extensions, user should include <arm_sve.h>
> when writing ACLE SVE code.
> 
> Fixes: 203fbaf8813d ("net/hns3: refactor SVE code compile method")
> 
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>

Hi Chengwen,

We need CI result to proceed with the patch, since I don't have arm platfrom to
test this properly.

But in the CI applying patch fails, I guess that is because the original patch
has been dropped in the next-net.

Can you please send a new version of the patch rebased on top of latest next-net?

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

* Re: [dpdk-dev] [PATCH v2] net/hns3: fix compile error with gcc8.3 and thunderx2
  2021-05-19 11:54 ` [dpdk-dev] [PATCH v2] net/hns3: fix compile error with gcc8.3 and thunderx2 Chengwen Feng
  2021-05-19 12:30   ` Ferruh Yigit
@ 2021-05-19 12:34   ` David Marchand
  2021-05-19 13:40     ` fengchengwen
  1 sibling, 1 reply; 7+ messages in thread
From: David Marchand @ 2021-05-19 12:34 UTC (permalink / raw)
  To: Chengwen Feng, Honnappa Nagarahalli, Ruifeng Wang (Arm Technology China)
  Cc: Thomas Monjalon, Yigit, Ferruh, dev, Jerin Jacob Kollanukkaran,
	Jerin Jacob, Jan Viktorin, Bruce Richardson, Juraj Linkeš,
	nd

On Wed, May 19, 2021 at 1:57 PM Chengwen Feng <fengchengwen@huawei.com> wrote:
>
> Compile error with gcc8.3 and crossfile arm64_thunderx2_linux_gcc:
>         ../drivers/net/hns3/hns3_rxtx_vec_sve.c
>         cc1: error: switch ‘-mcpu=armv8.1-a’ conflicts with
>         ‘-march=armv8.2-a’ switch [-Werror]
>         ../drivers/net/hns3/hns3_rxtx_vec_sve.c:5:10: fatal error:
>         arm_sve.h: No such file or directory
>             5 | #include <arm_sve.h>
>
> The root cause is that gcc8.3 supports SVE, but it doesn't support
> compile ACLE[1] SVE code, and the hns3_rxtx_vec_sve.c was written
> by ACLE SVE code.

Quite confusing.
What is the difference between the two?


>
> This patch also filters out '-march=' '-mcpu' '-mtune' when compile
> with hns3_rxtx_vec_sve.c.
>
> [1] ACLE: Arm C Language Extensions, user should include <arm_sve.h>
> when writing ACLE SVE code.
>
> Fixes: 203fbaf8813d ("net/hns3: refactor SVE code compile method")
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> ---
> v2:
> * fix check tool error
> ---
>  drivers/net/hns3/meson.build | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build
> index 8563d70..5f9af9b 100644
> --- a/drivers/net/hns3/meson.build
> +++ b/drivers/net/hns3/meson.build
> @@ -39,16 +39,22 @@ if arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64')
>      # compile SVE when:
>      # a. support SVE in minimum instruction set baseline
>      # b. it's not minimum instruction set, but compiler support
> -    if cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != ''
> +    if cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != '' and cc.check_header('arm_sve.h')

The rte_vect.h arm header unconditionally includes arm_sve.h if
__ARM_FEATURE_SVE is defined [1].
So it is surprising to see such a check being added.

1: https://git.dpdk.org/dpdk/tree/lib/eal/arm/include/rte_vect.h#n12


-- 
David Marchand


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

* Re: [dpdk-dev] [PATCH v2] net/hns3: fix compile error with gcc8.3 and thunderx2
  2021-05-19 12:30   ` Ferruh Yigit
@ 2021-05-19 12:42     ` David Marchand
  2021-05-19 13:30     ` fengchengwen
  1 sibling, 0 replies; 7+ messages in thread
From: David Marchand @ 2021-05-19 12:42 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Chengwen Feng, Thomas Monjalon, dev, Honnappa Nagarahalli,
	Jerin Jacob Kollanukkaran, Jerin Jacob,
	Ruifeng Wang (Arm Technology China),
	Jan Viktorin, Bruce Richardson, Juraj Linkeš,
	nd

On Wed, May 19, 2021 at 2:30 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> On 5/19/2021 12:54 PM, Chengwen Feng wrote:
> > Compile error with gcc8.3 and crossfile arm64_thunderx2_linux_gcc:
> >       ../drivers/net/hns3/hns3_rxtx_vec_sve.c
> >       cc1: error: switch ‘-mcpu=armv8.1-a’ conflicts with
> >       ‘-march=armv8.2-a’ switch [-Werror]
> >       ../drivers/net/hns3/hns3_rxtx_vec_sve.c:5:10: fatal error:
> >       arm_sve.h: No such file or directory
> >           5 | #include <arm_sve.h>
> >
> > The root cause is that gcc8.3 supports SVE, but it doesn't support
> > compile ACLE[1] SVE code, and the hns3_rxtx_vec_sve.c was written
> > by ACLE SVE code.
> >
> > This patch also filters out '-march=' '-mcpu' '-mtune' when compile
> > with hns3_rxtx_vec_sve.c.
> >
> > [1] ACLE: Arm C Language Extensions, user should include <arm_sve.h>
> > when writing ACLE SVE code.
> >
> > Fixes: 203fbaf8813d ("net/hns3: refactor SVE code compile method")
> >
> > Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>
> Hi Chengwen,
>
> We need CI result to proceed with the patch, since I don't have arm platfrom to
> test this properly.
>
> But in the CI applying patch fails, I guess that is because the original patch
> has been dropped in the next-net.
>
> Can you please send a new version of the patch rebased on top of latest next-net?

We are almost done for 21.05.
Is this issue a blocker?


-- 
David Marchand


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

* Re: [dpdk-dev] [PATCH v2] net/hns3: fix compile error with gcc8.3 and thunderx2
  2021-05-19 12:30   ` Ferruh Yigit
  2021-05-19 12:42     ` David Marchand
@ 2021-05-19 13:30     ` fengchengwen
  1 sibling, 0 replies; 7+ messages in thread
From: fengchengwen @ 2021-05-19 13:30 UTC (permalink / raw)
  To: Ferruh Yigit, thomas, david.marchand
  Cc: dev, Honnappa.Nagarahalli, jerinj, jerinjacobk, Ruifeng.Wang,
	viktorin, bruce.richardson, juraj.linkes, nd

Thanks a lot, Ferruh
Already rebase and send v6, please review 2/2 patch.


On 2021/5/19 20:30, Ferruh Yigit wrote:
> On 5/19/2021 12:54 PM, Chengwen Feng wrote:
>> Compile error with gcc8.3 and crossfile arm64_thunderx2_linux_gcc:
>> 	../drivers/net/hns3/hns3_rxtx_vec_sve.c
>> 	cc1: error: switch ‘-mcpu=armv8.1-a’ conflicts with
>> 	‘-march=armv8.2-a’ switch [-Werror]
>> 	../drivers/net/hns3/hns3_rxtx_vec_sve.c:5:10: fatal error:
>> 	arm_sve.h: No such file or directory
>> 	    5 | #include <arm_sve.h>
>>
>> The root cause is that gcc8.3 supports SVE, but it doesn't support
>> compile ACLE[1] SVE code, and the hns3_rxtx_vec_sve.c was written
>> by ACLE SVE code.
>>
>> This patch also filters out '-march=' '-mcpu' '-mtune' when compile
>> with hns3_rxtx_vec_sve.c.
>>
>> [1] ACLE: Arm C Language Extensions, user should include <arm_sve.h>
>> when writing ACLE SVE code.
>>
>> Fixes: 203fbaf8813d ("net/hns3: refactor SVE code compile method")
>>
>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> 
> Hi Chengwen,
> 
> We need CI result to proceed with the patch, since I don't have arm platfrom to
> test this properly.
> 
> But in the CI applying patch fails, I guess that is because the original patch
> has been dropped in the next-net.
> 
> Can you please send a new version of the patch rebased on top of latest next-net?
> 
> .
> 


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

* Re: [dpdk-dev] [PATCH v2] net/hns3: fix compile error with gcc8.3 and thunderx2
  2021-05-19 12:34   ` David Marchand
@ 2021-05-19 13:40     ` fengchengwen
  0 siblings, 0 replies; 7+ messages in thread
From: fengchengwen @ 2021-05-19 13:40 UTC (permalink / raw)
  To: David Marchand, Honnappa Nagarahalli,
	Ruifeng Wang (Arm Technology China)
  Cc: Thomas Monjalon, Yigit, Ferruh, dev, Jerin Jacob Kollanukkaran,
	Jerin Jacob, Jan Viktorin, Bruce Richardson, Juraj Linkeš,
	nd



On 2021/5/19 20:34, David Marchand wrote:
> On Wed, May 19, 2021 at 1:57 PM Chengwen Feng <fengchengwen@huawei.com> wrote:
>>
>> Compile error with gcc8.3 and crossfile arm64_thunderx2_linux_gcc:
>>         ../drivers/net/hns3/hns3_rxtx_vec_sve.c
>>         cc1: error: switch ‘-mcpu=armv8.1-a’ conflicts with
>>         ‘-march=armv8.2-a’ switch [-Werror]
>>         ../drivers/net/hns3/hns3_rxtx_vec_sve.c:5:10: fatal error:
>>         arm_sve.h: No such file or directory
>>             5 | #include <arm_sve.h>
>>
>> The root cause is that gcc8.3 supports SVE, but it doesn't support
>> compile ACLE[1] SVE code, and the hns3_rxtx_vec_sve.c was written
>> by ACLE SVE code.
> 
> Quite confusing.
> What is the difference between the two?
> 

Only SVE assembly instructions are supported in gcc8/9

And the ACLE SVE code like normal C code.
There are also ACLE NEON code which many driver already supports.

> 
>>
>> This patch also filters out '-march=' '-mcpu' '-mtune' when compile
>> with hns3_rxtx_vec_sve.c.
>>
>> [1] ACLE: Arm C Language Extensions, user should include <arm_sve.h>
>> when writing ACLE SVE code.
>>
>> Fixes: 203fbaf8813d ("net/hns3: refactor SVE code compile method")
>>
>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>> ---
>> v2:
>> * fix check tool error
>> ---
>>  drivers/net/hns3/meson.build | 14 ++++++++++----
>>  1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build
>> index 8563d70..5f9af9b 100644
>> --- a/drivers/net/hns3/meson.build
>> +++ b/drivers/net/hns3/meson.build
>> @@ -39,16 +39,22 @@ if arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64')
>>      # compile SVE when:
>>      # a. support SVE in minimum instruction set baseline
>>      # b. it's not minimum instruction set, but compiler support
>> -    if cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != ''
>> +    if cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != '' and cc.check_header('arm_sve.h')
> 
> The rte_vect.h arm header unconditionally includes arm_sve.h if
> __ARM_FEATURE_SVE is defined [1].
> So it is surprising to see such a check being added.
> 
> 1: https://git.dpdk.org/dpdk/tree/lib/eal/arm/include/rte_vect.h#n12
> 

Yes, it is, I will fix in 21.08

> 


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

end of thread, other threads:[~2021-05-19 13:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 11:47 [dpdk-dev] [PATCH] net/hns3: fix compile error with gcc8.3 and crossfile thunderx2 Chengwen Feng
2021-05-19 11:54 ` [dpdk-dev] [PATCH v2] net/hns3: fix compile error with gcc8.3 and thunderx2 Chengwen Feng
2021-05-19 12:30   ` Ferruh Yigit
2021-05-19 12:42     ` David Marchand
2021-05-19 13:30     ` fengchengwen
2021-05-19 12:34   ` David Marchand
2021-05-19 13:40     ` fengchengwen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).