[PATCH] D91281: [CUDA][HIP] Diagnose reference of host variable

2021-03-08 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D91281#2609766 , @yaxunl wrote: > In D91281#2607082 , @yaxunl wrote: > >> @tra I got some issue with this patch. There are cases that an expression >> using a host variable is compile-tim

[PATCH] D91281: [CUDA][HIP] Diagnose reference of host variable

2021-03-07 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D91281#2607082 , @yaxunl wrote: > @tra I got some issue with this patch. There are cases that an expression > using a host variable is compile-time constant, e.g. > > int x; > __device__ void fun() { > sizeof(x); > } >

[PATCH] D91281: [CUDA][HIP] Diagnose reference of host variable

2021-03-05 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. @tra I got some issue with this patch. There are cases that an expression using a host variable is compile-time constant, e.g. int x; __device__ void fun() { sizeof(x); } Do we want to allow that? Thanks. Repository: rG LLVM Github Monorepo CHANGES SINCE L

[PATCH] D91281: [CUDA][HIP] Diagnose reference of host variable

2020-12-08 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D91281#2441147 , @tra wrote: > I think `isCUDADeviceBuiltinTextureType` has problem handling texture refs > within templates. Proposed fix: https://reviews.llvm.org/D92893 Repository: rG LLVM Github Monorepo CHANGES SINCE LAS

[PATCH] D91281: [CUDA][HIP] Diagnose reference of host variable

2020-12-08 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. It appears that we need to add special handling for texture/surface references. Nominally they are host-side objects, but they are accessed/used from device functions as far as Sema is concerned. E.g. https://godbolt.org/z/z1YnE3 NVCC and older clang compile it, but the re

[PATCH] D91281: [CUDA][HIP] Diagnose reference of host variable

2020-12-02 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. yaxunl marked an inline comment as done. Closed by commit rG5c8911d0ba38: [CUDA][HIP] Diagnose reference of host variable (authored by yaxunl). Herald added a subscriber: jvesely. Herald added a project: clang. Changed prio

[PATCH] D91281: [CUDA][HIP] Diagnose reference of host variable

2020-11-11 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. LGTM. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91281/new/ https://reviews.llvm.org/D91281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D91281: [CUDA][HIP] Diagnose reference of host variable

2020-11-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked an inline comment as done. yaxunl added inline comments. Comment at: clang/lib/Sema/SemaExpr.cpp:357 + if (LangOpts.CUDAIsDevice) { +auto *FD = dyn_cast_or_null(CurContext); tra wrote: > This could use a comment why we only check `D->H` refer

[PATCH] D91281: [CUDA][HIP] Diagnose reference of host variable

2020-11-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. Comment at: clang/lib/Sema/SemaExpr.cpp:357 + if (LangOpts.CUDAIsDevice) { +auto *FD = dyn_cast_or_null(CurContext); This could use a comment why we o

[PATCH] D91281: [CUDA][HIP] Diagnose reference of host variable

2020-11-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 304569. yaxunl added a comment. add comments about H->D not diagnosed CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91281/new/ https://reviews.llvm.org/D91281 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/Sema/SemaCUDA.cpp

[PATCH] D91281: [CUDA][HIP] Diagnose reference of host variable

2020-11-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision. yaxunl added reviewers: tra, rjmccall. yaxunl requested review of this revision. This patch diagnoses invalid references of global host variables in device, global, or host device functions. https://reviews.llvm.org/D91281 Files: clang/include/clang/Basic/Diagnos