[HIP] Emit kernel symbol
authorYaxun (Sam) Liu <yaxun.liu@amd.com>
Mon, 8 Feb 2021 17:29:29 +0000 (12:29 -0500)
committerYaxun (Sam) Liu <yaxun.liu@amd.com>
Mon, 1 Mar 2021 21:31:40 +0000 (16:31 -0500)
commit5cf2a37f1255700d4da9d5f45e82bdfff09aee8c
tree7a903fea127625eb6ae5b8b4049c1fa5b90b071e
parent154c47dc06b5b432f9d8a3e3773e0089099a43d8
[HIP] Emit kernel symbol

Currently clang uses stub function to launch kernel. This is inconvenient
to interop with C++ programs since the stub function has different name
as kernel, which is required by ROCm debugger.

This patch emits a variable symbol which has the same name as the kernel
and uses it to register and launch the kernel. This allows C++ program to
launch a kernel by using the original kernel name.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D86376
clang/lib/CodeGen/CGCUDANV.cpp
clang/lib/CodeGen/CGCUDARuntime.h
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGenCUDA/Inputs/cuda.h
clang/test/CodeGenCUDA/cxx-call-kernel.cpp [new file with mode: 0644]
clang/test/CodeGenCUDA/kernel-dbg-info.cu
clang/test/CodeGenCUDA/kernel-stub-name.cu
clang/test/CodeGenCUDA/unnamed-types.cu