> -----Original Message----- > From: Prathamesh Kulkarni <[email protected]> > Sent: 03 June 2026 18:46 > To: Jan Hubicka <[email protected]> > Cc: [email protected] > Subject: RE: [RFC][Enable time profile function reordering with AutoFDO] > Introduce pass ipa_adjust_tp_first_run for handling profiled clones > > External email: Use caution opening links or attachments > > > > -----Original Message----- > > From: Jan Hubicka <[email protected]> > > Sent: 07 April 2026 13:48 > > To: Richard Biener <[email protected]> > > Cc: Prathamesh Kulkarni <[email protected]>; gcc- > > [email protected] > > Subject: Re: [RFC][Enable time profile function reordering with > > AutoFDO] Introduce pass ipa_adjust_tp_first_run for handling profiled > > clones > > > > External email: Use caution opening links or attachments > > > > > > > On Thu, 2 Apr 2026, Prathamesh Kulkarni wrote: > > > > > > > > > > > > > > > > -----Original Message----- > > > > > From: Prathamesh Kulkarni <[email protected]> > > > > > Sent: 26 March 2026 22:17 > > > > > To: Jan Hubicka <[email protected]> > > > > > Cc: [email protected] > > > > > Subject: RE: [RFC][Enable time profile function reordering with > > > > > AutoFDO] Introduce pass ipa_adjust_tp_first_run for handling > > > > > profiled clones > > > > > > > > > > External email: Use caution opening links or attachments > > > > > > > > > > > > > > > > -----Original Message----- > > > > > > From: Jan Hubicka <[email protected]> > > > > > > Sent: 10 March 2026 16:15 > > > > > > To: Prathamesh Kulkarni <[email protected]> > > > > > > Cc: [email protected] > > > > > > Subject: Re: [RFC][Enable time profile function reordering > > with > > > > > > AutoFDO] Introduce pass ipa_adjust_tp_first_run for handling > > > > > profiled > > > > > > clones > > > > > > > > > > > > External email: Use caution opening links or attachments > > > > > > > > > > > > > > > > > > > gcc/ChangeLog: > > > > > > > * auto-profile.cc: Include lto-streamer.h and data- > > > > > streamer.h. > > > > > > > (timestamp_info_map): Change value to std::pair<int, > > > > > > > int> > > > > > > instead of > > > > > > > int. > > > > > > > (autofdo_source_profile::read): Call std::make_pair > > for > > > > > > populating > > > > > > > value field of timestamp_info_map. > > > > > > > (afdo_annotate_cfg): Use it->second.second instead of > > > > > > >it- second for > > > > > > > assigning value to node->tp_first_run. > > > > > > > (clone_function_p): New function. > > > > > > > (clone_timestamp_map): New std::map for storing > > clone's > > > > > > >name > > > > > > and > > > > > > > tp_first_run which are materialized after auto-profile > > pass. > > > > > > > (adjust_tp_first_run_generate_summary): Likewise. > > > > > > > (adjust_tp_first_run_write_summary): Likewise. > > > > > > > (adjust_tp_first_run_read_summary): Likewise. > > > > > > > (adjust_tp_first_run): Likewise. > > > > > > > (class pass_ipa_adjust_tp_first_run): New pass. > > > > > > > (make_pass_ipa_adjust_tp_first_run): New function. > > > > > > > * lto-section-in.cc: Add entry > > "ipa_adjust_tp_first_run". > > > > > > > * lto-streamer.h (enum lto_section_type): Add entry > > for > > > > > > > LTO_section_ipa_adjust_tp_first_run. > > > > > > > * passes.def: Add entry for > > pass_ipa_adjust_tp_first_run. > > > > > > > * tree-pass.h (make_pass_ipa_adjust_tp_first_run): > > Declare. > > > > > > OK > > > > > Hi Honza, > > > > > Thanks for the approval, and sorry for late response. > > > > > I made a couple of cosmetic changes to the patch to avoid > > warnings > > > > > (removing unused variable and using const_cast), and verified > > the > > > > > patch passes bootstrap+test on aarch64-linux-gnu and > > > > > x86_64-pc-linux- gnu with multilib enabled, and for AutoFDO, I > > > > > verified the pass gets triggered and improves function layout > > for a large internal workload. > > > > > I am aware it's pretty late in stage-4, but I was hoping it'd be > > > > > OK to commit? > > > > > > > > > > (The pass added in patch is enabled with -fauto-profile, and it > > > > > only sets node->tp_first_run without affecting function > > reordering. > > > > > Time profile function reordering is enabled only with > > > > > -fauto-profile - fprofile-reorder-functions). > > > > Hi Honza and Richi, > > > > I am aware it's pretty late in stage-4 now, but was hoping if it'd > > be OK to commit the following patch ? > > > > https://gcc.gnu.org/pipermail/gcc-patches/2026-March/711506.html > > > > > > It's indeed pretty late and I'd prefer if this is delayed to stage1. > > The patch is OK for stage1 then. > Hi Honza, > Sorry for late response -- Before committing I realised the previous > patch had a memory leak: > It did not free clone_timestamp_map after write_summary (and there is no > other user of clone_timestamp map during LGEN). > And xstrdup (name) wasn't freed if insertion in clone_timestamp_map > failed in both generate_summary and read_summary hooks of the pass. > This is fixed in attached patch. > > Bootstrapped+tested on aaarch64-linux-gnu and verified the internal > workloads build correctly and show small gains (~2-2.5%) with the patch. > Is this patch OK to commit ? Hi, Ping: https://gcc.gnu.org/pipermail/gcc-patches/2026-June/719193.html Thanks, Prathamesh > > Thanks, > Prathamesh > > Honza > > > > > > Richard.
