D3D12.X: wait_for ignores stale signals on the reusable sparse fence event #1419
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!1419
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1419"
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:47 UTC · original
gridoe:sparse-wait-stale-event→main· +78 −6 · 1 files · 1 commits · opensparse::State::wait_forreuses a single auto-reset Win32 event (self.event) across waits onself.fence, callingSetEventOnCompletion(target, self.event)followed by oneWaitForSingleObject(self.event, 5000). If an earlier wait times out at 5 s and its pendingSetEventOnCompletion(old_target, self.event)completes afterwards,self.eventstays signalled (or fires mid-wait during a later call). Every subsequentwait_for(newer_target)then returns in under 1 ms beforeself.fenceactually reachesnewer_target, lettingbegin_slotreset an in-flight command allocator andreadback_after_executecopy from staging before the GPU copy finishes.This change extracts a small
wait_fence_untilhelper that callsResetEvent(event)beforeSetEventOnCompletionand loopsWaitForSingleObjectagainst the remaining deadline untilfence.GetCompletedValue() >= target.What is in it
crates/xcl/src/hle/d3d12x/sparse.rs: addwait_fence_until, switchState::wait_forto call it, and addwait_fence_until_ignores_stale_event_signalcovering both an already-signalled event and an earlier pendingSetEventOnCompletionfiring mid-wait.Tested
rustc 1.99.1 (58cf8f9c3 2026-10-13)(stable-x86_64-pc-windows-msvc), debug (tests) and release (smoke).cargo +stable-x86_64-pc-windows-msvc build --workspaceandcargo +stable-x86_64-pc-windows-msvc test --workspace -- --test-threads=4: 725 passed, 0 failed, 41 ignored (includinghle::d3d12x::sparse::tests::wait_fence_until_ignores_stale_event_signal).SKIPPEDGPU/D3D12 tests on this adapter:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64)gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)test_title_draws_with_a_root_signature_under_the_debug_layer(no d3d12SDKLayers.dll)uploads_start_from_each_subresources_state(no D3D12 debug layer (0x887A002D))<game folder>): 60 s regression run below; in longer bring-up runs past menus on this machine, once a single 5 s sparse wait timed out,wait_forpreviously logged 51 back-to-back ~1 ms timeouts before crashing in readback, and dropped to 0 after this fix.Regression run
main:
PR:
Not tested
d3d12SDKLayers.dllnot installed), Wine /vkd3d-proton.XCL_SAMPLE_*env vars.wait_fordoes not time out; the stale-event timeout path is covered directly by the unit test and by longer local bring-up runs.AI use
wait_fence_untilhelper, unit test, and PR description; all builds, tests, and smoke runs were executed locally on the hardware listed above.@futurepro62 on GitHub · 2026-11-24 15:57 UTC · original · edited 2026-11-24 16:07 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
3861d2e(on its base9aec53d).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 725 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.wait_fence_until_ignores_stale_event_signal.XCL_ADAPTER=radeon), full suite: one failure, 2 of 2 runs:readback_routing_tests::coherent_buffer_sanitizes_console_flags_and_state, atreal.rs:5463,assert_ne!(VirtualFree(mem, 0, MEM_RELEASE), 0)(the release of theOpenExistingHeapFromAddressmemory fails after the heap is dropped). 683 passed before cargo stopped.main930e8b4right after passes (751 passed, 0 failed), and the test passed in all ~70 other full Radeon runs of other PRs I did today. Run on its own, it passes 5 of 5 on both this head andmain. So it shows up only next to the other lib tests with this change in.Not tested
AI use
@DavidM1911 on GitHub · 2026-11-24 17:13 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. (One parallel run showed a single flaky failure; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@xpatfussy69x on GitHub · 2026-11-25 11:41 UTC · original
Test report for head
3861d2eas pushed (not merged onto currentmain) – NVIDIA, wave32.Tested
.\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 725 passed, 0 failed, 41 ignoredwait_fence_until_ignores_stale_event_signalran and passedXCL_SAMPLE_*data set (game-data tests not run)Not tested
main; the D3D12 debug layerAI use
@ClosetPie107 on GitHub · 2026-11-25 12:19 UTC · original
Linux / AMD RDNA4 (RADV) test report for head
3861d2emerged locally ontomain1a0bbe3(clean merge).Environment
experimental-11.0-20261112), vkd3d-proton v3.1 (#257+dxil-spirv53aac418), 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::sparse: 16 passed, 0 failed, 1 ignored (early_commit_timing), 0 skipped (2.31 s), includingwait_fence_until_ignores_stale_event_signalon RX 9070 / RADV.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.
@oni-swr on GitHub · 2026-11-25 13:19 UTC · original
AMD RDNA3 (native wave64) test report for exact head
3861d2e2b561482933c657802cc5801b28bc60ba, as pushed on its base9aec53d(not merged onto currentmain).Tested
cargo build --workspace: okwait_fence_until_ignores_stale_event_signal: 1 passed;sparsefilter: 17 passed, 0 failed, 1 ignoredcargo test --workspace --no-fail-fast -- --test-threads=4: 725 passed, 0 failed, 41 ignored (summed over all test binaries)Not tested
scripts/smoke.ps1regression run (synthetic GPU/unit tests only)main; other GPUs (NVIDIA / Intel / RDNA2 / RDNA4)AI use: Claude Code (Claude Sonnet 5.5) ran the build and tests and wrote this report; the numbers are from the runs above.
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.