D3D12.X: track Write64 fence highs and keep the sync watchdog awake after CPU releases #1429
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!1429
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1429"
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?
@gridoe on GitHub · 2026-11-24 15:53 UTC · original
gridoe:sync-watchdog-rewind-guard→main· +139 −9 · 1 files · 1 commits · openOn native Windows D3D12, an older in-flight GPU
queue.Signal(&fence, v - 1)on a slower queue can retire after a higher GPU completion or a CPUfence.Signal(v)(from a cycle-break or watchdog release) and rewindID3D12Fence::GetCompletedValue()backwards. Two gaps inlist_x.rslet those rewinds stick and stall laterqueue.Waitcalls:prune_completed_waitsdid not track the highest observedGetCompletedValue()on aSyncCellor restore a fence that dropped belowcpu_signaled_max.max(highest_completed).ARMED_GPU_WAITSdropped to0andxcl-sync-watchdogwent straight back tocv.wait, so an older in-flight GPUSignalretiring milliseconds later rewound the fence with nothing awake to restore it.This change records
SyncCell::highest_completed, restores rewound fences inprune_completed_waits, and adds a shortREWIND_GUARD_UNTILwindow (10 s, polling at 20 ms whileARMED_GPU_WAITS == 0) armed whenever a CPU release or rewind repair occurs soxcl-sync-watchdogcatches post-release GPU rewinds.What is in it
crates/xcl/src/hle/d3d12x/list_x.rs: trackSyncCell::highest_completed, detect/restore fence rewinds inprune_completed_waits, addREWIND_GUARD_UNTIL/arm_rewind_guard/rewind_guard_activeforxcl-sync-watchdog, and addsync_watchdog_and_prune_repair_fence_rewind_with_zero_armed_waits.Tested
rustc 1.99.1 (58cf8f9c3 2026-10-13)(stable-x86_64-pc-windows-msvc), debug (tests) and release (smoke).main(9633138) asdd5ea20:cargo +stable-x86_64-pc-windows-msvc test -p xcl --lib hle::d3d12x::list_x::tests— 35 passed, 0 failed (includingsync_watchdog_and_prune_repair_fence_rewind_with_zero_armed_waits);cargo +stable-x86_64-pc-windows-msvc build --release -p xclclean.3ea5ef4:cargo +stable-x86_64-pc-windows-msvc test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored (SKIPPEDon this adapter:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,test_title_draws_with_a_root_signature_under_the_debug_layer,uploads_start_from_each_subresources_state).<game folder>): 60 s regression run below; in longer bring-up runs past the opening title card on this machine, multi-queueWrite64rewinds (0x6df -> 0x6de,0x6e1 -> 0x6e0,0x795 -> 0x794) were caught and repaired, cuttingGPU queue.Waittimeouts from 166 to 0 in the compared run.Regression run
main:
PR:
Not tested
d3d12SDKLayers.dllnot installed), Wine /vkd3d-proton.XCL_SAMPLE_*env vars.Write64rewinds do not occur; the zero-armed-waits rewind repair path is covered directly by the unit test and by longer local bring-up runs.AI use
@futurepro62 on GitHub · 2026-11-24 15:57 UTC · original · edited 2026-11-24 16:01 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
3ea5ef4(on its base930e8b4).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.sync_watchdog_and_prune_repair_fence_rewind_with_zero_armed_waits.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
@DavidM1911 on GitHub · 2026-11-24 18:52 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@gridoe on GitHub · 2026-11-25 11:19 UTC · original
Rebased onto current
main(9633138) asdd5ea20, resolving the two additive conflicts incrates/xcl/src/hle/d3d12x/list_x.rsalongside#1926,#2078, and#2163.Tested
rustc 1.99.1(stable-x86_64-pc-windows-msvc).cargo +stable-x86_64-pc-windows-msvc test -p xcl --lib hle::d3d12x::list_x::tests— 35 passed, 0 failed (includingsync_watchdog_and_prune_repair_fence_rewind_with_zero_armed_waits,sync_watchdog_pair_is_set_before_the_thread_starts, andcpu_cycle_break_publishes_value_to_title_memory_and_keeps_it_monotonic).cargo +stable-x86_64-pc-windows-msvc test -p xcl --lib -- --test-threads=4— 1,173 passed, 2 unrelated pre-existing failures onmain9633138(gpu::recomp::pso::shader_cache_tests::rerouted_disk_entries_follow_the_direct_translatorandhle::d3d12x::device_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa), 26 ignored.AI use: Rebase conflict resolution and test verification assisted by Antigravity with Gemini 4 Neon.
@ClosetPie107 on GitHub · 2026-11-25 13:09 UTC · original
Linux / AMD RDNA4 (RADV) test report for head
dd5ea20merged locally ontomain1a0bbe3(clean merge).Environment
experimental-11.0-20261112), vkd3d-proton v3.1 (#257+dxil-spirvmaster694cc674), DXVKv3.1.1-209, DXC1.9.2609.5,x86_64-pc-windows-gnucross-compileTested (debug test binary under Wine,
XCL_ADAPTER=9070 XCL_REQUIRE_GPU=wave64,--test-threads=1 --nocapture)hle::d3d12x::list_x: 35 passed, 0 failed, 0 ignored, 0 skipped (0.34 s), includingsync_watchdog_and_prune_repair_fence_rewind_with_zero_armed_waits.hle::d3d12x::real: 56 passed, 0 failed, 0 ignored, 0 skipped.Not tested: full workspace suite, retail title run, native Windows.
AI use: T3 Code / Antigravity (Gemini 4 Neon) merged, built, ran the tests on this machine, and drafted this report.
@gridoe on GitHub · 2026-11-25 17:39 UTC · original
Rebased onto current
main(68a284a) asb14487f, resolving the additive test conflict at the end ofcrates/xcl/src/hle/d3d12x/list_x.rs.Tested
rustc 1.99.1(stable-x86_64-pc-windows-msvc).cargo +stable-x86_64-pc-windows-msvc test -p xcl --lib hle::d3d12x::list_x::tests— 37 passed, 0 failed (0.63 s), includingsync_watchdog_and_prune_repair_fence_rewind_with_zero_armed_waits,sync_watchdog_pair_is_set_before_the_thread_starts, andcpu_cycle_break_publishes_value_to_title_memory_and_keeps_it_monotonic.AI use: Rebase conflict resolution and test verification assisted by Antigravity with Gemini 4 Neon.
@ -1193,2 +1200,4 @@}fn arm_rewind_guard() {let until = Instant::now() + Duration::from_secs(10);@gut0to on GitHub · 2026-11-24 19:02 UTC · original
The rewind guard expires after 10 seconds, but a queued
ID3D12CommandQueue::Signalhas no completion deadline: it can remain behind stalled or long-running work and retire after this window. Once the guard expires with no armed waits, the watchdog returns tocv.wait, so that late lower signal can rewind the fence without repair until some later event happens to wake the watchdog. Could the guard remain active while older signals are in flight, or otherwise track their completion rather than use a fixed timeout? AI-assisted review; I verified the fixed window and idle branch.@DavidM1911 on GitHub · 2026-11-26 05:13 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
@gut0to on GitHub · 2026-11-24 19:02 UTC · original · reviewed
AI-assisted review; I checked the guard lifetime against the D3D12 queue ordering described in the PR.
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.