Skip to main content

Budget

Struct Budget 

Source
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: usize

Arena bytes the planner asks for under this backend’s width policy.

§reuse_saved_bytes: usize

Bytes liveness-aware slot reuse saved versus one buffer per node.

§width_overhead_bytes: usize

Extra 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 str

Name of the width policy in force (native / f32-uniform / hybrid).

§host_io_bytes: usize

Bytes 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: usize

Ops 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: usize

Cast nodes in the graph — every one is a full pass over a tensor whose only product is a different dtype.

§param_bytes: usize

Parameter 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: usize

Ops 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: usize

Bytes 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§

Source§

impl Clone for Budget

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Budget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for Budget

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,