> On 5 May 2025, at 16:34, Kyrylo Tkachov <ktkac...@nvidia.com> wrote:
> 
> 
> 
>> On 4 May 2025, at 19:19, Yangyu Chen <c...@cyyself.name> wrote:
>> 
>> Hi everyone,
>> 
>> This patch series introduces support for the target_clones profile
>> option in GCC. This option enables users to specify target_clones
>> attributes in a separate file, allowing GCC to generate multiple
>> versions of the function with different ISA extensions based on the
>> specified profile. This is achieved using the -ftarget-profile
>> option.
> 
> Interesting idea, but the terminology is confusing as is.
> In GCC “profile” usually refers to an execution profile gathered through PGO 
> instrumentation or perf.
> Whereas here I think you use “profile” to mean a “RISC-V profile” which is 
> something like a set of target architecture extensions?
> Thanks,
> Kyrill
> 

Sorry for the unclear information. The target profile here refers
to the target_clones attribute for each function. You can find an
example in the second patch.

For instance, we want a function foo to generate default and RISC-V
vector targets, while a function bar should generate default and
zba,zbb targets. The corresponding source code could be as follows:

```
__attribute__((target_clones("default","arch=+v")))
void foo();

__attribute__((target_clones("default","arch=+zba,+zbb")))
void bar();
```

But if we have a target profile, we can describe it as follows in
a separate file:

```
foo:default#arch=+v
bar:default#arch=+zba,+zbb
```

Thanks,
Yangyu Chen

>> 
>> The primary objective of this patch series is to provide a
>> user-friendly way to specify target_clones attributes without
>> modifying the source code. This approach enhances the source code's
>> cleanliness, facilitates easier maintenance, and ensures portability
>> across different architectures and compiler versions.
>> 
>> The example usage of the target_clones profile option is detailed in
>> the commit message of the second patch.
>> 
>> I understand that this patch lacks comprehensive documentation and
>> test cases, as I am still in the process of writing them.
>> However, I would appreciate feedback on the implementation before
>> adding them. If the implementation is deemed acceptable, I
>> will proceed with writing the documentation and test cases.
>> 
>> Yangyu Chen (2):
>> Fortran: Do not make_decl_rtl in trans_function_start
>> Add target_clones profile option support
>> 
>> gcc/common.opt            |  7 +++++++
>> gcc/fortran/trans-decl.cc |  3 ---
>> gcc/multiple_target.cc    | 24 +++++++++++++++++++++++-
>> gcc/opts.cc               | 23 +++++++++++++++++++++++
>> 4 files changed, 53 insertions(+), 4 deletions(-)
>> 
>> -- 
>> 2.49.0
>> 
> 

Reply via email to