tra added a comment.

A kernel functions in CUDA is actually two different functions. One is the real 
kernel we compile for the GPU, another is a host-side stub that launches the 
device-side kernel.

On device side both clang and nvcc currently silently ignore `hidden` 
visibility and force the kernel to always be visible:
https://godbolt.org/z/xrPMGc
This is needed because the kernel must be externally visible in the device-side 
executable for the host-side code to execute it.
The device-side executable and its symbols are isolated from the host DSO they 
are encapsulated in, so whether the `hidden` attribute is ignored or not on 
device side is independent of the visibility the kernel symbol gets on the host 
side.

On the host side there's no particular reason to give kernel (or, rather, its 
host-side stub) a special treatment. Setting `hidden` on it should be fine, if 
someone needs it for whatever reason.
Most likely users who may have applied `hidden` to a kernel would do so in 
order to avoid exposing kernel symbols outside of a DSO and the attribute will 
do that job just fine.

I think the warning is not going to buy anything for CUDA. The hidden attribute 
effectively applies to the host side only, where it should work correctly and 
where it is potentially useful. I'd rather not impose restrictions that are not 
necessary, even if it's just a warning.


Repository:
  rC Clang

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

https://reviews.llvm.org/D61274



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to