This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/SI: Use the correct scratch wave offset register for shaders.
AbandonedPublic

Authored by bnieuwenhuizen on Apr 10 2016, 5:59 AM.

Details

Summary

The code previously always used s1 as it was using the user + system SGPR
information for compute kernels. This is incorrect for Mesa shaders though,

The register should be the next SGPR after all user and system SGPR's.
We use that Mesa adds arguments for all input and system SGPR's and
take the next available SGPR for the scratch wave offset register.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>

Diff Detail

Event Timeline

bnieuwenhuizen retitled this revision from to Use the correct scratch wave offset register for shaders..
bnieuwenhuizen updated this object.
bnieuwenhuizen added a subscriber: llvm-commits.
arsenm added inline comments.Apr 12 2016, 3:11 PM
lib/Target/AMDGPU/SIISelLowering.cpp
735–748

You should avoid having the isShader repeated all of these times, and the others should all be in the same assert. Maybe move under the isShader above?

nhaehnle edited edge metadata.Apr 12 2016, 3:19 PM

This looks like an improvement, but I think it is still incorrect for shaders with non-void returns, where the scratch information may have to be passed through.

arsenm edited edge metadata.Apr 12 2016, 3:21 PM

This looks like an improvement, but I think it is still incorrect for shaders with non-void returns, where the scratch information may have to be passed through.

The assert can still be cleaned up to only one

This looks like an improvement, but I think it is still incorrect for shaders with non-void returns, where the scratch information may have to be passed through.

As discussed on IRC, it's fine to go ahead with this patch without fixing this, since it isn't a regression. We really need to make sure that non-mono shaders work correctly with spills though.

And I again forgot to mention: I agree with Matt about the assert.

bnieuwenhuizen edited edge metadata.

Changed the asserts. Still used two though as we also want to assert that some get enabled for kernels.

You should add the AMDGPU/SI: Prefix to the commit message.

bnieuwenhuizen retitled this revision from Use the correct scratch wave offset register for shaders. to AMDGPU/SI: Use the correct scratch wave offset register for shaders..Apr 12 2016, 6:34 PM
bnieuwenhuizen edited edge metadata.
bnieuwenhuizen abandoned this revision.Jan 19 2018, 1:49 PM