Follow-up to PR #426 (DSpark Phases 0-4 + single-user server) and the docs/dspark-plan.md spec (#413).
What's missing
DSpark currently requires the single-user InferenceEngine (MaxBatchSize=1); the loader rejects continuous batching because the tap/draft state is single-sequence:
- Per-sequence hidden-tap buffers.
HiddenTapBuffer is one position-indexed buffer per pass; ContinuousBatchingEngine interleaves sequences with per-sequence KV caches, so capture must be keyed by cache/sequence (the RunBatchedTrunk capture site already guards on the owned cache view — that guard becomes a routing decision instead).
- Per-sequence draft contexts.
IDSparkDraft holds one context (ctx K/V + append cursor). Multi-user needs one draft MODEL (weights shared) with N contexts — likely a CreateContext() handle API, restructuring DSparkDraftModel/CudaDSparkDraftModel state.
- Batched drafting + packed verify. Per decode step: propose a block per eligible greedy sequence (GPU draft amortizes well; CPU draft per-user is prohibitive), then verify all users' segments in one packed pass —
BatchForwardMulti already accepts repeated caches with consecutive positions per user (that's exactly what BatchVerify does single-user), so the trunk machinery may already suffice; per-user accept/rollback via per-sequence TruncateTo.
- Load-aware verify length (spec §7's server half). Trim each user's verified prefix by confidence AND batch occupancy — the paper's scheduler: under load, shorter verifies keep step latency bounded; when idle, full blocks. The threshold trim already resolves from
SHARPI_DSPARK_*; the occupancy signal comes from the batcher.
Why deferred
The payoff only exists where DSpark already wins single-user — which per the Phase-4 measurements means desktop-scale targets (see the companion validation issue). Building the engine's most concurrency-sensitive extension before the single-user win condition is demonstrated would be effort at the wrong altitude.
🤖 Generated with Claude Code
https://claude.ai/code/session_018EWo1niax1g8A5E79RSALJ
Follow-up to PR #426 (DSpark Phases 0-4 + single-user server) and the docs/dspark-plan.md spec (#413).
What's missing
DSpark currently requires the single-user
InferenceEngine(MaxBatchSize=1); the loader rejects continuous batching because the tap/draft state is single-sequence:HiddenTapBufferis one position-indexed buffer per pass;ContinuousBatchingEngineinterleaves sequences with per-sequence KV caches, so capture must be keyed by cache/sequence (theRunBatchedTrunkcapture site already guards on the owned cache view — that guard becomes a routing decision instead).IDSparkDraftholds one context (ctx K/V + append cursor). Multi-user needs one draft MODEL (weights shared) with N contexts — likely aCreateContext()handle API, restructuringDSparkDraftModel/CudaDSparkDraftModelstate.BatchForwardMultialready accepts repeated caches with consecutive positions per user (that's exactly whatBatchVerifydoes single-user), so the trunk machinery may already suffice; per-user accept/rollback via per-sequenceTruncateTo.SHARPI_DSPARK_*; the occupancy signal comes from the batcher.Why deferred
The payoff only exists where DSpark already wins single-user — which per the Phase-4 measurements means desktop-scale targets (see the companion validation issue). Building the engine's most concurrency-sensitive extension before the single-user win condition is demonstrated would be effort at the wrong altitude.
🤖 Generated with Claude Code
https://claude.ai/code/session_018EWo1niax1g8A5E79RSALJ