97 Commits

Author SHA1 Message Date
Clement Courbet
1b3251f9f4 [llvm-exegesis] Add uop computation for more X87 instruction classes.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336352 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 13:54:51 +00:00
Clement Courbet
363d86f959 [llvm-exegesis][NFC]clang-format
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336343 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 12:26:12 +00:00
Clement Courbet
d657fe7634 [llvm-exegesis] Remove dead comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336266 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-04 12:31:00 +00:00
John Brawn
a5c6980ab7 [llvm-exegesis] Add an AArch64 target
The target does just enough to be able to run llvm-exegesis in latency mode for
at least some opcodes.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336187 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 10:10:29 +00:00
Clement Courbet
c978388e74 [llvm-exegesis] ExegisX86Target::setRegToConstant() should depend on the subtarget features.
Summary: This fixes PR38008.

Reviewers: gchatelet, RKSimon

Subscribers: tschuett, craig.topper, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336171 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 06:17:05 +00:00
John Brawn
752e14cceb [llvm-exegesis] Change how the native architecture is determined
Currently the llvm-exegesis native architecture is determined by comparing the
llvm native architecture with X86, so to add a new target would mean adding a
new check. Change this to building up a list of the targets llvm-exegesis
supports then using that, as this means that when adding a new target you just
add the target to the list of supported targets.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336105 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-02 13:53:46 +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
33274bcdeb [llvm-exegesis][NFC] Cleanup useless braces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336076 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-02 06:39:55 +00:00
Clement Courbet
ff52478399 [llvm-exegesis] Add partial X87 support.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335815 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28 07:41:16 +00:00
Clement Courbet
a34afb0334 [llvm-exegesis][NFC] Fix windows warning in rL335465.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335591 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 10:52:41 +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
14a520d832 [llvm-exegesis][NFC] Remove unnecessary member variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335470 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-25 13:44:27 +00:00
Clement Courbet
4025e96cad [llvm-exegesis] Fix warning in r22752: Initialize IsSnippetSetupComplete.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335467 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-25 13:39:50 +00:00
Clement Courbet
15fac97085 [llvm-exegesis] Generate snippet setup code.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335465 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-25 13:12:02 +00:00
Clement Courbet
512d410a6b [llvm-exegesis][NFC] Simplify BenchmarkRunner ctor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335456 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-25 11:44:29 +00:00
Clement Courbet
534c5d4317 [llvm-exegesis][NFC] clang-format
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335452 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-25 11:22:23 +00:00
Clement Courbet
47c8e1d5eb [llvm-exegesis][NFC] Fix Operand class comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335450 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-25 11:12:30 +00:00
Clement Courbet
34d9682fc5 [llvm-exegesis][NFC] Simplify BenchmarkRunner.
Get rid of createExecutableFunction().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335240 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-21 14:49:04 +00:00
Clement Courbet
11ef9aa12e [llvm-exegesis][NFC] Simplify LLVMState.
Summary: Pretty much everything we need is in llvm::TargetMachine.

Reviewers: gchatelet

Subscribers: llvm-commits, tschuett

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335237 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-21 14:11:09 +00:00
Clement Courbet
859d067297 [llvm-exegesis] Add mechanism to add target-specific passes.
Summary:
createX86FloatingPointStackifierPass is disabled until we handle
TracksLiveness correctly.

Reviewers: gchatelet

Subscribers: mgorny, tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335117 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-20 11:54:35 +00:00
Clement Courbet
4234b30a97 [llvm-exegesis] Remove noexcept in r335105.
gcc checks for transitivity (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53903)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335109 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-20 09:18:37 +00:00
Clement Courbet
42ed299d09 [llvm-exegesis] Fix missing move in r335105.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335108 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-20 09:18:32 +00:00
Guillaume Chatelet
b1497a74ad [llvm-exegesis] Use a Prototype to defer picking a value for free vars.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335105 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-20 08:52:30 +00:00
Roman Lebedev
ba6893f382 llvm-exegesis: mark ~ExegesisTarget() as virtual. Fixes build.
/build/llvm/tools/llvm-exegesis/lib/X86/../Target.h:32:3: error: 'exegesis::ExegesisTarget' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor]
  ~ExegesisTarget();
  ^
