GPU: giving up a texture nulls the dynamic descriptor slots of lists recorded before #2597

Open
opened 2026-11-26 05:10:00 +00:00 by github-bot · 2 comments
Owner

@⁠BastienRodz on GitHub · 2026-11-25 16:29 UTC · original

What happens

Since 69d1e8e, resource::evict_unused gives up host textures fed from title memory: those idle for a while, and the least recently used ones while video memory is past the card's budget. It does this at the start of Host::execute. HostHeap::evict gives each heap slot viewing such a texture a null view and drops its hold on it. Since ed25c0e it finds the slots by scanning kept, which covers the dynamic slots as well: the descriptor tables a list builds for its draws (HostHeap::dynamic and make_at in draw.rs). A list that is recorded but not yet reset still owns those slots, since they are released only at reset. Its table is not made again before it runs. So its draws read a null 2D view (black, or a dimension mismatch for 3D, cube and array views), and the dynamic slot no longer holds the texture.

Expected

resource.rs (69d1e8e): "Gives up host textures gone at frame: first every heap slot viewing one gets a null view (made again when a draw or a shader reads it), then the title textures let go of it. Lists recorded before hold it until they are reset, so no GPU work reads it freed". The dynamic slots of lists not yet reset should keep their views. Title slots, and dynamic slots already released, can still be nulled.

Where

crates/victory-gpu/src/descriptor/host.rs, HostHeap::evict.

AI-assisted (Gemini 4 Neon found it, Claude Code reviewed and verified it); synthetic test only, no game data.

