mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4000] [Engine] Prefill / decode split across GPUs, so each card does what it is best at, including NVIDIA + AMD #1722
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#1722
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 @MarcoTool on GitHub (Oct 24, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4000
Area
[Engine]
What do you want to do?
Background
Prefill and decode need different things from a GPU. Prefill is large matrix products and depends on matrix units; decode is mostly limited by memory bandwidth and by how much of the model fits in VRAM. Cards are often strong at one and weak at the other. Many older data-center cards have large, high-bandwidth HBM2 memory but no matrix units, and they are inexpensive second-hand. Current consumer cards have fast matrix units but usually less VRAM. Some PCs also have two different GPUs; #3795, for example, reports a machine with one NVIDIA and one AMD card.
With several cards today, every card works on both stages, so unequal cards cannot each take the stage they are best at, and NVIDIA + AMD cards cannot share a model at all (
docs/MULTI_GPU.md).Proposal
Prefill / decode disaggregation is a mainstream optimization in data-center serving: prefill and decode run on separate GPU pools, and the KV cache moves between them over a fast interconnect. This proposal brings the same idea into a single PC.
Let some cards run prefill and others run decode, and hand the session over after the prompt is read. The two backends then share only a session, never a layer, which also makes NVIDIA + AMD combinations usable. Setup and
--calibratecould detect unequal cards and suggest the split, the way they suggest other settings today.Strata already has the parts: session save and restore,
--shared-expert-arenaso both engines map one copy of the experts, and one source tree for CUDA and HIP, so with the same engine version and the same session settings, such as the KV format and--kv-resident, the session fingerprints match. This is where Strata's design has an edge over the usual disaggregated setups. There, the prefill and the decode instance each load a full copy of the model. In Strata, the experts live in RAM and both engines map the same copy through--shared-expert-arena, so the split keeps one copy of the experts in RAM, not two, and the session moves through RAM instead of a network. Each engine still loads its own dense weights and buffers into its GPU. On the example machine below, which has 96 GB of RAM:What a normal user is missing is the orchestration: starting both engines with matching settings, routing a long prompt to the prefill card, and handing the session over.
Example
To check that this works, I set it up by hand with a small router in front of two engines, using the hardware I already had:
Across prompt lengths on the same machine, against the same two MI50s doing prefill themselves. Both setups use the same model, prompts, KV settings and decode settings, including
--kv-resident 262144and the gfx906 top-k change, so the MI50s decode the same way in both. The split's TTFT includes the session handoff through/dev/shm, 2.1–2.3 s at 32K and 10.0–11.6 s at 258K:Prefill and decode on 2× MI50
Prefill on an RTX 3070, decode on 2× MI50
Decode runs on the MI50s in both setups: 37–45 tok/s alone and 39–47 tok/s with the split across these lengths.
Community results for the same engine and quantization at 128K, Flash-Next IQ3_S with one request, from reports with different engine versions and prompts, show the pair prefilling faster than a Ryzen AI Max+ 395 while decoding at a similar speed:
The RTX 3070 and the MI50s are simply the cards I had. In the split, each side runs at the speed of its own card: the 32K prefill above matches the RTX 3070 running alone, 1,571 tok/s, and decode matches the MI50s running alone. Any card that is good at prefill and any card that is good at decode can take their places, and the prefill and decode numbers then follow those cards.
Would a built-in split like this be in scope? If so, I can describe the setup in detail and help with the parts that fit.
What do you do today instead?
Two engines and a router, set up by hand: https://github.com/MarcoTool/PDHyperMix-Strata-MI50
@github-actions[bot] commented on GitHub (Oct 24, 2026):
Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:
Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment
/reopen.Details: CONTRIBUTING.md
@github-actions[bot] commented on GitHub (Oct 24, 2026):
Thanks, this follows the format now.
@Niko1221 commented on GitHub (Oct 27, 2026):
Thank you @MarcoTool for the idea, the manual setup and the first measurements. 0.2.7 has a built-in version, opt-in:
--split-serve P,D(orsplit_servein the run config). One engine reads the prompt and hands the finished state to a second engine that answers, through a session file in RAM. The words are the same as with one engine, token for token (checked at 4,096 and 16,384 tokens). We could only measure two identical cards, 2x RTX A6000: there it is slower than the normal layer split on every workload (an 8K prompt 16% longer, a 32K prompt 48% longer), so we do not recommend it on alike cards; docs/SPLIT_SERVE.md has the numbers. It can only pay with different cards, as in your 3070 + MI50 setup, and we have no such pair. Could you try 0.2.7 on your cards and tell us what you get, with the same prompts as in your issue?Release: https://github.com/Niko1221/Strata/releases/tag/v0.2.7
@MarcoTool commented on GitHub (Oct 28, 2026):
Thank you @Niko1221 for building split serving into 0.2.7, and for the credit in SPLIT_SERVE.md.
I have started trying 0.2.7 on the cards from this issue:
Next, I will post the benchmark with the same prompts as above (16K to 258K): the PD split, the RTX 3070 alone, the MI50s alone, and decode on one against two MI50s.
@MarcoTool commented on GitHub (Oct 31, 2026):
I have run 0.2.7 on these cards with your standard benchmark, plus the same benchmark prompts extended to 258K; the full data is in #4819.
Short version:
split_servestarts both roles with one executable). Every request completed, with one or two MI50s on the decode side.STRATA_PIN_RESERVE_MIB=12288to start (#4514), and its prefill engine exits on one 16K sanity check in every run (cuBLAS status 6); after that it is not started again, unlike what SPLIT_SERVE.md describes.My RTX 3070 is a modified 16 GB board with its FP16 rate unlocked, so a stock card is likely to read prompts slower.
One question about gfx906: the gfx906 build stops in
src/core/dflash2.cpp. Building 0.2.7 for gfx906, it failed there withcudaDeviceGetStreamPriorityRangeandcudaStreamCreateWithPriorityundeclared, and the current main (c62d5e3a) still has the same check: the file tests onlySTRATA_USE_HIP, which the gfx906 build does not define. #3986 fixes it (#4766 has the same change plus a second guard). Would you take one of these, or would you rather fix it your way? Either way, if a change needs testing on gfx906 before a release, feel free to tag me; I can run it on the MI50s.