Skip to main content

DsparkSpecSession

Struct DsparkSpecSession 

Source
pub struct DsparkSpecSession {
    pub cache: Cache,
    pub rounds: usize,
    /* private fields */
}

Fields§

§cache: Cache§rounds: usize

Implementations§

Source§

impl DsparkSpecSession

Source

pub fn cache_max_ctx(&self) -> usize

Source

pub fn finished(&self) -> bool

Source

pub fn pos(&self) -> usize

Source

pub fn take_prefix_capture(&mut self) -> Option<SpecBoundaryCapture>

Drain the prompt-end prefix capture exactly once. Publication is worker-owned so it can apply namespace isolation, dedupe and the shared byte budget at the scheduler boundary.

Source

pub fn into_demoted(self) -> (Cache, u32)

DEMOTION HANDOFF (lane/dspark-spec-gate-demote, 2026-08-24): consume this session and hand its trunk cache + next-token prediction to the plain batched-decode path — the dspark twin of crate::spec::SpecSession::into_demoted.

WHY THIS IS EXACT (greedy). The burst-boundary invariant is `cache.pos == prompt rows

  • emitted tokens: each round commits exactly m+1trunk rows (anchor + accepted drafts) and emits exactly thosem+1tokens, so every emitted token has its KV row and nothing else does.last is the verify argmax at the LAST committed row — and verify-column argmax equality with plain decode is the very property the dspark E2E byte-identity gate pins (dspark_q38_gate`: ALL EXACT). Handing (cache, last) to the batched path therefore continues the stream from a state indistinguishable from one the batched path produced itself.

Unlike the MTP twin there is no carried-pending shape: the round commits its bonus inside the burst, so a session at a burst boundary is ALWAYS in handoff shape. The caller still cross-checks pos() against its fed-token count (a budget-clamped overshoot leaves cache rows past the public stream — those sessions finish, never demote). The draft KV, snapshot buffers and philox counters are DROPPED here (freeing their VRAM): the batched path never drafts, and the handoff is one-way.

Sampled sessions must not be demoted (the caller excludes them, mirroring the MTP gate): their committed stream depends on the session-owned philox counters, and the plain batched sampler is a different random program mid-request.

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, <T as TryFrom<U>>::Error>

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.