[PATCH] D53371: [llvm-exegesis] Allow measuring several instructions in a single run.

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 17 06:46:44 PDT 2018


gchatelet added a comment.

In https://reviews.llvm.org/D53371#1267732, @lebedev.ri wrote:

> 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** :)



================
Comment at: tools/llvm-exegesis/lib/BenchmarkRunner.cpp:59
+  llvm::Expected<double> runAndMeasure(const char *Counters) const override {
+    using llvm::CrashRecoveryContext;
+    // We sum counts when there are several counters for a single ProcRes
----------------
This is not very useful, is it?


================
Comment at: tools/llvm-exegesis/lib/BenchmarkRunner.cpp:63
+    int64_t CounterValue = 0;
+    llvm::SmallVector<llvm::StringRef, 2> CounterNames;
+    llvm::StringRef(Counters).split(CounterNames, ',');
----------------
Probably more than 2 counter names.


================
Comment at: tools/llvm-exegesis/lib/BenchmarkRunner.cpp:77
+        Counter.start();
+        if (!CRC.RunSafely([this, ScratchPtr]() { Function(ScratchPtr); })) {
+          // FIXME: Better diagnosis.
----------------
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 ....

```


Repository:
  rL LLVM

https://reviews.llvm.org/D53371





More information about the llvm-commits mailing list