[PATCH] D83743: [InlineAdvisor] New inliner advisor to replay inlining from optimization remarks

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 17:40:36 PDT 2020


wenlei added a comment.

In D83743#2151020 <https://reviews.llvm.org/D83743#2151020>, @wmi wrote:

> In D83743#2150725 <https://reviews.llvm.org/D83743#2150725>, @wenlei wrote:
>
> > In D83743#2150703 <https://reviews.llvm.org/D83743#2150703>, @davidxl wrote:
> >
> > > Can this be extended to the SCC inliner?
> >
> >
> > Yes, we can use it in SCC inliner as well. We just need extra plumbing there. We can do that in a separate change if needed.
>
>
> Thanks for the work, using inline advisor to replay inline is exactly something we want too.
>
> Currently every inline remark message has only one level: one caller, one callee and one callsite (maybe with multiple levels of inline stack associated with the callsite). One problem I am thinking of is: the inline advisor may only work with top-down inlining. In bottom-up inlining, if we decide to inline a specific callsite, it will actually be inlined at many places after its caller also being inlined into multiple places in the caller's callers. Since SCC inliner uses bottom-up inlining, current format of inline advise may not provide precise enough information to specify an exact location where inlining is expected to happen.
>
> Have you ever considered to use a callpath to specify the inlining location?


Glad to know that it will be useful for your case too. You're right that with a bottom-up CGSCC inliner, we won't be able to replay arbitrary inline decisions. However I think that's a limitation of the inliner, not how inline decisions are represented. E.g. even if we have a full inline tree (subset of call graph), we still won't be able to replay that with CGSCC inliner if there's context-sensitive inline (specialization) in it.

The use case we had was for tuning full context-sensitive AutoFDO's early inlining - we can replay baseline AutoFDO early inlining there, or the other way around. We could also replay CGSCC inline of one build in another. The way it's implemented would work for those scenarios. But replay FDO early inline in CGSCC inline or the opposite may not get us what we wanted for the reasons you mentioned.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83743





More information about the llvm-commits mailing list