Skip to content
Merged
Show file tree
Hide file tree
Changes from 184 commits
Commits
Show all changes
205 commits
Select commit Hold shift + click to select a range
5ab62a7
atomic add
chhwang Apr 12, 2026
88425a6
Add Expert-Parallel (MoE dispatch/combine) extension under src/ext/ep
seagater Apr 20, 2026
453160c
src/ext/ep: port low-latency dispatch/combine kernels
seagater Apr 20, 2026
a6af3a4
ext/ep: fix multi-rank intranode dispatch+combine
seagater Apr 21, 2026
393d6e2
ep: fix port-channel rank ordering for internode HT dispatch
seagater Apr 21, 2026
c351b87
ep: fix internode combine in multirank test
seagater Apr 22, 2026
9e96bf3
ep: document internode HT validation on 2x H100x8
seagater Apr 22, 2026
f0a7226
ext/ep: unfilter LL sync + add LL multirank test (intra-node WIP)
seagater Apr 22, 2026
2391ce1
ext/ep tests: add optional HT benchmark pass
seagater Apr 22, 2026
c51a8a5
ext/ep tests: time dispatch and combine separately in MSCCLPP_EP_BENCH
seagater Apr 22, 2026
1e43087
ext/ep: fix LL IB atomicAdd alignment by widening signaling buffers t…
seagater Apr 23, 2026
a073ca7
ext/ep: restore self CUDA-IPC connection (was needed by HT/LL paths)
seagater Apr 23, 2026
441bfa5
ext/ep: keep self slots in LL sema+port-channel loops (fixes cross-node)
seagater Apr 23, 2026
906fa3c
tests/ep: size HT buffers for bench hidden so bench phase fits
seagater Apr 23, 2026
b0eb5da
ext/ep: LL intra-node fast path via CUDA IPC + MemoryChannel
seagater Apr 23, 2026
63afb25
tests/ep: LL bench combine uses recv_tokens×hidden for payload bytes
seagater Apr 23, 2026
10cd001
tests/ep: LL bench prints per_rank_bw and accepts size env vars
seagater Apr 23, 2026
9840853
tests/ep: HT benches also print per_rank_bw
seagater Apr 23, 2026
85316b1
ep/ll: bump grid size to better utilize SMs
seagater Apr 23, 2026
6d0f99f
ep/ll: gate SM-count grid bump behind IPC path
seagater Apr 24, 2026
1600074
tests/ep: hoist combine output tensor out of the timed loop
seagater Apr 24, 2026
7d6efee
ep/ll: use 1 expert per SM with 32 warps per block
seagater Apr 25, 2026
9c129b8
ep/ll: keep (3,10) on PortChannel path
seagater Apr 25, 2026
4ed6f22
tests/ep: align intranode HT bench with NCCL-EP accounting
seagater Apr 27, 2026
48540bc
tests/ep: align internode HT bench with NCCL-EP accounting
seagater Apr 27, 2026
7e84155
ep: shard PortChannels across multiple ProxyServices
seagater Apr 27, 2026
0227626
ep: env-tunable + arch-aware num_proxy_services (default 8 on Hopper,…
seagater Apr 27, 2026
afbdcd6
ep tests: clean shutdown to silence TCPStore/HeartbeatMonitor noise
seagater Apr 29, 2026
9213587
ep tests: report dispatch/combine min, avg, max time and use avg for BW
seagater Apr 29, 2026
f2feb12
ext/ep: refresh README to reflect current LL, proxy sharding, and ben…
seagater Apr 29, 2026
e752dba
tests/ep: add NCCL-EP six-metric BW breakdown (send/recv x total/nvl/…
seagater Apr 29, 2026
6ad82e8
tests/ep: disable NCCL HeartbeatMonitor to silence mpirun shutdown noise
seagater Apr 29, 2026
2529774
tests/ep: intranode send-side counts unique (token, dst_node) to matc…
seagater Apr 29, 2026
fdf7d57
ext/ep: optional preallocated outputs for low_latency_dispatch
seagater Apr 30, 2026
89cb62d
Potential fix for pull request finding
seagater May 6, 2026
89f17da
Potential fix for pull request finding
seagater May 6, 2026
5178155
ext/ep: add MIT license headers to EP sources and tests
seagater May 6, 2026
075a43a
ext/ep: remove outdated single-rank smoke test
seagater May 6, 2026
b288065
ext/ep: remove unused mscclpp_ep CMake target
seagater May 6, 2026
c641487
ext/ep: fix SWITCH_* macros and add missing standard headers
seagater May 6, 2026
23e8ce6
ext/ep: add pragma once to event.hpp and update validation docs
seagater May 6, 2026
01032fa
core: TODO notes on CUDA-IPC atomicAdd context/flush caveats
seagater May 6, 2026
e87c66a
ext/ep: apply clang-format and black to fix CI lint failures
seagater May 6, 2026
5d16ac9
EP GB200 (4 GPUs/node) support
seagater May 8, 2026
8f2c4e7
ext/ep: route LL internode atomics over NVL72 fabric (Proposal A)
seagater May 8, 2026
3ab2e43
ext/ep: NVLS HT B2 phases 1-3 (notify_dispatch barrier + counter fast…
seagater May 9, 2026
46701d4
ext/ep: WIP Phase 4 NVLS HT B2 fabric-IPC data path
seagater May 9, 2026
591fe82
ext/ep: WIP Phase 4 NVLS HT B2 third multimem barrier in notify_dispatch
seagater May 9, 2026
28f1d72
ext/ep: WIP Phase 4 NVLS HT B2 cooperative-copy + relaxed multimem.red
seagater May 10, 2026
bf0a7e7
ext/ep: WIP Phase 4 normalize fence/sync ordering in combine writer
seagater May 10, 2026
f2228b0
ext/ep: WIP Phase 4 fabric-VA cross-node tail/head counter (bypass NV…
seagater May 10, 2026
e0a1bb2
ext/ep: WIP Phase 4 fix NVLS self-overcount + cached_notify NVLS barrier
seagater May 10, 2026
01a10e0
ext/ep: HT perf - lower lazy head-feedback threshold to chunk/4
seagater May 10, 2026
ce1554b
ext/ep: fix kRDMASender epilogue tail-write race (unblocks chunk_send…
seagater May 11, 2026
00ca2a2
ext/ep: lift cached_notify nc cap, strided-warp head fixup (HT 442/39…
seagater May 11, 2026
bb6176d
ext/ep: 8x unroll cross-node int4 copy (HT 645/612 GB/s)
seagater May 11, 2026
0f60ab5
ext/ep: LL escalate IPC layout when num_experts exceeds coop grid cap
seagater May 11, 2026
7b06a60
test/ext/ep: make HT test Config env-driven
seagater May 11, 2026
3f459a9
test/ext/ep: HT tests — env-driven cfg + allgather bookkeeping
seagater May 12, 2026
13babbf
test/ext/ep: HT — scale combine tolerance with bf16 ulp
seagater May 12, 2026
f9f0d0f
test/ext/ep: intranode HT bench — cached-mode iter loop
seagater May 12, 2026
33e59c2
test/ext/ep: intranode HT — parameterize num_sms and NVL chunk sizes
seagater May 13, 2026
7626daf
Merge branch 'qinghuazhou/expert_parallel_gb200' into qinghuazhou/exp…
seagater May 13, 2026
b7addc8
ext/ep: gate GB200-specific changes for non-GB200 builds
seagater May 13, 2026
8d773fe
Merge branch 'qinghuazhou/expert_parallel_gb200' (portability fix) in…
seagater May 13, 2026
79143c4
ext/ep: README — GB200 build + runtime notes
seagater May 13, 2026
9351e5a
Merge branch 'qinghuazhou/expert_parallel_gb200' (README) into qinghu…
seagater May 13, 2026
2a9dec9
ext/ep: README — split HT/LL mpirun, add torch install steps
seagater May 13, 2026
3b4fc5d
Merge branch 'qinghuazhou/expert_parallel_gb200' (README mpirun+insta…
seagater May 13, 2026
547c83a
ext/ep: README — clarify GB200 env-var defaults
seagater May 13, 2026
5d0c7df
Merge branch 'qinghuazhou/expert_parallel_gb200' (README env defaults…
seagater May 13, 2026
8715187
ext/ep: README — refresh Layout, reorder GB200 build, drop torchvision
seagater May 13, 2026
9d95821
Merge branch 'qinghuazhou/expert_parallel_gb200' (README layout/deps)…
seagater May 13, 2026
bcf2595
ext/ep: README - enable MSCCLPP_EP_BENCH in test commands; trim unuse…
seagater May 13, 2026
ad734c3
Merge qinghuazhou/expert_parallel_gb200 (README bench/env trim)
seagater May 13, 2026
20047dc
ext/ep: README - add explicit bench shape (TOKENS/HIDDEN/EXPERTS/TOPK…
seagater May 13, 2026
ce4b4c3
Merge qinghuazhou/expert_parallel_gb200 (README bench shape)
seagater May 13, 2026
9c93280
ext/ep: README - drop --mca TCP-only flags from default mpirun examples
seagater May 13, 2026
c1456e7
Merge qinghuazhou/expert_parallel_gb200 (drop --mca from mpirun examp…
seagater May 13, 2026
d4e70e2
ext/ep: README - document GB200 runtime env (NCCL_IB_DISABLE=1, NCCL_…
seagater May 13, 2026
bf6c235
Merge qinghuazhou/expert_parallel_gb200 (GB200 runtime env)
seagater May 13, 2026
22ddb3c
ext/ep: README - update Status with GB200 16-node validation + NVLS f…
seagater May 13, 2026
034324a
Merge qinghuazhou/expert_parallel_gb200 (Status GB200)
seagater May 13, 2026
4c13937
ext/ep: README - document GB200 NVLS variants in LL transport table +…
seagater May 13, 2026
399745f
Merge qinghuazhou/expert_parallel_gb200 (LL NVLS table)
seagater May 13, 2026
f7cbf1f
ext/ep: README - add Migration Phase 5 (Azure GB200 NVL72 port)
seagater May 13, 2026
7650e69
Merge qinghuazhou/expert_parallel_gb200 (Migration Phase 5 GB200)
seagater May 13, 2026
5911998
ext/ep: gate NVLS HT B2 on cross-host fabric IPC support (H100 fix)
seagater May 14, 2026
1f0948c
Merge branch 'qinghuazhou/expert_parallel' into qinghuazhou/expert_pa…
seagater May 14, 2026
98f6b1a
Merge branch 'qinghuazhou/expert_parallel_fix_h100' into qinghuazhou/…
seagater May 14, 2026
20bd1ec
ext/ep: fix CUDA 11.8 build + apply clang-format/black
seagater May 18, 2026
0099291
Merge remote-tracking branch 'origin/main' into qinghuazhou/expert_pa…
seagater May 18, 2026
cb93dd5
tests/ep: Unify the name of EP benchmark variables
seagater May 20, 2026
394b36c
Merge branch 'qinghuazhou/expert_parallel_gb200' into qinghuazhou/exp…
seagater May 20, 2026
757c5ec
Merge qinghuazhou/expert_parallel_gb200
seagater May 20, 2026
04ea24d
Fix python lint formatting in internode multirank test
Copilot May 20, 2026
2e73318
Revert "Clean up completed communicator receives (#804)" - thread-saf…
seagater May 27, 2026
c58e9b7
ext/ep/buffer: P2 - shard proxy on Blackwell multi-node by default (n…
seagater May 27, 2026
ef4f842
ep/internode: P4b - tune kNumDispatchRDMASenderWarps 7->6 (HT 2n disp…
seagater May 27, 2026
3a9ca15
ep: add MSCCLPP_EP_DISPATCH_NCCLEP build guard (EP_DISPATCH_NCCLEP) f…
seagater Jun 8, 2026
3ad6b70
ep: scaffold guarded dispatch_ncclep kernel (NCCL-EP port baseline) +…
seagater Jun 8, 2026
dbef7a5
ep(ncclep): increment 1 - same-GPU fused direct-write to recv_x
seagater Jun 8, 2026
fa07b49
ep(ncclep): increment 2 - deepen drain-copy MLP unroll 5->28
seagater Jun 8, 2026
2ebf81a
ep(ncclep): increment-3 de-risk - DRAIN_NOOP probe + SKIP_VERIFY test…
seagater Jun 8, 2026
ac25cf1
ep(ncclep): increment 3 - cross-GPU peer-map direct-write (eliminate …
seagater Jun 8, 2026
31c930d
ep(ncclep): increment 4a - VMM unicast recv pool (TMA-eligible peer m…
seagater Jun 8, 2026
b6140b0
ep(ncclep): increment 5 - sender direct-write dispatch (kEpDirect, di…
seagater Jun 11, 2026
ca829f6
ep(ncclep): inc5 ring-slot shrink + read-once direct write
seagater Jun 11, 2026
1f7942a
ep(ncclep): inc5 keep full rdma clean for combine under kEpDirect
seagater Jun 11, 2026
cc34e72
ep(ncclep): inc5 combine-direct gather (kEpDirect)
seagater Jun 11, 2026
3b6b2ac
ep(intranode): sender direct-write dispatch (MSCCLPP_EP_INTRA_DIRECT)
seagater Jun 11, 2026
14f1314
ep(ncclep): inc5 combine-gather correctness at >32 ranks (16n)
seagater Jun 12, 2026
462ab16
docs(ep): document MSCCLPP_EP_DIRECT and MSCCLPP_EP_INTRA_DIRECT for …
seagater Jun 15, 2026
57ea3dd
MoE Commnucator design doc (#818)
Binyang2014 Jun 29, 2026
04f8089
ep: high-throughput (HT) MoE backend on the nanobind MoECommunicator …
seagater Jul 1, 2026
c398af3
update read me
Binyang2014 Jul 2, 2026
8e34326
Binyli/ep revise (#828)
Binyang2014 Jul 7, 2026
b1d0893
Update ep test. Enable cuda graph for ep testing (#829)
Binyang2014 Jul 7, 2026
7eea687
ep: unified low-latency EP benchmark + LL combine SM-scaling fix (#831)
seagater Jul 9, 2026
359e681
ep(bench): mscclpp_ep_bench uses NCCL-EP-style random top-k routing (…
seagater Jul 13, 2026
bc4374e
merge main
Binyang2014 Jul 13, 2026
47c3255
Optimized LL implementation (#834)
Binyang2014 Jul 14, 2026
02c65cf
Support hidden size 6656 in low-latency EP (#835)
Binyang2014 Jul 14, 2026
8e64625
ep(bench): unified in-process LL benchmark for mscclpp + NCCL-EP Pyth…
seagater Jul 15, 2026
bc1b0c4
Merge remote-tracking branch 'origin/feature/ep' into qinghuazhou/uni…
seagater Jul 14, 2026
171e067
ep(bench): drop Python ep_bench_ll.py backend from run_ep_bench.py
seagater Jul 15, 2026
75c39b5
ep(bench): rename ep_bench_unified.py -> run_ep_bench_python.py
seagater Jul 15, 2026
13a7b4f
ep(bench): update run_ep_bench_python.py for current mscclpp LL API
seagater Jul 15, 2026
d4d665d
ep(bench): add validated 2-node MNNVL launch example to run_ep_bench_…
seagater Jul 15, 2026
d1f8b87
ep(bench): use placeholders for IPs/iface in the 2-node launch example
seagater Jul 15, 2026
bb58d5e
Refactor HT EP for direct fabric domains (#837)
Binyang2014 Jul 15, 2026
5ebbd34
Enable efficient 16-rank HT EP
Binyang2014 Jul 15, 2026
9a17f23
ep(bench): fix black formatting in run_ep_bench.py (CI lint)
seagater Jul 15, 2026
ca71c49
Merge branch 'feature/ep' of github.com:microsoft/mscclpp into qinghu…
seagater Jul 15, 2026
b58bd15
ep(bench): address review comments (arg validation, O_EXCL cupti lock…
seagater Jul 15, 2026
88676f6
Potential fix for pull request finding
seagater Jul 15, 2026
77a933b
ep(bench): add fp8/combine-mode/cuda-graph/validate to run_ep_bench_p…
seagater Jul 15, 2026
8ba25ff
ep(bench): report both min and avg for dispatch/combine in kernel-onl…
seagater Jul 15, 2026
ba6116d
Add token major layout support (#841)
Binyang2014 Jul 16, 2026
39813bf
Add token major layout support (#841)
Binyang2014 Jul 16, 2026
450fd62
ep(bench): drop per-iter stream.sync/barrier from timed loop and redu…
seagater Jul 17, 2026
436240b
Merge branch 'feature/ep' of https://github.com/microsoft/mscclpp int…
seagater Jul 17, 2026
dd9fa72
Adjust token major layout (#844)
Binyang2014 Jul 17, 2026
f2db956
ep(bench): add DeepEP-style kineto kernel timer with GPU NCCL barrier…
seagater Jul 17, 2026
2414364
Merge branch feature/ep into qinghuazhou/unified_ep_bench_ll_python
seagater Jul 17, 2026
b051c1e
Refactor HT mode (#846)
Binyang2014 Jul 17, 2026
9fd05f6
Add LL MXFP8 scale-32 dispatch (#847)
Binyang2014 Jul 18, 2026
04abdf5
Add native LL MXFP8 dispatch (#848)
Binyang2014 Jul 18, 2026
cea1d91
Harden LL token metadata handling (#849)
Binyang2014 Jul 20, 2026
548db1a
Add DeepEP V2 backend to unified EP bench; drop --backend both
seagater Jul 21, 2026
0d1f4e1
Merge branch 'feature/ep' of github.com:microsoft/mscclpp into qinghu…
seagater Jul 21, 2026
3b78be6
Add FlashInfer backend to unified EP bench
seagater Jul 21, 2026
20966a0
ep(bench): fix black formatting (CI lint)
seagater Jul 21, 2026
0ecb8de
ep(bench): add mscclpp high-throughput backend to unified Python bench
seagater Jul 22, 2026
8ac95f6
ep(bench): unified in-process Python EP benchmark (mscclpp vs NCCL-EP…
seagater Jul 25, 2026
5f4128c
fix(ep-bench): strip C++ template args in kineto kernel-name match (#…
seagater Jul 27, 2026
0eede0e
Merge branch 'main' into feature/ep
Binyang2014 Jul 28, 2026
b1cdec4
feat(ep-bench): capture mscclpp-ep dispatch+combine in one CUDA graph
seagater Jul 28, 2026
ec461a7
Merge origin/feature/ep into qinghuazhou/unified_ep_bench_ht_python
seagater Jul 28, 2026
c5246d6
Support rank major (#857)
Binyang2014 Jul 28, 2026
32d569d
feat(ep): add RANK_MAJOR dispatch layout for the high-throughput backend
seagater Jul 28, 2026
f0ab299
ep: address implementation review feedback
Binyang2014 Jul 29, 2026
28f4b5d
style(ep): format HT combine launch macro
Binyang2014 Jul 29, 2026
b26f178
ep(bench): remove C++ LL bench, shell driver, and CUPTI timer
seagater Jul 29, 2026
59c0385
ep(bench): disable DeepEP hybrid mode for the NVLink-only benchmark
seagater Jul 29, 2026
fe8c3c2
ep(bench): allow DeepEP CUDA-graph on the NVLink/MNNVL path at any scale
seagater Jul 29, 2026
55b4319
ep(bench): clarify EP_KINETO_SEPARATE=0 is the required CUDA-graph mode
seagater Jul 29, 2026
30c67f9
ep(bench): move per-library kineto kernel-name parse into backend files
seagater Jul 30, 2026
39f2e32
ep(bench): drop redundant sync between dispatch prime and combine pass
seagater Jul 30, 2026
17f8136
ep(bench): drop redundant mid-warmup sync between dispatch and combine
seagater Jul 30, 2026
48c1d91
ep(bench): give each backend its own parse_kineto_kernels()
seagater Jul 30, 2026
17a7c40
ep(bench): force paired kineto pass for mscclpp under --cuda-graph
seagater Jul 30, 2026
1dcab85
ep(bench): clarify the two-pass kineto comment is generic, not DeepEP…
seagater Jul 30, 2026
2f66c89
ep(bench): consolidate single-graph CUDA-graph capture into a shared …
seagater Jul 30, 2026
24ed414
ep(bench): move CUDA-graph capture into the harness (run_ep_bench_pyt…
seagater Jul 30, 2026
a9c5427
ep(bench): add --iters-per-graph to capture N iterations inside one C…
seagater Jul 30, 2026
4b77cf7
Merge branch 'feature/ep' of github.com:microsoft/mscclpp into qinghu…
seagater Jul 30, 2026
5bba8c7
ep(bench): default --graph-group-size to 10 for CUDA-graph runs
seagater Jul 30, 2026
16133c9
Potential fix for pull request finding
seagater Jul 30, 2026
644cacb
Potential fix for pull request finding
seagater Jul 30, 2026
65b89c8
Merge qinghuazhou/ep_bench_update into qinghuazhou/unified_ep_bench_h…
seagater Aug 3, 2026
d9c003c
ep(bench): enable CUDA-graph capture for the mscclpp high-throughput …
seagater Aug 3, 2026
434121a
ep(bench): fold the HT backend into ep_bench_mscclpp.py
seagater Aug 3, 2026
61a56dd
ep(bench): add setup_mscclpp_ht into ep_bench_mscclpp.py and fix harn…
seagater Aug 3, 2026
e405df1
ep(bench): rename _kineto_kernel_us -> torch_profiler_kernel_us
seagater Aug 4, 2026
01b608f
ep(bench): address review comments (default group 50, unify naming, f…
seagater Aug 5, 2026
55f4eaf
Merge branch 'qinghuazhou/ep_bench_update' into qinghuazhou/unified_e…
seagater Aug 5, 2026
c06ccbc
feat(ep): add RANK_MAJOR dispatch layout for HT backend (barrier-chan…
seagater Aug 5, 2026
b00c52e
style(ep): clang-format HT rank-major dispatch launch macro
seagater Aug 6, 2026
55fe426
fix(ep-bench): clamp single-graph combine span to avoid ZeroDivisionE…
seagater Aug 6, 2026
9fbd9cf
docs(ep-bench): clarify DeepEP internode graph limit is by design, no…
seagater Aug 6, 2026
ece1253
docs(ep-bench): correct DeepEP V2 internode transport in graph-gate c…
seagater Aug 6, 2026
41ec252
ep(bench): expose only --iters-per-graph (drop --graph-group-size alias)
seagater Aug 7, 2026
8897af4
Merge branch 'qinghuazhou/ep_bench_update' into qinghuazhou/unified_e…
seagater Aug 7, 2026
2753ce7
Merge branch 'feature/ep' into qinghuazhou/unified_ep_bench_ht_python
Binyang2014 Aug 21, 2026
030e161
Resolve feature/ep merge conflicts
Binyang2014 Aug 21, 2026
30d801c
Remove obsolete device code reviewer agent
Binyang2014 Aug 21, 2026
a60602a
Rename token-major implementation files for throughput
Binyang2014 Aug 22, 2026
9baea5f
Simplify unified EP runtime helper API
Binyang2014 Aug 22, 2026
d291da9
Remove obsolete low-latency EP test duplicate
Binyang2014 Aug 22, 2026
7c6703f
Unify EP benchmark backend mode selection
Binyang2014 Aug 22, 2026
bac1f6d
Remove redundant MSCCL++ benchmark bootstrap override
Binyang2014 Aug 22, 2026
ec36e19
Use mode-specific block defaults in EP benchmark
Binyang2014 Aug 22, 2026
c3b7d49
Use one communication resource knob in EP benchmark
Binyang2014 Aug 22, 2026
204f02b
Document EP num_blocks scheduler semantics
Binyang2014 Aug 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
"BASE_IMAGE": "ghcr.io/microsoft/mscclpp/mscclpp:base-dev-cuda12.9",
"BASE_IMAGE": "ghcr.io/microsoft/mscclpp/mscclpp:base-dev-cuda13.0",
"USERNAME": "devuser",
"SSH_PORT": "22345"
}
Expand Down
86 changes: 86 additions & 0 deletions .github/agents/device-code-reviewer.agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
description: "Use this agent for focused reviews of MSCCL++ device-side code, including CUDA/HIP kernels, device functions, synchronization, memory ordering, communication primitives, data types, conversions, and GPU performance.\n\nTrigger phrases include:\n- 'review this device code'\n- 'check this CUDA/HIP kernel'\n- 'look for races or synchronization bugs'\n- 'review the GPU memory ordering'\n- 'check the device data types and conversions'\n- 'check this kernel for correctness and performance'\n\nExamples:\n- User says 'I changed this CUDA kernel, can you review it?' → invoke this agent to inspect thread ownership, synchronization, memory safety, communication ordering, and performance\n- User asks 'Is this release/acquire sequence correct on the GPU?' → invoke this agent to trace the relevant writers, readers, scopes, and visibility guarantees\n- User says 'Review this device function for race conditions' → invoke this agent to inspect all call sites and report concrete concurrency hazards\n\nDo not use this agent for general host-only C++ review, code implementation, or EP build/test/performance validation; use the EP validator for validation requests."
name: device-code-reviewer
---

# Device Code Reviewer Instructions

You are a read-only reviewer specializing in MSCCL++ device-side code. Review CUDA and HIP kernels, device functions, low-level communication paths, and the host launch code needed to establish their execution context. Do not modify code.

## Review Priorities

1. **Correctness and memory safety**
- Check indexing, bounds, pointer arithmetic, alignment, aliasing, lifetime, and data layout assumptions.
- Trace ownership of every shared or remotely visible buffer, flag, counter, and queue entry.
- Identify races, deadlocks, hangs, early publication, duplicate publication, and stale-data hazards.

2. **Thread and synchronization semantics**
- Map work across lanes, warps, warp groups, blocks, and cooperative grids.
- Verify that every barrier is reached convergently by the required participants.
- Check that warp-, block-, device-, and system-scoped operations use the appropriate scope.
- Verify release/acquire ordering, fences, atomics, asynchronous copies, and completion waits.

3. **Communication correctness**
- Confirm payload writes complete before readiness signals are published.
- Check local, IPC/peer-mapped, and PortChannel paths independently.
- Verify single-writer contracts, remote offsets, source/destination rank mapping, and epoch or buffer reuse.
- Inspect the relevant MSCCL++ primitive semantics before recommending lower-level replacements.

4. **Performance**
- Look for load imbalance, poor coalescing, unnecessary serialization, excessive atomics, divergence, redundant synchronization, and avoidable global-memory traffic.
- Check launch geometry, occupancy constraints, register/shared-memory pressure, and warp utilization.
- Review asynchronous pipelines for overlap, dependency, and buffer-reuse hazards.
- Report performance concerns only when the mechanism and likely impact are concrete.

5. **Structure and boundary design**
- Flag redundant structures that duplicate fields, mirror another type, or only forward state without defining a distinct abstraction.
- Require each structure to have one coherent responsibility, explicit ownership or borrowing semantics, and invariants that it can maintain within its own boundary.
- Check that host configuration, device views, transport state, synchronization state, and workspace metadata have clear, non-overlapping roles.
- Identify designs that require callers to coordinate hidden invariants across multiple structures.
- Prefer reusing, merging, or removing structures when they do not have a distinct semantic, ownership, or lifetime boundary.

6. **Data types and conversions**
- Prefer the portable scalar types, vector types, `DataType`, `mscclpp::to`, `mscclpp::bit_cast`, and other helpers from `include/mscclpp/gpu_data_types.hpp` over raw CUDA/HIP types or locally duplicated conversion code.
- Search `gpu_data_types.hpp` before introducing a new packed type, alias, bit representation, clipping operation, or numeric conversion.
- If a required reusable type or conversion helper is missing, the recommended fix should add a documented CUDA/HIP-compatible definition or function to `include/mscclpp/gpu_data_types.hpp` instead of adding an ad hoc helper to a kernel file.
- Keep unavoidable backend-native types and intrinsics isolated at hardware or ABI boundaries, and convert to MSCCL++ types at the boundary.

7. **Portability and maintainability**
- Check CUDA/HIP portability and architecture guards when the code is not intentionally backend-specific.
- Prefer existing MSCCL++ helpers and established patterns when they preserve the required low-level semantics.
- Flag confusing naming or duplication only when it increases correctness or maintenance risk.

## Review Method

1. Establish the kernel's purpose, launch configuration, input/output layout, and synchronization contract.
2. Inspect call sites, configuration code, related helpers, and producer/consumer kernels before drawing conclusions.
3. Trace representative execution paths, including empty work, partial warps, uneven expert/token distributions, local peers, remote peers, and buffer rollover.
4. For each suspected issue, identify the exact failing interleaving, input, architecture, or configuration.
5. Check whether existing barriers, atomics, or API guarantees already prevent the issue.
6. Report only findings that are actionable and supported by the code.

## Avoid Incorrect Review Heuristics

- Do not reject raw kernels or device intrinsics merely because a higher-level API exists.
- Do not flag a single-thread control loop when its cost is negligible or parallelization would add synchronization.
- Do not recommend removing a barrier without proving that all dependent reads and writes remain ordered.
- Do not assume CUDA behavior applies to HIP, or vice versa.
- Do not enforce naming or style preferences that are not established by the repository.
- Do not merge structures solely to reduce the type count; preserve types that enforce a meaningful invariant or boundary.
- Do not replace a raw backend type when it is required by an intrinsic, assembly constraint, hardware format, or external ABI; isolate and document that boundary instead.
- Do not produce speculative performance claims without explaining the bottleneck.

## Output Format

List findings in descending severity. For each finding provide:

- `severity — file:line — concise title`
- The concrete correctness or performance impact.
- The execution scenario that triggers it.
- A specific fix or safer design direction.

If there are no high-confidence findings, say so directly and note only material residual risks or validation gaps. Do not create empty category sections, repeat the code, or include style-only noise.

## Clarification

Ask for clarification only when correctness depends on an undocumented external contract, target architecture, transport capability, or performance requirement that cannot be established from the repository.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
cpplint:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Check out Git repository
Expand All @@ -22,7 +22,7 @@ jobs:
run: bash ./tools/lint.sh cpp dry

pylint:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Check out Git repository
Expand All @@ -40,7 +40,7 @@ jobs:
run: bash ./tools/lint.sh py dry

spelling:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Check out Git repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mscclpp-lang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set environment variable
run: echo "LD_LIBRARY_PATH=/usr/local/cuda/compat:/usr/local/cuda/lib64" >> $GITHUB_ENV
run: echo "LD_LIBRARY_PATH=/usr/local/cuda/lib64" >> $GITHUB_ENV

- name: Install mscclpp
run: |
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ option(MSCCLPP_BUILD_TESTS "Build tests" OFF)
option(MSCCLPP_BUILD_PYTHON_BINDINGS "Build Python bindings" ON)
option(MSCCLPP_BUILD_EXT_NCCL "Build NCCL interfaces" ON)
option(MSCCLPP_BUILD_EXT_COLLECTIVES "Build collective algorithms" ON)
option(MSCCLPP_BUILD_EXT_EP "Build Expert-Parallel (MoE dispatch/combine) extension" ON)
option(MSCCLPP_USE_CUDA "Use NVIDIA/CUDA." OFF)
option(MSCCLPP_USE_ROCM "Use AMD/ROCm." OFF)
option(MSCCLPP_USE_IB "Use InfiniBand." ON)
Expand Down Expand Up @@ -176,7 +177,7 @@ if(MSCCLPP_GPU_ARCHS)
endif()
elseif(MSCCLPP_USE_CUDA)
if(NVIDIA_FOUND)
set(MSCCLPP_GPU_ARCHS "native")
set(MSCCLPP_GPU_ARCHS ${NVIDIA_GPU_ARCHS})
else()
if(CUDAToolkit_VERSION VERSION_LESS "12.0")
message(FATAL_ERROR "CUDA 12.0 or higher required (C++20 build), found ${CUDAToolkit_VERSION}")
Expand Down
7 changes: 6 additions & 1 deletion cmake/CheckNvidiaGpu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ enable_language(CUDA)

set(CHECK_SRC "${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_nvidia_gpu.cu")

try_run(RUN_RESULT COMPILE_SUCCESS SOURCES ${CHECK_SRC})
try_run(RUN_RESULT COMPILE_SUCCESS SOURCES ${CHECK_SRC}
RUN_OUTPUT_VARIABLE NVIDIA_GPU_ARCHS)

if(COMPILE_SUCCESS AND RUN_RESULT EQUAL 0)
string(STRIP "${NVIDIA_GPU_ARCHS}" NVIDIA_GPU_ARCHS)
list(REMOVE_DUPLICATES NVIDIA_GPU_ARCHS)
set(NVIDIA_FOUND "TRUE")
message(STATUS "Detected NVIDIA GPU architectures: ${NVIDIA_GPU_ARCHS}")
else()
unset(CMAKE_CUDA_ARCHITECTURES)
unset(NVIDIA_GPU_ARCHS)
endif()
14 changes: 13 additions & 1 deletion cmake/check_nvidia_gpu.cu
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@

#include <cuda_runtime.h>

__global__ void kernel() {}
#include <cstdio>

int main() {
int cnt;
cudaError_t err = cudaGetDeviceCount(&cnt);
if (err != cudaSuccess || cnt == 0) {
return 1;
}

for (int device = 0; device < cnt; ++device) {
cudaDeviceProp properties;
err = cudaGetDeviceProperties(&properties, device);
if (err != cudaSuccess) {
return 1;
}
if (device != 0) {
std::printf(";");
}
std::printf("%d", properties.major * 10 + properties.minor);
}
return 0;
}
7 changes: 7 additions & 0 deletions include/mscclpp/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,13 @@ class Connection {
/// @param newValue The new value to write.
void updateAndSync(RegisteredMemory dst, uint64_t dstOffset, uint64_t* src, uint64_t newValue);

/// Atomically add a value to a 64-bit integer in a destination RegisteredMemory.
///
/// @param dst The destination RegisteredMemory.
/// @param dstOffset The offset in bytes from the start of the destination RegisteredMemory.
/// @param value The 64-bit signed value to atomically add.
void atomicAdd(RegisteredMemory dst, uint64_t dstOffset, int64_t value);

/// Flush any pending writes to the remote process.
/// @param timeoutUsec Timeout in microseconds. Default: -1 (no timeout)
void flush(int64_t timeoutUsec = -1);
Expand Down
1 change: 1 addition & 0 deletions include/mscclpp/fifo_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ using TriggerType = uint64_t;
constexpr TriggerType TriggerData = 0x1; // Trigger a data transfer.
constexpr TriggerType TriggerFlag = 0x2; // Trigger a signaling.
constexpr TriggerType TriggerSync = 0x4; // Trigger a flush.
// type == 0 is reserved for atomic add operations.

constexpr unsigned int TriggerBitsSize = 32;
constexpr unsigned int TriggerBitsOffset = 32;
Expand Down
7 changes: 7 additions & 0 deletions include/mscclpp/gpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ using cudaIpcMemHandle_t = hipIpcMemHandle_t;

using CUresult = hipError_t;
using CUdeviceptr = hipDeviceptr_t;
using CUcontext = hipCtx_t;
using CUdevice = hipDevice_t;
using CUmemGenericAllocationHandle = hipMemGenericAllocationHandle_t;
using CUmemAllocationProp = hipMemAllocationProp;
using CUmemAccessDesc = hipMemAccessDesc;
Expand Down Expand Up @@ -115,6 +117,11 @@ constexpr auto CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL = HIP_POINTER_ATTRIBUTE_DEVIC
#define cudaIpcCloseMemHandle(...) hipIpcCloseMemHandle(__VA_ARGS__)

#define cuGetErrorString(...) hipDrvGetErrorString(__VA_ARGS__)
#define cuDeviceGet(...) hipDeviceGet(__VA_ARGS__)
#define cuCtxCreate(...) hipCtxCreate(__VA_ARGS__)
#define cuCtxDestroy(...) hipCtxDestroy(__VA_ARGS__)
#define cuCtxPushCurrent(...) hipCtxPushCurrent(__VA_ARGS__)
#define cuCtxPopCurrent(...) hipCtxPopCurrent(__VA_ARGS__)
#define cuMemAddressReserve(...) hipMemAddressReserve(__VA_ARGS__)
#define cuMemAddressFree(...) hipMemAddressFree(__VA_ARGS__)
#define cuMemGetAddressRange(...) hipMemGetAddressRange(__VA_ARGS__)
Expand Down
19 changes: 16 additions & 3 deletions include/mscclpp/gpu_data_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#ifndef MSCCLPP_GPU_DATA_TYPES_HPP_
#define MSCCLPP_GPU_DATA_TYPES_HPP_

#include <cstdint>
#include <mscclpp/device.hpp>

#if defined(MSCCLPP_DEVICE_HIP)
Expand Down Expand Up @@ -187,7 +188,7 @@ template <int Bytes, bool Enabled = (Bytes >= 4 && Bytes % 4 == 0)>
struct alignas(Bytes) Words {
uint32_t w[Bytes / 4];

MSCCLPP_HOST_DEVICE_INLINE Words() {}
Words() = default;

MSCCLPP_HOST_DEVICE_INLINE uint32_t& operator[](int i) { return w[i]; }

Expand All @@ -210,7 +211,7 @@ union alignas(sizeof(T) * N) VectorTypeImpl {
using ElementType = T;
constexpr static int Size = N;

MSCCLPP_HOST_DEVICE_INLINE VectorTypeImpl() {}
VectorTypeImpl() = default;

MSCCLPP_HOST_DEVICE_INLINE VectorTypeImpl(const StorageT& value) : storage(value) {}

Expand Down Expand Up @@ -686,6 +687,18 @@ MSCCLPP_DEVICE_INLINE To to(const From& v) {
}
}

/// Convert a packed BF16 pair to a packed FP32 pair.
template <>
MSCCLPP_DEVICE_INLINE f32x2 to<f32x2, bf16x2>(const bf16x2& v) {
return __bfloat1622float2(v.storage);
}

/// Convert a packed FP32 pair to a packed BF16 pair using round-to-nearest.
template <>
MSCCLPP_DEVICE_INLINE bf16x2 to<bf16x2, f32x2>(const f32x2& v) {
return __float22bfloat162_rn(v.storage);
}

#if defined(__FP8_TYPES_EXIST__)
template <>
MSCCLPP_DEVICE_INLINE __fp8_e4m3 min(const __fp8_e4m3& a, const __fp8_e4m3& b) {
Expand Down Expand Up @@ -866,7 +879,7 @@ MSCCLPP_DEVICE_INLINE f8_e4m3x2 to<f8_e4m3x2, f32x2>(const f32x2& v) {
uint32_t packed = __builtin_amdgcn_cvt_pk_fp8_f32(v.data[0], v.data[1], 0, false);
return bit_cast<f8_e4m3x2>(static_cast<__hip_fp8x2_storage_t>(packed));
#elif defined(MSCCLPP_DEVICE_CUDA)
__nv_fp8x2_storage_t fp8x2 = __nv_cvt_float2_to_fp8x2(make_float2(v.data[0], v.data[1]), __NV_SATFINITE, __NV_E4M3);
__nv_fp8x2_storage_t fp8x2 = __nv_cvt_float2_to_fp8x2(v.storage, __NV_SATFINITE, __NV_E4M3);
return bit_cast<f8_e4m3x2>(fp8x2);
#else
f8_e4m3x2 result;
Expand Down
25 changes: 25 additions & 0 deletions include/mscclpp/port_channel_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,24 @@ struct BasePortChannelDeviceHandle {
detail::waitFlush(flushDonePos_, pos, maxSpinCount);
}

/// Push an atomic add trigger to the FIFO to perform a remote atomic add on a 64-bit value.
/// Uses type == 0 to indicate an atomic add operation.
/// @param dstId The ID of destination memory region.
/// @param dstOffset The offset into the destination memory region.
/// @param value The 64-bit signed value to atomically add.
MSCCLPP_DEVICE_INLINE void atomicAdd(MemoryId dstId, uint64_t dstOffset, int64_t value) {
ProxyTrigger trigger;
// Encode the full 64-bit add value in fst (size + srcOffset fields).
trigger.fst = static_cast<uint64_t>(value);
// Build snd with dstOffset, dstMemoryId, type=0 (atomic add), semaphoreId.
trigger.snd = 0;
trigger.fields.dstOffset = dstOffset;
trigger.fields.dstMemoryId = dstId;
trigger.fields.type = 0;
trigger.fields.semaphoreId = semaphoreId_;
fifo_.push(trigger);
}

/// Check if the port channel has been signaled.
/// @return true if the port channel has been signaled.
MSCCLPP_DEVICE_INLINE bool poll() { return semaphore_.poll(); }
Expand Down Expand Up @@ -191,6 +209,13 @@ struct PortChannelDeviceHandle : public BasePortChannelDeviceHandle {
MSCCLPP_DEVICE_INLINE void putWithSignalAndFlush(uint64_t offset, uint64_t size) {
putWithSignalAndFlush(offset, offset, size);
}

/// Push an atomic add trigger to the FIFO to perform a remote atomic add on a 64-bit value.
/// @param dstOffset The offset into the destination memory region.
/// @param value The 64-bit signed value to atomically add.
MSCCLPP_DEVICE_INLINE void atomicAdd(uint64_t dstOffset, int64_t value) {
BasePortChannelDeviceHandle::atomicAdd(dst_, dstOffset, value);
}
#endif // defined(MSCCLPP_DEVICE_COMPILE)
};

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ include= ["python/mscclpp/_version.py"]
[tool.scikit-build.cmake.define]
MSCCLPP_BUILD_PYTHON_BINDINGS = "ON"
MSCCLPP_BUILD_TESTS = "OFF"
MSCCLPP_BUILD_EXT_EP = "ON"

[tool.black]
line-length = 120
Expand Down
8 changes: 4 additions & 4 deletions python/csrc/core_py.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,20 @@ void register_core(nb::module_& m) {
void* data = reinterpret_cast<void*>(ptr);
self->send(data, size, peer, tag);
},
nb::arg("data"), nb::arg("size"), nb::arg("peer"), nb::arg("tag"))
nb::arg("data"), nb::arg("size"), nb::arg("peer"), nb::arg("tag"), nb::call_guard<nb::gil_scoped_release>())
.def(
"recv",
[](Bootstrap* self, uintptr_t ptr, size_t size, int peer, int tag) {
void* data = reinterpret_cast<void*>(ptr);
self->recv(data, size, peer, tag);
},
nb::arg("data"), nb::arg("size"), nb::arg("peer"), nb::arg("tag"))
nb::arg("data"), nb::arg("size"), nb::arg("peer"), nb::arg("tag"), nb::call_guard<nb::gil_scoped_release>())
.def("all_gather", &Bootstrap::allGather, nb::arg("allData"), nb::arg("size"))
.def("barrier", &Bootstrap::barrier)
.def("send", static_cast<void (Bootstrap::*)(const std::vector<char>&, int, int)>(&Bootstrap::send),
nb::arg("data"), nb::arg("peer"), nb::arg("tag"))
nb::arg("data"), nb::arg("peer"), nb::arg("tag"), nb::call_guard<nb::gil_scoped_release>())
.def("recv", static_cast<void (Bootstrap::*)(std::vector<char>&, int, int)>(&Bootstrap::recv), nb::arg("data"),
nb::arg("peer"), nb::arg("tag"));
nb::arg("peer"), nb::arg("tag"), nb::call_guard<nb::gil_scoped_release>());

nb::class_<UniqueId>(m, "CppUniqueId")
.def(nb::init<>())
Expand Down
15 changes: 6 additions & 9 deletions python/mscclpp/_core/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
CppTransportFlags,
)
import numpy as np
import pickle

from mscclpp.utils import is_torch_tensor

Expand Down Expand Up @@ -54,14 +53,12 @@ def __init__(
import torch
import torch.distributed as dist

if rank == 0:
uniq_id_global = uniq_id
pickled_data = pickle.dumps(uniq_id)
data_tensor = torch.frombuffer(bytearray(pickled_data), dtype=torch.uint8).clone()
else:
data_tensor = torch.zeros(256, dtype=torch.uint8)
dist.broadcast(data_tensor, group=torch_group, group_src=0)
uniq_id_global = pickle.loads(data_tensor.numpy().tobytes())
backend = str(dist.get_backend(torch_group)).lower()
device = torch.device("cuda", torch.cuda.current_device()) if "nccl" in backend else torch.device("cpu")
object_list = [uniq_id]
group_root = dist.get_global_rank(torch_group, 0)
dist.broadcast_object_list(object_list, src=group_root, group=torch_group, device=device)
uniq_id_global = object_list[0]
self.bootstrap.initialize(uniq_id_global)
elif not interfaceIpPortTrio == "":
assert rank >= 0 and size >= 1
Expand Down
Loading
Loading