diff options
author | Clement Courbet <courbet@google.com> | 2018-06-06 09:42:36 +0000 |
---|---|---|
committer | Clement Courbet <courbet@google.com> | 2018-06-06 09:42:36 +0000 |
commit | 62b34fa89a9cabfebe56848e25be4413ee009520 (patch) | |
tree | 445956971d8c96465c4ec3aa81652f78cd289b4f /llvm/tools/llvm-exegesis/lib | |
parent | 57f661bd7d20412f21ac6b7611c41a0f8b84fc01 (diff) | |
download | bcm5719-llvm-62b34fa89a9cabfebe56848e25be4413ee009520.tar.gz bcm5719-llvm-62b34fa89a9cabfebe56848e25be4413ee009520.zip |
[llvm-exegesis] move Mode from Key to BenchmarResult.
Moves the Mode field out of the Key. The existing yaml benchmark results can be fixed with the following script:
```
readonly FILE=$1
readonly MODE=latency # Change to uops to fix a uops benchmark.
cat $FILE | \
sed "/^\ \+mode:\ \+$MODE$/d" | \
sed "/^cpu_name.*$/i mode: $MODE"
```
Differential Revision: https://reviews.llvm.org/D47813
Authored by: Guillaume Chatelet
llvm-svn: 334079
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib')
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/Analysis.cpp | 7 | ||||
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp | 12 | ||||
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/BenchmarkResult.h | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp | 2 | ||||
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h | 2 | ||||
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/Latency.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/Latency.h | 2 | ||||
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/Uops.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/Uops.h | 2 |
9 files changed, 19 insertions, 20 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/Analysis.cpp b/llvm/tools/llvm-exegesis/lib/Analysis.cpp index bf132724eaa..df353dcbf33 100644 --- a/llvm/tools/llvm-exegesis/lib/Analysis.cpp +++ b/llvm/tools/llvm-exegesis/lib/Analysis.cpp @@ -319,9 +319,8 @@ bool Analysis::SchedClassCluster::measurementsMatch( std::vector<BenchmarkMeasure> SchedClassPoint(NumMeasurements); // Latency case. assert(!Clustering.getPoints().empty()); - const InstructionBenchmarkKey::ModeE Mode = - Clustering.getPoints()[0].Key.Mode; - if (Mode == InstructionBenchmarkKey::Latency) { + const InstructionBenchmark::ModeE Mode = Clustering.getPoints()[0].Mode; + if (Mode == InstructionBenchmark::Latency) { if (NumMeasurements != 1) { llvm::errs() << "invalid number of measurements in latency mode: expected 1, got " @@ -337,7 +336,7 @@ bool Analysis::SchedClassCluster::measurementsMatch( std::max<double>(SchedClassPoint[0].Value, WLE->Cycles); } ClusterCenterPoint[0].Value = Representative[0].avg(); - } else if (Mode == InstructionBenchmarkKey::Uops) { + } else if (Mode == InstructionBenchmark::Uops) { for (int I = 0, E = Representative.size(); I < E; ++I) { // Find the pressure on ProcResIdx `Key`. uint16_t ProcResIdx = 0; diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp index 441aee0758e..87b25b413f2 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp @@ -68,12 +68,12 @@ template <> struct MappingTraits<exegesis::BenchmarkMeasure> { }; template <> -struct ScalarEnumerationTraits<exegesis::InstructionBenchmarkKey::ModeE> { +struct ScalarEnumerationTraits<exegesis::InstructionBenchmark::ModeE> { static void enumeration(IO &Io, - exegesis::InstructionBenchmarkKey::ModeE &Value) { - Io.enumCase(Value, "", exegesis::InstructionBenchmarkKey::Unknown); - Io.enumCase(Value, "latency", exegesis::InstructionBenchmarkKey::Latency); - Io.enumCase(Value, "uops", exegesis::InstructionBenchmarkKey::Uops); + exegesis::InstructionBenchmark::ModeE &Value) { + Io.enumCase(Value, "", exegesis::InstructionBenchmark::Unknown); + Io.enumCase(Value, "latency", exegesis::InstructionBenchmark::Latency); + Io.enumCase(Value, "uops", exegesis::InstructionBenchmark::Uops); } }; @@ -81,13 +81,13 @@ template <> struct MappingTraits<exegesis::InstructionBenchmarkKey> { static void mapping(IO &Io, exegesis::InstructionBenchmarkKey &Obj) { Io.mapRequired("opcode_name", Obj.OpcodeName); Io.mapOptional("instructions", Obj.Instructions); - Io.mapRequired("mode", Obj.Mode); Io.mapOptional("config", Obj.Config); } }; template <> struct MappingTraits<exegesis::InstructionBenchmark> { static void mapping(IO &Io, exegesis::InstructionBenchmark &Obj) { + Io.mapRequired("mode", Obj.Mode); Io.mapRequired("key", Obj.Key); Io.mapRequired("cpu_name", Obj.CpuName); Io.mapRequired("llvm_triple", Obj.LLVMTriple); diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h index 9b87482ac1b..421e210274f 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h @@ -34,8 +34,6 @@ struct InstructionBenchmarkKey { // The LLVM opcode name. std::string OpcodeName; // FIXME: Deprecated, use Instructions below. std::vector<llvm::MCInst> Instructions; - enum ModeE { Unknown, Latency, Uops }; - ModeE Mode; // An opaque configuration, that can be used to separate several benchmarks of // the same instruction under different configurations. std::string Config; @@ -50,6 +48,8 @@ struct BenchmarkMeasure { // The result of an instruction benchmark. struct InstructionBenchmark { InstructionBenchmarkKey Key; + enum ModeE { Unknown, Latency, Uops }; + ModeE Mode; std::string CpuName; std::string LLVMTriple; int NumRepetitions = 0; diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp index 75b2a1dc682..0599c8e0f3f 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -37,7 +37,7 @@ InstructionBenchmark BenchmarkRunner::run(unsigned Opcode, InstructionBenchmark InstrBenchmark; InstrBenchmark.Key.OpcodeName = State.getInstrInfo().getName(Opcode); - InstrBenchmark.Key.Mode = getMode(); + InstrBenchmark.Mode = getMode(); InstrBenchmark.CpuName = State.getCpuName(); InstrBenchmark.LLVMTriple = State.getTriple(); InstrBenchmark.NumRepetitions = NumRepetitions; diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h index 1382951716e..5dfd05e6028 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h @@ -54,7 +54,7 @@ protected: const llvm::MCRegisterInfo &MCRegisterInfo; private: - virtual InstructionBenchmarkKey::ModeE getMode() const = 0; + virtual InstructionBenchmark::ModeE getMode() const = 0; virtual llvm::Expected<std::vector<llvm::MCInst>> createSnippet(RegisterAliasingTrackerCache &RATC, unsigned Opcode, diff --git a/llvm/tools/llvm-exegesis/lib/Latency.cpp b/llvm/tools/llvm-exegesis/lib/Latency.cpp index 633189e110e..9c4ed567f11 100644 --- a/llvm/tools/llvm-exegesis/lib/Latency.cpp +++ b/llvm/tools/llvm-exegesis/lib/Latency.cpp @@ -52,8 +52,8 @@ static llvm::Error makeError(llvm::Twine Msg) { LatencyBenchmarkRunner::~LatencyBenchmarkRunner() = default; -InstructionBenchmarkKey::ModeE LatencyBenchmarkRunner::getMode() const { - return InstructionBenchmarkKey::Latency; +InstructionBenchmark::ModeE LatencyBenchmarkRunner::getMode() const { + return InstructionBenchmark::Latency; } llvm::Expected<std::vector<llvm::MCInst>> diff --git a/llvm/tools/llvm-exegesis/lib/Latency.h b/llvm/tools/llvm-exegesis/lib/Latency.h index 9dd0039b7c8..1e6150eada7 100644 --- a/llvm/tools/llvm-exegesis/lib/Latency.h +++ b/llvm/tools/llvm-exegesis/lib/Latency.h @@ -25,7 +25,7 @@ public: ~LatencyBenchmarkRunner() override; private: - InstructionBenchmarkKey::ModeE getMode() const override; + InstructionBenchmark::ModeE getMode() const override; llvm::Expected<std::vector<llvm::MCInst>> createSnippet(RegisterAliasingTrackerCache &RATC, unsigned OpcodeIndex, diff --git a/llvm/tools/llvm-exegesis/lib/Uops.cpp b/llvm/tools/llvm-exegesis/lib/Uops.cpp index 145bfad733b..b90ab1a22e4 100644 --- a/llvm/tools/llvm-exegesis/lib/Uops.cpp +++ b/llvm/tools/llvm-exegesis/lib/Uops.cpp @@ -141,8 +141,8 @@ static llvm::Error makeError(llvm::Twine Msg) { UopsBenchmarkRunner::~UopsBenchmarkRunner() = default; -InstructionBenchmarkKey::ModeE UopsBenchmarkRunner::getMode() const { - return InstructionBenchmarkKey::Uops; +InstructionBenchmark::ModeE UopsBenchmarkRunner::getMode() const { + return InstructionBenchmark::Uops; } llvm::Expected<std::vector<llvm::MCInst>> diff --git a/llvm/tools/llvm-exegesis/lib/Uops.h b/llvm/tools/llvm-exegesis/lib/Uops.h index 4fe7cb42ad2..a58fa1c5f01 100644 --- a/llvm/tools/llvm-exegesis/lib/Uops.h +++ b/llvm/tools/llvm-exegesis/lib/Uops.h @@ -25,7 +25,7 @@ public: ~UopsBenchmarkRunner() override; private: - InstructionBenchmarkKey::ModeE getMode() const override; + InstructionBenchmark::ModeE getMode() const override; llvm::Expected<std::vector<llvm::MCInst>> createSnippet(RegisterAliasingTrackerCache &RATC, unsigned Opcode, |