DPC++ Runtime
Runtime libraries for oneAPI DPC++
accessor.hpp File Reference

The file contains implementations of accessor class. More...

#include <sycl/access/access.hpp>
#include <sycl/aliases.hpp>
#include <sycl/aspects.hpp>
#include <sycl/atomic.hpp>
#include <sycl/buffer.hpp>
#include <sycl/detail/accessor_iterator.hpp>
#include <sycl/detail/common.hpp>
#include <sycl/detail/defines.hpp>
#include <sycl/detail/defines_elementary.hpp>
#include <sycl/detail/export.hpp>
#include <sycl/detail/generic_type_traits.hpp>
#include <sycl/detail/handler_proxy.hpp>
#include <sycl/detail/helpers.hpp>
#include <sycl/detail/image_accessor_util.hpp>
#include <sycl/detail/owner_less_base.hpp>
#include <sycl/detail/pi.h>
#include <sycl/detail/property_helper.hpp>
#include <sycl/detail/property_list_base.hpp>
#include <sycl/detail/type_list.hpp>
#include <sycl/detail/type_traits.hpp>
#include <sycl/device.hpp>
#include <sycl/exception.hpp>
#include <sycl/ext/oneapi/accessor_property_list.hpp>
#include <sycl/ext/oneapi/weak_object_base.hpp>
#include <sycl/id.hpp>
#include <sycl/image.hpp>
#include <sycl/multi_ptr.hpp>
#include <sycl/pointers.hpp>
#include <sycl/properties/accessor_properties.hpp>
#include <sycl/properties/buffer_properties.hpp>
#include <sycl/property_list.hpp>
#include <sycl/range.hpp>
#include <sycl/sampler.hpp>
#include <sycl/types.hpp>
#include <cstddef>
#include <functional>
#include <iterator>
#include <limits>
#include <memory>
#include <optional>
#include <stdint.h>
#include <tuple>
#include <type_traits>
#include <typeinfo>
#include <variant>
Include dependency graph for accessor.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sycl::_V1::detail::AccHostDataT
 
struct  sycl::_V1::detail::IsCxPropertyList< T >
 
struct  sycl::_V1::detail::IsCxPropertyList< ext::oneapi::accessor_property_list< Props... > >
 
struct  sycl::_V1::detail::IsCxPropertyList< ext::oneapi::accessor_property_list<> >
 
class  sycl::_V1::detail::accessor_common< DataT, Dimensions, AccessMode, AccessTarget, IsPlaceholder, PropertyListT >
 
class  sycl::_V1::detail::accessor_common< DataT, Dimensions, AccessMode, AccessTarget, IsPlaceholder, PropertyListT >::AccessorSubscript< SubDims, AccType >
 
class  sycl::_V1::detail::LocalAccessorBaseDevice< Dims >
 
class  sycl::_V1::detail::AccessorImplDevice< Dims >
 
class  sycl::_V1::detail::AccessorBaseHost
 
class  sycl::_V1::detail::LocalAccessorBaseHost
 
class  sycl::_V1::detail::UnsampledImageAccessorBaseHost
 
class  sycl::_V1::detail::SampledImageAccessorBaseHost
 
struct  sycl::_V1::detail::IsValidCoordDataT< 1, T >
 
struct  sycl::_V1::detail::IsValidCoordDataT< 2, T >
 
struct  sycl::_V1::detail::IsValidCoordDataT< 3, T >
 
struct  sycl::_V1::detail::IsValidUnsampledCoord2020DataT< 1, T >
 
struct  sycl::_V1::detail::IsValidUnsampledCoord2020DataT< 2, T >
 
struct  sycl::_V1::detail::IsValidUnsampledCoord2020DataT< 3, T >
 
struct  sycl::_V1::detail::IsValidSampledCoord2020DataT< 1, T >
 
struct  sycl::_V1::detail::IsValidSampledCoord2020DataT< 2, T >
 
struct  sycl::_V1::detail::IsValidSampledCoord2020DataT< 3, T >
 
class  sycl::_V1::detail::image_accessor< DataT, Dimensions, AccessMode, AccessTarget, IsPlaceholder >
 
class  sycl::_V1::detail::__image_array_slice__< DataT, Dimensions, AccessMode, IsPlaceholder >
 
class  sycl::_V1::local_accessor_base< DataT, Dimensions, AccessMode, IsPlaceholder >
 Local accessor. More...
 
class  sycl::_V1::accessor< DataT, Dimensions, AccessMode, access::target::local, IsPlaceholder >
 
class  sycl::_V1::accessor< DataT, Dimensions, AccessMode, access::target::host_image, IsPlaceholder >
 Host image accessor. More...
 
