[PATCH] D125060: [amdgpu] Implement lds kernel id intrinsic

Jon Chesterfield via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 11:05:10 PDT 2022


JonChesterfield marked 2 inline comments as done.
JonChesterfield added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIFrameLowering.cpp:530-536
+  if (MFI->hasLDSKernelId()) {
+    ConstantInt *Id = AMDGPUMachineFunction::getLDSKernelIdMetadata(F);
+    Register Reg = MFI->getPreloadedReg(AMDGPUFunctionArgInfo::LDS_KERNEL_ID);      
+    if (Id && Reg) {
+      BuildMI(MBB, I, DL, TII->get(AMDGPU::S_MOV_B32), Reg)
+        .addImm(Id->getZExtValue());
+    }
----------------
arsenm wrote:
> arsenm wrote:
> > This shouldn't get initialized in frame lowering. This should have been emitted as an outgoing call argument only, this isn't a reserved register
> The value chosen is also likely clobbering an incoming user sgpr
Moving this to call lowering is much cleaner, thanks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125060/new/

https://reviews.llvm.org/D125060



More information about the llvm-commits mailing list