DPC++ Runtime
Runtime libraries for oneAPI DPC++
sycl::_V1::nd_item< Dimensions > Class Template Reference

Identifies an instance of the function object executing at each point in an nd_range. More...

#include <sycl/nd_item.hpp>

Collaboration diagram for sycl::_V1::nd_item< Dimensions >:

Public Member Functions

id< Dimensionsget_global_id () const
 
size_t __SYCL_ALWAYS_INLINE get_global_id (int Dimension) const
 
size_t __SYCL_ALWAYS_INLINE get_global_linear_id () const
 
id< Dimensionsget_local_id () const
 
size_t __SYCL_ALWAYS_INLINE get_local_id (int Dimension) const
 
size_t get_local_linear_id () const
 
group< Dimensionsget_group () const
 
sub_group get_sub_group () const
 
size_t __SYCL_ALWAYS_INLINE get_group (int Dimension) const
 
size_t __SYCL_ALWAYS_INLINE get_group_linear_id () const
 
range< Dimensionsget_group_range () const
 
size_t __SYCL_ALWAYS_INLINE get_group_range (int Dimension) const
 
range< Dimensionsget_global_range () const
 
size_t get_global_range (int Dimension) const
 
range< Dimensionsget_local_range () const
 
size_t get_local_range (int Dimension) const
 
id< Dimensionsget_offset () const
 
nd_range< Dimensionsget_nd_range () const
 
void barrier (access::fence_space accessSpace=access::fence_space::global_and_local) const
 
template<access::mode accessMode = access::mode::read_write>
void mem_fence (typename std::enable_if_t< accessMode==access::mode::read||accessMode==access::mode::write||accessMode==access::mode::read_write, access::fence_space > accessSpace=access::fence_space::global_and_local) const
 Executes a work-group mem-fence with memory ordering on the local address space, global address space or both based on the value of accessSpace. More...
 
template<typename dataT >
std::enable_if_t<!detail::is_bool< dataT >::value, device_eventasync_work_group_copy (local_ptr< dataT > dest, global_ptr< dataT > src, size_t numElements, size_t srcStride) const
 Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest with a source stride specified by srcStride, and returns a SYCL device_event which can be used to wait on the completion of the copy. More...
 
template<typename dataT >
std::enable_if_t<!detail::is_bool< dataT >::value, device_eventasync_work_group_copy (global_ptr< dataT > dest, local_ptr< dataT > src, size_t numElements, size_t destStride) const
 Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest with the destination stride specified by destStride, and returns a SYCL device_event which can be used to wait on the completion of the copy. More...
 
template<typename DestDataT , typename SrcDataT >
std::enable_if_t<!detail::is_bool< DestDataT >::value &&std::is_same_v< std::remove_const_t< SrcDataT >, DestDataT >, device_eventasync_work_group_copy (decorated_local_ptr< DestDataT > dest, decorated_global_ptr< SrcDataT > src, size_t numElements, size_t srcStride) const
 Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest with a source stride specified by srcStride, and returns a SYCL device_event which can be used to wait on the completion of the copy. More...
 
template<typename DestDataT , typename SrcDataT >
std::enable_if_t<!detail::is_bool< DestDataT >::value &&std::is_same_v< std::remove_const_t< SrcDataT >, DestDataT >, device_eventasync_work_group_copy (decorated_global_ptr< DestDataT > dest, decorated_local_ptr< SrcDataT > src, size_t numElements, size_t destStride) const
 Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest with the destination stride specified by destStride, and returns a SYCL device_event which can be used to wait on the completion of the copy. More...
 
template<typename T , access::address_space DestS, access::address_space SrcS>
std::enable_if_t< detail::is_scalar_bool< T >::value, device_eventasync_work_group_copy (multi_ptr< T, DestS, access::decorated::legacy > Dest, multi_ptr< T, SrcS, access::decorated::legacy > Src, size_t NumElements, size_t Stride) const
 Specialization for scalar bool type. More...
 
