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

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

ditto

91

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

tools/llvm-exegesis/lib/CodeTemplate.h
51

please give an example for each one of these.

62

*powers

107

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

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

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
107

back-to-back ? :D

107

I don't get this comment.

123

ditto

unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
61

checkAndGetBestCodeTemplate

64

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

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

tools/llvm-exegesis/lib/CodeTemplate.h
60

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

70

Uses

78

doc ?

tools/llvm-exegesis/lib/Latency.cpp
169

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.