Skip to content

Commit 03cf168

Browse files
committed
[SYCL] Implement missing accessor functions
1 parent 85a6833 commit 03cf168

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

sycl/include/sycl/accessor.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,6 +1676,8 @@ class __SYCL_SPECIAL_CLASS accessor :
16761676
#endif
16771677
}
16781678

1679+
void swap(accessor &other) { std::swap(impl, other.impl); }
1680+
16791681
constexpr bool is_placeholder() const { return IsPlaceH; }
16801682

16811683
size_t get_size() const { return getAccessRange().size() * sizeof(DataT); }
@@ -1684,6 +1686,12 @@ class __SYCL_SPECIAL_CLASS accessor :
16841686
size_t get_count() const { return size(); }
16851687
size_t size() const noexcept { return getAccessRange().size(); }
16861688

1689+
size_t byte_size() const noexcept { return size() * sizeof(DataT); }
1690+
1691+
size_t max_size() const noexcept { return std::vector<DataT>().max_size(); }
1692+
1693+
bool empty() const noexcept { return size() == 0; }
1694+
16871695
template <int Dims = Dimensions, typename = detail::enable_if_t<(Dims > 0)>>
16881696
range<Dimensions> get_range() const {
16891697
return detail::convertToArrayOfN<Dimensions, 1>(getAccessRange());
@@ -2343,6 +2351,15 @@ class __SYCL_SPECIAL_CLASS local_accessor
23432351
}
23442352

23452353
#endif
2354+
2355+
public:
2356+
void swap(local_accessor &other) { std::swap(this->impl, other.impl); }
2357+
2358+
size_t byte_size() const noexcept { return this->size() * sizeof(DataT); }
2359+
2360+
size_t max_size() const noexcept { return std::vector<DataT>().max_size(); }
2361+
2362+
bool empty() const noexcept { return this->size() == 0; }
23462363
};
23472364

23482365
/// Image accessors.

0 commit comments

Comments
 (0)