Page MenuHomePhabricator

[Power9] Add a specific heuristic to schedule the addi before the load
ClosedPublic

Authored by steven.zhang on May 14 2019, 8:14 PM.

Details

Summary

When we are scheduling the load and addi, if all other heuristic didn't take effect, we will try to schedule the addi before the load, to hide the latency, and avoid the true dependency added by RA. And this only take effects for Power9.

Diff Detail

Repository
rL LLVM

Event Timeline

steven.zhang created this revision.May 14 2019, 8:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 14 2019, 8:14 PM
jsji requested changes to this revision.May 16 2019, 3:00 PM

I think we should update the title or summary to indicate that this is P9 only.

llvm/lib/Target/PowerPC/PPCMachineScheduler.cpp
12 ↗(On Diff #199549)

Can this be a lamda or std::function?

32 ↗(On Diff #199549)

These logic are similar to above, just swapped the Candidates.
Can we do it something like:

Cand1st= Zone.isTop() ? TryCand.SU->getInstr(): Cand.SU->getInstr();
Cand2nd= Zone.isTop() ? Cand.SU->getInstr(): *TryCand.SU->getInstr();

if(isADDIInstr(*Cand1st)) && Cand2nd->mayLoad())){
...
}
..
61 ↗(On Diff #199549)

Can we add an option to disable this heuristic?

llvm/lib/Target/PowerPC/PPCMachineScheduler.h
29 ↗(On Diff #199549)

I am seeing this as a bias heuristic, so maybe biasAddi?

llvm/test/CodeGen/PowerPC/schedule-addi-load.mir
1 ↗(On Diff #199549)

Can we commit this testcase as a NFC before this patch? So that the only difference in this patch will be the scheduling change. Thanks.

2 ↗(On Diff #199549)

We can also add a test for the newly added option to disable this heuristic

3 ↗(On Diff #199549)

Add a line as a negative test for pwr8 , as it doesn't use FeaturePPCPreRASched.

This revision now requires changes to proceed.May 16 2019, 3:00 PM
steven.zhang retitled this revision from [PowerPC] Add a specific heuristic to schedule the addi before the load to [Power9] Add a specific heuristic to schedule the addi before the load.Mon, May 20, 2:03 AM
steven.zhang edited the summary of this revision. (Show Details)

Address jinong's comments.

jsji accepted this revision.Thu, May 23, 9:19 AM

LGTM.

This revision is now accepted and ready to land.Thu, May 23, 9:19 AM
This revision was automatically updated to reflect the committed changes.