pub struct ActivationHint {
pub width: u32,
pub height: u32,
pub batch: u32,
pub dtype_bytes: u32,
pub family: ActivationFamily,
}Expand description
Per-request shape hint passed into [preflight_memory_guard] so the
activation budget can scale with resolution / dtype / arch. None
degrades to the previous fixed-headroom approximation (the
MEMORY_BUDGET_HEADROOM baked into estimate_peak_memory’s 2 GB
constant), which keeps behavior identical for callers that don’t yet
have a request in scope (e.g. admin-API model loads with no resolution
context).
Public because gpu_worker::ensure_model_ready_sync and
gpu_worker::run_chain_blocking (both pub) take it as a parameter.
Fields§
§width: u32Image-space width.
height: u32Image-space height.
batch: u32CFG-doubled forwards typically pass 2; non-CFG passes 1.
dtype_bytes: u32Bytes per element (2 for bf16/fp16, 4 for f32).
family: ActivationFamilyArchitecture family — drives the per-arch factor in
mold_inference::device::activation_bytes.
Implementations§
Source§impl ActivationHint
impl ActivationHint
Sourcepub fn from_request(req: &GenerateRequest, family_slug: &str) -> Self
pub fn from_request(req: &GenerateRequest, family_slug: &str) -> Self
Build a hint from a GenerateRequest and the manifest family slug
(e.g. "flux", "sdxl"). The family slug is what
activation_family_for expects — when the caller doesn’t have a
strong family signal (catalog ID without an installed manifest, etc.)
passing the empty string falls back to ActivationFamily::FluxDit.
Sourcepub fn budget_bytes(&self) -> u64
pub fn budget_bytes(&self) -> u64
Compute the activation budget bytes from this hint.
Trait Implementations§
Source§impl Clone for ActivationHint
impl Clone for ActivationHint
Source§fn clone(&self) -> ActivationHint
fn clone(&self) -> ActivationHint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ActivationHint
Auto Trait Implementations§
impl Freeze for ActivationHint
impl RefUnwindSafe for ActivationHint
impl Send for ActivationHint
impl Sync for ActivationHint
impl Unpin for ActivationHint
impl UnsafeUnpin for ActivationHint
impl UnwindSafe for ActivationHint
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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