mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1324] file tier: an LRU part of the RAM budget (--resident-lru-gib), elastic under memory pressure (Windows) #3383
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#3383
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/1324
Author: @malloc32
Created: 10/7/2026
Status: 🔄 Open
Base:
main← Head:pr/ram-tier-lru📝 Commits (10+)
d3659bcprefill: batched unbuffered expert reads in the stager; close the experts.bin view once reads are unbuffered24bd585file tier: STRATA_STAGE_KEEP_MIB keeps recently read expert blobs across decode windows (experiment)f8d0d27file tier: the prompt path copies a blob the stage pool holds instead of reading the drive again46baaa6file tier: --resident-lru-gib keeps part of the RAM budget as an LRU of the experts the decode reads8bb4a68file tier: STRATA_TIER_TRACE writes every expert blob served outside the GPU caches (measurement)8d47932file tier: the tier trace says which part of the engine read each blob (decode, prompt path, fills)23d2726file tier: STRATA_LRU_OFFER=1 offers the RAM tier's idle LRU buffers to Windows instead of keeping them49716f4file tier: STRATA_LRU_KEEP_FREE_GIB makes the RAM tier's LRU elasticd1a3710file tier: the elastic LRU keeps at least 1 GiBc470b83file tier: drop the offered-LRU experiment (STRATA_LRU_OFFER); the elastic LRU replaces it📊 Changes
5 files changed (+506 additions, -32 deletions)
View changed files
➕
bench/results/2026-10-07-windows-ram-tier-lru/README.md(+84 -0)📝
include/strata/core/expert_source.hpp(+65 -1)📝
src/core/expert_source.cpp(+262 -12)📝
src/prefill/prefill.cpp(+45 -18)📝
src/program/generate.cpp(+50 -1)📄 Description
AI-written. This PR was prepared by an AI (Claude Opus 5.5, via Claude Code) at the submitter's request: design, code and every measurement were done by the AI on the submitter's machine, and the submitter reviewed it before opening.
Depends on #1323 (the #833 port is this branch's first commit); review that one first.
Update 2026-10-07: rebased onto 0.1.40.2 (
e8ca9af) together with #1323. New commit: on Windows the elastic watcher keeps commit available as well as RAM (every LRU buffer is committed memory; here the commit charge reached 112-120 of 121 GiB while serving with 8-9 GB of RAM free). The release's I/O prefetch flag (stage_pf_) is cleared when the LRU frees a buffer. Measured on 0.1.40.2 with the production config: decode 72.9 tok/s against 71.4 for the 0.1.40.1-based build, prompts unchanged.What
--resident-budget-gibfills the RAM once from the global expert profile, so a conversation on another topic keeps reading the drive for experts that are cold in the profile but hot for it.--resident-lru-gib L: L GiB of the budget hold the experts the decode reads from the files, least recently used out first (the unbuffered reads' stage pool). The prompt path copies from it but never adds to it or refreshes it: a prompt chunk sweeps every cold expert once and would push out what the decode reuses.STRATA_LRU_KEEP_FREE_GIB=G: the LRU is elastic. A watcher frees the coldest buffers when the available RAM (on Windows also the available commit) falls below G (back to the OS at once, never paged) and grows the pool back a GiB at a time when RAM is free again. It never shrinks below 1 GiB.STRATA_TIER_TRACE=<file>: one line per expert served outside the GPU caches. It is how the policy was chosen: replaying a traced session against same-size policies, the decode-fed LRU cut the decode's drive reads by ~45%.The serve log reports the LRU's hits and, when elastic, what it holds and what it gave back. Without the flag and the variable nothing changes.
Measured
Full tables and method in
bench/results/2026-10-07-windows-ram-tier-lru/. IQ3_S, 2x RTX 5060 Ti, i7-12700K, 64 GB:Tried and not in this PR: offering idle buffers to Windows (
OfferVirtualMemory) halved decode speed; a routing lookahead reading the predicted blobs tripled the bytes read.Not tested
The elastic watcher on Linux (it uses
MemAvailable; only Windows was measured). HIP.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.