This is an archive of the discontinued LLVM Phabricator instance.

[X86][Atom] Convert Atom scheduler model to SchedRW (PR32431)
ClosedPublic

Authored by RKSimon on Apr 10 2018, 6:32 AM.

Details

Summary

Atom is the only x86 target that still uses schedule itineraries, if we can remove this then we can begin the work on removing x86 itineraries. I've also found that it will help with PR36550.

I've focussed on matching the existing model as closely as possible (relying on the schedule tests), PR36895 indicated a lot of these were incorrect but we can just as easily fix these after this patch as before. Hopefully we can get llvm-exegesis to help here,

This also required me to generalize the nop padding pass to work with TargetSchedModel instead of calling TargetInstrInfo::getInstrLatency directly - this could possibly be pre-committed if people are happy with it.

There are a few instructions that rely on itinerary scheduling (mainly push/pop/return) of multiple resource stages, but I don't think any of these are show stoppers.

There are also a few codegen changes that seem related to the post-ra scheduler acting a little differently, I haven't tracked these down but they don't seem critical.

NOTE: I don't have access to any Atom hardware, so this hasn't been tested in the wild.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Apr 10 2018, 6:32 AM
craig.topper added inline comments.Apr 10 2018, 9:46 PM
test/CodeGen/X86/sse-schedule.ll
6135 ↗(On Diff #141833)

Why did the number of nops change?

test/CodeGen/X86/sse2-schedule.ll
10709 ↗(On Diff #141833)

Any idea why the paddw wasn't commuted before to make the movdqa unnecessary?

RKSimon added inline comments.Apr 11 2018, 8:08 AM
test/CodeGen/X86/sse-schedule.ll
6135 ↗(On Diff #141833)

The actual test nop is inside an inlineasm, which can't be scheduled. Itineraries' getInstrLatency default to 0cy, but TargetSchedModel::computeInstrLatency defaults to 1cy.

TBH in this case, I think the schedrw is slightly better but only by chance.

test/CodeGen/X86/sse2-schedule.ll
10709 ↗(On Diff #141833)

Sorry, no - with the patch MachineCSE is performing the commute.

RKSimon added inline comments.Apr 11 2018, 9:21 AM
test/CodeGen/X86/sse2-schedule.ll
10709 ↗(On Diff #141833)

Both with/without the patch MachineCSE the paddw is being commutated twice (there and back again....). Without the patch I'm then seeing one more commutations coming from TwoAddressInstructionPass, and that leaves us with the movdqa.

This revision is now accepted and ready to land.Apr 11 2018, 10:22 AM