Why Two H100s Gave 1.5× the Output of One with vLLM

The last post ended with one H100 at its limits. This time I added a second one and split the model across both. Each card held half the model’s weights. Both still had to normalize the full hidden state, and twice per layer they had to combine their partial results.

At 64 clients, the pair delivered 1.54 times the output of one card. In a separate profiler capture, a step with 64 requests decoding took 8.86 ms on average on one card and 5.70 ms on the pair. A perfect split would have put it at 4.43 ms. In this post I follow one such step through both cards to find where the extra 1.27 ms went.

GPU · two NVIDIA H100 80 GB in one machine, joined by NVLink

Engine · vLLM 0.31.0, tensor parallel size 2

Model · Qwen/Qwen3-8B, BF16

Workload · 512-token prompt, 256-token output, prefix caching off

Load generator · closed loop, each client keeps one request in flight; 16, 64 and 256 clients

Runs · each card alone; both cards, twice; both cards with two API server processes, once; a short profiler capture after every run except the one with two API server processes

Data · raw data and scripts will be published in a public repository after this series; this post will link to it then

One model, two cards

vLLM can split one model across cards with tensor parallelism. Both cards take part in every layer. Each holds half of every projection matrix and half of the vocabulary tables; the small normalization weights are kept whole on both. Twice in each layer, the cards have to combine what they computed.

Qwen3-8B has 36 layers. Attention in each layer uses 32 query heads and 8 key/value heads. On two cards, each card computes 16 query heads and keeps the cache for 4 key/value heads.

The first projection in the layer is split by heads. Each card can therefore go all the way through attention on its own. The output projection after attention is where that stops. Its weight matrix is split by rows, matching each card’s half of the inputs, so each card produces a partial sum of the full 4,096-value result. The cards have to add their partial sums before the layer can go on.

That addition is an all-reduce. Each card sends its partial result to the other, and both end up with the sum.

The MLP half of the layer works the same way:

  • the first projection is split by columns;
  • the activation runs on each card’s own half;
  • the last projection again leaves each card with a partial sum, so it ends in a second all-reduce.

The normalizations between those steps work on all 4,096 values, so both cards do that work in full. The model’s input and output are split by vocabulary:

  • Before the first layer, each card holds the embeddings for half the vocabulary and fills in zeros for tokens outside its half. One more all-reduce gives both cards the full vector of every token.
  • After the last layer, each card scores its half of the vocabulary and the cards share the scores. Each card then picks the next token from all of them.

That makes 73 all-reduces in each forward pass: one for the input and two in each of the 36 layers. The profiler counted exactly that, on both cards.

For decoding steps like the ones below, vLLM 0.31.0 does not run the all-reduce and the normalization after it as separate kernels. It runs them as one kernel from FlashInfer.

Inside each of the 36 layers the two cards split the weights, compute the normalization in full, and twice add up their partial results.
Inside each of the 36 layers the two cards split the weights, compute the normalization in full, and twice add up their partial results.

The split also changes memory. The weights took 15.27 GiB on one card and 7.64 GiB on each card of the pair. Each card of the pair also stores the cache for only 4 of the 8 key/value heads of every token. The KV cache had room for 392,256 tokens on one card and 888,416 on the pair; most of that gain comes from storing half the heads, and the freed weight memory adds the rest.

The step sets the output

In these runs, output followed the time of one engine step. In a step, each request that is decoding gets one more token. At 16 and 64 clients, the median number of running requests equaled the number of clients on both setups, so a change in step time should show up in output.

Over the steady part of the run at 64 clients, which also includes steps that process new prompts, a step took 11.54 ms on average on one card and 7.37 ms on the pair. Output was 1.54 times one card’s; the step times alone would give 1.57. At 16 clients the steps took 7.87 and 5.07 ms, and output was 1.53 times one card’s, against 1.55 from the step times.

The question is therefore not really about output. It is why a step on the pair took 64% as long as on one card, and not half. vLLM’s documentation notes that a larger tensor parallel size “may cause excessive synchronization overhead”. How much of the gap was in the exchanges, and how much was in the work each card still had to do?

Inside one step

After every run except the one with two API server processes, I started a short extra load at 64 clients and recorded it with the PyTorch profiler that vLLM can switch on. The capture holds every kernel each card ran, with its start and end.

Steps in the capture differ: some process prompts, some only decode. I compared only steps in which 64 requests were decoding and none was in prefill. There were 93 such steps on one card and 90 on the pair.

On one card such a step took 8.86 ms on average. On card 0 of the pair it took 5.70 ms, 64% as long, the same share as in the measured runs.

