Skip to content

[WIP] Enable GLM-5.2 DSpark compact verify functionality - #30720

Draft
tanth47 wants to merge 5 commits into
sgl-project:mainfrom
tanth47:codex/glm52-official-dspark
Draft

tanth47 wants to merge 5 commits into
sgl-project:mainfrom
tanth47:codex/glm52-official-dspark

Conversation

@tanth47

@tanth47 tanth47 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

This is a draft/WIP GLM-5.2 DSpark functionality patch.

  • Fixes GLM-5.2 DSpark draft block layout to verify anchor + gamma and sample/confidence over draft slots only.
  • Enables compact/ragged verify plumbing for GLM-5.2, including DSA eager ragged support and CUDA-graph gating.
  • Adds seeded non-greedy DSpark draft/accept paths for PyTorch sampling backend, with debug reference assertions.
  • Adds request validation so seeded non-greedy DFlash/DSpark requests do not silently run unseeded on unsupported backends.
  • Adds seeded DFlash standalone sampling uniforms.
  • Adds trace/accuracy harness and focused tests for compact layout, target probs, DSA graph gating, request validation, and seeded sampling metadata.

Runtime validation

GLM-5.2 target: zai-org/GLM-5.2-FP8
Draft: RedHatAI/GLM-5.2-speculator.dspark
TP: 4
Backend: ROCm MI350, DSA tilelang, --sampling-backend pytorch, SGLANG_RAGGED_VERIFY_MODE=compact

  • Greedy/default compact 64x128: 64/64 OK, aggregate AR 0.5126, AL 4.5536, trace 1098 compact records, 0 failed.
  • Non-greedy seeded p19 64x128: 64/64 OK, aggregate AR 0.4962, AL 4.4353, trace 2021 compact/non-greedy records, 0 failed.
  • Forced-budget non-uniform p20 8x32 concurrency 2: 8/8 OK, trace 103 compact/non-greedy records, 33 non-uniform verify-lens records, 103 seeded sampling records, 0 failed.
  • p20 seeded mini 8x32: 8/8 OK, aggregate AR 0.6825, AL 5.6889, trace backend pytorch, 53 seeded records, 0 failed.

Unit/focused tests

python3 -m pytest \
  test/registered/unit/spec/test_dflash_request_validation.py \
  test/registered/unit/spec/test_dspark_softmax_temp.py \
  test/registered/unit/spec/test_dflash_verify_target_probs.py \
  test/registered/unit/spec/test_dspark_compact_layout.py \
  test/registered/unit/spec/test_dspark_dsa_ragged_graph_gate.py \
  test/registered/unit/sampling/test_sampling_batch_info.py \
  test/registered/spec/dspark/test_trtllm_mha_ragged_verify.py \
  -q -p no:cacheprovider

Result: 94 passed, 5 warnings.

Known limitations

  • This is not yet a full performance-stack implementation comparable to the DeepSeek-V4-specific DSpark path.
  • Exact A/B seeded replay is not used as the primary correctness oracle because GLM-5.2 DSA showed baseline nondeterminism; correctness is currently checked via verifier trace + runtime non-greedy accept reference asserts.
  • CUDA graph folded accept/commit and profiled SPS/STS tables are still future work for GLM-5.2 performance.

CI States

Latest PR Test (Base): ❌ Missing run-ci label -- add it to run CI tests.
Latest PR Test (Extra): ❌ Blocked -- run-ci is required first.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@hnyls2002

Copy link
Copy Markdown
Collaborator

Heads up - #30261 has just merged, so the DSpark stack this PR builds on is now on main. A rebase/merge of origin/main should shrink the diff considerably (46 of the 100 changed files were part of #30261), leaving just the GLM-5.2-specific changes for review.

@yiakwy-xpu-ml-framework-team

Copy link
Copy Markdown
Contributor

@tanth47 I guess this commit is targeted to ROCM 7.0. But in the tests, you have

 test/registered/spec/dspark/test_trtllm_mha_ragged_verify.py \

and passed the test. Can I know the reason ?

@tanth47

tanth47 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Good catch. That line in the draft PR body is confusing.

test/registered/spec/dspark/test_trtllm_mha_ragged_verify.py was not meant as ROCm 7.0 runtime validation of the TRTLLM MHA backend. It is a focused ragged-verify layout / graph-capability test that uses CPU tensors for the layout invariants, and the TRTLLM MHA-specific cases are guarded by an import skip:

  • if TRTLLMHAAttnBackend cannot be imported in the current environment, those cases are skipped;
  • the actual GLM-5.2 runtime validation for this PR was on ROCm/MI350 with the DSA backend, not TRTLLM MHA.

I included it in the draft validation list because the old monolithic patch touched generic ragged verify semantics shared by graph-capable attention backends. After #30261 merged, I am splitting this draft into smaller PRs; in the cleaned GLM-5.2/ROCm stack I will not present this test as ROCm TRTLLM evidence. It should either be listed only as generic CPU/focused coverage, or removed from the ROCm validation section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants