PI Mem mapping to CUDA memory allocations, both data and texture/surface. More...
#include <cuda/pi_cuda.hpp>
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 *, Mapping > | Mappings |
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) | |
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.
using _pi_mem::pi_context = _pi_context * |
Definition at line 200 of file pi_hip.hpp.
using _pi_mem::pi_context = _pi_context * |
Definition at line 227 of file pi_cuda.hpp.
|
strong |
Enumerator | |
---|---|
buffer | |
surface | |
buffer | |
surface |
Definition at line 207 of file pi_hip.hpp.
|
strong |
Enumerator | |
---|---|
buffer | |
surface | |
buffer | |
surface |
Definition at line 234 of file pi_cuda.hpp.
|
inline |
Constructs the PI MEM handler for a non-typed allocation ("buffer")
Definition at line 334 of file pi_cuda.hpp.
|
inline |
Constructs the PI allocation for an Image object (surface in CUDA)
Definition at line 353 of file pi_cuda.hpp.
|
inline |
Definition at line 365 of file pi_cuda.hpp.
References buffer, _pi_mem::mem_::buffer_mem_, context_, cuda_piContextRelease(), cuda_piMemRelease(), is_sub_buffer(), mem_type_, and _pi_mem::mem_::buffer_mem_::parent_.
_pi_mem::~_pi_mem | ( | ) |
|
inlineprotected |
Definition at line 173 of file pi_esimd_emulator.hpp.
|
inline |
Constructs the PI MEM handler for a non-typed allocation ("buffer")
Definition at line 318 of file pi_hip.hpp.
|
inline |
Constructs the PI allocation for an Image object.
Definition at line 337 of file pi_hip.hpp.
|
inline |
Definition at line 347 of file pi_hip.hpp.
References buffer, _pi_mem::mem_::buffer_mem_, context_, hip_piContextRelease(), hip_piMemRelease(), is_sub_buffer(), mem_type_, and _pi_mem::mem_::buffer_mem_::parent_.
|
inlinenoexcept |
Definition at line 370 of file pi_hip.hpp.
References refCount_.
|
inlinenoexcept |
Definition at line 388 of file pi_cuda.hpp.
References refCount_.
Referenced by cuda_piMemRelease(), and hip_piMemRelease().
|
inlinenoexcept |
Definition at line 366 of file pi_hip.hpp.
References context_.
|
inlinenoexcept |
Definition at line 384 of file pi_cuda.hpp.
References context_.
|
inlinenoexcept |
Definition at line 372 of file pi_hip.hpp.
References refCount_.
|
inlinenoexcept |
Definition at line 390 of file pi_cuda.hpp.
References refCount_.
Referenced by cuda_piMemRetain(), and hip_piMemRetain().
|
inlinenoexcept |
Definition at line 368 of file pi_hip.hpp.
References refCount_.
|
inlinenoexcept |
Definition at line 386 of file pi_cuda.hpp.
References refCount_.
Referenced by cuda_piMemRetain(), and hip_piMemRetain().
|
inlinenoexcept |
Definition at line 358 of file pi_hip.hpp.
|
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().
|
inlinenoexcept |
Definition at line 364 of file pi_hip.hpp.
|
inlinenoexcept |
Definition at line 382 of file pi_cuda.hpp.
|
inlinenoexcept |
Definition at line 360 of file pi_hip.hpp.
References _pi_mem::mem_::buffer_mem_, is_buffer(), and _pi_mem::mem_::buffer_mem_::parent_.
|
inlinenoexcept |
Definition at line 378 of file pi_cuda.hpp.
References _pi_mem::mem_::buffer_mem_, is_buffer(), and _pi_mem::mem_::buffer_mem_::parent_.
Referenced by cuda_piMemBufferPartition(), cuda_piMemRelease(), hip_piMemBufferPartition(), hip_piMemRelease(), and ~_pi_mem().
pi_context _pi_mem::Context |
Definition at line 140 of file pi_esimd_emulator.hpp.
pi_context _pi_mem::context_ |
Definition at line 230 of file pi_cuda.hpp.
Referenced by cuda_piMemBufferPartition(), get_context(), hip_piMemBufferPartition(), and ~_pi_mem().
char* _pi_mem::MapHostPtr = nullptr |
Definition at line 143 of file pi_esimd_emulator.hpp.
Referenced by piEnqueueMemBufferMap(), piEnqueueMemBufferRead(), piEnqueueMemImageRead(), sycl_get_cm_buffer_params(), and sycl_get_cm_image_params().
std::unordered_map<void *, Mapping> _pi_mem::Mappings |
Definition at line 163 of file pi_esimd_emulator.hpp.
Referenced by piEnqueueMemBufferMap(), and piEnqueueMemUnmap().
std::mutex _pi_mem::MappingsMutex |
Definition at line 165 of file pi_esimd_emulator.hpp.
Referenced by piEnqueueMemBufferMap(), and piEnqueueMemUnmap().
union _pi_mem::mem_ _pi_mem::mem_ |
Referenced by cuda_piEnqueueMemBufferCopy(), cuda_piEnqueueMemBufferCopyRect(), cuda_piEnqueueMemBufferFill(), cuda_piEnqueueMemBufferMap(), cuda_piEnqueueMemBufferRead(), cuda_piEnqueueMemBufferReadRect(), cuda_piEnqueueMemBufferWrite(), cuda_piEnqueueMemBufferWriteRect(), cuda_piEnqueueMemImageCopy(), cuda_piEnqueueMemUnmap(), cuda_piextKernelSetArgMemObj(), cuda_piextMemGetNativeHandle(), cuda_piMemBufferPartition(), hip_piEnqueueMemBufferCopy(), hip_piEnqueueMemBufferCopyRect(), hip_piEnqueueMemBufferFill(), hip_piEnqueueMemBufferMap(), hip_piEnqueueMemBufferRead(), hip_piEnqueueMemBufferReadRect(), hip_piEnqueueMemBufferWrite(), hip_piEnqueueMemBufferWriteRect(), hip_piEnqueueMemImageCopy(), hip_piEnqueueMemUnmap(), hip_piextKernelSetArgMemObj(), hip_piextMemGetNativeHandle(), and hip_piMemBufferPartition().
enum _pi_mem::mem_type _pi_mem::mem_type_ |
Referenced by cuda_piEnqueueMemBufferMap(), cuda_piEnqueueMemImageCopy(), cuda_piEnqueueMemUnmap(), cuda_piextKernelSetArgMemObj(), cuda_piMemRelease(), hip_piEnqueueMemBufferMap(), hip_piEnqueueMemImageCopy(), hip_piEnqueueMemUnmap(), hip_piextKernelSetArgMemObj(), hip_piMemRelease(), is_buffer(), is_image(), and ~_pi_mem().
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().
unsigned int _pi_mem::SurfaceIndex |
Definition at line 149 of file pi_esimd_emulator.hpp.
Referenced by piMemRelease(), and sycl_get_cm_surface_index().
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().
cm_surface_ptr_t _pi_mem::SurfacePtr |
Definition at line 167 of file pi_esimd_emulator.hpp.
Referenced by piEnqueueMemBufferRead(), and piEnqueueMemImageRead().