[polly] r311328 - [PPCGCodeGeneration] Enable `polly-codegen-perf-monitoring` for PPCGCodegen.
Siddharth Bhat via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 21 04:44:01 PDT 2017
Author: bollu
Date: Mon Aug 21 04:44:01 2017
New Revision: 311328
URL: http://llvm.org/viewvc/llvm-project?rev=311328&view=rev
Log:
[PPCGCodeGeneration] Enable `polly-codegen-perf-monitoring` for PPCGCodegen.
This feature was not enabled for `PPCGCodeGeneration`. Now that this is
enabled, we can benchmark Scops that have been optimised with
`-polly-codegen-ppcg` with the `-polly-codegen-perf-monitoring` option.
Differential Revision: https://reviews.llvm.org/D36934
Modified:
polly/trunk/include/polly/CodeGen/CodeGeneration.h
polly/trunk/lib/CodeGen/CodeGeneration.cpp
polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
Modified: polly/trunk/include/polly/CodeGen/CodeGeneration.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/CodeGeneration.h?rev=311328&r1=311327&r2=311328&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/CodeGeneration.h (original)
+++ polly/trunk/include/polly/CodeGen/CodeGeneration.h Mon Aug 21 04:44:01 2017
@@ -36,6 +36,8 @@ struct CodeGenerationPass : public PassI
PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
ScopStandardAnalysisResults &AR, SPMUpdater &U);
};
+
+extern bool PerfMonitoring;
} // namespace polly
#endif // POLLY_CODEGENERATION_H
Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=311328&r1=311327&r2=311328&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Mon Aug 21 04:44:01 2017
@@ -49,10 +49,12 @@ static cl::opt<bool> Verify("polly-codeg
cl::Hidden, cl::init(false), cl::ZeroOrMore,
cl::cat(PollyCategory));
-static cl::opt<bool>
- PerfMonitoring("polly-codegen-perf-monitoring",
- cl::desc("Add run-time performance monitoring"), cl::Hidden,
- cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
+bool polly::PerfMonitoring;
+static cl::opt<bool, true>
+ XPerfMonitoring("polly-codegen-perf-monitoring",
+ cl::desc("Add run-time performance monitoring"), cl::Hidden,
+ cl::location(polly::PerfMonitoring), cl::init(false),
+ cl::ZeroOrMore, cl::cat(PollyCategory));
namespace polly {
/// Mark a basic block unreachable.
Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=311328&r1=311327&r2=311328&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Mon Aug 21 04:44:01 2017
@@ -16,6 +16,7 @@
#include "polly/CodeGen/CodeGeneration.h"
#include "polly/CodeGen/IslAst.h"
#include "polly/CodeGen/IslNodeBuilder.h"
+#include "polly/CodeGen/PerfMonitor.h"
#include "polly/CodeGen/Utils.h"
#include "polly/DependenceInfo.h"
#include "polly/LinkAllPasses.h"
@@ -122,6 +123,8 @@ static cl::opt<int>
cl::desc("Minimal number of compute statements to run on GPU."),
cl::Hidden, cl::init(10 * 512 * 512));
+extern bool polly::PerfMonitoring;
+
/// Return a unique name for a Scop, which is the scop region with the
/// function name.
std::string getUniqueScopName(const Scop *S) {
@@ -3433,6 +3436,22 @@ public:
isl_ast_node_free(Root);
} else {
+ if (polly::PerfMonitoring) {
+ PerfMonitor P(*S, EnteringBB->getParent()->getParent());
+ P.initialize();
+ P.insertRegionStart(SplitBlock->getTerminator());
+
+ // TODO: actually think if this is the correct exiting block to place
+ // the `end` performance marker. Invariant load hoisting changes
+ // the CFG in a way that I do not precisely understand, so I
+ // (Siddharth<siddu.druid at gmail.com>) should come back to this and
+ // think about which exiting block to use.
+ auto *ExitingBlock = StartBlock->getUniqueSuccessor();
+ assert(ExitingBlock);
+ BasicBlock *MergeBlock = ExitingBlock->getUniqueSuccessor();
+ P.insertRegionEnd(MergeBlock->getTerminator());
+ }
+
NodeBuilder.addParameters(S->getContext().release());
Value *RTC = NodeBuilder.createRTC(Condition);
Builder.GetInsertBlock()->getTerminator()->setOperand(0, RTC);
More information about the llvm-commits
mailing list