mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #833] [CLOSED] Prefill: batched unbuffered expert reads, close the experts.bin view; opt-in RAM budget with helper caches #2860
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#2860
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/833
Author: @adonizm
Created: 10/4/2026
Status: ❌ Closed
Base:
main← Head:pp-opt📝 Commits (10+)
749d957setup (--backend hip): a system ROCm without the HIP development files falls back to the wheels (#446)5a30024calibrate: the engine's arguments come from the server's engine_args; a failed tuning says why (#447)9f60d13serve, setup: name the small split card that caps the prompt chunk; setup recommends the big card alone (#448)eb8da1d/metrics: each request's speculative draft counts, and their sums in the totals (#457)6a09387setup (--gguf-dir): GGUFs Strata cannot run are named as such, with the --family/--model to use (#444)d6a91e2docs: the Coder is weaker outside code, Chinese/CJK text included; the unpruned sizes for that (#438)d8d4ad3Merge branch 'f-135-eng' into rel-0.1.357b600d5Merge branch 'f-135-small' into rel-0.1.35d9ab843Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB PCs (#467), fixes #460 #459 #446 #447 #457 #448 #444; setup requires it57bd713sycl: pipeline the expert cache's profile fill (model load 3-4x faster)📊 Changes
1 file changed (+8 additions, -1 deletions)
View changed files
📝
src/program/generate.cpp(+8 -1)📄 Description
What
Two engine changes, plus one opt-in switch, that speed up prompt reading (prefill) on a PC whose RAM cannot hold all the experts. That is the 32 GB case, where the file tier reads unbuffered.
src/prefill/prefill.cpp,src/core/expert_source.cpp). Each prompt-path stager thread now claims a run of consecutive jobs. The source reads them with a singleread_directbatch through the newExpertSource::copy_blobs, which merges neighbouring blobs into requests of up to 32 MiB. Before this, every job was its own ~2 MB request. Set withSTRATA_STAGER_BATCH: the default is 8 for file-backed blobs and 1 otherwise.STRATA_STAGER_BATCH=1restores the old behaviour.experts.binview once reads are unbuffered (FileExpertSource::drop_mapping, called fromgenerate.cppafter the RAM copy is built). While the file is mapped, NTFS serves its unbuffered reads one at a time. After startup the view is only used as a fallback, so it is closed:mapped_blobreturns nullptr and every file read goes throughread_direct.STRATA_KEEP_MAPPING=1keeps the view open (A/B).STRATA_RESIDENT_REMOTE=1(experimental, opt-in). Allows--resident-budget-gibalongside the CUDA1-3 helper caches (--expert-cache-device1). The prompt path runs on CUDA0 and streams from the source, so the RAM budget is what speeds up long prompts, while the helpers serve decode. Without the variable, the existing refusal is unchanged.Why
On a 32 GB PC, IQ3_XXS read a 47.6K prompt at 227 tok/s.
STRATA_PREFILL_TIMING=1showed 86% of the GPU timeline waiting on expert blobs, and drive counters showed ~660 MB/s of mmap page faults. With a RAM budget and unbuffered reads it was still bound by the SSD, at queue depth 1 and ~2.3 GB/s.A standalone test on the same drive (WD SN580, 2 MiB unbuffered reads at QD32): 2.35 GB/s with experts.bin mapped, 3.57 GB/s without. With the view closed, the drive runs at an average queue depth of 12 during prefill.
Measurements
RTX 5070 Ti 16 GB + RTX 3060 12 GB, Ryzen 7 7800X3D, 32 GB RAM, Windows (WDDM), IQ3_XXS (Swift), 47.6K-token prompt,
--prefill auto:32768. One run per arm unless noted.--resident-budget-gib 18, release 0.1.39STRATA_STAGER_BATCH=1STRATA_KEEP_MAPPING=1)STRATA_RESIDENT_REMOTE=1, budget 16 GiB,--pool-workers 7(two runs)Decode, measured on three 600-token answers: the original config gives 33.6 tok/s. A single GPU with the RAM budget gives 35.6 tok/s. The RAM budget with the CUDA1 helper (
STRATA_RESIDENT_REMOTE=1) gives 43.3 tok/s.Notes for review
drop_mappingacts only whendirect_is non-empty and the source isexperts.bin. It does nothing for the GGUF-in-place mode, which keepsmaps_for the token embedding and PLE.base_stays non-null only as the "opened" mark.mapped_blobchecksunmapped_, andclose()skips the unmap when the view is already closed.kRing, so the earliest unfinished run never waits on a ring buffer it holds itself. A run that mixes in non-transient jobs copies those individually.STRATA_RESIDENT_REMOTEchanges where experts are computed (GPU helper versus CPU), exactly as the helper cache already does. Generated text was checked for coherence, not with a KL comparison.drop_mappingis Windows-only by design, andcopy_blobsfalls back to the default loop), HIP, and layer splits.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.