[NPU] Support GLM-5.2 DSpark loading - #38860
Open
yuejiat0416 wants to merge 3 commits into
Open
yuejiat0416 wants to merge 3 commits into
yuejiat0416 wants to merge 3 commits into
Conversation
5 tasks
yuejiat0416
force-pushed
the
feat/glm52-dspark-npu-upstream
branch
from
September 10, 2026 10:09
c434e2e to
421ed17
Compare
yuejiat0416
marked this pull request as ready for review
September 14, 2026 03:25
yuejiat0416
requested review from
JustinTong0323,
Qiaolin-Yu,
Ying1123,
hnyls2002,
iforgetmyname,
merrymercy,
ping1jing2 and
whybeyoung
as code owners
September 14, 2026 03:25
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.
Motivation
Enable GLM-5.2 DSpark with a Speculators-format dense BF16 draft and a ModelSlim QuaRot target on Ascend NPU. The draft export needs configuration translation, and its original-coordinate vocabulary and target-feature projection must remain compatible with the rotated target.
This draft PR targets static DSpark. Single-node/two-node colocated validation and performance results are being completed. Full accuracy evaluation results will be added to this PR in a follow-up update. Compact mode support will be implemented in a separate follow-up PR.
Depends on sgl-kernel-npu #791 for head_dim=192. Development testing uses the candidate
split_qkv_rmsnorm_rope.pythrough a process-local Python package overlay; the binary library and other modules remain from the image-installedsgl-kernel-npupackage. A released package version or reproducible image that includes #791 for normal installation is still TODO; the existing image is not claimed to contain this change.Modifications
SGLANG_NPU_GLM_DSPARK_QUAROT=originalfor an NPU GLM DSA ModelSlim QuaRot target with an unquantized dense draft. The default remains disabled;originaldeclares that the draft checkpoint has not already been converted.F_i @ Qon CPU in FP32 and store the original dtype. Validate the initial vocabulary/FC inputs; retain existing loader requirements on later reloads.The DFlash backbone and NPU fused-QKV call, DSpark proposal/verification/commit flow, and source checkpoints are preserved. The stored Q is not assumed to have an exact floating-point inverse. Independent vocabulary modules add device memory, and FC conversion adds startup work; both costs need measurement.
Accuracy Tests
PR head:
421ed1731176a33353b9a8a91a33bda6bb96b9b6; merge base:dc2157dcd62d5fb1bc5317fcf8765ebfcd8a8dad.Local CPU: 117 tests and 95 subtests passed across the eight affected test files on this PR head. This includes 51 new test methods and existing tests in
test_hf_transformers.py. Tests use CPU arithmetic, Gloo where applicable, and selected NPU mocks; this is not NPU execution or GitHub CI validation.Preliminary NPU results from development runs
Acceptance is
sum(A) / sum(P), not the mean of per-request percentages. The earlier run used the first 10 GSM8K test questions with temperature 0 and a 1024-token output limit: 8 requests stopped naturally and 2 reached the limit. Its 61.800% acceptance must not be combined with the later run's 9/10 score as if they came from one run.For the run reported on September 10, the same-run summary with algorithm/execution mode, TP/DP settings, tested source revisions, output budget and termination details is TODO. The uncredited answer has not yet been classified as incorrect, truncated or unparsed. These are small development samples collected before the PR rebase, not full GSM8K evaluation or validation of the current PR head. Full accuracy evaluation and matched target-only results will be added in a follow-up update.
Full-model NPU quality, actual graph replay and broader deployment compatibility remain unverified on the final PR head. Small development smoke results are not presented as a complete quality benchmark.
Speed Tests and Profiling
Record fixed versions, weights, topology, requests, sampling, concurrency and warmup/cache preparation. Report actual cache hits and graph execution. No speedup claim is made before these results are available.
Checklist
Targeted Ruff 0.15.1 formatting/lint, isort 7.0.0, codespell and syntax/diff checks passed on all 15 changed files without rewriting source. GitHub Lint passed on this head. A separate local full-repository pre-commit run and the remaining CPU/NPU CI are still pending.
Review and Merge Process
Keep this PR as a draft while validation and the kernel dependency are pending. Once ready, follow the maintainer process for code-owner review, authorized CPU/NPU CI, and merge after the required checks and dependency release.
CI States
Latest PR Test (Base): ⏳ Run #34464589708
Latest PR Test (Extra): ❌ Run #34464589499
Latest PR Test (AMD ROCm 10): ❌ Run #34464589834