This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Don't enable all lanes with non-CSR VGPR spills
ClosedPublic

Authored by arsenm on May 28 2019, 6:14 AM.

Details

Reviewers
rampitec
Summary

If the only VGPRs used for SGPR spilling were not CSRs, this was
enabling all laness and immediately restoring exec. This is the usual
situation in leaf functions.

Diff Detail

Event Timeline

arsenm created this revision.May 28 2019, 6:14 AM
rampitec accepted this revision.May 28 2019, 9:13 AM

LGTM, but I still believe it shall be reserved register instead.

This revision is now accepted and ready to land.May 28 2019, 9:13 AM

LGTM, but I still believe it shall be reserved register instead.

I'm not sure what you mean. A reserved register wouldn't help

LGTM, but I still believe it shall be reserved register instead.

I'm not sure what you mean. A reserved register wouldn't help

It would help if we can reserve it in both caller and callee, right?

LGTM, but I still believe it shall be reserved register instead.

I'm not sure what you mean. A reserved register wouldn't help

It would help if we can reserve it in both caller and callee, right?

Not sure what register you mean. Reserving registers generally causes more problems that it solves. Reserving VGPRs for SGPR spills would require reserving 2 to cover all possible SGPR spills

LGTM, but I still believe it shall be reserved register instead.

I'm not sure what you mean. A reserved register wouldn't help

It would help if we can reserve it in both caller and callee, right?

Not sure what register you mean. Reserving registers generally causes more problems that it solves. Reserving VGPRs for SGPR spills would require reserving 2 to cover all possible SGPR spills

I mean we can do it conditionally if we have a call stack. Normally you would only need one VGPR, but again that requires whole program analysis.

LGTM, but I still believe it shall be reserved register instead.

I'm not sure what you mean. A reserved register wouldn't help

It would help if we can reserve it in both caller and callee, right?

Not sure what register you mean. Reserving registers generally causes more problems that it solves. Reserving VGPRs for SGPR spills would require reserving 2 to cover all possible SGPR spills

I mean we can do it conditionally if we have a call stack. Normally you would only need one VGPR, but again that requires whole program analysis.

I think for a recursive call, you could need more than 2 VGPRs, so eventually you would still need to spill one to memory

arsenm closed this revision.May 28 2019, 9:43 AM

r361848

JBTW, strictly speaking you do not need a full wave and 256 bytes of scratch loads and stores per VGPR. Only first min(wavefrontsize, # of SGPRs spilled) lanes are needed.