batch 64 KiB block queries in texture mapped_bytes #177

Open
matheusfrta wants to merge 1 commit from upstream-pr/177 into main
matheusfrta commented 2026-11-24 22:13:18 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by matheusfrta on 2026-11-24T22:13:18Z.


mapped_bytes previously called readable one 64 KiB block at a time, issuing a separate K32QueryWorkingSetEx call per block on streamed textures. Batch up to 256 block probes per query like readable already does, and add a sparse reservation test across batch boundaries.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6592455017 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/177). Originally posted by [matheusfrta](https://github.com/matheusfrta) on 2026-11-24T22:13:18Z. --- mapped_bytes previously called readable one 64 KiB block at a time, issuing a separate K32QueryWorkingSetEx call per block on streamed textures. Batch up to 256 block probes per query like readable already does, and add a sparse reservation test across batch boundaries.
rostaddotcc commented 2026-11-24 23:09:37 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by rostaddotcc on 2026-11-24T22:36:06Z.


Supporting measurement from Linux/Proton, where this is now the largest item left in the texture lane.

With #175 (8e0e7b6, range-scoped mapping locks) the wait-for-remap counter is 0.0 ms in all 113 sampled windows, and what remains of texture refreshes per frame, all threads is the asking: 62.9 ms median, 936 ms in the worst window, out of a lane that runs 0.2–0.3 fps with 3 478–4 223 ms frames (RX 7900 XT, RADV, vkd3d-proton 3.2.0, 430-second run).

On the same box before that PR the split was the other way round — asking 7.3 ms median against 20.2 ms of waiting — so batching the block queries is what the lane needs next, not a micro-optimisation. It also matters on Wine specifically: K32QueryWorkingSetEx is emulated there, and the per-block call is a syscall round trip, so the wall-clock gain should be larger than on Windows for the same block count. If you have a way to count the calls per refresh, that number from a run here would make the case for the batch size.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7146425615 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/177#issuecomment-7146425615). Originally posted by [rostaddotcc](https://github.com/rostaddotcc) on 2026-11-24T22:36:06Z. --- Supporting measurement from Linux/Proton, where this is now the largest item left in the texture lane. With #175 (`8e0e7b6`, range-scoped mapping locks) the wait-for-remap counter is 0.0 ms in all 113 sampled windows, and what remains of `texture refreshes per frame, all threads` is the asking: **62.9 ms median, 936 ms in the worst window**, out of a lane that runs 0.2–0.3 fps with 3 478–4 223 ms frames (RX 7900 XT, RADV, vkd3d-proton 3.2.0, 430-second run). On the same box before that PR the split was the other way round — asking 7.3 ms median against 20.2 ms of waiting — so batching the block queries is what the lane needs next, not a micro-optimisation. It also matters on Wine specifically: `K32QueryWorkingSetEx` is emulated there, and the per-block call is a syscall round trip, so the wall-clock gain should be larger than on Windows for the same block count. If you have a way to count the calls per refresh, that number from a run here would make the case for the batch size.
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/177:upstream-pr/177'
git switch 'upstream-pr/177'

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/177'
git switch 'upstream-pr/177'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/177'
git switch 'upstream-pr/177'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/177'
git switch 'main'
git merge --squash 'upstream-pr/177'
git switch 'main'
git merge --ff-only 'upstream-pr/177'
git switch 'main'
git merge 'upstream-pr/177'
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!177
No description provided.