Reuse the block drafter runtime for DSpark - #2497
Open
Tianlei Wu (tianleiwu) wants to merge 3 commits into
Open
Conversation
3 tasks
Tianlei Wu (tianleiwu)
force-pushed
the
tlwu/20260828/runtime-dspark
branch
from
August 29, 2026 00:02
dabb410 to
b6569cd
Compare
Tianlei Wu (tianleiwu)
force-pushed
the
tlwu/20260828/runtime-dspark
branch
from
August 29, 2026 09:26
b6569cd to
f95ade5
Compare
Tianlei Wu (tianleiwu)
force-pushed
the
tlwu/20260828/runtime-dspark
branch
from
August 29, 2026 17:03
f95ade5 to
8cc9175
Compare
Tianlei Wu (tianleiwu)
force-pushed
the
tlwu/20260828/runtime-dspark
branch
from
August 30, 2026 02:59
8cc9175 to
87c4495
Compare
Tianlei Wu (tianleiwu)
marked this pull request as ready for review
August 30, 2026 02:59
Contributor
There was a problem hiding this comment.
Pull request overview
Adds DSpark support by reusing the existing Engine-hosted block-drafter runtime (originally for DFlash2), including config aliasing, stricter contract validation, and updated paged-KV cache budgeting so full-attention drafters are accounted for against the target cache size.
Changes:
- Parse
model.dsparkas an alias of the existing DFlash2 block-drafter config/runtime and enforce mutual exclusivity withmodel.dflash2. - Add full-attention KV budgeting support by charging auxiliary bytes-per-target-block plus fixed “query spill” reserved bytes before selecting target paged-cache capacity.
- Expand validation and test coverage for overflow handling, DSpark geometry, cache tensor bindings/types, and lattice output shapes.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/config.cpp |
Adds model.dspark alias parsing and rejects configuring both dspark and dflash2. |
src/config.h |
Extends block-drafter config with an is_dspark flag and clarifies DSpark vs DFlash2 geometry semantics. |
src/dflash2_drafter.h |
Generalizes the interface to cover DSpark and adds helpers for full-attention cache sizing/billing. |
src/dflash2_drafter.cpp |
Implements full target/drafter contract validation (cache tensors + lattice outputs) and adds full-attention sizing helpers. |
src/engine/engine.cpp |
Integrates full-attention drafter budgeting into engine cache planning and conditionally constructs fixed-window vs mirrored full-attention drafter pools. |
src/engine/cache_manager.{h,cpp} / src/engine/paged_key_value_cache.{h,cpp} |
Threads auxiliary reserved-memory into paged-cache capacity computation and adds overflow-safe sizing. |
test/cpp/dflash2_config_test.cpp |
Adds DSpark alias/geometry tests and broader compatibility validation coverage. |
test/cpp/engine/paged_key_value_cache_tests.cpp |
Adds explicit overflow coverage for paged-cache capacity math. |
docs/paged_attention_engine.md |
Updates documentation for DSpark aliasing and full-attention cache budgeting behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Tianlei Wu (tianleiwu)
force-pushed
the
tlwu/20260828/runtime-dspark
branch
from
August 30, 2026 04:36
87c4495 to
ce48686
Compare
Tianlei Wu (tianleiwu)
force-pushed
the
tlwu/20260828/runtime-dspark
branch
from
August 30, 2026 06:41
ce48686 to
2f1e9f1
Compare
Tianlei Wu (tianleiwu)
force-pushed
the
tlwu/20260828/runtime-dspark
branch
from
August 30, 2026 20:21
2f1e9f1 to
92cbb44
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Reuses the DFlash2 block-drafter runtime from #2496 for DSpark artifacts. DSpark emits the same candidate-and-edge-score lattice with a Markov head, so the runtime only needs a config alias, support for one prediction per block row, and full-attention KV budgeting against the target paged-cache size.
This replaces #2462 while excluding DSpark builder changes already covered by #2490, historical diagnostics, dense-checkpoint experiments, and ONNX Runtime dependency changes.
Summary of Changes
Shared drafter configuration
model.dsparkthrough the existing block-drafter runtime schema.num_draft_tokens == block_sizefor DSpark while preserving DFlash2'sblock_size - 1layout.Full-attention cache budgeting
Scope
Testing
build/Linux/Debug/unit_tests(240 passed, 22 skipped)build/Linux/Debug/engine_unit_tests(295/295 passed)cmake --build build/Linux/Debug(passed)model.dspark.Real-model DSpark proposal correctness and throughput remain follow-up validation for this draft.
Dependencies
Checklist