[PATCH] D68578: [HIP] Fix device stub name

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 7 10:30:22 PDT 2019


tra added a comment.

In D68578#1697851 <https://reviews.llvm.org/D68578#1697851>, @yaxunl wrote:

> In D68578#1697822 <https://reviews.llvm.org/D68578#1697822>, @tra wrote:
>
> > Could you elaborate on how exactly current implementation does not work?
> >
> > I would expect the kernel and the stub to be two distinct entities, as far as debugger is concerned. It does have enough information to track each independently (different address, .stub suffix, perhaps knowledge whether it's device or host code). Without the details, it looks to me that this is something that can and should be dealt with in the debugger. I've asked the same question in D63335 <https://reviews.llvm.org/D63335> but I don't think I've got a good answer.
>
>
> HIP debugger is a branch of gdb and the changes to support HIP will be upstreamed. When users set break point on a kernel, they intend to set a break point on the real kernel, not the device stub function. The device stub function is only a compiler generated helper function to help launch the kernel. Therefore it should have a different name so that it does not interfere with the symbol resolution of the real kernel.


I would agree that having distinct names for the device-side kernel and it's host-side stub would probably make things easier for debugger. 
However, debugger does have access to mangled names and does see the '.stub' suffix in the mangled name. I don't understand why it can't be considered to disambiguate between the kernel and the stub? 
I'm clearly missing something here. Is there a chance to get someone from the debugger team to chime in on this review directly?

Also, I would not agree that `they intend to set a break point on the real kernel` is the only scenario. E.g. quite often when I debug CUDA stuff, I do only care about host-side things and I do want to set breakpoint on the stub, so I can check kernel call parameters as they are passed to the kernel. It would be great if there were a way to explicitly tell debugger whether we want host-side stub or the kernel without having user to know how particular compiler transforms the name. For the user both entities have the same name, but distinct location and there should be a way to express that in the debugger.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68578/new/

https://reviews.llvm.org/D68578





More information about the cfe-commits mailing list