DPC++ Runtime
Runtime libraries for oneAPI DPC++
_pi_mem::mem_::buffer_mem_ Struct Reference

#include <cuda/pi_cuda.hpp>

Collaboration diagram for _pi_mem::mem_::buffer_mem_:

Public Types

enum  alloc_mode {
  alloc_mode::classic, alloc_mode::use_host_ptr, alloc_mode::copy_in, alloc_mode::alloc_host_ptr,
  alloc_mode::classic, alloc_mode::use_host_ptr, alloc_mode::copy_in, alloc_mode::alloc_host_ptr
}
 alloc_mode classic: Just a normal buffer allocated on the device via cuda malloc use_host_ptr: Use an address on the host for the device copy_in: The data for the device comes from the host but the host pointer is not available later for re-use alloc_host_ptr: Uses pinned-memory allocation More...
 
enum  alloc_mode {
  alloc_mode::classic, alloc_mode::use_host_ptr, alloc_mode::copy_in, alloc_mode::alloc_host_ptr,
  alloc_mode::classic, alloc_mode::use_host_ptr, alloc_mode::copy_in, alloc_mode::alloc_host_ptr
}
 alloc_mode classic: Just a normal buffer allocated on the device via hip malloc use_host_ptr: Use an address on the host for the device copy_in: The data for the device comes from the host but the host pointer is not available later for re-use alloc_host_ptr: Uses pinned-memory allocation More...
 
using native_type = CUdeviceptr
 
using native_type = hipDeviceptr_t
 

Public Member Functions

native_type get () const noexcept
 
size_t get_size () const noexcept
 
void * get_map_ptr () const noexcept
 
size_t get_map_offset (void *) const noexcept
 
void * map_to_ptr (size_t offset, pi_map_flags flags) noexcept
 Returns a pointer to data visible on the host that contains the data on the device associated with this allocation. More...
 
void unmap (void *) noexcept
 Detach the allocation from the host memory. More...
 
pi_map_flags get_map_flags () const noexcept
 
native_type get () const noexcept
 
native_type get_with_offset (size_t offset) const noexcept
 
void * get_void () const noexcept
 
size_t get_size () const noexcept
 
void * get_map_ptr () const noexcept
 
size_t get_map_offset (void *ptr) const noexcept
 
void * map_to_ptr (size_t offset, pi_map_flags flags) noexcept
 Returns a pointer to data visible on the host that contains the data on the device associated with this allocation. More...
 
void unmap (void *ptr) noexcept
 Detach the allocation from the host memory. More...
 
pi_map_flags get_map_flags () const noexcept
 

Public Attributes

pi_mem parent_
 
native_type ptr_
 
void * hostPtr_
 Pointer associated with this device on the host. More...
 
size_t size_
 Size of the allocation in bytes. More...
 
size_t mapOffset_
 Offset of the active mapped region. More...
 
void * mapPtr_
 Pointer to the active mapped region, if any. More...
 
pi_map_flags mapFlags_
 Original flags for the mapped region. More...
 
enum _pi_mem::mem_::buffer_mem_::alloc_mode allocMode_
 

Detailed Description

Definition at line 241 of file pi_cuda.hpp.

Member Typedef Documentation

◆ native_type [1/2]

Definition at line 213 of file pi_hip.hpp.

◆ native_type [2/2]

Member Enumeration Documentation

◆ alloc_mode [1/2]

alloc_mode classic: Just a normal buffer allocated on the device via hip malloc use_host_ptr: Use an address on the host for the device copy_in: The data for the device comes from the host but the host pointer is not available later for re-use alloc_host_ptr: Uses pinned-memory allocation

Enumerator
classic 
use_host_ptr 
copy_in 
alloc_host_ptr 
classic 
use_host_ptr 
copy_in 
alloc_host_ptr 

Definition at line 239 of file pi_hip.hpp.

◆ alloc_mode [2/2]

alloc_mode classic: Just a normal buffer allocated on the device via cuda malloc use_host_ptr: Use an address on the host for the device copy_in: The data for the device comes from the host but the host pointer is not available later for re-use alloc_host_ptr: Uses pinned-memory allocation

Enumerator
classic 
use_host_ptr 
copy_in 
alloc_host_ptr 
classic 
use_host_ptr 
copy_in 
alloc_host_ptr 

Definition at line 268 of file pi_cuda.hpp.

Member Function Documentation

◆ get() [1/2]

native_type _pi_mem::mem_::buffer_mem_::get ( ) const
inlinenoexcept

Definition at line 246 of file pi_hip.hpp.

References ptr_.

◆ get() [2/2]

◆ get_map_flags() [1/2]

pi_map_flags _pi_mem::mem_::buffer_mem_::get_map_flags ( ) const
inlinenoexcept

Definition at line 293 of file pi_hip.hpp.

References mapFlags_, and mapPtr_.

◆ get_map_flags() [2/2]

pi_map_flags _pi_mem::mem_::buffer_mem_::get_map_flags ( ) const
inlinenoexcept

Definition at line 311 of file pi_cuda.hpp.

References mapFlags_, and mapPtr_.

