draw: a texture without a write watch is not looked at again every frame #163

Manually merged
github merged 1 commit from github-bot/gh-163 into main 2026-12-02 19:16:50 +00:00 AGit
Owner

@⁠victorizando-byte on GitHub · 2026-12-02 05:34 UTC · original
victorizando-byte:draw/recheck-without-watch → main · +10 −0 · 1 files · 1 commits · merged 2026-12-02 19:14 UTC

Textures in title memory on the card stop being read back every frame

A texture picked by index that a look found changed is looked at again the next frame. While the look finds it unchanged, it is scheduled for the next frame again, on the assumption that the write watch answers that look without reading anything.

Title memory on the card has no write watch: watch::writes answers nothing there, and the watch was kept as 0. So each of those looks read the texture's 48 KiB fingerprint from the card's memory, every frame, for the rest of the run. That memory comes back through the BAR at 20-45 MB/s, or by a copy of the card's at about 7 ms a read.

Now a look that finds the texture unchanged goes back to the next frame only when the watch actually answered (since != 0). Otherwise the texture continues with the usual later looks (RECHECK_FRAMES: 12, 40, 120, 400 frames), as a texture without a watch did before it changed. Textures where the watch answers behave as before.

Measured

Same save and the same still dialogue scene, 30 s each (Series X profile, 1706x960 to 2560x1440):

Before After
Fingerprint reads 3,013 1,034
Threads' time waiting for title memory on the card 15.1 s 4.7 s
Preparing, per frame 19.3 ms 17.0 ms
fps 24.0 24.9

The card is busy about 92 % of each frame in that scene either way, so the frame rate gains little there. The saving is CPU time spent preparing submissions. The waiting time was measured with temporary per-caller counters that are not part of this change.

Also tried, not included

  • Letting RADV expose its SDMA transfer queue (RADV_EXPERIMENTAL=transfer_queue) for the read-back copies in pull.rs: each read took longer (9.9 ms against 6.7 ms on average).
  • Refreshing a texture in title memory on the card at most once a frame: it almost never applied. Nearly every re-read found the texture really changed.
**@⁠victorizando-byte** on GitHub · 2026-12-02 05:34 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/163) `victorizando-byte:draw/recheck-without-watch` → `main` · +10 −0 · 1 files · 1 commits · merged 2026-12-02 19:14 UTC ### Textures in title memory on the card stop being read back every frame A texture picked by index that a look found changed is looked at again the next frame. While the look finds it unchanged, it is scheduled for the next frame again, on the assumption that the write watch answers that look without reading anything. Title memory on the card has no write watch: `watch::writes` answers nothing there, and the watch was kept as `0`. So each of those looks read the texture's 48 KiB fingerprint from the card's memory, every frame, for the rest of the run. That memory comes back through the BAR at 20-45 MB/s, or by a copy of the card's at about 7 ms a read. Now a look that finds the texture unchanged goes back to the next frame only when the watch actually answered (`since != 0`). Otherwise the texture continues with the usual later looks (`RECHECK_FRAMES`: 12, 40, 120, 400 frames), as a texture without a watch did before it changed. Textures where the watch answers behave as before. #### Measured Same save and the same still dialogue scene, 30 s each (Series X profile, 1706x960 to 2560x1440): | | Before | After | |---|---|---| | Fingerprint reads | 3,013 | 1,034 | | Threads' time waiting for title memory on the card | 15.1 s | 4.7 s | | Preparing, per frame | 19.3 ms | 17.0 ms | | fps | 24.0 | 24.9 | The card is busy about 92 % of each frame in that scene either way, so the frame rate gains little there. The saving is CPU time spent preparing submissions. The waiting time was measured with temporary per-caller counters that are not part of this change. #### Also tried, not included - Letting RADV expose its SDMA transfer queue (`RADV_EXPERIMENTAL=transfer_queue`) for the read-back copies in `pull.rs`: each read took longer (9.9 ms against 6.7 ms on average). - Refreshing a texture in title memory on the card at most once a frame: it almost never applied. Nearly every re-read found the texture really changed.
A texture picked by index that a look found changed is looked at again
the next frame, and while the look finds it the same it was looked at
the next frame again, on the assumption that the write watch answers
that look without reading anything. Title memory on the card has no
watch (writes() answers nothing; the watch was kept as 0), so each of
those looks read the texture's 48 KiB fingerprint from the card's
memory, every frame for the rest of the run: through the BAR at 20-45
MB/s or by a copy of the card's at some 7 ms a read.

Such a texture now goes on to the later looks (12, 40, 120, 400 frames),
as one without a watch did before it changed. Where the watch answered,
nothing changes.

Same scene and save, 30 s each (a still dialogue scene, 1706x960 to
2560x1440, Series X): fingerprint reads 3,013 -> 1,034, threads' time
waiting for title memory on the card 15.1 s -> 4.7 s, preparing 19.3 ->
17.0 ms a frame, 24.0 -> 24.9 fps (the card is busy 92 % of the frame
there either way).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 05:35:02 +00:00
Author
Owner

