[llvm] [NVPTX] Annotate CUDA kernel pointer arguments with .ptr .space .align attributes. (PR #79646)
Artem Belevich via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 26 18:21:44 PST 2024
================
@@ -0,0 +1,34 @@
+; RUN: llc < %s -march=nvptx64 -mcpu=sm_72 2>&1 | FileCheck %s
+; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_72 | %ptxas-verify %}
+
+%struct.Large = type { [16 x double] }
+
+; CHECK: .param .u64 .ptr .global .align 16 func_align_param_0,
+; CHECK: .param .u64 func_align_param_1,
----------------
Artem-B wrote:
> For the second argument in both cases, the current code incorrectly is showing .global .ptr even though the pointer is not pointing to objects in global memory space
Following this logic, we should not be emitting ".global" for the first argument then,as the IR does not specify the address space for it, either.
We should be consistent. If we do assume that CUDA always uses global pointers for kernel arguments, then it should apply to both arguments in the test here, regardless of any other pointer properties.
If we do decide to be pedantic and issue address space directives only if IR contains specific AS info, then in this test case both arguments must not have `.global`.
Same with the alignment -- alignment specification on IR level should only control `.align` directive, and nothing else.
https://github.com/llvm/llvm-project/pull/79646
More information about the llvm-commits
mailing list