template<typename T , access::address_space DestS, access::address_space SrcS>
std::enable_if_t< detail::is_vector_bool< T >::value, device_eventasync_work_group_copy (multi_ptr< T, DestS, access::decorated::legacy > Dest, multi_ptr< T, SrcS, access::decorated::legacy > Src, size_t NumElements, size_t Stride) const
 Specialization for vector bool type. More...
 
template<typename DestT , access::address_space DestS, typename SrcT , access::address_space SrcS>
std::enable_if_t< detail::is_scalar_bool< DestT >::value &&std::is_same_v< std::remove_const_t< SrcT >, DestT >, device_eventasync_work_group_copy (multi_ptr< DestT, DestS, access::decorated::yes > Dest, multi_ptr< SrcT, SrcS, access::decorated::yes > Src, size_t NumElements, size_t Stride) const
 Specialization for scalar bool type. More...
 
template<typename DestT , access::address_space DestS, typename SrcT , access::address_space SrcS>
std::enable_if_t< detail::is_vector_bool< DestT >::value &&std::is_same_v< std::remove_const_t< SrcT >, DestT >, device_eventasync_work_group_copy (multi_ptr< DestT, DestS, access::decorated::yes > Dest, multi_ptr< SrcT, SrcS, access::decorated::yes > Src, size_t NumElements, size_t Stride) const
 Specialization for vector bool type. More...
 
template<typename dataT >
device_event async_work_group_copy (local_ptr< dataT > dest, global_ptr< dataT > src, size_t numElements) const
 Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest and returns a SYCL device_event which can be used to wait on the completion of the copy. More...
 
template<typename dataT >
device_event async_work_group_copy (global_ptr< dataT > dest, local_ptr< dataT > src, size_t numElements) const
 Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest and returns a SYCL device_event which can be used to wait on the completion of the copy. More...
 
template<typename DestDataT , typename SrcDataT >
std::enable_if_t< std::is_same_v< DestDataT, std::remove_const_t< SrcDataT > >, device_eventasync_work_group_copy (decorated_local_ptr< DestDataT > dest, decorated_global_ptr< SrcDataT > src, size_t numElements) const
 Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest and returns a SYCL device_event which can be used to wait on the completion of the copy. More...
 
template<typename DestDataT , typename SrcDataT >
std::enable_if_t< std::is_same_v< DestDataT, std::remove_const_t< SrcDataT > >, device_eventasync_work_group_copy (decorated_global_ptr< DestDataT > dest, decorated_local_ptr< SrcDataT > src, size_t numElements) const
 Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest and returns a SYCL device_event which can be used to wait on the completion of the copy. More...
 
template<typename... eventTN>
void wait_for (eventTN... events) const
 
sycl::ext::oneapi::experimental::root_group< Dimensionsext_oneapi_get_root_group () const
 
 nd_item (const nd_item &rhs)=default
 
 nd_item (nd_item &&rhs)=default
 
nd_itemoperator= (const nd_item &rhs)=default
 
nd_itemoperator= (nd_item &&rhs)=default
 
bool operator== (const nd_item &) const
 
bool operator!= (const nd_item &rhs) const
 

Static Public Attributes

static constexpr int dimensions = Dimensions
 

Protected Member Functions

 nd_item ()
 
 nd_item (const item< Dimensions, true > &, const item< Dimensions, false > &, const group< Dimensions > &)
 
void waitForHelper () const
 
void waitForHelper (device_event Event) const
 
template<typename T , typename... Ts>
void waitForHelper (T E, Ts... Es) const
 
id< Dimensionsget_group_id () const
 

Friends

class detail::Builder
 

Detailed Description

template<int Dimensions = 1>
class sycl::_V1::nd_item< Dimensions >

Identifies an instance of the function object executing at each point in an nd_range.

Definition at line 48 of file nd_item.hpp.

Constructor & Destructor Documentation

◆ nd_item() [1/4]

template<int Dimensions = 1>
sycl::_V1::nd_item< Dimensions >::nd_item ( const nd_item< Dimensions > &  rhs)
default

◆ nd_item() [2/4]

