Skip to content

D3D12.X: a timed-out UMA import check keeps what the GPU still uses - #578

Merged
raylitebull merged 1 commit into
xcl-dev:mainfrom
pablogonz12:d3d12x-uma-check-in-flight
Nov 25, 2026
Merged

raylitebull merged 1 commit into
xcl-dev:mainfrom
pablogonz12:d3d12x-uma-check-in-flight

Conversation

@pablogonz12

Copy link
Copy Markdown
Contributor

check_uma_import (start-up check that the GPU sees CPU writes to the coherent window) waits 2 s for its copy. When the wait ran out it returned and dropped the queue, allocator, command list, fence and readback buffer, and freed the probe words, while the copy was still on the GPU. vkd3d-proton releases those at once, and on RADV the GPU then faults on the freed memory (GCVM_L2_PROTECTION_FAULT, client TCP) and the gfx ring times out, so the title's device is removed (0x887a0005) within its first minute.

Under Wine the first GPU use of the 4 GiB imported window is slow (the check took 1.29–1.35 s when it passed), so it ran past 2 s in some runs only: on this machine 2 of 5 retail-title runs on main hung this way, and every hang came with UMA import check: check not run: GPU fence still pending after 2000 ms. On Windows the check takes microseconds, which is probably why it was not seen there.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs: when the check's wait fails, the objects the copy uses are kept (std::mem::forget, once, a few KiB) and the probe words are not freed.

Tested

Regression run

Made with scripts/linux/smoke.sh from #257 under Wine (not smoke.ps1), MSVC builds (cargo xwin), with a local copy of the script in which two lines are changed so that a run which does not reach its end still prints its block (set -eu instead of set -euo pipefail; the data: fallback as an if). The title's frame count in 60 s varies a lot between identical runs here (2 to 23); the first pair of runs gave 7 frames for this PR and 14 for main, both without removals or crashes, the second pair is below.

xcl-smoke v1
commit: 508a0c74d7c0625d6d2de8d24494e69dc2e1926f
gpu: AMD Radeon RX 9070 XT (RADV GFX1201)
title: Build
seconds: 60
exit: 0x0
frames shown: 9 (PresentX 16)
presents per 2 s (last 3): 1 1 0
device removals: 0
crashes: 0
peak commit: 0 MB
xcl-smoke v1
commit: 9fb0363ba81db5103181a302dc67398c87fce77a
gpu: AMD Radeon RX 9070 XT (RADV GFX1201)
title: Build
seconds: 60
exit: 0x0
frames shown: 8 (PresentX 10)
presents per 2 s (last 3): 0 1 0
device removals: 0
crashes: 0
peak commit: 0 MB

Not tested

  • Windows, NVIDIA, Intel, and AMD's Windows driver.
  • An automated test of the timeout path (see above).

AI use

  • Claude Code (Claude Opus 5.5): found the cause from the kernel's fault reports and XCL's logs, wrote the change and this description, and ran the commands above on the machine described.

check_uma_import waits 2 s for its copy out of the coherent window. When the wait ran out it returned and dropped the queue, allocator, list, fence and readback buffer and freed the probe words, with the copy still on the GPU. vkd3d-proton releases them at once; on RADV the GPU then faults on the freed memory (GCVM_L2_PROTECTION_FAULT, client TCP) and the gfx ring times out: the title's device is removed within its first minute. Under Wine the first use of the 4 GiB imported window can take longer than 2 s (1.3 s when it does not), so this happened in some runs only. On a timeout, what the copy uses is now kept (forgotten, once).
@H0UNDZER0

Copy link
Copy Markdown

Tested on an RTX 5080 and on the Radeon iGPU of the same PC, release build: pass, 680 passed, 0 failed on each. These are Windows runs, next to the Linux / vkd3d-proton runs in the description.

  • Commit 9fb0363ba81db5103181a302dc67398c87fce77a, this PR's head as is (on its base 508a0c7), release build.
  • NVIDIA GeForce RTX 5080 16 GB, driver 621.24 (32.0.16.2124), 32-lane waves; AMD Radeon(TM) Graphics (the Ryzen 7 9700X's RDNA2 iGPU), driver 32.0.21036.18, 32–64-lane waves; Windows 11 Pro 24H2 (26100.9711); Rust 1.100.0 MSVC; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0).
  • cargo build --release --workspace --locked: OK, the same single fetch_update warning as main.
  • cargo test --workspace --release --no-fail-fast --locked -- --test-threads=4: twice on the RTX 5080, the default adapter (the second with --show-output), and once with XCL_ADAPTER=radeon and --show-output: 680 passed, 0 failed, 41 ignored each time. The base 508a0c7 gives the same 680 / 0 / 41 on the RTX 5080.
  • SKIPPED: on the RTX 5080 the usual 2, gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64); on the Radeon none.
  • check_uma_import ran 4 times on each adapter, every time UMA import check: ok, 1 window(s): 21–46 ms on the RTX 5080, 2–5 ms on the Radeon. So the 2 s timeout this PR changes was not reached; these runs show the normal path is unchanged on Windows.

