[PATCH] D106288: [AMDGPU] Disable LDS lowering for GFX shaders
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 19 10:25:25 PDT 2021
rampitec created this revision.
rampitec added reviewers: arsenm, dstuttard, mareko.
Herald added subscribers: foad, kerbowa, hiraditya, t-tye, tpr, yaxunl, nhaehnle, jvesely, kzhuravl.
rampitec requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.
Apparently these need external LDS symbols to remain.
Fixes: SC1-3279
https://reviews.llvm.org/D106288
Files:
llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
llvm/test/CodeGen/AMDGPU/lower-kernel-lds.ll
Index: llvm/test/CodeGen/AMDGPU/lower-kernel-lds.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/lower-kernel-lds.ll
+++ llvm/test/CodeGen/AMDGPU/lower-kernel-lds.ll
@@ -12,6 +12,7 @@
;.
; CHECK: @lds.size.8.align.8 = internal unnamed_addr addrspace(3) global [8 x i8] undef, align 8
+; CHECK: @lds.k2 = internal unnamed_addr addrspace(3) global [1 x i8] undef, align 1
; CHECK: @llvm.amdgcn.kernel.k0.lds = internal addrspace(3) global %llvm.amdgcn.kernel.k0.lds.t undef, align 16
; CHECK: @llvm.amdgcn.kernel.k1.lds = internal addrspace(3) global %llvm.amdgcn.kernel.k1.lds.t undef, align 16
;.
@@ -63,3 +64,19 @@
ret void
}
+
+; Do not lower LDS for graphics shaders.
+
+ at lds.k2 = internal unnamed_addr addrspace(3) global [1 x i8] undef, align 1
+
+define amdgpu_ps void @k2() {
+; CHECK-LABEL: @k2(
+; CHECK-NEXT: %lds.k2.bc = bitcast [1 x i8] addrspace(3)* @lds.k2 to i8 addrspace(3)*
+; CHECK-NEXT: store i8 1, i8 addrspace(3)* %lds.k2.bc, align 1
+; CHECK-NEXT: ret void
+;
+ %lds.k2.bc = bitcast [1 x i8] addrspace(3)* @lds.k2 to i8 addrspace(3)*
+ store i8 1, i8 addrspace(3)* %lds.k2.bc, align 1
+
+ ret void
+}
Index: llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
@@ -162,7 +162,8 @@
bool Changed = processUsedLDS(M);
for (Function &F : M.functions()) {
- if (!AMDGPU::isKernelCC(&F))
+ // Only lower compute kernels' LDS.
+ if (!AMDGPU::isKernel(F.getCallingConv()))
continue;
Changed |= processUsedLDS(M, &F);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106288.359835.patch
Type: text/x-patch
Size: 1737 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210719/0d408ef5/attachment-0001.bin>
More information about the llvm-commits
mailing list