pub struct Budget {
pub arena_bytes: usize,
pub reuse_saved_bytes: usize,
pub width_overhead_bytes: usize,
pub width_policy: &'static str,
pub host_io_bytes: usize,
pub off_fast_path_ops: usize,
pub off_fast_path_bytes: usize,
pub cast_nodes: usize,
pub param_bytes: usize,
pub dispatches: usize,
pub dram_bytes: usize,
}Expand description
What one run of this graph costs on one architecture.
Device-free, like the rest of the checker: every number comes from the same memory planner and dispatch claim the backend will use, not from a probe. Nothing here is wrong — that is the point of reporting it as notes. It is the difference between a graph that fits a phone and one that does not, and between a kernel that runs on the accelerator and one that quietly round trips through the host.
Fields§
§arena_bytes: usizeArena bytes the planner asks for under this backend’s width policy.
reuse_saved_bytes: usizeBytes liveness-aware slot reuse saved versus one buffer per node.
width_overhead_bytes: usizeExtra arena bytes this backend’s width policy costs over storing every
tensor at its native dtype width, with every other planner option held
fixed. Non-zero only on the f32-uniform backends, and only for graphs
that actually carry F16/BF16 activations. Deliberately not
arena_bytes minus the native plan’s: those two plans also differ in
pinning, and that delta would report a saving where there is none.
width_policy: &'static strName of the width policy in force (native / f32-uniform / hybrid).
host_io_bytes: usizeBytes that must cross the host boundary every run: graph inputs read in plus graph outputs read back. Parameters are excluded — they are uploaded once and stay resident.
off_fast_path_ops: usizeOps that will not run on this backend’s native fast path (portable common-IR or still unsupported), and the output bytes they touch. On a GPU backend these are the candidates for a host round trip.
off_fast_path_bytes: usize§cast_nodes: usizeCast nodes in the graph — every one is a full pass over a tensor whose
only product is a different dtype.
param_bytes: usizeParameter bytes the graph expects to find already on the device.
Separate from host_io_bytes on purpose, and reported rather than
folded in, because “weights are uploaded once and stay resident” is an
assumption — and it is the assumption that fails. When residency
silently does not hold, this whole number becomes per-run traffic, and a
boundary figure that already included it could not show the difference.
dispatches: usizeOps left after this backend’s fusion pipeline, excluding graph leaves.
An estimate of dispatch count, which on a GPU backend is the quantity that multiplies the per-dispatch floor. It is an estimate because one op is not always one dispatch — a multi-pass reduction is several — so treat it as a floor on dispatches, not an exact count.
dram_bytes: usizeBytes the dispatched ops read and write, summed over the fused graph.
An upper bound: it assumes nothing survives in cache or registers
between ops. Useful as a ratio against arena_bytes — a graph moving
many times its own arena is re-reading the same tensors.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Budget
impl RefUnwindSafe for Budget
impl Send for Budget
impl Sync for Budget
impl Unpin for Budget
impl UnsafeUnpin for Budget
impl UnwindSafe for Budget
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