From one card's decoding step to the pair's: half of it, plus communication and normalization, plus attention and matrix multiplies that did not halve.
From one card's decoding step to the pair's: half of it, plus communication and normalization, plus attention and matrix multiplies that did not halve.

Half of one card’s step would be 4.43 ms. The pair’s step was 1.27 ms longer. Rounded to hundredths, the extra time split like this:

  • 0.59 ms went to communication and normalization;
  • 0.33 ms to attention;
  • 0.24 ms to matrix multiplies;
  • 0.10 ms to everything else.

In these decode steps, attention and matrix multiplies accounted for nearly as much of the gap as communication and normalization combined.

The other card and the repeated run came out within 20 µs of the same total.

The cards were busy for almost the whole step. In the trace, the time with no kernel running was about 0.1 ms per step or less on each card of the pair, and 0.25 ms on one card.

One layer, enlarged. On the pair, the exchange after the previous layer's MLP opens the layer, together with its normalization, and the exchange after attention sits in the middle; the matrix multiplies are shorter than on one card.
One layer, enlarged. On the pair, the exchange after the previous layer's MLP opens the layer, together with its normalization, and the exchange after attention sits in the middle; the matrix multiplies are shorter than on one card.

Seventy-three exchanges per step

In a step with 64 requests, each all-reduce carries 64 tokens × 4,096 values × 2 bytes: 512 KiB from each card. In steps of 33 to 64 tokens, the median call took 7.8 µs, including the normalization that runs inside it. In steps with only a few requests decoding, an all-reduce carries as little as 8 KiB, and the median call still took 4.8 µs. Sixty-four times the data took less than twice as long.

The step needs 73 of them, plus one all-gather of the scores at the end. Together they took 0.68 ms of the pair’s step, 12% of each card’s GPU time. One card had spent 0.17 ms on the normalizations that the pair ran inside its all-reduces. Half of that is already part of the 4.43 ms baseline, which is why communication and normalization add 0.59 ms in the chart above.

nccl-tests, NVIDIA’s benchmark for these operations, shows the same pattern over these sizes on the same two cards. Through NCCL, an all-reduce of anything from 1 KiB to 1 MiB took between 12.9 and 18.3 µs, and 13.7 µs at 512 KiB. By 16 MiB it had risen to 79.6 µs. The benchmark runs under different conditions from the server, with float values and without CUDA graphs. I put the two on one chart for their shape, not to compare the numbers.

Time of one all-reduce against message size: the server's calls next to nccl-tests on the same two cards, under different conditions.
Time of one all-reduce against message size: the server's calls next to nccl-tests on the same two cards, under different conditions.

At these sizes, the time of a call grows far more slowly than its size: most of what a 512 KiB call costs, an 8 KiB call costs too. Splitting the model does not make these messages smaller either. Each card sends its full 4,096-value partial result for every token, and the pair makes 73 such calls in every step.

The two cards start each call at slightly different moments and finish it almost together: the ends of paired calls differ by a median of 0.3 µs. In these steps the differences in start added up to about 60 µs per step, out of about 616 µs in all-reduce kernels.

The next post takes the exchange apart path by path.

Attention did not halve

Each card computes attention for its own 16 query heads, over the cache of its own 4 key/value heads.

The main attention kernel took 64.7 µs per call on one card and 39.1 µs on the pair, 60% as long. Both launches used 132 blocks, on a card with 132 SMs. The profiler records how a kernel was launched, not what happened inside it, so it does not show why the time stopped at 60%.

Two smaller kernels changed little:

  • writing each new token’s keys and values into the cache took 2.4 µs per call on both setups;
  • the attention kernel’s own combine step on each card, not the exchange between cards, took 3.0 µs on one card and 2.8 µs on the pair.

Each runs 36 times per step. On the pair they handled half the data, in about the same time.

Together, attention took 0.33 ms more than half of one card’s.

Matrix multiplies almost halved

Each layer has four projections. Their time per step went from 5.24 ms on one card to 2.87 ms on the pair, 55% as long. The vocabulary projection at the end of the step is one large matrix. It took 431.6 µs on one card and 214.8 µs on the pair, so it halved.

The two projections that shrank least in time were also the two whose launch grids got smaller on the pair: from 128 blocks to 96 and 88, on a card with 132 SMs. The trace does not show whether that is the reason. The appendix has the numbers for each projection.

Together, the matrix multiplies took 0.24 ms more than half of one card’s.

Everything else

The rest nets out at 0.10 ms. It covers activations, sampling, memory copies and small kernels the trace does not name. Both cards pick the next token over the whole vocabulary, so that work is not split.

