[PATCH] D123441: [CUDA][HIP] Fix host used external kernel in archive

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 12 12:41:16 PDT 2022


tra added a comment.

> This approach will only link in kernels and device variables used by host code

In the absence of the explicit reference info from the host side, GPU-side linker  must link all objects with symbols that **may** be used by the host.
E.g if we have a library with three objects, each has one kernel (and thus potentially used by the host), but the main TU only refers to a kernel from one of them, GPU-side linker would still have to link in all three objects from the library, as any of them may have been referenced by the host.

> --whole-archive will require users to carefully arrange --whole-archive and --no-whole-archive options for the archives they use.

This would be done by the driver. My understanding is that we already have to do nontrivial stuff under the hood (e.g. unbundling) so telling the linker that static archives must always use `--whole-archive` should be doable. 
I don't insist on it, just exploring alternative options we may have.


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

https://reviews.llvm.org/D123441



More information about the cfe-commits mailing list