pub struct GpuMemoryPool { /* private fields */ }Expand description
Enhanced GPU memory pool with suballocation
Implementations§
Source§impl GpuMemoryPool
impl GpuMemoryPool
Sourcepub fn with_config(config: MemoryPoolConfig) -> Self
pub fn with_config(config: MemoryPoolConfig) -> Self
Create a memory pool with custom configuration
Sourcepub fn allocate(&self, size: usize) -> LinalgResult<AllocationHandle>
pub fn allocate(&self, size: usize) -> LinalgResult<AllocationHandle>
Allocate memory from the pool
Sourcepub fn deallocate(&self, handle: &AllocationHandle) -> LinalgResult<()>
pub fn deallocate(&self, handle: &AllocationHandle) -> LinalgResult<()>
Deallocate memory
Sourcepub fn stats(&self) -> MemoryStats
pub fn stats(&self) -> MemoryStats
Get current memory statistics
Sourcepub fn fragmentation_ratio(&self) -> f64
pub fn fragmentation_ratio(&self) -> f64
Calculate fragmentation ratio
Sourcepub fn maybe_defragment(&self) -> LinalgResult<bool>
pub fn maybe_defragment(&self) -> LinalgResult<bool>
Trigger defragmentation if needed
Sourcepub fn defragment(&self) -> LinalgResult<()>
pub fn defragment(&self) -> LinalgResult<()>
Defragment the memory pool
Sourcepub fn evict_old_caches(&self) -> LinalgResult<usize>
pub fn evict_old_caches(&self) -> LinalgResult<usize>
Evict old cached blocks
Sourcepub fn reset(&self) -> LinalgResult<()>
pub fn reset(&self) -> LinalgResult<()>
Reset the memory pool
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GpuMemoryPool
impl RefUnwindSafe for GpuMemoryPool
impl Send for GpuMemoryPool
impl Sync for GpuMemoryPool
impl Unpin for GpuMemoryPool
impl UnsafeUnpin for GpuMemoryPool
impl UnwindSafe for GpuMemoryPool
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more