The API server, and 256 clients

At 256 clients the pair ran into the limit from the last post. With one API server process, the median wait for the first token was 979 ms on the pair, against 267 ms on one card. With the same two cards, a second API server process brought it down to 209 ms and raised output from 1.48 to 1.55 times one card’s. From here on, the pair at 256 clients means the configuration with two API server processes.

There, time per token on the pair was again about 65% of one card’s: 18.5 against 28.6 ms.

At that load, though, steps also carry prompts, and the cards ran at different speeds. The single card ran at 1,515 MHz, held there by its power limit. The pair’s cards ran at about 1,600 and 1,710 MHz; a later post is about why. For that reason I explain the step with the decoding steps of the capture, not with the heaviest load.

What the second card buys

Two cards could also serve two separate copies of the model. I did not run that, but I ran each card alone, with as many clients as the pair had, and I can add the two results up. The pair with two API server processes delivered 75 to 79% of that sum. Its tokens came faster, in 64 to 68% of the time. The two single-card runs served twice as many clients in total, and they did not run at the same time.

The pair with two API server processes produced each token faster; the two single-card runs, added up, had a higher output rate and twice as many clients in total.
The pair with two API server processes produced each token faster; the two single-card runs, added up, had a higher output rate and twice as many clients in total.

With this model and this workload, the second card bought speed per token, and room in the cache: at 256 clients, median KV cache use was 18% on the pair and 41% on one card.

What I changed in how I measure

  • I split a profile by what each step contains before comparing. Counting the same kinds of kernels throughout, the exchange took about 24% and 21% of GPU time on the two cards over the whole capture, and about 12% in steps with 64 requests decoding. Most of the difference came from steps processing prompts. These shares include the time between one card starting a call and the other card reaching it.
  • I compare step times only where both setups have the same number of requests running.

Appendix: How I measured

  • Runs. Each card alone, card 0 twice; two cards, twice; two cards with two API server processes, once. “One card” in this post is card 1 alone; card 0 ran warmer and slightly slower. Every run used 16, 64 and 256 clients, with 16 measured requests per client.

  • Server flags.

    • Every run: --max-num-seqs 1024, --max-num-batched-tokens 2048, prefix caching off.
    • Two cards: --tensor-parallel-size 2.
    • --api-server-count 2 where named.
  • Output and time per token. Output comes from the engine’s generated-token counter over the steady part of each load. Time per output token is the median over requests that finished before the last request was sent.

  • Step time in the measured runs. Seconds over the steady part divided by the number of engine steps, which vLLM counts in its iteration-tokens histogram.

  • Profiler capture. It ran after the measured phase of every run except the one with two API server processes: 64 clients, 2 requests each, 64 output tokens, 512-token prompts. The profiler kept the first 200 engine steps, and 186 of them had GPU work. A step runs from the start of its annotation to the start of the next.

  • Message sizes. The profiler did not record tensor shapes, so message sizes are derived: tokens in the step, after the CUDA graph rounding below, × 4,096 × 2 bytes.

  • CUDA graphs. Steps of up to 512 tokens run inside a CUDA graph, with the token count rounded up to a captured size. Steps with 64 tokens are not rounded.

  • Kinds of work. Each kernel is assigned a kind by its name. The list of every name and its kind will be in the repository.

  • Time per all-reduce call. For each call made by both cards, I take the shorter of the two durations, then the median per group of step sizes. The two cards’ traces share one clock: the ends of paired all-reduce kernels differ by a median of 0.3 µs.

  • Projections, per call, in steps with 64 requests decoding. On one card each of the four projections ran as 128 blocks. On the pair:

    • query, key and value: 96 blocks, from 20.7 to 12.1 µs;
    • output: 88 blocks, from 14.3 to 8.5 µs;
    • MLP up: 128 blocks, from 69.4 to 38.0 µs;
    • MLP down: 128 blocks, from 38.7 to 21.0 µs.

    On one card, the MLP down projection was also followed by a reduction kernel, 2.5 µs per call, which the pair did not run. It is counted with the matrix multiplies, so the four projections alone add up to less than the 5.24 ms in the text.

  • Clocks. The capture has no clock record: the card sampler had stopped before each capture started. In the 64-client measured runs, one card ran at a median 1,980 MHz and each card of the pair at 1,965 MHz.

  • Repeat. The repeated two-card run gave the same decoding step within 0.4%.

  • Code. References are to vLLM v0.31.0:

  • nccl-tests. Version 2.22.0 with NCCL 2.29.7, all_reduce_perf: float values, out-of-place times, 1 warm-up and 20 timed iterations, no CUDA graphs.