[PATCH] D98213: [InlineCost] Enable the cost benefit analysis on FDO

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 11 11:02:40 PST 2021


kazu added a comment.

In D98213#2612503 <https://reviews.llvm.org/D98213#2612503>, @wenlei wrote:

> What's the .text size change for your internal benchmark when you turn it on?

For FDO, the size of .text.* increases by 0.03%.  .text.hot and .text shrink by 0.67% by 0.24%, respectively.  The reduction is mostly offset by a 1.25% increase in .text.split.

For CSFDO, the size of .text.* increases by 0.07%.  .text.hot, .text, and .text.split grow by 1.10%, 0.40%, and 2.05%, respectively.

Under the hood, we are inlining very hot functions that were previously too big to be inlined while rejecting marginally hot call sites that were within the size threshold.  The former primarily contributes to the execution performance.  The latter contributes to size reduction with little impact on the execution performance.

Note that you can set `-inline-savings-multiplier` to some positive integer smaller than 8, say 4, to limit inlining of the hot call sites and thus reduce the executable size.  My experiments with our large internal benchmark show that the performance doesn't change much when I tweak -inline-savings-multiplier.  If we assume that the ratio of cycle savings to size cost is a reasonable indicator of inlining desirability, then applying a threshold on the ratio means that we always inline the most desirable call sites, with the threshold controlling the amount of the long tail to reject, which I think is the reason why the parameter doesn't affect the performance very much.

In D98213#2612503 <https://reviews.llvm.org/D98213#2612503>, @wenlei wrote:

> What is the impact of this switch with sample profile?

About neutral without ThinLTO and a 0.27% improvement on our large internal benchmark with ThinLTO.  This is why I am turning on the switch by default on FDO profile for now but not on sample profile.  The sample profile loader has its own inliner.  If we want to benefit from the idea of looking at the ratio of cycle savings to size cost, then I think we really have to modify the inliner in the sample profile loader.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98213



More information about the llvm-commits mailing list