DPC++ Runtime
Runtime libraries for oneAPI DPC++
sycl::_V1::detail::SYCLMemObjT Class Reference

#include <detail/sycl_mem_obj_t.hpp>

Inheritance diagram for sycl::_V1::detail::SYCLMemObjT:
Collaboration diagram for sycl::_V1::detail::SYCLMemObjT:

Public Member Functions

 SYCLMemObjT (const size_t SizeInBytes, const property_list &Props, std::unique_ptr< SYCLMemObjAllocator > Allocator)
 
 SYCLMemObjT (const property_list &Props, std::unique_ptr< SYCLMemObjAllocator > Allocator)
 
 SYCLMemObjT (pi_native_handle MemObject, const context &SyclContext, const size_t SizeInBytes, event AvailableEvent, std::unique_ptr< SYCLMemObjAllocator > Allocator)
 
 SYCLMemObjT (cl_mem MemObject, const context &SyclContext, event AvailableEvent, std::unique_ptr< SYCLMemObjAllocator > Allocator)
 
 SYCLMemObjT (pi_native_handle MemObject, const context &SyclContext, bool OwnNativeHandle, event AvailableEvent, std::unique_ptr< SYCLMemObjAllocator > Allocator)
 
 SYCLMemObjT (pi_native_handle MemObject, const context &SyclContext, bool OwnNativeHandle, event AvailableEvent, std::unique_ptr< SYCLMemObjAllocator > Allocator, sycl::detail::pi::PiMemImageChannelOrder Order, sycl::detail::pi::PiMemImageChannelType Type, range< 3 > Range3WithOnes, unsigned Dimensions, size_t ElementSize)
 
virtual ~SYCLMemObjT ()=default
 
const PluginPtrgetPlugin () const
 
size_t getSizeInBytes () const noexcept override
 
 __SYCL2020_DEPRECATED ("get_count() is deprecated, please use size() instead") size_t get_count() const
 
size_t size () const noexcept
 
template<typename propertyT >
bool has_property () const noexcept
 
template<typename propertyT >
propertyT get_property () const
 
void addOrReplaceAccessorProperties (const property_list &PropertyList)
 
void deleteAccessorProperty (const PropWithDataKind &Kind)
 
const std::unique_ptr< SYCLMemObjAllocator > & get_allocator_internal () const
 
void * allocateHostMem () override
 
void releaseHostMem (void *Ptr) override
 
void releaseMem (ContextImplPtr Context, void *MemAllocation) override
 
void * getUserPtr () const
 
void set_write_back (bool NeedWriteBack)
 
void set_final_data (std::nullptr_t)
 
void set_final_data_from_storage ()
 
void set_final_data (const std::function< void(const std::function< void(void *const Ptr)> &)> &FinalDataFunc)
 
bool useHostPtr ()
 
bool canReadHostPtr (void *HostPtr, const size_t RequiredAlign)
 
bool canReuseHostPtr (void *HostPtr, const size_t RequiredAlign)
 
void handleHostData (void *HostPtr, const size_t RequiredAlign)
 
void handleHostData (const void *HostPtr, const size_t RequiredAlign)
 
void handleHostData (const std::shared_ptr< void > &HostPtr, const size_t RequiredAlign, bool IsConstPtr)
 
void handleHostData (const std::function< void(void *)> &CopyFromInput, const size_t RequiredAlign, bool IsConstPtr)
 
void setAlign (size_t RequiredAlign)
 
void handleWriteAccessorCreation ()
 
void * allocateMem (ContextImplPtr Context, bool InitFromUserData, void *HostPtr, sycl::detail::pi::PiEvent &InteropEvent) override
 
MemObjType getType () const override
 
ContextImplPtr getInteropContext () const override
 
bool isInterop () const override
 
bool hasUserDataPtr () const override
 
bool isHostPointerReadOnly () const override
 
bool usesPinnedHostMemory () const override
 
void detachMemoryObject (const std::shared_ptr< SYCLMemObjT > &Self) const
 
void markAsInternal ()
 
bool needsWriteBack () const
 Returns true if this memory object requires a write_back on destruction. More...
 
void markBeingUsedInGraph ()
 Increment an internal counter for how many graphs are currently using this memory object. More...
 
void markNoLongerBeingUsedInGraph ()
 Decrement an internal counter for how many graphs are currently using this memory object. More...
 
bool isUsedInGraph () const
 Returns true if any graphs are currently using this memory object. More...
 
