This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Do not release VGPRs at -O0
ClosedPublic

Authored by foad on Aug 10 2023, 3:37 AM.

Details

Reviewers
t-tye
kzhuravl
lancesix
arsenm
Group Reviewers
Restricted Project
Commits
rG3091bdb86d55: [AMDGPU] Do not release VGPRs at -O0
Summary

This was an oversight when the GFX11 early release VGPRs optimization
was reimplemented in D153279.

Sending the DEALLOC_VGPRS message is a performance optimization so there
is no need to do it at -O0. In addition it makes some kinds of post
mortem debugging hard or impossible, since VGPR values are no longer
available to inspect at the s_endpgm instruction.

Diff Detail

Event Timeline

foad created this revision.Aug 10 2023, 3:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2023, 3:37 AM
foad requested review of this revision.Aug 10 2023, 3:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2023, 3:37 AM
foad added reviewers: Restricted Project, t-tye, kzhuravl, lancesix.Aug 10 2023, 3:38 AM
arsenm added inline comments.Aug 10 2023, 3:47 AM
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
1041

should also account for optnone on the function

llvm/test/CodeGen/AMDGPU/release-vgprs.mir
25

need an optnone case

foad added inline comments.Aug 10 2023, 3:50 AM
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
1041

Is there a helper I can use that takes both of these into account? In the whole of the backend I only see one explicit check for F.hasOptNone(), in AMDGPURegBankSelect.

arsenm added inline comments.Aug 10 2023, 3:51 AM
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
1041

I'm not sure, we don't have many of these skip optimizations in mandatory passes types of checks. Usually optnone is considered by skipFunction at the start of the pass, and the pass isn't added at -O0 to begin with

1041

I'd just add an optnone member and set it at the start of the function from optnone/opt level

foad updated this revision to Diff 548972.Aug 10 2023, 4:44 AM

optnone

foad marked 4 inline comments as done.Aug 10 2023, 4:45 AM
foad added a comment.Aug 10 2023, 5:22 AM

This should probably go into the LLVM 17 release branch.

arsenm accepted this revision.Aug 10 2023, 6:35 AM
This revision is now accepted and ready to land.Aug 10 2023, 6:35 AM
This revision was landed with ongoing or failed builds.Aug 10 2023, 6:58 AM
This revision was automatically updated to reflect the committed changes.