[llvm] bdb8c50 - [CSSPGO] Turn on priority inlining for probe-only profile
Hongtao Yu via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 29 17:32:05 PDT 2022
Author: Hongtao Yu
Date: 2022-04-29T17:31:56-07:00
New Revision: bdb8c50a1cf27ac021e700689affa8dd213db797
URL: https://github.com/llvm/llvm-project/commit/bdb8c50a1cf27ac021e700689affa8dd213db797
DIFF: https://github.com/llvm/llvm-project/commit/bdb8c50a1cf27ac021e700689affa8dd213db797.diff
LOG: [CSSPGO] Turn on priority inlining for probe-only profile
We have seen that the prioirty inliner delivered on-par performance with the old inliner for probe-only CSSPGO profile, as long as without a size budget. I'm turning on the priority inliner for probe-only profile by default.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D124632
Added:
Modified:
llvm/lib/Transforms/IPO/SampleProfile.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 6c4e6895bb3e..7c8104f2e75a 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -2016,31 +2016,36 @@ bool SampleProfileLoader::doInitialization(Module &M,
SampleProfileUseProfi = true;
if (!EnableExtTspBlockPlacement.getNumOccurrences())
EnableExtTspBlockPlacement = true;
- }
-
- if (Reader->profileIsCS() || Reader->profileIsPreInlined()) {
- ProfileIsCS = Reader->profileIsCS();
// Enable priority-base inliner and size inline by default for CSSPGO.
if (!ProfileSizeInline.getNumOccurrences())
ProfileSizeInline = true;
if (!CallsitePrioritizedInline.getNumOccurrences())
CallsitePrioritizedInline = true;
-
- // For CSSPGO, use preinliner decision by default when available.
- if (!UsePreInlinerDecision.getNumOccurrences())
- UsePreInlinerDecision = true;
-
// For CSSPGO, we also allow recursive inline to best use context profile.
if (!AllowRecursiveInline.getNumOccurrences())
AllowRecursiveInline = true;
- if (FunctionSamples::ProfileIsCS) {
- // Tracker for profiles under
diff erent context
- ContextTracker = std::make_unique<SampleContextTracker>(
- Reader->getProfiles(), &GUIDToFuncNameMap);
+ if (Reader->profileIsPreInlined()) {
+ if (!UsePreInlinerDecision.getNumOccurrences())
+ UsePreInlinerDecision = true;
+ } else if (!Reader->profileIsCS()) {
+ // Non-CS profile should be fine without a function size budget for the
+ // inliner since the contexts in the profile are all from inlining in
+ // the prevoius build, thus they are bounded.
+ if (!ProfileInlineLimitMin.getNumOccurrences())
+ ProfileInlineLimitMin = std::numeric_limits<unsigned>::max();
+ if (!ProfileInlineLimitMax.getNumOccurrences())
+ ProfileInlineLimitMax = std::numeric_limits<unsigned>::max();
}
}
+ if (FunctionSamples::ProfileIsCS) {
+ ProfileIsCS = true;
+ // Tracker for profiles under
diff erent context
+ ContextTracker = std::make_unique<SampleContextTracker>(
+ Reader->getProfiles(), &GUIDToFuncNameMap);
+ }
+
// Load pseudo probe descriptors for probe-based function samples.
if (Reader->profileIsProbeBased()) {
ProbeManager = std::make_unique<PseudoProbeManager>(M);
More information about the llvm-commits
mailing list