[PATCH] D147878: [llvm-exegesis][NFC] remove runAndMeasure

Aiden Grossman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 9 03:53:18 PDT 2023


aidengrossman created this revision.
Herald added a subscriber: mstojanovic.
Herald added a project: All.
aidengrossman requested review of this revision.
Herald added subscribers: llvm-commits, courbet.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147878

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


Index: llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp
===================================================================
--- llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp
+++ llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp
@@ -25,19 +25,19 @@
        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);
 }
Index: llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
===================================================================
--- llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
+++ llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
@@ -88,8 +88,6 @@
   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: llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
===================================================================
--- llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -47,12 +47,6 @@
         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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147878.511980.patch
Type: text/x-patch
Size: 2488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230409/17e3ddf8/attachment.bin>


More information about the llvm-commits mailing list