- Public Member Functions inherited from sycl::_V1::detail::SYCLMemObjI
virtual ~SYCLMemObjI ()=default
 

Static Public Member Functions

static size_t getBufSizeForContext (const ContextImplPtr &Context, pi_native_handle MemObject)
 

Protected Member Functions

void updateHostMemory (void *const Ptr)
 
void updateHostMemory ()
 
void determineHostPtr (const ContextImplPtr &Context, bool InitFromUserData, void *&HostPtr, bool &HostPtrReadOnly)
 

Protected Attributes

std::unique_ptr< SYCLMemObjAllocatorMAllocator
 
property_list MProps
 
EventImplPtr MInteropEvent
 
ContextImplPtr MInteropContext
 
sycl::detail::pi::PiMem MInteropMemObject
 
bool MOpenCLInterop
 
bool MHostPtrReadOnly
 
bool MNeedWriteBack
 
size_t MSizeInBytes
 
void * MUserPtr
 
void * MShadowCopy
 
std::function< void(void)> MUploadDataFunctor
 
std::shared_ptr< const void > MSharedPtrStorage
 
bool MHostPtrProvided
 
bool MIsInternal = false
 
std::atomic< size_t > MGraphUseCount = 0
 
std::function< void(void)> MCreateShadowCopy = []() -> void {}
 
bool MOwnNativeHandle = true
 
- Protected Attributes inherited from sycl::_V1::detail::SYCLMemObjI
std::shared_ptr< MemObjRecordMRecord
 

Additional Inherited Members

- Public Types inherited from sycl::_V1::detail::SYCLMemObjI
enum  MemObjType { Buffer = 0 , Image = 1 , Undefined = 2 }
 

Detailed Description

Definition at line 40 of file sycl_mem_obj_t.hpp.

Constructor & Destructor Documentation

◆ SYCLMemObjT() [1/6]

sycl::_V1::detail::SYCLMemObjT::SYCLMemObjT ( const size_t  SizeInBytes,
const property_list Props,
std::unique_ptr< SYCLMemObjAllocator Allocator 
)
inline

Definition at line 55 of file sycl_mem_obj_t.hpp.

◆ SYCLMemObjT() [2/6]

sycl::_V1::detail::SYCLMemObjT::SYCLMemObjT ( const property_list Props,
std::unique_ptr< SYCLMemObjAllocator Allocator 
)
inline

Definition at line 64 of file sycl_mem_obj_t.hpp.

◆ SYCLMemObjT() [3/6]

sycl::_V1::detail::SYCLMemObjT::SYCLMemObjT ( pi_native_handle  MemObject,
const context SyclContext,
const size_t  SizeInBytes,
event  AvailableEvent,
std::unique_ptr< SYCLMemObjAllocator Allocator 
)

Definition at line 20 of file sycl_mem_obj_t.cpp.

◆ SYCLMemObjT() [4/6]

sycl::_V1::detail::SYCLMemObjT::SYCLMemObjT ( cl_mem  MemObject,
const context SyclContext,
event  AvailableEvent,
std::unique_ptr< SYCLMemObjAllocator Allocator 
)
inline

Definition at line 72 of file sycl_mem_obj_t.hpp.

◆ SYCLMemObjT() [5/6]

sycl::_V1::detail::SYCLMemObjT::SYCLMemObjT ( pi_native_handle  MemObject,
const context SyclContext,
bool  OwnNativeHandle,
event  AvailableEvent,
std::unique_ptr< SYCLMemObjAllocator Allocator 
)

◆ SYCLMemObjT() [6/6]

◆ ~SYCLMemObjT()

virtual sycl::_V1::detail::SYCLMemObjT::~SYCLMemObjT ( )
virtualdefault

Member Function Documentation

◆ __SYCL2020_DEPRECATED()

sycl::_V1::detail::SYCLMemObjT::__SYCL2020_DEPRECATED ( "get_count() is  deprecated,
please use size() instead  
) const
inline

Definition at line 95 of file sycl_mem_obj_t.hpp.

◆ addOrReplaceAccessorProperties()

void sycl::_V1::detail::SYCLMemObjT::addOrReplaceAccessorProperties ( const property_list PropertyList)
inline

Definition at line 110 of file sycl_mem_obj_t.hpp.

◆ allocateHostMem()

void* sycl::_V1::detail::SYCLMemObjT::allocateHostMem ( )
inlineoverridevirtual

