diff options
-rw-r--r-- | clang/lib/CodeGen/CGCUDANV.cpp | 6 | ||||
-rw-r--r-- | clang/test/CodeGenCUDA/device-stub.cu | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp index 62661039a32..6f7295bf4b3 100644 --- a/clang/lib/CodeGen/CGCUDANV.cpp +++ b/clang/lib/CodeGen/CGCUDANV.cpp @@ -227,6 +227,12 @@ void CGNVCUDARuntime::emitDeviceStub(CodeGenFunction &CGF, emitDeviceStubBodyNew(CGF, Args); else emitDeviceStubBodyLegacy(CGF, Args); + + // Postfix kernel stub names with .stub to differentiate them from kernel + // names in device binaries. This is to facilitate the debugger to find + // the correct symbols for kernels in the device binary. + if (CGF.getLangOpts().HIP) + CGF.CurFn->setName(CGF.CurFn->getName() + ".stub"); } // CUDA 9.0+ uses new way to launch kernels. Parameters are packed in a local diff --git a/clang/test/CodeGenCUDA/device-stub.cu b/clang/test/CodeGenCUDA/device-stub.cu index 387a787cceb..3be0e7b2ec4 100644 --- a/clang/test/CodeGenCUDA/device-stub.cu +++ b/clang/test/CodeGenCUDA/device-stub.cu @@ -145,7 +145,8 @@ void use_pointers() { // Test that we build the correct number of calls to cudaSetupArgument followed // by a call to cudaLaunch. -// LNX: define{{.*}}kernelfunc +// CUDA-LABEL: define{{.*}}kernelfunc +// HIP-LABEL: define{{.*}}@_Z10kernelfunciii.stub // New launch sequence stores arguments into local buffer and passes array of // pointers to them directly to cudaLaunchKernel |