fix: let idle textures go from the texture queue's share (8 GB preset gap) #465

Merged
KainanP merged 1 commit from upstream-pr/465 into main 2026-11-27 15:42:35 +00:00
KainanP commented 2026-11-27 00:11:03 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by KainanP on 2026-11-27T00:11:03Z.


Fixes #449.

The bug, on the Vice-Tay base (b6d86cf8)

akimfomin re-checked it on #454's base and it is still there. resource::room() refuses new host copies of textures once the card's use (the same card_use count in both places) reaches VICTORY_TEXTURE_ROOM_PERCENT of the budget. That is 85 % with the 8 GB preset. host::vram_keep() keeps idle copies for 600 s until a fixed 88 %. Between 85 and 88 % every new texture was refused while idle copies stayed for ten minutes.

The change

  • vram_keep(budget, used, room_percent): letting go starts at min(room_percent, 88) and comes down to 3 points below that start (the old 88 → 85 gap). The 95 % short-time line (1.5 s) stays.
  • room() and let_go_idle() now share one card_use() count and one under_share() test, so admission and reclamation can't drift apart again.
  • The sweep loop is split out of let_go_idle() as let_go(all, idle_ms, most) with no change in behaviour, so a test can run it on one texture.

Behaviour changes

VICTORY_TEXTURE_ROOM_PERCENT Sweep before Sweep now
unset (90), or 88 to 97 from 88 %, down to 85 % unchanged
85 (8 GB preset) from 88 %, down to 85 % from 85 %, down to 82 %
n < 88 from 88 %, down to 85 % from n %, down to n−3 %

Only the 8 GB preset (and anyone who sets a share below 88 by hand) behaves differently. On those setups idle copies of textures now go after 5 s from the moment the queue is refused. The cost is that a copy which goes and is needed again gets made and uploaded again. That trade is what needs measuring (below).

The 8 GB preset's 1024 texel cap (moved to #506)

An earlier second commit here dropped VICTORY_TEXTURE_MAX_SIZE from the 8 GB and 12 GB presets, because the Vice-Tay base didn't read it. I've removed that commit. #506 makes the cap work on this base instead (ported from the Neptune-base implementation, with a VRAM churn bench on an RTX 4060 Laptop). So this PR now touches only host.rs and resource.rs, and the two don't conflict.

Tests (rule 5)

  • resource::tests::an_idle_copy_goes_once_the_texture_queue_is_refused follows akimfomin's suggestion and runs on the host device. It makes a 256×256 BC7 host copy that its title texture alone holds: no list, no slot, never submitted, so its fence is done. Its last use is backdated past 5 s and 4 frames. Only the usage row changes (card_use fixed by construction, 6,823 MiB budget as in #396, share 85):
    • 84 %: admitted, kept (the ten-minute rule);
    • 86 %: refused, and the idle copy goes;
    • 88 %: refused and goes (positive control, true before the change as well).
  • resource::tests::a_refused_queue_never_keeps_idle_copies_for_minutes: for every share from 50 to 97 and every use from 0 to 110 %, if room refuses, the sweep lets idle copies go within 5 s.
  • host::batch::textures_go_from_where_the_queue_is_refused: vram_keep rows at shares 85 and 50. textures_are_kept_while_the_card_has_room now checks the old rows at 88, 90 and 97 to show nothing changed there.
  • They fail on main's policy. With vram_keep forced back to the fixed 88 % start, the three new tests fail. The device test gets (false, true) at 86 %: refused, and the copy is kept.

Run here (RTX 4060 Laptop GPU, Intel UHD iGPU, WARP):

result
cargo test -p victory-gpu --lib --release --features diagnostics, RTX 480 passed in most runs. Over 41 full runs, 3 had one failure in a watch.rs write-watch timing test (no_write_is_lost_with_port_7, what_the_kernel_writes_through_is_not_guarded_for_another_view), each passing on rerun. One run hung and was killed after 9 minutes; 25 later runs with a 90 s timeout didn't reproduce it. watch.rs isn't touched here, and main shows the same kind of failure (nothing_is_guarded_between_our_forgetting_it_and_its_unmapping, 1 in 112 runs), but the rate here was higher, so I'm flagging it rather than calling it noise
same, VICTORY_D3D12_ADAPTER=Intel 480 passed
same, VICTORY_D3D12_WARP=1 480 passed
device test alone, per adapter runs on all three (about 5 s each; it returns at once without a host)
cargo clippy victory-gpu (lib + tests) / launcher no new warnings (victory-gpu: the same overlay.rs is_multiple_of one as main)
cargo xtask policy 285 files ok
cargo build --release --workspace --exclude anyxboxx-launcher (CI step) ok
ruff (W605,F,E9), pytest test_launcher, test_site, test_readme_sync, test_launch, test_lanceur_victory clean; 25 passed, 17 skipped

