[PATCH] D58163: [CUDA][HIP] Use device side kernel and variable names when registering them

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 12 19:57:56 PST 2019


yaxunl created this revision.
yaxunl added reviewers: rjmccall, tra.
Herald added subscribers: jdoerfert, tpr.

`__hipRegisterFunction` and `__hipRegisterVar` need to accept device side kernel and variable names
so that HIP runtime can associate kernel stub functions in host code with kernel symbols in fat binaries,
and associate shadow variables in host code with device variables in fat binaries.

Currently, clang assumes kernel functions and device variables have the same name as the kernel
stub functions and shadow variables. However, when host is compiled in windows with MSVC C++
ABI and device is compiled with Itanium C++ ABI (e.g. AMDGPU), kernels and device symbols in fat
binary are mangled differently than host.

This patch gets the device side kernel and variable name by mangling them in the mangle context
of aux target.


https://reviews.llvm.org/D58163

Files:
  include/clang/AST/ASTContext.h
  lib/AST/ASTContext.cpp
  lib/CodeGen/CGCUDANV.cpp
  lib/CodeGen/CGCUDARuntime.h
  lib/CodeGen/CodeGenModule.cpp
  test/CodeGenCUDA/device-stub.cu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58163.186582.patch
Type: text/x-patch
Size: 18456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190213/abe15bf5/attachment-0001.bin>


More information about the cfe-commits mailing list