This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Fix number of reserved SGPRs on CI to reflect flat scratch use
ClosedPublic

Authored by rampitec on Nov 29 2016, 1:44 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

rampitec updated this revision to Diff 79633.Nov 29 2016, 1:44 PM
rampitec retitled this revision from to [AMDGPU] Fix number of reserved SGPRs on SI to reflect flat scratch use.
rampitec updated this object.
rampitec added a reviewer: arsenm.
rampitec set the repository for this revision to rL LLVM.
lib/Target/AMDGPU/SIRegisterInfo.cpp
1125 ↗(On Diff #79633)

We should be checking for SEA_ISLANDS here, since there is no flat_scratch on SI.

rampitec updated this revision to Diff 79637.Nov 29 2016, 1:55 PM
rampitec edited edge metadata.

Added explicit check for SEA_ISLANDS.

rampitec marked an inline comment as done.Nov 29 2016, 1:56 PM
rampitec retitled this revision from [AMDGPU] Fix number of reserved SGPRs on SI to reflect flat scratch use to [AMDGPU] Fix number of reserved SGPRs on CI to reflect flat scratch use.Dec 2 2016, 10:56 AM
rampitec updated this object.
rampitec added a reviewer: nhaustov.
arsenm added inline comments.Dec 5 2016, 2:44 PM
lib/Target/AMDGPU/SIRegisterInfo.cpp
1126 ↗(On Diff #79637)

This can probably be skipped if there are no stack objects

rampitec added inline comments.Dec 5 2016, 2:52 PM
lib/Target/AMDGPU/SIRegisterInfo.cpp
1126 ↗(On Diff #79637)

Doesn't same apply to VI?

arsenm edited edge metadata.Dec 5 2016, 3:22 PM

I think D27150 already is trying to do this

arsenm added a comment.Dec 5 2016, 3:24 PM

I think D27150 already is trying to do this

lib/Target/AMDGPU/SIRegisterInfo.cpp
1126 ↗(On Diff #79637)

I think for VI because of the order, xnack requires reserving the 2 for flat_scratch even though it's unused. We can probably make flat_scratch allocatable in that case to avoid losing 2 registers

I think D27150 already is trying to do this

It does, yes. I see however a test where 104 SGPRs are allocated on CI which exceeds the limit. MFI.hasFlatScratchInit() returns false, and whole spilling went to VGPRs, but we still mark scratch as used. I suppose that is already a separate problem of not releasing scratch.

nhaustov accepted this revision.Dec 8 2016, 11:17 AM
nhaustov edited edge metadata.

Looks good as short term solution.

This revision is now accepted and ready to land.Dec 8 2016, 11:17 AM
This revision was automatically updated to reflect the committed changes.