This is an archive of the discontinued LLVM Phabricator instance.

[llvm-exegesis] Allow measuring several instructions in a single run.
ClosedPublic

Authored by courbet on Oct 17 2018, 6:24 AM.

Details

Summary

We try to recover gracefully on instructions that would crash the
program.

This includes some refactoring of runMeasurement() implementations.

Diff Detail

Repository
rL LLVM

Event Timeline

courbet created this revision.Oct 17 2018, 6:24 AM
courbet updated this revision to Diff 169999.Oct 17 2018, 6:26 AM

revert debug code

How do you plan to deal with opcodes that crash (assertion failure) the llvm as a whole?
I.e. not when the snippet crashes, but the generation of the snippet itself crashes.
I *believe* there are some cases.

How do you plan to deal with opcodes that crash (assertion failure) the llvm as a whole?
I.e. not when the snippet crashes, but the generation of the snippet itself crashes.
I *believe* there are some cases.

We were looking at those as I speak. The plan is to not crash :)

tools/llvm-exegesis/lib/BenchmarkRunner.cpp
59 ↗(On Diff #169999)

This is not very useful, is it?

63 ↗(On Diff #169999)

Probably more than 2 counter names.

77 ↗(On Diff #169999)

As discussed, lets store the result in a bool and return after the state is restored

CrashRecoveryContext CRC;
CrashRecoveryContext::Enable();
Counter.start();
const bool IsSuccess = CRC.RunSafely(...
Counter.stop();
CrashRecoveryContext::Disable();
if(!IsSuccess) return ....

How do you plan to deal with opcodes that crash (assertion failure) the llvm as a whole?
I.e. not when the snippet crashes, but the generation of the snippet itself crashes.
I *believe* there are some cases.

We were looking at those as I speak. The plan is to not crash :)

Ok, sounds great :)

courbet updated this revision to Diff 170003.Oct 17 2018, 7:04 AM

address comments.

courbet marked 2 inline comments as done.Oct 17 2018, 7:08 AM
courbet added inline comments.
tools/llvm-exegesis/lib/BenchmarkRunner.cpp
63 ↗(On Diff #169999)

The current max is 2, for SNB.

gchatelet added inline comments.Oct 17 2018, 7:18 AM
tools/llvm-exegesis/lib/BenchmarkRunner.cpp
58 ↗(On Diff #169999)

Return an int64_t here.

tools/llvm-exegesis/lib/Latency.cpp
91 ↗(On Diff #169999)

Can you please rename MinLatency to MinValue?

96 ↗(On Diff #169999)

ExpectedCounterValue? so it's easier to understand the next lines

97 ↗(On Diff #169999)

remove the braces

101 ↗(On Diff #169999)

Now you don't need to cast anymore.

tools/llvm-exegesis/lib/Uops.cpp
236 ↗(On Diff #169999)

remove the braces

245 ↗(On Diff #169999)

ditto

tools/llvm-exegesis/llvm-exegesis.cpp
121 ↗(On Diff #169999)

Let's go with a for loop so it's easier to reason about the last element.

125 ↗(On Diff #169999)

can you specify the lambda return type so it's explicit.

courbet updated this revision to Diff 170005.Oct 17 2018, 7:24 AM
courbet marked 9 inline comments as done.

address comments

gchatelet accepted this revision.Oct 17 2018, 7:32 AM
This revision is now accepted and ready to land.Oct 17 2018, 7:32 AM
courbet updated this revision to Diff 170008.Oct 17 2018, 7:55 AM

Start/stop the counter inside the lambda to avoid measuring events from RunSafely().

This revision was automatically updated to reflect the committed changes.