sycl::nd_item

template <int dimensions = 1>
class nd_item;

The nd_item describes the location of a point in an sycl::nd_range.

An nd_item is typically passed to a kernel function in a parallel_for. It addition to containing the id of the work item in the work group and global space, the nd_item also contains the sycl::nd_range defining the index space.

See also

SYCL Specification Section 4.10.1.5

get_global_id

sycl::id<dimensions> get_global_id() const;
size_t get_global_id(int dimension) const;

Returns global sycl::id for the requested dimensions.

get_global_linear_id

size_t get_global_linear_id() const;

Returns global id mapped to a linear space.

get_local_id

sycl::id<dimensions> get_local_id() const;
size_t get_local_id(int dimension) const;

Returns id for the point in the work group.

get_local_linear_id

size_t get_local_linear_id() const;

Returns linear id for point in the work group.

get_group

sycl::group<dimensions> get_group() const;
size_t get_group(int dimension) const;

Returns sycl::group associated with the item.

get_group_linear_id

size_t get_group_linear_id() const;

Returns linear id for group in workspace.

get_group_range

sycl::range<dimensions> get_group_range() const;
size_t get_group_range(int dimension) const;

Returns the number of groups in every dimension.

get_global_range

sycl::range<dimensions> get_global_range() const;
size_t get_global_range(int dimension) const;

Returns the sycl::range of the index space.

get_local_range

sycl::range<dimensions> get_local_range() const;
size_t get_local_range(int dimension) const;

Returns the position of the work item in the work group.

get_offset

sycl::id<dimensions> get_offset() const;

Returns the offset provided to the parallel_for.

get_nd_range

sycl::nd_range<dimensions> get_nd_range() const;

Returns the sycl::nd_range provided to the parallel_for.

barrier

void barrier(sycl::access::fence_space accessSpace =
  sycl::access::fence_space::global_and_local) const;

Executes a work group barrier.

mem_fence

template <sycl::access::mode accessMode = sycl::access::mode::read_write>
void mem_fence(sycl::access::fence_space accessSpace =
  sycl::access::fence_space::global_and_local) const;

Executes a work group memory fence.

async_work_group_copy

template <typename dataT>
device_event async_work_group_copy(sycl::local_ptr<dataT> dest,
  sycl::global_ptr<dataT> src, size_t numElements) const;
template <typename dataT>
device_event async_work_group_copy(sycl::global_ptr<dataT> dest,
  sycl::local_ptr<dataT> src, size_t numElements) const;
template <typename dataT>
device_event async_work_group_copy(sycl::local_ptr<dataT> dest,
  sycl::global_ptr<dataT> src, size_t numElements, size_t srcStride) const;
template <typename dataT>
sycl::device_event async_work_group_copy(sycl::global_ptr<dataT> dest,
  sycl::local_ptr<dataT> src, size_t numElements, size_t destStride) const;

Copies elements from a source local to the destination asynchronously.

Returns an event that indicates when the operation has completed.

wait_for

template <typename... eventTN>
void wait_for(eventTN... events) const;

Wait for asynchronous events to complete.