> On 3 Jun 2025, at 17:56, Richard Sandiford <richard.sandif...@arm.com> wrote:
> 
> Tamar Christina <tamar.christ...@arm.com> writes:
>> As requested in my patch for -mmax-vectorization this promotes the parameter
>> --param aarch64-autovec-preference to a first class top target flag.
>> 
>> If both the parameter and the flag is specified the parameter takes 
>> precedence
>> with the reasoning that it may already be embedded in build systems.
>> 
>> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
>> 
>> Ok for master?
>> 
>> Thanks,
>> Tamar
>> 
>> gcc/ChangeLog:
>> 
>> * config/aarch64/aarch64.cc (aarch64_override_options_internal): Set
>> value of parameter based on option.
>> * config/aarch64/aarch64.opt (autovec-preference): New.
>> * doc/invoke.texi (autovec-preference): Document it.
>> 
>> gcc/testsuite/ChangeLog:
>> 
>> * gcc.target/aarch64/autovec_param_asimd-only_2.c: New test.
>> * gcc.target/aarch64/autovec_param_default_2.c: New test.
>> * gcc.target/aarch64/autovec_param_prefer-asimd_2.c: New test.
>> * gcc.target/aarch64/autovec_param_prefer-sve_2.c: New test.
>> * gcc.target/aarch64/autovec_param_sve-only_2.c: New test.
> 

I’m okay with this but...

> Thanks for doing this.  I'm in favour, but on the documentation:
> 
>> diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt
>> index 
>> 2725c50da64a2c05489ea6202bdd5eedf1ba7e27..4dfd9b5c73011c73fcf8a39ad719ee9ca765297b
>>  100644
>> --- a/gcc/config/aarch64/aarch64.opt
>> +++ b/gcc/config/aarch64/aarch64.opt
>> @@ -290,6 +290,13 @@ msve-vector-bits=
>> Target RejectNegative Joined Enum(sve_vector_bits) 
>> Var(aarch64_sve_vector_bits) Init(SVE_SCALABLE)
>> -msve-vector-bits=<number> Set the number of bits in an SVE vector register.
>> 
>> +mautovec-preference=
>> +Target RejectNegative Joined Undocumented Var(autovec_preference) 
>> Enum(aarch64_autovec_preference) Init(AARCH64_AUTOVEC_DEFAULT)
>> +-mautovec-preference=[default|asimd-only|sve-only|prefer-asimd|prefer-sve]
>> +Force an ISA selection strategy for auto-vectorization. If both
>> +-mautovec-preference and --param aarch64_autovec-preference are set then the
>> +param value will be used.
>> +
>> mmax-vectorization
>> Target Undocumented Var(flag_aarch64_max_vectorization) Save
>> Override the scalar cost model such that vectorization is always profitable.
>> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
>> index 
>> 54d4cf88cccd4d0e4ede3442ad9907faac325d52..88a93f9bc76687c415e0cce4c3431f1d91194dfc
>>  100644
>> --- a/gcc/doc/invoke.texi
>> +++ b/gcc/doc/invoke.texi
>> @@ -21992,6 +21992,12 @@ precise control over which ISA will be used for 
>> auto-vectorization.  Unlike
>> -fno-vect-cost-model or -fvect-cost-model=unlimited this option does not turn
>> off cost comparison between different vector modes.
>> 
>> +@item -mautovec-preference=@var{name}
>> +-mautovec-preference=[default|asimd-only|sve-only|prefer-asimd|prefer-sve]
>> +Force an ISA selection strategy for auto-vectorization.  If both
>> +-mautovec-preference and --param aarch64_autovec-preference are set then the
>> +param value will be used.
>> +
>> @opindex march
>> @item -march=@var{name}
>> Specify the name of the target architecture and, optionally, one or
> 
> --params are supposed to be internal developer flags that could go away
> at any time.  So now that we have the user-facing flag, I think we should
> move the detailed documentation of @var{name} from the --param documentation
> to the -m option, and instead make the --param documentation reference the
> -m option.

… in addition I’d like us to continue with our design that “-mcpu=<CPU>” should 
be the recommended flag to get the best performance out of the CPU for the end 
user.
With promoting this flag to -m* status I’d like to avoid it proliferating in 
users makefiles who may mistakenly think they need it for production.
So can we add a note to the documentation saying that this is intended for 
performance exploration or something like that?

Thanks,
Kyrill


> 
> So something like:
> 
> --------------------------------------------------------------------------
> @item -mautovec-preference=@var{name}
> Force an ISA selection strategy for auto-vectorization.  The possible
> values of @var{name} are:
> @table @samp
> @item default
> Use the default heuristics.
> @item asimd-only
> Use only Advanced SIMD for auto-vectorization.
> @item sve-only
> Use only SVE for auto-vectorization.
> @item prefer-asimd
> Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
> deemed equal.
> @item prefer-sve
> Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
> @end table
> 
> ...
> 
> @item aarch64-autovec-preference
> An old alias for @option{-mautovec-preference}.  If both
> @option{-mautovec-preference} and @option{--param=aarch64_autovec-preference}
> are passed, the @option{--param} value will be used.
> --------------------------------------------------------------------------
> 
> (with the -m option deliberately not mentioning the --param)
> 
> Same idea for the .opt documentation.
> 
> Richard

Reply via email to