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

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

Reply via email to