D3D12.X: read wait cells without faulting #2960
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2960"
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?
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-27T05:15:41Z.
Part of #2508.
Stacked on #2959. Only top commit
099eaac0fc4e358bac6b2d6f86948b618efa5d49belongs to this PR.A readability probe can become stale before a title wait-cell dereference. Keep the committed coherent UMA window on its acquire-atomic fast path; outside that controlled window, snapshot through
ReadProcessMemoryso a concurrent decommit is contained by Windows instead of faulting XCL.What is in it
crates/xcl/src/hle/d3d12x/list_x.rs: use acquire atomic loads for committed UMA cells and contained current-process reads elsewhere, with tests for both the fast path and decommitted memory.Tested
099eaac0fc4e358bac6b2d6f86948b618efa5d49:./scripts/test.ps1 --nocapture --skip test_title_runs_and_game_folder_is_untouchedon GitHub-hosted Windows Server 2025, stable Rust 1.100.0, Microsoft Basic Render Driver: 39 test binaries, 2069 passed, 0 failed, 48 ignored, 361 GPU tests skipped. https://github.com/xcl-dev/xcl/actions/runs/46002355539git diff --check c2ee10e4e905eb736e56953c52b749e18bcc7ede..099eaac0fc4e358bac6b2d6f86948b618efa5d49passed.Regression run
xcl-smokeblocks.Not tested
AI use
Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-27T08:44:12Z.
read_valuenow does aReadProcessMemoryfor every observation, andwait_until_satisfiedobserves up to 513 times before it sleeps. On an Intel i5-10400 (Windows 11 26200), an 8-byteReadProcessMemoryof the process's own memory takes about 345 ns. An acquire atomic load takes 0.5 ns (2 million reads each, release build). That works out to about 177 µs of system calls per spinning wait, against about 0.3 µs before. The oldreadable()took that cost only for cells outsideuma::in_committed_windowand the resident cache; for those it already did aVirtualQueryat about the same 345 ns. Keeping the window fast path (an atomic load inside the committed coherent window) and using the contained read only outside it would keep the fault containment without the cost.AI use: Claude Code (Claude Opus 5.5) ran the timing and drafted this comment; Prime checked it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-27T13:06:39Z.
@Prime1997 Addressed at
099eaac0. Cells inside the committed coherent UMA window again use the acquire atomic-load fast path;ReadProcessMemoryis used only outside that controlled window for fault containment. A focused test covers the UMA path. I did not reproduce your nanosecond measurements, so the PR does not claim a measured speedup. Windows CI passed: 39 binaries, 2069 passed, 0 failed, 48 ignored, 361 GPU tests skipped (run).