[llvm] [NVPTX] Enable .ptr .global .align attributes for kernel attributes for CUDA (PR #79646)
Artem Belevich via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 26 14:13:39 PST 2024
================
@@ -1610,6 +1610,10 @@ void NVPTXAsmPrinter::emitFunctionParamList(const Function *F, raw_ostream &O) {
}
Align ParamAlign = I->getParamAlign().valueOrOne();
O << ".align " << ParamAlign.value() << " ";
+ } else if (I->getParamAlign().valueOrOne() != 1) {
+ O << ".ptr .global ";
----------------
Artem-B wrote:
I think the code would be more concise if we would rearrange the code a bit :
```
if (PTy) {
print ".param"
if (CUDA) {
assert(AS == generic)
print ".ptr.global"
} else {
switch(AS){
...
}
}
print(".align") // see note regarding alignment below.
}
```
I think we may want to annotate pointers & AS regardless of whether alignment is specified. E.g. the second test case should've generated '.praram .ptr .global func_param_0'
Another interesting quirk is that the default alignement assumed by ptxas is 4. I do not think LLVM has the same idea when alignment is not specified. So, I think the non-CUDA branch does the right thing always specifying it explicitly.
https://github.com/llvm/llvm-project/pull/79646
More information about the llvm-commits
mailing list