Implements sycl::_V1::detail::SYCLMemObjI.

Definition at line 122 of file sycl_mem_obj_t.hpp.

◆ allocateMem()

void* sycl::_V1::detail::SYCLMemObjT::allocateMem ( ContextImplPtr  Context,
bool  InitFromUserData,
void *  HostPtr,
sycl::detail::pi::PiEvent InteropEvent 
)
inlineoverridevirtual

Implements sycl::_V1::detail::SYCLMemObjI.

Definition at line 273 of file sycl_mem_obj_t.hpp.

◆ canReadHostPtr()

bool sycl::_V1::detail::SYCLMemObjT::canReadHostPtr ( void *  HostPtr,
const size_t  RequiredAlign 
)
inline

Definition at line 176 of file sycl_mem_obj_t.hpp.

◆ canReuseHostPtr()

bool sycl::_V1::detail::SYCLMemObjT::canReuseHostPtr ( void *  HostPtr,
const size_t  RequiredAlign 
)
inline

Definition at line 182 of file sycl_mem_obj_t.hpp.

◆ deleteAccessorProperty()

void sycl::_V1::detail::SYCLMemObjT::deleteAccessorProperty ( const PropWithDataKind Kind)
inline

Definition at line 114 of file sycl_mem_obj_t.hpp.

◆ detachMemoryObject()

◆ determineHostPtr()

void sycl::_V1::detail::SYCLMemObjT::determineHostPtr ( const ContextImplPtr Context,
bool  InitFromUserData,
void *&  HostPtr,
bool &  HostPtrReadOnly 
)
protected

◆ get_allocator_internal()

const std::unique_ptr<SYCLMemObjAllocator>& sycl::_V1::detail::SYCLMemObjT::get_allocator_internal ( ) const
inline

Definition at line 118 of file sycl_mem_obj_t.hpp.

◆ get_property()

template<typename propertyT >
propertyT sycl::_V1::detail::SYCLMemObjT::get_property ( ) const
inline

Definition at line 106 of file sycl_mem_obj_t.hpp.

◆ getBufSizeForContext()

size_t sycl::_V1::detail::SYCLMemObjT::getBufSizeForContext ( const ContextImplPtr Context,
pi_native_handle  MemObject 
)
static

Definition at line 175 of file sycl_mem_obj_t.cpp.

References PI_MEM_SIZE, and piMemGetInfo().

◆ getInteropContext()

ContextImplPtr sycl::_V1::detail::SYCLMemObjT::getInteropContext ( ) const
inlineoverridevirtual

Implements sycl::_V1::detail::SYCLMemObjI.

Definition at line 285 of file sycl_mem_obj_t.hpp.

◆ getPlugin()

const PluginPtr & sycl::_V1::detail::SYCLMemObjT::getPlugin ( ) const

◆ getSizeInBytes()

size_t sycl::_V1::detail::SYCLMemObjT::getSizeInBytes ( ) const
inlineoverridevirtualnoexcept

◆ getType()

MemObjType sycl::_V1::detail::SYCLMemObjT::getType ( ) const
inlineoverridevirtual

Implements sycl::_V1::detail::SYCLMemObjI.

Definition at line 283 of file sycl_mem_obj_t.hpp.

◆ getUserPtr()

void* sycl::_V1::detail::SYCLMemObjT::getUserPtr ( ) const
inline

Definition at line 131 of file sycl_mem_obj_t.hpp.

Referenced by determineHostPtr(), and releaseMem().

◆ handleHostData() [1/4]

void sycl::_V1::detail::SYCLMemObjT::handleHostData ( const std::function< void(void *)> &  CopyFromInput,
const size_t  RequiredAlign,
bool  IsConstPtr 
)
inline

Definition at line 247 of file sycl_mem_obj_t.hpp.

◆ handleHostData() [2/4]

void sycl::_V1::detail::SYCLMemObjT::handleHostData ( const std::shared_ptr< void > &  HostPtr,
const size_t  RequiredAlign,
bool  IsConstPtr 
)
inline

Definition at line 219 of file sycl_mem_obj_t.hpp.

◆ handleHostData() [3/4]

void sycl::_V1::detail::SYCLMemObjT::handleHostData ( const void *  HostPtr,
const size_t  RequiredAlign 
)
inline

Definition at line 214 of file sycl_mem_obj_t.hpp.

◆ handleHostData() [4/4]

