[llvm-exegesis][NFC] remove runAndMeasure
authorAiden Grossman <agrossman154@yahoo.com>
Fri, 14 Apr 2023 07:05:37 +0000 (07:05 +0000)
committerAiden Grossman <agrossman154@yahoo.com>
Fri, 14 Apr 2023 07:16:34 +0000 (07:16 +0000)
This completes the FIXME listed in FunctionExecutor in regards to
deprecating this function. It simply makes the appropriate call into
runAndSample and grabs the first counter value. This patch completely
removes the function, moving that logic into the callers (currently only
uopsBenchmarkRunner). This makes creating new FunctionExecutors easier
as an implementation no longer needs to worry about this detail.

Reviewed By: gchatelet

Differential Revision: https://reviews.llvm.org/D147878

llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp

index e268ba7..b0ea639 100644 (file)
@@ -47,13 +47,6 @@ public:
         Scratch(Scratch) {}
 
 private:
-  Expected<int64_t> runAndMeasure(const char *Counters) const override {
-    auto ResultOrError = runAndSample(Counters);
-    if (ResultOrError)
-      return ResultOrError.get()[0];
-    return ResultOrError.takeError();
-  }
-
   static void
   accumulateCounterValues(const llvm::SmallVector<int64_t, 4> &NewValues,
                           llvm::SmallVector<int64_t, 4> *Result) {
index a74f347..aff69fc 100644 (file)
@@ -88,8 +88,6 @@ public:
   class FunctionExecutor {
   public:
     virtual ~FunctionExecutor();
-    // FIXME deprecate this.
-    virtual Expected<int64_t> runAndMeasure(const char *Counters) const = 0;
 
     virtual Expected<llvm::SmallVector<int64_t, 4>>
     runAndSample(const char *Counters) const = 0;
index b99b1c5..6351fdd 100644 (file)
@@ -25,19 +25,19 @@ UopsBenchmarkRunner::runMeasurements(const FunctionExecutor &Executor) const {
        IssueCounter != IssueCounterEnd; ++IssueCounter) {
     if (!IssueCounter->Counter)
       continue;
-    auto ExpectedCounterValue = Executor.runAndMeasure(IssueCounter->Counter);
+    auto ExpectedCounterValue = Executor.runAndSample(IssueCounter->Counter);
     if (!ExpectedCounterValue)
       return ExpectedCounterValue.takeError();
     Result.push_back(BenchmarkMeasure::Create(IssueCounter->ProcResName,
-                                              *ExpectedCounterValue));
+                                              (*ExpectedCounterValue)[0]));
   }
   // NumMicroOps.
   if (const char *const UopsCounter = PCI.UopsCounter) {
-    auto ExpectedCounterValue = Executor.runAndMeasure(UopsCounter);
+    auto ExpectedCounterValue = Executor.runAndSample(UopsCounter);
     if (!ExpectedCounterValue)
       return ExpectedCounterValue.takeError();
     Result.push_back(
-        BenchmarkMeasure::Create("NumMicroOps", *ExpectedCounterValue));
+        BenchmarkMeasure::Create("NumMicroOps", (*ExpectedCounterValue)[0]));
   }
   return std::move(Result);
 }