> On 15 Nov 2025, at 8:36 am, Kugan Vivekanandarajah <[email protected]> 
> wrote:
> 
> External email: Use caution opening links or attachments
> 
> 
> Hi,
> 
>>> 
>>> I think we want to solve two problems
>>> 1) Handle situation when statement is duplicated (unrolling, loop
>>>  header copying etc.) and thus different locations in program
>>>  corresponds to different copies.
>>> 
>>>  Current code simply picks address with maximal count (expecting that
>>>  the statemnt perhaps spans multiple BBs) while we should really sum
>>>  counts of execution of different copies.
>>> 1) Handle situation where single address implies multiple executions
>>>  of the same statement (i.e. after vectorization)
>>> 
> 
> Here is the revised patch-set. In this:2
> 1. I have dropped gcov changes to 32bit discriminator. Instead  I have 
> changed autofdo tools to handle multiplicity and copy-id.
> I have put-up a pull request to autfdo tools as 
> https://github.com/google/autofdo/pull/257. This means all the changes to 
> auto-profile pass is not needed for this.
> We could still add 32bit support if there is a need as a follow up.
> 
> I have the split the patch into
> 1. Hierarchical discriminate support
> 2. Change vectoriser to add hierarchal discriminator
> 3. Adding hierarchical discriminate for loop versioning
> 4. Adding hierarchical discriminate for loop unrolling
> 

Hi,
This patch introduces the basic infrastructure for hierarchical
discriminators with format [Base:8][Multiplicity:7][CopyID:11][Unused:6]. 
This is a placeholder and values can be changed based on feedback.
It adds helper functions to create and extract discriminator components.

gcc/ChangeLog:

        * Makefile.in: Add hierarchical_discriminator.o to OBJS.
        * hierarchical_discriminator.cc: New file.
        * hierarchical_discriminator.h: New file.
        * input.cc (location_with_discriminator_components): New function.
        (get_discriminator_components_from_loc): Likewise.
        * input.h (DISCR_BASE_BITS): New constant.
        (DISCR_MULTIPLICITY_BITS): Likewise.
        (DISCR_COPYID_BITS): Likewise.
        (DISCR_UNUSED_BITS): Likewise.
        (DISCR_BASE_MASK): Likewise.
        (DISCR_MULTIPLICITY_MASK): Likewise.
        (DISCR_COPYID_MASK): Likewise.
        (DISCR_BASE_SHIFT): Likewise.
        (DISCR_MULTIPLICITY_SHIFT): Likewise.
        (DISCR_COPYID_SHIFT): Likewise.
        (DISCR_BASE_MAX): Likewise.
        (DISCR_MULTIPLICITY_MAX): Likewise.
        (DISCR_COPYID_MAX): Likewise.
        (location_with_discriminator_components): New function declaration.
        (get_discriminator_components_from_loc): Likewise.

Signed-off-by: Kugan Vivekanandarajah <[email protected]>

Thanks,
Kugan

Attachment: 0001-Autofdo-Add-hierarchical-discriminator-support.patch
Description: 0001-Autofdo-Add-hierarchical-discriminator-support.patch

Reply via email to