template<int Dimensions = 1>
sycl::_V1::nd_item< Dimensions >::nd_item ( nd_item< Dimensions > &&  rhs)
default

◆ nd_item() [3/4]

template<int Dimensions = 1>
sycl::_V1::nd_item< Dimensions >::nd_item ( )
inlineprotected

Definition at line 514 of file nd_item.hpp.

◆ nd_item() [4/4]

template<int Dimensions = 1>
sycl::_V1::nd_item< Dimensions >::nd_item ( const item< Dimensions, true > &  ,
const item< Dimensions, false > &  ,
const group< Dimensions > &   
)
inlineprotected

Definition at line 515 of file nd_item.hpp.

Member Function Documentation

◆ async_work_group_copy() [1/12]

template<int Dimensions = 1>
template<typename DestDataT , typename SrcDataT >
std::enable_if_t< std::is_same_v<DestDataT, std::remove_const_t<SrcDataT> >, device_event> sycl::_V1::nd_item< Dimensions >::async_work_group_copy ( decorated_global_ptr< DestDataT >  dest,
decorated_local_ptr< SrcDataT >  src,
size_t  numElements 
) const
inline

Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest and returns a SYCL device_event which can be used to wait on the completion of the copy.

Permitted types for DestDataT are all scalar and vector types. SrcDataT must be either the same as DestDataT or const DestDataT.

Definition at line 488 of file nd_item.hpp.

References sycl::_V1::nd_item< Dimensions >::async_work_group_copy().

◆ async_work_group_copy() [2/12]

template<int Dimensions = 1>
template<typename DestDataT , typename SrcDataT >
std::enable_if_t<!detail::is_bool<DestDataT>::value && std::is_same_v<std::remove_const_t<SrcDataT>, DestDataT>, device_event> sycl::_V1::nd_item< Dimensions >::async_work_group_copy ( decorated_global_ptr< DestDataT >  dest,
decorated_local_ptr< SrcDataT >  src,
size_t  numElements,
size_t  destStride 
) const
inline

Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest with the destination stride specified by destStride, and returns a SYCL device_event which can be used to wait on the completion of the copy.

Permitted types for DestDataT are all scalar and vector types, except boolean. SrcDataT must be either the same as DestDataT or const DestDataT.

Definition at line 316 of file nd_item.hpp.

References __SYCL_OpGroupAsyncCopyLocalToGlobal(), and __spv::Scope::Workgroup.

◆ async_work_group_copy() [3/12]

template<int Dimensions = 1>
template<typename DestDataT , typename SrcDataT >
std::enable_if_t< std::is_same_v<DestDataT, std::remove_const_t<SrcDataT> >, device_event> sycl::_V1::nd_item< Dimensions >::async_work_group_copy ( decorated_local_ptr< DestDataT >  dest,
decorated_global_ptr< SrcDataT >  src,
size_t  numElements 
) const
inline

Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest and returns a SYCL device_event which can be used to wait on the completion of the copy.

Permitted types for DestDataT are all scalar and vector types. SrcDataT must be either the same as DestDataT or const DestDataT.

Definition at line 473 of file nd_item.hpp.

References sycl::_V1::nd_item< Dimensions >::async_work_group_copy().

◆ async_work_group_copy() [4/12]

template<int Dimensions = 1>
template<typename DestDataT , typename SrcDataT >
std::enable_if_t<!detail::is_bool<DestDataT>::value && std::is_same_v<std::remove_const_t<SrcDataT>, DestDataT>, device_event> sycl::_V1::nd_item< Dimensions >::async_work_group_copy ( decorated_local_ptr< DestDataT >  dest,
decorated_global_ptr< SrcDataT >  src,
size_t  numElements,
size_t  srcStride 
) const
inline

Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest with a source stride specified by srcStride, and returns a SYCL device_event which can be used to wait on the completion of the copy.

Permitted types for DestDataT are all scalar and vector types, except boolean. SrcDataT must be either the same as DestDataT or const DestDataT.

Definition at line 294 of file nd_item.hpp.

