Slot eviction: textures picked by index of more than one pool piece are cut to their small levels, not put to null (depends on #4580) #4851

Closed
github-bot wants to merge 6 commits from github-bot/gh-4850 into main AGit
Owner

@⁠Lyrnc on GitHub · 2026-12-01 11:36 UTC · original
Lyrnc:perf/evict-index-idle → main · +935 −32 · 6 files · 6 commits · closed without merging

Depends on #4581: its two commits (02fe88f6 and the early-run fix 981dd225) are the first two here, and this pull request is the four commits after them. Refs #3829, #1772.

What it changes

What was wrong. On main, slot eviction lets no texture go when the card is over its budget. In our 8 GB stand-in run, 27,612 of 27,804 idle-looking textures were shown by slots that shaders pick by index. evictable_slots keeps every such texture unless it trusts the sampled marks (VICTORY_SAMPLED_EVICT), and victory play turns that off. Nothing else says whether such a slot is read:

  • no draw's table shows these slots (their table stamps are 0);
  • the title seldom views a texture again from another level (808 of 47,076 copies in an earlier 10-minute run on the same PC);
  • residency priority only tells Windows what to page first.

The marks do know. In the same run, 24,924 of those 27,612 textures (2.2 GB) had been read by no shader within the idle time.

#4581 trusts the marks once the card is at 95 % of its budget and a texture has gone 1,800 frames unread. It puts the slots of such a texture back to null, as VICTORY_SAMPLED_EVICT=1 did. Each slot then shows the neutral texture until a shader marks it, the marks are read back and the texture is uploaded again. That is a flat surface for a few frames each time such a texture comes back into view, which is the foliage flicker that made victory play turn 1 off. In our run with #4581 alone, 27,358 of the 70,126 slots it put to null were read again later.

What this does. With VICTORY_SAMPLED_SHRINK (on unless 0), a texture that slot eviction takes, that only slots picked by index show, and whose copy takes more than one piece of the texture pool is cut to its small levels instead. Its slots are never put back to null.

  1. The cut copy keeps the levels that fit one piece (cut_level, CUT_PIECE: 64 KiB of the console layout). The level is counted from the copy's own first level, since many copies already start from a later level (held levels).
  2. The copy is taken out the way grow_small takes one out to grow it (retake: REPLACED, then the texture's slots are due at the next pass). The slots keep holding the old copy and go on showing it until the small copy's upload has run. Then they show the small one, the same way slots move to a grown copy (levels_changed_after, texture_views_remade).
  3. The texture's slots are watched (sampled::shrunk, kept as bits and and-ed with each readback's words). The next mark of one grows the texture back (grow_shrunk, from wake_pending, outside the presenter's lock). It is then not taken again for the protection time. While cut textures are watched, the marks are read back every 4 frames instead of every 30.
  4. Safety rule (shrink_to): only a copy that no list holds (by Arc), that was unused for the pass's idle time, that is still the copy the look found, that has no tiles and no colour twin, that is not small already, that has smaller levels to begin at, and that takes more than one piece. A texture placed at the address of one the host writes (possibly an alias's) is not cut. A texture that a draw's table also shows is not cut (cut_not_null). At most 1,024 cuts are tried per pass.
  5. Idle rule (descriptor::may_take: the retain of evictable_slots, now a function): no table showed any of its slots lately; with the marks trusted, it is shown only by slots picked by index, none of them was marked within the idle time or since the trusted frame, and the marks are known for all of them.
  6. Every texture the cut does not take goes the old way: its slots go to null and are queued again on a mark, as in #4581. That is most of them, because the host gives every texture whole 64 KiB pieces and most textures picked by index fit in one. Cutting a one-piece copy would free nothing.
  7. A memory line every 5 s: textures picked by index cut to their small levels by slot eviction (VICTORY_SAMPLED_SHRINK=1), since the start: N (X MB before the cut), M grown back as a shader read them (...); K not cut, let go the old way if they could be (one piece of the pool or no smaller level ..., ...); W slots watched for a read now.

VICTORY_SAMPLED_SHRINK=0 restores #4581 exactly. With VICTORY_SAMPLED_EVICT=0 nothing changes. It still needs the marks (VICTORY_SAMPLED_MARKS=1, which is victory play's default).

How it was tested

  • GPU and profile: RTX 5080 16 GB (driver 610.88), Ryzen 7 9800X3D, 32 GB RAM, Windows 11. Series X, 2560x1440, DLSS Quality, frame generation off, ray tracing off. victory play defaults otherwise: VICTORY_SAMPLED_MARKS=1 and VICTORY_SLOT_EVICT=1, plus VICTORY_SAMPLED_EVICT=pressure from #4581 on the two branches.
  • VICTORY_VRAM_BUDGET_MB=8192 stands in for an 8 GB card. It is not one. The driver still has 16 GB, so nothing is paged when use goes past 8,192 MB. Read "card MB in use" as what a real 8 GB card would have to page.
  • Builds: release. Main is 5fabb46e. "#4580" is this branch with VICTORY_SAMPLED_SHRINK=0, which is #4581's commit on 5fabb46e (it was not built separately). "This PR" is the branch at 88a44f33, which was on #4581's first commit only. The branch has since been rebased onto #4581's head with its early-run fix (981dd225), and nothing else changed. The fix's own startup runs are on #4581. All runs used one shader cache, preloaded and warmed on main (the branches change no shader), the same save, and a 12-minute scripted walk (walking from world+30 s to about world+660 s). Main and #4581 ran twice each, this PR once.

8 GB stand-in. Columns are world+30-330 s / 330-630 s / 630-690 s (the last is short). Where a cell has two values separated by ";", they are the two runs.

main #4581 this PR
card MB in use (median), budget 8,192 8,780 / 8,841 / 8,892; 8,698 / 8,765 / 8,782 8,344 / 8,280 / 8,029; 8,618 / 8,456 / 8,414 8,742 / 8,552 / 8,407
shared MB (median), first segment 6,077; 6,031 5,998; 6,085 6,143
texture copies MB (queue room line), first two segments 3,193 / 3,149; 3,189 / 3,144 2,404 / 2,260; 2,589 / 2,687 2,532 / 2,540
queue room line (counted use, line 7,424 MB): mean over the run / last 8,492 / 8,632; 8,534 / 8,706 7,886 / 6,733; 8,221 / 6,884 8,182 / 6,650
queue lines saying "no room, new textures wait" 130 of 135; 131 of 136 123 of 137; 125 of 136 130 of 137
textures picked by index due (median), oldest due in frames (median), first segment 1,114, 9,012; 1,055, 6,665 178, 21; 435, 3,002 594, 878
served late: frames after due, the most 463; 313 63; 55 75
slots picked by index put to null / of them read again while null 0 70,126 / 27,358; 62,453 / 27,071 66,150 / 26,803
copies cut to their small levels / grown back on a read (within 10 s) – – 3,845 (1,485 MB before the cut) / 1,507 (483)
fps 29.2 / 30.3 / 29.7; 27.2 / 28.1 / 33.3 28.2 / 30.0 / 35.1; 25.9 / 27.4 / 34.2 26.9 / 29.1 / 34.4
frames over 50 ms, per 1,000 96 / 87 / 92; 123 / 100 / 16 117 / 83 / 14; 170 / 135 / 16 148 / 107 / 22
frames over 100 ms, per 1,000 2.6 / 3.0 / 1.1; 2.3 / 1.7 / 0.0 3.6 / 1.5 / 0.0; 3.4 / 1.1 / 0.0 2.3 / 0.9 / 0.0

What this shows:

  • Main lets no texture go (slot eviction: 0, with 27,612 of 27,804 idle-looking textures blocked by slots picked by index). The card stays 500-700 MB over the budget and the queue's counted use stays over its line.
  • With #4581, with or without the cut, about 600-900 MB of texture copies go. The queue's counted use falls under its line by the end of the walk, and the queue catches up: the oldest due texture is hundreds or thousands of frames younger.
  • The cut does not change how much goes, within the spread of #4581's own two runs. What it changes: 3,845 textures of more than one pool piece kept a small copy instead of a null slot. 1,507 of them were read again later, and showed their small copy until they grew back, where with #4581 alone their slots would have shown the neutral texture until the re-upload. The textures of one piece (most of them) still go to null, as in #4581: 26,803 of those slots were read again while null.
  • Frame times are within run-to-run noise. Main's two runs differ by up to 76 frames over 50 ms per 1,000 in the same segment. The first segment had more frames over 50 ms in all three eviction runs than in either main run (117, 170, 148 against 96, 123), which may be the cost of the uploads that come back. I have too few runs to say.
  • No device removal and no error other than Streamline's usual line at the start in any run. In the first two minutes after start, 4 of the 5 runs with #4581's first commit (this PR's run among them) logged at least 200 "a texture picked by index changed after its upload with nothing to tell of it" warnings, almost all on a few low slots, right after the first evictions while the loading screen was up. Main's runs logged 2 and 15. This comes from #4581's early eviction, and the cut does not change it. Two runs of #4581's new head (981dd225) still showed it: see my comments on #4581.

16 GB (the budget as is, 15,209 MB), main and this PR, one run each: the card used 13.2-13.8 GB, 87-91 % of its budget. That is below #4581's 95 %, so neither run put anything to null or cut anything, and the eviction was the same as main's.

  • Unit tests: cargo test --locked -p victory-gpu --lib on 88a44f33: 1,103 passed, 0 failed, 66 ignored. After the rebase onto 981dd225: -- resource:: descriptor:: sampled:: 199 passed, 0 failed. In one of three full runs, host::refresh_tests::chunked_nothing_new_with_matches_individual failed. It passes alone (-- host::refresh_tests: 7 passed), and it does not touch the files this changes (a write-watch timing test). New tests:
    • descriptor::tests::the_idle_rule_takes_by_index_only_what_no_shader_read;
    • resource::tests::the_safety_rule_cuts_only_an_idle_copy_no_list_holds;
    • resource::tests::a_cut_begins_past_the_copys_own_first_level;
    • resource::tests::only_textures_picked_by_index_alone_are_cut;
    • resource::tests::a_cut_texture_keeps_its_slot_and_grows_back (on the card: a placed 512x512 texture with a slot made from its copy is cut, and the slot still shows the old copy and is never null; a copy a list holds, or one at a target's address, is not cut; the next copy is the small one; a read grows it back to the full copy, once);
    • sampled::tests::a_read_of_a_cut_slot_grows_its_texture_once.
  • cargo clippy --locked -p victory-gpu --lib --tests: no warning in the lines this changes. The five it prints are main's (host/font.rs twice, host/menu.rs, host/panel.rs twice; #4680 / #4708). cargo xtask policy: ok.
  • For shader changes, the wave sizes tested: no shader changes.
  • cargo test passed for the crates it touches: yes (victory-gpu; the change touches no other crate's code; apps/victory/src/play.rs is #4581's line).

Not tested

  • On screen. These were release builds without captures, so "small copy instead of a neutral slot" is what the logs and the GPU unit test say, not something I looked at.
  • A real 8 or 12 GB card, frame generation, and a 16 GB card past 95 % of its budget.
  • Whether a texture never read since its upload should be cut at all. In this walk, 39 % of the cut copies were read again (483 within 10 s), most likely textures the title streamed in ahead of the player. With #4581 alone they go to null the same way.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #4581 (this builds on it: #4581 decides which textures picked by index go, this changes what happens to the ones of more than one piece); #3128 and #3127 (sampled eviction by default on small cards, and its F1 item: with them, the cut applies too); #3475 (the sweep's copies that no slot shows; complementary); #4713 and #4507 (the marks' cost); #3129, #4433 and #3697 (the marks' readback and slot eviction's back-off; they do not change what this changes); #4741 (a broad 8 GB set that also touches sampled.rs; no cut).

AI use

Claude Code (Claude Opus 5.5) wrote the change, its tests and this description, and read the bench logs. The bench runs are ours, on the PC named above.

🤖 Generated with Claude Code

**@⁠Lyrnc** on GitHub · 2026-12-01 11:36 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4850) `Lyrnc:perf/evict-index-idle` → `main` · +935 −32 · 6 files · 6 commits · closed without merging Depends on #4581: its two commits (02fe88f6 and the early-run fix 981dd225) are the first two here, and this pull request is the four commits after them. Refs #3829, #1772. ## What it changes **What was wrong.** On main, slot eviction lets no texture go when the card is over its budget. In our 8 GB stand-in run, 27,612 of 27,804 idle-looking textures were shown by slots that shaders pick by index. `evictable_slots` keeps every such texture unless it trusts the sampled marks (`VICTORY_SAMPLED_EVICT`), and `victory play` turns that off. Nothing else says whether such a slot is read: - no draw's table shows these slots (their table stamps are 0); - the title seldom views a texture again from another level (808 of 47,076 copies in an earlier 10-minute run on the same PC); - residency priority only tells Windows what to page first. The marks do know. In the same run, 24,924 of those 27,612 textures (2.2 GB) had been read by no shader within the idle time. #4581 trusts the marks once the card is at 95 % of its budget and a texture has gone 1,800 frames unread. It puts the slots of such a texture back to null, as `VICTORY_SAMPLED_EVICT=1` did. Each slot then shows the neutral texture until a shader marks it, the marks are read back and the texture is uploaded again. That is a flat surface for a few frames each time such a texture comes back into view, which is the foliage flicker that made `victory play` turn `1` off. In our run with #4581 alone, 27,358 of the 70,126 slots it put to null were read again later. **What this does.** With `VICTORY_SAMPLED_SHRINK` (on unless `0`), a texture that slot eviction takes, that only slots picked by index show, and whose copy takes **more than one piece** of the texture pool is **cut to its small levels** instead. Its slots are never put back to null. 1. The cut copy keeps the levels that fit one piece (`cut_level`, `CUT_PIECE`: 64 KiB of the console layout). The level is counted from the copy's own first level, since many copies already start from a later level (held levels). 2. The copy is taken out the way `grow_small` takes one out to grow it (`retake`: `REPLACED`, then the texture's slots are due at the next pass). The slots keep holding the old copy and go on showing it until the small copy's upload has run. Then they show the small one, the same way slots move to a grown copy (`levels_changed_after`, `texture_views_remade`). 3. The texture's slots are watched (`sampled::shrunk`, kept as bits and and-ed with each readback's words). The next mark of one grows the texture back (`grow_shrunk`, from `wake_pending`, outside the presenter's lock). It is then not taken again for the protection time. While cut textures are watched, the marks are read back every 4 frames instead of every 30. 4. **Safety rule** (`shrink_to`): only a copy that no list holds (by `Arc`), that was unused for the pass's idle time, that is still the copy the look found, that has no tiles and no colour twin, that is not small already, that has smaller levels to begin at, and that takes more than one piece. A texture placed at the address of one the host writes (possibly an alias's) is not cut. A texture that a draw's table also shows is not cut (`cut_not_null`). At most 1,024 cuts are tried per pass. 5. **Idle rule** (`descriptor::may_take`: the retain of `evictable_slots`, now a function): no table showed any of its slots lately; with the marks trusted, it is shown only by slots picked by index, none of them was marked within the idle time or since the trusted frame, and the marks are known for all of them. 6. Every texture the cut does not take goes the old way: its slots go to null and are queued again on a mark, as in #4581. That is most of them, because the host gives every texture whole 64 KiB pieces and most textures picked by index fit in one. Cutting a one-piece copy would free nothing. 7. A memory line every 5 s: `textures picked by index cut to their small levels by slot eviction (VICTORY_SAMPLED_SHRINK=1), since the start: N (X MB before the cut), M grown back as a shader read them (...); K not cut, let go the old way if they could be (one piece of the pool or no smaller level ..., ...); W slots watched for a read now`. `VICTORY_SAMPLED_SHRINK=0` restores #4581 exactly. With `VICTORY_SAMPLED_EVICT=0` nothing changes. It still needs the marks (`VICTORY_SAMPLED_MARKS=1`, which is `victory play`'s default). ## How it was tested - GPU and profile: RTX 5080 16 GB (driver 610.88), Ryzen 7 9800X3D, 32 GB RAM, Windows 11. Series X, 2560x1440, DLSS Quality, frame generation off, ray tracing off. `victory play` defaults otherwise: `VICTORY_SAMPLED_MARKS=1` and `VICTORY_SLOT_EVICT=1`, plus `VICTORY_SAMPLED_EVICT=pressure` from #4581 on the two branches. - **`VICTORY_VRAM_BUDGET_MB=8192` stands in for an 8 GB card. It is not one.** The driver still has 16 GB, so nothing is paged when use goes past 8,192 MB. Read "card MB in use" as what a real 8 GB card would have to page. - Builds: release. Main is 5fabb46e. "#4580" is this branch with `VICTORY_SAMPLED_SHRINK=0`, which is #4581's commit on 5fabb46e (it was not built separately). "This PR" is the branch at 88a44f33, which was on #4581's first commit only. The branch has since been rebased onto #4581's head with its early-run fix (981dd225), and nothing else changed. The fix's own startup runs are on #4581. All runs used one shader cache, preloaded and warmed on main (the branches change no shader), the same save, and a 12-minute scripted walk (walking from world+30 s to about world+660 s). Main and #4581 ran twice each, this PR once. 8 GB stand-in. Columns are world+30-330 s / 330-630 s / 630-690 s (the last is short). Where a cell has two values separated by ";", they are the two runs. | | main | #4581 | this PR | |---|---|---|---| | card MB in use (median), budget 8,192 | 8,780 / 8,841 / 8,892; 8,698 / 8,765 / 8,782 | 8,344 / 8,280 / 8,029; 8,618 / 8,456 / 8,414 | 8,742 / 8,552 / 8,407 | | shared MB (median), first segment | 6,077; 6,031 | 5,998; 6,085 | 6,143 | | texture copies MB (queue room line), first two segments | 3,193 / 3,149; 3,189 / 3,144 | 2,404 / 2,260; 2,589 / 2,687 | 2,532 / 2,540 | | queue room line (counted use, line 7,424 MB): mean over the run / last | 8,492 / 8,632; 8,534 / 8,706 | 7,886 / 6,733; 8,221 / 6,884 | 8,182 / 6,650 | | queue lines saying "no room, new textures wait" | 130 of 135; 131 of 136 | 123 of 137; 125 of 136 | 130 of 137 | | textures picked by index due (median), oldest due in frames (median), first segment | 1,114, 9,012; 1,055, 6,665 | 178, 21; 435, 3,002 | 594, 878 | | served late: frames after due, the most | 463; 313 | 63; 55 | 75 | | slots picked by index put to null / of them read again while null | 0 | 70,126 / 27,358; 62,453 / 27,071 | 66,150 / 26,803 | | copies cut to their small levels / grown back on a read (within 10 s) | – | – | 3,845 (1,485 MB before the cut) / 1,507 (483) | | fps | 29.2 / 30.3 / 29.7; 27.2 / 28.1 / 33.3 | 28.2 / 30.0 / 35.1; 25.9 / 27.4 / 34.2 | 26.9 / 29.1 / 34.4 | | frames over 50 ms, per 1,000 | 96 / 87 / 92; 123 / 100 / 16 | 117 / 83 / 14; 170 / 135 / 16 | 148 / 107 / 22 | | frames over 100 ms, per 1,000 | 2.6 / 3.0 / 1.1; 2.3 / 1.7 / 0.0 | 3.6 / 1.5 / 0.0; 3.4 / 1.1 / 0.0 | 2.3 / 0.9 / 0.0 | What this shows: - Main lets no texture go (slot eviction: 0, with 27,612 of 27,804 idle-looking textures blocked by slots picked by index). The card stays 500-700 MB over the budget and the queue's counted use stays over its line. - With #4581, with or without the cut, about 600-900 MB of texture copies go. The queue's counted use falls under its line by the end of the walk, and the queue catches up: the oldest due texture is hundreds or thousands of frames younger. - The cut does not change how much goes, within the spread of #4581's own two runs. What it changes: 3,845 textures of more than one pool piece kept a small copy instead of a null slot. 1,507 of them were read again later, and showed their small copy until they grew back, where with #4581 alone their slots would have shown the neutral texture until the re-upload. The textures of one piece (most of them) still go to null, as in #4581: 26,803 of those slots were read again while null. - Frame times are within run-to-run noise. Main's two runs differ by up to 76 frames over 50 ms per 1,000 in the same segment. The first segment had more frames over 50 ms in all three eviction runs than in either main run (117, 170, 148 against 96, 123), which may be the cost of the uploads that come back. I have too few runs to say. - No device removal and no error other than Streamline's usual line at the start in any run. In the first two minutes after start, 4 of the 5 runs with #4581's first commit (this PR's run among them) logged at least 200 "a texture picked by index changed after its upload with nothing to tell of it" warnings, almost all on a few low slots, right after the first evictions while the loading screen was up. Main's runs logged 2 and 15. This comes from #4581's early eviction, and the cut does not change it. Two runs of #4581's new head (981dd225) still showed it: see my comments on #4581. 16 GB (the budget as is, 15,209 MB), main and this PR, one run each: the card used 13.2-13.8 GB, 87-91 % of its budget. That is below #4581's 95 %, so neither run put anything to null or cut anything, and the eviction was the same as main's. - Unit tests: `cargo test --locked -p victory-gpu --lib` on 88a44f33: 1,103 passed, 0 failed, 66 ignored. After the rebase onto 981dd225: `-- resource:: descriptor:: sampled::` 199 passed, 0 failed. In one of three full runs, `host::refresh_tests::chunked_nothing_new_with_matches_individual` failed. It passes alone (`-- host::refresh_tests`: 7 passed), and it does not touch the files this changes (a write-watch timing test). New tests: - `descriptor::tests::the_idle_rule_takes_by_index_only_what_no_shader_read`; - `resource::tests::the_safety_rule_cuts_only_an_idle_copy_no_list_holds`; - `resource::tests::a_cut_begins_past_the_copys_own_first_level`; - `resource::tests::only_textures_picked_by_index_alone_are_cut`; - `resource::tests::a_cut_texture_keeps_its_slot_and_grows_back` (on the card: a placed 512x512 texture with a slot made from its copy is cut, and the slot still shows the old copy and is never null; a copy a list holds, or one at a target's address, is not cut; the next copy is the small one; a read grows it back to the full copy, once); - `sampled::tests::a_read_of_a_cut_slot_grows_its_texture_once`. - `cargo clippy --locked -p victory-gpu --lib --tests`: no warning in the lines this changes. The five it prints are main's (`host/font.rs` twice, `host/menu.rs`, `host/panel.rs` twice; #4680 / #4708). `cargo xtask policy`: ok. - For shader changes, the wave sizes tested: no shader changes. - `cargo test` passed for the crates it touches: yes (`victory-gpu`; the change touches no other crate's code; `apps/victory/src/play.rs` is #4581's line). ### Not tested - On screen. These were release builds without captures, so "small copy instead of a neutral slot" is what the logs and the GPU unit test say, not something I looked at. - A real 8 or 12 GB card, frame generation, and a 16 GB card past 95 % of its budget. - Whether a texture never read since its upload should be cut at all. In this walk, 39 % of the cut copies were read again (483 within 10 s), most likely textures the title streamed in ahead of the player. With #4581 alone they go to null the same way. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #4581 (this builds on it: #4581 decides which textures picked by index go, this changes what happens to the ones of more than one piece); #3128 and #3127 (sampled eviction by default on small cards, and its F1 item: with them, the cut applies too); #3475 (the sweep's copies that no slot shows; complementary); #4713 and #4507 (the marks' cost); #3129, #4433 and #3697 (the marks' readback and slot eviction's back-off; they do not change what this changes); #4741 (a broad 8 GB set that also touches `sampled.rs`; no cut). ## AI use Claude Code (Claude Opus 5.5) wrote the change, its tests and this description, and read the bench logs. The bench runs are ours, on the PC named above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
With the marks trusted (VICTORY_SAMPLED_EVICT, `pressure` since the commit
before), slot eviction takes textures shown only by slots shaders pick by
index that no shader read for a minute. It put those slots back to null:
each showed the neutral texture until a shader marked it, the marks were
read back and the texture was uploaded again, a few frames of a flat
surface at every texture that came back into view (the foliage flicker
that had play turn VICTORY_SAMPLED_EVICT=1 off).

Now such a texture is cut to its small levels (small_base, 256 KiB of the
console layout at most): its copy is taken out as grow_small takes one out
(retake: REPLACED, then its slots due at the next pass), the slots go on
showing the copy they hold until the small one's upload has run, and then
show the small one. They are watched (sampled::shrunk): the next mark of
one grows the texture back (grow_shrunk, from wake_pending), and it is not
taken again for the protection time. The readback runs every 4 frames
while cut textures are watched.

- Safety rule (shrink_to): no list holds the copy (Arc), unused for the
  pass's idle time, still the copy the look found, no tiles or colour
  twin, not small already, smaller levels to begin at; not a texture
  placed at a target's address (an alias's). Never a null slot.
- Idle rule (descriptor::may_take, the retain of evictable_slots as a
  function): a table showed none of its slots lately; with the marks
  trusted, only slots picked by index, none marked within the idle time
  nor since the trusted frame, the marks known for all of them.
- Only textures whose every slot is picked by index are cut; others go the
  old way. At most 1,024 cuts tried a pass. Copies made small already are
  not looked at while the cut is on.
- Memory line: "textures picked by index cut to their small levels by
  slot eviction (VICTORY_SAMPLED_SHRINK=1), since the start: ...".
- VICTORY_SAMPLED_SHRINK=0: slots put back to null, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Some 14,000 slots are marked in each readback (every 4 frames) of an 8 GB
card's walk; looking each up in the map of watched slots cost about a
millisecond under the presenter's lock. The slots of cut textures are now
also kept as bits laid as the marks are, so a readback finds the watched
slots it marked by a word's and, as #4740 does for the slots put to null.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
In game (RTX 5080, Series X 1440p, VICTORY_VRAM_BUDGET_MB=8192, 12-minute
walk) the cut took 39 textures and turned 279,482 tries down: most
textures picked by index take one 64 KiB piece of the pool (the host
gives every texture whole pieces), and many copies are held from a later
level already, at or past the 256 KiB small copy's first level, so there
was nothing to cut.

- The cut's level is measured from the copy's own first level
  (cut_level): the first level past it whose levels fit one piece
  (CUT_PIECE, 64 KiB of the console layout).
- Only a copy of more than one piece is cut; cut, one of a piece frees
  nothing. A copy that is not cut goes the old way (slots to null, queued
  again on a mark), which asks its own questions, instead of being kept.
- The memory line says why copies were not cut (SHRINK_WHY).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The cap of 1,024 tries a pass counted every texture shown only by slots
picked by index, the copies of one pool piece that go the old way
included. Those are most of them, so in game it held the old way (slots
to null) to 1,024 textures a pass, and the card stayed over the queue's
line where #4580 alone went under it.

The look notes each victim's bytes; only a copy of more than one piece is
tried for the cut and counted. One of a piece goes the old way at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 11:37:33 +00:00
github-bot force-pushed github-bot/gh-4850 from 88a44f3326 to 6650e3485c 2026-12-01 12:21:38 +00:00 Compare
github-bot closed this pull request 2026-12-01 18:36:24 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:30 UTC · original

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.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:30 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4850#issuecomment-7321063990) 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

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4851
No description provided.