Skip to content

batch 64 KiB block queries in texture mapped_bytes - #177

Open
matheusfrta wants to merge 1 commit into
fxceless:mainfrom
matheusfrta:patch-1795558392
Open

matheusfrta wants to merge 1 commit into
fxceless:mainfrom
matheusfrta:patch-1795558392

Conversation

@matheusfrta

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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.

RicerBoy added a commit to RicerBoy/DropItLikeItsHot that referenced this pull request Nov 24, 2026
…ries in texture mapped_bytes

Part of #16

# Conflicts:
#	crates/victory-gpu/src/texture.rs
oceansde012 pushed a commit to oceansde012/victory-gta6 that referenced this pull request Nov 25, 2026
CernyMuzCZ pushed a commit to CernyMuzCZ/vitezstvi-fork that referenced this pull request Nov 25, 2026
…stalls

Host::execute waited for each submission with no end. A host that loses
its device need not signal the fences of the work it dropped:
vkd3d-proton after a GPU fault does not, and by default does not report
the device removed either. The title's submit thread then stays in our
wait, its render thread blocks on its full submission ring, and 30 s
later the title's own watchdog ends the run at image+0x23cf683 (fxceless#1118),
with nothing of ours in crashes.log to say that the GPU faulted.

The wait now goes in 250 ms slices:

* between slices the device is asked whether it was removed; if so the
  wait ends and the existing check after the submission reports it;
* a submission still running is said so at 10 s and 20 s;
* at 25 s it is given up with a report of its own ("has not finished a
  submission ... and reports no removal"). The limit is below the
  title's 30 s so the run ends with the cause, not with the title's
  null write. vkd3d-proton's own source calls a wait of over 5 s a lost
  device; Windows resets a device after about 2 s.

A fence that comes is taken as before; a device that is removed and
signals (Windows) is reported by the check after the wait, as before.

Tested on Linux only (RTX 5080, driver 620.70, GE-Proton11-6's Wine,
vkd3d-proton 30b0eb9), on main + fxceless#177 + fxceless#259, where the world faults the
GPU in every run (Xid 13, fixed by fxceless#542):
* without this, with or without VKD3D_CONFIG=fault: the title's crash at
  +0x23cf683 24 to 30 s after the Xid, in 9 of 9 runs, and no report;
* with this and VKD3D_CONFIG=fault: "device removed: 0x887A0005" 4 s
  after the Xid;
* with this and vkd3d-proton's defaults: the two warnings, then the
  stall report 25 s after the submission began.
New unit test of the wait (no GPU); cargo test --workspace under Proton:
333 passed, the same ten environmental failures as main; clippy
-D warnings with and without --all-features; cargo xtask policy. Not run
on Windows.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit b58b779fdedc4e8724bcab295276c455e587c8f9)
oceansde012 pushed a commit to oceansde012/victory-gta6 that referenced this pull request Nov 25, 2026
…stalls

Host::execute waited for each submission with no end. A host that loses
its device need not signal the fences of the work it dropped:
vkd3d-proton after a GPU fault does not, and by default does not report
the device removed either. The title's submit thread then stays in our
wait, its render thread blocks on its full submission ring, and 30 s
later the title's own watchdog ends the run at image+0x23cf683 (fxceless#1118),
with nothing of ours in crashes.log to say that the GPU faulted.

The wait now goes in 250 ms slices:

* between slices the device is asked whether it was removed; if so the
  wait ends and the existing check after the submission reports it;
* a submission still running is said so at 10 s and 20 s;
* at 25 s it is given up with a report of its own ("has not finished a
  submission ... and reports no removal"). The limit is below the
  title's 30 s so the run ends with the cause, not with the title's
  null write. vkd3d-proton's own source calls a wait of over 5 s a lost
  device; Windows resets a device after about 2 s.

A fence that comes is taken as before; a device that is removed and
signals (Windows) is reported by the check after the wait, as before.

Tested on Linux only (RTX 5080, driver 620.70, GE-Proton11-6's Wine,
vkd3d-proton 30b0eb9), on main + fxceless#177 + fxceless#259, where the world faults the
GPU in every run (Xid 13, fixed by fxceless#542):
* without this, with or without VKD3D_CONFIG=fault: the title's crash at
  +0x23cf683 24 to 30 s after the Xid, in 9 of 9 runs, and no report;
* with this and VKD3D_CONFIG=fault: "device removed: 0x887A0005" 4 s
  after the Xid;
* with this and vkd3d-proton's defaults: the two warnings, then the
  stall report 25 s after the submission began.
New unit test of the wait (no GPU); cargo test --workspace under Proton:
333 passed, the same ten environmental failures as main; clippy
-D warnings with and without --all-features; cargo xtask policy. Not run
on Windows.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit b58b779fdedc4e8724bcab295276c455e587c8f9)
(cherry picked from commit 5ba89b7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants