This is an archive of the discontinued LLVM Phabricator instance.

[CSSPGO][llvm-profgen] Do not duplicate context profiles into base profile when converting CS flat profile to nested.
ClosedPublic

Authored by hoy on May 2 2022, 12:33 PM.

Details

Summary

Recent experiments with our two large internal services showed that duplicating context profiles into base profile caused code size inflation and didn't deliver good performance compared to no such duplication. It was a trick we made to catch up with the CS flat profile and I'm now turning it off by default.

The code size inflation mainly comes from the enriched based profiles. A base profile for a function represents the uninlined (or outlined) portion of the whole function running time. Such portion could be very small if a function is inlined into most of its hot callsites. Duplicating context profiles of the function into its base profiles could cause the outlined body to be hot enough and in turn get many of its callees inlined, thus increases the code size. The size inflation could further cause perf regression.

Diff Detail

Event Timeline

hoy created this revision.May 2 2022, 12:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2022, 12:33 PM
hoy requested review of this revision.May 2 2022, 12:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2022, 12:33 PM
hoy retitled this revision from [CSSPGO][llvm-profgen] Do not duplicate context profiles into base profile when converting CS flat profile to nested profile. to [CSSPGO][llvm-profgen] Do not duplicate context profiles into base profile when converting CS flat profile to nested..May 2 2022, 12:35 PM
hoy edited the summary of this revision. (Show Details)
hoy added reviewers: wenlei, wlei.
wenlei accepted this revision.May 11 2022, 2:19 PM

lgtm, thanks.

llvm/lib/ProfileData/SampleProf.cpp
37

Perhaps this is something we could completely remove after everything stabilizes..

This revision is now accepted and ready to land.May 11 2022, 2:19 PM
This revision was landed with ongoing or failed builds.May 12 2022, 9:29 AM
This revision was automatically updated to reflect the committed changes.