This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] GFX11: automatically release VGPRs at the end of the shader
ClosedPublic

Authored by foad on Jun 23 2022, 7:16 AM.

Details

Summary

GFX11 has a new message type MSG_DEALLOC_VGPRS which can be used to
release a shader's VGPRs. Sending this at the end of a shader (just
before the s_endpgm) can help overall system performance in cases where
the s_endpgm would have to wait for outstanding VMEM stores to complete
before releasing the VGPRs.

Diff Detail

Event Timeline

foad created this revision.Jun 23 2022, 7:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2022, 7:16 AM
foad requested review of this revision.Jun 23 2022, 7:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2022, 7:16 AM
foad added reviewers: Joe_Nash, rampitec, jpages, Restricted Project.Jun 23 2022, 7:17 AM
foad updated this revision to Diff 439424.Jun 23 2022, 9:04 AM

Add release-vgprs.mir.

jpages accepted this revision as: jpages.Jun 23 2022, 9:08 AM

LGTM.

Thanks!

This revision is now accepted and ready to land.Jun 23 2022, 9:08 AM
arsenm added inline comments.Jun 23 2022, 11:43 AM
llvm/lib/Target/AMDGPU/AMDGPUReleaseVGPRs.cpp
39

Doesn't this preserve everything?

97

Can just check rbegin

116

Can also early exit on non-entry calling conventions

foad updated this revision to Diff 439681.Jun 24 2022, 2:51 AM

Address review comments.

foad marked 2 inline comments as done.Jun 24 2022, 2:53 AM
foad added inline comments.
llvm/lib/Target/AMDGPU/AMDGPUReleaseVGPRs.cpp
39

Yes.

97

That seems like it would make the code a little less neat for no real benefit, since you would have to guard against emty MBBs.

foad marked an inline comment as done.Jun 30 2022, 1:28 AM

Ping!

arsenm added inline comments.Jun 30 2022, 7:45 AM
llvm/lib/Target/AMDGPU/AMDGPUReleaseVGPRs.cpp
58

Try to insert and see if it failed?

66

No else after return

foad updated this revision to Diff 441437.Jun 30 2022, 9:39 AM

Address feedback.

foad marked 2 inline comments as done.Jun 30 2022, 9:40 AM
foad added inline comments.
llvm/lib/Target/AMDGPU/AMDGPUReleaseVGPRs.cpp
58

How does this look?

arsenm accepted this revision.Jun 30 2022, 11:59 AM
This revision was landed with ongoing or failed builds.Jun 30 2022, 12:58 PM
This revision was automatically updated to reflect the committed changes.
foad marked an inline comment as done.