Distributed ML Systems from NVLink to Kernel Fusion
Reading notes on:
On UCCL’s GB300 testbed, a 256 MiB peer copy over NVLink reached about 700 GB/s with 16 of 152 streaming multiprocessors (SMs). On a pair of GH200s linked by 400 Gb/s InfiniBand, a single 4 KiB write in flight delivered 8.96 Gb/s, while a 1 GiB write delivered 387.59 Gb/s. The size of the transfer, the path it takes, and the resources available to issue it all determine how much of a link’s rated bandwidth a workload can use. NVLink bandwidth data · RDMA bandwidth data
DistML follows those bytes from GPU memory through the interconnect to the training or inference operation that needs them. The course currently has five full chapters on GPU communication and 18 chapter outlines. The first section below draws on UCCL’s experiments, code, and linked references. The remaining sections develop the syllabus using the linked material where available and primary papers, implementations, and vendor documentation. Course syllabus
GPU communication · Collectives · Parallelism · Kernel fusion · Accelerators · Worked MoE example
1. GPU communication from the SM to the fabric
NVLink scale-up and peer memory
A scale-up fabric connects accelerators closely enough for fine-grained communication. On GB300 NVL72, a GPU can address peer memory through NVSwitch. Each GPU has 1.8 TB/s of aggregate bidirectional NVLink bandwidth, so the nominal one-way ceiling for a copy is 900 GB/s. Topology changes what that number buys. The eight-GPU MI300X platform has seven direct Infinity Fabric links per GPU. A single peer gets 64 GB/s in one direction, and using all seven peers gets an aggregate 448 GB/s in that direction. A benchmark that talks to one peer and a benchmark that talks to seven measure different properties of that system. DistML on NVLink · GB300 NVL72 · MI300X platform data sheet
Peer access starts with mapping the allocation. Across processes on one host, the owner can export a CUDA IPC handle. The peer imports it and gets a pointer valid in its own address space. The imported pointer addresses the allocation base, so a view into the allocation needs its byte offset as well. Across participating hosts in a rack-scale NVLink fabric, CUDA virtual memory management can export a fabric handle. The importer reserves and maps a virtual address and grants its device access. The handle is exchanged through a control channel, and the kernel moves the tile through the mapped peer address. CUDA interprocess communication · CUDA virtual memory management
Once mapped, a kernel can copy with vectorized loads and stores, use the Tensor Memory Accelerator (TMA) to move tiles between shared memory and peer memory, or use a copy engine for a contiguous buffer. In UCCL’s 256 MiB HBM-to-HBM push, register copies and TMA reached 696.87 and 699.28 GB/s at 16 SMs. At 152 SMs they reached 706.32 and 705.76 GB/s, respectively. The copy engine reached 768.27 GB/s with no copy-kernel SMs. The first 16 SMs bought almost all of the measured kernel-copy bandwidth in this test. The remainder can be allocated to compute, subject to contention for HBM and shared paths. Copy benchmark code · Measurements · Scale-up contention study
The sender must also prove that the payload is ready, and the receiver must prove that the slot can be reused. A system-scope release after writing and a matching acquire before reading establish the first handoff on a supported peer path. Acknowledging after the last read establishes the second. If several threads write the tile, the signal must follow all those writes. If TMA writes it, the signal must follow the appropriate TMA completion. A low-latency alternative packs an epoch beside the data. MSCCL++ LL8 carries four payload bytes and a four-byte epoch. NCCL’s LL128 layout carries 120 data bytes and an eight-byte flag, under the visibility guarantees of its transport path. A sentinel instead reserves a payload value to denote an empty slot. MSCCL++ semaphore · MSCCL++ LL8 packet · NCCL LL128 implementation
| GB300 protocol | Median round trip for 120 B each way | What the receiver observes |
|---|---|---|
| Release/acquire counter | 8.30 µs | One separate counter for the payload |
| LL8 | 3.06 µs | An epoch in each aligned eight-byte packet |
| LL128 | 3.42 µs | A flag beside 120 payload bytes |
| Sentinel | 4.86 µs | A payload value distinct from the empty marker |
UCCL used one warp per GPU and measured ping-pong, including polling and checks and excluding kernel launches. LL8 spends half its packet on flags, a reasonable exchange for a short signal-heavy transfer and a large overhead for bulk data. Synchronization benchmark · Timing data · Every Microsecond Matters
RDMA scale-out and the meaning of completion
With RDMA, a NIC reads and writes registered memory on behalf of the application. GPUDirect RDMA lets compatible NICs DMA GPU buffers directly. A queue pair (QP) has send and receive work queues. The producer posts a work queue element (WQE) describing the verb and its buffers, then rings a doorbell. The NIC executes the request and writes a completion queue entry (CQE) where the operation’s semantics call for one. The application uses the CQE’s work-request ID to match it to its own state. Registered memory uses a local key for NIC access on the local side and a remote key for authorized one-sided access. Linux providers can register GPU memory through a peer-memory module or, where supported, through DMA-BUF. DistML on RDMA · RDMA programming manual · Memory registration API
InfiniBand and RoCE expose verbs through libibverbs on common NICs. RoCE carries RDMA over Ethernet, while InfiniBand uses its own link and fabric protocols. AWS EFA exposes its SRD transport through the EFA provider for libfabric and also offers EFA-specific verbs. These interfaces have similar concepts for posting and completing work. Their ordering, loss recovery, and notification guarantees come from the specific transport and operation. DistML RDMA programming · UCCL’s EFA programming guide
A two-sided send/receive matches a posted receive buffer. A one-sided write targets the remote address supplied by the sender. Write-with-immediate also generates a receive completion with a 32-bit value and consumes a posted receive request. On an appropriate ordered Reliable Connected (RC) path, a sender can issue a payload write followed by an atomic update to a remote counter on the same QP. That protocol depends on the ordering and visibility guarantees of the transport and memory path. MRC permits out-of-order placement and defines separate completion rules. AWS EFA’s GPU-direct backend exposes signals with its own guarantees. DistML on ordering and completion · MRC specification · EFA-GDA guide
Sender completion, receiver GPU visibility, and receiver consumption are three distinct events. A successful signaled RC write completion allows the source buffer to be reused and establishes arrival for ordinary coherent host memory. On a PCIe system, a CPU can see the receive CQE while an already-running GPU kernel still sees stale or partial data. NCCL’s InfiniBand transport has used a local loopback RDMA read or a supported mapped read to flush the receive path before notifying the GPU. When the receiver signals that the tile has been consumed, the sender may reuse the destination slot as well. GPUDirect RDMA memory ordering · NCCL InfiniBand flush path · NCCL receive proxy
In-flight bytes and posting rate set different ceilings. On UCCL’s two GH200s with a 400 Gb/s ConnectX-7 link, one outstanding write reached 8.96 Gb/s at 4 KiB, 158.95 Gb/s at 256 KiB, and 368.26 Gb/s at 4 MiB. In a separate 8-byte write benchmark with a queue depth of 128, signaling every 32nd write raised the median from 4.13 to 4.42 million completed writes/s. Posting 32 writes per call as well raised it to 18.36 million/s. For small messages, a larger transmit window and fewer doorbells per message can matter more than the line rate. At 400 Gb/s, every microsecond of round-trip time corresponds to 50 KB of bandwidth-delay product. Benchmark runner · Bandwidth data · Posting data
The same testbed measured 2.48 µs median and 3.06 µs p99 at eight bytes using half the round-trip time for write-with-immediate. That includes host polling and response posting. A one-way hardware latency or a persistent GPU kernel’s ready-to-consume latency would answer a different question. Latency data · perftest latency code
IBGDA and who posts the work
InfiniBand GPUDirect Async (IBGDA) puts the NIC submission path inside a GPU kernel. The CPU still registers memory, creates and connects queues, and maps hardware resources. At runtime the GPU reserves WQE slots, writes and publishes their descriptors, rings the NIC doorbell, and can wait for completion or use put-with-signal to coordinate with the receiving GPU. A shared QP needs to publish only a contiguous range of ready descriptors because thread B may finish filling a later slot before thread A fills an earlier one. More QPs reduce contention among producers and consume more NIC state. DistML on IBGDA · GPUNetIO architecture · GPUNetIO put-with-signal example
A CPU proxy offers another path. The GPU still chooses the destination, offset, and length from data such as router outputs. It writes a compact command into a mapped FIFO, and a pinned CPU worker posts the verb. The NIC moves the payload directly between GPU buffers. The proxy can batch doorbells, enforce credits and pacing, and adapt the ordering protocol to the transport. UCCL-EP caches FIFO credits on the GPU and spreads producers across proxy channels. KIWI gives producers separate queues to limit shared-index contention. UCCL-EP paper · KIWI paper · UCCL-EP implementation
| Control path on the GH200 testbed | 4 KiB, one write in flight | 16 MiB, one write in flight |
|---|---|---|
| Host libibverbs | 8.96 Gb/s | 385.95 Gb/s |
| Direct GPUNetIO IBGDA | 4.31 Gb/s | 382.27 Gb/s |
| KIWI proxy | 6.72 Gb/s | 384.58 Gb/s |
| UCCL-EP proxy | 5.35 Gb/s | 383.68 Gb/s |
Large transfers on this link approached the same throughput across control paths. In a separate benchmark with 256 producer warps issuing eight-byte writes, direct IBGDA reached 1.08 million writes/s with one shared QP, 20.22 million with one QP per CTA (thread block), and 2.94 million with one QP per posting warp. The UCCL-EP proxy reached 12.71 million with four CPU threads and four QPs. Those configurations use different resources, and GH200’s coherent CPU–GPU link helps its proxy path. The useful comparison is how each command path behaves at the actual transfer size and producer count. Network benchmark data · CUDA benchmark · FIFO data
The FIFO benchmark measures an earlier point on the path. With four workers on GH200, the UCCL-EP-style queue sustained 223.2 million commands/s in the median run. A fast handoff gives the proxy enough work to feed the NIC, and the posting, network, and completion stages still determine end-to-end throughput. FIFO command benchmark · FIFO command data
AWS’s EFA-GDA exposes GPU-initiated requests through NCCL GIN on supported EFA systems. The backend uses NIC counters for weak signals tied to a payload write. Seeing one signal gives the receiver the guarantee for that write. Earlier independent writes can still be in flight. Applications that build a ready queue or aggregate completions must account for that scope. AWS OFI NCCL GIN guide · EFA direct CUDA implementation · NCCL GIN notes
Hardware topology and where traffic crosses a shared path
Within a Hopper node, NVSwitch carries GPU-to-GPU traffic and a GPU reaches its network adapter through PCIe. A PCIe 5 ×16 path supplies about 64 GB/s in one direction before overhead, enough for one 400 Gb/s (50 GB/s) NIC. Two NICs may each run at full rate when their GPU-memory traffic stays within a sufficiently provisioned PCIe switch. If both target CPU memory through the same 64 GB/s uplink, their combined 100 GB/s line rate exceeds the uplink. HGX B300’s ConnectX-8 layout has a faster PCIe 6 GPU-facing path and a PCIe 5 CPU-facing path. The entire path from source to destination determines throughput. DistML on hardware topology · NVIDIA HGX components · GPUDirect supported topologies
Within GB200/GB300 NVL72, 18 compute trays of four GPUs connect to 18 NVSwitch chips and a GPU pair can communicate through one switch hop. The scale-out fabric connects those domains. A two-tier folded Clos is full bisection in the course’s example because each leaf has equal total uplink and downlink capacity. Rails group matching NIC positions across servers. Planes give the same endpoint several separate fabric attachments. OpenAI’s example divides an 800 Gb/s connection into eight 100 Gb/s planes, raising the logical radix per plane. A topology with both rails and planes can exploit locality and path diversity together. NVL72 hardware · OpenAI’s network topology · DeepSeek-V3 hardware notes
Congestion, tail latency, and diagnosis
Collectives can synchronize bursts from many senders. Equal-cost multipath routing (ECMP) may keep two large flows on one uplink while another sits idle. Priority Flow Control (PFC) pauses a priority on a port, so congestion at one receiver can propagate upstream and delay unrelated transfers sharing that queue. A grey failure, such as a NIC or switch that stays up while dropping packets, can show up as a slow rank long before a device reports link-down. DistML on congestion · Meta’s RDMA deployment study · Resilient AI networking with MRC and SRv6
AWS EFA’s SRD and OpenAI’s MRC use multiple paths. MRC sprays packets, places reordered payload directly into memory, and selectively retransmits missing packets. With SRv6, the sender can change paths without a fabric-wide routing update. UCCL-Tran implements transport control on the CPU over existing RDMA NICs, splitting transfers across QPs and using feedback to select paths and limit outstanding traffic. These designs address collisions in the fabric. Incast still needs pacing, credits, or less skewed placement because all those paths converge on one destination’s NIC and memory path. AWS on SRD · MRC specification · UCCL-Tran paper
Start diagnosis with isolated and concurrent GPU pairs, local and cross-leaf paths, and the actual collective at its payload size. A slow isolated pair points toward its GPU–NIC path or link health. A slowdown under concurrency calls for checking shared paths and receiver capacity. On RoCE, correlate PFC pause duration and direction with throughput, ECN marks, drops, and link errors. Inspect the chosen transport, path, and NICs with NCCL’s INIT,NET,GRAPH debug subsystems. Changing rail selection, QP count, or chunk size has a measurable effect only in the context of the topology and workload being tested. On NVLink, address-to-lane mapping and receiver contention can also produce stragglers. UCCL’s NCCL debugging guide · mlx5 counters · NCCL environment variables · Scale-up networking study
2. Collective communication expresses who gets the result
Primitives and algorithms
A collective describes the input and output on each rank, usually a process associated with one accelerator. A schedule then maps that operation onto links, buffers, and synchronization steps. The ranks must agree on the communicator and compatible calls, including counts, types, and buffer layout. If two ranks issue their collectives in a different order, a mismatch can look like a network hang. NCCL collective operations
| Primitive | Result | Typical use |
|---|---|---|
| Broadcast | Every rank gets the root’s tensor | Share initial state |
| Reduce | The root gets the elementwise reduction of all inputs | Aggregate statistics at one rank |
| All-reduce | Every rank gets the full reduced tensor | Synchronize replicated gradients |
| All-gather | Every rank gets the rank-ordered concatenation of the input shards | Materialize a sharded weight group |
| Reduce-scatter | Each rank gets one shard of the reduced tensor | Return synchronized gradients to their shard owners |
| All-to-all | Each rank sends a distinct piece to each destination | Send tokens to expert owners |
| Gather / scatter | A root collects distinct shards or distributes them | Assemble or distribute rank-specific state |
For a ring all-reduce over $p$ ranks with $n$ bytes of input per rank, split the tensor into $p$ chunks. In reduce-scatter, each rank forwards and accumulates chunks with its neighbor for $p-1$ steps. It ends with one fully reduced chunk. In all-gather, another $p-1$ steps circulate the reduced chunks. Each rank sends and receives $2(p-1)n/p$ bytes, counting each direction separately. With one startup cost $\alpha$ per round and effective per-direction bandwidth $B$, the idealized time is
\[T_{\mathrm{ring}} \approx 2(p-1)\alpha + \frac{2(p-1)n}{pB}.\]The model leaves out per-chunk reductions, shared-link bottlenecks, and overlap. A tree can reduce and distribute in logarithmically many stages, which helps when startup dominates. Its bandwidth depends on tree construction, chunking, and the links used. NCCL’s double binary trees split traffic across complementary trees to balance load. A hierarchical schedule can reduce locally over NVLink, exchange across nodes, and distribute locally again. For all-to-all, a pairwise exchange visits each peer in rounds to limit concurrent fan-out. Real MoE batches have irregular message sizes, so a few racks or ranks can carry most of the load. NCCL on double binary trees · NCCL tests bandwidth definitions · TPU and GPU collectives notes
NCCL and DeepEP
An NCCL communicator binds a set of ranks and the resources they use. A collective enqueued on a CUDA stream runs with that stream’s dependencies. NCCL chooses schedules, channels, transports, and protocols according to the operation, topology, and message. Rings and trees specify transfers between ranks. Local peer access, InfiniBand or network plugins, and hardware-assisted paths such as NVLink SHARP carry or perform those transfers. Protocols such as Simple, LL, and LL128 trade payload efficiency for different startup and synchronization costs. For an all-reduce, nccl-tests reports algorithm bandwidth as $n/t$ and normalized bus bandwidth as $(n/t)\,2(p-1)/p$. The latter is a comparison convention, so the NIC and NVLink counters are still needed to see which physical paths carried the bytes. NCCL communicator documentation · NCCL environment variables and protocols · nccl-tests performance model
DeepEP specializes communication for mixture-of-experts (MoE) layers. Dispatch sends tokens and routing metadata to ranks that own selected experts. The destination groups work for expert GEMMs. Combine returns the outputs and restores token order, applying the routing weights where the implementation expects them. Several experts for a token can live on the same rank, so transport and packing can sometimes share the transfer. The DeepSeek-V3 design also exploits cheap intra-node NVLink forwarding after an expensive inter-node transfer. Large training or prefill batches benefit from bandwidth and aggregation. Decode has smaller, irregular batches and exposes dispatch and combine startup on the critical path. Check the DeepEP version and backend when applying those observations. The repository documents the original NVSHMEM-based internode design and a V2 backend based on NCCL Gin. DeepEP repository · DeepSeek-V3 technical report · MoE training handbook notes
Fault tolerance across three layers
A stalled collective can reflect a slow network path, a failed rank, or a mismatch in the operations ranks entered. NCCL’s Reliability, Availability, and Serviceability (RAS) subsystem reports job status and can help identify missing or stalled ranks. Recovery starts by stopping the affected communicator consistently and resolving its in-flight work. NCCL provides abort and, in supported versions, communicator shrink and grow APIs. Those APIs handle membership and communication resources. The training runtime must also reconstruct model and optimizer shards, agree on a step boundary, and restore data and RNG state as appropriate. A network path failover, a communicator rebuild, and a training checkpoint solve problems at different layers. Meta’s Prometheus configuration illustrates the distinction. It runs training on 64 GPUs in a 72-GPU domain, with eight available to replace failed GPUs before a checkpoint restart. NCCL RAS · Communicator abort and membership changes · PyTorch Distributed Checkpoint · Meta Prometheus
3. Parallelism decides which tensor has to move
| Parallelism | What each rank owns | Communication that can limit the step |
|---|---|---|
| Data parallelism (DP) | Different training examples | Gradient all-reduces, or parameter all-gathers and gradient reduce-scatters with sharding |
| Tensor parallelism (TP) | A slice of an operator’s weights or activations | Frequent reductions or gathers inside layers |
| Expert parallelism (EP) | A subset of the experts | Dynamic token dispatch and combine |
| Context parallelism (CP) | A slice of the input sequence | Exchange of keys, values, and their gradients for attention |
| Pipeline parallelism (PP) | A stage of consecutive layers | Activations and their gradients at stage boundaries |
Data parallelism and state sharding
In ordinary distributed data parallelism, each replica runs forward and backward on its own examples. As gradients become available, PyTorch DDP all-reduces buckets so communication can overlap with the rest of backward. Small buckets can start earlier and pay more collective startups. Large buckets can wait on the last gradient they contain. An optimizer step uses synchronized gradients, so all replicas advance together. PyTorch DDP design
ZeRO progressively shards optimizer state (stage 1), gradients (stage 2), and parameters (stage 3). With PyTorch FSDP2, parameter groups are materialized with all-gather before use. The runtime can reshard after forward to save memory, then gather again before backward. Gradients are reduce-scattered to their owners, and optimizer updates run on local shards. The forward gather, backward gather, and backward reduce-scatter have their own dependencies. More aggressive prefetch can hide part of that time at the cost of temporarily holding more gathered weights. ZeRO paper · PyTorch FSDP2 grouping and scheduling
Tensor parallelism and where to reduce
For a transformer MLP, write its first linear layer as $XW$. Split the columns of $W$ so that each rank produces a different slice of intermediate features. A pointwise activation can run on each slice independently. Shard the rows of the next weight matrix along that same intermediate dimension. Each rank then produces a partial sum of the output, and one reduction combines the results. This pairing lets the activation stay sharded between the two layers. Megatron uses analogous partitioning for attention projections and their output. As TP increases, local GEMMs shrink and the collectives still recur inside each layer, making TP a good candidate for the fastest local fabric. Megatron-LM parallelism paper · GPU scaling notes
Megatron’s sequence parallelism (SP) keeps activations sharded across tokens in operations such as layer normalization and dropout. It can factor a TP all-reduce into a reduce-scatter before the sequence-sharded region and an all-gather when the next operation needs the whole activation. The communication then changes layout as well as synchronizing values. Sequence parallelism and activation recomputation
Expert parallelism and who becomes the straggler
EP maps the router’s top-k expert IDs to owner ranks. Each rank packs tokens and exchanges them with those owners, runs its local expert GEMMs, and returns results. Expert placement determines peer and rack traffic. Load balance determines the largest destination buffer and how much work the last expert finishes. One hot expert can delay the entire layer even when average NIC utilization and mean tokens per expert look healthy. Replicating hot experts gives the runtime more freedom over placement and adds weight storage and coordination work. Hierarchical routing, placement, and dispatch are ways to reduce inter-node fan-out. DeepEP · Megatron Core MoE guide · Rack-scale expert load balancing notes
A single cluster can install different rank groupings for attention and experts. Megatron’s parallel folding uses an attention mesh built around TP and CP and can re-factor those same ranks into an MoE mesh with a larger EP group. This preserves freedom to size the local GEMMs and to place expert exchanges on appropriate links. When reading a distributed configuration, identify the groups used by each operation before multiplying the parallelism degrees. Megatron MoE parallel folding · MoE parallel folding notes
Context parallelism and exact attention across ranks
In context parallelism, each rank holds the queries, keys, and values for a chunk of the sequence. A local query can attend to keys in other chunks, so ranks must exchange KV or an equivalent attention representation. A ring can circulate KV blocks while each rank computes scores for its local queries and updates the running softmax statistics and output. The process gives exact attention in real arithmetic without materializing the entire score matrix or every KV block on each rank at once. The same modeling dependency remains across ranks, and both causal work imbalance and backward communication matter. SP saves activation memory around TP operations. CP divides the attention context itself. Ring Attention · Megatron context parallelism · Sequence parallelism for video training
Pipeline parallelism and the cost of filling the pipeline
Each PP stage runs a block of layers and sends activations forward and activation gradients backward. Microbatches let successive stages work concurrently. For GPipe with $s$ balanced stages and $m$ equal microbatches, the ideal useful-time fraction is $m/(m+s-1)$, ignoring transfer costs and assuming equal stage times within each pass. With eight stages and 32 microbatches it is 32/39, or about 82%. Four microbatches give 4/11, or about 36%. Stage imbalance, communication, and smaller per-microbatch GEMMs can lower the useful fraction. GPipe paper · Megatron-LM pipeline schedules
A 1F1B schedule alternates forward and backward after warm-up, which lets earlier stages free activations sooner than an all-forward, all-backward schedule. Interleaving assigns several virtual stages to each rank to shrink idle intervals and adds communication boundaries. Zero Bubble separates backward work for input gradients, which unblock the previous stage, from weight gradients, which can fill gaps. Closing those gaps depends on the duration and placement of the work. Zero Bubble Pipeline Parallelism · Zero Bubble notes
For a concrete placement, 64 ranks can be arranged as four data replicas, two pipeline stages, and eight ranks per stage (TP 4 × CP 2). On eight eight-GPU NVSwitch servers, one possible starting point is one stage of one replica per server. That keeps the frequent TP exchanges and CP KV movement on each server’s scale-up links, while corresponding shards use scale-out links for gradient sync and stage boundaries. An MoE block can regroup the ranks for EP. Its useful placement depends on the measured per-destination token counts, even when the dense-layer groups fit within a server. Megatron-LM parallelism · Megatron MoE guide
4. Kernel fusion puts communication on the compute schedule
Two-batch overlap and tile-level overlap
Two-batch overlap schedules ready work from one microbatch while another is waiting on communication. In an MoE serving layer, attention for batch B can run while A dispatches tokens to expert ranks. Dispatch for A still has to precede A’s expert GEMM, and combine still has to follow it. SGLang expresses this as interleaved stages with explicit yield points. The gain comes from independent work that fits inside an exposed communication interval. Very small sub-batches can weaken their GEMMs or leave too little work to fill that interval. SGLang EP and two-batch overlap
Tile-level overlap changes the size of the dependency. A remote tile can enter the next GEMM as soon as the receiver sees its ready flag. In the opposite direction, a GEMM can hand off a finished output tile for reduction or transfer while other tiles are still running. FLUX overlaps communication and GEMMs this way in tensor parallelism. DeepGEMM’s MegaMoE and Mixture-of-Kittens apply similar producer–consumer scheduling to MoE. UCCL’s mKernel explores fused operators across nodes as well as within them. FLUX paper · DeepGEMM · mKernel · Mixture-of-Kittens notes
For $k$ equally sized tiles with transfer time $t_c$ and compute time $t_g$ per tile, an ideal two-stage pipeline takes
\[t_c + t_g + (k-1)\max(t_c,t_g).\]This assumes independent resources, sufficient buffering, and negligible per-tile synchronization. Making tiles smaller can start compute earlier, but more messages, flags, and smaller GEMMs can increase both stage times. If the transport and the kernel share HBM or SMs, repeated overlap can make each tile slower. The relevant result is the wall time of the fused operator or step. FLUX paper · Understanding Contention in GPU Scale-Up Domains
Signaling and buffer ownership
A tile buffer cycles through four states. The producer acquires an available slot, writes or transfers its payload, and publishes its epoch after the required completion and ordering. The consumer acquires readiness, reads the tile, and returns credit after its last use. The epoch distinguishes generations when the same slot is recycled. Two slots permit the producer to fill one while the consumer reads the other. A slower consumer eventually exhausts credits and applies backpressure. Registering or peer-mapping a longer-lived buffer amortizes setup, and the registration must outlive every operation that references it. MSCCL++ semaphores · DistML buffer management outline
NVLink SHARP (NVLS) can help with group signaling. CUDA’s multicast barrier example binds memory on participating devices to a multicast address. A multicast increment updates each participant’s backing counter. Each device can wait on its local counter for the expected arrivals. A barrier implementation still needs the correct scope and ordering for the payload it protects. A per-tile ready flag can give a consumer earlier progress when it needs just one peer’s tile. DistML signaling outline · CUDA multicast barrier example
SM and warp scheduling
With SM specialization, different groups of SMs handle transfer and compute. With warp specialization, producer and consumer warps in the same thread block can share tiles in scratchpad memory, subject to the block’s combined register and shared-memory budget. Persistent kernels need a progress guarantee. A grid of waiting consumers can occupy every resident slot and prevent the producers that release them from running. Dedicated producer roles or a schedule with provable residency can avoid that dependency cycle. ParallelKittens notes · UCCL mKernel
UCCL’s 16-SM GB300 copy result is a starting point for a resource sweep. It used an isolated, contiguous 256 MiB buffer. In a fused operator, remote reads can compete with attention for HBM, and packing or polling can occupy resources that the GEMMs need. Compare serialized compute and communication, batch overlap, then tile overlap using the same inputs. Record operator time, per-rank tail latency, and memory use alongside link throughput. UCCL NVLink benchmark · Scale-up contention measurements · CuTe layouts and tile mapping
5. Accelerator interconnects place the boundary in different places
Google TPU
Cloud TPU uses an inter-chip interconnect (ICI) within a slice and the data-center network (DCN) between slices. On TPU v4, v5p, and TPU7x, optical circuit switches connect the boundary links of 4 × 4 × 4 cubes into larger 3D or twisted 3D torus topologies. Logical mesh axes therefore matter to collective placement. When sharding extends over slices, some of those axes communicate through DCN. With JAX, a device mesh and sharding specification express the layout, and explicit operations such as lax.psum and lax.ppermute expose the intended collective or neighbor exchange when needed. Cloud TPU architecture · TPU v4 paper · JAX shard_map guide
AWS Trainium
Trainium2 connects 16 chips in one Trn2 instance with NeuronLink-v3 in a 2D torus. A 64-chip Trn2 UltraServer connects four instances over NeuronLink. Chips with corresponding coordinates across instances form additional rings. Dedicated collective-communication cores orchestrate movement within and between chips. Across scale-up groups, AWS uses EFA. The advertised 3.2 Tb/s per Trn2 instance and 12.8 Tb/s per UltraServer are aggregate EFA network rates for those systems. NeuronLink has its own chip-to-chip specification. AWS Trn2 product documentation · Trn2 physical topology · Neuron collective communication
Meta MTIA and Microsoft Maia
MTIA 300 integrates two network chiplets with six 800 Gb/s RDMA NICs each. Meta describes one allocation of those twelve NICs that supplies up to 1 TB/s inside a 16-node rack and 200 GB/s across racks. Dedicated message engines handle transport and near-memory reductions alongside the compute grid. The HCCL runtime chooses schedules for the asymmetric fabric and can trigger offloaded communication from device work. This design makes the NIC and reduction engines part of the accelerator’s resource budget. Meta MTIA 300 architecture
Maia 200 uses a custom transport over Ethernet and an integrated NIC. Four devices are directly connected inside a tray, and a two-tier network extends scale-up across racks. Microsoft reports 2.8 TB/s of dedicated bidirectional scale-up bandwidth per accelerator and collective support in clusters of up to 6,144 accelerators. That published number describes per-device aggregate capacity. It is a different measurement from an isolated device-pair copy or a p99 all-to-all at a given token count. Microsoft Maia 200 system architecture
For a cross-system comparison, pin down the direction, aggregation level, distance crossed, and operation. Report one-way application bytes per second for a pair, then actual collective time at the relevant group size and payload. Vary local versus cross-domain placement and measure concurrency with compute. A per-chip ICI rate, per-instance EFA rate, and bidirectional Ethernet scale-up rate each describe a different part of the system. Cloud TPU architecture · AWS Trn2 · Maia 200
6. Following one MoE batch through the stack
Suppose one rank routes 4,096 tokens, each with a hidden width of 7,168 in BF16, to eight experts per token. Assume 75% of the token-to-expert assignments cross the source’s scale-out link and that the system sends a full activation for each assignment. The rank has to send 336 MiB at dispatch. A single 400 Gb/s (50 GB/s) egress link needs at least 7.05 ms for that payload. The estimate excludes metadata, combine, and overlap. It measures wire demand at the source under those assumptions. The most heavily loaded destination could set a higher bound. DeepSeek-V3 dispatch design · DistML RDMA measurements
- Count the transfers that cross the expensive boundary. If several of a token’s experts live in one remote domain, a hierarchical implementation can send the token there once and fan it out over scale-up. With FP8 dispatch, the activation values in this example take half as many bytes, plus scales and metadata. Measure bytes per NIC and per destination, and include the combine format in a separate calculation. DeepSeek-V3 hardware analysis · DeepEP
- Compare bytes per second and operations per second. At 400 Gb/s, a stream of 7 KB payloads needs about 7.14 million writes/s to reach line rate. If each write has a separate signal verb, the issue rate required is about 14.29 million verbs/s. Aggregating payloads or signals changes the calculation. The IBGDA experiment shows why a queue configuration can limit a workload that looks fine in a large-buffer test. DistML on IBGDA posting rates
- Check when each expert can start and when the layer can finish. Trace the last payload needed for each expert tile, the matching signal and acquire, and the time the last combine reaches its consumer. Compare even and skewed routing under the same offered load. This separates delays from network contention, expert compute imbalance, and late handoffs in the fused kernel. UCCL-EP paper · DeepSeek-V4 overlap notes
The same accounting works for a gradient bucket or a block of attention KV. Start with which rank owns the tensor, which rank needs it next, and what event lets that rank proceed. Then measure the slowest dependency in the real schedule. A faster fabric helps when bytes are the limit. A different rank layout, posting path, or tile schedule helps when the dependency sits elsewhere.
The 23 DistML chapters
| Part | Chapters |
|---|---|
| GPU communication | NVLink Scale-Up · RDMA Scale-Out · IBGDA · Hardware Topology · Congestion |
| Collective communication | Collective Primitives · Collective Algorithms · NCCL · DeepEP · Fault Tolerance |
| ML parallelism | Data Parallelism · Tensor Parallelism · Expert Parallelism · Context Parallelism · Pipeline Parallelism |
| Kernel fusion | Two-Batch Overlapping · Tile-Level Overlapping · Signaling · Buffer Management · SM Scheduling |
| Accelerator interconnect | TPU · Trainium · MTIA & Maia |