Tests: the GPU-wait watchdog releases a bridged Wait64 whose producer was never submitted #2433
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2443"
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 tiagonleal on 2026-11-25T19:06:44Z.
Part of #1452.
A
Wait64BitValueXis bridged to a GPUqueue.Waitwhenever aWrite64BitValueXfor the same address has been recorded (try_gpu_wait). If that producer list is recorded but never submitted, the log showsprod=qNone ... wait-before-signalandrecorded=<v> submitted=0x0 completed=0x0, and the waiting queue stays blocked until the sync watchdog signals the fence on the CPU afterXCL_GPU_WAIT_TIMEOUT_MS(5 s by default). Nothing in the test suite arms a wait this way and waits for the realxcl-sync-watchdogthread: the only test of the expiry path,cpu_watchdog_signal_with_inflight_gpu_signal_completes_cleanly, signals the fence by hand.What is in it
#[cfg(test)]test incrates/xcl/src/hle/d3d12x/list_x.rs,unsubmitted_write64_producer_wait_is_released_by_the_watchdog(+82 lines, nothing outsidemod tests).Write64and a DIRECT list with the matchingWait64, arms the DIRECT list's wait on its queue throughexecute_with_waits_on(the COMPUTE list is never submitted), then signals a fence on that queue. It checks that the fence stays at 0 while the wait is armed (submitted_max == 0), that it reaches 1 after the watchdog timeout and not before, that the cell records the CPU release (no armed waits left,cpu_signaled_max == 0x677), and that the queue runs more work afterwards.OnceLockread from the environment, so the test uses whatever it resolved to (5 s by default, about 5.4 s of wall time) instead of setting a process-wide variable that could race with the other tests. Same GPU-or-WARP device setup as the neighbouring tests.It passes on main and only pins the current behaviour; no runtime code changes. It will also catch a change that stops expiring waits with no known producer, which is what #1046, #1045 and #1123 touch.
Tested
3f277701plus this commit. No game was running when the runs started.cargo test -p xcl --lib unsubmitted_write64_producer -- --nocapture: 1 passed; the log shows thebridged to GPU queue.Wait (... prod=qNone ...; wait-before-signal ...)line and thendid not complete within 5000 ms ... released on CPU. The same test binary run alone 5 times: 5/5 passed (5.3 s each).hle::d3d12xwith--test-threads=4, 3 runs: 246 passed, 0 failed, 2 ignored each time.cargo test --workspace -j 6 -- --test-threads=4, 3 runs: 1275 passed, 5 failed, 26 ignored each time; the new test passes in all 3. The 5 failures are the same on3f277701without this commit (1274 passed, 5 failed, 26 ignored):gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0to_3andgpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier. 24SKIPPEDlines per run on this adapter (no wave64and similar).Notes on the test
execute_with_waits_onstill arms thequeue.Wait):ExecuteCommandListsgoes through the queue hook, which would add the queue, blocked for 5 s, topresent::QUEUES, and the sparse tests (flush_parked...,a_tile_decommitted...) andreadback_routing_teststhen wait on it and fail when they run in that window. I found this because the first version executed the list and failed 3 other tests in a parallel run.ExecuteCommandListsalso re-entersexecute_with_waits_on, so a bridged wait can be armed twice for one list (seen with--test-threads=4); the assertions accept one or more armed waits for that reason. Observation only, not changed here.Update, second commit
84ee77d1(review request)Dropruns the cleanup on a normal return and on unwind:on_releasefor both lists, the fence, and the twoSYNC_GRAPHentries. +22/−7, still nothing outsidemod tests.panic!forced right after the guard:hle::d3d12xwith--test-threads=4gave 245 passed, 1 failed (the forced one), 2 ignored. The panic is not in the commit.84ee77d1: the test alone 5 of 5;hle::d3d12x3 runs, 246 passed, 0 failed each;cargo test --workspace --no-fail-fast -j 4 -- --test-threads=4twice, 1353 passed, 5 failed, 46 ignored each time (25SKIPPEDlines), the same 5 failures as above. These totals count every test binary of the workspace.mainf9a0cb80(head82d0e7ad):cargo test --workspace --no-fail-fast -- --test-threads=4, one run: 1461 passed, 4 failed, 47 ignored (25SKIPPEDlines). The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0to_3, as before. The other results in this section are from the earlier heads named in them.Regression run
scripts/smoke.ps1 -Seconds 60 -Title 9cc6a39e(Newer Retail Game), release builds of both commits in clean trees, run again after the rebase ontomainf9a0cb80. Both runs hadXCL_PREPARE=0and the same warm DXIL cache, one after the other in the same session,mainfirst, one run each. A warm-up run ofmaincame before them and is not shown.main(f9a0cb80):This PR (
82d0e7ad):Not tested
XCL_GPU_WAIT_TIMEOUT_MSset to a non-default value (the value is read once per process).AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T19:06:57Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T19:54:42Z.
Independent AMD RDNA4 (native wave64) test report on exact head
9dd81efd3145e6456cbc72025794eb3b9949c831(clean detached checkout, no local changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1355 passed, 3 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.hle::d3d12x::list_x::tests::unsubmitted_write64_producer_wait_is_released_by_the_watchdog.main:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722) andfuzz_validate_and_gpu_3(seed 1599) on this GPU, plusgpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier(from50a9fde/ #2074, fixed later onmainin #2420).Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T20:02:41Z.
gpu_suite (cold cache): 160 passed / 4 failed, no crashes. The four are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, depth-buffer state refusal, andgpu_promoted_uav_clear_values_pass_create_committed_resource(report); none caused by this PR.Targeted run of the new watchdog tests (
unsubmitted_write64_producer_wait_is_released_by_the_watchdogand friends): 3 passed, including the 5 s release path, on this lane. Related to the failures I logged on #2439: the twod11_*tests that hang until the watchdog fires are the same mechanism, and this PR's harness approach looks compatible.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T20:15:59Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.Thanks!
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-25T21:57:21Z.
One test-isolation issue: this fixture calls
on_createfor both lists and records the fakevain the sync graph, buton_releaseand the graph/fence cleanup run only after the assertions and the finalexpect. If the watchdog behavior regresses, an assertion panics first; the COM lists andcellthen drop while their raw addresses remain in global test state. Later tests running in the same process can encounter stale registrations and report secondary failures unrelated to their own code.Could you install a small scope guard immediately after registration to run the existing cleanup on both normal return and unwind? This is especially useful for a test whose purpose is to catch a timeout/failure path.
Read-only review of head
9dd81efd3145e6456cbc72025794eb3b9949c831; I did not build or run it. AI use: OpenAI Codex and a Luna subagent inspected the diff and drafted this finding.Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-25T22:21:56Z.
Focused RX 6800M report for exact PR head
9dd81efd3145e6456cbc72025794eb3b9949c831(clean detached worktree).Tested
30.0.13002.13003; Windows 11 Home build 26200; Rust1.99.0MSVC.XCL_ADAPTER=6800M XCL_REQUIRE_GPU=1 XCL_DIRECT_DXIL=1 cargo test --locked -p xcl --lib -j 2 unsubmitted_write64_producer_wait_is_released_by_the_watchdog -- --test-threads=1 --show-output: 1 passed, 0 failed, 0 ignored, 0 skipped. The expected 5-second GPU wait timeout released on CPU; noSKIPPEDrecord appeared. Resource guard: none. Log:filter-unsubmitted-write64-watchdog.log.Not tested
AI use
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-25T22:41:49Z.
Done in
84ee77d1. The test now installs a guard right after the registrations, and itsDropruns the cleanup that used to sit at the end of the test:on_releasefor both lists, the fence, and the twoSYNC_GRAPHentries. It runs on a normal return and on unwind, and it takes over a poisoned lock so it cannot panic a second time.To check the failure path I forced a
panic!right after the guard and rancargo test -p xcl --lib -- hle::d3d12x --test-threads=4: 245 passed, 1 failed (the forced one), 2 ignored. The panic is not in the commit.The suite counts and the two smoke blocks in the description are for the new head.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T02:12:18Z.
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
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:06:15Z.
Triage (#1607) – head
82d0e7aNo open or merged PR adds this test. #2499 (merged) tests a different watchdog case: the lost wake-up of a wait armed during the check. Main still has no test that arms a bridged
Wait64with an unsubmitted producer and waits for the real watchdog to release it.The test only touches
mod tests, cleans up its global state in aDropguard, and does not execute the list through the queue hook, so it does not leak a blocked queue intopresent::QUEUES. It adds about 5 s to the suite (the watchdog timeout). No problems found in the diff.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-03T11:01:08Z.
merge-check
base:
16c2fd082ahead:
82d0e7add4merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> the lib binary is ended by the new test (exit code 0x80004005), so it has no counts; the other binaries: 156 passed, 0 failed, 20 ignored. The lib binary with the new test skipped: 2856 passed, 0 failed, 36 ignored. SKIPPED: 24 until the process ended; failing:
unsubmitted_write64_producer_wait_is_released_by_the_watchdog, 30 of 30 runs alone. It is new in this PR; base passes its own suite.review: read the whole diff (1 file, +97). One blocker, caused by a change on main after this PR's base:
dd84e0ad("D3D12.X: fail closed on unproven wait timeouts", in main through #2959), the watchdog no longer releases such a wait by default. It callsstop_for_unresolved_wait, which ends the process. The log of the test alone ends with:a GPU queue wait exceeded its watchdog without a graph-proven cycle – the title is stopped before its remaining GPU submissionAll lib tests that had not run yet are lost with it. CI on this head is green because it ran on 2026-11-27, before that change was on main.
XCL_WAIT_TIMEOUT_CONTINUE=1: with it the test passes 5 of 5 here. That setting is read once per process, so it cannot be set for one test in the shared process.XCL_WAIT_TIMEOUT_CONTINUE=1, as the tests inconsole_heap.rsdo withcurrent_exe(). A second child without the variable could check the default, that the process ends with 0x80004005.performance: none at run time, test only. The test takes about 5.3 s.
verdict: not yet: on current main the new test ends the lib test binary (point 1)
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
@tiagonleal point 1 needs a change after a rebase onto main.
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.