class  sycl::_V1::host_accessor< DataT, Dimensions, AccessMode >
 
struct  sycl::_V1::host_accessor< DataT, Dimensions, AccessMode >::IsSameAsBuffer< T, Dims >
 
class  sycl::_V1::unsampled_image_accessor< DataT, Dimensions, AccessMode, AccessTarget >
 
class  sycl::_V1::host_unsampled_image_accessor< DataT, Dimensions, AccessMode >
 
class  sycl::_V1::sampled_image_accessor< DataT, Dimensions, AccessTarget >
 
class  sycl::_V1::host_sampled_image_accessor< DataT, Dimensions >
 
struct  std::hash< sycl::accessor< DataT, Dimensions, AccessMode, AccessTarget, IsPlaceholder > >
 
struct  std::hash< sycl::host_accessor< DataT, Dimensions, AccessMode > >
 
struct  std::hash< sycl::local_accessor< DataT, Dimensions > >
 
struct  std::hash< sycl::unsampled_image_accessor< DataT, Dimensions, AccessMode, AccessTarget > >
 
struct  std::hash< sycl::host_unsampled_image_accessor< DataT, Dimensions, AccessMode > >
 
struct  std::hash< sycl::sampled_image_accessor< DataT, Dimensions, AccessTarget > >
 
struct  std::hash< sycl::host_sampled_image_accessor< DataT, Dimensions > >
 

Namespaces

 sycl
 
 sycl::_V1
 
 sycl::_V1::ext
 
 sycl::_V1::ext::intel
 
 sycl::_V1::ext::intel::esimd
 
 sycl::_V1::ext::intel::esimd::detail
 
 sycl::_V1::detail
 
 std
 

Typedefs

template<typename T >
using sycl::_V1::detail::IsPropertyListT = typename std::is_base_of< PropertyListBase, T >
 
template<typename T >
using sycl::_V1::detail::IsRunTimePropertyListT = typename std::is_same< ext::oneapi::accessor_property_list<>, T >
 
using sycl::_V1::detail::AccessorImplPtr = std::shared_ptr< AccessorImplHost >
 
using sycl::_V1::detail::LocalAccessorImplPtr = std::shared_ptr< LocalAccessorImplHost >
 
using sycl::_V1::detail::UnsampledImageAccessorImplPtr = std::shared_ptr< UnsampledImageAccessorImplHost >
 
using sycl::_V1::detail::SampledImageAccessorImplPtr = std::shared_ptr< SampledImageAccessorImplHost >
 

Functions

void sycl::_V1::detail::constructorNotification (void *BufferObj, void *AccessorObj, access::target Target, access::mode Mode, const code_location &CodeLoc)
 
void sycl::_V1::detail::unsampledImageConstructorNotification (void *ImageObj, void *AccessorObj, const std::optional< image_target > &Target, access::mode Mode, const void *Type, uint32_t ElemSize, const code_location &CodeLoc)
 
void sycl::_V1::detail::sampledImageConstructorNotification (void *ImageObj, void *AccessorObj, const std::optional< image_target > &Target, const void *Type, uint32_t ElemSize, const code_location &CodeLoc)
 
template<typename BufferT >
sycl::range< 1 > sycl::_V1::detail::GetZeroDimAccessRange (BufferT Buffer)
 
device sycl::_V1::detail::getDeviceFromHandler (handler &CommandGroupHandlerRef)
 
template<typename DataT >
constexpr access::mode sycl::_V1::detail::accessModeFromConstness ()
 
template<typename MayBeTag1 , typename MayBeTag2 >
constexpr access::mode sycl::_V1::detail::deduceAccessMode ()
 
template<typename MayBeTag1 , typename MayBeTag2 >
constexpr access::target sycl::_V1::detail::deduceAccessTarget (access::target defaultTarget)
 
void sycl::_V1::detail::addHostAccessorAndWait (AccessorImplHost *Req)
 
void sycl::_V1::detail::addHostUnsampledImageAccessorAndWait (UnsampledImageAccessorImplHost *Req)
 
void sycl::_V1::detail::addHostSampledImageAccessorAndWait (SampledImageAccessorImplHost *Req)
 
template<typename DataT , int Dimensions, typename AllocatorT >
class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >) -> accessor< DataT, Dimensions, access::mode::read_write, target::device, access::placeholder::true_t >
 Buffer accessor. More...
 
