This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Split GCNRegBankReassign
ClosedPublic

Authored by rampitec on Apr 7 2021, 12:47 PM.

Details

Summary

Allow pass to work separately with SGPR, VGPR registers or both.
This is NFC now but will be needed to split RA for separate
SGPR and VGPR passes.

Diff Detail

Event Timeline

rampitec created this revision.Apr 7 2021, 12:47 PM
rampitec requested review of this revision.Apr 7 2021, 12:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2021, 12:47 PM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm added a comment.Apr 7 2021, 1:10 PM

Can't this just skip virtual registers? Does it really need to know which mode its in?

Can't this just skip virtual registers? Does it really need to know which mode its in?

All registers are virtual here. It will skip a register if there is no assignment in VRM (and obviously skip physregs).
This is slower as it is though. I can add the check "Reg.isPhysical() || !VRM->isAssignedReg(Reg)" earlier to mitigate it.
Will that help?

arsenm added a comment.Apr 7 2021, 1:20 PM

Can't this just skip virtual registers? Does it really need to know which mode its in?

All registers are virtual here. It will skip a register if there is no assignment in VRM (and obviously skip physregs).
This is slower as it is though. I can add the check "Reg.isPhysical() || !VRM->isAssignedReg(Reg)" earlier to mitigate it.
Will that help?

Why is that slower?

I also would prefer with the allocation split that the final rewrite of registers was done at once at the end. It does commit the intermediate state now, although I don't remember why I did it that way

Can't this just skip virtual registers? Does it really need to know which mode its in?

All registers are virtual here. It will skip a register if there is no assignment in VRM (and obviously skip physregs).
This is slower as it is though. I can add the check "Reg.isPhysical() || !VRM->isAssignedReg(Reg)" earlier to mitigate it.
Will that help?

Why is that slower?

Simply because I do that check late. It does not matter much until you split the RA. I can move the check earlier, that is not a big deal.

I also would prefer with the allocation split that the final rewrite of registers was done at once at the end. It does commit the intermediate state now, although I don't remember why I did it that way

If you will run rewriter once no changes are needed at all. Just run the pass right before the rewriter. Although currently you are running it twice. What are your plans about this?

arsenm accepted this revision.Apr 7 2021, 1:45 PM

If you will run rewriter once no changes are needed at all. Just run the pass right before the rewriter. Although currently you are running it twice. What are your plans about this?

I would need to look at it again. For now I guess assume the rewrite will run twice

llvm/lib/Target/AMDGPU/GCNRegBankReassign.cpp
400

Unrelated, but this is likely a bug. This should cover all meta instructions (most likely this will do the wrong thing for kill)

This revision is now accepted and ready to land.Apr 7 2021, 1:45 PM
rampitec added inline comments.Apr 7 2021, 2:44 PM
llvm/lib/Target/AMDGPU/GCNRegBankReassign.cpp
400

Ack, will fix it separately.

This revision was landed with ongoing or failed builds.Apr 7 2021, 3:00 PM
This revision was automatically updated to reflect the committed changes.