GPU: look up slot-eviction candidates by the raw texture key (part of #2778) #2890

Open
github-bot wants to merge 1 commit from github-bot/gh-2890 into main AGit
Owner

@⁠SlyWater on GitHub · 2026-11-29 18:34 UTC · original
SlyWater:fix/slot-evict-raw-key → main · +10 −2 · 1 files · 1 commits · draft

Part of #2778 (analysis and proposed change there; the author could not build it). Draft: it fixes a keyspace mismatch, but on our run it did not by itself make the sweep let textures go.

The mismatch

slot_evict builds raws keyed by the raw host texture pointer, with the title texture address as its value, and descriptor::evictable_slots returns its slots keyed the same way:

raws.insert(Interface::as_raw(&host.texture) as usize, at);   // key: raw, value: at
...
for (index, raw, ok, lately, indexed) in host.slots_showing(&set, frame, cutoff) {
    by_texture.entry(raw).or_default().push((at, index, indexed));   // key: raw
}

Both use sites looked the title address up in that raw-keyed map:

copies.retain(|&(at, ..)| slots.contains_key(&at));            // matches nothing
let (reset, busy) = crate::descriptor::evict_slots(at, &slots[&at]);   // would panic

A title address is never a key of slots, so retain emptied the candidates on every pass and the loop below ran zero times. The second site has to change with the first, or the fixed retain makes the sweep panic on the missing key.

Tested

Built and run on Windows 11, i5-12400F, RTX 3070 8 GB, title 1.0.2.1, Series S 1080p, with the change applied on main (f889bb0):

  • no crash, no panic, no behaviour change outside the sweep;
  • the sweep still reports 0 textures (0 MB) let go. Before the change it saw 30836 idle-looking with 14926 not to be taken (a slot shaders pick by index shows them); after it the same class of counters, still nothing taken, so the candidate set is empty for a second reason this change does not establish (e.g. the raw keys of those textures are not in the slots map at all).

So this removes one definite bug on the path and nothing more; it should not be read as closing #2778. A test for it can be written without the title (build raws with one entry and a slots map keyed the way evictable_slots returns it, then assert the retain keeps the copy); I have not added one here.

No game files, dumps or title logs are included.

**@⁠SlyWater** on GitHub · 2026-11-29 18:34 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2890) `SlyWater:fix/slot-evict-raw-key` → `main` · +10 −2 · 1 files · 1 commits · draft Part of #2778 (analysis and proposed change there; the author could not build it). Draft: it fixes a keyspace mismatch, but on our run it did not by itself make the sweep let textures go. ## The mismatch `slot_evict` builds `raws` keyed by the **raw host texture pointer**, with the **title texture address** as its value, and `descriptor::evictable_slots` returns its slots keyed the same way: ```rust raws.insert(Interface::as_raw(&host.texture) as usize, at); // key: raw, value: at ... for (index, raw, ok, lately, indexed) in host.slots_showing(&set, frame, cutoff) { by_texture.entry(raw).or_default().push((at, index, indexed)); // key: raw } ``` Both use sites looked the **title address** up in that raw-keyed map: ```rust copies.retain(|&(at, ..)| slots.contains_key(&at)); // matches nothing let (reset, busy) = crate::descriptor::evict_slots(at, &slots[&at]); // would panic ``` A title address is never a key of `slots`, so `retain` emptied the candidates on every pass and the loop below ran zero times. The second site has to change with the first, or the fixed `retain` makes the sweep panic on the missing key. ## Tested Built and run on Windows 11, i5-12400F, RTX 3070 8 GB, title 1.0.2.1, Series S 1080p, with the change applied on main (`f889bb0`): - no crash, no panic, no behaviour change outside the sweep; - the sweep still reports `0 textures (0 MB)` let go. Before the change it saw `30836 idle-looking` with `14926 not to be taken (a slot shaders pick by index shows them)`; after it the same class of counters, still nothing taken, so the candidate set is empty for a second reason this change does not establish (e.g. the raw keys of those textures are not in the `slots` map at all). So this removes one definite bug on the path and nothing more; it should not be read as closing #2778. A test for it can be written without the title (build `raws` with one entry and a `slots` map keyed the way `evictable_slots` returns it, then assert the `retain` keeps the copy); I have not added one here. No game files, dumps or title logs are included.
slot_evict builds raws keyed by the raw host texture pointer with the title address as the value, and descriptor::evictable_slots returns its slots keyed the same way. Both use sites looked the title address up in that map, so retain emptied the candidates on every pass and the loop below never ran: no texture was ever let go, the card climbed to its line, and runs could end on E_INVALIDARG from a command list that would not close.

Translate the title address to its raw key before the lookup, as #2778 works out. The second use site is changed with the first, or it would index a missing key.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 18:40:20 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/resource.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2890/head:github-bot/gh-2890'
git switch 'github-bot/gh-2890'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2890'
git switch 'github-bot/gh-2890'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2890'
git switch 'github-bot/gh-2890'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2890'
git switch 'main'
git merge --squash 'github-bot/gh-2890'
git switch 'main'
git merge --ff-only 'github-bot/gh-2890'
git switch 'main'
git merge 'github-bot/gh-2890'
git push origin 'main'
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!2890
No description provided.