DPC++ Runtime
Runtime libraries for oneAPI DPC++
_pi_mem Struct Reference

PI Mem mapping to CUDA memory allocations, both data and texture/surface. More...

#include <cuda/pi_cuda.hpp>

Inheritance diagram for _pi_mem:
Collaboration diagram for _pi_mem:

Classes

struct  Mapping
 
union  mem_
 A PI Memory object represents either plain memory allocations ("Buffers" in OpenCL) or typed allocations ("Images" in OpenCL). More...
 

Public Types

enum  mem_type { mem_type::buffer, mem_type::surface, mem_type::buffer, mem_type::surface }
 
enum  mem_type { mem_type::buffer, mem_type::surface, mem_type::buffer, mem_type::surface }
 
using pi_context = _pi_context *
 
using pi_context = _pi_context *
 

Public Member Functions

 _pi_mem (pi_context ctxt, pi_mem parent, mem_::buffer_mem_::alloc_mode mode, CUdeviceptr ptr, void *host_ptr, size_t size)
 Constructs the PI MEM handler for a non-typed allocation ("buffer") More...
 
 _pi_mem (pi_context ctxt, CUarray array, CUsurfObject surf, pi_mem_type image_type, void *host_ptr)
 Constructs the PI allocation for an Image object (surface in CUDA) More...
 
 ~_pi_mem ()
 
bool is_buffer () const noexcept
 
bool is_sub_buffer () const noexcept
 
bool is_image () const noexcept
 
pi_context get_context () const noexcept
 
pi_uint32 increment_reference_count () noexcept
 
pi_uint32 decrement_reference_count () noexcept
 
pi_uint32 get_reference_count () const noexcept
 
 ~_pi_mem ()
 
 _pi_mem (pi_context ctxt, pi_mem parent, mem_::buffer_mem_::alloc_mode mode, hipDeviceptr_t ptr, void *host_ptr, size_t size)
 Constructs the PI MEM handler for a non-typed allocation ("buffer") More...
 
 _pi_mem (pi_context ctxt, hipArray *array, hipSurfaceObject_t surf, pi_mem_type image_type, void *host_ptr)
 Constructs the PI allocation for an Image object. More...
 
 ~_pi_mem ()
 
bool is_buffer () const noexcept
 
bool is_sub_buffer () const noexcept
 
bool is_image () const noexcept
 
pi_context get_context () const noexcept
 
pi_uint32 increment_reference_count () noexcept
 
pi_uint32 decrement_reference_count () noexcept
 
pi_uint32 get_reference_count () const noexcept
 

Public Attributes

pi_context context_
 
std::atomic_uint32_t refCount_
 Reference counting of the handler. More...
 
enum _pi_mem::mem_type mem_type_
 
union _pi_mem::mem_ mem_
 
pi_context Context
 
char * MapHostPtr = nullptr
 
std::mutex SurfaceLock
 
unsigned int SurfaceIndex
 
std::unordered_map< void *, MappingMappings
 
std::mutex MappingsMutex
 
cm_surface_ptr_t SurfacePtr
 

Protected Member Functions

 _pi_mem (pi_context ctxt, char *HostPtr, cm_surface_ptr_t SurfacePtrArg, unsigned int SurfaceIdxArg)
 

Detailed Description

PI Mem mapping to CUDA memory allocations, both data and texture/surface.

PI Mem mapping to HIP memory allocations, both data and texture/surface.

Represents non-SVM allocations on the CUDA backend. Keeps tracks of all mapped regions used for Map/Unmap calls. Only one region can be active at the same time per allocation.

Represents non-SVM allocations on the HIP backend. Keeps tracks of all mapped regions used for Map/Unmap calls. Only one region can be active at the same time per allocation.

Definition at line 224 of file pi_cuda.hpp.

Member Typedef Documentation

◆ pi_context [1/2]

Definition at line 200 of file pi_hip.hpp.

◆ pi_context [2/2]

Definition at line 227 of file pi_cuda.hpp.

Member Enumeration Documentation

◆ mem_type [1/2]

enum _pi_mem::mem_type
strong
Enumerator
buffer 
surface 
buffer 
surface 

Definition at line 207 of file pi_hip.hpp.

◆ mem_type [2/2]

enum _pi_mem::mem_type
strong
Enumerator
buffer 
surface 
buffer 
surface 

Definition at line 234 of file pi_cuda.hpp.

Constructor & Destructor Documentation

◆ _pi_mem() [1/5]

_pi_mem::_pi_mem ( pi_context  ctxt,
pi_mem  parent,
mem_::buffer_mem_::alloc_mode  mode,
CUdeviceptr  ptr,
void *  host_ptr,
size_t  size 
)
inline

Constructs the PI MEM handler for a non-typed allocation ("buffer")

Definition at line 334 of file pi_cuda.hpp.

◆ _pi_mem() [2/5]

_pi_mem::_pi_mem ( pi_context  ctxt,
CUarray  array,
CUsurfObject  surf,
pi_mem_type  image_type,
void *  host_ptr 
)
inline

Constructs the PI allocation for an Image object (surface in CUDA)

Definition at line 353 of file pi_cuda.hpp.

◆ ~_pi_mem() [1/3]

◆ ~_pi_mem() [2/3]

_pi_mem::~_pi_mem ( )

◆ _pi_mem() [3/5]

_pi_mem::_pi_mem ( pi_context  ctxt,
char *  HostPtr,
cm_surface_ptr_t  SurfacePtrArg,
unsigned int  SurfaceIdxArg 
)
inlineprotected

