Invalidate cached buffer lookups at registration and idle sweep #1242

Open
UwUCammie wants to merge 2 commits from upstream-pr/1245 into main
UwUCammie commented 2026-11-26 01:46:18 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by UwUCammie on 2026-11-26T01:46:18Z.


This follows the lookup cache imported in 32be36d. Registration could publish its new generation while a recording thread could still see the old table. A lookup could also upgrade a weak reference to a loose window after the idle sweep removed it and before it dropped its last reference.

Registration now publishes under the table lock after insertion. A cached loose window is checked against the window table and marked in use under the same lock as the idle sweep. Registered-buffer hits keep their fast path. The existing 0, 1 and alt modes stay available.

Both focused regressions fail on the original contributor branch and pass with these fixes under Wine 11.22 on the RX 7900 XT (RADV 26.3.1). The registration case uses no GPU. The sweep case uses a synthetic window. The patch also builds against 7496a4c.

Four first-room pairs on the patched contributor branch gave 6.02 FPS with the cache off and 6.01 with it on, with 132 million cached lookups in the enabled blocks. Those measurements compare the switch settings on the patched binary. Run details · Contributor PR

<!-- greyfinch-sync:fxceless/victory-fork:issue:6617642686 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1245). Originally posted by [UwUCammie](https://github.com/UwUCammie) on 2026-11-26T01:46:18Z. --- This follows the lookup cache imported in `32be36d`. Registration could publish its new generation while a recording thread could still see the old table. A lookup could also upgrade a weak reference to a loose window after the idle sweep removed it and before it dropped its last reference. Registration now publishes under the table lock after insertion. A cached loose window is checked against the window table and marked in use under the same lock as the idle sweep. Registered-buffer hits keep their fast path. The existing `0`, `1` and `alt` modes stay available. Both focused regressions fail on the original contributor branch and pass with these fixes under Wine 11.22 on the RX 7900 XT (RADV 26.3.1). The registration case uses no GPU. The sweep case uses a synthetic window. The patch also builds against `7496a4c`. Four first-room pairs on the patched contributor branch gave 6.02 FPS with the cache off and 6.01 with it on, with 132 million cached lookups in the enabled blocks. Those measurements compare the switch settings on the patched binary. [Run details](https://github.com/UwUCammie/victory-amd/blob/ff88d27/benchmarks/README.md#profiling-after-the-comparison) · [Contributor PR](https://github.com/KyleS98/victory-fork/pull/5)
UwUCammie commented 2026-11-26 02:08:44 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by UwUCammie on 2026-11-26T01:47:23Z.


I also ran the two tests on this PR head (7b42ef2) on the RX 7900 XT. Both passed in three separate-process pairs and in three grouped runs. One Wine process per pair cut the median wall time from 9.71 to 4.92 seconds. Exact command and timings

<!-- greyfinch-sync:fxceless/victory-fork:comment:7180132005 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1245#issuecomment-7180132005). Originally posted by [UwUCammie](https://github.com/UwUCammie) on 2026-11-26T01:47:23Z. --- I also ran the two tests on this PR head (`7b42ef2`) on the RX 7900 XT. Both passed in three separate-process pairs and in three grouped runs. One Wine process per pair cut the median wall time from 9.71 to 4.92 seconds. [Exact command and timings](https://github.com/UwUCammie/victory-amd/blob/fccf829/benchmarks/README.md#running-focused-windows-tests-together)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1245:upstream-pr/1245'
git switch 'upstream-pr/1245'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1245'
git switch 'upstream-pr/1245'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1245'
git switch 'upstream-pr/1245'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1245'
git switch 'main'
git merge --squash 'upstream-pr/1245'
git switch 'main'
git merge --ff-only 'upstream-pr/1245'
git switch 'main'
git merge 'upstream-pr/1245'
git push origin 'main'
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
fxceless/victory-fork!1242
No description provided.