Halving the bytes: a bf16 all-reduce for the MoE combine on PCIe-only RTX 3090s

Two RTX 3090 GPUs without NVLink spend a large share of prefill time in all-reduce. Sending bf16 instead of fp32 in the MoE combine raised throughput at 16 concurrent requests by 16.5%, with a weak quality gate.

Openference Labs3 min readOFL-001

Contents

Two RTX 3090 cards can serve a 26-billion-parameter mixture-of-experts model with tensor parallelism, but they have to talk to each other on every layer. On the rented host we use, that conversation is slow. This post covers one change that reduces how much they say, what it gained, and how little we can yet claim about its cost.

The host has no NVLink bridge, and nvidia-smi topo -p2p r reports that the chipset does not support peer-to-peer between the GPUs. NCCL therefore moves data through host shared memory. In the notebook record for this host (the measurement harness was not archived, so this is not a dataset run), an all-reduce reached roughly 5.1 GB/s of algorithm bandwidth: 12.6 MB in bf16 took 2.45 ms and 25.2 MB in fp32 took 4.85 ms.

Those two numbers are almost exactly proportional to the bytes moved. With bandwidth BB fixed by the link, time is simply

t≈bytesBt \approx \frac{\text{bytes}}{B}

and 12.6 MB at 5.1 GB/s is 2.5 ms. Changing NCCL algorithm, protocol, buffer size or channel count did not help in the notebook record, and more channels was 12% worse. When time is set by bytes, the lever is to move fewer of them.

Where the bytes are

A profile of one 2,048-token prefill pass (notebook record; the raw trace was not archived) put 27.6% of GPU time in the fp32 all-reduce that combines the expert outputs, and another 14.0% in the bf16 all-reduce of the attention output. The combine is the larger share, and it moves fp32 partial sums.

The change

Each rank’s partial sums are cast to bf16 for the all-reduce when more than 512 tokens are in flight, then cast back to fp32. The threshold is the one the engine’s NVLink multicast path already uses. For decode, the all-reduces are tiny, so the change does not apply there and inter-token latency is unchanged.

What it gained

The benchmark below is identical for both servers: random prompts of exactly 512 tokens, exactly 256 generated tokens, closed-loop concurrency, warm server, one run per point.

Experiment E02, concurrency sweep. Host: 2x GeForce RTX 3090 24 GB, PCIe only (no NVLink bridge), rented host A. Method: SGLang serving benchmark, random tokens 512 in / 256 out, closed loop. baseline: fp32 MoE-combine all-reduce. treatment: bf16 MoE-combine all-reduce.Each point is a single run (1 repeat).
ConcurrencyOutput tok/s
baseline
Output tok/s
treatment
Change
treatment vs baseline
Total tok/s
baseline
Total tok/s
treatment
TTFT mean ms
baseline
TTFT mean ms
treatment
ITL mean ms
baseline
ITL mean ms
treatment
Requests
173.073.2+0.3%219.0219.623922012.913.016
4214.4213.8−0.3%643.2641.332532717.617.616
16393.8458.6+16.5%1,181.51,375.83,2981,82428.128.164
64493.5520.4+5.5%1,480.41,561.313,89712,81469.567.1256
MeasuredPreliminaryClick a throughput figure for the full run, its limitations and its raw output.
Equivalence check: Prompt-logprob equivalence gate, 3 fixed prompts. Run details.
MeasureValueUnit
Prompt 1: prompt tokens2,061tokens
Prompt 1: mean absolute prompt-logprob difference0.053nats
Prompt 1: maximum absolute prompt-logprob difference1.444nats
Prompt 1: top-1 token agreement0.980fraction
Prompt 1: perplexity, fp32 combine2.499ppl
Prompt 1: perplexity, bf16 combine2.486ppl
Prompt 1: greedy continuation identical (1 = yes)0bool
Prompt 2: prompt tokens1,794tokens
Prompt 2: mean absolute prompt-logprob difference0.062nats
Prompt 2: maximum absolute prompt-logprob difference1.898nats
Prompt 2: top-1 token agreement0.966fraction
Prompt 2: perplexity, fp32 combine2.240ppl
Prompt 2: perplexity, bf16 combine2.247ppl
Prompt 2: greedy continuation identical (1 = yes)1bool
Prompt 3: prompt tokens607tokens
Prompt 3: mean absolute prompt-logprob difference0.010nats
Prompt 3: maximum absolute prompt-logprob difference0.522nats
Prompt 3: top-1 token agreement1fraction
Prompt 3: perplexity, fp32 combine1.171ppl
Prompt 3: perplexity, bf16 combine1.172ppl
Prompt 3: greedy continuation identical (1 = yes)1bool

At 16 concurrent requests aggregate throughput rose by 16.5% and mean first-token latency fell from 3.3 s to 1.8 s. At 4 requests nothing changed. At 64 the gain was 5.5%, but see the limitation below. On a separate uncached-prefill measurement (notebook record, raw output not archived) prefill throughput rose from about 3.17 to about 3.6 thousand tokens per second.

What we can not say yet

Quality. The only check is a small numerical gate: three fixed texts of about 4.4 thousand prompt tokens run through both servers. Mean absolute prompt-logprob difference was between 0.01 and 0.06 nats and top-1 token agreement between 96.6% and 100%. One of three 48-token greedy continuations differs. Perplexity moved in both directions (2.499 to 2.486, 2.240 to 2.247, 1.171 to 1.172), so it is not a one-way degradation. A repeat of the bf16 server was bit-identical, so these differences are real numerical effects and not noise. That is a weak gate: it does not show the change is free, and a task-level evaluation is on the roadmap.

Large batches. Both servers used the default decode CUDA-graph cap of 48, which a later experiment (E04) showed makes decode at 64 concurrent requests run eagerly. The 64-request result may change when that is fixed; re-running with the cap raised is planned as G01.

Repeats. Each figure is one run. The dataset labels every run here preliminary, and the run pages list what was not recorded about the host.

The patch is part of the Ampere series that will be released under the open-source programme; it is not released yet.