pub enum Instruction {
Show 34 variants
LoadInput {
name: String,
dst: usize,
},
LoadParam {
graph_name: String,
param_name: String,
dst: usize,
},
Unary {
op: UnaryInstr,
src: usize,
dst: usize,
},
Binary {
op: BinaryInstr,
lhs: usize,
rhs: usize,
dst: usize,
},
Reduce {
op: ReduceInstr,
src: usize,
dst: usize,
dims: Vec<i64>,
keepdim: bool,
},
Reshape {
src: usize,
dst: usize,
shape: Vec<usize>,
},
Transpose {
src: usize,
dst: usize,
},
Permute {
src: usize,
dst: usize,
dims: Vec<i64>,
},
Expand {
src: usize,
dst: usize,
shape: Vec<usize>,
},
Concat {
srcs: Vec<usize>,
dst: usize,
dim: usize,
},
Split {
src: usize,
dst: usize,
dim: usize,
chunks: usize,
},
Softmax {
src: usize,
dst: usize,
dim: usize,
},
Embedding {
indices: usize,
table: usize,
dst: usize,
},
Linear {
input: usize,
weight: usize,
bias: Option<usize>,
dst: usize,
},
LayerNorm {
input: usize,
weight: usize,
bias: usize,
dst: usize,
eps: f64,
},
BatchNorm {
input: usize,
weight: Option<usize>,
bias: Option<usize>,
dst: usize,
eps: f64,
},
MultiHeadAttention {
input: usize,
dst: usize,
n_heads: usize,
},
TransformerBlock {
input: usize,
dst: usize,
n_heads: usize,
},
Dropout {
src: usize,
dst: usize,
p: f64,
},
CrossEntropy {
predictions: usize,
targets: usize,
dst: usize,
},
MseLoss {
predictions: usize,
targets: usize,
dst: usize,
},
Constant {
value: ConstantValue,
output_type: IrType,
dst: usize,
},
Repeat {
count: i64,
body_op: Box<OpKind>,
src: usize,
dst: usize,
},
Call {
graph_name: String,
inputs: Vec<usize>,
dst: usize,
},
Compare {
op: CompareInstr,
lhs: usize,
rhs: usize,
dst: usize,
},
LogicalNot {
src: usize,
dst: usize,
},
LogicalBinOp {
op: LogicalBinInstr,
lhs: usize,
rhs: usize,
dst: usize,
},
FusedMatMulAdd {
a: usize,
b: usize,
c: usize,
dst: usize,
},
FusedAddRelu {
lhs: usize,
rhs: usize,
dst: usize,
},
FusedSubRelu {
lhs: usize,
rhs: usize,
dst: usize,
},
FusedMatMulRelu {
lhs: usize,
rhs: usize,
dst: usize,
},
Copy {
src: usize,
dst: usize,
},
Range {
inputs: Vec<usize>,
output_type: IrType,
dst: usize,
},
Free {
slot: usize,
},
}Expand description
A single operation in the compiled execution plan.
Unlike the interpreter, instructions are a flat enum with pre-resolved input/output buffer slots — no name lookups, no HashMap access.
Variants§
LoadInput
Load a graph input into a buffer slot.
Fields
LoadParam
Load a parameter into a buffer slot.
Fields
Unary
Binary
Reduce
Reshape
Fields
Transpose
Permute
Expand
Concat
Split
Softmax
Embedding
Linear
LayerNorm
BatchNorm
MultiHeadAttention
TransformerBlock
Dropout
CrossEntropy
MseLoss
Constant
Repeat
Call
Compare
LogicalNot
LogicalBinOp
FusedMatMulAdd
FusedAddRelu
FusedSubRelu
FusedMatMulRelu
Copy
Range
Free
Trait Implementations§
Source§impl Clone for Instruction
impl Clone for Instruction
Source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Instruction
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnwindSafe for Instruction
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
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>
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