void sycl::_V1::detail::SYCLMemObjT::handleHostData ( void *  HostPtr,
const size_t  RequiredAlign 
)
inline

Definition at line 186 of file sycl_mem_obj_t.hpp.

◆ handleWriteAccessorCreation()

void sycl::_V1::detail::SYCLMemObjT::handleWriteAccessorCreation ( )

◆ has_property()

template<typename propertyT >
bool sycl::_V1::detail::SYCLMemObjT::has_property ( ) const
inlinenoexcept

Definition at line 102 of file sycl_mem_obj_t.hpp.

◆ hasUserDataPtr()

bool sycl::_V1::detail::SYCLMemObjT::hasUserDataPtr ( ) const
inlineoverridevirtual

Implements sycl::_V1::detail::SYCLMemObjI.

Definition at line 289 of file sycl_mem_obj_t.hpp.

◆ isHostPointerReadOnly()

bool sycl::_V1::detail::SYCLMemObjT::isHostPointerReadOnly ( ) const
inlineoverridevirtual

Implements sycl::_V1::detail::SYCLMemObjI.

Definition at line 291 of file sycl_mem_obj_t.hpp.

◆ isInterop()

bool sycl::_V1::detail::SYCLMemObjT::isInterop ( ) const
overridevirtual

Implements sycl::_V1::detail::SYCLMemObjI.

Definition at line 186 of file sycl_mem_obj_t.cpp.

References MOpenCLInterop.

◆ isUsedInGraph()

bool sycl::_V1::detail::SYCLMemObjT::isUsedInGraph ( ) const
inline

Returns true if any graphs are currently using this memory object.

Definition at line 326 of file sycl_mem_obj_t.hpp.

◆ markAsInternal()

void sycl::_V1::detail::SYCLMemObjT::markAsInternal ( )
inline

Definition at line 300 of file sycl_mem_obj_t.hpp.

◆ markBeingUsedInGraph()

void sycl::_V1::detail::SYCLMemObjT::markBeingUsedInGraph ( )
inline

Increment an internal counter for how many graphs are currently using this memory object.

Definition at line 307 of file sycl_mem_obj_t.hpp.

◆ markNoLongerBeingUsedInGraph()

void sycl::_V1::detail::SYCLMemObjT::markNoLongerBeingUsedInGraph ( )
inline

Decrement an internal counter for how many graphs are currently using this memory object.

Definition at line 311 of file sycl_mem_obj_t.hpp.

◆ needsWriteBack()

bool sycl::_V1::detail::SYCLMemObjT::needsWriteBack ( ) const
inline

Returns true if this memory object requires a write_back on destruction.

Definition at line 303 of file sycl_mem_obj_t.hpp.

◆ releaseHostMem()

void sycl::_V1::detail::SYCLMemObjT::releaseHostMem ( void *  Ptr)
inlineoverridevirtual

Implements sycl::_V1::detail::SYCLMemObjI.

Definition at line 124 of file sycl_mem_obj_t.hpp.

Referenced by updateHostMemory().

◆ releaseMem()

void sycl::_V1::detail::SYCLMemObjT::releaseMem ( ContextImplPtr  Context,
void *  MemAllocation 
)
overridevirtual

◆ set_final_data() [1/2]

void sycl::_V1::detail::SYCLMemObjT::set_final_data ( const std::function< void(const std::function< void(void *const Ptr)> &)> &  FinalDataFunc)
inline

Definition at line 149 of file sycl_mem_obj_t.hpp.

◆ set_final_data() [2/2]

void sycl::_V1::detail::SYCLMemObjT::set_final_data ( std::nullptr_t  )
inline

Definition at line 137 of file sycl_mem_obj_t.hpp.

◆ set_final_data_from_storage()

void sycl::_V1::detail::SYCLMemObjT::set_final_data_from_storage ( )
inline

Definition at line 139 of file sycl_mem_obj_t.hpp.

◆ set_write_back()

void sycl::_V1::detail::SYCLMemObjT::set_write_back ( bool  NeedWriteBack)
inline

Definition at line 135 of file sycl_mem_obj_t.hpp.

◆ setAlign()

void sycl::_V1::detail::SYCLMemObjT::setAlign ( size_t  RequiredAlign)
inline

Definition at line 264 of file sycl_mem_obj_t.hpp.

◆ size()

size_t sycl::_V1::detail::SYCLMemObjT::size ( ) const
inlinenoexcept

