mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1282] [CLOSED] prefill: STRATA_PREFILL_CPU_SHARE=auto hands a small chunk's least-routed experts to the idle CPU pool (opt-in) #3354
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#3354
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/1282
Author: @sergqwer
Created: 10/7/2026
Status: ❌ Closed
Base:
main← Head:pr/prefill-cpu-share📝 Commits (1)
9004b70prefill: STRATA_PREFILL_CPU_SHARE=auto hands a small chunk's least-routed experts to the idle CPU pool📊 Changes
3 files changed (+196 additions, -4 deletions)
View changed files
📝
include/strata/prefill/prefill.hpp(+12 -0)📝
src/prefill/prefill.cpp(+178 -2)📝
src/program/generate.cpp(+6 -2)📄 Description
Replaces #1050, which GitHub closed when
main's history was rewritten. The closing note says this was not a rejection. It is the same commit, cherry-picked onto the newmain(v0.1.40.1).A chunk below
stream_all_min()(1,024 tokens) streams every routed expert outside VRAM over PCIe. An agent's tool result, a test's output and a short follow-up are all such chunks. Meanwhile the decode CPU pool sits idle, and the arena holds the same experts in RAM.This adds an opt-in,
STRATA_PREFILL_CPU_SHARE=auto|x. Unset (the default), no expert moves and the output is byte-identical to v0.1.40.1.What it does
MAXTof the chunk's tokens, fewest first. It runs them on a thread while the GPU streams and runs the rest.Dm's tail, as a peer GPU's do (the same mechanism as--peer-device), and the combine weights them as any other row.auto: the share is measured. Each layer times the CPU thread per expert, and the GPU's expert work per streamed expert. The GPU side uses CUDA events around its expert work, read after the next layer's routing sync, because the host reaches the combine long before the GPU does; timing the host instead gave a wrong share. The next layers hand the CPUg / (c + g)of the streamed experts, the point where both sides end together. A small CPU therefore takes a small share and does not make the prompt slower.xfixes a share.ActQ, as decode's), and i-quant layers take the nativevec_dottype.Measured
On another machine, by @did-technomancer (#1050): RX 6800 16 GB (gfx1030) + Ryzen 7 5700X3D (AVX2, no AVX-512), Windows 11, ROCm, IQ3_XXS, 128K context. Short prompts (~850 tokens) read 37-45% faster, and long prompts and decode are unchanged. Their quality suite gave 22/22 with the switch on.
autoautoOn 0.1.40, here (IQ2_XS, one chunk, ms, off / auto): 600 tokens 487 / 463, 489 / 457, 491 / 485 (share 0.86-0.87); 250 tokens 386 / 357, 386 / 352, 379 / 356 (share 0.90).
On 0.1.39, here. RTX 5090 + Ryzen 9 9950X3D, generate, one chunk, ms (off / auto):
STRATA_PREFILL_MMQ=0: 0.0053 off, 0.0080 auto.stream_all_min()stays 1,024. On the fork with NVFP4's 2.76 MB experts the routed-only walk paid up to 4,096 tokens, but on Q2_0 it lost against streaming every expert, so it stays out of this PR.🤖 Generated with Claude Code
https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.