https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/74211
This patch adjust the runConfiguration function to allow passing a parameter to force returning SnippetCrashes as errors rather than serializing them as strings in the returned Benchmark object. In addition, this patch adds a getter for the signal information address in the SnippetCrash object. These are both needed to allow for downstream consumption of the exegesis library within Gematria. >From 2bddb1011489651cb2e5f2f94d5fae89ddf63216 Mon Sep 17 00:00:00 2001 From: Aiden Grossman <agrossman...@yahoo.com> Date: Sat, 2 Dec 2023 14:18:50 -0800 Subject: [PATCH] [llvm-exegesis] Minor changes for downstream consumers This patch adjust the runConfiguration function to allow passing a parameter to force returning SnippetCrashes as errors rather than serializing them as strings in the returned Benchmark object. In addition, this patch adds a getter for the signal information address in the SnippetCrash object. These are both needed to allow for downstream consumption of the exegesis library within Gematria. --- llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp | 7 ++++--- llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h | 6 +++--- llvm/tools/llvm-exegesis/lib/Error.h | 2 ++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp index f5d73a8bd6a31..51c9c6cd09358 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -545,9 +545,10 @@ BenchmarkRunner::createFunctionExecutor( llvm_unreachable("ExecutionMode is outside expected range"); } -Expected<Benchmark> BenchmarkRunner::runConfiguration( - RunnableConfiguration &&RC, - const std::optional<StringRef> &DumpFile) const { +Expected<Benchmark> +BenchmarkRunner::runConfiguration(RunnableConfiguration &&RC, + const std::optional<StringRef> &DumpFile, + bool ErrorOnSnippetCrash /*= false*/) const { Benchmark &InstrBenchmark = RC.InstrBenchmark; object::OwningBinary<object::ObjectFile> &ObjectFile = RC.ObjectFile; diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h index 24f2086289408..eb8c9f55722ca 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h @@ -65,9 +65,9 @@ class BenchmarkRunner { unsigned NumRepetitions, unsigned LoopUnrollFactor, const SnippetRepetitor &Repetitor) const; - Expected<Benchmark> - runConfiguration(RunnableConfiguration &&RC, - const std::optional<StringRef> &DumpFile) const; + Expected<Benchmark> runConfiguration(RunnableConfiguration &&RC, + const std::optional<StringRef> &DumpFile, + bool ErrorOnSnippetCrash = false) const; // Scratch space to run instructions that touch memory. struct ScratchSpace { diff --git a/llvm/tools/llvm-exegesis/lib/Error.h b/llvm/tools/llvm-exegesis/lib/Error.h index 8d3f394ed8d6e..8c95439d63ac6 100644 --- a/llvm/tools/llvm-exegesis/lib/Error.h +++ b/llvm/tools/llvm-exegesis/lib/Error.h @@ -52,6 +52,8 @@ class SnippetCrash : public ErrorInfo<SnippetCrash> { std::error_code convertToErrorCode() const override; + intptr_t GetCrashAddress() const { return SIAddress; } + private: std::string Msg; intptr_t SIAddress; _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits