diff options
| author | Clement Courbet <courbet@google.com> | 2019-10-08 09:06:48 +0000 |
|---|---|---|
| committer | Clement Courbet <courbet@google.com> | 2019-10-08 09:06:48 +0000 |
| commit | 4919534ae4d4029982d5a5ad7ea18f4a681cb602 (patch) | |
| tree | 48b231dd73467e5fd83334eada5a12d130dea598 /llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp | |
| parent | c41294705bbb9457524df91c525d53ade53b304a (diff) | |
| download | bcm5719-llvm-4919534ae4d4029982d5a5ad7ea18f4a681cb602.tar.gz bcm5719-llvm-4919534ae4d4029982d5a5ad7ea18f4a681cb602.zip | |
[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
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp')
| -rw-r--r-- | llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
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<llvm::MCInst> &Instructions = BC.Instructions; + const std::vector<llvm::MCInst> &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<llvm::object::ObjectFile> 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<double>(BC.Instructions.size()) / + BM.PerSnippetValue *= static_cast<double>(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(); } |

