summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-exegesis][NFC] Remove extra `llvm::` qualifications.Clement Courbet2019-10-091-27/+26
| | | | | | | | | | | | | | Summary: Second patch: in the lib. Reviewers: gchatelet Subscribers: nemanjai, tschuett, MaskRay, mgrang, jsji, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68692 llvm-svn: 374158
* [llvm-exegesis] Finish plumbing the `Config` field.Clement Courbet2019-10-081-12/+10
| | | | | | | | | | | | | | | | | | | | | | 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-exegesis][NFC] Move BenchmarkFailure to own file.Clement Courbet2019-09-301-5/+2
| | | | | | | | | | | | | | Summary: And rename to exegesis::Failure, as it's used everytwhere. Reviewers: gchatelet Subscribers: tschuett, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68217 llvm-svn: 373209
* [llvm-exegesis] Add loop mode for repeating the snippet.Clement Courbet2019-09-271-23/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Before this change the Executable function was made by duplicating the snippet. This change adds a --repetion-mode={loop|duplicate} flag that allows choosing between this behaviour and wrapping the snippet instructions in a loop. The new mode can help measurements when the snippet fits in the DSB by short-cirtcuiting decoding. The loop adds a dec + jmp to the measurements, but since these are not part of the critical path, they execute in parallel with the measured code and do not impact measurements in practice. Overview of the change: - New SnippetRepetitor abstraction that handles repeating the snippet. The assembler delegates repeating the instructions to this class. - ExegesisTarget learns how to decrement loop counter and jump. - Some refactoring of the assembler into FunctionFiller/BasicBlockFiller. Reviewers: gchatelet Subscribers: mgorny, tschuett, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68125 llvm-svn: 373083
* [llvm] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-151-1/+1
| | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
* [llvm-exegesis] BenchmarkRunner::runConfiguration(): write small snippet to ↵Roman Lebedev2019-05-071-7/+6
| | | | | | | | | | | | | memory It was previously writing this temporary snippet to file, then reading it back, but leaving the tmp file in place. This is both unefficient, and results in huge garbage pileup in /tmp. One would have thought it would have been caught during D60317.. llvm-svn: 360138
* Add an option do not dump the generated object on diskGuillaume Chatelet2019-04-051-11/+25
| | | | | | | | | | | | Reviewers: courbet Subscribers: llvm-commits, bdb Tags: #llvm Differential Revision: https://reviews.llvm.org/D60317 llvm-svn: 357769
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Revert "[llvm-exegesis] Add a snippet generator to generate snippets to ↵Clement Courbet2018-11-081-1/+1
| | | | | | | | compute ROB sizes." This reverts accidental commit rL346394. llvm-svn: 346398
* [llvm-exegesis] Add a snippet generator to generate snippets to compute ROB ↵Clement Courbet2018-11-081-1/+1
| | | | | | sizes. llvm-svn: 346394
* [llvm-exegesis] Fix SNB counter definition and handling.Clement Courbet2018-10-281-3/+4
| | | | | | | | | | | | Summary: SNB is the only one that has P23 as a single proc res. Reviewers: gchatelet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D53766 llvm-svn: 345480
* [llvm-exegesis] Fix name lookup ambiguity in MSVC after 344922Fangrui Song2018-10-221-1/+1
| | | | llvm-svn: 344927
* [llvm-exegesis] Move namespace exegesis inside llvm::Fangrui Song2018-10-221-0/+2
| | | | | | | | | | | | | | | | Summary: This allows simplifying references of llvm::foo with foo when the needs come in the future. Reviewers: courbet, gchatelet Reviewed By: gchatelet Subscribers: javed.absar, tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D53455 llvm-svn: 344922
* [llvm-exegesis] Allow measuring several instructions in a single run.Clement Courbet2018-10-171-4/+61
| | | | | | | | | | | | | | | | Summary: We try to recover gracefully on instructions that would crash the program. This includes some refactoring of runMeasurement() implementations. Reviewers: gchatelet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D53371 llvm-svn: 344695
* [llvm-exegesis] Output the unscaled value as well as the scaled one.Clement Courbet2018-09-261-1/+9
| | | | | | | | | | | | Summary: See PR38936 for context. Reviewers: gchatelet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D52500 llvm-svn: 343081
* [llvm-exegesis] Serializes registers initial values.Guillaume Chatelet2018-09-251-0/+1
| | | | | | | | | | | | Summary: Adds the registers initial values to the YAML output of llvm-exegesis. Reviewers: courbet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D52460 llvm-svn: 342982
* [llvm-exegesis] Add lit tests (v2).Clement Courbet2018-09-251-4/+2
| | | | | | | | | | | | Summary: This revisits rL342953 by adding detection of host support. Reviewers: gchatelet, lebedev.ri, alexshap Subscribers: mgorny, tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D52464 llvm-svn: 342975
* [llvm-exegesis] Allow benchmarking arbitrary code snippets.Clement Courbet2018-09-251-3/+3
| | | | | | | | | | | | | | | | | Summary: This is a step towards fixing PR38048. Note that right now the measurements are given per instruction. We'll need to give measurements a per code snippet and update the analysis (PR38731). Reviewers: gchatelet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D52041 llvm-svn: 342947
* [llvm-exegesis] Improve Register Setup (roll forward of D51856).Guillaume Chatelet2018-09-201-1/+1
| | | | | | | | | | | | | | Summary: Added function to set a register to a particular value + tests. Add EFLAGS test, use new setRegTo instead of setRegToConstant. Reviewers: courbet, javed.absar Subscribers: llvm-commits, tschuett, mgorny Differential Revision: https://reviews.llvm.org/D52297 llvm-svn: 342644
* Revert rL342466: [llvm-exegesis] Improve Register Setup.Simon Pilgrim2018-09-181-1/+1
| | | | | | | | | | | | | | | | rL342465 is breaking the MSVC buildbots, but I need to revert this dependent revision as well. Summary: Added function to set a register to a particular value + tests. Add EFLAGS test, use new setRegTo instead of setRegToConstant. Reviewers: courbet, javed.absar Subscribers: mgorny, tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D51856 llvm-svn: 342489
* [llvm-exegesis] Improve Register Setup.Guillaume Chatelet2018-09-181-1/+1
| | | | | | | | | | | | | | Summary: Added function to set a register to a particular value + tests. Add EFLAGS test, use new setRegTo instead of setRegToConstant. Reviewers: courbet, javed.absar Subscribers: mgorny, tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D51856 llvm-svn: 342466
* [llvm-exegesis][NFC] Split BenchmarkRunner classClement Courbet2018-09-131-125/+1
| | | | | | | | | | | | | | | Summary: The snippet-generation part goes to the SnippetGenerator class. This will allow benchmarking arbitrary code (see PR38437). Reviewers: gchatelet Subscribers: mgorny, tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D51979 llvm-svn: 342117
* [llvm-exegesis][NFC]Remove dead function parameterClement Courbet2018-09-121-2/+2
| | | | llvm-svn: 342035
* [llvm-exegesis] Renaming classes and functions.Guillaume Chatelet2018-08-031-61/+61
| | | | | | | | | | | | Summary: Functional No Op. Reviewers: gchatelet Subscribers: tschuett, courbet, llvm-commits Differential Revision: https://reviews.llvm.org/D50231 llvm-svn: 338836
* [llvm-exegesis] Rename InstructionInstance into InstructionBuilder.Guillaume Chatelet2018-08-021-14/+14
| | | | | | | | | | Summary: Non functional change. Subscribers: tschuett, courbet, llvm-commits Differential Revision: https://reviews.llvm.org/D50176 llvm-svn: 338701
* [llvm-exegesis] Provide a way to handle memory instructions.Guillaume Chatelet2018-08-011-9/+15
| | | | | | | | | | | | | | | | | Summary: And implement memory instructions on X86. This fixes PR36906. Reviewers: gchatelet Reviewed By: gchatelet Subscribers: lebedev.ri, filcab, mgorny, tschuett, RKSimon, llvm-commits Differential Revision: https://reviews.llvm.org/D48935 llvm-svn: 338567
* [llvm-exegesis] Add uop computation for more X87 instruction classes.Clement Courbet2018-07-051-2/+11
| | | | | | | | | | | | | | Summary: This allows measuring comparisons (UCOM_FpIr32,UCOM_Fpr32,...), conditional moves (CMOVBE_Fp32,...) Reviewers: gchatelet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48713 llvm-svn: 336352
* [llvm-exegesis] Add partial X87 support.Clement Courbet2018-06-281-0/+21
| | | | | | | | | | | | | | Summary: This enables the X86-specific X86FloatingPointStackifierPass, and allow llvm-exegesis to generate and measure X87 latency/uops for some FP ops. Reviewers: gchatelet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48592 llvm-svn: 335815
* [llvm-exegesis] Get the BenchmarkRunner from the ExegesisTarget.Clement Courbet2018-06-261-12/+15
| | | | | | | | | | | | | | | Summary: This allows targets to override code generation for some instructions. As an example of override, this also moves ad-hoc instruction filtering for X86 into the X86 ExegesisTarget. Reviewers: gchatelet Subscribers: mgorny, tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48587 llvm-svn: 335582
* [llvm-exegesis][NFC] Remove unnecessary member variables.Clement Courbet2018-06-251-3/+2
| | | | llvm-svn: 335470
* [llvm-exegesis] Generate snippet setup code.Clement Courbet2018-06-251-9/+58
| | | | | | | | | | | | | | | Summary: This ensures that the snippet always sees the same values for registers, making measurements reproducible. This will also allow exploring different values. Reviewers: gchatelet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48542 llvm-svn: 335465
* [llvm-exegesis][NFC] Simplify BenchmarkRunner ctor.Clement Courbet2018-06-251-2/+1
| | | | llvm-svn: 335456
* [llvm-exegesis][NFC] clang-formatClement Courbet2018-06-251-6/+6
| | | | llvm-svn: 335452
* [llvm-exegesis][NFC] Simplify BenchmarkRunner.Clement Courbet2018-06-211-21/+12
| | | | | | Get rid of createExecutableFunction(). llvm-svn: 335240
* [llvm-exegesis][NFC] Simplify LLVMState.Clement Courbet2018-06-211-2/+3
| | | | | | | | | | | | Summary: Pretty much everything we need is in llvm::TargetMachine. Reviewers: gchatelet Subscribers: llvm-commits, tschuett Differential Revision: https://reviews.llvm.org/D48428 llvm-svn: 335237
* [llvm-exegesis] Use a Prototype to defer picking a value for free vars.Guillaume Chatelet2018-06-201-1/+15
| | | | | | | | | | | | Summary: Introducing a Prototype object to capture Variables that must be set but keeps degrees of freedom as Invalid. This allows exploring non constraint variables later on. Reviewers: courbet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48316 llvm-svn: 335105
* [llvm-exegesis] Print the whole snippet in analysis.Clement Courbet2018-06-151-14/+44
| | | | | | | | | | | | | | | | | Summary: On hover, the whole asm snippet is displayed, including operands. This requires the actual assembly output instead of just the MCInsts: This is because some pseudo-instructions get lowered to actual target instructions during codegen (e.g. ABS_Fp32 -> SSE or X87). Reviewers: gchatelet Subscribers: mgorny, tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48164 llvm-svn: 334805
* [llvm-exegesis] Use BenchmarkResult::Instructions instead of OpcodeNameClement Courbet2018-06-141-1/+0
| | | | | | | | | | | | | | | | | | Summary: Get rid of OpcodeName. To remove the opcode name from an old file: ``` cat old_file | sed '/opcode_name.*/d' ``` Reviewers: gchatelet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48121 llvm-svn: 334691
* [llvm-exegesis] Cleaner design without mutable data.Guillaume Chatelet2018-06-131-3/+5
| | | | | | | | | | | | Summary: Previous design was relying on the 'mutate' keyword and was quite confusing. This version separate mutable from immutable data and makes it clearer what changes and what doesn't. Reviewers: courbet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48020 llvm-svn: 334596
* [llvm-exegesis] Make BenchmarkRunner handle multiple configurations.Guillaume Chatelet2018-06-071-28/+31
| | | | | | | | | | | | Summary: BenchmarkRunner subclasses can now create many configurations - although this patch still generates one. Reviewers: courbet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D47877 llvm-svn: 334197
* [llvm-exegesis] Add a Configuration object for Benchmark.Guillaume Chatelet2018-06-071-4/+5
| | | | | | | | | | | | Summary: This is the first step to have the BenchmarkRunner create and measure many different configurations (different initial values for instance). Reviewers: courbet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D47826 llvm-svn: 334169
* [llvm-exegesis] Serializes instruction's operand in BenchmarkResult's key.Guillaume Chatelet2018-06-071-1/+3
| | | | | | | | | | | | Summary: Follow up patch to https://reviews.llvm.org/D47764. Reviewers: courbet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D47785 llvm-svn: 334165
* [llvm-exegesis] move Mode from Key to BenchmarResult.Clement Courbet2018-06-061-1/+1
| | | | | | | | | | | | | | | | | | Moves the Mode field out of the Key. The existing yaml benchmark results can be fixed with the following script: ``` readonly FILE=$1 readonly MODE=latency # Change to uops to fix a uops benchmark. cat $FILE | \ sed "/^\ \+mode:\ \+$MODE$/d" | \ sed "/^cpu_name.*$/i mode: $MODE" ``` Differential Revision: https://reviews.llvm.org/D47813 Authored by: Guillaume Chatelet llvm-svn: 334079
* [llvm-exegesis][NFC] Use an enum instead of a string for benchmark mode.Clement Courbet2018-06-041-1/+1
| | | | | | | | | | | | Summary: YAML encoding is backwards-compatible. Reviewers: gchatelet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D47705 llvm-svn: 333886
* reland r332579: [llvm-exegesis] Update to cover latency through another opcode.Clement Courbet2018-05-171-29/+59
| | | | | | | | | | | | | | Restructuring the code to measure latency and uops. The end goal is to have this program spawn another process to deal with SIGILL and other malformed programs. It is not yet the case in this redesign, it is still the main program that runs the code (and may crash). It now uses BitVector instead of Graph for performance reasons. https://reviews.llvm.org/D46821 (with fixed ARM tests) Authored by Guillaume Chatelet llvm-svn: 332592
* Revert r332579 "[llvm-exegesis] Update to cover latency through another opcode."Clement Courbet2018-05-171-59/+29
| | | | | | The revision failed to update the ARM tests. llvm-svn: 332580
* [llvm-exegesis] Update to cover latency through another opcode.Clement Courbet2018-05-171-29/+59
| | | | | | | | | | | | Restructuring the code to measure latency and uops. The end goal is to have this program spawn another process to deal with SIGILL and other malformed programs. It is not yet the case in this redesign, it is still the main program that runs the code (and may crash). It now uses BitVector instead of Graph for performance reasons. https://reviews.llvm.org/D46821 Authored by Guillaume Chatelet llvm-svn: 332579
* [llvm-exegesis] Split AsmTemplate.Name into components.Clement Courbet2018-05-151-5/+2
| | | | | | | | | | | | | | Summary: AsmTemplate becomes IntructionBenchmarkKey, which has three components. This allows retreiving the opcode for analysis. Reviewers: gchatelet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D46873 llvm-svn: 332348
* Re-land r329156 "Add llvm-exegesis tool."Clement Courbet2018-04-041-0/+79
| | | | | | Fixed to depend on and initialize the native target instead of X86. llvm-svn: 329169
* Revert r329156 "Add llvm-exegesis tool."Clement Courbet2018-04-041-79/+0
| | | | | | Breaks a bunch of bots. llvm-svn: 329157
OpenPOWER on IntegriCloud