pub struct PooledBuffer<T: Copy> { /* private fields */ }Expand description
A device buffer allocated from a MemoryPool.
Unlike DeviceBuffer, a PooledBuffer is freed
asynchronously — the free operation is enqueued on the stream rather
than blocking the CPU. This enables overlap of allocation, computation,
and deallocation across multiple stream operations.
§Status
This type allocates from an in-process memory pool and returns buffers to that pool on drop.
Implementations§
Source§impl<T: Copy> PooledBuffer<T>
impl<T: Copy> PooledBuffer<T>
Sourcepub fn alloc_async(
pool: &MemoryPool,
n: usize,
_stream: &Stream,
) -> CudaResult<Self>
pub fn alloc_async( pool: &MemoryPool, n: usize, _stream: &Stream, ) -> CudaResult<Self>
Asynchronously allocates a buffer of n elements from the given pool.
The allocation is ordered relative to other operations on stream.
§Errors
Sourcepub fn as_device_ptr(&self) -> CUdeviceptr
pub fn as_device_ptr(&self) -> CUdeviceptr
Returns the raw CUdeviceptr handle.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for PooledBuffer<T>
impl<T> RefUnwindSafe for PooledBuffer<T>where
T: RefUnwindSafe,
impl<T> Send for PooledBuffer<T>where
T: Send,
impl<T> Sync for PooledBuffer<T>where
T: Sync,
impl<T> Unpin for PooledBuffer<T>where
T: Unpin,
impl<T> UnsafeUnpin for PooledBuffer<T>
impl<T> UnwindSafe for PooledBuffer<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more