> On 02/07/25 07:26, Kugan Vivekanandarajah wrote: > > > > > > > > > > Given the latest few patches that you have committed, is this patch > > > necessary > > > anymore? I have not fully understood the new logic as I was on holiday > > > last > > > week, but it looks like the propagation is occurring correctly now? > > > > > > > I think you are referring to the patch “Avoid some lost AFDO profiles with > > LTO” which introduces pass_ipa_auto_profile_offline. I dont think it does > > offline functions !afdo_callsite_hot_enough_for_early_inline. However, it > > should be easier now as the early_inline is moved out of auto-profile. > > Hmm, I was referring to the "Fix afdo profiles for functions that > was not early-inlined" patch which introduces the > > void > autofdo_source_profile::offline_unrealized_inlines () > > function. This seems to merge profiles to offline definitions, and it > is called from the main auto_profile function.
Sorry for the confusion. Indeed those two patches should make sure that all functions that was not inlined are merged into their offline versions. With -flto training the problem is bit more complex than just tracking down failed early inlining, since the function may be inlined cross module and also the offline copies of functions may have functions inlined to them. So there are two passes now, the offline pass (run before early opts) that takes care of reading the auto-profile, offlining all cross-module inlines and also removes unnecesary parts of the profile (to save memory). This makes sure that the profile considered by afdo inlining during early opts will not ignore functions inlined cross-module during train run. After all of early inlining afdo pass offlines remaining function (in offline_unrealized_inlines). Offlining is now recursive and merges also profiles of functions that are inlined to functions being offlined. Honza