[PATCH] D138531: [PATCH] [NVPTX] Backend support for variadic functions
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 29 12:25:13 PST 2022
tra added a comment.
> Note that aggregates passed by value as variadic arguments are not currently supported.
What happens when a user does try to pass an aggregate as a var arg?
================
Comment at: llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp:1676
+ O << ",\n";
+ O << "\t.param .align 8 .b8 %VAParam[]";
+ }
----------------
pavelkopyl wrote:
> tra wrote:
> > What determines the alignment here?
> > NVIDIA does not seem to specify anything regarding alignment here and their example shows `align 4`:
> > https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#kernel-and-function-directives-func
> >
> >
> It seems the documentation is a little bit outdated, because NVCC 11.7 generates .align 8 for the last parameter (unsized array): https://godbolt.org/z/7W7YThMf8
>
The question remains. Do we set alignment to 8 because that's what NVCC does or is there some other reason behind it?
I.e. should it follow the alignment guarantees provided by e.g. `malloc` which returns a pointer sufficiently aligned to access any type.
I think this should be retrieved from DataLayout or TargetInfo, instead of being hardcoded here.
Based on `NVPTXTargetLowering::getFunctionParamOptimizedAlign`, we may have argument alignment as high as 16.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138531/new/
https://reviews.llvm.org/D138531
More information about the llvm-commits
mailing list