[llvm] 999a8b8 - [llvm-exegesis][NFC] remove runAndMeasure
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 14 00:16:49 PDT 2023
Author: Aiden Grossman
Date: 2023-04-14T07:16:34Z
New Revision: 999a8b8ce92742911cc5ad16a279340931339efc
URL: https://github.com/llvm/llvm-project/commit/999a8b8ce92742911cc5ad16a279340931339efc
DIFF: https://github.com/llvm/llvm-project/commit/999a8b8ce92742911cc5ad16a279340931339efc.diff
LOG: [llvm-exegesis][NFC] remove runAndMeasure
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
Added:
Modified:
llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index e268ba7ca757f..b0ea639ba6564 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -47,13 +47,6 @@ class FunctionExecutorImpl : public BenchmarkRunner::FunctionExecutor {
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) {
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
index a74f347b3a1ef..aff69fca6ed19 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
@@ -88,8 +88,6 @@ class BenchmarkRunner {
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;
diff --git a/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp
index b99b1c5e71131..6351fdd3345a8 100644
--- a/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp
@@ -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);
}
More information about the llvm-commits
mailing list