Tachyon (current)
Current Main Branch
|
Several OptiX APIs make use of CUDA driver API pointer types (CUdevicepointer) so it becomes worthwhile to manage these in a templated class supporting easy memory management for vectors of special template types, and simple copies to and from the associated CUDA device. More...
#include <TachyonOptiX.h>
Public Member Functions | |
void * | dptr () const |
CUdeviceptr | cu_dptr () const |
size_t | get_size (void) |
query current buffer size in bytes More... | |
void | set_size (size_t newsize) |
(re)allocate buffer of requested size More... | |
void | set_size (size_t newsize, cudaStream_t stream) |
(re)allocate buffer of requested size, asynchronously More... | |
void | clear_persist_allocation (void) |
clear "used" size to zero, but keep existing device allocation More... | |
void | free () |
free allocated memory More... | |
void | free (cudaStream_t stream) |
free allocated memory asynchronously More... | |
template<typename T > | |
void | resize_upload (const std::vector< T > &vecT) |
Combination of a buffer resize with synchronous upload to GPU device memory. More... | |
template<typename T > | |
void | resize_upload (const T *t, size_t cnt) |
Combination of a buffer resize with synchronous upload to GPU device memory. More... | |
template<typename T > | |
void | resize_upload (const std::vector< T > &vecT, cudaStream_t stream) |
Combination of a buffer resize with asynchronous upload to GPU device memory using the caller-provided CUDA stream to enforce ordering requirements. More... | |
template<typename T > | |
void | resize_upload (const T *t, size_t cnt, cudaStream_t stream) |
Combination of a buffer resize with asynchronous upload to GPU device memory using the caller-provided CUDA stream to enforce ordering requirements. More... | |
template<typename T > | |
void | upload (const T *t, size_t cnt) |
Synchronous upload to GPU device memory. More... | |
template<typename T > | |
void | download (T *t, size_t cnt) |
Synchronous download from GPU device memory. More... | |
template<typename T > | |
void | upload (const T *t, size_t cnt, cudaStream_t stream) |
Asynchronous upload to GPU device memory, using the caller-provided CUDA stream to enforce ordering requirements. More... | |
template<typename T > | |
void | download_async (T *t, size_t cnt, cudaStream_t stream) |
Asynchronous download from GPU device memory, using the caller-provided CUDA stream to enforce ordering requirements. More... | |
Data Fields | |
size_t | sz { 0 } |
device memory buffer usage size in bytes More... | |
size_t | dmemsz { 0 } |
device memory buffer allocated size in bytes More... | |
void * | d_ptr { nullptr } |
pointer to device memory buffer More... | |
Several OptiX APIs make use of CUDA driver API pointer types (CUdevicepointer) so it becomes worthwhile to manage these in a templated class supporting easy memory management for vectors of special template types, and simple copies to and from the associated CUDA device.
Definition at line 328 of file TachyonOptiX.h.
|
inline |
clear "used" size to zero, but keep existing device allocation
Definition at line 424 of file TachyonOptiX.h.
Referenced by TachyonOptiX::destroy_scene().
|
inline |
Definition at line 341 of file TachyonOptiX.h.
Referenced by TachyonOptiX::render().
|
inline |
Synchronous download from GPU device memory.
Definition at line 560 of file TachyonOptiX.h.
References d_ptr.
Referenced by TachyonOptiX::framebuffer_download_rgb4u().
|
inline |
Asynchronous download from GPU device memory, using the caller-provided CUDA stream to enforce ordering requirements.
Definition at line 583 of file TachyonOptiX.h.
References d_ptr.
|
inline |
Definition at line 333 of file TachyonOptiX.h.
Referenced by TachyonOptiX::framebuffer_clear().
|
inline |
free allocated memory
Definition at line 433 of file TachyonOptiX.h.
References d_ptr, dmemsz, and sz.
Referenced by clear_persist_allocation(), TachyonOptiX::framebuffer_destroy(), TachyonOptiX::minimize_memory_use(), and set_size().
|
inline |
free allocated memory asynchronously
Definition at line 442 of file TachyonOptiX.h.
|
inline |
query current buffer size in bytes
Definition at line 350 of file TachyonOptiX.h.
References sz.
Referenced by TachyonOptiX::framebuffer_clear(), and TachyonOptiX::render().
|
inline |
Combination of a buffer resize with synchronous upload to GPU device memory.
Definition at line 471 of file TachyonOptiX.h.
References set_size(), and upload().
|
inline |
Combination of a buffer resize with synchronous upload to GPU device memory.
Definition at line 479 of file TachyonOptiX.h.
References d_ptr, and set_size().
|
inline |
Combination of a buffer resize with asynchronous upload to GPU device memory using the caller-provided CUDA stream to enforce ordering requirements.
Definition at line 493 of file TachyonOptiX.h.
References set_size(), and upload().
|
inline |
Combination of a buffer resize with asynchronous upload to GPU device memory using the caller-provided CUDA stream to enforce ordering requirements.
Definition at line 502 of file TachyonOptiX.h.
References d_ptr, and set_size().
|
inline |
(re)allocate buffer of requested size
Definition at line 355 of file TachyonOptiX.h.
References d_ptr, dmemsz, free(), and sz.
Referenced by TachyonOptiX::framebuffer_resize(), and resize_upload().
|
inline |
|
inline |
Synchronous upload to GPU device memory.
Definition at line 554 of file TachyonOptiX.h.
References d_ptr.
Referenced by TachyonOptiX::render(), and resize_upload().
|
inline |
Asynchronous upload to GPU device memory, using the caller-provided CUDA stream to enforce ordering requirements.
Definition at line 572 of file TachyonOptiX.h.
References d_ptr.
void* CUMemBuf::d_ptr { nullptr } |
pointer to device memory buffer
Definition at line 331 of file TachyonOptiX.h.
Referenced by cu_dptr(), download(), download_async(), dptr(), free(), resize_upload(), set_size(), and upload().
size_t CUMemBuf::dmemsz { 0 } |
device memory buffer allocated size in bytes
Definition at line 330 of file TachyonOptiX.h.
Referenced by free(), and set_size().
size_t CUMemBuf::sz { 0 } |
device memory buffer usage size in bytes
Definition at line 329 of file TachyonOptiX.h.
Referenced by clear_persist_allocation(), cu_dptr(), dptr(), free(), get_size(), and set_size().