GPU: buffer lookups also look through the buffers over 1 MiB when the 64 entries below an address hold none of it #2618
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2618"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 101Leafy on 2026-11-29T14:59:48Z.
Lookups in the shadow buffer map walk the 64 entries below an address. A parent buffer with many placed buffers inside it has more than 64 entries between its start and the address, so the walk stops short, the parent is never found, and the range falls through to a loose copy.
This keeps the 64-entry walk and, when it finds nothing, walks a second index that holds only the buffers over 1 MiB (again 64 entries below the address). Parents with many children are almost always that big, and there are few of them, so the second walk is short. A hit from the big index is checked against the buffer map's own end, so a buffer registered again shorter cannot be found at its old length.
extent,peek,lookup, andin_bufferuse it.VICTORY_LOOKUP_SPAN=0turns the second walk off (back to the 64 entries only).The stale entry is why the earlier take on this (b73bb8b473) was reverted: when a key was registered again with a smaller length, the big index still held the old length. Registering at or under 1 MiB now removes the key from it, and there is a test for that case.
#2556 bounds the walk by the largest registered size instead. On a miss that walk goes through every entry in that span; in the opening we counted about 480 entries per miss on average, up to 2,842, at about 330k misses every 5 seconds.
Numbers from the opening, game time 60 to 80 s, measured on our tree (which carries this change on top of a lot of other work), same PC, warm shader cache:
It is also a picture fix. With 64 entries only, the faces in the coffee shop scene go solid blue and green/red. With this change (or the wide walk) those solid faces are gone:
Top: 64 entries only. Bottom: this change. The frames are from separate runs, so they are not the same moment. The red specks still left on the right face show up in every mode, so they come from something else.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-29T15:40:11Z.
Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch
janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with--profile diag --features diagnostics, and the CPU tests of the touched crates pass. Runs on an RTX 4090 are queued (Series X 1440p, and Series S with ray tracing, DLSS Quality). Frame times will follow here.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-29T20:28:30Z.
A measurement from our integration branch (RTX 4090, house scene, cache warm, 300 s, same exe with and without
VICTORY_LOOKUP_SPAN=0):VICTORY_LOOKUP_SPAN=0Both profiles show the same ~4 ms extra frame time, all on the CPU side (the card time is unchanged). I've taken the PR out of our branch for now. Did you measure the extra lookup cost when it was written? A narrower search, for example only for parents already known to be larger than 1 MiB, might keep the fix without the cost.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.