GPU: defer live title-slot views of newly-allocated resources until earlier submissions finish (fixes RADV GPUVM faults) #1031

Open
UwUCammie wants to merge 1 commit from upstream-pr/1033 into main
UwUCammie commented 2026-11-25 16:49:28 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by UwUCammie on 2026-11-25T16:49:28Z.


With VICTORY_LATE_WAIT / VICTORY_RELAY enabled on Linux AMD (RADV + amdgpu), recording threads can allocate a new host texture/buffer and immediately write its descriptor into a live title slot (0..self.count) of VK_EXT_descriptor_heap while an earlier submission is still executing on the card. On amdgpu, AMDGPU_VA_OP_MAP isn't flushed into GPU page tables until the next amdgpu_cs_ioctl, so the in-flight submission can sample the newly-written slot and hit an unmapped GPU VA (TCP (0x8) PERMISSION_FAULTS: 0x3 RW: 0x0 a few ms after BO creation in RADV_DEBUG=bo_history), leading to a ring gfx_0.0.0 timeout and DXGI_ERROR_DEVICE_REMOVED.

What changed

  • Stamp newly-allocated host textures and shadow buffers with born_after = host::started() (the submission serial already in flight when the resource was created).
  • When mirroring into a live title slot (HostHeap::mirror_as), if born_after > host::finished(), leave the live slot untouched and queue the update in deferred_views.
  • Flush ready deferred views (born_after <= host::finished()) as submissions complete, and mark draws binding a title slot directly through a non-fresh table (mirror_required) so a submission that actually needs the new view settles first.
  • Enabled by default; VICTORY_DEFER_NEW_VIEWS=0 restores immediate writes.

Tested

  • RX 7900 XT, CachyOS Linux, Wine 11.22 + vkd3d-proton (VKD3D_CONFIG=descriptor_heap) + RADV, RADV_DEBUG=bo_history + journalctl -k.
  • Previously hit TCP (0x8) PERMISSION_FAULTS right after VRAM sweeps / texture streaming bursts on VICTORY_LATE_WAIT=3.
  • After this change: three consecutive full gameplay runs (540 s + 540 s + 480 s, up to frame 4200, deferring and publishing new-resource views across ~144 log intervals per run) with 0 GPUVM faults and 0 device removals.
  • Builds cleanly (diag + victory-gpu tests) on 465b94f.
<!-- greyfinch-sync:fxceless/victory-fork:issue:6609311098 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1033). Originally posted by [UwUCammie](https://github.com/UwUCammie) on 2026-11-25T16:49:28Z. --- With `VICTORY_LATE_WAIT` / `VICTORY_RELAY` enabled on Linux AMD (RADV + `amdgpu`), recording threads can allocate a new host texture/buffer and immediately write its descriptor into a live title slot (`0..self.count`) of `VK_EXT_descriptor_heap` while an earlier submission is still executing on the card. On `amdgpu`, `AMDGPU_VA_OP_MAP` isn't flushed into GPU page tables until the next `amdgpu_cs_ioctl`, so the in-flight submission can sample the newly-written slot and hit an unmapped GPU VA (`TCP (0x8) PERMISSION_FAULTS: 0x3 RW: 0x0` a few ms after BO creation in `RADV_DEBUG=bo_history`), leading to a `ring gfx_0.0.0` timeout and `DXGI_ERROR_DEVICE_REMOVED`. ### What changed - Stamp newly-allocated host textures and shadow buffers with `born_after = host::started()` (the submission serial already in flight when the resource was created). - When mirroring into a live title slot (`HostHeap::mirror_as`), if `born_after > host::finished()`, leave the live slot untouched and queue the update in `deferred_views`. - Flush ready deferred views (`born_after <= host::finished()`) as submissions complete, and mark draws binding a title slot directly through a non-fresh table (`mirror_required`) so a submission that actually needs the new view settles first. - Enabled by default; `VICTORY_DEFER_NEW_VIEWS=0` restores immediate writes. ### Tested - RX 7900 XT, CachyOS Linux, Wine 11.22 + vkd3d-proton (`VKD3D_CONFIG=descriptor_heap`) + RADV, `RADV_DEBUG=bo_history` + `journalctl -k`. - Previously hit `TCP (0x8) PERMISSION_FAULTS` right after VRAM sweeps / texture streaming bursts on `VICTORY_LATE_WAIT=3`. - After this change: three consecutive full gameplay runs (`540 s` + `540 s` + `480 s`, up to frame 4200, deferring and publishing new-resource views across ~144 log intervals per run) with 0 GPUVM faults and 0 device removals. - Builds cleanly (`diag` + `victory-gpu` tests) on `465b94f`.
UwUCammie commented 2026-11-25 17:08:04 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by UwUCammie on 2026-11-25T16:59:32Z.


Follow-up test with VICTORY_RELAY=2 + VICTORY_BACK_OWN_VIEW=1 enabled (which used to reliably trigger the TCP (0x8) GPUVM fault on RADV under Wine): ran a full 480 s gameplay pass to frame 4600 on RX 7900 XT with 203 deferred/published view batches (up to 130 views deferred in a single streaming burst), 0 kernel GPUVM faults, 0 device removals, and median frame time dropped to 136–139 ms (~7.2 fps, 109 ms shortest).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7168837944 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1033#issuecomment-7168837944). Originally posted by [UwUCammie](https://github.com/UwUCammie) on 2026-11-25T16:59:32Z. --- Follow-up test with `VICTORY_RELAY=2` + `VICTORY_BACK_OWN_VIEW=1` enabled (which used to reliably trigger the `TCP (0x8)` GPUVM fault on RADV under Wine): ran a full 480 s gameplay pass to frame 4600 on RX 7900 XT with 203 deferred/published view batches (up to 130 views deferred in a single streaming burst), 0 kernel GPUVM faults, 0 device removals, and median frame time dropped to 136–139 ms (~7.2 fps, 109 ms shortest).
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/1033:upstream-pr/1033'
git switch 'upstream-pr/1033'

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