Skip to content

Use runtime token widths for Triton speculative verification - #39859

Merged
merrymercy merged 5 commits into
mainfrom
lianmin/spec-verify-runtime-metadata-20260916
Sep 18, 2026
Merged

merrymercy merged 5 commits into
mainfrom
lianmin/spec-verify-runtime-metadata-20260916

Conversation

@merrymercy

@merrymercy merrymercy commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Triton target verification can omit the bonus token when it uses the draft proposal count for query and mask offsets. Use the speculative input's runtime token width, falling back to the model runner's capture width when metadata is absent or unset. Deterministic sliding-window attention also uses the actual prefix length and resolved verification width.

Give speculative inputs a shared optional attention-mask default while preserving Eagle's required constructor fields. Add CPU regression coverage for eager metadata, capture, padded replay, and sliding-window offsets.

Test plan

  • LD_PRELOAD=/usr/lib64/libnuma.so.1 uv run --no-sync python -m pytest -q test/registered/unit/layers/attention/test_triton_verify_metadata.py test/registered/unit/spec/test_eagle_worker_v2_topk1_fastpath.py — 19 tests and 7 subtests passed.
  • CUDA_VISIBLE_DEVICES=1 LD_PRELOAD=/usr/lib64/libnuma.so.1 uv run --no-sync python -m pytest -q test/registered/attention/unittests/dense/test_triton.py — 10 tests and 42 subtests passed on NVIDIA GB300, including eager speculative verification and CUDA-graph cases.
  • with-proxy uv run --project "$SYNC_LINT_ENV" --no-sync pre-commit run --files python/sglang/srt/layers/attention/triton_backend.py python/sglang/srt/speculative/eagle_info.py python/sglang/srt/speculative/spec_info.py test/registered/unit/spec/test_eagle_worker_v2_topk1_fastpath.py test/registered/unit/layers/attention/test_triton_verify_metadata.py — passed using the installed lint environment.
  • git diff --cached --check — passed.
  • Full model-server and ROCm tests were not run; local validation covers metadata and the NVIDIA attention unit suite.

Original commits

  • 50ef144be241dc09ca871f03315e18a8048b67c0

CI States

Latest PR Test (Base): 🚫 Run #35199622054
Latest PR Test (Extra): ❌ Run #35199621976
Latest PR Test (AMD ROCm 10): ❌ Run #35199622067

Resolve eager and graph verification widths from runtime metadata, preserve
the shared optional attention-mask contract, and use actual prefix lengths
for deterministic sliding-window attention.

Co-authored-by: raghotham <853234+raghotham@users.noreply.github.com>
@merrymercy

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Sep 16, 2026
Initialize the per-runner enum expected by decode_num_tokens_per_req. This matches the published non-speculative configuration; verification widths continue to come from runtime SpecInput metadata.

Validation: all nine Triton MLA tests passed on GB300, including target verification and draft CUDA graphs. Scoped pre-commit checks passed.
Comment thread python/sglang/srt/speculative/eagle_info.py
Comment thread python/sglang/srt/speculative/spec_info.py Outdated
Comment thread python/sglang/srt/speculative/spec_info.py
@metamergebot

Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@merrymercy

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_spec_eagle_triton.py

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_spec_eagle_triton.py:

🚀 1-gpu-5090 (1 test): ✅ View workflow run

cd test/ && python3 registered/spec/eagle/test_spec_eagle_triton.py

@merrymercy
merrymercy merged commit 248c202 into main Sep 18, 2026
464 of 536 checks passed
@merrymercy
merrymercy deleted the lianmin/spec-verify-runtime-metadata-20260916 branch September 18, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants