Skip to content

[AMD] Fix DeepSeekV4 server cutlass error - #30374

Merged
HaiShaw merged 5 commits into
sgl-project:mainfrom
At1a8:fangyuan/fix_dsv4_server_cutlass_error
Jul 7, 2026
Merged

HaiShaw merged 5 commits into
sgl-project:mainfrom
At1a8:fangyuan/fix_dsv4_server_cutlass_error

Conversation

@At1a8

@At1a8 At1a8 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Motivation

PR #25220 introduced a top-level import of the CuTeDSL MQA logits module, which depends on NVIDIA-only cutlass packages.

On AMD/ROCm environments without cutlass, this import fails during DSV4 model registration and prevents the server from starting, even though the CuTeDSL backend is not used.
image

Modifications

Guard the CuTeDSL imports behind not is_hip(). On non-ROCm platforms, preserve the original eager import behavior so NVIDIA/CuTeDSL logic remains unchanged.

Accuracy Tests

root@smci355-ccs-aus-n12-13:/sgl-workspace/sglang# python3 /sgl-workspace/sglang/benchmark/gsm8k/bench_sglang.py --port 8000 --num-questions 1319

100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1319/1319 [01:08<00:00, 19.29it/s]
Accuracy: 0.948
Invalid: 0.000
Latency: 68.365 s
Output throughput: 1728.667 token/s

Speed Tests and Profiling

This PR has almost no impact on performance.

TP8 DP8, 8k/1k, concurrency = 256, num prompts = 4 × concurrency Total token throughput (tok/s) Mean TTFT (ms) Mean TPOT (ms)
Main branch failed failed failed
This PR 34904.71 6871.52 57.17

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 #28877915192
Latest PR Test (Extra): ❌ Run #28877913869

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces conditional imports for pick_dsl_expand and CuteDSLPagedMQALogitsRunner to avoid eager loading on ROCm (HIP) platforms. The review feedback notes that on ROCm platforms, pick_dsl_expand is left completely undefined in the module namespace, which will trigger static analysis warnings. It is recommended to define a fallback value of None when _is_hip is True to resolve this issue.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +67 to +69
if not _is_hip:
# Preserve the original eager import behavior on non-ROCm platforms.
from sglang.jit_kernel.dsa import pick_dsl_expand

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When _is_hip is True, pick_dsl_expand is not imported and remains completely undefined in the module namespace. Although the code path that uses it (use_cute_dsl) is not reachable on ROCm, static analysis tools (such as Pyright, mypy, or flake8) will still flag pick_dsl_expand as an undefined name.\n\nDefining a fallback value of None when _is_hip is True resolves this static analysis issue.

if not _is_hip:\n    # Preserve the original eager import behavior on non-ROCm platforms.\n    from sglang.jit_kernel.dsa import pick_dsl_expand\nelse:\n    pick_dsl_expand = None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check this review comment and fix that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check this review comment and fix that

Thanks for your comments! I've addressed the issue based on your suggestions.
image

@At1a8 At1a8 changed the title [AMD] Fix dsv4 server cutlass error [AMD] Fix DeepSeekV4 server cutlass error Jul 7, 2026
@bingxche bingxche added the run-ci CI: run the baseline test suite on this PR label Jul 7, 2026

@b8zhong b8zhong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Sorry about the breaking

@At1a8

At1a8 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author
image DeepSeek V4 passed in local terminal.

@HaiShaw
HaiShaw merged commit 40a6852 into sgl-project:main Jul 7, 2026
128 of 149 checks passed
@At1a8
At1a8 deleted the fangyuan/fix_dsv4_server_cutlass_error branch July 7, 2026 23:41
Fridge003 pushed a commit that referenced this pull request Jul 10, 2026
…error (#30374) (#30729)

Co-authored-by: Wang, FangYuan <39615225+At1a8@users.noreply.github.com>
Chronostasys pushed a commit to MindLab-Research/sglang that referenced this pull request Aug 24, 2026
…error (sgl-project#30374) (sgl-project#30729)

Co-authored-by: Wang, FangYuan <39615225+At1a8@users.noreply.github.com>
Chronostasys pushed a commit to MindLab-Research/sglang that referenced this pull request Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants