34 Commits

Author SHA1 Message Date
Fangrui Song
9fda99d1e5 [llvm-exegesis] Remove unused headers and fix naming issues
Reviewers: courbet

Reviewed By: courbet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343177 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 06:10:15 +00:00
Guillaume Chatelet
f8d595349c [llvm-exegesis][NFC] Rewrite of the YAML serialization.
Summary: This is a NFC in preparation of exporting the initial registers as part of the YAML dump

Reviewers: courbet

Reviewed By: courbet

Subscribers: mgorny, tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342967 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-25 12:18:08 +00:00
Clement Courbet
956d5f3258 [llvm-exegesis] Allow benchmarking arbitrary code snippets.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342947 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-25 07:31:44 +00:00
Clement Courbet
198fe03a30 [llvm-exegesis][NFC] Remove dead parameter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342118 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-13 08:06:29 +00:00
Clement Courbet
0f8c605133 [llvm-exegesis][NFC] Split BenchmarkRunner class
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342117 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-13 07:40:53 +00:00
John Brawn
3fc11a82d1 [llvm-exegesis] Delegate the decision of cycle counter name to the target
Currently the cycle counter is taken from the subtarget schedule model, which
isn't any use if the subtarget doesn't have one. Delegate the decision to the
target benchmark runner, as it may know better what to do in that case, with
the default being the current behaviour.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336099 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-02 13:14:49 +00:00
Clement Courbet
d6bc0c7274 [llvm-exegesis] Get the BenchmarkRunner from the ExegesisTarget.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335582 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 08:49:30 +00:00
Clement Courbet
41d0646d59 Re-land r335038 "[llvm-exegesis] A mechanism to add target-specific functionality.""
Fix typo: LLVM_NATIVE_ARCH -> LLVM_EXEGESIS_NATIVE_ARCH.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335041 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-19 11:28:59 +00:00
Clement Courbet
0dae1a0252 Revert r335038 "[llvm-exegesis] A mechanism to add target-specific functionality."
Breaks buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335040 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-19 10:54:12 +00:00
Clement Courbet
fdc767cc01 [llvm-exegesis] A mechanism to add target-specific functionality.
Summary: This is a step towards implementing memory operands and X87.

Reviewers: gchatelet

Subscribers: mgorny, tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335038 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-19 10:39:50 +00:00
Clement Courbet
288479f35c [llvm-exegesis] Optionally ignore instructions without a sched class.
Summary: See PR37602.

Reviewers: RKSimon

Subscribers: llvm-commits, tschuett

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334932 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-18 11:27:47 +00:00
Clement Courbet
480c306fdd [llvm-exegesis] Print the whole snippet in analysis.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334805 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-15 07:30:45 +00:00
Guillaume Chatelet
582e5dd555 [llvm-exegesis] Fix unhandled error.
Summary: Fixing an unhandled error when calling writeYaml.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334405 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-11 14:10:10 +00:00
Guillaume Chatelet
e0003ef72c [llvm-exegesis] Program should succeed if benchmark returns StringError.
Summary: Fix for https://bugs.llvm.org/show_bug.cgi?id=37759.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334395 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-11 09:18:01 +00:00
Zachary Turner
03bcb2143b [FileSystem] Split up the OpenFlags enumeration.
This breaks the OpenFlags enumeration into two separate
enumerations: OpenFlags and CreationDisposition.  The first
controls the behavior of the API depending on whether or not
the target file already exists, and is not a flags-based
enum.  The second controls more flags-like values.

This yields a more easy to understand API, while also allowing
flags to be passed to the openForRead api, where most of the
values didn't make sense before.  This also makes the apis more
testable as it becomes easy to enumerate all the configurations
which make sense, so I've added many new tests to exercise all
the different values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334221 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07 19:58:58 +00:00
Guillaume Chatelet
9c8bd216eb [llvm-exegesis] Make BenchmarkRunner handle multiple configurations.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334197 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07 14:00:29 +00:00
Guillaume Chatelet
184b9569f9 [llvm-exegesis] Improve error reporting.
Summary: BenchmarkResult IO functions now return an Error or Expected so caller can deal take proper action.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334167 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07 07:51:16 +00:00
Clement Courbet
bed775073b [llvm-exegesis] Add instructions to BenchmarkResult Key.
We want llvm-exegesis to explore instructions (effect of initial register values, effect of operand selection). To enable this a BenchmarkResult muststore all the relevant data in its key. This patch starts adding such data. Here we simply allow to store the generated instructions, following patches will add operands and initial values for registers.

