[llvm] dee058c - [CSSPGO] Turn on ext-tsp by default for CSSPGO.
Hongtao Yu via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 4 19:48:50 PST 2022
Author: Hongtao Yu
Date: 2022-02-04T19:46:44-08:00
New Revision: dee058c670593b999fec19c458dbbd882ad9de56
URL: https://github.com/llvm/llvm-project/commit/dee058c670593b999fec19c458dbbd882ad9de56
DIFF: https://github.com/llvm/llvm-project/commit/dee058c670593b999fec19c458dbbd882ad9de56.diff
LOG: [CSSPGO] Turn on ext-tsp by default for CSSPGO.
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.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D119048
Added:
Modified:
llvm/lib/CodeGen/MachineBlockPlacement.cpp
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/lib/Transforms/Utils/CodeLayout.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
index c93ffaabf74c..5ad3d4d21ce2 100644
--- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -200,10 +200,7 @@ static cl::opt<unsigned> TriangleChainCount(
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;
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 0298f3c025db..38bbd506381b 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -295,6 +295,8 @@ static cl::opt<bool> OverwriteExistingWeights(
"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 @@ bool SampleProfileLoader::doInitialization(Module &M,
if (!SampleProfileUseProfi.getNumOccurrences())
SampleProfileUseProfi = true;
+ // Enable EXT-TSP block layout for CSSPGO.
+ if (!EnableExtTspBlockPlacement.getNumOccurrences())
+ EnableExtTspBlockPlacement = true;
+
if (FunctionSamples::ProfileIsCSFlat) {
// Tracker for profiles under
diff erent context
ContextTracker = std::make_unique<SampleContextTracker>(
diff --git a/llvm/lib/Transforms/Utils/CodeLayout.cpp b/llvm/lib/Transforms/Utils/CodeLayout.cpp
index dfb9f608eab2..e46a939dcace 100644
--- a/llvm/lib/Transforms/Utils/CodeLayout.cpp
+++ b/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>
More information about the llvm-commits
mailing list