Skip to content

Commit 3105802

Browse files
committed
[SYCL] Complete nd_item interface updates
1 parent 68b2d3e commit 3105802

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

sycl/include/sycl/nd_item.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ template <int Dimensions = 1> class nd_item {
4747
public:
4848
static constexpr int dimensions = Dimensions;
4949

50+
nd_item() = delete;
51+
5052
id<Dimensions> get_global_id() const noexcept {
5153
#ifdef __SYCL_DEVICE_ONLY__
5254
return __spirv::initBuiltInGlobalInvocationId<Dimensions, id<Dimensions>>();
@@ -199,7 +201,7 @@ template <int Dimensions = 1> class nd_item {
199201
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
200202
__SYCL2020_DEPRECATED("use sycl::group_barrier() free function instead")
201203
void barrier([[maybe_unused]] access::fence_space accessSpace =
202-
access::fence_space::global_and_local) const noexcept {
204+
access::fence_space::global_and_local) const {
203205
#ifdef __SYCL_DEVICE_ONLY__
204206
uint32_t flags = _V1::detail::getSPIRVMemorySemanticsMask(accessSpace);
205207
__spirv_ControlBarrier(__spv::Scope::Workgroup, __spv::Scope::Workgroup,
@@ -217,7 +219,7 @@ template <int Dimensions = 1> class nd_item {
217219
accessMode == access::mode::write ||
218220
accessMode == access::mode::read_write,
219221
access::fence_space>
220-
accessSpace = access::fence_space::global_and_local) const noexcept {
222+
accessSpace = access::fence_space::global_and_local) const {
221223
#if __SYCL_DEVICE_ONLY__
222224
uint32_t flags = detail::getSPIRVMemorySemanticsMask(accessSpace);
223225
// TODO: currently, there is no good way in SPIR-V to set the memory
@@ -528,7 +530,6 @@ template <int Dimensions = 1> class nd_item {
528530

529531
protected:
530532
friend class detail::Builder;
531-
nd_item() {}
532533
nd_item(const item<Dimensions, true> &, const item<Dimensions, false> &,
533534
const group<Dimensions> &) {}
534535

sycl/test/basic_tests/nd_item_interface.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ struct has_member_not_equal<
3535

3636
using Item = sycl::nd_item<1>;
3737

38+
static_assert(!std::is_default_constructible_v<Item>);
39+
3840
static_assert(noexcept(std::declval<const Item &>().get_global_id()));
3941
static_assert(noexcept(std::declval<const Item &>().get_global_id(0)));
4042
static_assert(noexcept(std::declval<const Item &>().get_global_linear_id()));
@@ -54,11 +56,6 @@ static_assert(noexcept(std::declval<const Item &>().get_local_range(0)));
5456
static_assert(noexcept(std::declval<const Item &>().get_offset()));
5557
static_assert(noexcept(std::declval<const Item &>().get_nd_range()));
5658

57-
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
58-
static_assert(noexcept(std::declval<const Item &>().barrier()));
59-
static_assert(noexcept(std::declval<const Item &>().mem_fence()));
60-
#endif
61-
6259
static_assert(!has_member_equal<Item>::value);
6360
static_assert(!has_member_not_equal<Item>::value);
6461
static_assert(std::is_same_v<decltype(std::declval<const Item &>() ==

0 commit comments

Comments
 (0)