Definition at line 173 of file pi_esimd_emulator.hpp.

◆ _pi_mem() [4/5]

_pi_mem::_pi_mem ( pi_context  ctxt,
pi_mem  parent,
mem_::buffer_mem_::alloc_mode  mode,
hipDeviceptr_t  ptr,
void *  host_ptr,
size_t  size 
)
inline

Constructs the PI MEM handler for a non-typed allocation ("buffer")

Definition at line 318 of file pi_hip.hpp.

◆ _pi_mem() [5/5]

_pi_mem::_pi_mem ( pi_context  ctxt,
hipArray *  array,
hipSurfaceObject_t  surf,
pi_mem_type  image_type,
void *  host_ptr 
)
inline

Constructs the PI allocation for an Image object.

Definition at line 337 of file pi_hip.hpp.

◆ ~_pi_mem() [3/3]

Member Function Documentation

◆ decrement_reference_count() [1/2]

pi_uint32 _pi_mem::decrement_reference_count ( )
inlinenoexcept

Definition at line 370 of file pi_hip.hpp.

References refCount_.

◆ decrement_reference_count() [2/2]

pi_uint32 _pi_mem::decrement_reference_count ( )
inlinenoexcept

Definition at line 388 of file pi_cuda.hpp.

References refCount_.

Referenced by cuda_piMemRelease(), and hip_piMemRelease().

◆ get_context() [1/2]

pi_context _pi_mem::get_context ( ) const
inlinenoexcept

Definition at line 366 of file pi_hip.hpp.

References context_.

◆ get_context() [2/2]

pi_context _pi_mem::get_context ( ) const
inlinenoexcept

Definition at line 384 of file pi_cuda.hpp.

References context_.

◆ get_reference_count() [1/2]

pi_uint32 _pi_mem::get_reference_count ( ) const
inlinenoexcept

Definition at line 372 of file pi_hip.hpp.

References refCount_.

◆ get_reference_count() [2/2]

pi_uint32 _pi_mem::get_reference_count ( ) const
inlinenoexcept

Definition at line 390 of file pi_cuda.hpp.

References refCount_.

Referenced by cuda_piMemRetain(), and hip_piMemRetain().

◆ increment_reference_count() [1/2]

pi_uint32 _pi_mem::increment_reference_count ( )
inlinenoexcept

Definition at line 368 of file pi_hip.hpp.

References refCount_.

◆ increment_reference_count() [2/2]

pi_uint32 _pi_mem::increment_reference_count ( )
inlinenoexcept

Definition at line 386 of file pi_cuda.hpp.

References refCount_.

Referenced by cuda_piMemRetain(), and hip_piMemRetain().

◆ is_buffer() [1/2]

bool _pi_mem::is_buffer ( ) const
inlinenoexcept

Definition at line 358 of file pi_hip.hpp.

References buffer, and mem_type_.

◆ is_buffer() [2/2]

bool _pi_mem::is_buffer ( ) const
inlinenoexcept

Definition at line 376 of file pi_cuda.hpp.

References buffer, and mem_type_.

Referenced by cuda_piMemBufferPartition(), hip_piMemBufferPartition(), and is_sub_buffer().

◆ is_image() [1/2]

bool _pi_mem::is_image ( ) const
inlinenoexcept

Definition at line 364 of file pi_hip.hpp.

References mem_type_, and surface.

◆ is_image() [2/2]

bool _pi_mem::is_image ( ) const
inlinenoexcept

Definition at line 382 of file pi_cuda.hpp.

References mem_type_, and surface.

◆ is_sub_buffer() [1/2]

bool _pi_mem::is_sub_buffer ( ) const
inlinenoexcept

◆ is_sub_buffer() [2/2]

bool _pi_mem::is_sub_buffer ( ) const
inlinenoexcept

Member Data Documentation

◆ Context

pi_context _pi_mem::Context

Definition at line 140 of file pi_esimd_emulator.hpp.

◆ context_

pi_context _pi_mem::context_

◆ MapHostPtr

◆ Mappings

std::unordered_map<void *, Mapping> _pi_mem::Mappings

Definition at line 163 of file pi_esimd_emulator.hpp.

Referenced by piEnqueueMemBufferMap(), and piEnqueueMemUnmap().

◆ MappingsMutex

std::mutex _pi_mem::MappingsMutex

Definition at line 165 of file pi_esimd_emulator.hpp.

Referenced by piEnqueueMemBufferMap(), and piEnqueueMemUnmap().

◆ mem_

◆ mem_type_

◆ refCount_

std::atomic_uint32_t _pi_mem::refCount_

Reference counting of the handler.

Definition at line 233 of file pi_cuda.hpp.

Referenced by decrement_reference_count(), get_reference_count(), and increment_reference_count().

◆ SurfaceIndex

unsigned int _pi_mem::SurfaceIndex

Definition at line 149 of file pi_esimd_emulator.hpp.

Referenced by piMemRelease(), and sycl_get_cm_surface_index().

◆ SurfaceLock

std::mutex _pi_mem::SurfaceLock

Definition at line 145 of file pi_esimd_emulator.hpp.

Referenced by sycl_get_cm_buffer_params(), and sycl_get_cm_image_params().

◆ SurfacePtr

cm_surface_ptr_t _pi_mem::SurfacePtr

Definition at line 167 of file pi_esimd_emulator.hpp.

Referenced by piEnqueueMemBufferRead(), and piEnqueueMemImageRead().


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