mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#106
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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) inan 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
--gpus, both cards)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-expertsand #151's--vram-experts— honest baselines against the peer tier aremissing; 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.
@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-expertsas a baseline.@q8atnight commented on GitHub (Sep 30, 2026):
Great — that's a clear shape to work to. Plan as agreed:
--peer-device): the helper card holds anadaptive expert tier; its rows come back over NVLink into the pool's mapped rows. Opt-in; default
path untouched, byte-identical.
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-expertsas a third baselinealongside 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.
@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-expertsis in the table as asked.On our 2×3090 (IQ3_S, 32K): single 2,094 pp / 89 tg,
--gpu1-experts1,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.
@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.
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.
@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.
@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)ssm_outprojection.attn_qkv/attn_gateonce 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).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 fullattn_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_exacttakes 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)
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.txtlinksCUDA::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_exactalso be offered on its own?