[GH-ISSUE #4000] [Engine] Prefill / decode split across GPUs, so each card does what it is best at, including NVIDIA + AMD #1722

Open
opened 2026-11-04 01:53:28 +07:00 by bsakaguchi · 5 comments
Owner

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 --calibrate could 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-arena so 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:

One full copy per engine Strata, one shared copy
Expert weights in RAM about 100 GB, two copies of 50 GB about 50 GB, one copy
RAM in use with both engines running about 107 GB, more than the 96 GB installed about 60 GB of the 96 GB installed

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:

Role Hardware
Decode 2× AMD Instinct MI50 32 GB (gfx906), HBM2 at about 1 TB/s each, no MFMA; together they hold every expert of Flash-Next IQ3_S in VRAM
Prefill NVIDIA RTX 3070, a modified 16 GB board; its FP16/BF16 issue rate is raised with Zagitta/gpu-unlock
Host AMD Threadripper 1920X, 96 GB RAM, PCIe 3.0, SATA SSD
Software Ubuntu 22.04, ROCm 7.14, CUDA 13, Strata 0.1.43.1 with one gfx906 kernel change (#3987)

Request flow

Prefill on an RTX 3070 against prefill on 2× MI50

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 262144 and 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

Prompt Prefill TTFT
16K 399 tok/s 41.2 s
32K 391 tok/s 84.0 s
64K 390 tok/s 168.1 s
128K 384 tok/s 341.8 s
192K 369 tok/s 532.5 s
258K 357 tok/s 722.8 s

Prefill on an RTX 3070, decode on 2× MI50

Prompt Prefill TTFT
16K 1,533 tok/s 12.2 s
32K 1,597 tok/s 22.5 s
64K 1,681 tok/s 42.4 s
128K 1,643 tok/s 85.6 s
192K 1,589 tok/s 132.6 s
258K 1,543 tok/s 179.8 s

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:

Hardware 128K prefill 128K decode Source
RTX 5090 4,450 tok/s 127.2 tok/s community, 2026-10-02
2× MI50 + RTX 3070, split 1,643 tok/s 40.5 tok/s this report
Ryzen AI Max+ 395, 128 GB unified memory 1,312 tok/s 42.8 tok/s Strata docs, maintainers' box
R9700 32 GB 718 tok/s 87.6 tok/s community, 2026-10-08
2× MI50 alone 384 tok/s 42.5 tok/s this report

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

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 `--calibrate` could 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-arena` so 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: | | One full copy per engine | Strata, one shared copy | |---|---|---| | Expert weights in RAM | about 100 GB, two copies of 50 GB | about 50 GB, one copy | | RAM in use with both engines running | about 107 GB, more than the 96 GB installed | about 60 GB of the 96 GB installed | 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: | Role | Hardware | |---|---| | Decode | 2× AMD Instinct MI50 32 GB (gfx906), HBM2 at about 1 TB/s each, no MFMA; together they hold every expert of Flash-Next IQ3_S in VRAM | | Prefill | NVIDIA RTX 3070, a modified 16 GB board; its FP16/BF16 issue rate is raised with Zagitta/gpu-unlock | | Host | AMD Threadripper 1920X, 96 GB RAM, PCIe 3.0, SATA SSD | | Software | Ubuntu 22.04, ROCm 7.14, CUDA 13, Strata 0.1.43.1 with one gfx906 kernel change (#3987) | ![Request flow](https://raw.githubusercontent.com/MarcoTool/PDHyperMix-Strata-MI50/c7df84be8d83e4191a276c26ef71a0683ef13e7c/assets/pd-flow.svg) ![Prefill on an RTX 3070 against prefill on 2× MI50](https://raw.githubusercontent.com/MarcoTool/PDHyperMix-Strata-MI50/3f01e08393b913e16f70bc0e9bf930e62bd40677/assets/pd-advantage.svg) 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 262144` and 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: <table> <tr> <td valign="top"> **Prefill and decode on 2× MI50** | Prompt | Prefill | TTFT | |---|---|---| | 16K | 399 tok/s | 41.2 s | | 32K | 391 tok/s | 84.0 s | | 64K | 390 tok/s | 168.1 s | | 128K | 384 tok/s | 341.8 s | | 192K | 369 tok/s | 532.5 s | | 258K | 357 tok/s | 722.8 s | </td> <td valign="top"> **Prefill on an RTX 3070, decode on 2× MI50** | Prompt | Prefill | TTFT | |---|---|---| | 16K | 1,533 tok/s | 12.2 s | | 32K | 1,597 tok/s | 22.5 s | | 64K | 1,681 tok/s | 42.4 s | | 128K | 1,643 tok/s | 85.6 s | | 192K | 1,589 tok/s | 132.6 s | | 258K | 1,543 tok/s | 179.8 s | </td> </tr> </table> 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: | Hardware | 128K prefill | 128K decode | Source | |---|---|---|---| | RTX 5090 | 4,450 tok/s | 127.2 tok/s | [community, 2026-10-02](https://github.com/Niko1221/Strata/tree/main/bench/results/2026-10-02-community-rtx-5090-iq3s) | | **2× MI50 + RTX 3070, split** | **1,643 tok/s** | **40.5 tok/s** | this report | | Ryzen AI Max+ 395, 128 GB unified memory | 1,312 tok/s | 42.8 tok/s | [Strata docs, maintainers' box](https://github.com/Niko1221/Strata/blob/main/docs/STRIX_HALO.md#6-measured) | | R9700 32 GB | 718 tok/s | 87.6 tok/s | [community, 2026-10-08](https://github.com/Niko1221/Strata/tree/main/bench/results/2026-10-08-community-r9700-linux) | | 2× MI50 alone | 384 tok/s | 42.5 tok/s | this report | 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
Author
Owner

@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:

  • Fill in "What do you want to do?".

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

<!-- gh-comment-id:6388245043 --> @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: - [ ] Fill in "What do you want to do?". 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](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

@github-actions[bot] commented on GitHub (Oct 24, 2026):

Thanks, this follows the format now.

<!-- gh-comment-id:6388279374 --> @github-actions[bot] commented on GitHub (Oct 24, 2026): Thanks, this follows the format now.
Author
Owner

@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 (or split_serve in 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

<!-- gh-comment-id:6446117353 --> @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` (or `split_serve` in 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
Author
Owner

@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:

  • 2× MI50, split serving as documented (card 0 reads the prompt, card 1 answers): the decode engine does not start on this 94 GiB PC. Both HIP engines register the shared arena, and the amdgpu driver counts it once per engine, so the count reaches its limit. Reported in #4514, with a workaround and a fix for the gfx906 part in my fork.
  • RTX 3070 prefill, 2× MI50 decode (the setup above): the hand-over between the CUDA and HIP engines works on 0.2.7 as it is. A 32K run read the prompt on the 3070 at 1,488 tok/s, restored the session on the MI50s in 1.07 s and decoded at 45.6 tok/s.

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.

<!-- gh-comment-id:6474717767 --> @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: - **2× MI50, split serving as documented** (card 0 reads the prompt, card 1 answers): the decode engine does not start on this 94 GiB PC. Both HIP engines register the shared arena, and the amdgpu driver counts it once per engine, so the count reaches its limit. Reported in #4514, with a workaround and a fix for the gfx906 part in my fork. - **RTX 3070 prefill, 2× MI50 decode** (the setup above): the hand-over between the CUDA and HIP engines works on 0.2.7 as it is. A 32K run read the prompt on the 3070 at 1,488 tok/s, restored the session on the MI50s in 1.07 s and decoded at 45.6 tok/s. 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.
Author
Owner

@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:

  • RTX 3070 prefill, MI50 decode works on 0.2.7, with #3986 and a small launcher script (stock split_serve starts both roles with one executable). Every request completed, with one or two MI50s on the decode side.
  • Prompt: the RTX 3070 reads it for an MI50 at 2.4 to 4.3 times the MI50's own speed (853 to 1,645 tok/s against 356 to 417).
  • Answer: the MI50s answer 6.8% to 48.3% faster than the RTX 3070 alone. The hand-over costs 1.2 to 11.4 s per request, so the split catches up with the RTX 3070 alone after roughly 200 answer tokens at 4K and about 6,000 at 258K.
  • One or two MI50s for decode: no clear difference.
  • Two MI50s (MI50 #0 prefill, MI50 #1 decode): as on your A6000s, nothing gets faster. It needs STRATA_PIN_RESERVE_MIB=12288 to 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 with cudaDeviceGetStreamPriorityRange and cudaStreamCreateWithPriority undeclared, and the current main (c62d5e3a) still has the same check: the file tests only STRATA_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.

<!-- gh-comment-id:6546546694 --> @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: - **RTX 3070 prefill, MI50 decode works on 0.2.7**, with #3986 and a small launcher script (stock `split_serve` starts both roles with one executable). Every request completed, with one or two MI50s on the decode side. - **Prompt:** the RTX 3070 reads it for an MI50 at 2.4 to 4.3 times the MI50's own speed (853 to 1,645 tok/s against 356 to 417). - **Answer:** the MI50s answer 6.8% to 48.3% faster than the RTX 3070 alone. The hand-over costs 1.2 to 11.4 s per request, so the split catches up with the RTX 3070 alone after roughly 200 answer tokens at 4K and about 6,000 at 258K. - **One or two MI50s for decode:** no clear difference. - **Two MI50s (MI50 #0 prefill, MI50 #1 decode):** as on your A6000s, nothing gets faster. It needs `STRATA_PIN_RESERVE_MIB=12288` to 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 with `cudaDeviceGetStreamPriorityRange` and `cudaStreamCreateWithPriority` undeclared, and the current main (`c62d5e3a`) still has the same check: the file tests only `STRATA_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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1722
No description provided.