[PATCH] D108456: [CUDA] Fix static device variables with -fgpu-rdc

Jonas Hahnfeld via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 21 08:26:39 PDT 2021


Hahnfeld added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:6450
     llvm::raw_ostream &OS) const {
-  OS << ".static." << getContext().getCUIDHash();
+  OS << "__static__" << getContext().getCUIDHash();
 }
----------------
tra wrote:
> I would expect  NVPTXAssignValidGlobalNames.cpp to deal with this ptx quirk. 
> I'm fine with the underscores, but it would be good we're not just covering up an issue somewhere else.
> 
`NVPTXAssignValidGlobalNames` checks `hasLocalLinkage`, which the `static` variables here are not (see discussion in D85223). I think the reason is that we don't want variable and function names to differ between host and device, and this might even be important here for maintaining proper connection for `cudaMemcpy`s and so on.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108456



More information about the cfe-commits mailing list