pub struct WorkspacePool { /* private fields */ }Expand description
Cloneable handle to the workspace pool.
Implementations§
Source§impl WorkspacePool
impl WorkspacePool
pub fn new() -> Self
pub fn with_capacity(per_class: usize) -> Self
Sourcepub fn acquire(
&self,
stream: &Arc<CudaStream>,
requested_bytes: usize,
) -> Result<WorkspaceLease, GpuError>
pub fn acquire( &self, stream: &Arc<CudaStream>, requested_bytes: usize, ) -> Result<WorkspaceLease, GpuError>
Acquire a workspace slab of at least requested_bytes. If the
pool has a free slab in the matching size class it’s reused;
otherwise a fresh CudaSlice<u8> is allocated against stream.
The returned WorkspaceLease auto-returns to the pool on
Drop. Callers should not manually clone the inner slice
across the boundary — the kernel envelope already keeps the
Arc<CudaSlice<u8>> alive for the duration of the kernel.
Sourcepub fn pooled_slabs(&self) -> usize
pub fn pooled_slabs(&self) -> usize
Number of slabs currently in the free list across all size classes. Diagnostic only.
Sourcepub fn pooled_bytes(&self) -> usize
pub fn pooled_bytes(&self) -> usize
Total bytes currently in the free list.
Trait Implementations§
Source§impl Clone for WorkspacePool
impl Clone for WorkspacePool
Source§fn clone(&self) -> WorkspacePool
fn clone(&self) -> WorkspacePool
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WorkspacePool
impl !RefUnwindSafe for WorkspacePool
impl Send for WorkspacePool
impl Sync for WorkspacePool
impl Unpin for WorkspacePool
impl UnsafeUnpin for WorkspacePool
impl !UnwindSafe for WorkspacePool
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