[PATCH] D123471: [CUDA] Create offloading entries when using the new driver

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 12 12:45:56 PDT 2022


jhuber6 added a comment.

In D123471#3446464 <https://reviews.llvm.org/D123471#3446464>, @tra wrote:

> I've mentioned in D123441 <https://reviews.llvm.org/D123441> that it would be useful to have a list of GPU-side symbols needed by the host and this offload info is pretty close to what we need. The only remaining feature is being able to extract them by external tool, so we could pass them to the GPU-side linker. Perhaps we could just generate a GPU-side stub file which would only have an array of needed GPU-side references, compile and add it to the GPU-side linker as yet another input which would ensure we do link in the exact set of GPU objects from the static libraries.

These will probably only be valid once the final executable is linked. Since the structure contains a pointers to other symbols they'll only have non-null values after the final linking. After linking for the host you should be able to just use something like `objdump -s -j cuda_offloading_entries` to get all of them. For my use-case I only need to be able to iterate these symbols when the program is run. If we want to use this for something else it would be good to keep them synced up to avoid duplicating error. Also the patches say "CUDA" but the vast majority will also apply to HIP without much change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123471



More information about the cfe-commits mailing list