From 4919534ae4d4029982d5a5ad7ea18f4a681cb602 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Tue, 8 Oct 2019 09:06:48 +0000 Subject: [llvm-exegesis] Finish plumbing the `Config` field. Summary: Right now there are no snippet generators that emit the `Config` Field, but I plan to add it to investigate LEA operands for PR32326. What was broken was: - `Config` Was not propagated up until the BenchmarkResult::Key. - Clustering should really consider different configs as measuring different things, so we should stabilize on (Opcode, Config) instead of just Opcode. Reviewers: gchatelet Subscribers: tschuett, llvm-commits, lebedev.ri Tags: #llvm Differential Revision: https://reviews.llvm.org/D68629 llvm-svn: 374031 --- llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp') diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp index 4b541f4d829..da26bc458dc 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -31,7 +31,6 @@ BenchmarkRunner::BenchmarkRunner(const LLVMState &State, BenchmarkRunner::~BenchmarkRunner() = default; - namespace { class FunctionExecutorImpl : public BenchmarkRunner::FunctionExecutor { public: @@ -92,10 +91,9 @@ InstructionBenchmark BenchmarkRunner::runConfiguration( InstrBenchmark.NumRepetitions = NumRepetitions; InstrBenchmark.Info = BC.Info; - const std::vector &Instructions = BC.Instructions; + const std::vector &Instructions = BC.Key.Instructions; - InstrBenchmark.Key.Instructions = Instructions; - InstrBenchmark.Key.RegisterInitialValues = BC.RegisterInitialValues; + InstrBenchmark.Key = BC.Key; // Assemble at least kMinInstructionsForSnippet instructions by repeating the // snippet for debug/analysis. This is so that the user clearly understands @@ -104,10 +102,10 @@ InstructionBenchmark BenchmarkRunner::runConfiguration( { llvm::SmallString<0> Buffer; llvm::raw_svector_ostream OS(Buffer); - assembleToStream( - State.getExegesisTarget(), State.createTargetMachine(), BC.LiveIns, - BC.RegisterInitialValues, - Repetitor.Repeat(BC.Instructions, kMinInstructionsForSnippet), OS); + assembleToStream(State.getExegesisTarget(), State.createTargetMachine(), + BC.LiveIns, BC.Key.RegisterInitialValues, + Repetitor.Repeat(Instructions, kMinInstructionsForSnippet), + OS); const ExecutableFunction EF(State.createTargetMachine(), getObjectFromBuffer(OS.str())); const auto FnBytes = EF.getFunctionBytes(); @@ -117,7 +115,7 @@ InstructionBenchmark BenchmarkRunner::runConfiguration( // Assemble NumRepetitions instructions repetitions of the snippet for // measurements. const auto Filler = - Repetitor.Repeat(BC.Instructions, InstrBenchmark.NumRepetitions); + Repetitor.Repeat(Instructions, InstrBenchmark.NumRepetitions); llvm::object::OwningBinary ObjectFile; if (DumpObjectToDisk) { @@ -133,7 +131,7 @@ InstructionBenchmark BenchmarkRunner::runConfiguration( llvm::SmallString<0> Buffer; llvm::raw_svector_ostream OS(Buffer); assembleToStream(State.getExegesisTarget(), State.createTargetMachine(), - BC.LiveIns, BC.RegisterInitialValues, Filler, OS); + BC.LiveIns, BC.Key.RegisterInitialValues, Filler, OS); ObjectFile = getObjectFromBuffer(OS.str()); } @@ -150,7 +148,7 @@ InstructionBenchmark BenchmarkRunner::runConfiguration( // Scale the measurements by instruction. BM.PerInstructionValue /= InstrBenchmark.NumRepetitions; // Scale the measurements by snippet. - BM.PerSnippetValue *= static_cast(BC.Instructions.size()) / + BM.PerSnippetValue *= static_cast(Instructions.size()) / InstrBenchmark.NumRepetitions; } @@ -167,7 +165,7 @@ BenchmarkRunner::writeObjectFile(const BenchmarkCode &BC, return std::move(E); llvm::raw_fd_ostream OFS(ResultFD, true /*ShouldClose*/); assembleToStream(State.getExegesisTarget(), State.createTargetMachine(), - BC.LiveIns, BC.RegisterInitialValues, FillFunction, OFS); + BC.LiveIns, BC.Key.RegisterInitialValues, FillFunction, OFS); return ResultPath.str(); } -- cgit v1.2.3