Qiming Bao · Blog · 2 December 2026 · English / 中文 · views Follow @14H034160212

Two days inside MSCCL++ on an A100: 5x allgather, 2.4x allreduce, and a deadlock that needs fewer than 128 SMs

MSCCL++ is Microsoft's GPU communication library. One way to use it is as a drop-in NCCL replacement: preload libmscclpp_nccl.so and every ncclAllReduce or ncclAllGather goes to MSCCL++ algorithms, with real NCCL as the fallback. Most of its tuning targets H100 and Blackwell. I ran it on two A100-SXM4-80GB GPUs connected by NVLink, compared it with NCCL 2.29 using NVIDIA's nccl-tests, and followed every number that looked wrong. That produced seven pull requests, all in review at the time of writing.

Results

changebeforeafterPR
allgather, 1 MB total, no CUDA graph143 µs (NCCL: 20 µs)27 µs#990
allreduce, 2 MB, CUDA graph50 µs (NCCL: 45 µs)19 µs#993
allreduce, 16 MB, CUDA graph127 µs (NCCL: 124 µs)84 µs#993
allreduce ≥ 64 MB, uint8 minhangscompletes#992
100k allreduce calls+420 MB GPU, +870 MB host per rankflat#986

bf16, 2 ranks, medians of 3 interleaved rounds of 500–1000 iterations, 0 wrong values. Every run was checked for other processes on the GPUs and repeated if any appeared (the machine is shared).

1. A fixed 135 µs in every small allgather

By default, the shim runs without "symmetric memory". The user's buffers can then change from call to call, so the default allgather algorithm (fullmesh2, zero-copy) registers both buffers and exchanges their IPC handles with every peer over the bootstrap network on every call. That puts a floor of about 135 µs under every allgather up to 32 MB, whatever the size: 8 KB and 8 MB took about the same time.

The library already had a second allgather, fullmesh, which stages data through a buffer that is registered once. Selecting it for non-graph calls up to 16 MB gave 5.0–5.5x from 8 KB to 1 MB and 2.4x at 8 MB. Two details mattered more than the switch itself:

2. Fast allreduce algorithms that A100 never used

On GPUs without NVLS (A100, and most PCIe GPUs), the selector handed every allreduce above 1 MB to NCCL. Forcing each candidate algorithm with a small experiment switch showed that the algorithms Blackwell already uses are faster here too:

sizeNCCL, graphrsag_zero_copy, graphNCCL, no graphrsag / rsag_pipeline, no graph
2 MB45 µs19 µs59 µs41 µs
8 MB79 µs47 µs87 µs69 µs
32 MB224 µs158 µs220 µs201 µs
256 MB1492 µs1204 µs1429 µs1436 µs (left to NCCL)

#993 selects them on non-NVLS GPUs, with only rank-uniform conditions: size divisible into whole 16-byte vectors per rank, a supported rank count, and at most 16 ranks for the pipeline variant, whose stage must fit the 128 MB scratch buffer. Copilot raised all three of those during review, and each was a real out-of-bounds or invalid-configuration case.

3. A deadlock that needs fewer than 128 SMs

Testing #993 across data types, uint8 min at 64 MB hung. Sum at the same size was fine, and so was min at 48 MB. The zero-copy kernel synchronizes all of its blocks with a grid-wide barrier, so every block must be resident at once. From 64 MB up it launches 128 blocks of 1024 threads. cuobjdump --dump-resource-usage explained the rest:

H100 (132 SMs) and B200 (148 SMs) hold 128 blocks even at one per SM, which is why this had not been seen. The fix in #992 caps the grid with cudaOccupancyMaxActiveBlocksPerMultiprocessor. Copilot added one more requirement: the cap must be the same on every rank, because block i pairs with block i on each peer. The ranks now agree on the smallest SM count during initialization.

4. Leaks and silently wrong results

What I would do again

Caveats

Everything above was measured with 2 ranks on one pair of NVLink-connected A100s. Thresholds may move with 4 or 8 ranks, and PCIe-only GPUs are untested. Allreduce on buffers that are not 16-byte aligned is still an open question for the native paths (main already fails at ≤ 1 MB), and I asked the maintainers how they would like it handled. All seven PRs were still under review when this was written.

I used Claude (Anthropic) to help investigate, write the patches and draft this post. I ran and checked the measurements myself.