[PATCH] D125060: [amdgpu] Implement lds kernel id intrinsic
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 13 09:29:15 PDT 2022
arsenm added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUArgumentUsageInfo.h:106
FLAT_SCRATCH_INIT = 5,
+ LDS_KERNEL_ID = 6,
WORKGROUP_ID_X = 10,
----------------
Needs a comment explaining this isn't a real user SGPR defined in the ABI
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp:106
+ConstantInt *AMDGPUMachineFunction::getLDSKernelIdMetadata(const Function &F) {
+ auto MD = F.getMetadata("llvm.amdgcn.lds_kernel_id");
+ if (MD && MD->getNumOperands() == 1) {
----------------
arsenm wrote:
> arsenm wrote:
> > Why '.' and '_'?
> What is this metadata for? Where does it come from?
probably should have gone the other way, all . instead of _
================
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());
+ }
----------------
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
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