[PATCH] D123441: [CUDA][HIP] Fix host used external kernel in archive

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 8 21:15:16 PDT 2022


yaxunl created this revision.
yaxunl added a reviewer: tra.
Herald added a project: All.
yaxunl requested review of this revision.

For -fgpu-rdc, a host function may call an external kernel
which is defined in an archive of bitcode. Since this external
kernel is only referenced in host function, the device
bitcode does not contain reference to this external
kernel, then the linker will not try to resolve this external
kernel in the archive.

To fix this issue, host-used external kernels and device
variables are tracked. A global array containing pointers
to these external kernels and variables is emitted which
serves as an artificial references to the external kernels
and variables used by host.


https://reviews.llvm.org/D123441

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Sema/SemaCUDA.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/CodeGenCUDA/host-used-extern.cu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123441.421680.patch
Type: text/x-patch
Size: 5958 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220409/7c8b8730/attachment.bin>


More information about the cfe-commits mailing list