[llvm] [NVPTX] Annotate CUDA kernel pointer arguments with .ptr .space .align attributes. (PR #79646)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 19:26:49 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,
----------------
Vandana2896 wrote:

In the original commit linked above, the second test case does end up **not** emitting ".ptr .global .align" for the first argument since alignment is specified. For the first test case where "align 16" is specified in the first argument, we get ".ptr .global .align 16".
```
Test 1:
ptr nocapture readonly align 16 %input, ptr nocapture %out
>>> .param .u64 .ptr .global .align 16 func_param_0, .param .u64 func_param_1

Test 2:
ptr nocapture readonly %input, ptr nocapture
>>> .param .u64 func_param_0, .param .u64 func_param_1
```

We generate .ptr .global .align only when the alignment is specified.

Let me know your thoughts on this. 


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


More information about the llvm-commits mailing list