Skip to content

Merge preview/rvv-exegesis with main (dirty change history) #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: merge/rvv-exegesis
Choose a base branch
from

Conversation

e1turin
Copy link
Owner

@e1turin e1turin commented Feb 7, 2025

Nasty process of merging 2 commits (llvm#114149) onto main (dirty branch yet). With a purpose to control made changes, there are merge.diff in the root and log of changed files in status_merge.txt.

  • left // MERGEME: comments when it should recheck changes.
  • llvm/lib/RISCV/Target.cpp contains tidy merge conflicts to be solved in future commits.
  • ...

Implementation details

  • check whether same label used multiple times in output object file

@e1turin e1turin marked this pull request as ready for review February 7, 2025 02:40
@e1turin e1turin changed the title Merge/rvv exegesis full refactoring merge/rvv-exegesis-full Feb 7, 2025
Copy link
Owner Author

@e1turin e1turin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conflicts that are obvious for the first review iteration

Comment on lines +80 to +84
// MERGEME: useful operator?
//bool operator==(const BenchmarkKey &RHS) const {
// return Config == RHS.Config &&
// Instructions[0].getOpcode() == RHS.Instructions[0].getOpcode();
//}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MERGEME

Comment on lines +150 to +160
bool DryRun = DryRunMeasurement;
auto PS = ET.withSavedState();
CrashRecoveryContext CRC;
CrashRecoveryContext::Enable();
const bool Crashed = !CRC.RunSafely([this, Counter, ScratchPtr]() {
Counter->start();
this->Function(ScratchPtr);
Counter->stop();
});
const bool Crashed =
!CRC.RunSafely([this, Counter, ScratchPtr, DryRun]() {
Counter->start();
if (!DryRun)
this->Function(ScratchPtr);
Counter->stop();
});
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does DryRunMeasurement supported?

Comment on lines +57 to +59
Benchmark BenchmarkResult;
object::OwningBinary<object::ObjectFile> ObjectFile;

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert. It should remain private

Comment on lines -148 to -158
#else
void ConfiguredEvent::initRealEvent(pid_t ProcessID, const int GroupFD) {}

Expected<SmallVector<int64_t>>
ConfiguredEvent::readOrError(StringRef /*unused*/) const {
return make_error<StringError>("Not implemented",
errc::function_not_supported);
}

ConfiguredEvent::~ConfiguredEvent() = default;
#endif // HAVE_LIBPFM
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really require LIBPFM?

Comment on lines -218 to -243
#else

void CounterGroup::initRealEvent(pid_t ProcessID) {}

void CounterGroup::start() {}

void CounterGroup::stop() {}

Expected<SmallVector<int64_t, 4>>
CounterGroup::readOrError(StringRef /*unused*/) const {
if (IsDummyEvent) {
SmallVector<int64_t, 4> Result;
Result.push_back(42);
return Result;
}
return make_error<StringError>("Not implemented", errc::io_error);
}

Expected<SmallVector<int64_t>>
CounterGroup::readValidationCountersOrError() const {
return SmallVector<int64_t>(0);
}

int CounterGroup::numValues() const { return 1; }

#endif
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really require LIBPFM?

Comment on lines -53 to -56
static cl::opt<int> OpcodeIndex(
"opcode-index",
cl::desc("opcode to measure, by index, or -1 to measure all opcodes"),
cl::cat(BenchmarkOptions), cl::init(0));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert. Use modern option instead same OpcodeIndices

Comment on lines +129 to +133
static cl::opt<std::string>
InputFile(cl::Positional,
cl::desc("Input benchmarks file to resume or snippet file"),
cl::init("-"), cl::cat(Options));

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert as there is modern benchmarks-file option

Comment on lines -115 to +204
static cl::opt<BenchmarkPhaseSelectorE> BenchmarkPhaseSelector(
"benchmark-phase",
cl::desc(
"it is possible to stop the benchmarking process after some phase"),
cl::cat(BenchmarkOptions),
cl::values(
clEnumValN(BenchmarkPhaseSelectorE::PrepareSnippet, "prepare-snippet",
"Only generate the minimal instruction sequence"),
clEnumValN(BenchmarkPhaseSelectorE::PrepareAndAssembleSnippet,
"prepare-and-assemble-snippet",
"Same as prepare-snippet, but also dumps an excerpt of the "
"sequence (hex encoded)"),
clEnumValN(BenchmarkPhaseSelectorE::AssembleMeasuredCode,
"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"),
clEnumValN(
BenchmarkPhaseSelectorE::Measure, "measure",
"Same as prepare-measured-code, but also runs the measurement "
"(default)")),
cl::init(BenchmarkPhaseSelectorE::Measure));
static const auto BenchmarkPhasesOptValues = cl::values(
clEnumValN(BenchmarkPhaseSelectorE::PrepareSnippet, "prepare-snippet",
"Only generate the minimal instruction sequence"),
clEnumValN(BenchmarkPhaseSelectorE::PrepareAndAssembleSnippet,
"prepare-and-assemble-snippet",
"Same as prepare-snippet, but also dumps an excerpt of the "
"sequence (hex encoded)"),
clEnumValN(BenchmarkPhaseSelectorE::AssembleMeasuredCode,
"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"),
clEnumValN(BenchmarkPhaseSelectorE::Measure, "measure",
"Same as prepare-measured-code, but also runs the measurement "
"(default)"));

static cl::opt<BenchmarkPhaseSelectorE>
StopAfter("stop-after-phase",
cl::desc("Stop the benchmarking process after some phase"),
cl::cat(BenchmarkOptions), BenchmarkPhasesOptValues,
cl::init(BenchmarkPhaseSelectorE::Measure));

static cl::alias BenchmarkPhaseSelector("benchmark-phase",
cl::desc("Alias of -stop-after-phase"),
cl::aliasopt(StopAfter));

static cl::opt<BenchmarkPhaseSelectorE> StartBefore(
"start-before-phase",
cl::desc("Resume the benchmarking process before a certain phase"),
cl::cat(BenchmarkOptions), BenchmarkPhasesOptValues,
cl::init(BenchmarkPhaseSelectorE::PrepareSnippet));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Carefully resolve diff: refactored options structure in modern version

Comment on lines +693 to +695
// MERGEME: eliminated code in main.
//std::vector<BenchmarkRunner::RunnableConfiguration> RunnableConfigs;
//SmallVector<unsigned> Repetitions;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MERGEME: does exegesis support repetitions? RunnableConfigs looks like a legacy

Comment on lines -479 to +596
if (BenchmarkPhaseSelector == BenchmarkPhaseSelectorE::Measure &&
!UseDummyPerfCounters) {
#ifndef HAVE_LIBPFM
ExitWithError(
"benchmarking unavailable, LLVM was built without libpfm. You can "
"pass --benchmark-phase=... to skip the actual benchmarking or "
"--use-dummy-perf-counters to not query the kernel for real event "
"counts.");
#else
if (StopAfter == BenchmarkPhaseSelectorE::Measure && !UseDummyPerfCounters) {
#ifdef HAVE_LIBPFM
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

@e1turin e1turin changed the base branch from main to merge/rvv-exegesis February 7, 2025 12:44
@e1turin e1turin changed the title refactoring merge/rvv-exegesis-full Merge preview/rvv-exegesis with main (dirty change history) Feb 8, 2025
@e1turin e1turin force-pushed the merge/rvv-exegesis-full branch from 40aa183 to 147aba3 Compare February 8, 2025 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant