pub struct DeviceBudget {
pub backend: BudgetBackend,
pub total_bytes: u64,
pub usable_bytes: u64,
pub reserve_fraction: f64,
pub source: String,
pub approximate: bool,
}Expand description
A probed byte ceiling plus the sentence explaining where it came from. The sentence is not decoration: a budget a user cannot trace back to a query is a budget they will disable.
Fields§
§backend: BudgetBackend§total_bytes: u64What the query returned, before the reserve.
usable_bytes: u64total_bytes minus the reserve: what a plan may actually spend.
reserve_fraction: f64Held-back fraction, as applied.
source: StringHuman sentence naming the query, e.g. “Metal recommendedMaxWorkingSetSize”.
approximate: boolTrue whenever the checkpoint is mmap’d – i.e. always, for GGUF – because resident weight bytes are then the kernel’s business, not ferrox’s. Kept as a field rather than a constant so nothing downstream can print the budget without deciding what to say about it.
Implementations§
Source§impl DeviceBudget
impl DeviceBudget
Sourcepub fn new(
backend: BudgetBackend,
total_bytes: u64,
reserve: f64,
source: String,
) -> Self
pub fn new( backend: BudgetBackend, total_bytes: u64, reserve: f64, source: String, ) -> Self
Applies reserve to total and records the source.
Sourcepub fn detect(backend: BudgetBackend) -> Self
pub fn detect(backend: BudgetBackend) -> Self
Probes the backend the process is configured to use, honouring
FERROX_DEVICE_BUDGET_BYTES first.
backend is the caller’s already-resolved choice (the CLI’s
--device, the server’s FERROX_METAL/FERROX_CUDA), not a
second guess at it – this module decides how much memory a
backend has, never which backend runs.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
True when nothing could be probed. Callers must treat this as “do not enforce” rather than “reject everything”: refusing to load because a probe failed would be worse than not checking.
Trait Implementations§
Source§impl Clone for DeviceBudget
impl Clone for DeviceBudget
Source§fn clone(&self) -> DeviceBudget
fn clone(&self) -> DeviceBudget
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 DeviceBudget
impl Debug for DeviceBudget
Source§impl Display for DeviceBudget
impl Display for DeviceBudget
Source§impl PartialEq for DeviceBudget
impl PartialEq for DeviceBudget
impl StructuralPartialEq for DeviceBudget
Auto Trait Implementations§
impl Freeze for DeviceBudget
impl RefUnwindSafe for DeviceBudget
impl Send for DeviceBudget
impl Sync for DeviceBudget
impl Unpin for DeviceBudget
impl UnsafeUnpin for DeviceBudget
impl UnwindSafe for DeviceBudget
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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