[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-15 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked an inline comment as done. yaxunl added inline comments. Comment at: cfe/trunk/lib/Frontend/InitPreprocessor.cpp:581 // Define macros for the OpenCL memory scope. // The values should match clang SyncScope enum. + static_assert( t-tye wrote:

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-15 Thread Tony Tye via Phabricator via cfe-commits
t-tye added inline comments. Comment at: cfe/trunk/lib/Frontend/InitPreprocessor.cpp:581 // Define macros for the OpenCL memory scope. // The values should match clang SyncScope enum. + static_assert( // The values should match clang AtomicScopeOpenCLModel

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-15 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL310924: [OpenCL] Support variable memory scope in atomic builtins (authored by yaxunl). Changed prior to commit: https://reviews.llvm.org/D36580?vs=60&id=85#toc Repository: rL LLVM https://r

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-15 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision. rjmccall added a comment. Thanks, that looks great. https://reviews.llvm.org/D36580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-15 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 60. yaxunl marked 3 inline comments as done. yaxunl added a comment. Revised by John's comments. https://reviews.llvm.org/D36580 Files: include/clang/AST/Expr.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/SyncScope.h lib/AST/Ex

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-14 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 6 inline comments as done. yaxunl added inline comments. Comment at: include/clang/Basic/SyncScope.h:92 +/// \brief Defines the synch scope ABI for OpenCL. +class AtomicScopeOpenCLABI : public AtomicScopeABI { +public: rjmccall wrote: > yaxunl wrote

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-14 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: include/clang/Basic/SyncScope.h:92 +/// \brief Defines the synch scope ABI for OpenCL. +class AtomicScopeOpenCLABI : public AtomicScopeABI { +public: yaxunl wrote: > rjmccall wrote: > > yaxunl wrote: > > > rjmccall wrot

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-14 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 4 inline comments as done. yaxunl added inline comments. Comment at: include/clang/Basic/SyncScope.h:92 +/// \brief Defines the synch scope ABI for OpenCL. +class AtomicScopeOpenCLABI : public AtomicScopeABI { +public: rjmccall wrote: > yaxunl wrote

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-14 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: include/clang/Basic/SyncScope.h:92 +/// \brief Defines the synch scope ABI for OpenCL. +class AtomicScopeOpenCLABI : public AtomicScopeABI { +public: yaxunl wrote: > rjmccall wrote: > > Please correct me if I'm wrong, b

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-14 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 7 inline comments as done. yaxunl added inline comments. Comment at: include/clang/Basic/SyncScope.h:89 + static std::unique_ptr create(LangOptions &Opt); +}; + rjmccall wrote: > The previous design of this header seems more appropriate to me. Cla

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-14 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: include/clang/Basic/SyncScope.h:59 +return "opencl_subgroup"; + } +} yaxunl wrote: > rjmccall wrote: > > t-tye wrote: > > > Should there be a default/assert/static_assert to allow SyncScope enum to > > > grow due

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-13 Thread Tony Tye via Phabricator via cfe-commits
t-tye accepted this revision. t-tye added a comment. LGTM https://reviews.llvm.org/D36580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-13 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 110904. yaxunl marked 2 inline comments as done. yaxunl added a comment. Refactor to introduce classes AtomicScopeABI and AtomicScopeOpenCLABI for easy extension to other languages. https://reviews.llvm.org/D36580 Files: include/clang/AST/ASTContext.h i

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-13 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 6 inline comments as done. yaxunl added inline comments. Comment at: lib/CodeGen/CGAtomic.cpp:678 + auto &Builder = CGF.Builder; + auto Scopes = getAllLanguageSyncScopes(); + llvm::DenseMap BB; t-tye wrote: > yaxunl wrote: > > t-tye wrote: > > >

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-13 Thread Tony Tye via Phabricator via cfe-commits
t-tye added inline comments. Comment at: lib/CodeGen/CGAtomic.cpp:678 + auto &Builder = CGF.Builder; + auto Scopes = getAllLanguageSyncScopes(); + llvm::DenseMap BB; yaxunl wrote: > t-tye wrote: > > Should only the scopes that apply to the language be returned

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-13 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 8 inline comments as done. yaxunl added inline comments. Comment at: include/clang/Basic/SyncScope.h:56 /// enums in opencl-c.h. -enum class SyncScope { - OpenCLWorkGroup = 1, - OpenCLDevice = 2, - OpenCLAllSVMDevices = 3, - OpenCLSubGroup = 4, +enum class Open

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-13 Thread Tony Tye via Phabricator via cfe-commits
t-tye added inline comments. Comment at: include/clang/Basic/SyncScope.h:56 /// enums in opencl-c.h. -enum class SyncScope { - OpenCLWorkGroup = 1, - OpenCLDevice = 2, - OpenCLAllSVMDevices = 3, - OpenCLSubGroup = 4, +enum class OpenCLMemoryScope { + WorkGroup = 1,

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-12 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 110863. yaxunl marked 5 inline comments as done. yaxunl added a comment. Revised by John's and Tony's comments. https://reviews.llvm.org/D36580 Files: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/SyncScope.h lib/CodeGen/CGAtomic.cpp

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-12 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 10 inline comments as done. yaxunl added inline comments. Comment at: include/clang/Basic/SyncScope.h:46 + Scopes.push_back(SyncScope::OpenCLSubGroup); + return Scopes; +} rjmccall wrote: > t-tye wrote: > > Should there be an assert/static_assert

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-11 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGAtomic.cpp:696 +if (S != Default) + SI->addCase(Builder.getInt32(static_cast(S)), B); + t-tye wrote: > rjmccall wrote: > > t-tye wrote: > > > Is it documented in the SyncScope enum that the enumer

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-11 Thread Tony Tye via Phabricator via cfe-commits
t-tye accepted this revision. t-tye added a comment. This revision is now accepted and ready to land. LGTM other than suggested documentation and static_assert/unreachable comments. Comment at: lib/CodeGen/CGAtomic.cpp:696 +if (S != Default) + SI->addCase(Builder.getIn

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-11 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: include/clang/Basic/SyncScope.h:46 + Scopes.push_back(SyncScope::OpenCLSubGroup); + return Scopes; +} t-tye wrote: > Should there be an assert/static_assert in case SyncScope enum grows due to > other languages? It m

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-11 Thread Tony Tye via Phabricator via cfe-commits
t-tye added inline comments. Comment at: include/clang/Basic/SyncScope.h:46 + Scopes.push_back(SyncScope::OpenCLSubGroup); + return Scopes; +} Should there be an assert/static_assert in case SyncScope enum grows due to other languages? Comme

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-11 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: include/clang/Basic/SyncScope.h:47 + return Scopes; +} + You could just return an ArrayRef to a static const array. Comment at: lib/CodeGen/CGAtomic.cpp:687 + + auto *SC = Builder.CreateIntCast(Scop

[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

2017-08-10 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision. https://reviews.llvm.org/D36580 Files: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/SyncScope.h lib/CodeGen/CGAtomic.cpp lib/Sema/SemaChecking.cpp test/CodeGenOpenCL/atomic-ops-libcall.cl test/CodeGenOpenCL/atomic-ops.cl test/SemaOpenC