This is an archive of the discontinued LLVM Phabricator instance.

[llvm-exegeis] Computing Latency configuration upfront so we can generate many CodeTemplates at once.
ClosedPublic

Authored by gchatelet on Oct 16 2018, 5:07 AM.

Details

Summary

LatencyGenerator now computes all possible mode of serial execution for an Instruction upfront and generates CodeTemplate for the ones that give the best results (e.g. no need to generate a two instructions snippet when repeating a single one would do). The next step is to generate even more configurations for cases (e.g. for XOR we should generate "XOR EAX, EAX, EAX" and "XOR EAX, EAX, EBX")

Diff Detail

Repository
rL LLVM

Event Timeline

gchatelet created this revision.Oct 16 2018, 5:07 AM
courbet added inline comments.Oct 16 2018, 5:21 AM
tools/llvm-exegesis/lib/CodeTemplate.cpp
68 ↗(On Diff #169811)

ditto

91 ↗(On Diff #169811)

I can't convince myself that this is fine. Let's go through a static Execution[].

tools/llvm-exegesis/lib/CodeTemplate.h
51 ↗(On Diff #169811)

please give an example for each one of these.

62 ↗(On Diff #169811)

*powers

82 ↗(On Diff #169811)

This is calling for buildbot failures (I remember that some compilers handle this differently). Let's rename one of these to ExecutionMode.

courbet added inline comments.Oct 16 2018, 5:33 AM
tools/llvm-exegesis/lib/CodeTemplate.h
53 ↗(On Diff #169811)

There is a large difference between e.g. this one and SERIAL_VIA_IMPLICIT_REGS. The latter indicates that the inst is always serial, the former that it can be made serial. Maybe rename SERIAL_VIA_IMPLICIT_REGS to ALWAYS_SERIAL_VIA_IMPLICIT_REGS ?

53 ↗(On Diff #169811)

Add doc for each one of these, e.g. "The instruction can be made serial by adding a back-to-back instruction that reads/writes to memory."

tools/llvm-exegesis/lib/Latency.cpp
104 ↗(On Diff #169811)

back-to-back ? :D

104 ↗(On Diff #169811)

I don't get this comment.

120 ↗(On Diff #169811)

ditto

unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
60 ↗(On Diff #169811)

checkAndGetBestCodeTemplate

63 ↗(On Diff #169811)

Please add a comment on generateCodeTemplates as to the order of templates.

gchatelet updated this revision to Diff 169818.Oct 16 2018, 6:41 AM
gchatelet marked 12 inline comments as done.
-Addressing comments
gchatelet updated this revision to Diff 169829.Oct 16 2018, 8:29 AM
  • Remove dead code and fix comment
  • Revert files from other commit to previous state
  • Fix variable name
courbet added inline comments.Oct 17 2018, 1:08 AM
tools/llvm-exegesis/lib/CodeTemplate.cpp
69 ↗(On Diff #169957)

why do you need this ? The type system should do that for you...

tools/llvm-exegesis/lib/CodeTemplate.h
60 ↗(On Diff #169957)

This would be the case if you wrote to memory too, so add "/reads" after "clobbers"

70 ↗(On Diff #169957)

Uses

78 ↗(On Diff #169957)

doc ?

tools/llvm-exegesis/lib/Latency.cpp
85 ↗(On Diff #169957)

ditto

tools/llvm-exegesis/lib/SnippetGenerator.cpp
25 ↗(On Diff #169957)

pass by && ?

gchatelet updated this revision to Diff 169987.Oct 17 2018, 4:12 AM
gchatelet marked 6 inline comments as done.
  • Addressing comments
courbet accepted this revision.Oct 17 2018, 4:15 AM
This revision is now accepted and ready to land.Oct 17 2018, 4:15 AM
This revision was automatically updated to reflect the committed changes.