mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1461] [CLOSED] Peer tier with mutual help: concurrency 2 at 155 t/s aggregate on dual RTX 3090 (elastic peer pair, opt-in) #3473
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#3473
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/1461
Author: @q8atnight
Created: 10/7/2026
Status: ❌ Closed
Base:
main← Head:elastic-pair📝 Commits (2)
94e9010multi-GPU: --peer-link, two one-card engines as each other's expert tier (mutual help), and the elastic control lines (opt-in)2ff69cdserve: the elastic peer pair (opt-in "elastic" config block) - the helper card turns into its own engine on a second request📊 Changes
14 files changed (+1602 additions, -10 deletions)
View changed files
📝
CMakeLists.txt(+1 -1)📝
docs/MULTI_GPU.md(+58 -0)📝
include/strata/core/peer_experts.hpp(+12 -2)➕
include/strata/core/peer_link.hpp(+132 -0)📝
include/strata/hip_compat/cuda_runtime.h(+2 -0)📝
include/strata/kernels/cpu/pool.hpp(+9 -0)📝
include/strata/platform/hip_compat/strata_hip.h(+2 -0)➕
serve/elastic.py(+536 -0)📝
serve/server.py(+11 -2)➕
serve/test_elastic.py(+104 -0)📝
src/core/peer_experts.cpp(+12 -1)➕
src/core/peer_link.cpp(+494 -0)📝
src/kernels/cpu/pool.cpp(+28 -0)📝
src/program/generate.cpp(+201 -4)📄 Description
Follow-up to #723 and #531. As you asked there: opt-in, off by default, gated like the peer pair, numbers first.
What it does. With
--peer-deviceone engine uses both cards for one conversation and a second request waits.The elastic pair lets the second card turn into its own engine when a second request arrives, and back into the
first engine's peer tier after it has been idle for a while. While both run, each engine computes the other's rows
for the experts its card holds (
--peer-link, "mutual help"), so neither falls back to the CPU for the experts theother card has. Still one sequence per engine process: two processes, one card each, one shared expert arena.
--peer-device: card 2 is its tier (as without the pair)--vram-elastic), optionally frozen withcuda-checkpointPEER_DETACHbetween two verify windows,POOL_HOLD nLINK_SERVE 1, takes the requesthold_sPEER_ATTACHafter its request: card 2 is its tier againThe two numbers you asked for (2x RTX 3090 + NVLink, Ryzen 9 3950X, 121 GB DDR4, IQ3_S, 262K, kv int8)
1. Single request speed unchanged. Stock v0.1.40.3
--peer-device 1vs this PR's elastic pair serving onerequest, 3 alternating restarts x 2 runs (n = 6, medians, sampled, cached 54K coding prompt for decode):
--peer-device 1(the lead IS a
--peer-deviceengine while it is alone; the only difference is the cache split between the cards:every second profile rank, close to the default
STRATA_PEER_HOT0.45.)2. The cost to the first card when the second request starts (streamed, 3 runs, B starts 8 s into A):
B's first token comes 4.7 s plus its prompt after it was sent.
Aggregate, two 1,000-token requests at once (cached prompts, 5 runs): 151-160 t/s (median 155) vs 99 t/s
for the same two one after the other on
--peer-device(+55 %). Two one-card engines without the mutual help: 136-139.Exactness
Without
--peer-linkand without the"elastic"block nothing of this runs. Gates (greedy, word for word, thedeterministic gate configs:
--expert-cache 3000 --adapt-swaps 0 --pcie-frac 0 --prompt-cache 0 --no-prefill-borrow,STRATA_IQ_MT_MIN=1): stock v0.1.40.3 saved, stock repeated (PASS), this PR checked:--layer-split 24: chat/code/math + 20K-token long prompt x2 + one image: PASSWith the link on, a linked expert is computed with the same kernels (q8_1 +
native_expert_grouped) from the sameactivations as on the requester's own card, so its rows are the same; as with any cache, which experts sit in VRAM vs
on the CPU still decides the last bits.
Where it does NOT help (honest row)
unsloth UD-Q4_K_XL on the same cards: a
--layer-splitalready spends both cards' memory bandwidth on oneconversation (95 t/s); the pair gives 87-88 t/s for two together (75-79 for one request on the peer pair). Q4's dense
weights + head (~2.9 GB) are read per verify window per engine, so two engines read them twice. The pair pays off
where
--peer-deviceleaves the second card mostly idle (as a peer tier alone it measured 11-18 % busy here).How it is built
--peer-link FILE --peer-link-role 0|1(engine): a small shared-memory file. Each engine publishes its card'sresidency; a service thread computes the other engine's rows on its own card (zero-copy through the mapped file,
high-priority stream). Only the owner ever touches its card: it holds the link while it rewrites or unmaps slots
(adaptive swaps, the prompt path's loan, VRAM) and publishes after the copies landed; an expert planned a moment
too late is copied in from the owner's RAM copy for that request (counted in the log line). No CUDA IPC, no P2P
between processes, no MPS.
PEER_DETACH,PEER_ATTACH,POOL_HOLD n,LINK_SERVE 0|1(answeredCTL ...).serve/elastic.py: the desk (twoStrataEngines behind oneService,batch = 2), routing to the idle lane withthe longest prefix;
serve/test_elastic.py(fake engines, no GPU);docs/MULTI_GPU.md: setup + these numbers.Limits / follow-ups
sched_setaffinity); two cards (a pair). The shared arena must fit its tmpfs (/dev/shmis half of RAM by default).
long prompt, the helper wakes after that prompt (measured: 11.5 s into a fresh 54K prompt).
Measured with
bench/q4pair.py-style scripts (one-shot, not part of the PR); happy to add them undertools/if useful.Development of this PR (design, engine code, desk, measurements) was heavily supported by Opus 5.5.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.