[PATCH] D108180: [CSSPGO] Track and use context-sensitive post-optimization function size to drive global pre-inliner in llvm-profgen

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 17 12:09:58 PDT 2021


wmi accepted this revision.
wmi added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: llvm/tools/llvm-profgen/ProfiledBinary.cpp:55
 
+void BinarySizeContextTracker::addInstructionForContext(
+    const FrameLocationStack &Context, uint32_t InstrSize) {
----------------
wenlei wrote:
> wmi wrote:
> > The function size computed for a certain context doesn't include the size of any function inlined into it. This matches well with top-down inline in sample loader, but may not match well with cgscc inliner. I forget how much inlining is done by the inliner in sample loader and how much is done by cgscc inliner for CSSPGO. Is it a problem right now?  
> It's difficult for sample loader to capture all inlining since cgscc inliner uses difference heuristic, but most of the hot inlining should be done in sample loader. The size here is used for global top-down pre-inlining in llvm-profgen which would guide sample loader inlining. cgscc inliner will still be able to use context-less profile and current heuristic to estimate cost/benefit without being affected by what we're doing here.
I see. Merging the non-inlined context profile from other modules back to the base profile in preinliner will be helpful for cgscc inliner.   


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108180/new/

https://reviews.llvm.org/D108180



More information about the llvm-commits mailing list