Repository navigation
D3D12.X: resolve GPU timestamps targeting memory outside unified memory - #330
Conversation
|
Static code audit of Overlap with earlier PR #311This solves the same non-UMA GPU timestamp issue in That said, this PR handles three details cleaner than #311's current head:
Issues found in
|
Write64BitValueBottomOfPipeX and Write64BitValueTopOfPipeX with timestamp flags previously rejected any target address outside unified memory (for example, a title's own VirtualAlloc memory on a first run before the coherent window grows), even though non-timestamp writes already fall back to cpu_writes after the queue fence completes. Resolve non-UMA timestamp queries into a lazily allocated, persistently mapped READBACK buffer per device (4096 slots, 32 KiB) and copy the 64-bit GPU tick atomically to the title's address in the cpu_writes worker once the submission's fence completes. Also separate the 8-byte alignment check from the unified-memory check so warnings report the actual reason. Assisted-by: Antigravity (Gemini 4 Neon)
|
An NVIDIA run, which the description lists under Not tested: Tested
Not tested
This PR, #311 and #317 all reshape AI use: Claude Code with Claude Opus 5.5 ran the build and tests and wrote this comment; the numbers come from those runs. |
85d85b5 to
4403887
Compare
|
Thanks for the audit! Fixed those in 4403887:
Didn't catch #311 before opening this — I'll leave it open if the atomic 64-bit write / |
|
Merged (a6f5f7a). Checked on an RX 9070 (RDNA4) on main a6f5f7a, together with #335, #322, #331, #330, #338, #318 and #332: |
|
Tested RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native, Graphics Tools + XGameRuntime installed, so the debug-layer tests run), rustc 1.100.0 MSVC, debug, Pass: 672 passed, 0 failed, 41 ignored. SKIPPED: only the 2 Run and written with Claude Code (Claude Opus 5.5). |
Write64BitValueBottomOfPipeXandWrite64BitValueTopOfPipeXwith timestamp flags (BOTTOM_TIMESTAMPS/TOP_TIMESTAMPS) previously dropped any timestamp targeting memory outside unified memory (0x... is not 8-byte aligned in unified memory – not done), even though non-timestamp writes already fall back tocpu_writesafter the queue fence completes. On a retail title's first run (beforeuma_coherent.txtgrows the coherent window), its timestamp buffers land in plainVirtualAllocmemory and every GPU timestamp is lost.This resolves non-UMA GPU timestamp queries into a lazily allocated, persistently mapped
READBACKbuffer per device (4096slots, 32 KiB) and copies the resolved 64-bit GPU tick atomically to the title's address incpu_writesonce the submission's queue fence completes. It also separates the 8-byte alignment check from the unified-memory check so warnings report the actual reason.What is in it
crates/xcl/src/hle/d3d12x/cpu_writes.rs: replace the(usize, Vec<u32>)alias with aWriteenum (ImmediateandReadbackU64) and atomic 64-bit stores for readback slots; addreadback_u64_lands_after_the_queueunit test.crates/xcl/src/hle/d3d12x/list_x.rs: extendTIMESTAMPSwith a lazy per-deviceREADBACKbuffer (TimestampPool) for non-UMA timestamp targets, separate alignment vs. UMA validation, and addtimestamps_outside_unified_memory_land_after_the_queueGPU test.Tested
rustc 1.98.1, debug (tests) and release (smoke).cargo build --workspace && cargo test --workspace -- --test-threads=4: 654 passed, 0 failed, 40 ignored, 0SKIPPEDGPU tests.hle::d3d12x::cpu_writes::tests::readback_u64_lands_after_the_queueandhle::d3d12x::list_x::tests::timestamps_outside_unified_memory_land_after_the_queuepass on the RX 7900 XT (both verify non-UMA GPU timestamp / readback delivery after queue completion and rejection of unaligned/unwritable targets).Regression run
Not tested
timestamps_outside_unified_memory_land_after_the_queue) andreadback_u64_lands_after_the_queue.AI use