Not tested

  • The timeout path itself: no test forces it, as the description says.
  • This PR merged onto a newer main. At the time of the run that was 9ce2070; git merge-tree showed no conflict.
  • Debug build, retail titles, scripts/smoke.ps1.

AI use: Claude Code (Claude Opus 5.5, Claude Fable 5.2)

@JoaoPauluu

Copy link
Copy Markdown

Test report: #578 on Linux with NVIDIA (proprietary driver): the same fault, and the PR fixes it

The description covers Linux on RADV and the other report covers Windows. This one is Linux + NVIDIA's proprietary driver, using the same forced-timeout method as the description. On main the freed objects give an NVIDIA MMU fault, and the title never starts. With this PR there is no fault and the title runs.

Setup

Forced timeout (0 ms wait), 3 runs each, alternating

build UMA check NVIDIA kernel log title
508a0c7 + 0 ms no line logged NVRM: Xid 31 … MMU Fault: ENGINE CE0 HUBCLIENT_CE1 faulted @ 0x0_2aa00000. Fault is of type FAULT_PTE ACCESS_TYPE_VIRT_WRITE, 3 of 3 never started, 3 of 3: the log stops before D3D12.X: backend 'real', no DirectStorage request, then XCL_RUN_SECONDS: 60 s – ending the title (0 frames shown, 0 PresentX calls)
9fb0363 + 0 ms check not run: GPU fence still pending after 0 ms no Xid, 3 of 3 ran, 3 of 3: 935 / 903 / 936 frames, 0 device removals, 0 crashes
  • Xid 31 is a write by the copy engine (CE) to a page that is no longer mapped: the check's copy landing in memory freed under it. That's the NVIDIA counterpart of the RADV GCVM_L2_PROTECTION_FAULT in the description. On NVIDIA it doesn't remove the device; instead the title's start-up stops right there.
  • On the base, smoke.sh printed no block for these runs. The log has no gpu: line, so a grep in the script fails under set -o pipefail and it exits without output (the same limitation TLS: xcl.exe built with MinGW and lld keeps its TLS directory #464's author worked around). The numbers above are from XCL's log and journalctl -k.
  • The first PR forced run's block says exit: killed (no exit): XCL ended the title at 60 s (935 frames shown), and the process ended at 75 s, past the 15 s grace. The other two exited 0x0.

Without forcing (the real 2000 ms wait): the check passes in about 4 ms on this driver (UMA import check: ok, 1 window(s), 4104 µs on the base, 4219 µs on the PR), against 1.29–1.35 s on RADV in the description. So on NVIDIA's driver the timeout is unlikely to be hit by itself, but when it is, the fault is the same.

xcl-smoke v1
commit: 508a0c74d7c0625d6d2de8d24494e69dc2e1926f
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 864 (PresentX 864)
presents per 2 s (last 3): 60 54 31
device removals: 0
crashes: 0
peak commit: 0 MB
xcl-smoke v1
commit: 9fb0363ba81db5103181a302dc67398c87fce77a
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 704 (PresentX 704)
presents per 2 s (last 3): 0 33 60
device removals: 0
crashes: 0
peak commit: 0 MB

(peak commit: 0 MB is XCL reading 0 MB committed under Wine, see #257; it is not caused by this PR.)

Not tested

  • The unit tests on this machine; Windows NVIDIA (covered in the other report); a timeout that happens by itself rather than forced; runs longer than 60 s

AI use: Claude Code (Claude Opus 5.5) built the four variants, ran every run above on the machine above and wrote this report. The blocks and log lines are pasted from those runs. The account owner asked for test reports to be posted while they were away and has not reviewed this one.

@raylitebull

Copy link
Copy Markdown
Member

Diff check on 9fb0363:

  • Keeping (queue, alloc, list, fence, readback) alive via mem::forget on a timed-out check_uma_import avoids freeing resources still referenced by an in-flight GPU copy (preventing RADV/driver faults on slow first imports).
  • Already verified across both AMD (Radeon iGPU + RADV) and NVIDIA (RTX 5080 Windows + Linux), with PR description passing.

Next step to unblock merge: Please rebase onto current main so CI runs Build and test (Windows, no GPU) on the head.

@raylitebull
raylitebull merged commit 52272a0 into xcl-dev:main Nov 25, 2026
2 checks passed
@pablogonz12

Copy link
Copy Markdown
Contributor Author

On the rebase: this head (9fb0363) already has Build and test (Windows, no GPU) pass (run 45309319094, 2m34s) and PR description pass, and the branch is MERGEABLE against current main. I keep published branches un-rebased, but if you want a fresh CI run on top of main I can merge main into it (a merge commit, no force-push); that push changes runtime code, so I would redo scripts/smoke.ps1 on the new head before asking for review again. Not done yet: our GPU queue is busy right now, so no smoke number today.

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.

4 participants