@⁠GreemSC on GitHub · 2026-12-02 11:21 UTC · original · edited 2026-12-02 11:52 UTC

Result on an RX 7900 XT 20 GB (RDNA 3), i7-12700K, 24 GB RAM, CachyOS kernel 7.3.6, Proton-CachyOS Wine, this repo's patched Mesa 26.3.1 and vkd3d-proton 71cae09. Series X, 2560x1440 output, render scale 0.75, ray tracing on, same save and scripted drive for both runs, pipeline cache warm, swap off for the game's cgroup.

On this machine the CPU reads the card's memory slowly (rep_movsb_mb_s=51 streaming_mb_s=2 from um::calibrate_reads; 65 / 35 MB/s in a native Vulkan test outside Wine), so #93's card pull stays on in both runs.

world, first 187 s d044248 d044248 + #163 + #164 + #166 + local GPU detile
fps 27.0 29.0
median frame 35.7 ms 33.9 ms
p95 61.7 ms 58.2 ms
worst frame 348 ms 172 ms
fewest frames in 1 s 12 16
stats: frame medians: preparing / copy / gpu_wait 21.7 / 15.0 / 4.4 ms 6.1 / 0.8 / 12.2 ms
peak game RAM / GTT / VRAM 6.1 / 11.7 / 17.8 GB 6.1 / 11.9 / 17.8 GB

The CPU side of the frame almost disappears and the card becomes the only limit (gpu_wait goes up by what preparing loses). This matches @⁠DecayingEagle's numbers in #173 (copy 20.7 → 0.67 ms, preparing 22.5 → 2.7 ms), which also included #163 and #164; since #93's pull is still on here, most of the copy drop seems to come from #163 rather than from #173's switch.

Edit: repeated: a second run of the candidate (with #149 also in, which does not touch the frame) gave 29.2 fps over the whole world part, median 33.9 ms, p95 57.3 ms (first run: 29.0 / 33.9 / 58.2), so the gain holds over 2 runs.

Caveats: one run for the baseline, and the candidate also had a local GPU detile patch turned on (VICTORY_GPU_DETILE=1, not in this repo); on the previous base that patch alone did not move the median. No crash, no artefact noticed.

AI assistance: Claude Code (Claude Opus 5.5) ran the builds and measurements, read the logs and wrote this report on the hardware above.

**@⁠GreemSC** on GitHub · 2026-12-02 11:21 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/163#issuecomment-7343817499) · edited 2026-12-02 11:52 UTC Result on an RX 7900 XT 20 GB (RDNA 3), i7-12700K, 24 GB RAM, CachyOS kernel 7.3.6, Proton-CachyOS Wine, this repo's patched Mesa 26.3.1 and vkd3d-proton `71cae09`. Series X, 2560x1440 output, render scale 0.75, ray tracing on, same save and scripted drive for both runs, pipeline cache warm, swap off for the game's cgroup. On this machine the CPU reads the card's memory slowly (`rep_movsb_mb_s=51 streaming_mb_s=2` from `um::calibrate_reads`; 65 / 35 MB/s in a native Vulkan test outside Wine), so #93's card pull stays on in both runs. | world, first 187 s | `d044248` | `d044248` + #163 + #164 + #166 + local GPU detile | |---|---|---| | fps | 27.0 | **29.0** | | median frame | 35.7 ms | **33.9 ms** | | p95 | 61.7 ms | **58.2 ms** | | worst frame | 348 ms | **172 ms** | | fewest frames in 1 s | 12 | **16** | | `stats: frame` medians: preparing / copy / gpu_wait | 21.7 / 15.0 / 4.4 ms | **6.1 / 0.8** / 12.2 ms | | peak game RAM / GTT / VRAM | 6.1 / 11.7 / 17.8 GB | 6.1 / 11.9 / 17.8 GB | The CPU side of the frame almost disappears and the card becomes the only limit (gpu_wait goes up by what preparing loses). This matches @⁠DecayingEagle's numbers in #173 (copy 20.7 → 0.67 ms, preparing 22.5 → 2.7 ms), which also included #163 and #164; since #93's pull is still on here, most of the copy drop seems to come from #163 rather than from #173's switch. **Edit:** repeated: a second run of the candidate (with #149 also in, which does not touch the frame) gave 29.2 fps over the whole world part, median 33.9 ms, p95 57.3 ms (first run: 29.0 / 33.9 / 58.2), so the gain holds over 2 runs. Caveats: one run for the baseline, and the candidate also had a local GPU detile patch turned on (`VICTORY_GPU_DETILE=1`, not in this repo); on the previous base that patch alone did not move the median. No crash, no artefact noticed. AI assistance: Claude Code (Claude Opus 5.5) ran the builds and measurements, read the logs and wrote this report on the hardware above.
github manually merged commit d6fc10dcb1 into main 2026-12-02 19:16:50 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.