This is an archive of the discontinued LLVM Phabricator instance.

MachineScheduler: Add a target hook for deciding which RegPressure sets to increase
ClosedPublic

Authored by tstellarAMD on Nov 18 2015, 7:44 PM.

Details

Summary

This patch adds a function called getRegPressureSetScore() to
TargetRegisterInfo. The MachineScheduler uses this when comparing
instruction that increase the register pressure of different sets
to determine which set is safer to increase.

This hook is useful for GPU targets where the number of registers in the
class is not the best metric for determing which presser set is safer to
increase.

Future work may include adding more parameters to this function, like
for example, the current pressure level of the set or the amount that
the pressure will be increased/decreased.

Diff Detail

Repository
rL LLVM

Event Timeline

tstellarAMD retitled this revision from to MachineScheduler: Add a target hook for deciding which RegPressure sets to increase.
tstellarAMD updated this object.
tstellarAMD added a subscriber: llvm-commits.

As this method is only usefull inside the MachineScheduler, maybe a better place for it would be MachineSchedStragy?

Also adding Andy for comments/review.

lib/CodeGen/MachineScheduler.cpp
2585–2602 ↗(On Diff #40598)

The "if (TryRank == CandRank)" is confusing, even more so after the rank adjustments here. I think using unsigned TryPSet, CandPSet at first and introducing unsigned TryRank, CandRank at the place of the getPressureSetScore() calls could help.

atrick accepted this revision.Nov 29 2015, 11:34 PM
atrick edited edge metadata.

This seems like a reasonable TRI hook. Generally I expect specialized targets to plugin there own MachineSchedStrategy, but I'm ok with this as long as it doesn't hurt compile time (I wouldn't expect it to).

This revision is now accepted and ready to land.Nov 29 2015, 11:34 PM
tstellarAMD edited edge metadata.

Rename TryRank to TryPSet to minimize confusion.

Updating D14806: MachineScheduler: Add a target hook for deciding which RegPressure sets to

increase

This revision was automatically updated to reflect the committed changes.