References __SYCL_OpGroupAsyncCopyGlobalToLocal(), and __spv::Scope::Workgroup.

◆ async_work_group_copy() [5/12]

template<int Dimensions = 1>
template<typename dataT >
device_event sycl::_V1::nd_item< Dimensions >::async_work_group_copy ( global_ptr< dataT >  dest,
local_ptr< dataT >  src,
size_t  numElements 
) const
inline

Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest and returns a SYCL device_event which can be used to wait on the completion of the copy.

Permitted types for dataT are all scalar and vector types.

Definition at line 459 of file nd_item.hpp.

References sycl::_V1::nd_item< Dimensions >::async_work_group_copy().

◆ async_work_group_copy() [6/12]

template<int Dimensions = 1>
template<typename dataT >
std::enable_if_t<!detail::is_bool<dataT>::value, device_event> sycl::_V1::nd_item< Dimensions >::async_work_group_copy ( global_ptr< dataT >  dest,
local_ptr< dataT >  src,
size_t  numElements,
size_t  destStride 
) const
inline

Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest with the destination stride specified by destStride, and returns a SYCL device_event which can be used to wait on the completion of the copy.

Permitted types for dataT are all scalar and vector types, except boolean.

Definition at line 270 of file nd_item.hpp.

References __SYCL_OpGroupAsyncCopyLocalToGlobal(), and __spv::Scope::Workgroup.

◆ async_work_group_copy() [7/12]

template<int Dimensions = 1>
template<typename dataT >
device_event sycl::_V1::nd_item< Dimensions >::async_work_group_copy ( local_ptr< dataT >  dest,
global_ptr< dataT >  src,
size_t  numElements 
) const
inline

Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest and returns a SYCL device_event which can be used to wait on the completion of the copy.

Permitted types for dataT are all scalar and vector types.

Definition at line 446 of file nd_item.hpp.

References sycl::_V1::nd_item< Dimensions >::async_work_group_copy().

◆ async_work_group_copy() [8/12]

template<int Dimensions = 1>
template<typename dataT >
std::enable_if_t<!detail::is_bool<dataT>::value, device_event> sycl::_V1::nd_item< Dimensions >::async_work_group_copy ( local_ptr< dataT >  dest,
global_ptr< dataT >  src,
size_t  numElements,
size_t  srcStride 
) const
inline

Asynchronously copies a number of elements specified by numElements from the source pointed by src to destination pointed by dest with a source stride specified by srcStride, and returns a SYCL device_event which can be used to wait on the completion of the copy.

Permitted types for dataT are all scalar and vector types, except boolean.

Definition at line 249 of file nd_item.hpp.

References __SYCL_OpGroupAsyncCopyGlobalToLocal(), and __spv::Scope::Workgroup.

Referenced by sycl::_V1::nd_item< Dimensions >::async_work_group_copy().

◆ async_work_group_copy() [9/12]

template<int Dimensions = 1>
template<typename DestT , access::address_space DestS, typename SrcT , access::address_space SrcS>
std::enable_if_t<detail::is_scalar_bool<DestT>::value && std::is_same_v<std::remove_const_t<SrcT>, DestT>, device_event> sycl::_V1::nd_item< Dimensions >::async_work_group_copy ( multi_ptr< DestT, DestS, access::decorated::yes Dest,
multi_ptr< SrcT, SrcS, access::decorated::yes Src,
size_t  NumElements,
size_t  Stride 
) const
inline

Specialization for scalar bool type.

Asynchronously copies a number of elements specified by NumElements from the source pointed by Src to destination pointed by Dest with a stride specified by Stride, and returns a SYCL device_event which can be used to wait on the completion of the copy.

Definition at line 391 of file nd_item.hpp.

References sycl::_V1::nd_item< Dimensions >::async_work_group_copy(), sycl::_V1::detail::cast_AS(), and sycl::_V1::access::yes.

◆ async_work_group_copy() [10/12]

