[AMD] Support DeepSeek V4 DSpark on AMD HIP platform - #30964
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
This reverts commit 888db41.
…o JIT and add SwapAB (sgl-project#30438)" This reverts commit 7431f35.
Wires the nightly-amd-8-gpu-mi35x-deepseek-v4-pro-dspark suite (registered by #30964) into the ROCm 7.2 AMD nightly workflow so it can be dispatched and scheduled.
|
@HaiShaw @At1a8 I dispatched the nightly suite on our MI35x CI runners so we get a CI-side signal on top of the author's local run. Run: https://github.com/sgl-project/sglang/actions/runs/31291406552
One gap worth flagging: the suite registered here isn't referenced by any job in I'll report accuracy and acceptance-length numbers back here once the run finishes. |
@HaiShaw @michaelzhang-ai |
|
Results are in — the nightly suite passed on our MI35x CI runners. @HaiShaw @At1a8 Run: 31291406552 →
Configuration was Still open is the scheduling gap: this only ran because I added the job on a branch. #34147 lands that job on |

Motivation
Follow #30261, support dspark for deepseek v4 on AMD platform
Modifications
python/sglang/srt/layers/attention/deepseek_v4_backend_hip_radix.pyEnables HIP ragged verify CUDA graph support for DSpark. Adds ragged layout metadata handling, GPU prefill expansion/compression planning, token-tier graph keys, and a draft-worker token-count fix. Removes previous HIP NotImplementedError guards for ragged verify.
python/sglang/srt/layers/attention/dsv4/unified_kv_kernels/runtime.pyAdds a Triton scatter kernel and wrapper to write already normed/roped BF16 KV rows into unified KV by precomputed ring locations, skipping rows marked with negative locations.
python/sglang/srt/mem_cache/deepseek_v4_memory_pool.pyAdds a unified-KV store method for DSpark KV writes. It applies fused norm/RoPE to draft KV, then scatters BF16 keys into the unified SWA ring instead of the non-unified SWA KV pool.
python/sglang/srt/models/deepseek_v4_dspark.pyRoutes DSpark draft KV storage and target-hidden KV injection through unified-KV writes when enabled. This avoids accessing swa_kv_pool in unified mode while preserving the original non-unified path.
python/sglang/srt/speculative/dflash_utils.pyAdds HIP Torch fallbacks for top-k and top-p probability renormalization, since ROCm builds may not register the corresponding sgl_kernel ops. CUDA/MUSA behavior remains unchanged.
python/sglang/srt/speculative/dspark_components/dspark_kv_inject.pyAdds unified-KV injection addressing using request state slots and ring positions. Applies SWA-window skipping and commit masking via negative locations, while preserving the existing full-to-SWA mapping path for non-unified KV.
python/sglang/srt/speculative/dspark_components/dspark_verify.pyPasses state-slot information into verify commit injection and selects unified commit-inject layouts when unified KV is enabled. Non-unified DSpark verify injection continues using the original layout builder.
python/sglang/srt/speculative/dspark_components/dspark_worker_v2.pyComputes per-token state slots and final positions during prefill injection for unified KV. This lets the injector keep only SWA-window tokens and avoid ring-slot collisions.
python/sglang/srt/speculative/dspark_components/kernels/dspark_verify_window.pyAdds a unified-KV commit-inject layout builder. It computes ring rows from request slots and token positions, marks uncommitted tokens as skipped, and returns the existing layout result type.
Accuracy Tests
ci results by
test/registered/amd/test_deepseek_v4_pro_fp4_dspark.pySpeed Tests and Profiling
Serving Bench - TP8 - 8k/1k
Serving Bench - TP8DP8 - 8k/1k
Accept length(4.84) as Expected(5) at TP8DP8 conc256 unified_kv_triton
Server cmd
Client cmd
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ✅ Run #31089093009
Latest PR Test (Extra): ❌ Run #31089091879