Skip to content

Fix MockDSV4ModelRunner missing spec_algorithm - #31056

Merged
hnyls2002 merged 2 commits into
sgl-project:mainfrom
Jialin:jialino/fix-dsv4-mock-spec-algorithm
Jul 13, 2026
Merged

hnyls2002 merged 2 commits into
sgl-project:mainfrom
Jialin:jialino/fix-dsv4-mock-spec-algorithm

Conversation

@Jialin

@Jialin Jialin commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Motivation

DSpark (#30261) switched DeepseekV4AttnBackend.__init__ from reading
server_args.speculative_algorithm to model_runner.spec_algorithm, which the
attention-unittest mock runner does not define, so every dsv4 backend construction
through the kit crashes with AttributeError: 'MockDSV4ModelRunner' object has no attribute 'spec_algorithm' (e.g. all dsv4_c4_* cases in
test/registered/attention/unittests/dsv4/test_deepseek_v4.py). This breaks CI for
every PR based on current main.

Modifications

Give the mock SpeculativeAlgorithm.NONE, matching the pre-DSpark behavior for
non-spec cases: the old gate was server_args.speculative_algorithm is not None,
which the mock overrides to None, so with NONE the new gate resolves identically
(needs_cpu_seq_lens unset, is_dspark_draft False). One attribute plus its import in
python/sglang/test/kits/attention_unittest/attention_methods/dsv4_attention.py;
is_draft_worker, the other attribute the new code reads, was already defined.

Accuracy Tests

N/A — test-kit-only change; no runtime code touched.

Speed Tests and Profiling

N/A.

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): ⏳ Run #29281398333
Latest PR Test (Extra): ❌ Run #29281398028

DSpark (sgl-project#30261) switched DeepseekV4AttnBackend.__init__ from reading
server_args.speculative_algorithm to model_runner.spec_algorithm, which the
attention-unittest mock runner does not define, so every dsv4 backend
construction through the kit crashes with AttributeError. Give the mock
SpeculativeAlgorithm.NONE, matching the pre-DSpark behavior for non-spec cases
(needs_cpu_seq_lens unset, is_dspark_draft False).
@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!

@Jialin
Jialin marked this pull request as ready for review July 13, 2026 17:43
@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!

@Jialin

Jialin commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

/tag-run-ci-label

@Jialin

Jialin commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

/rerun-test registered/attention/unittests/dsv4/test_deepseek_v4.py

@github-actions

Copy link
Copy Markdown
Contributor

/rerun-test is not available for fork PRs unless the commenter has write permission on the repo.

Please ask a maintainer to run this command, or use the normal CI flow.

@Jialin

Jialin commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

/rerun-stage base-b-test-4-gpu-b200

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ /rerun-stage has been deprecated.

Stage granularity is too coarse — a stage usually doesn't map to one feature, so rerunning a stage re-pays the cost of unrelated tests. If you don't know which exact test files to rerun, you shouldn't be using /rerun-stage or /rerun-test in the first place.

Use one of these instead:

  • Selective tests (you know exactly which files to rerun):
    /rerun-test test_foo.py test_bar.py
    
  • Rerun only failed jobs:
    /rerun-failed-ci
    
  • Full CI rerun (with extra coverage): add the run-ci or run-ci-extra label and push a new commit (or use /tag-and-rerun-ci).

AMD CI: stage-level dispatch is still available via Actions UI → PR Test (AMD) / PR Test ROCm 7.2 (AMD)Run workflow → pick a stage from the dropdown.

@Jialin

Jialin commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@hnyls2002

Copy link
Copy Markdown
Collaborator

/rerun-test test_deepseek_v4.py

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_deepseek_v4.py:

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

cd test/ && python3 registered/attention/unittests/dsv4/test_deepseek_v4.py

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

cd test/ && python3 registered/attention/unittests/dsv4/test_deepseek_v4.py

@hnyls2002
hnyls2002 merged commit 47030b2 into sgl-project:main Jul 13, 2026
77 of 115 checks passed
@Jialin
Jialin deleted the jialino/fix-dsv4-mock-spec-algorithm branch July 13, 2026 20:55
Chronostasys pushed a commit to MindLab-Research/sglang that referenced this pull request Aug 24, 2026
jakki-amd pushed a commit to jakki-amd/sglang that referenced this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants