pub struct BufferPool { /* private fields */ }Expand description
Reusable GPU buffer pool.
Implementations§
Source§impl BufferPool
impl BufferPool
Sourcepub fn new(device: Device, queue: Queue, config: &DispatchConfig) -> Self
pub fn new(device: Device, queue: Queue, config: &DispatchConfig) -> Self
docs
Sourcepub fn with_tiering(
device: Device,
queue: Queue,
config: &DispatchConfig,
tiers: Vec<CacheTier>,
) -> Result<Self, BackendError>
pub fn with_tiering( device: Device, queue: Queue, config: &DispatchConfig, tiers: Vec<CacheTier>, ) -> Result<Self, BackendError>
Opt-in hot/cold tiered caching on top of the power-of-two pool.
Returns a new BufferPool that shares the underlying device
and queue but wraps every acquire/release in a TieredCache
governed by the supplied tiers + policy. Consumers that batch
many small dispatches (inference servers, streaming scanners,
batched probes) use this to keep hot allocations resident and
demote/evict cold ones via per-tier O(1) LRU.
The tiers vector is ordered coldest-first; policy controls
promotion/eviction. Defaults at
TieredCache::try_new(vec![CacheTier::try_new("hot", 1 << 24)?, CacheTier::try_new("cold", 1 << 30)?]) are a reasonable starting
point for 16 MiB hot / 1 GiB cold.
Sourcepub fn acquire(
&self,
len: u64,
usage: BufferUsages,
) -> Result<GpuBufferHandle, BackendError>
pub fn acquire( &self, len: u64, usage: BufferUsages, ) -> Result<GpuBufferHandle, BackendError>
docs
Sourcepub fn release(&self, handle: GpuBufferHandle)
pub fn release(&self, handle: GpuBufferHandle)
docs
Sourcepub fn stats(&self) -> BufferPoolStats
pub fn stats(&self) -> BufferPoolStats
docs
Trait Implementations§
Source§impl Clone for BufferPool
impl Clone for BufferPool
Source§fn clone(&self) -> BufferPool
fn clone(&self) -> BufferPool
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 !RefUnwindSafe for BufferPool
impl !UnwindSafe for BufferPool
impl Freeze for BufferPool
impl Send for BufferPool
impl Sync for BufferPool
impl Unpin for BufferPool
impl UnsafeUnpin for BufferPool
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