[PATCH] D125023: [CSSPGO][Preinliner] Use linear threshold to drive inline decision.
Wenlei He via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 5 22:12:56 PDT 2022
wenlei added inline comments.
================
Comment at: llvm/tools/llvm-profgen/CSPreInliner.cpp:173
+ // Linearly adjust threshold based on call site hotness
+ auto Range = Summary->getMaxCount() - ColdCountThreshold;
+ double Position =
----------------
One concern about using `getMaxCount` -- that will have more instability and variation run to run. How about using HotCountThreshold (or N * HotCountThresold, or a set percentile) to stabilize?
The `NormalizedHotness` doesn't have to be between 0 and 1. Or if we want it to be between 0 and 1, we can also do `min(NormalizedHotness, 1)`.
================
Comment at: llvm/tools/llvm-profgen/CSPreInliner.cpp:174-175
+ auto Range = Summary->getMaxCount() - ColdCountThreshold;
+ double Position =
+ (Candidate.CallsiteCount - ColdCountThreshold) / (double)Range;
+ double Multiplier = PreInlineHotCallsiteThresholdMultiplier * Position;
----------------
Perhaps rename `Position` as `NormalizedHotness`?
================
Comment at: llvm/tools/llvm-profgen/CSPreInliner.cpp:176-179
+ double Multiplier = PreInlineHotCallsiteThresholdMultiplier * Position;
+ SampleThreshold = SampleHotCallSiteThreshold * Multiplier +
+ SampleColdCallSiteThreshold +
+ PreInlineHotCallsiteThresholdConstant;
----------------
How about we simplify the knobs, i.e. remove flag `preinline-hot-callsite-threshold-multiplier` and `preinline-hot-callsite-threshold-constant`.
Make `Multiplier` a constant, and we can still effectively tune the multiplier via setting `sample-profile-hot-inline-threshold`.
Make `PreInlineHotCallsiteThresholdConstant` a constant and we can still effectively tune it via `sample-profile-cold-inline-threshold`. We could also consider setting `SampleColdCallSiteThreshold = 1` in PreInliner (current we set it to 0).
With the above, I think if we can simply switches (avoid adding new ones) without scarifying flexibility for tuning.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125023/new/
https://reviews.llvm.org/D125023
More information about the llvm-commits
mailing list