[PATCH] D80858: [CUDA][HIP] Support accessing static device variable in host code

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 23 07:09:31 PDT 2020


hliao requested changes to this revision.
hliao added a comment.
This revision now requires changes to proceed.

I don't that's proper way to support file-scope static device variables. As we discuss APIs like cudaMemcpyToSymol, that's a runtime API instead of driver API. The later needs to specify the module (or code object) id in addition to a symbol name and won't have the conflict issues. For the runtime API, all named device variables (static or not) are identified at the host side by their host stub variables. That stub variable is used to register the corresponding device variables associated with a module id to unique identify that variables across all TUs. As long as we look up device variables using their host stub variable pointers, they are uniquely identified already. The runtime implementation needs to find the module id and the variable symbol from the pointer of its host stub variable. It's not the compiler job to fabricate name uniquely across TUs.


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

https://reviews.llvm.org/D80858





More information about the cfe-commits mailing list