Skip to content

[DSpark] Fix draft CUDA graph stream explosion - #40658

Merged
kpham-sgl merged 4 commits into
sgl-project:mainfrom
kpham-sgl:fix/dspark-draft-cuda-graph-streams
Sep 22, 2026
Merged

kpham-sgl merged 4 commits into
sgl-project:mainfrom
kpham-sgl:fix/dspark-draft-cuda-graph-streams

Conversation

@kpham-sgl

@kpham-sgl kpham-sgl commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

DSpark draft CUDA graph replay expands to seven streams on B300 with TP8/DCP1. Its seven dependent token broadcasts go through ProcessGroupNCCL even while the graph capture context has enabled PyNccl.

Modifications

Use the enabled PyNccl communicator for CUDA broadcasts, keeping broadcasts on the current capture stream. Preserve the torch.distributed fallback when PyNccl is disabled or unavailable. Keep the existing typed PyNccl broadcast unchanged. Audited SRT callers use supported integer or floating-point payloads; no bool/complex broadcast support is added.

Accuracy Tests

Existing Kimi K3 B300 correctness tests are being retriggered on the updated head. Dummy weights and simulated acceptance do not validate model accuracy. Pre-commit checks passed for the runtime change.

Speed Tests and Profiling

8× B300, TP8, 60k input / 1k output, DSpark block 7, simulated acceptance 5.5, dummy MXFP4 target and dummy draft weights, FP8 E4M3 KV, FP32 SSM, CuTe DSL MLA, FlashInfer MXFP4 MoE, CUDA device connections 8.

  • TP8/DCP1 draft replay streams: 7 → 1; target remains at 4.
  • The initial typed-broadcast DCP1 profile has the exact same runtime patch as the current head: 137 draft kernels and 1,950 target kernels per replay on all eight ranks, with stable stream assignments across 16 replays. The stream fix does not depend on byte broadcasting.

Earlier-revision measurements: the following N=5 table was collected at ff17b2e04b, which included byte broadcasting. These timings have not been rerun after restoring the existing typed broadcast at e91dd97ff0. The earlier DCP8 traces showed one draft stream and four target streams before and after.

N=5 unprofiled samples per variant, topology, and batch size:

Configuration BS Before, tok/s (mean ± SD) After, tok/s (mean ± SD) Change
TP8/DCP1 1 498.28 ± 2.33 498.57 ± 2.38 +0.06%
TP8/DCP1 16 3262.63 ± 19.96 3260.56 ± 19.76 −0.06%
TP8/DCP8 1 474.95 ± 2.24 474.95 ± 2.20 +0.002%
TP8/DCP8 16 3070.06 ± 19.06 3070.47 ± 19.26 +0.01%

Decode throughput is effectively unchanged in these runs; full-batch steady-state throughput gives the same conclusion. Mean total latency changes are +0.10%, +0.09%, +0.12%, and −0.26%, respectively. The last mean includes one slower baseline prefill, retained in the results; no end-to-end speedup is established.

Baseline is main c4d3770a68; patched is ff17b2e04b. Each variant/topology uses one fresh server, an excluded full-shape BS1/BS16 warmup pair, then five alternating measured pairs. Order: baseline DCP1, patched DCP1, patched DCP8, baseline DCP8. Client/server seeds are 42, corresponding acceptance lengths match, and all requests complete the requested output length. Samples share a server launch, so this is limited regression evidence rather than a general performance guarantee. DCP8 uses fi_a2a with replicated Q projection. The client capacity check is skipped because it reads physical capacity while DCP exposes logical capacity; server memory settings are unchanged.

Checklist

  • Pre-commit checks pass.
  • Typed-broadcast DCP1 profile verified; earlier-revision repeated timings identified above.
  • Correctness CI on the updated head.

CI States

Latest PR Test (Base): ❌ Run #35692480924
Latest PR Test (Extra): ❌ Run #35692480469
Latest PR Test (AMD ROCm 10): ❌ Run #35692480624

@kpham-sgl

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_broadcast_cuda_graph.py test_kimi_k3_b300.py test_kimi_k3_b300_low_latency.py

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_broadcast_cuda_graph.py test_kimi_k3_b300.py test_kimi_k3_b300_low_latency.py:

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

cd test/ && python3 registered/kernels/ops/communication/test_broadcast_cuda_graph.py

🚀 8-gpu-b300 (2 tests): ✅ View workflow run

cd test/ && python3 registered/e2e/models/test_kimi_k3_b300.py
cd test/ && python3 registered/e2e/models/test_kimi_k3_b300_low_latency.py

@sgl-project sgl-project deleted a comment from github-actions Bot Sep 22, 2026
@sgl-project sgl-project deleted a comment from github-actions Bot Sep 22, 2026
@kpham-sgl

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_kimi_k3_b300.py test_kimi_k3_b300_low_latency.py test_gemma4_dflash_31b_extra.py test_dflash_domino.py test_qwen35_fp4_mtp.py

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_kimi_k3_b300.py test_kimi_k3_b300_low_latency.py test_gemma4_dflash_31b_extra.py test_dflash_domino.py test_qwen35_fp4_mtp.py:

🚀 8-gpu-b300 (2 tests): ✅ View workflow run

cd test/ && python3 registered/e2e/models/test_kimi_k3_b300.py
cd test/ && python3 registered/e2e/models/test_kimi_k3_b300_low_latency.py

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

cd test/ && python3 registered/spec/test_gemma4_dflash_31b_extra.py

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

cd test/ && python3 registered/e2e/models/test_qwen35_fp4_mtp.py

⛔ test_dflash_domino.py: Ambiguous filename test_dflash_domino.py — matched 3 files:

  • test/registered/e2e/speculative/test_dflash_domino.py
  • test/registered/kernels/ops/speculative/test_dflash_domino.py
  • test/registered/unit/spec/test_dflash_domino.py

Please provide the full path, e.g. /rerun-test test/registered/e2e/speculative/test_dflash_domino.py

@kpham-sgl

Copy link
Copy Markdown
Collaborator Author

/rerun-test test/registered/e2e/speculative/test_dflash_domino.py

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test/registered/e2e/speculative/test_dflash_domino.py:

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

cd test/ && python3 registered/e2e/speculative/test_dflash_domino.py

@kpham-sgl
kpham-sgl merged commit bc22e1d into sgl-project:main Sep 22, 2026
94 of 110 checks passed
Leoyzen pushed a commit to Leoyzen/sglang that referenced this pull request Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant