[PATCH] D125904: [Cuda] Use fallback method to mangle externalized decls if no CUID given

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 24 17:54:24 PDT 2022


jhuber6 added a comment.

In D125904#3535905 <https://reviews.llvm.org/D125904#3535905>, @jhuber6 wrote:

> I can't think of a way to generate these new symbols, we'd need to somehow have a list of all the static entries that need new symbols and then modify the object file after its been made. Not sure if this is possible in general considering the vendor linkers might not behave. I'm definitely open to discussion though, I'd love to have a solution for this.

Thinking further, we could theoretically read all the offloading entries via the object files, since we already scan for the `.llvm.offloading` section, we would just need to look in the same files for all the `omp_offload_entries`. It would be somewhat difficult to extract the strings, it's theoretically possible. Then we could do a sort of device-side registration where we create a new `.ll` file containing some new symbols to hook up to those offloading entries. The problem at this point, is even if we had this device glue, how would we register the static variable's pointer? The CUDA runtime looks up symbols by name, so we'd need a symbol with some arbitrary name, whose pointer somehow maps to an existing static variable. Another problem is we'd have duplicate names in the offloading entry, so we'd need to change those somehow to match up with the ones on the device.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125904



More information about the cfe-commits mailing list