[PATCH] D101830: AMDGPU: Correct const_index_stride for wave 32 for PAL API
David Stuttard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 4 05:45:08 PDT 2021
dstuttard created this revision.
Herald added subscribers: kerbowa, arphaman, hiraditya, t-tye, tpr, yaxunl, nhaehnle, jvesely, kzhuravl, arsenm.
dstuttard requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
Since there is a single scratch resource descriptor for all shaders, if there is
a wave32 and a wave64 shader (for instance for VsFs pairs)
then the const_index_stride will be incorrect for wave32 shaders.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D101830
Files:
llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
Index: llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
+++ llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
@@ -525,6 +525,7 @@
// The pointer to the GIT is formed from the offset passed in and either
// the amdgpu-git-ptr-high function attribute or the top part of the PC
Register Rsrc01 = TRI->getSubReg(ScratchRsrcReg, AMDGPU::sub0_sub1);
+ Register Rsrc03 = TRI->getSubReg(ScratchRsrcReg, AMDGPU::sub3);
buildGitPtr(MBB, I, DL, TII, Rsrc01);
@@ -546,6 +547,15 @@
.addImm(0) // cpol
.addReg(ScratchRsrcReg, RegState::ImplicitDefine)
.addMemOperand(MMO);
+
+ // If we are in a wave32 shader we have to modify the const_index_stride to
+ // b10 We can't rely on the driver setting this for us since there are often
+ // multiple shaders with different wave sizes
+ // TODO: convert to using SCRATCH instructions or multiple SRD buffers
+ if (ST.isWave32()) {
+ const MCInstrDesc &SAndB32 = TII->get(AMDGPU::S_AND_B32);
+ BuildMI(MBB, I, DL, SAndB32, Rsrc03).addReg(Rsrc03).addImm(0xffdfffff);
+ }
} else if (ST.isMesaGfxShader(Fn) || !PreloadedScratchRsrcReg) {
assert(!ST.isAmdHsaOrMesa(Fn));
const MCInstrDesc &SMovB32 = TII->get(AMDGPU::S_MOV_B32);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101830.342706.patch
Type: text/x-patch
Size: 1346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210504/e905eef0/attachment.bin>
More information about the llvm-commits
mailing list