Skip to content

dsv4.1: communication kernels and wrappers - #39653

Merged
hnyls2002 merged 14 commits into
mainfrom
dsv4.1-communication
Sep 16, 2026
Merged

hnyls2002 merged 14 commits into
mainfrom
dsv4.1-communication

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add NVLink collectives on the CustomAllReduceV2 push and pull planes: all-reduce, all-gather and reduce-scatter, each as a push (Lamport slot) and a pull (multicast) kernel, with an optional residual folded into the reduction (csrc/distributed/nvlink_comm.cuh, ops/communication/nvlink_comm.py).
  • Add a fused deferred-MoE finalize -> one-shot push all-reduce kernel with optional shared-expert add and RMSNorm epilogue (csrc/distributed/all_reduce_fusion.cuh, ops/communication/all_reduce_fusion.py); the rank-local finalize is computed in registers and pushed straight into the peers' slots, keeping the unfused path's bf16 rounding points.
  • Add the DeepSeek-V4.1 mHC variants of that kernel: post-mixing, post-mixing + RMSNorm, and post-mixing + RMSNorm + fp8 quantization with ue8m0 group scales (ops/communication/all_reduce_mhc.py).
  • Add VocabGather (srt/distributed/device_communicators/vocab_gather.py): one [rows, local] -> [rows, world_size * local] interface with local, NCCL and NVLink transports; the NVLink transport takes the push kernel while the slice fits a push slot, the pull kernel into a symmetric-memory output beyond that, and the NCCL ring otherwise.
  • Add sharded_greedy_step (ops/speculative/dspark/sharded_greedy.py): each rank reduces its vocab shard to (value, index) partials and only those cross the transport.
  • Model call sites (finalize-fusion admission, communicator registration, the DSpark draft head) are in dsv4.1: remaining model and runtime integration #38798.

Changes to existing kernels

  • csrc/distributed/custom_all_reduce.cuh: the one-shot push kernel maps warps to blocks round-robin instead of block-major, so the tail CTAs keep work in the size band where choose_block_size moves past 512 threads before 1024 threads fill the grid. No numerical change.
  • include/sgl_kernel/distributed/ptx.cuh: the bulk multimem loads and stores name the .global state space (ST.E.128 becomes STG.E.128). No measured change.

Both changes, and the collectives themselves, are the shared-kernel part of #36720; the Kimi K3 migration in that PR is not included here.

Verification

  • JIT builds of every module in this PR (push, pull, finalize fusion, mHC, mHC + quant) and the Triton kernels succeed.
  • Existing tests on the modified shared kernels and headers are rerun on this PR: test_custom_all_reduce.py, test_deterministic_reduce_scatter.py, kimi_k3/test_collectives.py, kimi_k3/test_ar_fusion.py, test_symm_mem_all_gather.py.

CI States

Latest PR Test (Base): 🚫 Run #35072303670
Latest PR Test (Extra): ❌ Run #35072303560
Latest PR Test (AMD ROCm 10): ❌ Run #35072303590

@hnyls2002
hnyls2002 added this pull request to stack #39654 September 15, 2026 21:56
@hnyls2002
hnyls2002 removed this pull request from stack #39654 September 15, 2026 22:10
@hnyls2002
hnyls2002 added this pull request to stack #39658 September 15, 2026 22:10
@hnyls2002
hnyls2002 removed this pull request from stack #39658 September 15, 2026 22:31
@hnyls2002
hnyls2002 added this pull request to stack #39667 September 15, 2026 22:32
@hnyls2002
hnyls2002 removed this pull request from stack #39667 September 15, 2026 22:43
@hnyls2002
hnyls2002 added this pull request to stack #39669 September 15, 2026 22:43
@hnyls2002
hnyls2002 removed this pull request from stack #39669 September 15, 2026 22:56
@hnyls2002
hnyls2002 added this pull request to stack #39672 September 15, 2026 22:58
@hnyls2002
hnyls2002 removed this pull request from stack #39718 September 16, 2026 05:42
Base automatically changed from dsv4.1-topk to main September 16, 2026 06:54
@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/rerun-test test/registered/kernels/ops/communication/test_custom_all_reduce.py test/registered/kernel/communication/test_deterministic_reduce_scatter.py test/registered/kernels/ops/kimi_k3/test_collectives.py test/registered/kernels/ops/kimi_k3/test_ar_fusion.py test/registered/kernels/ops/communication/test_symm_mem_all_gather.py

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test/registered/kernels/ops/communication/test_custom_all_reduce.py test/registered/kernel/communication/test_deterministic_reduce_scatter.py test/registered/kernels/ops/kimi_k3/test_collectives.py test/registered/kernels/ops/kimi_k3/test_ar_fusion.py test/registered/kernels/ops/communication/test_symm_mem_all_gather.py:

🚀 8-gpu-h200 (3 tests): ✅ View workflow run

cd test/ && python3 registered/kernels/ops/communication/test_custom_all_reduce.py
cd test/ && python3 registered/kernels/ops/kimi_k3/test_ar_fusion.py
cd test/ && python3 registered/kernels/ops/communication/test_symm_mem_all_gather.py

🚀 4-gpu-b200 (2 tests): ❌ View workflow run

cd test/ && python3 registered/kernel/communication/test_deterministic_reduce_scatter.py
cd test/ && python3 registered/kernels/ops/kimi_k3/test_collectives.py

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

cd test/ && python3 registered/kernels/ops/kimi_k3/test_collectives.py

@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

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.

2 participants