yaxunl added a comment.

In D55067#1313213 <https://reviews.llvm.org/D55067#1313213>, @rjmccall wrote:

> This seems backwards.  Clang knows what the actual ABI alignment of the C 
> type is, and it doesn't have to match the alignment of the IR type that IRGen 
> produces.  It's the actual C ABI alignment that's supposed to affect the 
> calling convention, so there needs to be some way to specify the C ABI 
> alignment on the parameter in IR.  That may mean using `byval`, which can be 
> given an explicit alignment.


AMDGPU backend does not support passing struct type kernel argument by pointer 
with byval attribute.

@arsenm Do you think it is feasible to use pointer with byval attribute to pass 
the struct type kernel argument? Thanks.



================
Comment at: lib/CodeGen/CGCUDANV.cpp:205
+    auto *Aux = CGM.getContext().getAuxTargetInfo();
+    if (Aux && Aux->getTriple().getArch() == llvm::Triple::amdgcn) {
+      auto *ArgTy = Arg->getType()->getPointerElementType();
----------------
arsenm wrote:
> Checking the specific target seems wrong. Shouldn't you just need to check if 
> the value is byval or not?
This is in the host code gen for the kernel stub function, where the struct 
argument is always by val for x86_64. We cannot use that to differentiate 
between nvptx and amdgcn.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55067/new/

https://reviews.llvm.org/D55067



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to