Skip to content

Commit 72225ca

Browse files
committed
Revert "Reland: "[Exegesis] Add the ability to dry-run the measurement phase (#121991)" (#122775)"
This reverts commit a39aaf3 and 63d3bd6. Due to test failures on MacOSX.
1 parent a829eba commit 72225ca

File tree

7 files changed

+13
-51
lines changed

7 files changed

+13
-51
lines changed

llvm/docs/CommandGuide/llvm-exegesis.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ OPTIONS
301301
* ``prepare-and-assemble-snippet``: Same as ``prepare-snippet``, but also dumps an excerpt of the sequence (hex encoded).
302302
* ``assemble-measured-code``: Same as ``prepare-and-assemble-snippet``. but also creates the full sequence that can be dumped to a file using ``--dump-object-to-disk``.
303303
* ``measure``: Same as ``assemble-measured-code``, but also runs the measurement.
304-
* ``dry-run-measurement``: Same as measure, but does not actually execute the snippet.
305304

306305
.. option:: --x86-lbr-sample-period=<nBranches/sample>
307306

llvm/test/tools/llvm-exegesis/X86/dry-run-measurement.test

Lines changed: 0 additions & 10 deletions
This file was deleted.

llvm/test/tools/llvm-exegesis/lit.local.cfg

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ def can_use_perf_counters(mode, extra_options=[]):
3030
print("could not exec llvm-exegesis")
3131
return False
3232

33-
# LLJIT builds its own TargetMachine using arch designated by LLVM_TARGET_ARCH, which
34-
# is default to host. We don't want tests that use LLJIT (but not necessarily
35-
# execute the snippets) to run on machines that are not even supported by
36-
# exegesis.
37-
if config.root.native_target in ["AArch64", "Mips", "PowerPC", "RISCV", "X86"]:
38-
config.available_features.add("native-registered-exegesis-target")
3933

4034
for arch in ["aarch64", "mips", "powerpc", "x86_64"]:
4135
if can_execute_generated_snippets(arch):

llvm/tools/llvm-exegesis/lib/BenchmarkResult.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ enum class BenchmarkPhaseSelectorE {
3838
PrepareAndAssembleSnippet,
3939
AssembleMeasuredCode,
4040
Measure,
41-
DryRunMeasure,
4241
};
4342

4443
enum class BenchmarkFilter { All, RegOnly, WithMem };

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

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,22 @@ class InProcessFunctionExecutorImpl : public BenchmarkRunner::FunctionExecutor {
9999
static Expected<std::unique_ptr<InProcessFunctionExecutorImpl>>
100100
create(const LLVMState &State, object::OwningBinary<object::ObjectFile> Obj,
101101
BenchmarkRunner::ScratchSpace *Scratch,
102-
std::optional<int> BenchmarkProcessCPU, bool DryRun) {
102+
std::optional<int> BenchmarkProcessCPU) {
103103
Expected<ExecutableFunction> EF =
104104
ExecutableFunction::create(State.createTargetMachine(), std::move(Obj));
105105

106106
if (!EF)
107107
return EF.takeError();
108108

109109
return std::unique_ptr<InProcessFunctionExecutorImpl>(
110-
new InProcessFunctionExecutorImpl(State, std::move(*EF), Scratch,
111-
DryRun));
110+
new InProcessFunctionExecutorImpl(State, std::move(*EF), Scratch));
112111
}
113112

114113
private:
115114
InProcessFunctionExecutorImpl(const LLVMState &State,
116115
ExecutableFunction Function,
117-
BenchmarkRunner::ScratchSpace *Scratch,
118-
bool DryRun)
119-
: State(State), Function(std::move(Function)), Scratch(Scratch),
120-
DryRun(DryRun) {}
116+
BenchmarkRunner::ScratchSpace *Scratch)
117+
: State(State), Function(std::move(Function)), Scratch(Scratch) {}
121118

