From b8fb15d4122b04d620c1d4a89449b6eba2f4b0c0 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Fri, 29 Mar 2019 11:36:08 +0000 Subject: [NFC][llvm-exegesis] Refactor Analysis::SchedClassCluster::measurementsMatch() Summary: The diff looks scary but it really isn't: 1. I moved the check for the number of measurements into `SchedClassClusterCentroid::validate()` 2. While there, added a check that we can only have a single inverse throughput measurement. I missed that when adding it initially. 3. In `Analysis::SchedClassCluster::measurementsMatch()` is called with the current LLVM values from schedule class and the values from Centroid. 3.1. The values from centroid we can already get from `SchedClassClusterCentroid::getAsPoint()`. This isn't 100% a NFC, because previously for inverse throughput we used `min()`. I have asked whether i have done that correctly in https://reviews.llvm.org/D57647?id=184939#inline-510384 but did not hear back. I think `avg()` should be used too, thus it is a fix. 3.2. Finally, refactor the computation of the LLVM-specified values into `Analysis::SchedClassCluster::getSchedClassPoint()` I will need that function for [[ https://bugs.llvm.org/show_bug.cgi?id=41275 | PR41275 ]] Reviewers: courbet, gchatelet Reviewed By: courbet Subscribers: tschuett, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59951 llvm-svn: 357245 --- llvm/tools/llvm-exegesis/lib/Analysis.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/tools/llvm-exegesis/lib/Analysis.h') diff --git a/llvm/tools/llvm-exegesis/lib/Analysis.h b/llvm/tools/llvm-exegesis/lib/Analysis.h index e38f460b79d..36a3479b6df 100644 --- a/llvm/tools/llvm-exegesis/lib/Analysis.h +++ b/llvm/tools/llvm-exegesis/lib/Analysis.h @@ -79,6 +79,12 @@ private: // Return the cluster centroid. const SchedClassClusterCentroid &getCentroid() const { return Centroid; } + std::vector + getSchedClassPoint(InstructionBenchmark::ModeE Mode, + const llvm::MCSubtargetInfo &STI, + const ResolvedSchedClass &SC, + ArrayRef Representative) const; + // Returns true if the cluster representative measurements match that of SC. bool measurementsMatch(const llvm::MCSubtargetInfo &STI, -- cgit v1.2.3