Texture store: bound the kept levels by host memory, and let them go at a steady pace (peak private 3.0 → 0.9 GiB under pressure) #625
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!625
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-625"
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?
@11run11 on GitHub · 2026-11-27 14:49 UTC · original
11run11:performance/T-0039-texstore-bound→a-publier· +343 −16 · 1 files · 3 commits · openWith
VICTORY_TEXTURE_STOREon, the store keeps up to 4 GiB of the larger levels in memory, whatever the host has free. On PCs with 16–32 GB that space competes with the title, which is the situation in #546 (RX 9070 XT, 32 GB, memory at the ceiling) and #600 (out of memory on 16 GB). The kept levels are a cache of files the store has already written, so they can be released under pressure and read back when needed.The change (
crates/victory-gpu/src/texstore.rsonly)kept_limit(total, headroom)sets the bound. Headroom is free commit (commit limit less commit charge), sampled at most every 250 ms withGlobalMemoryStatusEx. It wasmin(free RAM, free commit)until9e24db7; see the in-game numbers in the comments. The bound is a quarter of 4 GiB on hosts with ≤32 GiB, at most an eighth of headroom, and below 6 GiB of headroom a ramp down to nothing at 2 GiB. The ramp has no steps.trimreleases at most 64 MiB per 16 ms window, however many lookups call it, so a drop is spread over frames. Making room for a newly kept texture is still immediate (one for one).VICTORY_TEXSTORE_BOUND=0keeps the old fixed 4 GiB bound. Nothing changes while the store is off, which is the default.Tested
Windows 11, RX 9070 XT, Rust 1.98.1,
--features diagnostics.cargo test -p victory-gpu --features diagnostics: 448 passed, 0 failed. New tests:kept_limit_follows_host_memory(which also checks that the limit never rises as headroom falls),kept_evicts_least_recent_firstandkept_trims_a_large_drop_in_steps.texstore_pressure_synthetic_stream,#[ignore]) simulates a 32 GiB host whose headroom falls from 10 GiB as the title grows. Each of its 768 frames keeps a new 4 MiB texture and looks up four earlier ones. Results over 5 runs:VICTORY_TEXSTORE_BOUND=0Limits and risks
CI
Belobug's own
ci.yml, unmodified, passes on this branch in my fork (Clippy with-D warnings, default and diagnostics tests): https://github.com/11run11/VIctory-Belobug-11run/actions/runs/46033108523 (commit9e24db7).@gw1337x on GitHub · 2026-11-27 15:48 UTC · original
In-game numbers on a 32 GB PC where free RAM bottoms out at about 0.5 GB, the situation this PR targets. Memory Integrity was off.
PC: Ryzen 7 9800X3D, RX 7800 XT, 32 GB. Test: 270 s hands-off boat scene, RT off, Belobug launcher settings plus the 5 port switches, warm shader caches. Both sides ran with
VICTORY_TEXTURE_STOREpointing at the same folder, which one base run had filled first. #625 (2ff0f1d) on4eb6cfdvs4eb6cfd, interleaved (base, PR, base, PR).Sleep. What that thread waits on is not measured.AI-assisted (Claude Code); numbers from the run logs and timelines.
@11run11 on GitHub · 2026-11-27 16:22 UTC · original
Thank you, this is exactly the case I could not measure here.
My reading of it: the bound used
min(free RAM, free commit). On your PC free RAM sits at ~0.5 GB, so the limit fell to almost nothing (73/167 MB), and every miss became a synchronous read from the folder on the lookup's thread. That fits the doubled folder reads and the worse tail. Your "lowest free RAM doesn't change" row also says that letting the levels go didn't give the system any RAM back. Under RAM pressure alone, Windows pages them out anyway. What ends a title is running out of commit (E_OUTOFMEMORY, #600), and that is where the bound did help (peak commit −1.6 GB).9e24db7therefore bounds the kept levels by free commit only. The store's report line now gives the limit together with the free commit and free RAM of the last sample, so a run shows what the limit followed.If you can repeat the same interleaved runs on
9e24db7, the numbers to compare are the p95/p99 tail, the folder reads, and peak commit. If commit headroom on your PC is large, I would expect the store to hold close to its old amount: little gain there, and no tail cost.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.