Expand description
Qwen3 full attention layer.
Q/K/V projection -> Q/K norms -> RoPE -> KV cache write -> paged decode attention -> O projection, then MoE FFN.
Split into submodules:
types:MlaWeights+Qwen3AttentionLayerstruct definitionsinit:new,new_ungated,new_with_gating(kernel loading)helpers: setters +apply_layer_scalar+effective_attn_scaleprefill_weights: prefill weight setup + W4A16 M128 dispatcherdecode: single-token attention forward + KV cache helpersprefill: batched prefill with paged attentiontrait_impl:TransformerLayertrait implementation
Re-exports§
pub use innerq_driver::InnerQDriver;
Modules§
- innerq_
driver - Host-side driver for TurboQuant+ InnerQ per-channel K equalization.
Structs§
- Compressor
Weights - DeepSeek-V4 compressed-attention compressor weights (one per compressed layer).
Produces
n_win = usable/ratiocompressed KV entries that are concatenated to the raw sliding-window KV before core attention. CSA (ratio 4) uses a 2×ratio overlap window (Ca/Cb); HCA (ratio 128) uses a single non-overlapping window. - HcHead
Weights - Both HC sites for a DeepSeek-V4 block: the attention site runs before/after attention, the FFN site before/after the MoE FFN. Model-level HC head parameters (final collapse before LM head). Loaded once, attached to every layer, but only used by the last layer.
- HcLow
Rank - Qwen3.8-Flash-Next’s LOW-RANK hyper-connection parameters for one site.
- HcSite
Weights - Per-block Manifold-Constrained Hyper-Connection (mHC) parameters for one
site (attention or FFN). All buffers are float32 device pointers, matching
the checkpoint dtype. See
ops::hc_pre/ops::hc_post. - HcWeights
- MlaWeights
- MLA (Multi-head Latent Attention) weight components for 2-step decode.
- Qwen3
Attention Layer - Qwen3-Next full attention layer (12 of 48 layers).
Statics§
- ATTN_
PHASE_ US - Per-phase host-time accumulators for the prefill ATTENTION path
(
ATLAS_PREFILL_HOST_TIMING=1). Index: 0=qkv projections, 1=everything between qkv and the attention call (deinterleave + per-head norms + RoPE + KV write), 2=the attention kernel call itself, 3=o_proj + head gate. Summed across layers; read and reset once per prefill. - FFN_
HOST_ US - Host-time accumulator for the FFN/MoE half of prefill layers
(
ATLAS_PREFILL_HOST_TIMING=1). Summed across layers and read+reset once per prefill by the layer loop, so the attention half can be derived as loop_wall - ffn.
Functions§
- add_
attn_ phase_ us - add_
ffn_ host_ us - take_
attn_ phase_ us - take_
ffn_ host_ us - validate_
required_ kv_ kernels - Startup fail-fast for
--kv-cache-dtype: resolve every kernel handle the dtype’s dispatch arms require (chunked-prefill kernel, WHT bookends) and error with the full missing list — BEFORE the multi-minute weight load, instead of at first dispatch. Seekernel_requirements.rs.