pub struct StateBudget {
pub kda_recurrent: usize,
pub kda_conv: usize,
pub dsa_kv_per_token: usize,
pub dsa_indexer_per_token: usize,
pub mhc_highway_per_token: usize,
pub moe_routing_per_token: usize,
}Expand description
2026-09-25: Per-sequence state bytes, built by Glm5NextTextSkeleton::state_budget from
the config’s geometry. per_rank divides only the KDA state and the DSA KV.
Fields§
§kda_recurrent: usize2026-09-25: KDA recurrent state, [heads, head_dim, head_dim] fp32 per KDA layer,
summed over the KDA layers. Does not grow with sequence length.
kda_conv: usize2026-09-25: KDA causal-conv window, bf16, conv_dim x (kernel - 1 + num_spec) per KDA
layer. Does not grow with sequence length.
dsa_kv_per_token: usize2026-09-25: DSA MLA KV per token across the text-stack DSA layers, kv_lora_rank x 2
bytes each. Grows with sequence length.
dsa_indexer_per_token: usize2026-09-25: Indexer key and gate state per token across the text-stack DSA layers.
Grows with sequence length. The indexer projections are DsaShard::Replicated
(glm5next_dsa/tp.rs), so every rank holds the whole cache and Self::per_rank
does not divide it.
mhc_highway_per_token: usize2026-09-25: mHC highway per token, hc_mult x hidden fp32. An activation, so neither
fixed nor per_token counts it.
moe_routing_per_token: usize2026-09-25: MoE routing scratch per token: f32 logits plus 4-byte top-k ids and weights.
Implementations§
Source§impl StateBudget
impl StateBudget
Sourcepub fn fixed(&self) -> usize
pub fn fixed(&self) -> usize
2026-09-25: Fixed (sequence-length-independent) bytes per sequence.
Sourcepub fn for_sequence(&self, tokens: usize) -> usize
pub fn for_sequence(&self, tokens: usize) -> usize
2026-09-25: Total persistent state for a sequence of tokens.
Sourcepub fn per_rank(&self, ep: usize) -> StateBudget
pub fn per_rank(&self, ep: usize) -> StateBudget
2026-09-25: Divides kda_recurrent, kda_conv and dsa_kv_per_token by ep; the
indexer cache, the mHC highway and the routing scratch stay whole.
Trait Implementations§
Source§impl Clone for StateBudget
impl Clone for StateBudget
Source§fn clone(&self) -> StateBudget
fn clone(&self) -> StateBudget
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more