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

2020-10-07 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay marked an inline comment as done. MaskRay 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())

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

2020-10-07 Thread Artem Belevich via Phabricator via cfe-commits
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,

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

2020-10-05 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. This patch may break some existing HIP applications. For rdc mode, device vars are merged. Host shadow vars should also be in comdat and merged. HIP runtime just ignores the same shadow var registered with the same device var, everything should work. For nordc mode,

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

2020-10-05 Thread Fangrui Song via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGa2cc8833683d: [CUDA] Dont call __cudaRegisterVariable on C++17 inline variables (authored by MaskRay). Repository: rG LLVM Github Monorepo

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

2020-10-05 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D88786#2312365 , @MaskRay wrote: >> Could you provide an example where this is causing an issue? > > If the C++17 inline variable appears in two TUs. They have the same comdat > group. The first comdat group is prevailing and the

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

2020-10-05 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment. In D88786#2312329 , @tra wrote: >> If such a variable (which has a comdat group) is discarded (a copy from >> another >> translation unit is prevailing and selected), accessing the variable from >> outside the section group

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

2020-10-05 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. > If such a variable (which has a comdat group) is discarded (a copy from > another > translation unit is prevailing and selected), accessing the variable from > outside the section group (__cuda_register_globals) is a violation of the ELF > specification and will be

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

2020-10-03 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay updated this revision to Diff 296007. MaskRay retitled this revision from "[CUDA] Suppress comdat on host-side shadow variables registered by __cuda_register_globals" to "[CUDA] Don't call __cudaRegisterVariable on C++17 inline variables". MaskRay edited the summary of this revision.