pub enum CostNode {
Lit(f64),
Sym(String),
Bin {
op: BinOp,
lhs: Box<CostNode>,
rhs: Box<CostNode>,
},
Neg(Box<CostNode>),
Index {
base: Box<CostNode>,
index: Box<CostNode>,
},
Call {
name: String,
args: Vec<CostNode>,
},
}Expand description
One node of a cost-expression AST.
Variants§
Lit(f64)
A numeric literal (integer or float; held as f64).
Sym(String)
A shape / param symbol resolved at eval time (m, n, k,
dtype_bytes, …). A dotted member path (lhs.dim, x.dim,
FKC §4.4 “shape dims by role”) is carried as one dotted Sym.
Bin
A binary arithmetic operation.
Neg(Box<CostNode>)
Unary negation.
Index
A shape-axis index: base[index] (FKC §3.5 dim[i], §4.4
lhs.dim[0] / out_shape[2]). base is the symbol path, index
the (usually literal) axis expression.
Call
A function-style term: f(arg, ...) (e.g. block_bytes(quant_type)
in the quant-matmul cost hints). Resolved at eval time from the
bindings by its canonical string spelling.
Trait Implementations§
impl StructuralPartialEq for CostNode
Auto Trait Implementations§
impl Freeze for CostNode
impl RefUnwindSafe for CostNode
impl Send for CostNode
impl Sync for CostNode
impl Unpin for CostNode
impl UnsafeUnpin for CostNode
impl UnwindSafe for CostNode
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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 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> ⓘ
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