This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Fix using incorrect private resource with no allocation
ClosedPublic

Authored by arsenm on Oct 13 2016, 7:20 PM.

Details

Reviewers
tstellarAMD
Summary

It's possible to have a use of the private resource descriptor or
scratch wave offset registers even though there are no allocated
stack objects. This would result in continuing to use the maximum
number reserved registers. This could go over the number of SGPRs
available on VI, or violate the SGPR limit requested by
the function attributes.

Diff Detail

Event Timeline

arsenm updated this revision to Diff 74610.Oct 13 2016, 7:20 PM
arsenm retitled this revision from to AMDGPU: Fix using incorrect private resource with no allocation.
arsenm updated this object.
arsenm added a subscriber: llvm-commits.
lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
465–471 ↗(On Diff #74610)

I don't think this is correct. For example if the shader uses 12 SGPRS , VCC and Flat. then we would allocate 12 + 4 = 16 SGPRs. This would put the flat_scratch register at s[10:11], which may also be referenced as a regular SGPR by the shader, so we may end up randomly over writing this register.

arsenm updated this revision to Diff 74765.Oct 14 2016, 9:29 PM
arsenm edited edge metadata.

Remove reserved register changes

tstellarAMD accepted this revision.Oct 17 2016, 2:24 PM
tstellarAMD edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Oct 17 2016, 2:24 PM
arsenm closed this revision.Oct 28 2016, 12:53 PM

r285435