Expand description
2026-09-25: Types every TransformerLayer shares: per-sequence layer state, the
per-pass ForwardContext, and the attention and GDN metadata a pass hands its layers.
Owner: model-layers. Invariants: none beyond the types.
Structs§
- Attn
Layer State - 2026-09-25: Per-sequence state of a Qwen3 attention layer. The KV cache lives outside it; the one field is the QSA indexer carry, created on first use and only on a layer that has a QSA indexer.
- Attn
Metadata Dev - 2026-09-25: Device addresses of one pass’s attention metadata, uploaded by the model
before its layer loop. On a decode pass each row is one sequence, with one entry (or one
block-table row) per row in each array. A prefill pass has
num_seqs == 1and onepositionsandslotentry per token. - Batched
Attn Metadata - 2026-09-25: Device metadata for one kernel-batched prefill chunk over several streams,
built by
stage_batched_attn_metadata(model-engineprefill_b/stage_batched.rs) and passed toprefill_attn_batched_layerandprefill_ssm_batched_layer. Positions and KV slots are stacked incu_seqlensorder; block tables and sequence lengths are per-stream pointer arrays. - Empty
Layer State - 2026-09-25: State of a layer that keeps nothing per sequence.
- Forward
Context - 2026-09-25: What one forward pass hands every layer: the GPU, buffers, config, the model’s switches and the pass’s metadata.
- GdnCarry
Binding - 2026-09-26: A GDN layer’s device buffers for the carried-state verify, set once by the
model (
model-engine gdn_carry.rs) before any capture. - GdnPrefill
Buffers - 2026-09-25: Whole-prompt GDN buffers for the split SSM prefill:
prefill_phase1writes the inputs,prefill_gdn_fullruns the recurrence intooutput, andprefill_phase3readsoutputandz. - Midchunk
Capture - 2026-09-25: Per-pass descriptor for mid-chunk SSM tail capture: the reserved snapshot slot’s per-SSM-layer destinations and the split point in pass-local token coordinates.
- SsmLayer
State - 2026-09-25: Per-sequence state of a recurrent (SSM/GDN) layer: the recurrent h state and the conv1d window, plus the copies speculative decode rolls back to.
Enums§
- MoeLora
Route - 2026-09-25: MoE-LoRA fold decision for one forward pass. One MoE adapter is active at
a time;
MoeLayer::moe_route_gate(layers/moe/lora.rs) folds onFold, skips onSkipand returns an error onRefuse.lora::resolve_moe_lora_routemaps a request’sadapter_slotto a route.
Constants§
- MTP_
CATCHUP_ MAX - 2026-09-25: Catch-up stash rows per sequence (
ModelLevers::mtp_kv_exact). The batched verify step stashes at most this many accepted drafts per sequence (verify_k4_batch_step.rs). - VERIFY_
WY_ LAYER_ STRIDE_ BYTES - 2026-09-25: Bytes between consecutive GDN layers’ table slices.
- VERIFY_
WY_ TABLES_ PER_ LAYER - 2026-09-25: Tables per GDN layer:
h_stateplus up to 15 intermediates.upload_verify_wy_tablesstages a verify only when k is in2..=VERIFY_WY_TABLES_PER_LAYER, and returns NULL otherwise. - VERIFY_
WY_ TABLE_ SEQS - 2026-09-25: Batched-verify WY pointer-table layout.
TransformerModel::upload_verify_wy_tables(model-engineverify_e2.rs) writes it; the qwen3_ssmGdnStates::Multiarm and the write-on-accept fold read it. - VERIFY_
WY_ TABLE_ STRIDE_ BYTES - 2026-09-25: Bytes between consecutive tables within a layer slice.
Traits§
- Layer
AuxState - 2026-09-26: A supertrait of
TransformerLayer; see the module header. - Layer
Capabilities - 2026-09-26: A supertrait of
TransformerLayer; see the module header. - Layer
Graph Hooks - 2026-09-26: A supertrait of
TransformerLayer; see the module header. - Layer
Split Prefill - 2026-09-26: A supertrait of
TransformerLayer; see the module header. - Layer
State - 2026-09-25: One layer’s per-sequence state, reached through
as_anydowncasts. Implementors here:EmptyLayerState,AttnLayerStateandSsmLayerState. - Layer
Weight Setup - 2026-09-26: A supertrait of
TransformerLayer; see the module header. - Layer
Write OnAccept - 2026-09-26: A supertrait of
TransformerLayer; see the module header. - Transformer
Layer