template<typename DataT , int Dimensions, typename AllocatorT , typename... PropsT>
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, const ext::oneapi::accessor_property_list< PropsT... > &) -> accessor< DataT, Dimensions, access::mode::read_write, target::device, access::placeholder::true_t, ext::oneapi::accessor_property_list< PropsT... >>
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 >
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, Type1) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type1, Type1 >(), detail::deduceAccessTarget< Type1, Type1 >(target::device), access::placeholder::true_t >
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename... PropsT>
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, Type1, const ext::oneapi::accessor_property_list< PropsT... > &) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type1, Type1 >(), detail::deduceAccessTarget< Type1, Type1 >(target::device), access::placeholder::true_t, ext::oneapi::accessor_property_list< PropsT... >>
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 >
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, Type1, Type2) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type1, Type2 >(), detail::deduceAccessTarget< Type1, Type2 >(target::device), access::placeholder::true_t >
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 , typename... PropsT>
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, Type1, Type2, const ext::oneapi::accessor_property_list< PropsT... > &) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type1, Type2 >(), detail::deduceAccessTarget< Type1, Type2 >(target::device), access::placeholder::true_t, ext::oneapi::accessor_property_list< PropsT... >>
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 , typename Type3 >
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, Type1, Type2, Type3) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type2, Type3 >(), detail::deduceAccessTarget< Type2, Type3 >(target::device), access::placeholder::true_t >
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 , typename Type3 , typename... PropsT>
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, Type1, Type2, Type3, const ext::oneapi::accessor_property_list< PropsT... > &) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type2, Type3 >(), detail::deduceAccessTarget< Type2, Type3 >(target::device), access::placeholder::true_t, ext::oneapi::accessor_property_list< PropsT... >>
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 , typename Type3 , typename Type4 >
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, Type1, Type2, Type3, Type4) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type3, Type4 >(), detail::deduceAccessTarget< Type3, Type4 >(target::device), access::placeholder::true_t >
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 , typename Type3 , typename Type4 , typename... PropsT>
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, Type1, Type2, Type3, Type4, const ext::oneapi::accessor_property_list< PropsT... > &) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type3, Type4 >(), detail::deduceAccessTarget< Type3, Type4 >(target::device), access::placeholder::true_t, ext::oneapi::accessor_property_list< PropsT... >>
 
template<typename DataT , int Dimensions, typename AllocatorT >
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, handler &) -> accessor< DataT, Dimensions, access::mode::read_write, target::device, access::placeholder::false_t >
 
template<typename DataT , int Dimensions, typename AllocatorT , typename... PropsT>
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, handler &, const ext::oneapi::accessor_property_list< PropsT... > &) -> accessor< DataT, Dimensions, access::mode::read_write, target::device, access::placeholder::false_t, ext::oneapi::accessor_property_list< PropsT... >>
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 >
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, handler &, Type1) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type1, Type1 >(), detail::deduceAccessTarget< Type1, Type1 >(target::device), access::placeholder::false_t >
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename... PropsT>
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, handler &, Type1, const ext::oneapi::accessor_property_list< PropsT... > &) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type1, Type1 >(), detail::deduceAccessTarget< Type1, Type1 >(target::device), access::placeholder::false_t, ext::oneapi::accessor_property_list< PropsT... >>
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 >
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, handler &, Type1, Type2) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type1, Type2 >(), detail::deduceAccessTarget< Type1, Type2 >(target::device), access::placeholder::false_t >
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 , typename... PropsT>
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, handler &, Type1, Type2, const ext::oneapi::accessor_property_list< PropsT... > &) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type1, Type2 >(), detail::deduceAccessTarget< Type1, Type2 >(target::device), access::placeholder::false_t, ext::oneapi::accessor_property_list< PropsT... >>
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 , typename Type3 >
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, handler &, Type1, Type2, Type3) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type2, Type3 >(), detail::deduceAccessTarget< Type2, Type3 >(target::device), access::placeholder::false_t >
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 , typename Type3 , typename... PropsT>
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, handler &, Type1, Type2, Type3, const ext::oneapi::accessor_property_list< PropsT... > &) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type2, Type3 >(), detail::deduceAccessTarget< Type2, Type3 >(target::device), access::placeholder::false_t, ext::oneapi::accessor_property_list< PropsT... >>
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 , typename Type3 , typename Type4 >
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, handler &, Type1, Type2, Type3, Type4) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type3, Type4 >(), detail::deduceAccessTarget< Type3, Type4 >(target::device), access::placeholder::false_t >
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 , typename Type3 , typename Type4 , typename... PropsT>
 sycl::_V1::accessor (buffer< DataT, Dimensions, AllocatorT >, handler &, Type1, Type2, Type3, Type4, const ext::oneapi::accessor_property_list< PropsT... > &) -> accessor< DataT, Dimensions, detail::deduceAccessMode< Type3, Type4 >(), detail::deduceAccessTarget< Type3, Type4 >(target::device), access::placeholder::false_t, ext::oneapi::accessor_property_list< PropsT... >>
 
