[PATCH] D48779: [llvm-exegesis] Delegate the decision of cycle counter name to the target
John Brawn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 2 06:19:47 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL336099: [llvm-exegesis] Delegate the decision of cycle counter name to the target (authored by john.brawn, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D48779?vs=153534&id=153700#toc
Repository:
rL LLVM
https://reviews.llvm.org/D48779
Files:
llvm/trunk/tools/llvm-exegesis/lib/Latency.cpp
llvm/trunk/tools/llvm-exegesis/lib/Latency.h
llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp
Index: llvm/trunk/tools/llvm-exegesis/lib/Latency.h
===================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/Latency.h
+++ llvm/trunk/tools/llvm-exegesis/lib/Latency.h
@@ -38,6 +38,8 @@
std::vector<BenchmarkMeasure>
runMeasurements(const ExecutableFunction &EF,
const unsigned NumRepetitions) const override;
+
+ virtual const char *getCounterName() const;
};
} // namespace exegesis
Index: llvm/trunk/tools/llvm-exegesis/lib/Latency.cpp
===================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/Latency.cpp
+++ llvm/trunk/tools/llvm-exegesis/lib/Latency.cpp
@@ -94,19 +94,28 @@
return generateTwoInstructionPrototype(Instr);
}
+const char *LatencyBenchmarkRunner::getCounterName() const {
+ if (!State.getSubtargetInfo().getSchedModel().hasExtraProcessorInfo())
+ llvm::report_fatal_error("sched model is missing extra processor info!");
+ const char *CounterName = State.getSubtargetInfo()
+ .getSchedModel()
+ .getExtraProcessorInfo()
+ .PfmCounters.CycleCounter;
+ if (!CounterName)
+ llvm::report_fatal_error("sched model does not define a cycle counter");
+ return CounterName;
+}
+
std::vector<BenchmarkMeasure>
LatencyBenchmarkRunner::runMeasurements(const ExecutableFunction &Function,
const unsigned NumRepetitions) const {
// Cycle measurements include some overhead from the kernel. Repeat the
// measure several times and take the minimum value.
constexpr const int NumMeasurements = 30;
int64_t MinLatency = std::numeric_limits<int64_t>::max();
- const char *CounterName = State.getSubtargetInfo()
- .getSchedModel()
- .getExtraProcessorInfo()
- .PfmCounters.CycleCounter;
+ const char *CounterName = getCounterName();
if (!CounterName)
- llvm::report_fatal_error("sched model does not define a cycle counter");
+ llvm::report_fatal_error("could not determine cycle counter name");
const pfm::PerfEvent CyclesPerfEvent(CounterName);
if (!CyclesPerfEvent.valid())
llvm::report_fatal_error("invalid perf event");
Index: llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp
===================================================================
--- llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp
+++ llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp
@@ -140,10 +140,6 @@
return;
}
- // FIXME: Do not require SchedModel for latency.
- if (!State.getSubtargetInfo().getSchedModel().hasExtraProcessorInfo())
- llvm::report_fatal_error("sched model is missing extra processor info!");
-
const std::unique_ptr<BenchmarkRunner> Runner =
State.getExegesisTarget().createBenchmarkRunner(BenchmarkMode, State);
if (!Runner) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48779.153700.patch
Type: text/x-patch
Size: 2958 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180702/c6bacda7/attachment.bin>
More information about the llvm-commits
mailing list