This is an archive of the discontinued LLVM Phabricator instance.

[exegesis] Benchmark: provide optional progress meter / ETA
ClosedPublic

Authored by lebedev.ri on Dec 11 2022, 12:44 PM.

Details

Summary

Now that --opcode-index=-1 is mostly stable,
and i can migrate off of my custom tooling that emulated it,
there comes a bit of confusion as to the status of the run.

It is normal for the single all-opcode run to take ~3 minutes,
and it's a bit more than one can be comfortable with,
without having some sort of visual indication of the progress.

Thus, i present:

$ ./bin/llvm-exegesis -mode=inverse_throughput --opcode-index=-1 --benchmarks-file=/dev/null --dump-object-to-disk=0 --measurements-print-progress --skip-measurements
<...>
XAM_Fp80: unsupported opcode: pseudo instruction
XBEGIN: Unsupported opcode: isPseudo/usesCustomInserter
XBEGIN_2: Unsupported opcode: isBranch/isIndirectBranch
XBEGIN_4: Unsupported opcode: isBranch/isIndirectBranch
XCH_F: unsupported second-form X87 instruction
Processing...   1%, ETA 02:10
Processing...   2%, ETA 02:03
Processing...   3%, ETA 02:00
Processing...   4%, ETA 01:57
Processing...   5%, ETA 01:54
Processing...   6%, ETA 01:53
Processing...   7%, ETA 01:51
Processing...   8%, ETA 01:50
Processing...   9%, ETA 01:49
Processing...  10%, ETA 01:48
Processing...  11%, ETA 01:46
Processing...  12%, ETA 01:45
Processing...  13%, ETA 01:44
Processing...  14%, ETA 01:43
Processing...  15%, ETA 01:42
Processing...  16%, ETA 01:42
Processing...  17%, ETA 01:41

As usual, the ETA estimation is statically-insignificant,
and is a lie/does not converge at least until 50% through.
It would be nice to have an actual progress indicator like in LIT,
but i'm not sure we have such a luxury in C++ form in LLVM codebase already.

Diff Detail

Event Timeline

lebedev.ri created this revision.Dec 11 2022, 12:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 11 2022, 12:44 PM
Herald added a subscriber: mstojanovic. · View Herald Transcript
lebedev.ri requested review of this revision.Dec 11 2022, 12:44 PM

s/RunningAverage/SimpleMovingAverage/

Now with a test.

Did find you found this one:
https://reviews.llvm.org/D38416

I'm wary of patch feature creep and *exceptionally* wary of review sluggishness.
I don't think we are not allowed to add something to a subtool even it it would fit into elsewhere.

Did find you found this one:
https://reviews.llvm.org/D38416

I'm wary of patch feature creep and *exceptionally* wary of review sluggishness.
I don't think we are not allowed to add something to a subtool even it it would fit into elsewhere.

Agreed - better to keep this inside exegesis until someone actually needs it someplace else - as long as the only exegesis dependency is the namespace it should be easier enough to move to Support (and change the namespace then),

courbet added inline comments.Dec 12 2022, 3:52 AM
llvm/tools/llvm-exegesis/lib/ProgressMeter.h
21

Please add a small descriptove comment so that one doe snot have to read the code, somehting like:

// Represents `\sum_{i=1..accumulated}{step_i} / accumulated`, where `step_i` is the value passed to the `i`-th call to `step()`, and `accumulated` is the total number of calls to `step()`.
42

Any reason not to inline this (and other members) ? That's a lot of repeated typing.

courbet added inline comments.Dec 12 2022, 3:54 AM
llvm/unittests/tools/llvm-exegesis/ProgressMeterTest.cpp
25

?

31

[nit] at top level, I this this would be better as a function rather than a variable of lambda type:

auto Pt(int i) {return PreprogrammedClock::time_point(PreprogrammedClock::duration(i)); }
courbet added inline comments.Dec 12 2022, 4:02 AM
llvm/tools/llvm-exegesis/lib/ProgressMeter.h
61

You should define what getAverage is when step() has never been called rather then crash here. Ar at least assert explicitly.

126

assert(NumStepsTotal > 0);

140–141

You're not using Unaccounted afterwards, so:

int Seconds = Unaccounted % 60;
int Minutes = Unaccounted / 60;
lebedev.ri marked 7 inline comments as done.

Thanks for taking a look!
Addressing review notes.

courbet accepted this revision.Dec 13 2022, 12:09 AM
This revision is now accepted and ready to land.Dec 13 2022, 12:09 AM

@courbet thank you for the review!