template<int Dimensions = 1>
template<typename DestT , access::address_space DestS, typename SrcT , access::address_space SrcS>
std::enable_if_t<detail::is_vector_bool<DestT>::value && std::is_same_v<std::remove_const_t<SrcT>, DestT>, device_event> sycl::_V1::nd_item< Dimensions >::async_work_group_copy ( multi_ptr< DestT, DestS, access::decorated::yes Dest,
multi_ptr< SrcT, SrcS, access::decorated::yes Src,
size_t  NumElements,
size_t  Stride 
) const
inline

Specialization for vector bool type.

Asynchronously copies a number of elements specified by NumElements from the source pointed by Src to destination pointed by Dest with a stride specified by Stride, and returns a SYCL device_event which can be used to wait on the completion of the copy.

Definition at line 419 of file nd_item.hpp.

References sycl::_V1::nd_item< Dimensions >::async_work_group_copy(), sycl::_V1::detail::cast_AS(), and sycl::_V1::access::yes.

◆ async_work_group_copy() [11/12]

template<int Dimensions = 1>
template<typename T , access::address_space DestS, access::address_space SrcS>
std::enable_if_t< detail::is_scalar_bool<T>::value, device_event> sycl::_V1::nd_item< Dimensions >::async_work_group_copy ( multi_ptr< T, DestS, access::decorated::legacy >  Dest,
multi_ptr< T, SrcS, access::decorated::legacy >  Src,
size_t  NumElements,
size_t  Stride 
) const
inline

Specialization for scalar bool type.

Asynchronously copies a number of elements specified by NumElements from the source pointed by Src to destination pointed by Dest with a stride specified by Stride, and returns a SYCL device_event which can be used to wait on the completion of the copy.

Definition at line 337 of file nd_item.hpp.

References sycl::_V1::nd_item< Dimensions >::async_work_group_copy().

◆ async_work_group_copy() [12/12]

template<int Dimensions = 1>
template<typename T , access::address_space DestS, access::address_space SrcS>
std::enable_if_t< detail::is_vector_bool<T>::value, device_event> sycl::_V1::nd_item< Dimensions >::async_work_group_copy ( multi_ptr< T, DestS, access::decorated::legacy >  Dest,
multi_ptr< T, SrcS, access::decorated::legacy >  Src,
size_t  NumElements,
size_t  Stride 
) const
inline

Specialization for vector bool type.

Asynchronously copies a number of elements specified by NumElements from the source pointed by Src to destination pointed by Dest with a stride specified by Stride, and returns a SYCL device_event which can be used to wait on the completion of the copy.

Definition at line 363 of file nd_item.hpp.

References sycl::_V1::nd_item< Dimensions >::async_work_group_copy().

◆ barrier()

◆ ext_oneapi_get_root_group()

template<int Dimensions = 1>
sycl::ext::oneapi::experimental::root_group<Dimensions> sycl::_V1::nd_item< Dimensions >::ext_oneapi_get_root_group ( ) const
inline

Definition at line 499 of file nd_item.hpp.

◆ get_global_id() [1/2]

◆ get_global_id() [2/2]

template<int Dimensions = 1>
size_t __SYCL_ALWAYS_INLINE sycl::_V1::nd_item< Dimensions >::get_global_id ( int  Dimension) const
inline

◆ get_global_linear_id()

◆ get_global_range() [1/2]

◆ get_global_range() [2/2]

template<int Dimensions = 1>
size_t sycl::_V1::nd_item< Dimensions >::get_global_range ( int  Dimension) const
inline

◆ get_group() [1/2]

◆ get_group() [2/2]

template<int Dimensions = 1>
size_t __SYCL_ALWAYS_INLINE sycl::_V1::nd_item< Dimensions >::get_group ( int  Dimension) const
inline

◆ get_group_id()

template<int Dimensions = 1>
id<Dimensions> sycl::_V1::nd_item< Dimensions >::get_group_id ( ) const
inlineprotected

◆ get_group_linear_id()

◆ get_group_range() [1/2]

◆ get_group_range() [2/2]

template<int Dimensions = 1>
size_t __SYCL_ALWAYS_INLINE sycl::_V1::nd_item< Dimensions >::get_group_range ( int  Dimension) const
inline

