[all-commits] [llvm/llvm-project] 0424b5: [CUDA][HIP] Fix host used external kernel in archive

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Wed Apr 13 07:48:32 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0424b5115cffad73a0f6e68affed603a7ed9a692
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2022-04-13 (Wed, 13 Apr 2022)

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

  Log Message:
  [CUDA][HIP] Fix host used external kernel in archive

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.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D123441

More information about the All-commits mailing list