Repository navigation
[Feat][DSpark] Add single-card DeepSeek V4.1 draft execution and weight-reuse recipe - #2
Merged
wenxuewuhd merged 6 commits intoNov 8, 2026
Conversation
added 3 commits
October 21, 2026 11:30
Preserve adjacent RoPE pairs through stack/flatten. Validate and expand MXFP8 scale bytes on CPU during weight loading to avoid the RepeatInterleave and ReduceAny timeouts observed with CANN 9.2.0-beta.2 on Ascend950. Signed-off-by: pan-boyi <panboyi@huawei.com>
Reuse the upstream V4.1 drafter with Ascend mHC and context-KV operations. Keep all draft experts in HBM, isolate per-layer MoE dispatch, and publish stable deferred attention lengths for real requests. Add regression tests and an experimental deployment recipe. Document the five generation smoke checks and the unresolved 2/1270 draft acceptance result; no acceleration claim is made. Signed-off-by: pan-boyi <panboyi@huawei.com>
SparseFlashMla applies the block table to request-relative indices. Passing physical slots mapped draft KV twice and caused near-zero acceptance. Select the index space by backend and preserve legacy shared-KV behavior. Add shuffled-page unit coverage and an A5 numerical regression with a physical-index negative control. Record the fresh five-case validation: 142 of 600 proposed tokens accepted, with all five positions active. Signed-off-by: pan-boyi <panboyi@huawei.com>
2 tasks done
Link the companion kt-kernel PR and distinguish its target-branch port from the historically validated native build. Update the launch recipe to retain graph sizes three and six and record correctness, acceptance, throughput, and output-equivalence limits. Signed-off-by: pan-boyi <panboyi@huawei.com>
added 2 commits
November 2, 2026 18:33
Bind the three upstream hardware calls only during drafter construction and reuse the target RoPE/scatter helpers without a dummy query. Remove redundant binding inspection and post-load expert scanning, restore the base target patch dispatcher, and use the proposer hidden-state interface. Retain logical KV indices, persistent valid lengths and per-layer MoE state. Add CPU equivalence/interface regressions and distinguish isolated checks from pending native validation. Signed-off-by: pan-boyi <panboyi@huawei.com>
Keep the launch settings and current validation limits, distinguish historical native results from the simplified adapter, and link the separate CPU kernel instead of repeating its benchmark history. Runtime and test sources are unchanged. Signed-off-by: pan-boyi <panboyi@huawei.com>
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.
What this PR does / why we need it?
Enable experimental single-card DeepSeek-V4.1-Flash DSpark with kt CPU expert offload. A 50-line Ascend adapter reuses the upstream forward and checkpoint loader; the three draft layers keep all 128 experts in HBM while the target retains its 100 resident slots and CPU offload.
The remaining shared-path changes select the V4.1 drafter, accept its hidden-state interface, keep target/draft MoE dispatch state separate, and provide backend-correct KV indices with persistent metadata buffers. SparseFlashMla consumes logical positions; the legacy backend retains physical slots. Small CANN initialization compatibility fixes remain in their separate commit.
The PR contains +232/-69 runtime lines, +764/-24 test lines, and +105/-5 documentation lines. The latest update condenses the two documents by 113 lines without changing runtime or test sources.
Base:
dsv41-moe-offload-prat59ce1e18a4f93c20a872e4450bd14e891c556cb7. vLLM:a9686bc6e6809a49cb3e3c592a337d0721c3619f; CANN 9.2.0-beta.2.Does this PR introduce any user-facing change?
Yes.
method="dspark"uses the target checkpoint'smtp.*weights without a separate checkpoint, adding about 7.39 GiB of draft HBM. The recipe covers single-card text generation, concurrency one, maximum model length 8192, bf16 KV, target graphs[1,2,3,6], and eager draft execution. It retains the default asynchronous scheduler and stream-prefill threshold of 512 tokens. Multi-card and multimodal end-to-end generation remain unverified.CPU expert weight reuse is an optional separate kt-kernel change. Rebuild it and select its installation through
KT_SITE; the existing kernel is sufficient for functional DSpark. Setup and version-specific limits are inexamples/kt_moe_offload/README.mdanddspark_validation.md.How was this patch tested?
8147c5fpassed 280 targeted unit tests, one native A5 shuffled-page attention regression with the incorrect-index negative control, and five generation smoke checks. These results do not validate the simplified adapter revision. Fresh full vLLM/native NPU validation remains pending, so the PR remains Draft. No stable whole-model speedup or complete quality score is claimed.git diff --check, and static K2/K5 launch-argument/JSON checks passed. Runtime/tests are unchanged; no new model or NPU run was performed.bash format.sh ciwas rerun in an isolated copy. It still fails existing repository lint, formatting, spelling, logger/import checks and missing wget/gitleaks/shellcheck; full CI is not claimed green.