Skip to main content

Module op

Module op 

Source
Expand description

Operation types — every tensor op in the RLX IR.

Designed for pattern-matching fusion: ops are grouped by category so fusion passes can reason about them structurally.

Enums§

Activation
Unary element-wise activation functions.
AttentionBwdWrt
Which forward input an Op::AttentionBackward node differentiates.
BinaryOp
Binary element-wise operations.
ChainOperand
An operand inside a fused ChainStep — either a graph-level input to the Op::ElementwiseRegion (by index 0..num_inputs) or the result of a previous step in the chain (by index 0..step_position).
ChainStep
One step in a fused element-wise chain. Each step produces exactly one scalar result (per element); later steps can refer to it via ChainOperand::Step. The whole chain runs per element in registers.
CmpOp
Comparison operations (return Bool tensor).
MaskKind
What kind of attention mask the kernel should apply.
Op
An operation in the RLX IR graph.
OpKind
PLAN L4: discriminant for each Op variant. Used by Op::kind + the Backend::supported_ops trait method to declare which ops a backend can lower; the LegalizeForBackend pass in rlx-opt checks the graph against this set and fails the compile when an unsupported op is present (instead of silent fallback).
ReduceOp
Reduction operations along specified axes.
ScaleMode
Scale-tracking strategy for Op::FakeQuantize. Determines how the per-channel s[c] is computed each forward pass.
SteKind
Straight-through estimator variants for Op::FakeQuantize’s backward. The forward is the same regardless: discrete clamp(round(x/s)) * s. The choice here affects only the gradient w.r.t. x during training.