[PATCH] D119048: [CSSPGO] Turn on ext-tsp by default for CSSPGO.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 4 17:20:35 PST 2022


hoy created this revision.
Herald added subscribers: ormris, modimo, wenlei, hiraditya.
hoy requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I'm seeing ext-tsp helps CSSPGO for our intern large benchmarks so I'm turning on it for CSSPGO. For non-CS AutoFDO, ext-tsp doesn't seem to help, probably because of lower profile counts quality.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119048

Files:
  llvm/lib/CodeGen/MachineBlockPlacement.cpp
  llvm/lib/Transforms/IPO/SampleProfile.cpp
  llvm/lib/Transforms/Utils/CodeLayout.cpp


Index: llvm/lib/Transforms/Utils/CodeLayout.cpp
===================================================================
--- llvm/lib/Transforms/Utils/CodeLayout.cpp
+++ llvm/lib/Transforms/Utils/CodeLayout.cpp
@@ -45,6 +45,11 @@
 using namespace llvm;
 #define DEBUG_TYPE "code-layout"
 
+cl::opt<bool> EnableExtTspBlockPlacement(
+    "enable-ext-tsp-block-placement", cl::Hidden, cl::init(false),
+    cl::desc("Enable machine block placement based on the ext-tsp model, "
+             "optimizing I-cache utilization."));
+
 // Algorithm-specific constants. The values are tuned for the best performance
 // of large-scale front-end bound binaries.
 static cl::opt<double>
Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -295,6 +295,8 @@
     "overwrite-existing-weights", cl::Hidden, cl::init(false),
     cl::desc("Ignore existing branch weights on IR and always overwrite."));
 
+extern cl::opt<bool> EnableExtTspBlockPlacement;
+
 namespace {
 
 using BlockWeightMap = DenseMap<const BasicBlock *, uint64_t>;
@@ -2000,6 +2002,10 @@
     if (!SampleProfileUseProfi.getNumOccurrences())
       SampleProfileUseProfi = true;
 
+    // Enable EXT-TSP block layout for CSSPGO.
+    if (!EnableExtTspBlockPlacement.getNumOccurrences())
+      EnableExtTspBlockPlacement = true;
+
     if (FunctionSamples::ProfileIsCSFlat) {
       // Tracker for profiles under different context
       ContextTracker = std::make_unique<SampleContextTracker>(
Index: llvm/lib/CodeGen/MachineBlockPlacement.cpp
===================================================================
--- llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -200,10 +200,7 @@
     cl::init(2),
     cl::Hidden);
 
-static cl::opt<bool> EnableExtTspBlockPlacement(
-    "enable-ext-tsp-block-placement", cl::Hidden, cl::init(false),
-    cl::desc("Enable machine block placement based on the ext-tsp model, "
-             "optimizing I-cache utilization."));
+extern cl::opt<bool> EnableExtTspBlockPlacement;
 
 namespace llvm {
 extern cl::opt<unsigned> StaticLikelyProb;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119048.406130.patch
Type: text/x-patch
Size: 2236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220205/518c6aff/attachment.bin>


More information about the llvm-commits mailing list