pub struct StreamShardAllocator { /* private fields */ }Expand description
Streaming shard allocator.
Callers feed (key, cost) pairs; the allocator returns the target device
plus a running snapshot of per-device load. Initial landing is
shard_by_blake3. If the target device’s running cost exceeds the
least-loaded device’s cost by more than spill_threshold, the item spills
to the least-loaded device. Least-loaded selection is heap-backed and keeps
stale heap entries compacted to GPU-count scale.
Implementations§
Source§impl StreamShardAllocator
impl StreamShardAllocator
Sourcepub fn new(n_gpus: u32, spill_threshold: u64) -> Result<Self, StreamShardError>
pub fn new(n_gpus: u32, spill_threshold: u64) -> Result<Self, StreamShardError>
Create an allocator for n_gpus devices with an initial zero-cost load
vector.
Sourcepub fn seed_load(
&mut self,
device: u32,
cost: u64,
) -> Result<(), StreamShardError>
pub fn seed_load( &mut self, device: u32, cost: u64, ) -> Result<(), StreamShardError>
Inject pre-existing load, such as already-queued work.
Auto Trait Implementations§
impl Freeze for StreamShardAllocator
impl RefUnwindSafe for StreamShardAllocator
impl Send for StreamShardAllocator
impl Sync for StreamShardAllocator
impl Unpin for StreamShardAllocator
impl UnsafeUnpin for StreamShardAllocator
impl UnwindSafe for StreamShardAllocator
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