[llvm] [AMDGPU] Add support for preloading implicit kernel arguments (PR #83817)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon May 20 11:03:54 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 :
----------------
arsenm wrote:
I forgot this was specifically about the implicit arguments, but essentially yes. You could rewrite the IR signature of the function, giving you uniformity of representation, although it's a bit cumbersome to do that (you have to create a new function with the new type, then splice the body, and steal the name)
I have a long term desire to have clang only emit byref for every kernel argument, and avoid the triple handling in AMDPULowerKernelArguments and the 2 selector implementations. We would then have a uniformity of representation where non-byref arguments are passed in registers. The blocker before is you lose some optimizations, from attributes that traditionally can only be applied to arguments. The main one was noalias, but we have metadata now that works in the load case, so it's probably a reasonable time to revisit that project.
https://github.com/llvm/llvm-project/pull/83817
More information about the llvm-commits
mailing list