https://reviews.llvm.org/D47764

Authored by: Guilluame Chatelet

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334008 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-05 10:56:19 +00:00
Clement Courbet
2652053345 [llvm-exegesis] Improve documentation.
Summary:
- Better flag names.
- Fix flag reference in doc.
- Add usage examples in doc.

Fixes PR37497.

Reviewers: gchatelet

Subscribers: llvm-commits, tschuett

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332708 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18 12:33:57 +00:00
Clement Courbet
0ade31e6a1 [llvm-exegesis] Write out inconsistencies to a file.
Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332608 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 13:41:28 +00:00
Clement Courbet
1e03426310 [llvm-exegesis] Analysis: detect clustering inconsistencies.
Summary:
Warn on instructions that should have the same performance
characteristics according to the sched model but actually
differ in their benchmarks.

Next step: Make the display nicer to browse, I was thinking maybe html.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332601 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 12:25:18 +00:00
Clement Courbet
4f11b743f4 reland r332579: [llvm-exegesis] Update to cover latency through another opcode.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332592 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 10:52:18 +00:00
Clement Courbet
9bb99f85e4 Revert r332579 "[llvm-exegesis] Update to cover latency through another opcode."
The revision failed to update the ARM tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332580 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 08:12:29 +00:00
Clement Courbet
33d415b159 [llvm-exegesis] Update to cover latency through another opcode.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332579 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 07:38:21 +00:00
Clement Courbet
3f4a74f3e5 [llvm-exegesis] Add a flag to output analysis csv to a file.
Reviewers: gchatelet

Subscribers: llvm-commits, tschuett

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332445 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 09:50:04 +00:00
Clement Courbet
13a2d87d4d [llvm-exegesis] Analysis: Display sched class for instructions.
Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332437 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 08:47:21 +00:00
Clement Courbet
ea4e63b33c Fix r332344: only the native target is linked.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332345 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 12:27:36 +00:00
Clement Courbet
fc0362a3f2 [llvm-exegesis] Add an analysis mode.
Summary:
The analysis mode gives the user a clustered view of the measurement results.
Next steps are (requires the split ok AsmTemplate.Name into {mnemonic, mode}):
 - Show the sched class.
 - Highlight any inconsistencies with the checked-in data.

Reviewers: gchatelet

Subscribers: mgorny, llvm-commits, tschuett

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332344 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 12:08:00 +00:00
Clement Courbet
4f14c9bd16 [llvm-exegesis] Revert accidentally commited code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332231 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 11:35:37 +00:00
Clement Courbet
431f230ab6 [llvm-exegesis] Add an analysis mode.
The analysis mode gives the user a clustered view of the measurement results and
highlights any inconsistencies with the checked-in data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332229 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 11:30:56 +00:00
Simon Pilgrim
c5db21b266 [llvm-exegesis] Early out if the scheduler models have no extra info.
We were calling getExtraProcessorInfo() without checking hasExtraProcessorInfo(), resulting in an assertion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330263 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-18 14:46:54 +00:00
Clement Courbet
fd68be2418 Re-land r329156 "Add llvm-exegesis tool."
Fixed to depend on and initialize the native target instead of X86.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329169 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-04 11:37:06 +00:00
Clement Courbet
fb12c072df Revert r329156 "Add llvm-exegesis tool."
Breaks a bunch of bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329157 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-04 08:22:54 +00:00
Clement Courbet
780c045964 Add llvm-exegesis tool.
Summary:
[llvm-exegesis][RFC] Automatic Measurement of Instruction Latency/Uops

This is the code corresponding to the RFC "llvm-exegesis Automatic Measurement of Instruction Latency/Uops".

The RFC is available on the LLVM mailing lists as well as the following document
for easier reading:
https://docs.google.com/document/d/1QidaJMJUyQdRrFKD66vE1_N55whe0coQ3h1GpFzz27M/edit?usp=sharing

Subscribers: mgorny, gchatelet, orwant, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329156 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-04 08:13:32 +00:00