[PATCH] D86376: [HIP] Emit kernel symbol

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 11:28:02 PST 2021


tra added a comment.

In D86376#2551298 <https://reviews.llvm.org/D86376#2551298>, @yaxunl wrote:

> Actually there is one issue with this approach.
>
> HIP have API's to launch kernels, which accept kernel as function pointer argument. Currently when taking address of kernel, we get the stub function. These kernel launching API's will not work if we use kernel symbol to register the kernel. A solution is to return the kernel symbol instead of stub function when taking address of the kernel in host compilation, i.e. if a function pointer is assigned to a kernel in host code, it gets the kernel symbol instead of the stub function. This will make the kernel launching API work.
>
> To keep the triple chevron working, the kernel symbol will be initialized with the address of the stub function. For triple chevron call, the address of the stub function is loaded from the kernel symbol and invoked.

This could work.
Do we really need an indirection? If we know the stub address when we initialize the symbol with it, we should be able to use that address for `<<<>>>`.


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

https://reviews.llvm.org/D86376



More information about the cfe-commits mailing list