[GH-ISSUE #204] Multi-GPU on 2x RTX 3090 (NVLink): the peer expert tier (#110) vs the layer split — measurements #106

Closed
opened 2026-11-04 01:39:59 +07:00 by bsakaguchi · 6 comments
Owner

Originally created by @q8atnight on GitHub (Sep 30, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/204

Follow-up to #110, as asked there ("for the peer tier, let's first compare it with the layer split (--gpus) in
an issue"). Numbers first, no pitch.

The box

2x RTX 3090 24 GB with NVLink, Ryzen 9 3950X (AVX2), 121 GB RAM, Linux. Model: Qwen3.8-Flash-Next GSQ-RCO IQ3_S.
Bench: flashbench (ours), greedy. Prefill = prompt tokens/s at 32K unless a length is given; decode = tokens/s.

The numbers

build prefill 8K / 32K / 64K / 128K decode greedy 1K..128K
0.1.24 stock, one card (quick run) — / 2,007 / — / — 91 (1K) / 89 (32K)
0.1.24 layer split (--gpus, both cards) 835 / 842 / 852 / 855 97 / 98 / 94 / 92 / 87
ours, peer tier on 0.1.24 ("SUPER FAST 2") 2,353 / 2,761 / 2,767 / 2,665 125 / 121 / 115 / 113 / 101
ours, peer tier + fe609ce/F-1/F-2/E-9 ports ("SUPER FAST 2.1", 2026-09-30) 2,422 / 2,830 / 2,830 / 2,724 128 / 119 / 122 / 105 / 107

Sampled decode on SUPER FAST 2: 119 / 121 / 114 / 105 / 100 (1K..128K).

Independent, different box (issue #165: EPYC 7453 AVX2 + 2x3090, v0.1.26, layer split K=24): IQ3_S 749 prefill /
106.3 decode; IQ3_XXS 1,159 / 96.7. So the layer split's prefill cost is not our box alone.

Exactness gate: with #152's env trio (width-invariant CPU experts) two single-GPU runs are identical, and the
dual run equals them on all 3 gate prompts (SUPER FAST 2.1). SUPER FAST 2 was gated before the trio was known:
dual equal to one of two single runs on every prompt (the single reference was not repeatable - #152's cause).

The peer-tier builds also run the vision encoder on the helper card and keep the mid-prompt checkpoints working.

What the peer tier is

The second card holds a second adaptive expert cache (~45 % of the hot experts), computes its experts' rows for
decode windows and prompt chunks over NVLink/P2P, and takes the last 50 % of QSA queries' selection + attention
in prompts.

Our reading of why it beats the layer split here (not profiled on the split side): the split leaves one card idle per stage in decode, and in prefill it
pipelines chunks but both cards stream their missing experts over one shared PCIe root. The peer tier moves
bytes over NVLink instead and keeps both cards doing the same layer.

Open baselines we did NOT measure

docs/SECOND_GPU.md's --gpu1-experts and #151's --vram-experts — honest baselines against the peer tier are
missing; anyone with a 2x3090 box should try them.

The ask

Which parts of this would you accept, and in what shape — e.g. the peer tier as an option beside --gpus
(a second cache tier + P2P rows + the QSA query split), gated by the same exactness method? Happy to split it
the way you prefer.

Originally created by @q8atnight on GitHub (Sep 30, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/204 Follow-up to #110, as asked there ("for the peer tier, let's first compare it with the layer split (`--gpus`) in an issue"). Numbers first, no pitch. ## The box 2x RTX 3090 24 GB with NVLink, Ryzen 9 3950X (AVX2), 121 GB RAM, Linux. Model: Qwen3.8-Flash-Next GSQ-RCO IQ3_S. Bench: flashbench (ours), greedy. Prefill = prompt tokens/s at 32K unless a length is given; decode = tokens/s. ## The numbers | build | prefill 8K / 32K / 64K / 128K | decode greedy 1K..128K | |---|---|---| | 0.1.24 stock, one card (quick run) | — / 2,007 / — / — | 91 (1K) / 89 (32K) | | 0.1.24 layer split (`--gpus`, both cards) | 835 / 842 / 852 / 855 | 97 / 98 / 94 / 92 / 87 | | ours, peer tier on 0.1.24 ("SUPER FAST 2") | 2,353 / 2,761 / 2,767 / 2,665 | 125 / 121 / 115 / 113 / 101 | | ours, peer tier + fe609ce/F-1/F-2/E-9 ports ("SUPER FAST 2.1", 2026-09-30) | 2,422 / 2,830 / 2,830 / 2,724 | 128 / 119 / 122 / 105 / 107 | Sampled decode on SUPER FAST 2: 119 / 121 / 114 / 105 / 100 (1K..128K). Independent, different box (issue #165: EPYC 7453 AVX2 + 2x3090, v0.1.26, layer split K=24): IQ3_S 749 prefill / 106.3 decode; IQ3_XXS 1,159 / 96.7. So the layer split's prefill cost is not our box alone. Exactness gate: with #152's env trio (width-invariant CPU experts) two single-GPU runs are identical, and the dual run equals them on all 3 gate prompts (SUPER FAST 2.1). SUPER FAST 2 was gated before the trio was known: dual equal to one of two single runs on every prompt (the single reference was not repeatable - #152's cause). The peer-tier builds also run the vision encoder on the helper card and keep the mid-prompt checkpoints working. ## What the peer tier is The second card holds a second adaptive expert cache (~45 % of the hot experts), computes its experts' rows for decode windows and prompt chunks over NVLink/P2P, and takes the last 50 % of QSA queries' selection + attention in prompts. Our reading of why it beats the layer split here (not profiled on the split side): the split leaves one card idle per stage in decode, and in prefill it pipelines chunks but both cards stream their missing experts over one shared PCIe root. The peer tier moves bytes over NVLink instead and keeps both cards doing the same layer. ## Open baselines we did NOT measure docs/SECOND_GPU.md's `--gpu1-experts` and #151's `--vram-experts` — honest baselines against the peer tier are missing; anyone with a 2x3090 box should try them. ## The ask Which parts of this would you accept, and in what shape — e.g. the peer tier as an option beside `--gpus` (a second cache tier + P2P rows + the QSA query split), gated by the same exactness method? Happy to split it the way you prefer.
Author
Owner

@Niko1221 commented on GitHub (Sep 30, 2026):

Thanks, the numbers are convincing. It would be accepted as an opt-in beside --gpus, in separate PRs: 1) the second cache tier plus P2P rows, 2) the QSA query split. Each needs to keep the default output byte-identical and pass the exactness method from #152. Please include --gpu1-experts as a baseline.

<!-- gh-comment-id:5908111661 --> @Niko1221 commented on GitHub (Sep 30, 2026): Thanks, the numbers are convincing. It would be accepted as an opt-in beside `--gpus`, in separate PRs: 1) the second cache tier plus P2P rows, 2) the QSA query split. Each needs to keep the default output byte-identical and pass the exactness method from #152. Please include `--gpu1-experts` as a baseline.
Author
Owner

@q8atnight commented on GitHub (Sep 30, 2026):

Great — that's a clear shape to work to. Plan as agreed:

  • PR 1 — second expert-cache tier + P2P rows (--peer-device): the helper card holds an
    adaptive expert tier; its rows come back over NVLink into the pool's mapped rows. Opt-in; default
    path untouched, byte-identical.
  • PR 2 — the QSA query split: the helper computes the last 50 % of the prompt queries'
    selection + attention. Opt-in on top of PR 1; default byte-identical.

Both gated with the width-invariant CPU-expert method from #152 (STRATA_NO_IQ512/256/IQ4NL=1 +
single-vs-multi reference), and the numbers table will include --gpu1-experts as a third baseline
alongside the layer split and the peer tier. Our current 2×3090 IQ3_S figures for reference: peer
tier 2,761 pp / 115–125 tg vs layer split 842 pp / ~106 tg (and #165's independent 749 / 106.3).

Will send PR 1 first.

<!-- gh-comment-id:5910017964 --> @q8atnight commented on GitHub (Sep 30, 2026): Great — that's a clear shape to work to. Plan as agreed: - **PR 1 — second expert-cache tier + P2P rows** (`--peer-device`): the helper card holds an adaptive expert tier; its rows come back over NVLink into the pool's mapped rows. Opt-in; default path untouched, byte-identical. - **PR 2 — the QSA query split**: the helper computes the last 50 % of the prompt queries' selection + attention. Opt-in on top of PR 1; default byte-identical. Both gated with the width-invariant CPU-expert method from #152 (`STRATA_NO_IQ512/256/IQ4NL=1` + single-vs-multi reference), and the numbers table will include `--gpu1-experts` as a third baseline alongside the layer split and the peer tier. Our current 2×3090 IQ3_S figures for reference: peer tier 2,761 pp / 115–125 tg vs layer split 842 pp / ~106 tg (and #165's independent 749 / 106.3). Will send PR 1 first.
Author
Owner

