Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions sycl/include/CL/sycl/accessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ class accessor_common {
constexpr static bool IsAccessReadWrite =
AccessMode == access::mode::read_write;

constexpr static bool IsAccessAtomic = AccessMode == access::mode::atomic;

using RefType = detail::const_if_const_AS<AS, DataT> &;
using ConstRefType = const DataT &;
using PtrType = detail::const_if_const_AS<AS, DataT> *;
Expand Down Expand Up @@ -325,6 +327,14 @@ class accessor_common {
return MAccessor[MIDs];
}

template <int CurDims = SubDims>
typename detail::enable_if_t<CurDims == 1 && IsAccessAtomic,
atomic<DataT, AS>>
operator[](size_t Index) const {
MIDs[Dims - CurDims] = Index;
return MAccessor[MIDs];
}

template <int CurDims = SubDims,
typename = detail::enable_if_t<CurDims == 1 && IsAccessReadOnly>>
ConstRefType operator[](size_t Index) const {
Expand Down