Referenced by cuda_piEnqueueMemUnmap(), and hip_piEnqueueMemUnmap().

◆ get_map_offset() [1/2]

size_t _pi_mem::mem_::buffer_mem_::get_map_offset ( void *  ) const
inlinenoexcept

Definition at line 281 of file pi_cuda.hpp.

References mapOffset_.

Referenced by cuda_piEnqueueMemUnmap(), and hip_piEnqueueMemUnmap().

◆ get_map_offset() [2/2]

size_t _pi_mem::mem_::buffer_mem_::get_map_offset ( void *  ptr) const
inlinenoexcept

Definition at line 259 of file pi_hip.hpp.

References mapOffset_.

◆ get_map_ptr() [1/2]

void* _pi_mem::mem_::buffer_mem_::get_map_ptr ( ) const
inlinenoexcept

Definition at line 257 of file pi_hip.hpp.

References mapPtr_.

◆ get_map_ptr() [2/2]

void* _pi_mem::mem_::buffer_mem_::get_map_ptr ( ) const
inlinenoexcept

◆ get_size() [1/2]

size_t _pi_mem::mem_::buffer_mem_::get_size ( ) const
inlinenoexcept

Definition at line 255 of file pi_hip.hpp.

References size_.

◆ get_size() [2/2]

size_t _pi_mem::mem_::buffer_mem_::get_size ( ) const
inlinenoexcept

◆ get_void()

void* _pi_mem::mem_::buffer_mem_::get_void ( ) const
inlinenoexcept

◆ get_with_offset()

native_type _pi_mem::mem_::buffer_mem_::get_with_offset ( size_t  offset) const
inlinenoexcept

◆ map_to_ptr() [1/2]

void* _pi_mem::mem_::buffer_mem_::map_to_ptr ( size_t  offset,
pi_map_flags  flags 
)
inlinenoexcept

Returns a pointer to data visible on the host that contains the data on the device associated with this allocation.

The offset is used to index into the HIP allocation.

Definition at line 268 of file pi_hip.hpp.

References get_size(), hostPtr_, sycl::_V1::malloc(), mapFlags_, mapOffset_, and mapPtr_.

◆ map_to_ptr() [2/2]

void* _pi_mem::mem_::buffer_mem_::map_to_ptr ( size_t  offset,
pi_map_flags  flags 
)
inlinenoexcept

Returns a pointer to data visible on the host that contains the data on the device associated with this allocation.

The offset is used to index into the CUDA allocation.

Definition at line 287 of file pi_cuda.hpp.

References get_size(), hostPtr_, sycl::_V1::malloc(), mapFlags_, mapOffset_, and mapPtr_.

Referenced by cuda_piEnqueueMemBufferMap(), and hip_piEnqueueMemBufferMap().

◆ unmap() [1/2]

void _pi_mem::mem_::buffer_mem_::unmap ( void *  )
inlinenoexcept

Detach the allocation from the host memory.

Definition at line 301 of file pi_cuda.hpp.

References sycl::_V1::detail::usm::free(), hostPtr_, mapOffset_, and mapPtr_.

Referenced by cuda_piEnqueueMemUnmap(), and hip_piEnqueueMemUnmap().

◆ unmap() [2/2]

void _pi_mem::mem_::buffer_mem_::unmap ( void *  ptr)
inlinenoexcept

Detach the allocation from the host memory.

Definition at line 282 of file pi_hip.hpp.

References sycl::_V1::detail::usm::free(), hostPtr_, mapOffset_, and mapPtr_.

Member Data Documentation

◆ allocMode_

◆ hostPtr_

void * _pi_mem::mem_::buffer_mem_::hostPtr_

Pointer associated with this device on the host.

Definition at line 251 of file pi_cuda.hpp.

Referenced by cuda_piMemBufferPartition(), hip_piMemBufferPartition(), map_to_ptr(), and unmap().

◆ mapFlags_

pi_map_flags _pi_mem::mem_::buffer_mem_::mapFlags_

Original flags for the mapped region.

Definition at line 259 of file pi_cuda.hpp.

Referenced by get_map_flags(), and map_to_ptr().

◆ mapOffset_

size_t _pi_mem::mem_::buffer_mem_::mapOffset_

Offset of the active mapped region.

Definition at line 255 of file pi_cuda.hpp.

Referenced by get_map_offset(), map_to_ptr(), and unmap().

◆ mapPtr_

void * _pi_mem::mem_::buffer_mem_::mapPtr_

Pointer to the active mapped region, if any.

Definition at line 257 of file pi_cuda.hpp.

Referenced by get_map_flags(), get_map_ptr(), map_to_ptr(), and unmap().

◆ parent_

pi_mem _pi_mem::mem_::buffer_mem_::parent_

Definition at line 246 of file pi_cuda.hpp.

Referenced by _pi_mem::is_sub_buffer(), and _pi_mem::~_pi_mem().

◆ ptr_

native_type _pi_mem::mem_::buffer_mem_::ptr_

◆ size_

size_t _pi_mem::mem_::buffer_mem_::size_

Size of the allocation in bytes.

Definition at line 253 of file pi_cuda.hpp.

Referenced by get_size().


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