/build/llvm/tools/llvm-exegesis/lib/X86/Target.cpp:15:7: error: 'exegesis::(anonymous namespace)::ExegesisX86Target' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor]
class ExegesisX86Target : public ExegesisTarget {
      ^

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335042 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-19 11:58:10 +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
34ed662e9f [llvm-exegesis][NFC] Remove dead variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334813 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-15 09:46:57 +00:00
Clement Courbet
089aa0bc9b [llvm-exegesis][NFC] Add more comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334811 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-15 09:27:12 +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
Clement Courbet
49fb4d413f [llvm-exegesis] Use BenchmarkResult::Instructions instead of OpcodeName
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334691 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-14 06:57:52 +00:00
Guillaume Chatelet
f246e3e960 [llvm-exegesis] Fix buildbot - power was using native target for X86.
Reviewers: courbet

Reviewed By: courbet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334601 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13 14:07:36 +00:00
Guillaume Chatelet
c855277f2a [llvm-exegesis] Fix failing assert when creating Snippet for LAHF.
Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334599 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13 13:53:56 +00:00
Guillaume Chatelet
7f976eb280 [llvm-exegesis] Cleaner design without mutable data.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334596 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13 13:24:41 +00:00
Clement Courbet
4fcee8af8b [llvm-exegesis] Sum counter values when several counters are specified for a ProcRes.
Summary: This allows handling memory ports on SNB.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334502 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12 13:28:37 +00:00
Guillaume Chatelet
331580afbf [llvm-exegesis] Move libpfm linking to LLVMExegesis.
Summary: This patch moves linking of libpfm from different places to a single one.

Reviewers: courbet

Subscribers: mgorny, tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334499 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12 13:07:16 +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
d9ded5e7ff [llvm-exegesis] Add a Configuration object for Benchmark.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334169 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07 08:11:54 +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
Guillaume Chatelet
a1c8d87b41 [llvm-exegesis] Serializes instruction's operand in BenchmarkResult's key.
Summary: Follow up patch to https://reviews.llvm.org/D47764.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334165 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07 07:40:40 +00:00
Clement Courbet
f37d193460 [llvm-exegesis] move Mode from Key to BenchmarResult.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334079 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06 09:42:36 +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
2d87e5abe5 [llvm-exegesis][NFC] Use an enum instead of a string for benchmark mode.
Summary: YAML encoding is backwards-compatible.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333886 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-04 11:43:40 +00:00
Clement Courbet
f5872fd35f [llvm-exegesis] Analysis: Show inconsistencies between checked-in and measured data.
Summary:
We now highlight any sched classes whose measurements do not match the
LLVM SchedModel. "bad" clusters are marked in red.

Screenshot in phabricator diff.

Reviewers: gchatelet

Subscribers: tschuett, mgrang, RKSimon, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333884 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-04 11:11:55 +00:00
Clement Courbet
1d12ed5273 [llvm-exegesis] Analysis: Display idealized sched class port pressure.
Summary: Screenshot in phabricator diff.

Reviewers: gchatelet

Subscribers: mgorny, tschuett, mgrang, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333753 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 14:18:02 +00:00
Roman Lebedev
0ff5fd6ca9 [llvm-exegesis][NFCI] Counter::Counter(): more useful msg on event open error
Summary:
I'm slowly looking into a new X86 scheduler model,
for AMD Bulldozer CPU, model 2 (bdver2, Piledriver).

And naturally, i have hit that assert :)
I happened to know what it meant, and how to fix it,
but that is not too common knowledge.

Reviewers: courbet, RKSimon

Reviewed By: courbet

Subscribers: tschuett, llvm-commits, craig.topper

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333632 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31 07:08:26 +00:00