This is an archive of the discontinued LLVM Phabricator instance.

[MachinePipeliner] Add a way to unit-test the schedule emitter
ClosedPublic

Authored by jmolloy on Aug 30 2019, 10:34 AM.

Details

Summary

Emitting a schedule is really hard. There are lots of corner cases to take care of; in fact, of the 60+ SWP-specific testcases in the Hexagon backend most of those are testing codegen rather than the schedule creation itself.

One issue is that to test an emission corner case we must craft an input such that the generated schedule uses that corner case; sometimes this is very hard and convolutes testcases. Other times it is impossible but we want to test it anyway.

This patch adds a simple test pass that will consume a module containing a loop and generate pipelined code from it. We use post-instr-symbols as a way to annotate instructions with the stage and cycle that we want to schedule them at.

We also provide a flag that causes the MachinePipeliner to generate these annotations instead of actually emitting code; this allows us to generate an input testcase with:

llc < %s -stop-after=pipeliner -pipeliner-annotate-for-testing -o test.mir

And run the emission in isolation with:

llc < test.mir -run-pass=modulo-schedule-test
NOTE: relies on D67006 to land.

Diff Detail

Repository
rL LLVM

Event Timeline

jmolloy created this revision.Aug 30 2019, 10:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 30 2019, 10:34 AM
ThomasRaoux accepted this revision.Sep 2 2019, 9:51 PM

Looks good to me

This revision is now accepted and ready to land.Sep 2 2019, 9:51 PM
jmolloy closed this revision.Sep 3 2019, 1:19 AM

Landed in rL370705. Thanks Thomas!