◆ get_local_id() [1/2]

◆ get_local_id() [2/2]

template<int Dimensions = 1>
size_t __SYCL_ALWAYS_INLINE sycl::_V1::nd_item< Dimensions >::get_local_id ( int  Dimension) const
inline

◆ get_local_linear_id()

◆ get_local_range() [1/2]

◆ get_local_range() [2/2]

template<int Dimensions = 1>
size_t sycl::_V1::nd_item< Dimensions >::get_local_range ( int  Dimension) const
inline

◆ get_nd_range()

◆ get_offset()

template<int Dimensions = 1>
id<Dimensions> sycl::_V1::nd_item< Dimensions >::get_offset ( ) const
inline

◆ get_sub_group()

template<int Dimensions = 1>
sub_group sycl::_V1::nd_item< Dimensions >::get_sub_group ( ) const
inline

Definition at line 124 of file nd_item.hpp.

◆ mem_fence()

template<int Dimensions = 1>
template<access::mode accessMode = access::mode::read_write>
void sycl::_V1::nd_item< Dimensions >::mem_fence ( typename std::enable_if_t< accessMode==access::mode::read||accessMode==access::mode::write||accessMode==access::mode::read_write, access::fence_space accessSpace = access::fence_space::global_and_local) const
inline

Executes a work-group mem-fence with memory ordering on the local address space, global address space or both based on the value of accessSpace.

Definition at line 223 of file nd_item.hpp.

References __spirv_MemoryBarrier(), sycl::_V1::detail::getSPIRVMemorySemanticsMask(), and __spv::Scope::Workgroup.

◆ operator!=()

template<int Dimensions = 1>
bool sycl::_V1::nd_item< Dimensions >::operator!= ( const nd_item< Dimensions > &  rhs) const
inline

Definition at line 510 of file nd_item.hpp.

◆ operator=() [1/2]

template<int Dimensions = 1>
nd_item& sycl::_V1::nd_item< Dimensions >::operator= ( const nd_item< Dimensions > &  rhs)
default

◆ operator=() [2/2]

template<int Dimensions = 1>
nd_item& sycl::_V1::nd_item< Dimensions >::operator= ( nd_item< Dimensions > &&  rhs)
default

◆ operator==()

template<int Dimensions = 1>
bool sycl::_V1::nd_item< Dimensions >::operator== ( const nd_item< Dimensions > &  ) const
inline

Definition at line 509 of file nd_item.hpp.

◆ wait_for()

template<int Dimensions = 1>
template<typename... eventTN>
void sycl::_V1::nd_item< Dimensions >::wait_for ( eventTN...  events) const
inline

Definition at line 494 of file nd_item.hpp.

References sycl::_V1::nd_item< Dimensions >::waitForHelper().

◆ waitForHelper() [1/3]

template<int Dimensions = 1>
void sycl::_V1::nd_item< Dimensions >::waitForHelper ( ) const
inlineprotected

◆ waitForHelper() [2/3]

template<int Dimensions = 1>
void sycl::_V1::nd_item< Dimensions >::waitForHelper ( device_event  Event) const
inlineprotected

Definition at line 520 of file nd_item.hpp.

References sycl::_V1::device_event::wait().

◆ waitForHelper() [3/3]

template<int Dimensions = 1>
template<typename T , typename... Ts>
void sycl::_V1::nd_item< Dimensions >::waitForHelper ( E,
Ts...  Es 
) const
inlineprotected

Definition at line 523 of file nd_item.hpp.

References sycl::_V1::nd_item< Dimensions >::waitForHelper().

Friends And Related Function Documentation

◆ detail::Builder

template<int Dimensions = 1>
friend class detail::Builder
friend

Definition at line 513 of file nd_item.hpp.

Member Data Documentation

◆ dimensions

template<int Dimensions = 1>
constexpr int sycl::_V1::nd_item< Dimensions >::dimensions = Dimensions
staticconstexpr

Definition at line 50 of file nd_item.hpp.


The documentation for this class was generated from the following files: