[PATCH] D84468: [HotColdSplitting] Add SplittingDelta option to enable splitting more small blocks
Ruijie Fang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 23 14:37:36 PDT 2020
rjf created this revision.
rjf added a reviewer: hiraditya.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Add an option "hotcoldsplit-delta" that is set to 5 by default;
the delta value enables blocks with cost benefit-penalty>=-delta
be split, in addition to blocks with positive benefit-penalty
differences. We have found that on common workloads, a splitting
delta of 5 enables hot/cold splitting to split significantly more
cold blocks with no obvious performance regression observed.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D84468
Files:
llvm/lib/Transforms/IPO/HotColdSplitting.cpp
Index: llvm/lib/Transforms/IPO/HotColdSplitting.cpp
===================================================================
--- llvm/lib/Transforms/IPO/HotColdSplitting.cpp
+++ llvm/lib/Transforms/IPO/HotColdSplitting.cpp
@@ -85,6 +85,11 @@
cl::desc("Base penalty for splitting cold code (as a "
"multiple of TCC_Basic)"));
+static cl::opt<int>
+ SplittingDelta("hotcoldsplit-delta", cl::init(5), cl::Hidden,
+ cl::desc("Allowance threshold for blocks with "
+ "Benefit - Penalty >= -Delta to be split. "));
+
namespace {
// Same as blockEndsInUnreachable in CodeGen/BranchFolding.cpp. Do not modify
// this function unless you modify the MBB version as well.
@@ -317,7 +322,13 @@
getOutliningPenalty(Region, Inputs.size(), Outputs.size());
LLVM_DEBUG(dbgs() << "Split profitability: benefit = " << OutliningBenefit
<< ", penalty = " << OutliningPenalty << "\n");
- if (OutliningBenefit <= OutliningPenalty)
+
+ // SplittingDelta gives OutliningBenefit a "boost" by allowing
+ // certain blocks with small Benefit-Penalty differences to be split.
+ // Empirical evidence indicates that setting SplittingDelta to a small
+ // number in [1, 5] can lead to a sizeable improvement in the overall
+ // number of cold regions extracted.
+ if (OutliningBenefit + SplittingDelta <= OutliningPenalty)
return nullptr;
Function *OrigF = Region[0]->getParent();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84468.280263.patch
Type: text/x-patch
Size: 1504 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200723/0e526390/attachment.bin>
More information about the llvm-commits
mailing list