mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1600] [CLOSED] split: decide STRATA_SPLIT_RING before sizing the lend regions (a 104k read stops reading 10 GB from the file) #3556
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#3556
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/1600
Author: @noon-at-cgn
Created: 10/8/2026
Status: ❌ Closed
Base:
main← Head:pr/lend-sizing📝 Commits (5)
39708aeresident split: a test that the RAM copy keeps each stage's lend region (red: FileExpertSource has no stage_lend_regions, and no append_stage_lend_regions)3ba11b1resident split: pin_cache_complement keeps each stage's lend region in the RAM copy too (stage_lend_regions, append_stage_lend_regions) - the experts the prompt path borrows under a split streamed from the mapped files through page faults (3.7 GiB read for one 73K prompt, 1.5 s of a 3.9 s chunk on host staging, 2026-10-06 rig); one budget caps complement and regions, experts past it keep the file fallback6b6277agenerate: size every part's lend region for a layer split by the serve scan's own arithmetic (auto ceiling or the explicit chunk, the 128-slot floor, the auto percentage cap), #340's own-buffer rule deciding which parts lend nothing - and hand them to the resident copy before it pins84ef5dbsplit: decide STRATA_SPLIT_RING before sizing the lend regions; log borrowed vs RAM-kept slots8c274dddocs: replace the evidence placeholder in the lend-sizing paragraph with the measured result📊 Changes
9 files changed (+628 additions, -20 deletions)
View changed files
📝
CMakeLists.txt(+19 -0)📝
docs/MULTI_GPU.md(+23 -0)📝
include/strata/core/expert_source.hpp(+22 -0)➕
include/strata/program/split_ring.hpp(+36 -0)📝
src/core/expert_source.cpp(+79 -0)📝
src/program/generate.cpp(+100 -20)➕
src/program/split_ring_test.cpp(+84 -0)📝
tests/core/file_expert_source_test.cpp(+46 -0)➕
tests/core/split_lend_complement_test.cpp(+219 -0)📄 Description
Title
Issue: Related: #1190 (this PR depends on it and is branched from its head; please merge it first). Near it: #1417 changes
part_slotsin the same area ofgenerate.cpp.Summary
Why it matters: with
STRATA_SPLIT_RING=384the prompt path borrowed 5,396 cache slots but the RAM copy kept only 4,662. Each long prompt then re-read the other 734 slots' experts from the model file in every chunk. The cause is an ordering bug: the lend regions are sized withPrefill::bytes_neededbefore the ring override is applied, althoughPrefill::set_ring_overridesays it must come first. Now the ring is decided first, and a start-up line shows borrowed against kept so a mismatch is visible.Nothing changes without a split or without
--resident-experts. With the override unset the lend lines are identical before and after.What changed
src/program/generate.cpp: the ring choice moves intodecide_split_ring(), called before the stage lend regions are sized (the old call site stays and does nothing a second time). The tail-slot count for a region and for the borrow is one function. New line:strata serve: lend sizing: the prompt path borrows N slots (ring R slots at chunk C), K of them keep their experts in RAM too, with aWARNINGwhen K is below N.include/strata/program/split_ring.hpp(new):split_ring_slots,split_lend_slots.src/program/split_ring_test.cpp(new) +CMakeLists.txt: CPU test (23 checks): the copy keeps every borrowed slot with the ring decided first, not with the old order.docs/MULTI_GPU.md: one paragraph.Extra Notes
Machine: 2x RTX 3080 20 GB (220 W), Xeon E5-2696 v4, 90 GiB container, UD-Q4_K_XL,
--prefill auto:16384, one restart per arm; the patched binary has none of our other patches. MemAvailable minimum during the reads: 11.98 GiB with the fix, 13.34 GiB without, both above the 2 GiB floor.Not claimed: a speed gain. Medians of three 104k reads were 2,803 (before) and 2,907 (after) tok/s, but the before arm's spread is 2,540-2,897 (its first read faulted 4.2 GB in from NVMe) and it has no A/A restart. 25k and 51k reads are equal within 1-2% (they touch none of the unkept slots). On a box with less spare page cache the 10 GB per request would be disk traffic; here the page cache absorbed it.
The setting our own deployment uses,
STRATA_PREFILL_RING=384, was never affected. 413 = 7 x 59 (7 equal chunks) is our inference, not logged. Not tested: both ring variables unset.Checked:
split_ring_test, #1190'sfile_expert_source_testandsplit_lend_complement_test, CUDA build on #1190's base. Not built: HIP, SYCL. This is a bug fix, not an opt-in: with a split and the resident RAM mode the sizing order changes for every ring choice.Context: the setup measured in the community benchmark #1640 does not use
STRATA_SPLIT_RING, so its numbers do not depend on this fix.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.