Page MenuHomePhabricator

AMDGPU: Fix MUBUF offset bugs affecting llvm.amdgcn.buffer.* intrinsics

Authored by nhaehnle on Jun 14 2016, 7:32 AM.



This fixes two related bugs. First, the generic optimization passes
unfortunately generate negative constant offsets but the hardware treats
SOffset as an unsigned value.

Second, there is a hardware bug on SI and CI, where address clamping in MUBUF
instructions does not work correctly when SOffset is larger than the buffer
size. This patch works around this bug by never using SOffset.

An alternative workaround would be to do the clamping manually when SOffset
is too large, but generating the required code sequence during instruction
selection would be rather involved, and in any case the resulting code would
probably be worse.


Diff Detail


Event Timeline

nhaehnle updated this revision to Diff 60684.Jun 14 2016, 7:32 AM
nhaehnle retitled this revision from to AMDGPU: Fix MUBUF offset bugs affecting llvm.amdgcn.buffer.* intrinsics.
nhaehnle updated this object.
nhaehnle added reviewers: arsenm, tstellarAMD.
nhaehnle added a subscriber: llvm-commits.
tstellarAMD accepted this revision.Jun 14 2016, 6:00 PM
tstellarAMD edited edge metadata.


This revision is now accepted and ready to land.Jun 14 2016, 6:00 PM
This revision was automatically updated to reflect the committed changes.