Asking for an A/B on an 8 GB card

I don't have an 8 GB card. Could someone who owns one (an RTX 5060 8 GB like #396's, or similar) run the 8 GB preset on main and on this branch? The useful numbers are the ones listed in #449's "done when": texture refusals, local and non-local memory in use, how many textures are let go and made again (sweep: trail lines, card accounting), and frame times (VICTORY_FRAMETIME_DUMP=1). The risk to watch for is a let-go/re-upload cycle between 82 and 85 %.

Credit: FunWithFlagsDev for the analysis in #449, and akimfomin for re-checking it on the Vice-Tay base, spotting the unread cap and proposing the test.

AI use: code, tests and this description written with Claude Code; tests run locally on RTX, Intel UHD and WARP; nothing was run in game.

🤖 Generated with Claude Code

<!-- greyfinch-sync:LooperSalty/AnyXboxX:issue:5518949384 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/465). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T00:11:03Z. --- Fixes #449. ## The bug, on the Vice-Tay base (`b6d86cf8`) akimfomin re-checked it on #454's base and it is still there. `resource::room()` refuses new host copies of textures once the card's use (the same `card_use` count in both places) reaches `VICTORY_TEXTURE_ROOM_PERCENT` of the budget. That is 85 % with the 8 GB preset. `host::vram_keep()` keeps idle copies for 600 s until a fixed 88 %. Between 85 and 88 % every new texture was refused while idle copies stayed for ten minutes. ## The change - `vram_keep(budget, used, room_percent)`: letting go starts at `min(room_percent, 88)` and comes down to 3 points below that start (the old 88 → 85 gap). The 95 % short-time line (1.5 s) stays. - `room()` and `let_go_idle()` now share one `card_use()` count and one `under_share()` test, so admission and reclamation can't drift apart again. - The sweep loop is split out of `let_go_idle()` as `let_go(all, idle_ms, most)` with no change in behaviour, so a test can run it on one texture. ### Behaviour changes | `VICTORY_TEXTURE_ROOM_PERCENT` | Sweep before | Sweep now | |---|---|---| | unset (90), or 88 to 97 | from 88 %, down to 85 % | **unchanged** | | 85 (8 GB preset) | from 88 %, down to 85 % | from 85 %, down to 82 % | | n < 88 | from 88 %, down to 85 % | from n %, down to n−3 % | Only the 8 GB preset (and anyone who sets a share below 88 by hand) behaves differently. On those setups idle copies of textures now go after 5 s from the moment the queue is refused. The cost is that a copy which goes and is needed again gets made and uploaded again. That trade is what needs measuring (below). ### The 8 GB preset's 1024 texel cap (moved to #506) An earlier second commit here dropped `VICTORY_TEXTURE_MAX_SIZE` from the 8 GB and 12 GB presets, because the Vice-Tay base didn't read it. I've removed that commit. #506 makes the cap work on this base instead (ported from the Neptune-base implementation, with a VRAM churn bench on an RTX 4060 Laptop). So this PR now touches only `host.rs` and `resource.rs`, and the two don't conflict. ## Tests (rule 5) - `resource::tests::an_idle_copy_goes_once_the_texture_queue_is_refused` follows akimfomin's suggestion and runs on the host device. It makes a 256×256 BC7 host copy that its title texture alone holds: no list, no slot, never submitted, so its fence is done. Its last use is backdated past 5 s and 4 frames. Only the usage row changes (`card_use` fixed by construction, 6,823 MiB budget as in #396, share 85): - 84 %: admitted, kept (the ten-minute rule); - **86 %: refused, and the idle copy goes**; - 88 %: refused and goes (positive control, true before the change as well). - `resource::tests::a_refused_queue_never_keeps_idle_copies_for_minutes`: for every share from 50 to 97 and every use from 0 to 110 %, if `room` refuses, the sweep lets idle copies go within 5 s. - `host::batch::textures_go_from_where_the_queue_is_refused`: `vram_keep` rows at shares 85 and 50. `textures_are_kept_while_the_card_has_room` now checks the old rows at 88, 90 and 97 to show nothing changed there. - **They fail on main's policy.** With `vram_keep` forced back to the fixed 88 % start, the three new tests fail. The device test gets `(false, true)` at 86 %: refused, and the copy is kept. Run here (RTX 4060 Laptop GPU, Intel UHD iGPU, WARP): | | result | |---|---| | `cargo test -p victory-gpu --lib --release --features diagnostics`, RTX | 480 passed in most runs. Over 41 full runs, 3 had one failure in a `watch.rs` write-watch timing test (`no_write_is_lost_with_port_7`, `what_the_kernel_writes_through_is_not_guarded_for_another_view`), each passing on rerun. One run hung and was killed after 9 minutes; 25 later runs with a 90 s timeout didn't reproduce it. `watch.rs` isn't touched here, and main shows the same kind of failure (`nothing_is_guarded_between_our_forgetting_it_and_its_unmapping`, 1 in 112 runs), but the rate here was higher, so I'm flagging it rather than calling it noise | | same, `VICTORY_D3D12_ADAPTER=Intel` | 480 passed | | same, `VICTORY_D3D12_WARP=1` | 480 passed | | device test alone, per adapter | runs on all three (about 5 s each; it returns at once without a host) | | `cargo clippy` victory-gpu (lib + tests) / launcher | no new warnings (victory-gpu: the same `overlay.rs` `is_multiple_of` one as main) | | `cargo xtask policy` | 285 files ok | | `cargo build --release --workspace --exclude anyxboxx-launcher` (CI step) | ok | | ruff (`W605,F,E9`), pytest `test_launcher`, `test_site`, `test_readme_sync`, `test_launch`, `test_lanceur_victory` | clean; 25 passed, 17 skipped | ## Asking for an A/B on an 8 GB card I don't have an 8 GB card. Could someone who owns one (an RTX 5060 8 GB like #396's, or similar) run the 8 GB preset on `main` and on this branch? The useful numbers are the ones listed in #449's "done when": texture refusals, local and non-local memory in use, how many textures are let go and made again (`sweep:` trail lines, card accounting), and frame times (`VICTORY_FRAMETIME_DUMP=1`). The risk to watch for is a let-go/re-upload cycle between 82 and 85 %. Credit: FunWithFlagsDev for the analysis in #449, and akimfomin for re-checking it on the Vice-Tay base, spotting the unread cap and proposing the test. _AI use: code, tests and this description written with Claude Code; tests run locally on RTX, Intel UHD and WARP; nothing was run in game._ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
akimfomin commented 2026-11-27 01:01:22 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by akimfomin on 2026-11-27T01:01:22Z.


