diff options
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/Clustering.cpp')
| -rw-r--r-- | llvm/tools/llvm-exegesis/lib/Clustering.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.cpp b/llvm/tools/llvm-exegesis/lib/Clustering.cpp index 2a8cc453be0..398bbf776af 100644 --- a/llvm/tools/llvm-exegesis/lib/Clustering.cpp +++ b/llvm/tools/llvm-exegesis/lib/Clustering.cpp @@ -363,5 +363,36 @@ std::vector<BenchmarkMeasure> SchedClassClusterCentroid::getAsPoint() const { return ClusterCenterPoint; } +bool SchedClassClusterCentroid::validate( + InstructionBenchmark::ModeE Mode) const { + size_t NumMeasurements = Representative.size(); + switch (Mode) { + case InstructionBenchmark::Latency: + if (NumMeasurements != 1) { + llvm::errs() + << "invalid number of measurements in latency mode: expected 1, got " + << NumMeasurements << "\n"; + return false; + } + break; + case InstructionBenchmark::Uops: + // Can have many measurements. + break; + case InstructionBenchmark::InverseThroughput: + if (NumMeasurements != 1) { + llvm::errs() << "invalid number of measurements in inverse throughput " + "mode: expected 1, got " + << NumMeasurements << "\n"; + return false; + } + break; + default: + llvm_unreachable("unimplemented measurement matching mode"); + return false; + } + + return true; // All good. +} + } // namespace exegesis } // namespace llvm |