122119
static void accumulateCounterValues(const SmallVector<int64_t, 4> &NewValues,
123120
SmallVector<int64_t, 4> *Result) {
@@ -146,14 +143,9 @@ class InProcessFunctionExecutorImpl : public BenchmarkRunner::FunctionExecutor {
146143
CrashRecoveryContext CRC;
147144
CrashRecoveryContext::Enable();
148145
const bool Crashed = !CRC.RunSafely([this, Counter, ScratchPtr]() {
149-
if (DryRun) {
150-
Counter->start();
151-
Counter->stop();
152-
} else {
153-
Counter->start();
154-
this->Function(ScratchPtr);
155-
Counter->stop();
156-
}
146+
Counter->start();
147+
this->Function(ScratchPtr);
148+
Counter->stop();
157149
});
158150
CrashRecoveryContext::Disable();
159151
PS.reset();
@@ -185,7 +177,6 @@ class InProcessFunctionExecutorImpl : public BenchmarkRunner::FunctionExecutor {
185177
const LLVMState &State;
186178
const ExecutableFunction Function;
187179
BenchmarkRunner::ScratchSpace *const Scratch;
188-
bool DryRun = false;
189180
};
190181

191182
#ifdef __linux__
@@ -673,29 +664,21 @@ Expected<std::unique_ptr<BenchmarkRunner::FunctionExecutor>>
673664
BenchmarkRunner::createFunctionExecutor(
674665
object::OwningBinary<object::ObjectFile> ObjectFile,
675666
const BenchmarkKey &Key, std::optional<int> BenchmarkProcessCPU) const {
676-
bool DryRun =
677-
BenchmarkPhaseSelector == BenchmarkPhaseSelectorE::DryRunMeasure;
678-
679667
switch (ExecutionMode) {
680668
case ExecutionModeE::InProcess: {
681669
if (BenchmarkProcessCPU.has_value())
682670
return make_error<Failure>("The inprocess execution mode does not "
683671
"support benchmark core pinning.");
684672

685673
auto InProcessExecutorOrErr = InProcessFunctionExecutorImpl::create(
686-
State, std::move(ObjectFile), Scratch.get(), BenchmarkProcessCPU,
687-
DryRun);
674+
State, std::move(ObjectFile), Scratch.get(), BenchmarkProcessCPU);
688675
if (!InProcessExecutorOrErr)
689676
return InProcessExecutorOrErr.takeError();
690677

691678
return std::move(*InProcessExecutorOrErr);
692679
}
693680
case ExecutionModeE::SubProcess: {
694681
#ifdef __linux__
695-
if (DryRun)
696-
return make_error<Failure>("The subprocess execution mode cannot "
697-
"dry-run measurement at this moment.");
698-
699682
auto SubProcessExecutorOrErr = SubProcessFunctionExecutorImpl::create(
700683
State, std::move(ObjectFile), Key, BenchmarkProcessCPU);
701684
if (!SubProcessExecutorOrErr)

llvm/tools/llvm-exegesis/lib/Target.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ ExegesisTarget::createBenchmarkRunner(
9898
return nullptr;
9999
case Benchmark::Latency:
100100
case Benchmark::InverseThroughput:
101-
if (BenchmarkPhaseSelector >= BenchmarkPhaseSelectorE::Measure &&
101+
if (BenchmarkPhaseSelector == BenchmarkPhaseSelectorE::Measure &&
102102
!PfmCounters.CycleCounter) {
103103
const char *ModeName = Mode == Benchmark::Latency
104104
? "latency"
@@ -116,7 +116,7 @@ ExegesisTarget::createBenchmarkRunner(
116116
State, Mode, BenchmarkPhaseSelector, ResultAggMode, ExecutionMode,
117117
ValidationCounters, BenchmarkRepeatCount);
118118
case Benchmark::Uops:
119-
if (BenchmarkPhaseSelector >= BenchmarkPhaseSelectorE::Measure &&
119+
if (BenchmarkPhaseSelector == BenchmarkPhaseSelectorE::Measure &&
120120
!PfmCounters.UopsCounter && !PfmCounters.IssueCounters)
121121
return make_error<Failure>(
122122
"can't run 'uops' mode, sched model does not define uops or issue "

llvm/tools/llvm-exegesis/llvm-exegesis.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,7 @@ static cl::opt<BenchmarkPhaseSelectorE> BenchmarkPhaseSelector(
132132
clEnumValN(
133133
BenchmarkPhaseSelectorE::Measure, "measure",
134134
"Same as prepare-measured-code, but also runs the measurement "
135-
"(default)"),
136-
clEnumValN(
137-
BenchmarkPhaseSelectorE::DryRunMeasure, "dry-run-measurement",
138-
"Same as measure, but does not actually execute the snippet")),
135+
"(default)")),
139136
cl::init(BenchmarkPhaseSelectorE::Measure));
140137

141138
static cl::opt<bool>
@@ -479,7 +476,7 @@ static void runBenchmarkConfigurations(
479476
}
480477

481478
void benchmarkMain() {
482-
if (BenchmarkPhaseSelector >= BenchmarkPhaseSelectorE::Measure &&
479+
if (BenchmarkPhaseSelector == BenchmarkPhaseSelectorE::Measure &&
483480
!UseDummyPerfCounters) {
484481
#ifndef HAVE_LIBPFM
485482
ExitWithError(
@@ -504,7 +501,7 @@ void benchmarkMain() {
504501

505502
// Preliminary check to ensure features needed for requested
506503
// benchmark mode are present on target CPU and/or OS.
507-
if (BenchmarkPhaseSelector >= BenchmarkPhaseSelectorE::Measure)
504+
if (BenchmarkPhaseSelector == BenchmarkPhaseSelectorE::Measure)
508505
ExitOnErr(State.getExegesisTarget().checkFeatureSupport());
509506

510507
if (ExecutionMode == BenchmarkRunner::ExecutionModeE::SubProcess &&

0 commit comments

Comments
 (0)