Definition at line 97 of file sycl_mem_obj_t.hpp.

◆ updateHostMemory() [1/2]

◆ updateHostMemory() [2/2]

void sycl::_V1::detail::SYCLMemObjT::updateHostMemory ( void *const  Ptr)
protected

◆ useHostPtr()

bool sycl::_V1::detail::SYCLMemObjT::useHostPtr ( )
inline

Definition at line 171 of file sycl_mem_obj_t.hpp.

Referenced by sycl::_V1::detail::buffer_impl::allocateMem().

◆ usesPinnedHostMemory()

bool sycl::_V1::detail::SYCLMemObjT::usesPinnedHostMemory ( ) const
inlineoverridevirtual

Member Data Documentation

◆ MAllocator

std::unique_ptr<SYCLMemObjAllocator> sycl::_V1::detail::SYCLMemObjT::MAllocator
protected

Definition at line 334 of file sycl_mem_obj_t.hpp.

◆ MCreateShadowCopy

std::function<void(void)> sycl::_V1::detail::SYCLMemObjT::MCreateShadowCopy = []() -> void {}
protected

Definition at line 377 of file sycl_mem_obj_t.hpp.

Referenced by handleWriteAccessorCreation().

◆ MGraphUseCount

std::atomic<size_t> sycl::_V1::detail::SYCLMemObjT::MGraphUseCount = 0
protected

Definition at line 373 of file sycl_mem_obj_t.hpp.

◆ MHostPtrProvided

bool sycl::_V1::detail::SYCLMemObjT::MHostPtrProvided
protected

Definition at line 367 of file sycl_mem_obj_t.hpp.

Referenced by detachMemoryObject().

◆ MHostPtrReadOnly

bool sycl::_V1::detail::SYCLMemObjT::MHostPtrReadOnly
protected

Definition at line 349 of file sycl_mem_obj_t.hpp.

Referenced by determineHostPtr().

◆ MInteropContext

ContextImplPtr sycl::_V1::detail::SYCLMemObjT::MInteropContext
protected

◆ MInteropEvent

EventImplPtr sycl::_V1::detail::SYCLMemObjT::MInteropEvent
protected

◆ MInteropMemObject

sycl::detail::pi::PiMem sycl::_V1::detail::SYCLMemObjT::MInteropMemObject
protected

◆ MIsInternal

bool sycl::_V1::detail::SYCLMemObjT::MIsInternal = false
protected

Definition at line 371 of file sycl_mem_obj_t.hpp.

Referenced by detachMemoryObject().

◆ MNeedWriteBack

bool sycl::_V1::detail::SYCLMemObjT::MNeedWriteBack
protected

Definition at line 351 of file sycl_mem_obj_t.hpp.

Referenced by updateHostMemory().

◆ MOpenCLInterop

bool sycl::_V1::detail::SYCLMemObjT::MOpenCLInterop
protected

◆ MOwnNativeHandle

bool sycl::_V1::detail::SYCLMemObjT::MOwnNativeHandle = true
protected

Definition at line 378 of file sycl_mem_obj_t.hpp.

Referenced by detachMemoryObject().

◆ MProps

property_list sycl::_V1::detail::SYCLMemObjT::MProps
protected

◆ MShadowCopy

void* sycl::_V1::detail::SYCLMemObjT::MShadowCopy
protected

Definition at line 357 of file sycl_mem_obj_t.hpp.

Referenced by updateHostMemory().

◆ MSharedPtrStorage

std::shared_ptr<const void> sycl::_V1::detail::SYCLMemObjT::MSharedPtrStorage
protected

Definition at line 362 of file sycl_mem_obj_t.hpp.

◆ MSizeInBytes

size_t sycl::_V1::detail::SYCLMemObjT::MSizeInBytes
protected

Definition at line 353 of file sycl_mem_obj_t.hpp.

Referenced by SYCLMemObjT(), and updateHostMemory().

◆ MUploadDataFunctor

std::function<void(void)> sycl::_V1::detail::SYCLMemObjT::MUploadDataFunctor
protected

Definition at line 359 of file sycl_mem_obj_t.hpp.

Referenced by updateHostMemory().

◆ MUserPtr

void* sycl::_V1::detail::SYCLMemObjT::MUserPtr
protected

Definition at line 355 of file sycl_mem_obj_t.hpp.

Referenced by handleWriteAccessorCreation().


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