template<typename DataT , int Dimensions, access::mode AccessMode, access::placeholder IsPlaceholder>
class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_EBO __SYCL_SPECIAL_CLASS sycl::_V1::__SYCL_TYPE (accessor) accessor< DataT
 Image accessors. More...
 
template<typename DataT , int Dimensions, access::mode AccessMode, access::placeholder IsPlaceholder>
class __SYCL_EBO __SYCL_SPECIAL_CLASS sycl::_V1::__SYCL_TYPE (accessor) accessor< DataT
 Image array accessor. More...
 
template<typename DataT , int Dimensions, typename AllocatorT >
 sycl::_V1::host_accessor (buffer< DataT, Dimensions, AllocatorT >) -> host_accessor< DataT, Dimensions, access::mode::read_write >
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 >
 sycl::_V1::host_accessor (buffer< DataT, Dimensions, AllocatorT >, Type1) -> host_accessor< DataT, Dimensions, detail::deduceAccessMode< Type1, Type1 >()>
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 >
 sycl::_V1::host_accessor (buffer< DataT, Dimensions, AllocatorT >, Type1, Type2) -> host_accessor< DataT, Dimensions, detail::deduceAccessMode< Type1, Type2 >()>
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 , typename Type3 >
 sycl::_V1::host_accessor (buffer< DataT, Dimensions, AllocatorT >, Type1, Type2, Type3) -> host_accessor< DataT, Dimensions, detail::deduceAccessMode< Type2, Type3 >()>
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 , typename Type3 , typename Type4 >
 sycl::_V1::host_accessor (buffer< DataT, Dimensions, AllocatorT >, Type1, Type2, Type3, Type4) -> host_accessor< DataT, Dimensions, detail::deduceAccessMode< Type3, Type4 >()>
 
template<typename DataT , int Dimensions, typename AllocatorT , typename Type1 , typename Type2 , typename Type3 , typename Type4 , typename Type5 >
 sycl::_V1::host_accessor (buffer< DataT, Dimensions, AllocatorT >, Type1, Type2, Type3, Type4, Type5) -> host_accessor< DataT, Dimensions, detail::deduceAccessMode< Type4, Type5 >()>
 

Variables

class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_EBO __SYCL_SPECIAL_CLASS sycl::_V1::Dimensions
 
class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_EBO __SYCL_SPECIAL_CLASS sycl::_V1::AccessMode
 
class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_EBO __SYCL_SPECIAL_CLASS sycl::_V1::IsPlaceholder
 

Detailed Description

The file contains implementations of accessor class.

For device side AccessorImplHost/LocalAccessorImplHost are fileds of accessor(1) and accessor(3).

For host side AccessorBaseHost/LocalAccessorBaseHost contains shared_ptr which points to AccessorImplHost/LocalAccessorImplHost object.

Objects of accessor class define a requirement to access some SYCL memory object or local memory of the device.

Basically there are 3 distinct types of accessors.

One of them is an accessor to a SYCL buffer object(Buffer accessor) which has the richest interface. It supports things like accessing only a part of buffer, multidimensional access using sycl::id, conversions to various multi_ptr and atomic classes.

Second type is an accessor to a SYCL image object(Image accessor) which has "image" specific methods for reading and writing.

Finally, accessor to local memory(Local accessor) doesn't require access to any SYCL memory object, but asks for some local memory on device to be available. Some methods overlap with ones that "Buffer accessor" provides.

Buffer and Image accessors create the requirement to access some SYCL memory object(or part of it). SYCL RT must detect when two kernels want to access the same memory objects and make sure they are executed in correct order.

"accessor_common" class that contains several common methods between Buffer and Local accessors.

Accessors have different representation on host and on device. On host they have non-templated base class, that is needed to safely work with any accessor type. Furhermore on host we need some additional fields in order to implement functionality required by Specification, for example during lifetime of a host accessor other operations with memory object the accessor refers to should be blocked and when all references to the host accessor are desctructed, the memory this host accessor refers to should be "written back".

The scheme of inheritance for host side:

dot_inline_dotgraph_1.png

The scheme of inheritance for device side:

dot_inline_dotgraph_2.png

accessor(1) declares accessor as a template class and implements accessor class for access targets: host_buffer, global_buffer and constant_buffer.

accessor(3) specializes accessor(1) for the local access target.

image_accessor contains implements interfaces for access targets: host_image, image and image_array. But there are three distinct specializations of the accessor(1) (accessor(2), accessor(4), accessor(5)) that are just inherited from image_accessor.

accessor_common contains several helpers common for both accessor(1) and accessor(3)

Definition in file accessor.hpp.