hliao added a comment. In D62603#1521832 <https://reviews.llvm.org/D62603#1521832>, @tra wrote:
> In D62603#1521792 <https://reviews.llvm.org/D62603#1521792>, @hliao wrote: > > > that should assume that variable is not declared with `static`. that's also > > the motivation of this patch. > > > cppreference defines internal linkage as 'The name can be referred to from > all scopes in the current translation unit.' > The current translation unit in CUDA context gets a bit murky. On one hand > host and device are compiled separately, and may conceivably be considered > separate TUs. On the other hand, the fact that we mix host and device code in > the same source file implies tight coupling and the users do expect them to > be treated as if all host and device code in the source file is in the same > TU. E.g. you may have a kernel in an anonymous namespace yet you do want to > be able to launch it from the host side. > > I think `static __device__` globals would fall into the same category -- > nominally they should not be visible outside of device-side object file, but > in practice we do need to make them visible from the host side of the same TU. That's true if there's a reference on the host side. E.g, if I modify `foo` function as both __host__ and __device, that host-side shadow could be generated (with 'undef` initializer as expected.) Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D62603/new/ https://reviews.llvm.org/D62603 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits