mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #663] [CLOSED] prefill: a layer split's idle card streams a share of a one-chunk prompt's experts #2750
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#2750
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/663
Author: @anon761
Created: 10/3/2026
Status: ❌ Closed
Base:
main← Head:split-prefill-peer-stream📝 Commits (1)
46c4715prefill: a layer split's idle card streams a share of a one-chunk prompt's experts📊 Changes
6 files changed (+270 additions, -15 deletions)
View changed files
📝
docs/MULTI_GPU.md(+14 -0)📝
include/strata/prefill/kernels.hpp(+3 -0)📝
include/strata/prefill/prefill.hpp(+12 -0)📝
src/prefill/kernels.cu(+14 -0)📝
src/prefill/prefill.cpp(+214 -15)📝
src/program/generate.cpp(+13 -0)📄 Description
What
A prompt that fits one chunk runs a layer split's stages one after the other: while one card reads its layers, the other idles.
--peer-devicealready has the mechanism to use such a card -PeerPrefill's peer streaming (a share of the experts the primary streams goes over the peer's own PCIe link and is computed there) - but it needs P2P and is refused with--layer-split. Most consumer pairs have no P2P (two RTX 3090 here:nvidia-smi topo -p2p rsaysCNS).This makes
PeerPrefillusable as a stream-only peer between the stages:Prefill::set_stage_helper: each stage's prompt path gets the next stage's (the last one the first's). A stream-onlyPeerPrefillholds no experts (peer == nullptr); every use of the peer tier is guarded.bind_stage_helper, per prompt: points it at the idle stage's own lent prompt buffers (mixed,Xq,GU,H,Hq,Dm, its ring, its MMQ context). No VRAM of its own;serve'slend()lays every stage's buffers out at once before the prompt.copy_f32_wide, 16-byte loads). My first version used copy-engine uploads; they queued behind the ring's expert blobs - the same reason the grouping tables live in mapped memory - and cost ~20 ms per layer, which ate the whole gain (thecombinephase went 24 -> 407 ms).cudaMemcpyPeerAsyncwithout P2P is staged by the driver.--peer-device), with a share that falls with the chunk -min(0.45, 0.5 - T/16384), off below 0.3 (~3.3K tokens) - from the sweep below.STRATA_PREFILL_HELP=0turns it off,STRATA_PREFILL_HELP_FRAC=ffixes the share.docs/MULTI_GPU.mddescribes it.The
--peer-devicepath is unchanged (itsctxbecomesrun_ctx, a pointer, so the helper can run in the idle stage's context).Measured
2x RTX 3090 (PCIe 4.0 x16 each, no P2P), EPYC 7413, Unsloth UD-Q4_K_XL, layer split auto, 262K context,
--kv int8 --pcie-frac 0 --ple-io ram --adapt-swaps 0, synthetic prompts (a repeated paragraph, unique per run) over/v1/chat/completions, 3 runs each, same binary:STRATA_PREFILL_HELP=0Decode unchanged. The share sweep behind the rule (
STRATA_PREFILL_HELP_FRAC0.2 / 0.3 / 0.4 against none): 1.5K 749 / 820 / 908 (675), 3K 1,335 / 1,437 / 1,328 (1,262), 4K 1,622 / 1,620 / 1,440 (1,609), 6K 1,811 / 1,660 / 1,471 (2,038), 8K 1,895 / 1,804 / 1,663 (2,230).Output
Repeatable: the same prompt gives the same answer, run after run (
--adapt-swaps 0, four fixed prompts of 1.2-3.1K tokens, twice). It is not bit-identical toSTRATA_PREFILL_HELP=0's: the helped rows are computed in another MMQ grouping and round differently - likeSTRATA_SPLIT_OWN. I made it default-on because the default (adaptive swaps on) is not bit-repeatable across requests anyway and the gain is large for the short prompts agents send; if you prefer it opt-in likeSTRATA_SPLIT_OWN, that is a one-line change and I'm happy to flip it.Not tested: a P2P pair (the helper always takes the mapped route), HIP, three or more stages (the code takes the next stage's card; only two were available).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.