[PATCH] D55067: [HIP] Fix offset of kernel argument for AMDGPU target

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 29 12:17:19 PST 2018


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





More information about the cfe-commits mailing list