[llvm] [AMDGPU] Fix hidden kernarg preload count inconsistency (PR #116759)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 08:25:58 PST 2024


================
@@ -520,6 +520,16 @@ bool AMDGPUCallLowering::lowerFormalArgumentsKernel(
 
   // TODO: Align down to dword alignment and extract bits for extending loads.
   for (auto &Arg : F.args()) {
+    // Hidden arguments that are in the kernel signature must be preloaded to
+    // user SGPRs, or loaded via the implicit_arg ptr. Print a diagnostic error
+    // if a hidden argument is in the argument list and is not preloaded.
+    if (Arg.hasAttribute("amdgpu-hidden-argument")) {
+      DiagnosticInfoUnsupported NonPreloadHiddenArg(
+          *Arg.getParent(),
+          "hidden argument in kernel signature was not preloaded");
+      F.getContext().diagnose(NonPreloadHiddenArg);
+    }
----------------
arsenm wrote:

This is an unconditonal error, and untested. Currently the IR kernel argument lowering is treated as optional, both selectors are supposed to fully handle kernel lowering independently with -amdgpu-ir-lower-kernel-arguments=0.

I also don't understand the second part of the comment. If they're loaded through the implicit pointer, they weren't preloaded?

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


More information about the llvm-commits mailing list