[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-27 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 4 inline comments as done. yaxunl added a comment. In D84364#2170769 , @tra wrote: > In D84364#2170244 , @tra wrote: > > > I'm going to try the patch on our CUDA code and see how it fares. Stay > > tu

[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-23 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D84364#2170244 , @tra wrote: > I'm going to try the patch on our CUDA code and see how it fares. Stay tuned. The patch works well enough to build TensorFlow which is a good sign that existing working code should be OK -- we're ma

[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-23 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. I'm going to try the patch on our CUDA code and see how it fares. Stay tuned. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D84364/new/ https://reviews.llvm.org/D84364 ___ cfe-commits mailing list cfe-commits@lists.llvm.

[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-23 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 280144. yaxunl added a comment. update the lit test for SFINAE. make sure substitution failure does not incur error msg if there is valid substitution. Since template is not allowed in local class, there is no need for test SFINAE inside host device function

[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-23 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 280102. yaxunl added a comment. added lit test for SFINAE CHANGES SINCE LAST ACTION https://reviews.llvm.org/D84364/new/ https://reviews.llvm.org/D84364 Files: clang/include/clang/Basic/LangOptions.def clang/include/clang/Driver/Options.td clang/inc

[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment. FWIW, OpenMP does also defer some diagnostics. It feels like a mess we can't avoid. That means, I think there is merit in generalizing this. I haven't reviewed this in any detail though. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D84364/new/ https://review

[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. Another thing we can do is to limit the diagnostic messages that can be deferred. For example, we only defer semantic diagnostics, or overloading resolution related diagnostics. According to previous experience, what bothers us most are the diagnostics triggered by the d

[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. I'd like to clarify a little bit about `deferring` an error. First it is localized to a function. If an error causes a function not parsed completely, it will be emitted immediately. So if an error is deferred, it means clang at least parses that function containing it.

[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D84364#2168036 , @tra wrote: > One side effect of this change is that we'll probably stop producing > diagnostics for the code that is known to be wrong, but happens to be unused. > > E.g. > > __host__ __device__ static void h

[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 280013. yaxunl edited the summary of this revision. yaxunl added a comment. Herald added a subscriber: dang. Added option -fgpu-defer-diag to control this new behavior. By default it is off. Added test for syntax error. CHANGES SINCE LAST ACTION https://re

[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment. In D84364#2168036 , @tra wrote: > E.g. > > __host__ __device__ static void hd() { > no_such_type_t t; > } > > > We obviously can never compile this function on either side of the > compilation and clang currently does d

[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Artem Belevich via Phabricator via cfe-commits
tra added a subscriber: rsmith. tra added a comment. It's an interesting idea and it may be needed to handle wider range of implicitly-HD functions. However it's likely to have interesting consequences, not all of them desirable. It may be worth considering hiding the new behavior behind a flag

[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 279950. yaxunl added a comment. update for depending patch change CHANGES SINCE LAST ACTION https://reviews.llvm.org/D84364/new/ https://reviews.llvm.org/D84364 Files: clang/include/clang/Sema/Sema.h clang/lib/Sema/AnalysisBasedWarnings.cpp clang/li

[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision. yaxunl added a reviewer: tra. Herald added subscribers: sstefan1, kristof.beyls. Herald added a reviewer: jdoerfert. In CUDA/HIP a function may become implicit host device function by pragma or constexpr. A host device function is checked in both host and device compi