@q8atnight commented on GitHub (Sep 30, 2026):

Part 1 is up as #229 (second cache tier + P2P rows, opt-in via --peer-device), rebased on 0.1.28. Both checks pass with the #152 method: default output byte-identical to 0.1.28, and peer-on byte-identical to single GPU with the same GPU expert set. --gpu1-experts is in the table as asked.

On our 2×3090 (IQ3_S, 32K): single 2,094 pp / 89 tg, --gpu1-experts 1,425 / 86, layer split 936 / 95, peer tier 2,566 / 107.

Part 2 (QSA query split): not submitted for now. On 0.1.28 the prefill attention is the D-1 tensor-core kernel, which the split can't divide mid-chunk, so our split fell back to the older kernel — not byte-identical, and slower than part 1 alone. We might redesign it later around D-1; if we do, it will come as a separate PR.

<!-- gh-comment-id:5910844890 --> @q8atnight commented on GitHub (Sep 30, 2026): Part 1 is up as #229 (second cache tier + P2P rows, opt-in via `--peer-device`), rebased on 0.1.28. Both checks pass with the #152 method: default output byte-identical to 0.1.28, and peer-on byte-identical to single GPU with the same GPU expert set. `--gpu1-experts` is in the table as asked. On our 2×3090 (IQ3_S, 32K): single 2,094 pp / 89 tg, `--gpu1-experts` 1,425 / 86, layer split 936 / 95, peer tier 2,566 / 107. Part 2 (QSA query split): not submitted for now. On 0.1.28 the prefill attention is the D-1 tensor-core kernel, which the split can't divide mid-chunk, so our split fell back to the older kernel — not byte-identical, and slower than part 1 alone. We might redesign it later around D-1; if we do, it will come as a separate PR.
Author
Owner

