[PATCH] D55000: [llvm-mca] Return the total number of cycles from method Pipeline::run().
Andrea Di Biagio via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 28 05:36:04 PST 2018
andreadb created this revision.
andreadb added reviewers: courbet, orodley, mattd, gchatelet.
Herald added subscribers: gbedwell, tschuett.
If a user only cares about the overall latency, then the best/quickest way is to change method Pipeline::run() so that it returns the total number of cycles to the caller.
When the simulation pipeline is run, the number of cycles (or an error) is returned from method Pipeline::run().
The advantage is that no hardware event listener is needed for computing that latency. So, the whole process should be faster (and simpler - for that particular use case).
https://reviews.llvm.org/D55000
Files:
tools/llvm-mca/include/Pipeline.h
tools/llvm-mca/lib/Pipeline.cpp
tools/llvm-mca/llvm-mca.cpp
Index: tools/llvm-mca/llvm-mca.cpp
===================================================================
--- tools/llvm-mca/llvm-mca.cpp
+++ tools/llvm-mca/llvm-mca.cpp
@@ -240,8 +240,9 @@
// Returns true on success.
static bool runPipeline(mca::Pipeline &P) {
// Handle pipeline errors here.
- if (auto Err = P.run()) {
- WithColor::error() << toString(std::move(Err));
+ Expected<unsigned> Cycles = P.run();
+ if (!Cycles) {
+ WithColor::error() << toString(Cycles.takeError());
return false;
}
return true;
Index: tools/llvm-mca/lib/Pipeline.cpp
===================================================================
--- tools/llvm-mca/lib/Pipeline.cpp
+++ tools/llvm-mca/lib/Pipeline.cpp
@@ -35,7 +35,7 @@
});
}
-Error Pipeline::run() {
+Expected<unsigned> Pipeline::run() {
assert(!Stages.empty() && "Unexpected empty pipeline found!");
do {
@@ -46,7 +46,7 @@
++Cycles;
} while (hasWorkToProcess());
- return ErrorSuccess();
+ return Cycles;
}
Error Pipeline::runCycle() {
Index: tools/llvm-mca/include/Pipeline.h
===================================================================
--- tools/llvm-mca/include/Pipeline.h
+++ tools/llvm-mca/include/Pipeline.h
@@ -67,7 +67,10 @@
public:
Pipeline() : Cycles(0) {}
void appendStage(std::unique_ptr<Stage> S);
- Error run();
+
+ // Returns the total number of simulated cycles.
+ Expected<unsigned> run();
+
void addEventListener(HWEventListener *Listener);
};
} // namespace mca
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55000.175671.patch
Type: text/x-patch
Size: 1495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181128/06b8ac32/attachment.bin>
More information about the llvm-commits
mailing list