Expand description
2026-09-25: Single-token decode forward for one Qwen3.5 decoder layer, full
attention or GDN, through &dyn GpuBackend and a QuantWeights impl.
Owner: model-layers. Invariants: none beyond the types.
forward_full_attention and forward_linear_attention each run norm,
projections, attention or the GDN recurrence, the residual add with the
post-attention norm, and the MLP with its residual. One token per call: the
KV append writes position cache_pos, and attention is passed seq_len_attn
as the cache length. Tokenizer, sampler and weight loading belong to the caller.
Structs§
- Full
Attention Layer - Full
Attention Scratch - 2026-09-25: Scratch buffers for
forward_full_attention. - Layer
KvCache - 2026-09-25: KV cache of one full-attention layer, for one sequence.
- Linear
Attention Layer - Linear
Attention Scratch - 2026-09-25: Scratch buffers for
forward_linear_attention. - Linear
Attention State - 2026-09-25: Conv and GDN state of one linear-attention layer, carried from token to token. The caller allocates and zeroes it.
- Qwen35
Forward Config - 2026-09-25: Dimensions of a Qwen3.5 checkpoint, read by both layer forwards.
- Qwen35
Kernels - 2026-09-25: Kernel handles for both layer forwards, looked up once by
Self::resolve.
Enums§
- Metal
KvDtype - 2026-09-25: Storage format of the contiguous KV cache (
LayerKvCache). Per-element sizes are whatLayerKvCache::allocallocates, scales included.
Functions§
- forward_
full_ attention - 2026-09-25: Runs one full-attention decoder layer for one token and returns
scratch.x_out, which holds the layer’s output residual stream. - forward_
linear_ attention - 2026-09-25: Runs one GDN decoder layer for one token and returns
x_buf, into which the layer’s output residual stream (scratch.x_final) is copied.intra_dump, when given, receives named intermediate buffers after a stream synchronize.