Texture eviction: count as room only what is room (VICTORY_ROOM_BY_BLOCKS, opt-in) #3754
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3754"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Trillazill on 2026-11-30T06:01:25Z.
What this changes
The idle sweep (
resource.rs, the card's rule in the idle-copy sweep) and slot eviction both takepool::texture_room()off the card's use before comparing it with their lines.texture_room()is every free byte in the texture blocks, however scattered. A block goes back to the system only when it is completely empty (Pool::reclaim), so a copy freed inside a sparse block lowers the counted use by its size and leaves the real use unchanged. Eviction reaches its low line and stops while DXGI still reports the card over budget. This is the fault #3680 describes from reading the code at41adb551(RTX 3070: the pool grew ~1.5 GB from minute 30 to 60 while the copies alive in it grew ~70 MB).With
VICTORY_ROOM_BY_BLOCKS=1the two eviction sites use a newpool::texture_room_reusable()instead, which counts:VICTORY_POOL_FULLEST, fills those before a new block is made),and nothing for the holes of a block less than half held, which the card keeps for its last copy.
The room for new textures (
resource::room,room_for_first_upload,first_upload_headroom) is unchanged: a new texture that fits a hole does take it, andVICTORY_ROOM_REALalready guards that side.Why opt-in
Not measured in a run yet. Counting less room makes the sweeps evict more, so on a card that is fine today it could cost re-uploads. It needs a before/after on an 8 GB card (the #3680, #3688 and #3683 setups) before it can be on by default. What to compare, with
VICTORY_POOL_STATS=1: the pool's blocks and free bytes over 30–60 minutes, DXGI use against budget, and the "no room, new textures wait" count.Tests
pool::tests::only_empty_blocks_and_holes_in_half_held_ones_count_as_room(a full block, a sparse one, an empty one; holes stop counting once a block falls under half held; an emptied block counts whole again).cargo test -p victory-gpu --lib pool::: all 32 pass, the new one included.cargo test -p victory-gpu --no-fail-fast: 922 pass; 1 fails,shader_cache::tests::every_switch_of_the_translator_is_in_the_key, and it fails the same way on41adb551without this change.victory-shaderon41adb551already (unused importsPAIR_MEETINGSandanalysis::lane_regions, a loop condition never mutated), before reachingvictory-gpu. Without-D warnings, clippy reports nothing in the lines this change adds or touches.cargo test --workspace:victory-formatsfails threebcpack::tests::oracle_parity_*tests on41adb551already.cargo xtask policy --staged: ok (2 files).Main's own failures are not touched here, to keep this change to one thing.
No game data, logs or other files from the title are in this change.
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tyr0nsur on 2026-11-30T07:05:07Z.
I tested a cherry-pickable follow-up on top of
ba47955. Under the pool mutex, each block's held bytes include pieces still in REST, so an eligible block's currently reusable bytes areBLOCK - held. This keeps the same empty and half-held rules while replacing the free-range walk with one calculation per block. The test covers exactly half held, just before REST expires, and after the block falls below half held.On this Windows rig, an optimized synthetic test with 96 half-held blocks and 49,152 free ranges returned the same byte count in both implementations. Median compute-only time went from 57.4 µs to 0.057 µs per call over five alternating batches. The final patch passed 29 pool tests (3 ignored) and the staged asset-policy check. Claude Opus 5.5 reviewed the accounting invariant.
A three-way merge with #3454 conflicts in the assignment to
usedinslot_evict. If both land, use raw DXGI usage at/over budget as #3454 intends, and calleviction_room()below budget to preserve this PR's opt-in there. The idle sweep can keep this PR's existing change. #3766 merged cleanly in a local three-way merge.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Trillazill on 2026-11-30T10:36:34Z.
Thanks. I cherry-picked bba051d (now
6fbe09a, authorship kept).BLOCK - heldis the right count, sinceheldalready includes resting pieces, and moving the accounting ahead of the trace is a good catch. All 29pool::tests pass here (3 ignored), and clippy reports nothing inpool.rs.On the #3454 overlap in
slot_evict: agreed. At or over the DXGI budget use the raw usage, as #3454 intends, and below it useeviction_room(). Whichever of the two lands second should take that resolution.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ffaddd-ddd on 2026-11-30T19:11:37Z.
Tested
VICTORY_ROOM_BY_BLOCKS=1here: an 8 GB RTX 4060 Laptop. Both runs used the same cache and the same settings, so the only difference is the switch.Caveat first: neither run finished compiling. The exe built from
6fbe09a9found 5,187 pipelines the previous build's cache did not cover, and 800+ of them were still being made during play. So the frame rates are not comparable — but the pool figures are, since the pool grows from texture requests and theno roomverdict reads DXGI's figures, neither of which depends on compiling.The three things you asked for
no room, new textures waitThe block distribution is the clearest part:
That is what
reusable_free()should do: counting only the holes of blocks at least half held makes the sweeps evict sooner, so the pool stops being packed to the brim. Before, every one of the 72 blocks sat above three quarters.It ended in a device removal, but I do not think it is this PR
Just before it, six pipelines were made in 34-54 s and every one failed to load with
0x80070057:Process private bytes were 23,030 MB with 3.4-3.9 GB free on the PC.
That looks like the path
compilemem.rswarns about — several workers compiling at once, the driver's compiler finds no memory, and a failure inside a driver library cannot be caught. The PR-off run had the same 94.9% cache and the same compiling, reached 25.3 GB private and 3.1 fps, and simply did not get as far. So it is the compile-side memory, notVICTORY_ROOM_BY_BLOCKS.(Mentioning it here rather than filing anew: #3347 is the admission switch, and #3230 carries the same error string. I can add the logs there if useful.)
What I take from it
no roomfalls.Happy to produce the per-second CSVs from both runs (time, fps, frame ms, preparing, GPU, copy-back, VramInUse, queue due) if you want to plot them — say the word.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Trillazill on 2026-12-01T06:21:33Z.
Rebased onto main
5fabb46e. Conflict inresource.rs: main's slot eviction now counts throughqueue_use; the free-room part goes througheviction_room()there, which istexture_room()unlessVICTORY_ROOM_BY_BLOCKS=1, so the default is unchanged. One added commit:pool.add(0, BLOCK, 0)in the test, sincePool::addtakes the block's size on main. Tests on the rebased branch:cargo test -p victory-gpu --lib -- pool:: resource::96 pass (4 ignored);cargo clippy -p victory-gpu --lib --testsno errors.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:49:01Z.
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed