mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1414] [CLOSED] prefill: the CPU share (STRATA_PREFILL_CPU_SHARE) up to 3,072-token chunks, from mapped experts, on a layer split #3437
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#3437
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/1414
Author: @architectds
Created: 10/7/2026
Status: ❌ Closed
Base:
main← Head:pr/cpu-share-staged📝 Commits (2)
4555263prefill: the CPU share up to 3,072-token chunks, from mapped experts too, and on a layer split's stagesca6fbfadocs: the CPU share up to 3,072-token chunks, from mapped experts, on a split - and what it measured📊 Changes
4 files changed (+94 additions, -31 deletions)
View changed files
📝
docs/DETAILS.md(+25 -7)📝
include/strata/prefill/prefill.hpp(+9 -3)📝
src/prefill/prefill.cpp(+53 -19)📝
src/program/generate.cpp(+7 -2)📄 Description
Title
Issue: none - a follow-up to STRATA_PREFILL_CPU_SHARE (
978d355, 0.1.40.2).Summary
STRATA_PREFILL_CPU_SHARE(0.1.40.2) hands the decode CPU pool a share of a small chunk's streamed experts. On a PCthat maps its experts (
--mmap-experts) it took none, because it only takes page-locked experts; it also stopped at1,024-token chunks and ran on one GPU only. With this change, when it is set:
experts.bin'spages in the file cache;
every expert from 1,024 tokens on;
STRATA_PREFILL_CPU_SHARE_MAX=1024keeps the old limit;Unset, nothing changes: every new path is behind
cpu_share_on().Measured on Windows 11, Ryzen 9 5900XT, 96 GB DDR4-3200, PCIe 3.0 x8,
--mmap-experts, q4_0 KV. Fresh prompts readafter an 8K prewarm, medians of 5 interleaved rounds, off / auto, ms:
A coding agent's recorded conversation on the two cards (a 100K-token start, then 8 turns of 1-5K tokens of code, 128
tokens written a turn; both read the same tokens): 137.4 s off, 130.6 s auto (reading 121.1 -> 114.3 s).
What changed
src/prefill/prefill.cppstream_all_min(): once the share is armed, the share's own limit (STRATA_PREFILL_CPU_SHARE_MAX, default 3072,at least 1024) instead of 1024.
Prefill::arm_cpu_sharesets it before any loan is sized;initsets it too.transient()with a stable blob. The blob pointers are takenwhile the experts are chosen (on the prefill thread, as before); an expert without one stays on the GPU.
g_cpu_pool_busy), and gives it backat the end of the chunk, after the last layer's CPU thread has been joined.
include/strata/prefill/prefill.hpp:Prefill::arm_cpu_share, andset_cpu_pool's comment.src/program/generate.cpp--batch);plan_lend(one GPU, as before).docs/DETAILS.md: the CPU share section, with the table above.Extra Notes
(3,319 against 3,322 ms at 512 tokens; 3,000 tokens 5,487 against 5,525).
conversation differ from off, the first differing word coming after 4-41 words (near ties).
builds and in daily use for coding agents since 2026-10-02 (one RTX 5070 Ti, later with an RTX 3060 beside it). The
same tests measured it equal to this up to 1,000 tokens, and 3% / 5% faster at 2,000 / 3,000 tokens on one card (on
the two cards within 1.5%): it quantizes the layer's activations on the GPU and copies a quarter of the bytes down,
where this copies floats and quantizes on the CPU. That part can follow as its own PR.
CPU: a narrow or older PCIe link (3.0, x8 or x4, an eGPU, a laptop), a card whose cache holds few of the experts, and
a CPU with many cores and good RAM bandwidth - the PC above has all three (-41% to -49% at 1,000 tokens and below).
It helps less with PCIe 5.0 x16 or a card that holds most experts, and a slow CPU or low RAM bandwidth gets a small
share (
automeasures both sides). The table in DETAILS.md already has -19% to -35% below 1,000 tokens on three otherPCs. Not measured here: PCIe 4.0 / 5.0 links, AMD or Intel GPUs, Linux.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.