pub enum MemoryPoolConfig {
Exclusive {
max_alloc_size: MemorySize,
dealloc_period: Option<u64>,
},
Direct {
reclaim_at: Option<MemorySize>,
},
Sliced {
page_size: MemorySize,
max_slice_size: Option<MemorySize>,
max_pool_size: Option<MemorySize>,
dealloc_period: Option<u64>,
},
}Expand description
One pool entry; mirrors MemoryPoolOptions
and PoolType.
Sizes are aligned up to the device alignment.
Variants§
Exclusive
Every allocation gets its own page
(PoolType::ExclusivePages).
Fields
max_alloc_size: MemorySizeLargest allocation this pool accepts. 0 is valid: it makes a pool
dedicated to zero-sized (sub-alignment) allocations.
Direct
Every allocation is its own device allocation, reused by exact size
(PoolType::Direct).
Wastes only alignment padding, at the cost of a device allocation per distinct size rather than per page.
Fields
reclaim_at: Option<MemorySize>Reserved bytes above which the pool returns free slices to the driver, releasing just enough for the allocation that crossed it.
A watermark, not a budget: an allocation that still does not fit
once everything free is gone is served anyway. None never
reclaims on its own, leaving it to an explicit cleanup.
Sliced
Allocations are slices of larger pages
(PoolType::SlicedPages).
Fields
page_size: MemorySizeSize of each page.
max_slice_size: Option<MemorySize>Largest slice this pool accepts. Defaults to page_size.
max_pool_size: Option<MemorySize>Hard cap on the pool’s total reserved bytes: exceeding it is an
error instead of silent growth. None grows unbounded. Note:
runtimes that create one memory management per stream (CUDA, HIP)
apply the cap per stream.
Trait Implementations§
Source§impl Clone for MemoryPoolConfig
impl Clone for MemoryPoolConfig
Source§fn clone(&self) -> MemoryPoolConfig
fn clone(&self) -> MemoryPoolConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MemoryPoolConfig
impl Debug for MemoryPoolConfig
Source§impl PartialEq for MemoryPoolConfig
impl PartialEq for MemoryPoolConfig
impl StructuralPartialEq for MemoryPoolConfig
Auto Trait Implementations§
impl Freeze for MemoryPoolConfig
impl RefUnwindSafe for MemoryPoolConfig
impl Send for MemoryPoolConfig
impl Sync for MemoryPoolConfig
impl Unpin for MemoryPoolConfig
impl UnsafeUnpin for MemoryPoolConfig
impl UnwindSafe for MemoryPoolConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> ⓘ
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> ⓘ
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