diff options
author | Miloš Stojanović <Milos.Stojanovic@rt-rk.com> | 2019-12-31 14:14:41 +0100 |
---|---|---|
committer | Miloš Stojanović <Milos.Stojanovic@rt-rk.com> | 2019-12-31 14:17:24 +0100 |
commit | c7dc4734d23f45f576ba5af2aae5be9dfa2d3643 (patch) | |
tree | 8ac0dc37838151e992078388ddc452c3fdd387d2 /llvm/tools/llvm-exegesis/lib/Target.cpp | |
parent | b409f73e1fd8e498a2bff4208eeadf023959a0f7 (diff) | |
download | llvm-c7dc4734d23f45f576ba5af2aae5be9dfa2d3643.zip llvm-c7dc4734d23f45f576ba5af2aae5be9dfa2d3643.tar.gz llvm-c7dc4734d23f45f576ba5af2aae5be9dfa2d3643.tar.bz2 |
[llvm-exegesis] Check counters before running
Check if the appropriate counters for the specified mode are defined on
the target. This is checked before any other work is done.
Differential Revision: https://reviews.llvm.org/D71927
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/Target.cpp')
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/Target.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/Target.cpp b/llvm/tools/llvm-exegesis/lib/Target.cpp index 57de701..2974195 100644 --- a/llvm/tools/llvm-exegesis/lib/Target.cpp +++ b/llvm/tools/llvm-exegesis/lib/Target.cpp @@ -54,13 +54,24 @@ std::unique_ptr<SnippetGenerator> ExegesisTarget::createSnippetGenerator( std::unique_ptr<BenchmarkRunner> ExegesisTarget::createBenchmarkRunner(InstructionBenchmark::ModeE Mode, const LLVMState &State) const { + PfmCountersInfo PfmCounters = State.getPfmCounters(); switch (Mode) { case InstructionBenchmark::Unknown: return nullptr; case InstructionBenchmark::Latency: case InstructionBenchmark::InverseThroughput: + if (!PfmCounters.CycleCounter) { + const char *ModeName = Mode == InstructionBenchmark::Latency + ? "latency" + : "inverse_throughput"; + report_fatal_error(Twine("can't run '").concat(ModeName).concat("' mode, " + "sched model does not define a cycle counter.")); + } return createLatencyBenchmarkRunner(State, Mode); case InstructionBenchmark::Uops: + if (!PfmCounters.UopsCounter && !PfmCounters.IssueCounters) + report_fatal_error("can't run 'uops' mode, sched model does not define " + "uops or issue counters."); return createUopsBenchmarkRunner(State); } return nullptr; |