[llvm] [AMDGPU] Add support for preloading implicit kernel arguments (PR #83817)

Austin Kerbow via llvm-commits llvm-commits at lists.llvm.org
Sun May 5 22:57:09 PDT 2024


================
@@ -3210,4 +3210,12 @@ def int_amdgcn_addrspacecast_nonnull : DefaultAttrsIntrinsic<
   [llvm_anyptr_ty], [llvm_anyptr_ty],
   [IntrNoMem, IntrSpeculatable]
 >;
+
+// This intrinsic is used to track the user SGPRs that hold implicit kernel
+// arguments. The i32 argument for this intrinsic represents the offset in
+// bytes from the value pointed to by the implicitarg pointer.
+def int_amdgcn_preload_implicitarg :
----------------
kerbowa wrote:

I'd like to avoid needing an intrinsic. The issue is how do I identify the loads that use the implicit_arg pointer to properly allocate user SGPRs before isel, and then also identify and replace these loads during isel. The best idea I've come up with is to check ahead of time and use an intrinsic.

We allocate user SGPRs, then system SGPRs directly after. If it is possible to delay the allocation of system SGPRs until the end of isel then it's doable. What do you think?

https://github.com/llvm/llvm-project/pull/83817


More information about the llvm-commits mailing list