D3D12.X: check at start-up that the GPU sees CPU writes to unified memory #220
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!220
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/220/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Kalmarv on GitHub · 2026-11-23 21:15 UTC · original
Kalmarv:fix/uma-import-check→main· +101 −0 · 2 files · 1 commits · merged 2026-11-23 21:24 UTCXCL's coherent UMA windows reach the GPU through
OpenExistingHeapFromAddress. A runtime that can't import the memory may still return success with memory of its own. vkd3d-proton does this under a Wine withoutuserfaultfdwrite watches (#175):vkd3d_import_host_memorylogs a WARN and falls back to a separate allocation. Shaders then read zeros where the title wrote, and XCL's log shows nothing. On such a stack fivegpu::recompmemory-window tests fail that way.Change
In
open_uma(hle/d3d12x/real.rs), after the coherent windows are opened:alloc_in), so no title data is touched. Write a canary word (0x58434C00 | window), copy it on the GPU into a readback buffer, compare, and free the block.xlog_error!, naming the likely cause, for example: "the GPU does not see what the CPU writes to unified memory (window 3: wrote 0x58434c03, the GPU read 0x0): the host-memory import fell back to memory of its own (Wine without userfaultfd write watches?) …".report.jsonasd3d12.uma_import_check:"ok, N window(s), T µs","off (XCL_UMA_CHECK=0)", or the failure. The new field is#[serde(default)].XCL_UMA_CHECK=0turns it off.Test:
gpu_uma_import_check_at_initrunsreal::init()and expectsok(oroff).Tested
Linux: Ubuntu 24.04, RTX 2060 (Turing), NVIDIA 595.91.07, Wine 11.21 Staging (Kron4ek wow64), vkd3d-proton
master30b0eb9 relaxed as in #175, DXVK 3.1.1dxgi. Cross-built forx86_64-pc-windows-gnu, release, no warnings.gpu_uma_import_check_at_initUMA import check: the GPU does not see … (window 3: wrote 0x58434c03, the GPU read 0x0) …XCL_UMA_CHECK=0UMA import check: off (XCL_UMA_CHECK=0)MEM_WRITE_WATCH= 0 ingpu/uma.rs(experiment only: the import then works on this stack)UMA import check: ok, 1 window(s)in 5655 / 5001 / 4760 µsCost on this stack is about 5 ms once at device creation, mostly the queue, list and fence through vkd3d-proton and Wine.
Windows: Windows 11 Pro 26200, RTX 5070 Ti, NVIDIA 610.74, MSVC release,
cargo test --release -p xcl --lib gpu_uma_import_check_at_init -- --nocapture --test-threads=1: pass 3 of 3, loggedUMA import check: ok, 1 window(s)in 20 388 / 20 706 / 28 997 µs (once, at device creation). Runs 1–2 were at 2558a2f on main956a476, run 3 after the rebase on6da33fa(5ceb8fc).Not tested
AI use: Claude Code, Claude Opus 5.5 (written and Linux-tested by one agent, Windows run by another).
Closes nothing; follows #175.
@ivall on GitHub · 2026-11-23 21:24 UTC · original
Merged (main
d4f17ca). Checked on an RX 9070 (RDNA4) with 11 PRs merged together on mainaf20b4b:cargo build --workspace && cargo test --workspace -- --test-threads=4- 605 unit tests passed, 0 failed (20 ignored), the integration and e2e tests passed; and the retail game still reaches its first menu at 30 fps (720 draws per 2 s).