[llvm] ca8dbdc - [llvm-exegesis] Add error for subprocess and dummy perf counters

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 12:34:58 PDT 2023


Author: Aiden Grossman
Date: 2023-09-05T12:34:26-07:00
New Revision: ca8dbdc12a72c35fc1832476c5d5836058ae224c

URL: https://github.com/llvm/llvm-project/commit/ca8dbdc12a72c35fc1832476c5d5836058ae224c
DIFF: https://github.com/llvm/llvm-project/commit/ca8dbdc12a72c35fc1832476c5d5836058ae224c.diff

LOG: [llvm-exegesis] Add error for subprocess and dummy perf counters

When using the subprocess execution mode and dummy perf counters
currently, cryptic errors will be printed out related to not being able
to send the file descriptor through a socket. This patch prints out an
explicit message that this configuration isn't (currently) supported.

Reviewed By: courbet

Differential Revision: https://reviews.llvm.org/D157686

Added: 
    llvm/test/tools/llvm-exegesis/X86/dummy-perf-counters-subprocess.s

Modified: 
    llvm/tools/llvm-exegesis/llvm-exegesis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-exegesis/X86/dummy-perf-counters-subprocess.s b/llvm/test/tools/llvm-exegesis/X86/dummy-perf-counters-subprocess.s
new file mode 100644
index 000000000000000..d810d697ca2735e
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/X86/dummy-perf-counters-subprocess.s
@@ -0,0 +1,7 @@
+# REQUIRES: exegesis-can-measure-latency, x86_64-linux
+
+# RUN: not llvm-exegesis -mtriple=x86_64-unknown-unknown -mode=latency -snippets-file=%s -execution-mode=subprocess -use-dummy-perf-counters 2>&1 | FileCheck %s
+
+# CHECK: llvm-exegesis error: Dummy perf counters are not supported in the subprocess execution mode.
+
+mov $0, %rax

diff  --git a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
index 7d2ce010bd74940..774e54ffe8b6fe7 100644
--- a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
+++ b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
@@ -477,6 +477,11 @@ void benchmarkMain() {
   if (BenchmarkPhaseSelector == BenchmarkPhaseSelectorE::Measure)
     ExitOnErr(State.getExegesisTarget().checkFeatureSupport());
 
+  if (ExecutionMode == BenchmarkRunner::ExecutionModeE::SubProcess &&
+      UseDummyPerfCounters)
+    ExitWithError("Dummy perf counters are not supported in the subprocess "
+                  "execution mode.");
+
   const std::unique_ptr<BenchmarkRunner> Runner =
       ExitOnErr(State.getExegesisTarget().createBenchmarkRunner(
           BenchmarkMode, State, BenchmarkPhaseSelector, ExecutionMode,


        


More information about the llvm-commits mailing list