Your 84/86/88 regression now gives the receiving team a runnable 86% failure case, and the unread cap is no longer advertised. I checked the exact #465 head f9e4260 against current main 4340aac; the Git merge is clean.

For the 8 GB A/B you asked for, PortBridge Test Lab #107 has the exact pair, the host synthetic control, and the eviction/recreation counters needed to check the 82–85% churn risk. A volunteer can give the link to their agent and send aggregates. We can return the attributed result here. The report distinguishes your existing test coverage from this outstanding timing question.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7206944934 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/465#issuecomment-7206944934). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-27T01:01:22Z. --- Your 84/86/88 regression now gives the receiving team a runnable 86% failure case, and the unread cap is no longer advertised. I checked the exact #465 head `f9e4260` against [current main `4340aac`](https://github.com/LooperSalty/AnyXboxX/commit/4340aac1a494b9649c00e0e1ad2c6fbe6ea00e80); the Git merge is clean. For the 8 GB A/B you asked for, [PortBridge Test Lab #107](https://github.com/akimfomin/PortBridge/issues/107) has the exact pair, the host synthetic control, and the eviction/recreation counters needed to check the 82–85% churn risk. A volunteer can give the link to their agent and send aggregates. We can return the attributed result here. The report distinguishes your existing test coverage from this outstanding timing question.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
LooperSalty/AnyXboxX!465
No description provided.