Skip to main content

Module lower_graph

Module lower_graph 

Source
Expand description

The engine’s program read off a model’s step graph: the decode step crate::model::author::decode_step writes for a ModelSpec, lifted into the one IR and fused by the shared table under the engine’s shim (super::shim::EngineShim), read block by block into the Commands of super::program.

lower_graph reads the step as the blocks the engine has units for: the embedding, then each layer’s norm, its mixer (a Gated-DeltaNet block or an attention block), the residual add, the FFN’s norm, the SwiGLU FFN and its add, then the step’s advance, the final norm and the head. Every op of a block is checked three ways before the block is written: its kind, the tensors it reads and writes (each block reads the residual the block before left and the next one reads what it wrote), and the checkpoint tensor and view each constant it reads is bound to (crate::model::bind). The engine’s merges are the shared table’s fused symbols, each read as the unit that runs it: the projections of one checkpoint matrix (merged_qkv) — row ranges of one tensor that follow one another from its first row (a Gated-DeltaNet block’s query, key and value of attn_qkv), or the interleaved halves of each head (an attention block’s queries and output gate of attn_q) — as one matvec; each convolution with its SiLU (conv_bias_silu) as a channel of the conv unit; the sigmoid and the decay a delta rule reads (gdn_gating) as the gates; and an attention’s output gate (glu_act_mul) as the sigmoid gate. A block is written in the order the engine’s units take it, which is not the order the author writes its ops in. What a block does that the engine has no unit for — a norm after the mixer, an FFN that is not SwiGLU, experts, latent attention, attention sinks, a sliding window, a scaled embedding — is refused by name, so a program the engine runs computes what the step graph says.

Enums§

LowerError
Why a step graph is not a program the engine runs.

Functions§

lower_graph
The program of graph, the step spec authors as the engine’s shim leaves it, at numerics.