@Adamyno commented on GitHub (Sep 30, 2026):

2x RTX 2080 Ti 22GB (PCIe P2P, no NVLink) datapoint, on q8atnight's #229 tree (part 1, compiled
for sm_75 — split and peer run side by side there). Same protocol: fixed prompts, temp 0, warm
medians of 3, 256 generated tokens, INT8 KV, resident 32768.

  • 1 card: 13.5k cold 23.5 s, 30.1k cold 46.0 s; warm decode 5.08 / 5.45 s
  • layer split (auto): prefill parity (45.8 s at 30k cold), warm decode 4.68 / 4.85 s (−8-11%)
  • split + 256-expert peer on the x16 card: prefill parity, warm decode 4.50 / 4.68 s
  • the same peer on a x8 Gen3 card: prefill +5% (48.2 s)

The decode gain tracks cache coverage (16.9k of 24,576 pairs resident vs 10.0k on one card).
The auto peer does not start on 22 GB cards without buffer headroom (details in #229). This is
the pre-#216 split on the author's dual-GPU base — happy to rerun the same matrix once #216 and
the #223 follow-up land, on this exact rig.

<!-- gh-comment-id:5912221465 --> @Adamyno commented on GitHub (Sep 30, 2026): 2x RTX 2080 Ti 22GB (PCIe P2P, no NVLink) datapoint, on q8atnight's #229 tree (part 1, compiled for sm_75 — split and peer run side by side there). Same protocol: fixed prompts, temp 0, warm medians of 3, 256 generated tokens, INT8 KV, resident 32768. - 1 card: 13.5k cold 23.5 s, 30.1k cold 46.0 s; warm decode 5.08 / 5.45 s - layer split (auto): prefill parity (45.8 s at 30k cold), warm decode 4.68 / 4.85 s (−8-11%) - split + 256-expert peer on the x16 card: prefill parity, warm decode 4.50 / 4.68 s - the same peer on a x8 Gen3 card: prefill +5% (48.2 s) The decode gain tracks cache coverage (16.9k of 24,576 pairs resident vs 10.0k on one card). The auto peer does not start on 22 GB cards without buffer headroom (details in #229). This is the pre-#216 split on the author's dual-GPU base — happy to rerun the same matrix once #216 and the #223 follow-up land, on this exact rig.
Author
Owner

@Niko1221 commented on GitHub (Sep 30, 2026):

Thanks for the measurements. The peer expert tier continues in #229; closing this one so the discussion stays in one place.

<!-- gh-comment-id:5917492114 --> @Niko1221 commented on GitHub (Sep 30, 2026): Thanks for the measurements. The peer expert tier continues in #229; closing this one so the discussion stays in one place.
Author
Owner

@q8atnight commented on GitHub (Oct 1, 2026):

A heads-up on a follow-up for the peer tier, before it becomes a PR: the prompt path can split every GDN layer's heads across the two GPUs.

What it does (opt-in, STRATA_PF_GDN_SPLIT=1; default off, default path byte-identical)

  • The peer computes q/k heads 8-15 and their 24 v heads. v head h uses q/k head h%16, so splitting by h%16 < 8 vs >= 8 duplicates no q/k work. The primary keeps the other half plus the full ssm_out projection.
  • The peer dequantizes its half of attn_qkv/attn_gate once per layer straight from the primary's VRAM over P2P, so there are no copies of those weights on the peer (~170 MB of peer scratch with 2048-token passes, STRATA_PF_GDN_SUB).
  • It reads/writes the primary's GDN state and conv history in place, so checkpoints and conversation snapshots are untouched. Copies are pipelined on a second peer stream (STRATA_PF_GDN_PIPE). The half kernels use the same per-head arithmetic as the existing ones.

Exactness finding (probably useful beyond this PR)

cuBLAS GemmEx picks a split-K factor per shape, so a product over a row subset of a weight is not bit-identical to the full product. At T=8192, the full attn_qkv (N=10240) runs without split-K while the N=5120 half picks split-K 2; the full attn_gate (N=6144) itself runs split-K 2. A standalone probe showed that every tensor-core kernel with the same split-K factor and reduction scheme gives identical bits, and that cublasLt's first heuristic choice equals GemmEx. Fix: Gemm::f16_exact takes a cublasLt algorithm with the split-K of the full shape's first heuristic.

Result: GDN state hash identical to the unsplit path (8K, and 21K multi-chunk); flashbench gate PASS (chat/code/math vs the single-GPU reference with STRATA_IQ_MT_MIN=1 STRATA_MMQ_NO_STREAMK=1); long gate PASS.

Numbers (2x RTX 3090 + NVLink, Qwen3.8-Flash-Next IQ3_S, same session, vs the same build without the split)

prompt without with split
8K 2,202 t/s 2,337 (+6.2 %)
32K 2,615 2,809 (+7.4 %)
128K 2,696 2,913 (+8.0 %)

Decode is unchanged (~102-104 t/s). Profile at 34K: GDN was 31 % of the prompt GPU time and the helper card idled 68 %; with the split it idles 49 %. The primary still waits ~210 ms per 34K prompt for the peer's half, since its weights come over NVLink.

Code: https://github.com/q8atnight/Strata/tree/preview/gdn-split (commits 90b4df0 + c02c510 on top of our peer-tier tree; src/prefill/prefill.cpp, src/prefill/kernels.cu, src/prefill/gemm.cu, include/strata/prefill/{gemm,kernels}.hpp, CMakeLists.txt links CUDA::cublasLt).

Plan: it depends on the peer tier, so it would follow right after the #229 resubmit on 0.1.31 (part 1) as a separate small PR. Would you prefer it stacked like that, or folded in differently? And should f16_exact also be offered on its own?

<!-- gh-comment-id:5929534606 --> @q8atnight commented on GitHub (Oct 1, 2026): A heads-up on a follow-up for the peer tier, before it becomes a PR: the prompt path can split every GDN layer's heads across the two GPUs. **What it does** (opt-in, `STRATA_PF_GDN_SPLIT=1`; default off, default path byte-identical) - The peer computes q/k heads 8-15 and their 24 v heads. v head h uses q/k head h%16, so splitting by h%16 < 8 vs >= 8 duplicates no q/k work. The primary keeps the other half plus the full `ssm_out` projection. - The peer dequantizes its half of `attn_qkv`/`attn_gate` once per layer straight from the primary's VRAM over P2P, so there are no copies of those weights on the peer (~170 MB of peer scratch with 2048-token passes, `STRATA_PF_GDN_SUB`). - It reads/writes the primary's GDN state and conv history in place, so checkpoints and conversation snapshots are untouched. Copies are pipelined on a second peer stream (`STRATA_PF_GDN_PIPE`). The half kernels use the same per-head arithmetic as the existing ones. **Exactness finding** (probably useful beyond this PR) cuBLAS GemmEx picks a split-K factor per *shape*, so a product over a row subset of a weight is not bit-identical to the full product. At T=8192, the full `attn_qkv` (N=10240) runs without split-K while the N=5120 half picks split-K 2; the full `attn_gate` (N=6144) itself runs split-K 2. A standalone probe showed that every tensor-core kernel with the same split-K factor and reduction scheme gives identical bits, and that cublasLt's first heuristic choice equals GemmEx. Fix: `Gemm::f16_exact` takes a cublasLt algorithm with the split-K of the full shape's first heuristic. Result: GDN state hash identical to the unsplit path (8K, and 21K multi-chunk); flashbench gate PASS (chat/code/math vs the single-GPU reference with `STRATA_IQ_MT_MIN=1 STRATA_MMQ_NO_STREAMK=1`); long gate PASS. **Numbers** (2x RTX 3090 + NVLink, Qwen3.8-Flash-Next IQ3_S, same session, vs the same build without the split) | prompt | without | with split | |---|---|---| | 8K | 2,202 t/s | 2,337 (+6.2 %) | | 32K | 2,615 | 2,809 (+7.4 %) | | 128K | 2,696 | 2,913 (+8.0 %) | Decode is unchanged (~102-104 t/s). Profile at 34K: GDN was 31 % of the prompt GPU time and the helper card idled 68 %; with the split it idles 49 %. The primary still waits ~210 ms per 34K prompt for the peer's half, since its weights come over NVLink. **Code**: https://github.com/q8atnight/Strata/tree/preview/gdn-split (commits 90b4df0 + c02c510 on top of our peer-tier tree; `src/prefill/prefill.cpp`, `src/prefill/kernels.cu`, `src/prefill/gemm.cu`, `include/strata/prefill/{gemm,kernels}.hpp`, `CMakeLists.txt` links `CUDA::cublasLt`). **Plan**: it depends on the peer tier, so it would follow right after the #229 resubmit on 0.1.31 (part 1) as a separate small PR. Would you prefer it stacked like that, or folded in differently? And should `f16_exact` also be offered on its own?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#106
No description provided.