[AMD] Dsv4/pr2 compressor opt - #26208
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces fused Triton kernels and performance optimizations for DeepSeek V4 on HIP, including fused compressor attention, Q/K RMSNorm, and sparse attention decode, alongside multi-stream overlap and aiter integration. The review highlights critical bugs regarding numerical stability and memory safety: online softmax implementations require guards against -inf to prevent NaN propagation, and several kernels need improved masking to avoid unsafe memory overwrites or incorrect reduction sums when handling invalid indices.
Remove the local fused-compress notes file from this branch to keep the PR focused on executable DSV4 optimization changes. Co-authored-by: Cursor <cursoragent@cursor.com>
Fix online softmax NaN guards and invalid write/index masking in HIP compressor paths, and keep fused kernel import paths consolidated after merging fused_compress_kernel into fused_compress_triton.
|
Addressed review feedback in commit
|
Delete fused_compress_kernel.py now that fused kernel implementation has been merged into fused_compress_triton.py.
Inline minimal test-only plan/write/compress helpers in test_fused_compress_attn_hip.py so the manual test no longer depends on the removed fused_compress_kernel module.
Preserve input-path contributions in c128 prefill softmax masking and only gate state-path entries by src_pos validity to avoid regression in GSM8K accuracy.
Drop duplicated DeepSeek-V4 norm/rope operator defs in common_extension_rocm to prevent c10 duplicate-registration aborts in AMD CI.
yctseng0211
left a comment
There was a problem hiding this comment.
LGTM
AMD failures : all known in scheduled run: https://github.com/sgl-project/sglang/actions/runs/26389348481
|
@amd-bot ci-status |
CI Status for PR #26208PR: [AMD] Dsv4/pr2 compressor opt AMD: 3 failures (0 likely related) | Others: 8 failures (0 related) AMD CI Failures
The three finish/gate jobs (pr-test-amd-finish, wait-for-stage-b-amd, call-gate / pr-gate, pr-test-extra-finish) are aggregator jobs that failed only because of the upstream stage-b failures above — no independent failure. Other CI FailuresAll 7 NPU jobs failed at workflow startup with the same infrastructure error — none ran any PR code.
DetailsBottom line: none of the failures clearly trace to this PR's code.
Suggested action: rebase on latest main and re-trigger AMD CI; if the
|
No need to rebase and re-trigger AMD CI, the |
Resolve conflict in AiterMoeQuantInfo (keep both swiglu_limit and gate_mode fields) and reconcile AiterRunnerCore.run() into a single gate_mode source. main #26208 set extra["gate_mode"]=INTERLEAVE when swiglu_limit>0, while this branch passes gate_mode=quant_info.gate_mode directly to fused_moe. A naive merge would pass gate_mode twice (TypeError) on the FP8/DSv4 path where swiglu_limit>0. Now gate_mode is resolved once: it comes from quant_info.gate_mode (MXFP4/GPT-OSS sets it from activation), and swiglu_limit>0 forces INTERLEAVE to preserve the original DSv4 behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: wunhuang <wunhuang@amd.com> Co-authored-by: Thomas Wang <1am9trash@gmail.com> Co-authored-by: Xinyi Song <86638975+RolaoDenthu@users.noreply.github.com> Co-authored-by: HaiShaw <hixiao@gmail.com> Co-authored-by: amd-danli103 <danli103@amd.com> Co-authored-by: Lin, Soga <soga.lin@amd.com> Co-authored-by: Raiden-Makoto <Raiden-Makoto@users.noreply.github.com> Co-authored-by: Hubert Lu <55214931+hubertlu-tw@users.noreply.github.com> Co-authored-by: yichiche@amd.com <jacky.cheng> Co-authored-by: yctseng0211 <yctseng@amd.com> Co-authored-by: Bingxu Chen <bingxche@amd.com>
…iffusion matrix Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: @1am9trash @RolaoDenthu @yichiche @hubertlu-tw @sogalin @HaiShaw @yctseng0211 @bingxche @amd-danli103 @Raiden-Makoto
Motivation
This PR improves DeepSeek-V4 inference performance on AMD ROCm by reducing decode/prefill hot-path overhead in compressor, indexer, and fused attention execution.
It also consolidates kernel options so we can enable high-performance fused paths with clearer runtime flags while maintaining numerical correctness checks.
Modifications
fused_compress_kernel.py,fused_compress_triton.py) and integrate them into compressor flows.triton_decode/*) for optimized/fused/split-k decode paths.fused_qk_norm.py) and wire related model-layer updates (deepseek_v4.py, RoPE, top-k, fp8, mem cache, MoE runner).environ.pyfor selecting fused kernels and indexer behaviors.sgl-kernelnorm+rope benchmark/test.AMD Accuracy Tests
server command
client command
Result
NVIDIA Accuracy Tests
server command
Result
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ✅ Run #26403671212
Latest PR Test (Extra): ❌ Run #26403670966