Skip to main content

Glm5SpecSession

Struct Glm5SpecSession 

Source
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: usize

Verify rounds completed over the session lifetime (the worker’s per-burst rounds-delta receipt, the dspark rounds convention).

Implementations§

Source§

impl Glm5SpecSession

Source

pub fn cache_max_ctx(&self) -> usize

Context capacity of the session’s cache (the server’s ContextFull guard).

Source

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).

Source

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.

Source

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.

Source

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.

Source

pub fn pos(&self) -> usize

Trunk rows currently committed (== committed.len() at burst boundaries).

Source

pub fn finished(&self) -> bool

EOS committed or the context guard tripped: the next burst would emit nothing.

Source

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).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.