[v2] config/arm: update aarch32 build with gcc13

Message ID 20231009095325.86444-1-juraj.linkes@pantheon.tech (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] config/arm: update aarch32 build with gcc13 |

Checks

Context Check Description
ci/loongarch-compilation success Compilation OK
ci/checkpatch success coding style OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Juraj Linkeš Oct. 9, 2023, 9:53 a.m. UTC
  The aarch32 with gcc13 fails with:

Compiler for C supports arguments -march=armv8-a: NO

../config/arm/meson.build:714:12: ERROR: Problem encountered: No
suitable armv8 march version found.

This is because we test -march=armv8-a alone (without the -mpfu option),
which is no longer supported in gcc13 aarch32 builds.

The most recent recommendation from the compiler team is to build with
-march=armv8-a+simd -mfpu=auto, which should work for compilers old and
new. The suggestion is to first check -march=armv8-a+simd and only then
check -mfpu=auto.

To address this, add a way to force the architecture (the value of
the -march option).

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 config/arm/meson.build | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
  

Comments

Ruifeng Wang Oct. 10, 2023, 2:55 a.m. UTC | #1
> -----Original Message-----
> From: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Sent: Monday, October 9, 2023 5:53 PM
> To: thomas@monjalon.net; Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>;
> bruce.richardson@intel.com; Ruifeng Wang <Ruifeng.Wang@arm.com>
> Cc: dev@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
> Subject: [PATCH v2] config/arm: update aarch32 build with gcc13
> 
> The aarch32 with gcc13 fails with:
> 
> Compiler for C supports arguments -march=armv8-a: NO
> 
> ../config/arm/meson.build:714:12: ERROR: Problem encountered: No suitable armv8 march
> version found.
> 
> This is because we test -march=armv8-a alone (without the -mpfu option), which is no
> longer supported in gcc13 aarch32 builds.
> 
> The most recent recommendation from the compiler team is to build with -march=armv8-a+simd
> -mfpu=auto, which should work for compilers old and new. The suggestion is to first check
> -march=armv8-a+simd and only then check -mfpu=auto.
> 
> To address this, add a way to force the architecture (the value of the -march option).
> 
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> ---
>  config/arm/meson.build | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/config/arm/meson.build b/config/arm/meson.build index 3f22d8a2fc..5303d0e969
> 100644
> --- a/config/arm/meson.build
> +++ b/config/arm/meson.build
> @@ -43,7 +43,9 @@ implementer_generic = {
>          },
>          'generic_aarch32': {
>              'march': 'armv8-a',
> -            'compiler_options': ['-mfpu=neon'],
> +            'force_march': true,
> +            'march_features': ['simd'],
> +            'compiler_options': ['-mfpu=auto'],
>              'flags': [
>                  ['RTE_ARCH_ARM_NEON_MEMCPY', false],
>                  ['RTE_ARCH_STRICT_ALIGN', true], @@ -711,7 +713,11 @@ if update_flags
>              endif
>          endforeach
>          if candidate_march == ''
> -            error('No suitable armv8 march version found.')
> +            if part_number_config.get('force_march', false)
> +                candidate_march = part_number_config['march']
> +            else
> +                error('No suitable armv8 march version found.')
> +            endif
>          endif
>          if candidate_march != part_number_config['march']
>              warning('Configuration march version is ' + @@ -741,7 +747,7 @@ if
> update_flags
>      # apply supported compiler options
>      if part_number_config.has_key('compiler_options')
>          foreach flag: part_number_config['compiler_options']
> -            if cc.has_argument(flag)
> +            if cc.has_multi_arguments(machine_args + [flag])
>                  machine_args += flag
>              else
>                  warning('Configuration compiler option ' +
> --
> 2.34.1

Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
  
Paul Szczepanek Oct. 12, 2023, 12:40 p.m. UTC | #2
On 09/10/2023 10:53, Juraj Linkeš wrote:
> The aarch32 with gcc13 fails with:
>
> Compiler for C supports arguments -march=armv8-a: NO
>
> ../config/arm/meson.build:714:12: ERROR: Problem encountered: No
> suitable armv8 march version found.
>
> This is because we test -march=armv8-a alone (without the -mpfu option),
> which is no longer supported in gcc13 aarch32 builds.
>
> The most recent recommendation from the compiler team is to build with
> -march=armv8-a+simd -mfpu=auto, which should work for compilers old and
> new. The suggestion is to first check -march=armv8-a+simd and only then
> check -mfpu=auto.
>
> To address this, add a way to force the architecture (the value of
> the -march option).
>
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>   config/arm/meson.build | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/config/arm/meson.build b/config/arm/meson.build
> index 3f22d8a2fc..5303d0e969 100644
> --- a/config/arm/meson.build
> +++ b/config/arm/meson.build
> @@ -43,7 +43,9 @@ implementer_generic = {
>           },
>           'generic_aarch32': {
>               'march': 'armv8-a',
> -            'compiler_options': ['-mfpu=neon'],
> +            'force_march': true,
> +            'march_features': ['simd'],
> +            'compiler_options': ['-mfpu=auto'],
>               'flags': [
>                   ['RTE_ARCH_ARM_NEON_MEMCPY', false],
>                   ['RTE_ARCH_STRICT_ALIGN', true],
> @@ -711,7 +713,11 @@ if update_flags
>               endif
>           endforeach
>           if candidate_march == ''
> -            error('No suitable armv8 march version found.')
> +            if part_number_config.get('force_march', false)
> +                candidate_march = part_number_config['march']
> +            else
> +                error('No suitable armv8 march version found.')
> +            endif
This section is only used when no candidate is found, this would make it 
not really be a forced arch but more a fallback arch. If we want the 
user to be able to really force the march string we'd need to put the 
"is forced?" check higher. Am I reading the code right?
>           endif
>           if candidate_march != part_number_config['march']
>               warning('Configuration march version is ' +
> @@ -741,7 +747,7 @@ if update_flags
>       # apply supported compiler options
>       if part_number_config.has_key('compiler_options')
>           foreach flag: part_number_config['compiler_options']
> -            if cc.has_argument(flag)
> +            if cc.has_multi_arguments(machine_args + [flag])
>                   machine_args += flag
>               else
>                   warning('Configuration compiler option ' +
  
Juraj Linkeš Oct. 13, 2023, 7:35 a.m. UTC | #3
On Thu, Oct 12, 2023 at 2:40 PM Paul Szczepanek <paul.szczepanek@arm.com> wrote:
>
>
> On 09/10/2023 10:53, Juraj Linkeš wrote:
> > The aarch32 with gcc13 fails with:
> >
> > Compiler for C supports arguments -march=armv8-a: NO
> >
> > ../config/arm/meson.build:714:12: ERROR: Problem encountered: No
> > suitable armv8 march version found.
> >
> > This is because we test -march=armv8-a alone (without the -mpfu option),
> > which is no longer supported in gcc13 aarch32 builds.
> >
> > The most recent recommendation from the compiler team is to build with
> > -march=armv8-a+simd -mfpu=auto, which should work for compilers old and
> > new. The suggestion is to first check -march=armv8-a+simd and only then
> > check -mfpu=auto.
> >
> > To address this, add a way to force the architecture (the value of
> > the -march option).
> >
> > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > ---
> >   config/arm/meson.build | 12 +++++++++---
> >   1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/config/arm/meson.build b/config/arm/meson.build
> > index 3f22d8a2fc..5303d0e969 100644
> > --- a/config/arm/meson.build
> > +++ b/config/arm/meson.build
> > @@ -43,7 +43,9 @@ implementer_generic = {
> >           },
> >           'generic_aarch32': {
> >               'march': 'armv8-a',
> > -            'compiler_options': ['-mfpu=neon'],
> > +            'force_march': true,
> > +            'march_features': ['simd'],
> > +            'compiler_options': ['-mfpu=auto'],
> >               'flags': [
> >                   ['RTE_ARCH_ARM_NEON_MEMCPY', false],
> >                   ['RTE_ARCH_STRICT_ALIGN', true],
> > @@ -711,7 +713,11 @@ if update_flags
> >               endif
> >           endforeach
> >           if candidate_march == ''
> > -            error('No suitable armv8 march version found.')
> > +            if part_number_config.get('force_march', false)
> > +                candidate_march = part_number_config['march']
> > +            else
> > +                error('No suitable armv8 march version found.')
> > +            endif
> This section is only used when no candidate is found, this would make it
> not really be a forced arch but more a fallback arch. If we want the
> user to be able to really force the march string we'd need to put the
> "is forced?" check higher. Am I reading the code right?

Yes, you are right. The name should be a bit different to really reflect this.

The question now is what logic do we want. Either this "fallback after
fallback" when the regular fallback doesn't work OR a real forced
march where the regular fallback won't be used at all.

> >           endif
> >           if candidate_march != part_number_config['march']
> >               warning('Configuration march version is ' +
> > @@ -741,7 +747,7 @@ if update_flags
> >       # apply supported compiler options
> >       if part_number_config.has_key('compiler_options')
> >           foreach flag: part_number_config['compiler_options']
> > -            if cc.has_argument(flag)
> > +            if cc.has_multi_arguments(machine_args + [flag])
> >                   machine_args += flag
> >               else
> >                   warning('Configuration compiler option ' +
  

Patch

diff --git a/config/arm/meson.build b/config/arm/meson.build
index 3f22d8a2fc..5303d0e969 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -43,7 +43,9 @@  implementer_generic = {
         },
         'generic_aarch32': {
             'march': 'armv8-a',
-            'compiler_options': ['-mfpu=neon'],
+            'force_march': true,
+            'march_features': ['simd'],
+            'compiler_options': ['-mfpu=auto'],
             'flags': [
                 ['RTE_ARCH_ARM_NEON_MEMCPY', false],
                 ['RTE_ARCH_STRICT_ALIGN', true],
@@ -711,7 +713,11 @@  if update_flags
             endif
         endforeach
         if candidate_march == ''
-            error('No suitable armv8 march version found.')
+            if part_number_config.get('force_march', false)
+                candidate_march = part_number_config['march']
+            else
+                error('No suitable armv8 march version found.')
+            endif
         endif
         if candidate_march != part_number_config['march']
             warning('Configuration march version is ' +
@@ -741,7 +747,7 @@  if update_flags
     # apply supported compiler options
     if part_number_config.has_key('compiler_options')
         foreach flag: part_number_config['compiler_options']
-            if cc.has_argument(flag)
+            if cc.has_multi_arguments(machine_args + [flag])
                 machine_args += flag
             else
                 warning('Configuration compiler option ' +