[PATCH] D102237: [CUDA][HIP] Fix non-ODR-use of static device variable

2021-05-19 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D102237#2769475 , @yaxunl wrote: > In D102237#2767538 , @tra wrote: > >> Here's a slightly simpler reproducer: https://godbolt.org/z/rW6P9e37s > > I have a fix for this: https://reviews.llv

[PATCH] D102237: [CUDA][HIP] Fix non-ODR-use of static device variable

2021-05-19 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D102237#2767538 , @tra wrote: > Here's a slightly simpler reproducer: https://godbolt.org/z/rW6P9e37s I have a fix for this: https://reviews.llvm.org/D102801 It seems the issue was due to clang emits the implicit constant vari

[PATCH] D102237: [CUDA][HIP] Fix non-ODR-use of static device variable

2021-05-18 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. Here's a slightly simpler reproducer: https://godbolt.org/z/85EsxnPPM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D102237/new/ https://reviews.llvm.org/D102237 ___ cfe-commits maili

[PATCH] D102237: [CUDA][HIP] Fix non-ODR-use of static device variable

2021-05-18 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. Here's one example reproducer: https://godbolt.org/z/77M596W89 It's rather hairy, but should be usable for further debugging. There are no CUDA attributes anywhere in sight, but we do end up emitting a host-only constructor for `o_u` which calls `strlen`. Repository: rG

[PATCH] D102237: [CUDA][HIP] Fix non-ODR-use of static device variable

2021-05-18 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D102237#2767131 , @yaxunl wrote: > > It would be interesting to know what kind of variables are emitted. I'm still reducing the failure. I'll send you a reproducer once I have it. > Would you like the change reverted? We ha

[PATCH] D102237: [CUDA][HIP] Fix non-ODR-use of static device variable

2021-05-18 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D102237#2767052 , @tra wrote: > Sam, this patch has apparently triggered some unwanted side effects. I'm > still reducing the failures to something that could be used for debugging, > but the rough symptoms are: > > We now end

[PATCH] D102237: [CUDA][HIP] Fix non-ODR-use of static device variable

2021-05-18 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. Sam, this patch has apparently triggered some unwanted side effects. I'm still reducing the failures to something that could be used for debugging, but the rough symptoms are: We now end up emitting the code for the host-only static member functions of instantiated class t

[PATCH] D102237: [CUDA][HIP] Fix non-ODR-use of static device variable

2021-05-12 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. yaxunl marked 2 inline comments as done. Closed by commit rG98575708da95: [CUDA][HIP] Fix device template variables (authored by yaxunl). Herald added a project: clang. Changed prior to commit: https://reviews.llvm.org/D1

[PATCH] D102237: [CUDA][HIP] Fix non-ODR-use of static device variable

2021-05-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 2 inline comments as done. yaxunl added inline comments. Comment at: clang/lib/Sema/SemaExpr.cpp:17145 }; -if (Var && Var->hasGlobalStorage() && !IsEmittedOnDeviceSide(Var)) { - SemaRef.targetDiag(Loc, diag::err_ref_bad_target) - << /*host*/ 2

[PATCH] D102237: [CUDA][HIP] Fix non-ODR-use of static device variable

2021-05-11 Thread Artem Belevich via Phabricator via cfe-commits
tra accepted this revision. tra added a comment. This revision is now accepted and ready to land. LGTM with few nits. Comment at: clang/lib/Sema/SemaExpr.cpp:17145 }; -if (Var && Var->hasGlobalStorage() && !IsEmittedOnDeviceSide(Var)) { - SemaRef.targetDiag(Loc, d

[PATCH] D102237: [CUDA][HIP] Fix non-ODR-use of static device variable

2021-05-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision. yaxunl added a reviewer: tra. yaxunl requested review of this revision. Currently non-ODR-use of static device variable by host code causes static device variable to be emitted and registered, which should not. This patch fixes that. https://reviews.llvm.org/D10223