[PATCH 4/4] Implement hierarchical discriminators for AutoFDO

Kugan Vivekanandarajah kvivekananda@nvidia.com
Fri Jan 2 04:56:45 GMT 2026



> On 17 Dec 2025, at 9:42 pm, Kugan Vivekanandarajah <kvivekananda@nvidia.com> wrote:
> 
> External email: Use caution opening links or attachments
> 
> 
> Hi Honza,
> 
>> On 12 Dec 2025, at 9:04 am, Kugan Vivekanandarajah <kvivekananda@nvidia.com> wrote
>> How about going with  something like:
>> copyid_base = allocate_copyid_base (loc, base_discriminator);
>> This should have global context and allocate new copyid_base for each call without any of the defines we have now.
>> This would still have issue for LTO where any copyid_base generated in LTRANS will have conflict unless we generate this
>> in WPA and stream. What do you think?
> 
> Here is the implementation (just the patch 1 or the infrastructure). Do you prefer this?
> 
> Using this API, we would assign copy_id like:
> +      gimple *nloop_last = last_nondebug_stmt (nloop->header);
> +      location_t nloop_loc
> +               = nloop_last ? gimple_location (nloop_last) : UNKNOWN_LOCATION;
> +      if (nloop_loc != UNKNOWN_LOCATION)
> +       {
> +         unsigned int nloop_copyid = allocate_copyid_base (nloop_loc, 1);
> +         assign_discriminators_to_loop (nloop, 0, nloop_copyid);
> +       }
> 
> 
> I will post the series based on this if you prefer this.

Ping?

Thanks,
Kugan


> 
> Thanks,
> Kugan
> 
> <0001-Autofdo-V3-Add-hierarchical-discriminator-support.patch>



More information about the Gcc-patches mailing list