D3D12.X: honour OS QPC timestamp flags and atomic 64-bit CPU writes (#103) #317
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!317
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@Michael-Glaser on GitHub · 2026-11-23 23:09 UTC · original
Michael-Glaser:fix/d3d12x-os-qpc-timestamps→main· +226 −64 · 3 files · 1 commits · openPart 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, rejectPAGE_GUARD, and add unit tests.Tested
aarch64-apple-darwin, Rust 1.100.0):cargo check --offline --target x86_64-pc-windows-msvc --workspace --tests(0 errors, 0 new warnings).Not tested
cargo test, GPU tests, andscripts/smoke.ps1not run yet.AI use
@regiumlepidi on GitHub · 2026-11-23 23:34 UTC · original
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.
@Michael-Glaser on GitHub · 2026-11-24 00:19 UTC · original
Thanks @regiumlepidi! Rebased onto main (
a6f5f7a, commit d87aa07), keeping 4403887's ReadbackU64 GPU timestamp path intact alongside the OS QPC timestamp flags and AtomicU64 / PAGE_GUARD fixes.@WebIdentity1 on GitHub · 2026-11-24 01:48 UTC · original · edited 2026-11-24 02:18 UTC
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.@iggyvilla on GitHub · 2026-11-24 03:04 UTC · original
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
@Michael-Glaser on GitHub · 2026-11-24 13:52 UTC · original
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.@CuteBooty on GitHub · 2026-11-24 21:02 UTC · original
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
@DavidM1911 on GitHub · 2026-11-25 14:29 UTC · original
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.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.