pub struct Glm5SpecSession {
pub committed: Vec<u32>,
pub rounds: usize,
/* private fields */
}Expand description
glm5_next SERVED speculative session (lane/glm5-spec-routing, 2026-08-30): the state one
request’s spec decoding carries across worker bursts — the dspark/gemma session twins’
shape. The session OWNS its trunk cache (the worker’s s.cache stays None); at every
burst boundary the invariant is cache.pos == committed.len() with each committed row’s
trunk state exactly what a plain prime of that sequence would hold (the accept walk’s
basis, pinned by the tparallel gate), plus ONE emitted-but-uncommitted anchor token
(the next round’s verify row 0 — the dspark last convention).
Fields§
§committed: Vec<u32>Every token whose trunk state the cache holds, in order (prompt + committed
generation). EXCLUDES the live anchor.
rounds: usizeVerify rounds completed over the session lifetime (the worker’s per-burst
rounds-delta receipt, the dspark rounds convention).
Implementations§
Source§impl Glm5SpecSession
impl Glm5SpecSession
Sourcepub fn cache_max_ctx(&self) -> usize
pub fn cache_max_ctx(&self) -> usize
Context capacity of the session’s cache (the server’s ContextFull guard).
Sourcepub fn take_prefix_capture(&mut self) -> Option<SpecBoundaryCapture>
pub fn take_prefix_capture(&mut self) -> Option<SpecBoundaryCapture>
Drain the prompt-boundary capture (doc on the field; the dspark
take_prefix_capture twin — the worker publishes it against cache_ref).
Sourcepub fn prefix_capture_ready(&self) -> bool
pub fn prefix_capture_ready(&self) -> bool
True when the deferred prefix capture can publish NOW: a capture exists AND the DFlash2 drafter KV already covers the boundary. glm5 defers the prompt’s feature ingest to round 1 (unlike dspark’s at-creation ingest), so a drain that fired before the first burst would export an empty tail and waste the capture — the worker’s sweep polls this instead.
Sourcepub fn export_draft_tail(&self, e: &Engine, upto: usize) -> Option<DflashKvTail>
pub fn export_draft_tail(&self, e: &Engine, upto: usize) -> Option<DflashKvTail>
The drafter’s readable KV tail at upto rows (the dspark export_tail seam) —
None on the native arm or when the tail cannot cover the drafter window.
Sourcepub fn cache_ref(&self) -> &Cache
pub fn cache_ref(&self) -> &Cache
The session’s trunk cache, for the worker’s deferred prefix publication (the append-only-below-boundary slices) — never for mutation.
Sourcepub fn pos(&self) -> usize
pub fn pos(&self) -> usize
Trunk rows currently committed (== committed.len() at burst boundaries).
Sourcepub fn finished(&self) -> bool
pub fn finished(&self) -> bool
EOS committed or the context guard tripped: the next burst would emit nothing.
Sourcepub fn demote_eligible(&self) -> bool
pub fn demote_eligible(&self) -> bool
True when the session is a legal demotion source (loop-port fold-in, map #8): GREEDY only — a sampled session’s committed stream depends on its session-owned Philox counters, and the plain batched sampler is a different random program mid-request (the exact exclusion the MTP and dspark sweeps carry).