# Row all-gather (`row_all_gather`) | ServingStudio Kernel Library

Every GPU of a group receives every GPU's rows.

GPU r contributes per_rank_tokens\[r\] rows of hidden_size elements and every GPU receives all sum(per_rank_tokens) rows in rank order (all-gatherv semantics). A data-parallel group that runs one op sharded over its members (for example a tensor-parallel attention block inside data-parallel attention) gathers its members' inputs this way before the op.

Category: Communication. Interactive page: https://servingstudio.cs.washington.edu/kernels.html?kind=row_all_gather. All kernel kinds: https://servingstudio.cs.washington.edu/kernels.md.

## Formula

- `row bytes = hidden_size · 2 (bf16)`
- `received bytes = max over GPUs of (sum(per_rank_tokens) − own rows) · row bytes`
- `algbw = busbw = max(received bytes, sent bytes) / time`

## How it is measured

N calls captured in one CUDA graph and replayed back to back; CUDA-event time per call on each GPU, the slowest GPU kept. Every shape is first checked bit for bit against a Torch concatenation of the GPUs' rows.

## Caveats

- Each group is measured alone on num_gpus GPUs; in serving, the other groups of the node run their gathers at the same time.

## Arguments

| Argument | Type | Unit | Meaning |
| --- | --- | --- | --- |
| `num_gpus` | number | GPUs | GPUs in the group. |
| `per_rank_tokens` | list | tokens | Rows each GPU contributes, in rank order. |
| `hidden_size` | number | elements | Elements in each row. |
| `dtype` | dtype |  | Element type of the rows; bf16 is measured. |
| `fabric` | label |  | Interconnect label; these backends require nvlink. |

## Metrics

- Time (`time_ms`, ms)
- Algorithm bandwidth (`algbw_gbps`, GB/s)
- Bus bandwidth (`busbw_gbps`, GB/s)
- Energy (`energy_j`, J)

## Backends

- `mnnvl_lamport`: One kernel launch: every GPU stores its rows directly into every peer's landing rows in fabric (MNNVL) memory; each GPU copies the arrived rows out (Lamport-style arrival, one round marker per peer, no separate barrier). dtypes `bf16`, any CUDA GPU. Source: https://github.com/flashinfer-ai/flashinfer/blob/main/include/flashinfer/comm/moe_alltoall_lamport.cuh
- `mnnvl_pull`: One kernel launch, reader side only: every GPU's rows already sit in its own fabric-mapped buffer (the producer wrote them there); after a ready flag per peer, each GPU reads every row from its owner. The producer's write into the mapped buffer is not part of this time. dtypes `bf16`, any CUDA GPU. Source: https://github.com/flashinfer-ai/flashinfer/blob/main/include/flashinfer/comm/moe_alltoall_lamport.cuh

## Measured rows

124 rows in all.

| GPU | Backend | Precision | Rows |
| --- | --- | --- | --- |
| NVIDIA B200 | `mnnvl_lamport` | `bf16` | 62 |
| NVIDIA B200 | `mnnvl_pull` | `bf16` | 62 |

## Used by these deployments

- [GLM-5.3-Flash NVFP4: ServingStudio design: DP attention, KDA TP groups, fused EP MoE, DFlash speculative decoding](https://servingstudio.cs.washington.edu/models/GLM-5.3-Flash-NVFP4/glm53_flash_nvfp4_dp_attn_kda_tp_fused_ep_moe_dflash2.md) (`GLM-5.3-Flash-NVFP4/glm53_flash_nvfp4_dp_attn_kda_tp_fused_ep_moe_dflash2`)

## API

- This kind: https://servingstudio.cs.washington.edu/api/public/v1/kernels/row_all_gather
- Measured rows: https://servingstudio.cs.washington.edu/api/public/v1/kernels/row_all_gather/rows (filter by any column, such as `?gpu=NVIDIA%20H200`; `format=csv` for CSV)
- Configs the public deployments ask of it: https://servingstudio.cs.washington.edu/api/public/v1/kernels/row_all_gather/configs

---

This page as Markdown: https://servingstudio.cs.washington.edu/kernels/row_all_gather.md. A guide to the whole site for AI agents: [llms.txt](https://servingstudio.cs.washington.edu/llms.txt).
