pull: poll the copy fence; keep copies where 1.25x faster than the CPU #256

Manually merged
github merged 1 commit from github-bot/gh-256 into main 2026-12-02 22:38:35 +00:00 AGit
Owner

@⁠prinzjo on GitHub · 2026-12-02 21:54 UTC · original
prinzjo:pr/pull-faster → main · +39 −13 · 1 files · 1 commits · merged 2026-12-02 22:35 UTC

Card copies of title memory are now waited for by polling the fence, and kept where they are a quarter faster than the processor.

Problem: in play on an RX 7900 XTX + i7-13700K (ray tracing on), the processor read the card's memory at 42-44 MB/s and the card's copies at 75 MB/s. The 2× rule from ff57de2 turned the copies off after the first 64 MiB. The processor then read 13.2 GB of title memory from the card in that session, and frames that refreshed new textures took 250-820 ms.

Changes:

  • Copies are kept when at least 1.25× the processor's speed. The RX 9070 XT case from ff57de2 (copies 41-79 MB/s against 76-97) still turns them off.
  • The copy fence is D3D12_FENCE_FLAG_SHARED, whose completed value vkd3d-proton reads from the timeline semaphore itself. A plain fence's value comes from vkd3d-proton's fence thread, so it lagged by that thread's wake-up.
  • The fence is polled (yielding) for up to 4 ms before the event wait.

Results (pull::tests::reads_title_memory_on_the_card_back, game running beside it):

copy size before after
32 KiB 0.12 ms 0.05 ms
128 KiB 0.24 ms 0.19 ms
512 KiB 0.20 ms 0.10 ms
4 MiB and more unchanged unchanged

Co-Authored-By: Claude Opus 5.5 [email protected]

**@⁠prinzjo** on GitHub · 2026-12-02 21:54 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/256) `prinzjo:pr/pull-faster` → `main` · +39 −13 · 1 files · 1 commits · merged 2026-12-02 22:35 UTC Card copies of title memory are now waited for by polling the fence, and kept where they are a quarter faster than the processor. **Problem:** in play on an RX 7900 XTX + i7-13700K (ray tracing on), the processor read the card's memory at 42-44 MB/s and the card's copies at 75 MB/s. The 2× rule from ff57de2 turned the copies off after the first 64 MiB. The processor then read 13.2 GB of title memory from the card in that session, and frames that refreshed new textures took 250-820 ms. **Changes:** - Copies are kept when at least 1.25× the processor's speed. The RX 9070 XT case from ff57de2 (copies 41-79 MB/s against 76-97) still turns them off. - The copy fence is `D3D12_FENCE_FLAG_SHARED`, whose completed value vkd3d-proton reads from the timeline semaphore itself. A plain fence's value comes from vkd3d-proton's fence thread, so it lagged by that thread's wake-up. - The fence is polled (yielding) for up to 4 ms before the event wait. **Results** (`pull::tests::reads_title_memory_on_the_card_back`, game running beside it): | copy size | before | after | |---|---|---| | 32 KiB | 0.12 ms | 0.05 ms | | 128 KiB | 0.24 ms | 0.19 ms | | 512 KiB | 0.20 ms | 0.10 ms | | 4 MiB and more | unchanged | unchanged | Co-Authored-By: Claude Opus 5.5 <[email protected]>
In play here (RX 7900 XTX, i7-13700K, ray tracing on) the processor read
the card's memory at 42-44 MB/s and the card's copies at 75 MB/s; they were
turned off after the first 64 MiB (twice the processor's speed asked) and
the processor read 13.2 GB of title memory on the card in the session
(play-1202-2207), frames that refreshed new textures taking 250-820 ms.
Kept now where a quarter faster.

A copy's end came by an event vkd3d-proton's fence thread sets, a wake of
that thread after the copy ended; the fence is now shared, whose completed
value vkd3d-proton reads from the semaphore itself, and it is asked in a loop
(the thread yielding) for up to 4 ms before the event is waited for.
pull::tests on the card with the game running beside: 32 KiB 0.12 -> 0.05
ms, 128 KiB 0.24 -> 0.19, 512 KiB 0.20 -> 0.10; 4 MiB and more as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 21:55:18 +00:00
github manually merged commit 8e2bcdc58e into main 2026-12-02 22:38:35 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.