pub struct DsparkSpecSession {
pub cache: Cache,
pub rounds: usize,
/* private fields */
}Fields§
§cache: Cache§rounds: usizeImplementations§
Source§impl DsparkSpecSession
impl DsparkSpecSession
pub fn cache_max_ctx(&self) -> usize
pub fn finished(&self) -> bool
pub fn pos(&self) -> usize
Sourcepub fn take_prefix_capture(&mut self) -> Option<SpecBoundaryCapture>
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.
Sourcepub fn into_demoted(self) -> (Cache, u32)
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 exactlym+1trunk rows (anchor + accepted drafts) and emits exactly thosem+1tokens, so every emitted token has its KV row and nothing else does.lastis 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.