D3D12.X: honour OS QPC timestamp flags and atomic 64-bit CPU writes (#103) #314
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/317"
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 Michael-Glaser on 2026-11-23T23:09:06Z.
Part of #103.
Write64BitValueBottomOfPipeX(0x2) andWrite64BitValueTopOfPipeX(0x8) routed OS QPC timestamps to GPU timestamp queries;cpu_writesalso split 64-bit stores into two 32-bit writes and did not rejectPAGE_GUARD.What is in it
crates/xcl/src/hle/d3d12x/{cpu_writes.rs, list_x.rs, real.rs}: split GPU vs OS timestamp flags (classify_write64), stamp top/bottom OS QPC timestamps viacpu_writeswithAtomicU64, unify committed-UMA fast-path +PAGE_GUARD/ overflow checks inaligned_writable_now(preservingmax_u64_now), and add unit tests.Tested
173fa08on macOS (aarch64-apple-darwin, Rust 1.100.0):cargo check --offline --target x86_64-pc-windows-msvc --workspace --tests(0 errors, 0 new warnings).d87aa07/f6d072d) were validated on Windows by@regiumlepidi(RTX 5070 Ti + RDNA2 iGPU),@WebIdentity1(RTX 3090 + AMD iGPU, 5/5 focused tests), and@CuteBooty(60 s RTX 3070 retail smoke run).Not tested
173fa08(rebased onto623d02eto resolve thecpu_writes.rsconflict) has not been executed on Windows or re-smoked withscripts/smoke.ps1yet.AI use
Imported from ivall/xcl. Originally posted by regiumlepidi on 2026-11-23T23:34:36Z.
A Windows run for this draft, since the description has none yet:
adddae9merged onto currentmain85bdf21(clean merge,real.rsauto-merged): builds and passes on both adapters.Tested
XCL_ADAPTER=radeon.\scripts\test.ps1(cargo test --workspace -- --test-threads=4), noXCL_SAMPLE_*setmain85bdf21adddae9on85bdf21GPU tests skipped: the usual 2 (
no wave64) on NVIDIA, none on the iGPU.The
cpu_writestests run alone, 50 times each (--exact):writes_land_after_the_queue0 of 50 failed,os_timestamp_writes_qpc_and_writable_rejects_page_guard0 of 50 failed. That matters here because onmain/ #311 the same test waits only for the first of two dword stores; on #311 run alone it fails every time on this machine (details in #311). With this PR's singleAtomicU64store the race is gone.Not tested
scripts/smoke.ps1on a real title (I have none), so nothing on the QPC-flag path at run time.write_nownow skips.AI use: Claude Code with Claude Opus 5.5 ran the build and tests and wrote this comment; the numbers come from those runs.
Imported from ivall/xcl. Originally posted by Michael-Glaser on 2026-11-24T00:19:29Z.
Thanks @regiumlepidi! Rebased onto main (
a6f5f7a, commitd87aa07), keeping 4403887's ReadbackU64 GPU timestamp path intact alongside the OS QPC timestamp flags and AtomicU64 / PAGE_GUARD fixes.Imported from ivall/xcl. Originally posted by WebIdentity1 on 2026-11-24T01:48:12Z.
Independent Windows validation of current head
d87aa071287e4a8cd5f4a068d3b791e01c7052c7, cleanly integrated with main508a0c74d7c0625d6d2de8d24494e69dc2e1926f(tree7126b9600b4ebdf0274f934956032f24d92aa83a; no additional runtime changes).Tested
cargo build --locked --workspace: exit 0. Interactive desktop session, thencargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output: 681 passed / 1 failed / 41 ignored across workspace targets. The sole failure isgpu_clamp_and_omod_per_instruction, also present on the same main baseline (679 passed / 1 failed / 41 ignored); #202 addresses it. The CPU-write fixtures passed in this run. This is not a clean-suite claim or proof that intermittent failures are eliminated.cargo test --locked -p xcl --lib -- cpu_writes::tests:: timestamps_outside_unified_memory_land_after_the_queue write64_os_timestamp_flags_route_to_qpc_instead_of_gpu_timestamps --nocapture --test-threads=1: 5 passed / 0 failed / 0 ignored, 658 filtered out, no skips. Covers QPC/PAGE_GUARD, atomic writes, preservedReadbackU64, command-list timestamp readback, and flag routing.D3D12CreateDevice(None)and do not honorXCL_ADAPTER. A separate test-only diagnostic overlay queried the actual device LUID: all four GPU fixtures used AMD integrated graphics and passed (5/0/0 including the CPU-only flag test). A second local test-only overlay selected and asserted RTX 3090 for those four devices: 5/0/0, no skips. No runtime code changed in either diagnostic run; these overlays are not part of the reported full-suite tree.gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64 on selected NVIDIA adapter);test_title_draws_with_a_root_signature_under_the_debug_layeranduploads_start_from_each_subresources_state(missing D3D12 debug layer). These early returns are included in Rust's pass counts, not coverage. Sample-data tests had noXCL_SAMPLE_*inputs; system XGameRuntime comparison also skipped without its DLL.Not tested
Retail-title smoke/regression runs, gameplay, console hardware, and sustained stress. Full-suite fixtures use mixed adapters; this is not a claim that every fixture ran on NVIDIA. Local source snapshots, integration patch, diagnostic overlays, hashes and logs retained. This complements the earlier
adddae9report; it does not replace the required retail evidence.AI use
Codex (GPT-6) inspected the integration, prepared test-only adapter diagnostics, executed the native Windows runs and prepared this report.
Integration follow-up: tested together with #562 on current main
9ce2070. Six focused tests pass on verified AMD and RTX3090 devices; the shared-worker negative control fails queue independence on both without device removal. Serial workspace: main 683/1/41, integration 686/1/41, same CLAMP failure. Report and tested resolution branch. This is a separately modified integration, not a replacement for the exact-head results above; parallel isolation and retail smoke remain unverified.Imported from ivall/xcl. Originally posted by iggyvilla on 2026-11-24T03:04:35Z.
A run-time data point on the path this PR changes, from a retail title on
main9ce2070. We did not run this PR.Measured
Write64BitValueBottomOfPipeXwith a timestamp flag into its own memory, outside unified memory. On a cold address space (game files on a hard drive, after the account prompt) thecpu_writes::writablecheck intimestamp()(list_x.rs:1169) was 18.5 % of the render thread's samples, all of it inNtQueryVirtualMemory. Each timestamp makes oneVirtualQuerythere.What it means for this PR (read from the diff, not measured)
os_timestampcallswritablefor every OS timestamp, also when the destination is in unified memory.timestamp()onmainchecksuma_window_bufferfirst and skipsVirtualQueryfor those addresses.VirtualQuerywhen it is written (write_now). For top-of-pipe timestamps that runs incpu_writes_before, on the thread that submits.os_timestampand adds a second walk per timestamp. Checkinguma_window_bufferfirst, astimestamp()does, would at least keep unified-memory destinations off that path.Tested
9ce2070with local counters intitle_textures.rs(not in any PR),XCL_NETWORK=0. Profile with a stack sampler of our own, symbols from the build's PDB.Not tested
d87aa07), at build time or at run time. Which timestamp flag the title uses. NVIDIA.AI use
Imported from ivall/xcl. Originally posted by Michael-Glaser on 2026-11-24T13:52:32Z.
Thanks @WebIdentity1 and @iggyvilla! Rebased onto
main(47efa2e, commitf6d072d) to resolve the merge conflict with the wait64 mid-list split changes, preserving theLATEtimeout log and split-segment state clearing.Also addressed @iggyvilla's
VirtualQueryprofiling point: bothcpu_writes::writableandcpu_writes::write_nownow fast-path committed coherent UMA windows viaUma::in_committed_window, keeping UMA OS timestamps offVirtualQuerycompletely (andos_timestampno longer adds CPU-written destinations to GPUsparse_writes). Cross-checked on macOS againstx86_64-pc-windows-msvc(--workspace --tests); Windows runtime not re-run locally.Imported from ivall/xcl. Originally posted by CuteBooty on 2026-11-24T21:02:33Z.
Regression run on a retail title for
f6d072d: pass (no device removal, no crash, frames and peak commit within the check's limits).Tested
scripts\smoke.ps1 -Game <folder> -Seconds 60, no input, on this PR's head as it is and onmain47efa2e, the commit it branches from, each from a clean checkout. Each build ran twice back to back; the blocks are the second runs. Themainblock is shared with my reports on other PRs of the same base.main:
this PR:
Not tested
mainmerged in, AMD and Intel GPUs.AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T14:29:12Z.
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main(crates/xcl/src/hle/d3d12x/cpu_writes.rs) — needs a rebase before it can be tested.Imported from ivall/xcl. Originally posted by Michael-Glaser on 2026-11-27T12:05:39Z.
Thanks @CuteBooty and @DavidM1911! Rebased onto
main(623d02e, commit173fa08) to resolve thecpu_writes.rsmerge conflict withc1a9b52/max_u64_now(unifying the committed-UMA fast-path andPAGE_GUARDcheck intoaligned_writable_now). Cross-checked on macOS againstx86_64-pc-windows-msvc(--workspace --tests);173fa08is conflict-free again and ready for a fresh Windows test +smoke.ps1pass.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:07:50Z.
Triage (#1607) – head
67daad8No open or merged PR handles the OS QPC timestamp flags. The other #103 PRs (#786 HDR colour space, #1372 frame interval tolerances) touch other code.
In cpu_writes.rs
write_now, aWrite64BitValue*to an address that is 4- but not 8-byte aligned is now recorded (writablechecks no alignment) and then silently dropped (aligned_writable_now(va, 8)). On main it was written as two dwords. Top-of-pipe OS timestamps are stamped on the CPU right before submission, not when the GPU reaches them.The PR also bundles two changes (OS timestamps and the U32/U64 write rework), conflicts with main, and only the PR description check has run.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.