[PATCH] D115770: [llvm-profgen] Turn on preinliner by default
Wenlei He via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 14 17:12:33 PST 2021
wenlei created this revision.
wenlei added reviewers: hoy, wlei.
Herald added subscribers: modimo, eraman.
wenlei requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
preinliner has been tuned on large server workloads and it's not ready to be turned on by default. this change also updates the thresholds based on tuning.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D115770
Files:
llvm/test/tools/llvm-profgen/cs-preinline.test
llvm/tools/llvm-profgen/CSPreInliner.cpp
Index: llvm/tools/llvm-profgen/CSPreInliner.cpp
===================================================================
--- llvm/tools/llvm-profgen/CSPreInliner.cpp
+++ llvm/tools/llvm-profgen/CSPreInliner.cpp
@@ -61,7 +61,14 @@
// ContextTracker.getFuncNameFor to work, if `Profiles` can have md5 codes
// as their profile context.
ContextTracker(Profiles, nullptr), ProfileMap(Profiles), Binary(Binary),
- HotCountThreshold(HotThreshold), ColdCountThreshold(ColdThreshold) {}
+ HotCountThreshold(HotThreshold), ColdCountThreshold(ColdThreshold) {
+ // Set default preinliner hot/cold call site threshold tuned with CSSPGO.
+ // for good performance with reasonable profile size.
+ if (!SampleHotCallSiteThreshold.getNumOccurrences())
+ SampleHotCallSiteThreshold = 1500;
+ if (!SampleColdCallSiteThreshold.getNumOccurrences())
+ SampleColdCallSiteThreshold = 0;
+}
std::vector<StringRef> CSPreInliner::buildTopDownOrder() {
std::vector<StringRef> Order;
Index: llvm/test/tools/llvm-profgen/cs-preinline.test
===================================================================
--- llvm/test/tools/llvm-profgen/cs-preinline.test
+++ llvm/test/tools/llvm-profgen/cs-preinline.test
@@ -3,20 +3,20 @@
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-DEFAULT
; Test llvm-profgen with preinliner on will merge not inlinable profile into base profile.
-; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --csspgo-preinliner=1
+; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --csspgo-preinliner=1 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=45 --output=%t
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-PREINL
; Test preinliner threshold that prevents all possible inlining and merges everything into base profile.
-; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --csspgo-preinliner=1 -sample-profile-cold-inline-threshold=0
+; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --csspgo-preinliner=1 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=0 --output=%t
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-NO-PREINL
; Test cold profile trimming. Only base profiles should be dropped.
-; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --csspgo-preinliner=1 --trim-cold-profile=1 --profile-summary-hot-count=400
+; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --csspgo-preinliner=1 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=45 --output=%t --trim-cold-profile=1 --profile-summary-hot-count=400
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-TRIM
; Test llvm-profgen with preinliner on will merge not inlinable profile into base profile.
-; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --csspgo-preinliner=1 --gen-cs-nested-profile=1
+; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --csspgo-preinliner=1 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=45 --output=%t --gen-cs-nested-profile=1
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-PREINL-NEST
; CHECK-DEFAULT: [main:1 @ foo]:309:0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115770.394418.patch
Type: text/x-patch
Size: 3857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211215/6927bc89/attachment.bin>
More information about the llvm-commits
mailing list