**@⁠BastienRodz** on GitHub · 2026-11-25 16:29 UTC · [original](https://github.com/Marvisak/VIctory/issues/2597) ### What happens Since 69d1e8e, `resource::evict_unused` gives up host textures fed from title memory: those idle for a while, and the least recently used ones while video memory is past the card's budget. It does this at the start of `Host::execute`. `HostHeap::evict` gives each heap slot viewing such a texture a null view and drops its hold on it. Since ed25c0e it finds the slots by scanning `kept`, which covers the dynamic slots as well: the descriptor tables a list builds for its draws (`HostHeap::dynamic` and `make_at` in `draw.rs`). A list that is recorded but not yet reset still owns those slots, since they are released only at reset. Its table is not made again before it runs. So its draws read a null 2D view (black, or a dimension mismatch for 3D, cube and array views), and the dynamic slot no longer holds the texture. ### Expected `resource.rs` (69d1e8e): "Gives up host textures gone at frame: first every heap slot viewing one gets a null view (made again when a draw or a shader reads it), then the title textures let go of it. Lists recorded before hold it until they are reset, so no GPU work reads it freed". The dynamic slots of lists not yet reset should keep their views. Title slots, and dynamic slots already released, can still be nulled. ### Where `crates/victory-gpu/src/descriptor/host.rs`, `HostHeap::evict`. AI-assisted (Gemini 4 Neon found it, Claude Code reviewed and verified it); synthetic test only, no game data.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:10:00 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 18:46 UTC · original · edited 2026-11-26 06:48 UTC

Automated triage for the maintainers.

Confirmed in main, in crates/victory-gpu/src/descriptor/host.rs. HostHeap::evict walks all of kept, which is sized count + extra and so includes the dynamic slots that HostHeap::make_at fills for draw tables. It nulls every slot holding an evicted texture and does not check whether the slot is still taken by a list that has not been reset (HostHeap::release only frees them at reset). A recorded list's table can therefore read a null view.

Open PRs #2598 and #2707 address this. New since the last triage: a comparison on an RTX 4070 against main 63bcca4 found both regression tests fail on main and pass with either fix. #2598 merges cleanly; #2707 conflicts in its test tail but holds locks for less time and has a GPU-readback test that could be carried over.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 18:46 UTC · [original](https://github.com/Marvisak/VIctory/issues/2597#issuecomment-7171392043) · edited 2026-11-26 06:48 UTC <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-26T04:06:40Z at=2026-11-26T07:23:00Z --> Automated triage for the maintainers. Confirmed in `main`, in `crates/victory-gpu/src/descriptor/host.rs`. `HostHeap::evict` walks all of `kept`, which is sized `count + extra` and so includes the dynamic slots that `HostHeap::make_at` fills for draw tables. It nulls every slot holding an evicted texture and does not check whether the slot is still taken by a list that has not been reset (`HostHeap::release` only frees them at reset). A recorded list's table can therefore read a null view. Open PRs #2598 and #2707 address this. **New since the last triage:** a comparison on an RTX 4070 against `main` `63bcca4` found both regression tests fail on `main` and pass with either fix. #2598 merges cleanly; #2707 conflicts in its test tail but holds locks for less time and has a GPU-readback test that could be carried over. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠pawrenity on GitHub · 2026-11-26 04:06 UTC · original

Comparative verification of #2598 and #2707 against main at 63bcca4.

Hardware: NVIDIA GeForce RTX 4070, Windows 11 (rustc 1.98.1 MSVC, debug, --locked). Unit tests only. No title run, no game data. Both regression tests reach their GPU assertions on this card and do not take the no-host early return.

PR Head Own test Fails on main (test only, no fix) Cross-tests Clippy -D warnings (victory-gpu, default + diagnostics) Merges onto main Defects found
#2598 1c356e5 live_dynamic_slots_keep_a_texture_given_up passes, at its head and merged onto main yes: a live dynamic slot keeps its view #2707's test passes with #2598's evict clean (head and merged) yes, cleanly none
#2707 fb10ff3 evict_keeps_taken_dynamic_slots_until_released passes, at its head and merged onto main (conflict resolved by hand) yes: ours + taken dynamic slot (refcount assertion) #2598's test passes with #2707's evict clean (head and merged) no: conflict in descriptor/host.rs. It is only at the end of the test module, where both sides append tests, and keeping both resolves it none blocking. Nits: see below

Full cargo test -p victory-gpu --lib, merged onto main: 230 passed, 2 failed, 1 ignored for each PR. main gives 229/2/1. The two failures (descriptor::host::tests::dynamic_slots_are_held_until_released, memory::tests::lists_share_a_table_and_copies_keep_their_views) also fail on main when run alone with --test-threads=1. They are the NVIDIA heap cap failures (#1744).

Review notes (both checked against main's HostHeap: kept has count + dynamic entries, next.1 has dynamic, made has count):

  • #2598 host.rs:787-808: skips dynamic slots still marked taken (:800). The index i - count stays within next.1. Lock order is made → next → kept. mirror takes made → kept, and dynamic/release take only next, so I found no inversion. Trade-off: made and next are now held for the whole kept scan (:793-794), so mirror and dynamic() wait during an eviction pass.
  • #2707 host.rs:787-852: title slots as before (0..count). A second pass over the dynamic range holds next → kept and nulls only released slots. Old resources are retired after the locks drop. retire takes only its own leaf lock. It holds locks for less time than #2598. Nits: it duplicates keep()'s diagnostics/retire block (:840-851 vs :520-536), and let _ = index; (:850) is a leftover. Its test is about 220 lines (FXC compile, compute dispatch, exact COM refcounts). It checks the GPU actually reads the texture through the kept slot, which #2598's test does not.
  • Both keep a taken slot's texture until the slot is made again or a later eviction finds it released, not until the list resets. #2598 says so in a comment.

Recommendation: the two fixes are functionally equivalent on these tests. Each PR's test passes with the other's fix, and both fail on main. #2598 is the smaller change and merges cleanly as is. #2707 holds locks for less time and has the stronger GPU-level test, but it needs a rebase (test tail only) and a small cleanup. Either one closes the issue. Merging #2598 is the shorter path. #2707's GPU readback test could be carried over as extra coverage.

AI-assisted (Claude Code).

**@⁠pawrenity** on GitHub · 2026-11-26 04:06 UTC · [original](https://github.com/Marvisak/VIctory/issues/2597#issuecomment-7182303095) Comparative verification of #2598 and #2707 against `main` at `63bcca4`. Hardware: NVIDIA GeForce RTX 4070, Windows 11 (rustc 1.98.1 MSVC, debug, `--locked`). Unit tests only. No title run, no game data. Both regression tests reach their GPU assertions on this card and do not take the no-host early return. | PR | Head | Own test | Fails on `main` (test only, no fix) | Cross-tests | Clippy `-D warnings` (victory-gpu, default + `diagnostics`) | Merges onto `main` | Defects found | |---|---|---|---|---|---|---|---| | #2598 | `1c356e5` | `live_dynamic_slots_keep_a_texture_given_up` passes, at its head and merged onto `main` | yes: `a live dynamic slot keeps its view` | #2707's test passes with #2598's `evict` | clean (head and merged) | yes, cleanly | none | | #2707 | `fb10ff3` | `evict_keeps_taken_dynamic_slots_until_released` passes, at its head and merged onto `main` (conflict resolved by hand) | yes: `ours + taken dynamic slot` (refcount assertion) | #2598's test passes with #2707's `evict` | clean (head and merged) | **no**: conflict in `descriptor/host.rs`. It is only at the end of the test module, where both sides append tests, and keeping both resolves it | none blocking. Nits: see below | Full `cargo test -p victory-gpu --lib`, merged onto `main`: 230 passed, 2 failed, 1 ignored for each PR. `main` gives 229/2/1. The two failures (`descriptor::host::tests::dynamic_slots_are_held_until_released`, `memory::tests::lists_share_a_table_and_copies_keep_their_views`) also fail on `main` when run alone with `--test-threads=1`. They are the NVIDIA heap cap failures (#1744). Review notes (both checked against `main`'s `HostHeap`: `kept` has `count + dynamic` entries, `next.1` has `dynamic`, `made` has `count`): - #2598 `host.rs:787-808`: skips dynamic slots still marked taken (`:800`). The index `i - count` stays within `next.1`. Lock order is `made` → `next` → `kept`. `mirror` takes `made` → `kept`, and `dynamic`/`release` take only `next`, so I found no inversion. Trade-off: `made` and `next` are now held for the whole `kept` scan (`:793-794`), so `mirror` and `dynamic()` wait during an eviction pass. - #2707 `host.rs:787-852`: title slots as before (`0..count`). A second pass over the dynamic range holds `next` → `kept` and nulls only released slots. Old resources are retired after the locks drop. `retire` takes only its own leaf lock. It holds locks for less time than #2598. Nits: it duplicates `keep()`'s diagnostics/retire block (`:840-851` vs `:520-536`), and `let _ = index;` (`:850`) is a leftover. Its test is about 220 lines (FXC compile, compute dispatch, exact COM refcounts). It checks the GPU actually reads the texture through the kept slot, which #2598's test does not. - Both keep a taken slot's texture until the slot is made again or a later eviction finds it released, not until the list resets. #2598 says so in a comment. Recommendation: the two fixes are functionally equivalent on these tests. Each PR's test passes with the other's fix, and both fail on `main`. #2598 is the smaller change and merges cleanly as is. #2707 holds locks for less time and has the stronger GPU-level test, but it needs a rebase (test tail only) and a small cleanup. Either one closes the issue. Merging #2598 is the shorter path. #2707's GPU readback test could be carried over as extra coverage. AI-assisted (Claude Code).
This discussion has been locked. Commenting is limited to contributors.
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/Marvisak--VIctory#2597
No description provided.