[v2] build: fix SVE compile error with gcc8.3

Message ID 1621510812-45405-1-git-send-email-fengchengwen@huawei.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] build: fix SVE compile error with gcc8.3 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/github-robot success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-testing fail Testing issues
ci/iol-mellanox-Performance fail Performance Testing issues
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-mellanox-Functional success Functional Testing PASS

Commit Message

Chengwen Feng May 20, 2021, 11:40 a.m. UTC
  If the target machine has SVE feature (e.g. "-march=armv8.2-a+sve'),
and the compiler is gcc8.3, it will compile error:
	In file included from ../dpdk-next-net/lib/eal/common/
	eal_common_options.c:38:
	../dpdk-next-net/lib/eal/arm/include/rte_vect.h:13:10: fatal
	error: arm_sve.h: No such file or directory
	#include <arm_sve.h>
	       ^~~~~~~~~~~
	compilation terminated.

The root cause is that gcc8.3 support SVE (the macro __ARM_FEATURE_SVE
was 1), but it doesn't support SVE ACLE [1].

The solution:
a) Detect compiler whether support SVE ACLE, if support then define
CC_SVE_ACLE_SUPPORT macro.
b) Use the CC_SVE_ACLE_SUPPORT macro to include SVE header file.

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

Fixes: 67b68824a82d ("lpm/arm: support SVE")

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
v2: 
* modify title start with 'build'

---
 config/arm/meson.build         | 5 +++++
 lib/eal/arm/include/rte_vect.h | 2 +-
 lib/lpm/rte_lpm.h              | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)
  

Comments

Bruce Richardson May 20, 2021, 1:09 p.m. UTC | #1
On Thu, May 20, 2021 at 07:40:12PM +0800, Chengwen Feng wrote:
> If the target machine has SVE feature (e.g. "-march=armv8.2-a+sve'),
> and the compiler is gcc8.3, it will compile error:
> 	In file included from ../dpdk-next-net/lib/eal/common/
> 	eal_common_options.c:38:
> 	../dpdk-next-net/lib/eal/arm/include/rte_vect.h:13:10: fatal
> 	error: arm_sve.h: No such file or directory
> 	#include <arm_sve.h>
> 	       ^~~~~~~~~~~
> 	compilation terminated.
> 
> The root cause is that gcc8.3 support SVE (the macro __ARM_FEATURE_SVE
> was 1), but it doesn't support SVE ACLE [1].
> 
> The solution:
> a) Detect compiler whether support SVE ACLE, if support then define
> CC_SVE_ACLE_SUPPORT macro.
> b) Use the CC_SVE_ACLE_SUPPORT macro to include SVE header file.
> 
> [1] ACLE:  Arm C Language Extensions, the SVE ACLE header file is
> <arm_sve.h>, user should include it when writing ACLE SVE code.
> 
> Fixes: 67b68824a82d ("lpm/arm: support SVE")
> 
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> ---
> v2: 
> * modify title start with 'build'
> 

