[llvm] [AMDGPU] Add support for preloading implicit kernel arguments (PR #83817)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 26 05:37:49 PDT 2024
================
@@ -5495,6 +5495,34 @@ bool AMDGPULegalizerInfo::legalizeLDSKernelId(MachineInstr &MI,
return true;
}
+bool AMDGPULegalizerInfo::legalizePreloadImplicitarg(
+ MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const {
+ assert(ST.hasKernargPreload());
+ MachineFunction &MF = B.getMF();
+ Register OrigReg = MI.getOperand(0).getReg();
+ const SIMachineFunctionInfo *MFI = MF.getInfo<SIMachineFunctionInfo>();
+ // A unique identifier defined as the offset from start of implicit args added
+ // to the number of formal args.
+ unsigned ImplictArgIdx =
+ MI.getOperand(2).getImm() + MF.getFunction().arg_size();
+ auto &ArgDesc =
+ MFI->getArgInfo().PreloadKernArgs.find(ImplictArgIdx)->getSecond();
----------------
arsenm wrote:
I think representing this in terms of indexes of implicit arguments will be confusing. The arguments do not have uniform size. Can this be expressed as a raw byte offset instead?
https://github.com/llvm/llvm-project/pull/83817
More information about the llvm-commits
mailing list