GPU: find enclosing buffers behind shorter registrations #1142

Open
github-bot wants to merge 2 commits from github-bot/gh-1142 into main AGit
Owner

@⁠UwUCammie on GitHub · 2026-11-25 21:33 UTC · original
UwUCammie:pr/shadow-containing-ranges → main · +143 −29 · 1 files · 2 commits · open

A view can fall inside a registered buffer even when 64 more recent starts lie between the buffer and the view. If those shorter buffers end before the view does, the lookup used to miss the enclosing buffer and make a separate window over the same bytes. The remap path had a similar cutoff at 256 entries. It also missed a placed window starting more than one 4 MiB grid cell before the remap.

The registered-buffer search checks the nearest start first. Beyond one 64 KiB page it checks only buffers longer than a page, stopping when even the longest registered buffer could not reach the request. The latest start that contains the full view still wins. Remapping checks placed windows against their full extents.

Three synthetic regressions cover 300 short intervals inside a larger one, replacing and removing long buffers, half-open boundaries and a remap in the third cell of a window. All 33 shadow tests and 22 tests matching host::tests passed in the Windows x64 diagnostics build under Wine 11.22. I haven’t measured how often these misses occur in gameplay.

**@⁠UwUCammie** on GitHub · 2026-11-25 21:33 UTC · [original](https://github.com/fxceless/victory-fork/pull/1142) `UwUCammie:pr/shadow-containing-ranges` → `main` · +143 −29 · 1 files · 2 commits · open A view can fall inside a registered buffer even when 64 more recent starts lie between the buffer and the view. If those shorter buffers end before the view does, the lookup used to miss the enclosing buffer and make a separate window over the same bytes. The remap path had a similar cutoff at 256 entries. It also missed a placed window starting more than one 4 MiB grid cell before the remap. The registered-buffer search checks the nearest start first. Beyond one 64 KiB page it checks only buffers longer than a page, stopping when even the longest registered buffer could not reach the request. The latest start that contains the full view still wins. Remapping checks placed windows against their full extents. Three synthetic regressions cover 300 short intervals inside a larger one, replacing and removing long buffers, half-open boundaries and a remap in the third cell of a window. All 33 shadow tests and 22 tests matching `host::tests` passed in the Windows x64 diagnostics build under Wine 11.22. I haven’t measured how often these misses occur in gameplay.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:58:20 +00:00
Author
Owner

@⁠Filip722 on GitHub · 2026-11-25 23:56 UTC · original

I ran the three shadow::buffer_map_tests:: regressions from 1c0377dc under GE-Proton11-14 and all three passed.

In a one-launch-per-arm Series S comparison on Bazzite 44, RTX 5060 Laptop 8 GB, NVIDIA 615.78.08 and vkd3d-proton cae8353ed7959c4+, both arms used the same initial prefix, shader cache, source base and launch settings. The treatment added this PR. At the guarded loading transition, cumulative successful loose shared-window allocations were 1,672 MiB on the control and 1,316 MiB with this PR. Registered shared buffers were approximately 487 MiB in each. Both runs stopped on host memory pressure before the first observed upscale dispatch. The counters measure successful allocation traffic through each stop, and the launches advanced for different durations.

Test and report prepared with assistance from OpenAI Codex.

**@⁠Filip722** on GitHub · 2026-11-25 23:56 UTC · [original](https://github.com/fxceless/victory-fork/pull/1142#issuecomment-7178232301) I ran the three `shadow::buffer_map_tests::` regressions from `1c0377dc` under GE-Proton11-14 and all three passed. In a one-launch-per-arm Series S comparison on Bazzite 44, RTX 5060 Laptop 8 GB, NVIDIA 615.78.08 and vkd3d-proton `cae8353ed7959c4+`, both arms used the same initial prefix, shader cache, source base and launch settings. The treatment added this PR. At the guarded loading transition, cumulative successful loose shared-window allocations were 1,672 MiB on the control and 1,316 MiB with this PR. Registered shared buffers were approximately 487 MiB in each. Both runs stopped on host memory pressure before the first observed upscale dispatch. The counters measure successful allocation traffic through each stop, and the launches advanced for different durations. Test and report prepared with assistance from OpenAI Codex.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/shadow.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/1142/head:github-bot/gh-1142'
git switch 'github-bot/gh-1142'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1142'
git switch 'github-bot/gh-1142'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1142'
git switch 'github-bot/gh-1142'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1142'
git switch 'main'
git merge --squash 'github-bot/gh-1142'
git switch 'main'
git merge --ff-only 'github-bot/gh-1142'
git switch 'main'
git merge 'github-bot/gh-1142'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.