[PATCH] D88786: [CUDA] Don't call __cudaRegisterVariable on C++17 inline variables

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 7 13:17:45 PDT 2020


tra added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:4137
+        // TODO: Reject __device__ constexpr and __device__ inline in Sema.
+        if (!D->hasExternalStorage() && !D->isInline())
           getCUDARuntime().registerDeviceVar(D, *GV, !D->hasDefinition(),
----------------
> For rdc mode, device vars are merged. Host shadow vars should also be in comdat and merged. 

Right. I think we need to add `|| (getLangOpts().HIP && getLangOpts().GPURelocatableDeviceCode)`. Maybe even for both CUDA and HIP as `rdc` should work similarly in CUDA, too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88786



More information about the cfe-commits mailing list