pub struct GpuPool {
pub workers: Vec<Arc<GpuWorker>>,
}Expand description
Pool of GPU workers with placement strategy.
Fields§
§workers: Vec<Arc<GpuWorker>>Implementations§
Source§impl GpuPool
impl GpuPool
Sourcepub fn worker_by_ordinal(&self, ordinal: usize) -> Option<Arc<GpuWorker>>
pub fn worker_by_ordinal(&self, ordinal: usize) -> Option<Arc<GpuWorker>>
Return the worker bound to ordinal, if present in this pool.
Sourcepub fn resolve_explicit_placement_gpu(
&self,
placement: Option<&DevicePlacement>,
) -> Result<Option<usize>, String>
pub fn resolve_explicit_placement_gpu( &self, placement: Option<&DevicePlacement>, ) -> Result<Option<usize>, String>
Validate a request/config placement against the active worker pool.
In multi-GPU worker mode a request may explicitly pin components to at most one GPU ordinal. Cross-GPU component placement would bypass the worker-affinity model entirely, so reject it here instead of letting the engines silently allocate on a sibling GPU.
Sourcepub fn find_loaded(&self, model_name: &str) -> Option<Arc<GpuWorker>>
pub fn find_loaded(&self, model_name: &str) -> Option<Arc<GpuWorker>>
Find a non-degraded worker that already has this model loaded on GPU. If multiple workers have it, prefer the one with fewer in-flight requests.
Sourcepub fn select_worker(
&self,
model_name: &str,
estimated_vram: u64,
) -> Option<Arc<GpuWorker>>
pub fn select_worker( &self, model_name: &str, estimated_vram: u64, ) -> Option<Arc<GpuWorker>>
Select the best worker for a model, using the placement strategy (checked in order):
- Loaded and idle (model on GPU, no in-flight requests).
- Loaded but busy — queue behind the warm copy instead of reloading.
- Idle GPU with no model (spreads cold loads across free GPUs).
- Non-degraded worker with the most headroom (will evict LRU).
Sourcepub fn select_worker_excluding(
&self,
model_name: &str,
estimated_vram: u64,
skip: &[usize],
) -> Option<Arc<GpuWorker>>
pub fn select_worker_excluding( &self, model_name: &str, estimated_vram: u64, skip: &[usize], ) -> Option<Arc<GpuWorker>>
Same as [select_worker], but skips workers whose ordinal is in skip.
Used by the dispatcher to retry after a try_send failure.
Sourcepub fn gpu_status(&self) -> Vec<GpuWorkerStatus>
pub fn gpu_status(&self) -> Vec<GpuWorkerStatus>
Collect status from all workers.
Sourcepub fn worker_count(&self) -> usize
pub fn worker_count(&self) -> usize
Number of GPU workers in the pool.
Auto Trait Implementations§
impl Freeze for GpuPool
impl RefUnwindSafe for GpuPool
impl Send for GpuPool
impl Sync for GpuPool
impl Unpin for GpuPool
impl UnsafeUnpin for GpuPool
impl UnwindSafe for GpuPool
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
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>
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