One minor comment inline below.
/Bruce
> ---
>  config/arm/meson.build         | 5 +++++
>  lib/eal/arm/include/rte_vect.h | 2 +-
>  lib/lpm/rte_lpm.h              | 2 +-
>  3 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/config/arm/meson.build b/config/arm/meson.build
> index e83a56e..bff70e4 100644
> --- a/config/arm/meson.build
> +++ b/config/arm/meson.build
> @@ -480,6 +480,11 @@ if (cc.get_define('__ARM_NEON', args: machine_args) != '' or
>      compile_time_cpuflags += ['RTE_CPUFLAG_NEON']
>  endif
>  
> +if (cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != '' and
> +    cc.check_header('arm_sve.h'))
Please double-indent this line. It looks like part of the condition body
as-is.
  
Chengwen Feng May 21, 2021, 1:57 a.m. UTC | #2
Fix in v3, also with minor changes, thanks

On 2021/5/20 21:09, Bruce Richardson wrote:
> On Thu, May 20, 2021 at 07:40:12PM +0800, Chengwen Feng wrote:
>> If the target machine has SVE feature (e.g. "-march=armv8.2-a+sve'),
>> and the compiler is gcc8.3, it will compile error:
>> 	In file included from ../dpdk-next-net/lib/eal/common/
>> 	eal_common_options.c:38:
>> 	../dpdk-next-net/lib/eal/arm/include/rte_vect.h:13:10: fatal
>> 	error: arm_sve.h: No such file or directory
>> 	#include <arm_sve.h>
>> 	       ^~~~~~~~~~~
>> 	compilation terminated.
>>
>> The root cause is that gcc8.3 support SVE (the macro __ARM_FEATURE_SVE
>> was 1), but it doesn't support SVE ACLE [1].
>>
>> The solution:
>> a) Detect compiler whether support SVE ACLE, if support then define
>> CC_SVE_ACLE_SUPPORT macro.
>> b) Use the CC_SVE_ACLE_SUPPORT macro to include SVE header file.
>>
>> [1] ACLE:  Arm C Language Extensions, the SVE ACLE header file is
>> <arm_sve.h>, user should include it when writing ACLE SVE code.
>>
>> Fixes: 67b68824a82d ("lpm/arm: support SVE")
>>
>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>> ---
>> v2: 
>> * modify title start with 'build'
>>
> 
> One minor comment inline below.
> /Bruce
>> ---
>>  config/arm/meson.build         | 5 +++++
>>  lib/eal/arm/include/rte_vect.h | 2 +-
>>  lib/lpm/rte_lpm.h              | 2 +-
>>  3 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/config/arm/meson.build b/config/arm/meson.build
>> index e83a56e..bff70e4 100644
>> --- a/config/arm/meson.build
>> +++ b/config/arm/meson.build
>> @@ -480,6 +480,11 @@ if (cc.get_define('__ARM_NEON', args: machine_args) != '' or
>>      compile_time_cpuflags += ['RTE_CPUFLAG_NEON']
>>  endif
>>  
>> +if (cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != '' and
>> +    cc.check_header('arm_sve.h'))
> Please double-indent this line. It looks like part of the condition body
> as-is.
> 
> 
> .
>
  

Patch

diff --git a/config/arm/meson.build b/config/arm/meson.build
index e83a56e..bff70e4 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -480,6 +480,11 @@  if (cc.get_define('__ARM_NEON', args: machine_args) != '' or
     compile_time_cpuflags += ['RTE_CPUFLAG_NEON']
 endif
 
+if (cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != '' and
+    cc.check_header('arm_sve.h'))
+    dpdk_conf.set('CC_SVE_ACLE_SUPPORT', 1)
+endif
+
 if cc.get_define('__ARM_FEATURE_CRC32', args: machine_args) != ''
     compile_time_cpuflags += ['RTE_CPUFLAG_CRC32']
 endif
diff --git a/lib/eal/arm/include/rte_vect.h b/lib/eal/arm/include/rte_vect.h
index 093e912..277b656 100644
--- a/lib/eal/arm/include/rte_vect.h
+++ b/lib/eal/arm/include/rte_vect.h
@@ -9,7 +9,7 @@ 
 #include "generic/rte_vect.h"
 #include "rte_debug.h"
 #include "arm_neon.h"
-#ifdef __ARM_FEATURE_SVE
+#ifdef CC_SVE_ACLE_SUPPORT
 #include <arm_sve.h>
 #endif
 
diff --git a/lib/lpm/rte_lpm.h b/lib/lpm/rte_lpm.h
index 28b5768..9262814 100644
--- a/lib/lpm/rte_lpm.h
+++ b/lib/lpm/rte_lpm.h
@@ -402,7 +402,7 @@  rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4],
 	uint32_t defv);
 
 #if defined(RTE_ARCH_ARM)
-#ifdef __ARM_FEATURE_SVE
+#ifdef CC_SVE_ACLE_SUPPORT
 #include "rte_lpm_sve.h"
 #else
 #include "rte_lpm_neon.h"