mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #110] [CLOSED] Multi-GPU: a second GPU as an expert tier for decode and prompts (--peer-device), + multi-conversation cache #2463
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#2463
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/110
Author: @q8atnight
Created: 9/29/2026
Status: ❌ Closed
Base:
main← Head:pr/multi-gpu📝 Commits (1)
1cac43eMulti-GPU support (--peer-device): the second GPU as an expert tier for decode and a share of every prompt chunk; plus --expert-cache-fill-all, --ple-io ram, --conv-cache (multi-conversation cache), async prompt checkpoints, and the prefill/decode kernel speed-ups📊 Changes
31 files changed (+2591 additions, -54 deletions)
View changed files
📝
CMakeLists.txt(+1 -1)📝
include/strata/core/expert_source.hpp(+5 -0)➕
include/strata/core/peer_experts.hpp(+96 -0)📝
include/strata/core/verify.hpp(+15 -0)📝
include/strata/kernels/bf16_gemv.hpp(+4 -0)📝
include/strata/kernels/elementwise.hpp(+4 -0)📝
include/strata/kernels/fused_gr.hpp(+2 -1)📝
include/strata/kernels/native_moe.hpp(+3 -0)📝
include/strata/kernels/native_qsa_indexer.hpp(+6 -0)📝
include/strata/kernels/native_router.hpp(+2 -0)📝
include/strata/kernels/ngram.hpp(+3 -0)📝
include/strata/kernels/verify_kernels.hpp(+2 -0)📝
include/strata/prefill/kernels.hpp(+5 -2)📝
include/strata/prefill/prefill.hpp(+7 -0)📝
serve/server.py(+4 -0)📝
src/core/expert_source.cpp(+29 -3)📝
src/core/mtp.cpp(+2 -2)➕
src/core/peer_experts.cpp(+303 -0)📝
src/core/verify.cpp(+197 -10)📝
src/kernels/cuda/elementwise.cu(+31 -0)...and 11 more files
📄 Description
What
Two-GPU support (closes #36), tested on 2x RTX 3090 with NVLink (P2P also works over PCIe, slower). The second card
is an expert tier, not a pipeline stage - the model's dense part stays on the primary, so the output is
bit-identical to a single card holding the same experts (see Exactness):
--peer-device N(+--peer-reserve-mib,--peer-slots,--peer-adapt-swaps): a second adaptive expert cacheon the other GPU. Decode: the pool launches the peer's share right after publishing the primary's plan; its rows come
back through the same mapped rows. Prompts: per MoE layer the peer computes the rows of the experts it holds
(activations in over P2P, results back group by group), streams a share of the primary's non-resident experts over
its own PCIe link (
STRATA_PF_PEER_STREAM, default 0.35), and does the selection + attention of the last halfof each chunk's queries in QSA layers. Group-sized (compact) peer buffers keep it at ~0.26 GB on the helper card.
--expert-cache-fill-all: auto sizing fills the whole card past the ranked profile pairs--ple-io ram: the n-gram table mmap'd + mlock'ed (no O_DIRECT SSD reads on the prompt/token path)--conv-cache N(+-gib,-min): up to N conversations another request displaced keep their positional cells(KV host copy, pooled indexer keys, drafter K/V) + checkpoints in RAM; switching back reads only the new part
(a 111K chat back in ~1 s instead of ~64 s). Complements #62 (which keeps the shared prefix of ONE branch).
device sync + pageable copies (~370 ms of GPU idle each)
visionblock may carryenv(e.g.CUDA_VISIBLE_DEVICES=0puts the image encoder on the helper card)STRATA_PREFILL_TIMINGnow also prints the peer GPU's own timelineMeasured (flashbench 1.0, IQ3_S, 262K context, tokens/s, median)
With Q2_0 / IQ2_XS all 24,576 experts fit on the two cards (Q2_0: ~2,170 tok/s prompt at 32K).
Exactness
Gate: a single-GPU config holding N experts vs a two-GPU config holding the same N split across both cards, static
residency (
--adapt-swaps 0 --pcie-frac 0),STRATA_MMQ_NO_STREAMK=1(a debug switch that turns off MMQ stream-k,whose tile split depends on the group's total tiles):
flashbench.py gategreedy outputs IDENTICAL on all prompts,after every step. With stream-k on, results differ only by MMQ's summation order.
Notes
CUDA_VISIBLE_DEVICES=1,0); P2P is enabled both ways at open.--peer-reserve-mibsets it.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.