pub enum KernelInstruction {
Show 19 variants
Cached(usize),
RealConstant(f64),
ComplexConstant(Complex64),
Parameter(ParamId),
Unary {
op: UnaryOp,
input: KernelValueId,
},
Binary {
op: BinaryOp,
lhs: KernelValueId,
rhs: KernelValueId,
},
Add(Vec<KernelValueId>),
Mul(Vec<KernelValueId>),
Complex {
re: KernelValueId,
im: KernelValueId,
},
Vector(Vec<KernelValueId>),
Matrix {
rows: usize,
cols: usize,
elements: Vec<KernelValueId>,
},
Component {
input: KernelValueId,
index: usize,
},
MatrixElement {
input: KernelValueId,
row: usize,
col: usize,
},
MatMul {
lhs: KernelValueId,
rhs: KernelValueId,
},
MatVec {
matrix: KernelValueId,
vector: KernelValueId,
},
Dot {
lhs: KernelValueId,
rhs: KernelValueId,
},
Solve {
matrix: KernelValueId,
rhs: KernelValueId,
},
SolveRow {
row_slot: usize,
rhs: Vec<KernelValueId>,
},
SolveRowAdjointElement {
row_slot: usize,
index: usize,
len: usize,
adjoint: KernelValueId,
},
}Expand description
Operation that produces one value in kernel IR.
Variants§
Cached(usize)
Reads a precomputed cache slot.
RealConstant(f64)
Emits a real constant.
ComplexConstant(Complex64)
Emits a complex constant.
Parameter(ParamId)
Reads a scalar parameter.
Unary
Applies a unary scalar operation.
Binary
Applies a binary scalar operation.
Add(Vec<KernelValueId>)
Adds scalar operands.
Mul(Vec<KernelValueId>)
Multiplies scalar operands.
Complex
Constructs a complex scalar from real components.
Vector(Vec<KernelValueId>)
Constructs a vector from scalar elements.
Matrix
Constructs a row-major matrix.
Fields
elements: Vec<KernelValueId>Row-major scalar elements.
Component
Selects a vector component.
MatrixElement
Selects a matrix element.
Fields
input: KernelValueIdMatrix input.
MatMul
Multiplies two matrices.
MatVec
Multiplies a matrix by a vector.
Dot
Computes a vector dot product.
Solve
Solves a linear system.
SolveRow
Evaluates one row of a specialized cached solve.
Fields
rhs: Vec<KernelValueId>Right-hand-side scalar values.
SolveRowAdjointElement
Evaluates one adjoint element for a specialized solve row.
Implementations§
Source§impl KernelInstruction
impl KernelInstruction
Sourcepub fn diagnostic_name(&self) -> &'static str
pub fn diagnostic_name(&self) -> &'static str
Returns the stable instruction name used in diagnostics and support reporting.
Sourcepub fn event_dependence(&self) -> KernelEventDependence
pub fn event_dependence(&self) -> KernelEventDependence
Returns the backend-independent event-dependence rule for this instruction.
Sourcepub fn operands(&self) -> Vec<KernelValueId>
pub fn operands(&self) -> Vec<KernelValueId>
Returns the direct input value identifiers.
Sourcepub fn for_each_operand(&self, visit: impl FnMut(KernelValueId))
pub fn for_each_operand(&self, visit: impl FnMut(KernelValueId))
Visits direct operands in their instruction order without allocating.
The owned Self::operands method remains available for callers that
need a collected list. Backend dependency and liveness analysis should
prefer this callback when it only needs to traverse the operands.
Trait Implementations§
Source§impl Clone for KernelInstruction
impl Clone for KernelInstruction
Source§fn clone(&self) -> KernelInstruction
fn clone(&self) -> KernelInstruction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more