D3D12.X: amd-dev readback waits: no stale wake-up, no buffer freed under a queued copy #2842
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!2842
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2842"
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?
@GreemSC on GitHub · 2026-11-26 17:50 UTC · original
GreemSC:amd-dev-readback-inflight→amd-dev· +151 −25 · 1 files · 2 commits · closed without mergingTwo fixes to
amd-dev's sparse readback waits, found while runningamd-devc32c91a3under Wine on an RX 7900 XT: a timed-outreadback_nowfreed its readback buffer under a queued GPU copy (a GPU page fault on RADV), and the waits could end early on a stale signal of their reused event. Neither is Wine-specific in the code. Related: #2619, #2626 (amd-dev page faults entering the world on Windows; theirs are shader reads, ours a command-processor write, so maybe not the same bug).What is in it
D3D12.X: sparse fence waits ignore a stale signal of their reused event(sparse.rs):wait_for,wait_for_rbandreadback_nowgo throughwait_fence_until, the helper of #1419 (gridoe) / #2821 formain, with the same signature so the two merge as one: reset the auto-reset event, then wait in a loop until the fence reaches the target or the deadline passes.readback_rangescopies nothing back after a failed wait. Testwait_fence_until_ignores_stale_event_signal(#2821's test).D3D12.X: a timed-out readback_now keeps its job until the GPU copy has run(sparse.rs): theReadbackJobwaits inIN_FLIGHT_RB_JOBSwith its fence and goes back to the pool once the copy has run, instead of being dropped with the copy queued. Testa_timed_out_readback_job_is_kept_until_its_copy_ran.Why
readback_now queue has not reached fence value … after 5 s, the kernel logs[gfxhub] page fault … Faulty UTCL2 client ID: CPG, PERMISSION_FAULTS 0x5, RW 0x1; the GPU stalls and the title's GPU watchdog ends it (game_scarlett_master.exe+0x23cf683). GPU page faults in every run until the second commit, none after (6 runs).Tested
x86_64-pc-windows-msvc; lib tests run under Wine (tools-xcl/wine-tests.sh, which skips the few tests that call DXGI functions Wine lacks).hle::d3d12x::sparse::on this head: 34 passed, 0 failed, 1 ignored, no SKIPPED.wait_fence_until_ignores_stale_event_signalfails with the old single wait (returned too early), passes with the fix.cargo test -p xcl --libbinary under Wine): the run aborts at the same test on the base and on this head (aftergpu::recomp::tests::scalar_relative_move_cluster, the process ends; pre-existing, as in #2632). Before the abort:amd-devc32c91a3974 passed / 72 failed, this head 976 passed / 69 failed, 6 SKIPPED lines each; no test fails only on this head (the three fewer are GPU tests that pass or fail from run to run here).amd-dev+ the Wine stack + Wine-only changes discussed on #877 / #1732), 600 s runs, 0 crashes, 0 device removals, 0 kernel GPU faults, reaching the playable part.Regression run (by @vibryxcx on Windows, comment: RX 6800, retail title, 60 s, after a warm-up run). The base is this PR's base on
amd-dev, not a commit ofmain.On Windows no sparse or readback wait reached its 5 s timeout (300 s runs too), so these runs show the normal path does not regress, not that the two fixes work there; the whole suite there: the same failures on base and head. Under Wine (@SlopTart, two machines): the lib run stops at the same test on base and head.
Not tested
AI use
🤖 Generated with Claude Code
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175@GreemSC on GitHub · 2026-11-26 18:43 UTC · original
A Windows pair is what this needs to leave draft:
scripts/smoke.ps1onamd-devc32c91a3and on this head (344ce7b5), same title, same time. If someone on Windows (ideally AMD, given #2619 / #2626) can run it, thank you.One addition to Tested: the whole-suite abort under Wine is
hle::d3d12x::list_x::tests::a_dispatch_with_a_pipeline_still_building_waits_at_the_submit, which @SlopTart isolated on two machines in #2764 (it fails the same way on bareamd-dev).AI use: Claude Code (Claude Opus 5.5) wrote this comment.
@SlopTart on GitHub · 2026-11-26 18:56 UTC · original
Wine dual-lane run at head
344ce7b5- your two readback fixes land clean on Wine, and they neither cause nor cure the branch-level failure that makes our lanes unable to finish the suite. (No Windows machine here, so thesmoke.ps1pair above is out of our reach; this is the Linux/Wine half of the picture.)Suite:
cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --test-threads=2 --skip gpu::. Base for comparison:c32c91a3(this PR's exact base), measured on both lanes earlier today.At this head, both lanes die at the identical spot as base: 283 tests run, then
hle::d3d12x::list_x::tests::a_dispatch_with_a_pipeline_still_building_waits_at_the_submitFAILED and the process dies (rig exit 5; boxb takes an execute page fault into winedbg). Nothing completed before the death differs from base - your changes break nothing that we can see in the 283 tests Wine does finish.Solo repro of the killer test at this head, identical panic on both:
Base numbers were 9.957s / 9.927s - same signature, same stand-in pipeline for console shader
0x7e57d001never completing its background build, retries doubling to #16. So the stand-in-build deadlock survives your two fixes untouched on both Wine stacks. It stays branch-blocking for our lanes until someone finds why that build never lands under Wine (it completes fine onmainandnvidia-dev, same test, measured today).Practical note for Wine testers: on the NVIDIA lane the crash can hang
winedbg --autoand wedge the whole run silently - kill the winedbg pid to let cargo report and move on.AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.
@vibryxcx on GitHub · 2026-11-26 19:42 UTC · original
The Windows AMD pair asked for above:
scripts/smoke.ps1onamd-devc32c91a3and on this head344ce7b5, same title, same time. There is no device removal or crash on either, and nothing in the suite fails only on this head. On Windows / RDNA2 the readback timeouts this PR handles did not occur, so these runs do not exercise the two fixed paths (see the end of this comment).Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release forxcl.exe, debug for the tests. Base and head each in their own worktree with no uncommitted changes. I read the full diff before building.cargo test -p xcl --lib -- --test-threads=1on head (the 4-thread run aborts onamd-dev, as reported on other PRs):--skip placed_title_textures_share_vram_and_preserve_pixels(that test hangs inside the full run, see #2757), aborted at test 1276 of 1646 with0xc0000409(STATUS_STACK_BUFFER_OVERRUN). The cause wasvram::tests::d32s8_targets_take_their_own_size_of_video_memory, which panicked attitle_textures.rs:1441:33and panicked again while unwinding.--exact) on base and on head give the same result on both. The same 10 fail on both (fuzz_validate_and_gpu_1,dispatch_chain_native_wave64_builds_whole,a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier,f32_programs_on_the_gpu,a_dispatch_with_a_pipeline_still_building_waits_at_the_submit,a_put_off_dispatch_runs_at_the_submit_when_its_build_outlasts_the_wait_budget,bitset_runs_emit_exact_contiguous_page_ranges,giant_driver_compiles_have_their_own_lane,title_bytes_are_used_in_place_when_all_are_readable,physical_home_without_sparse_windows_uses_coherent_window).two_pass_binds_set_the_shared_view_heap,d32s8_targets_take_their_own_size_of_video_memoryandplaced_title_textures_share_vram_and_preserve_pixelspass alone on both and fail, abort or hang only inside the full run.title_textures::tests::gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_releasedfailed once in the first full run, then passed in the rerun and 3 times out of 3 alone on base and on head. It looks flaky rather than caused by this PR.wait_fence_until_ignores_stale_event_signalanda_timed_out_readback_job_is_kept_until_its_copy_ran: both pass on real hardware (not WARP).f16_programs_on_the_gpu(#1426).Regression run (retail title, 60 s, after one 60 s warm-up run on base that is not counted)
The base is
c32c91a3onamd-dev(this PR's base), not a commit ofmain.Longer runs, 300 s,
XCL_PRESS_A_AT=40,60,…,180… after 5 slines (sparse / readback)c32c91a3344ce7b5wait_for,wait_for_rborreadback_nowwait reached its 5 s timeout.graphics pipeline wait window (12000 ms) spent(the same loading stall as onb5c0275fin #2757). It is not caused by this PR.Not tested: a Windows run where a readback actually times out (I did not force one); NVIDIA / Intel; the world past the loading stall; #2619 / #2626.
AI use: Claude Code (Claude Opus 5.5) read the diff, ran the builds, tests and game runs, read the logs and wrote this comment. The numbers come from those runs on the hardware above.
@GreemSC on GitHub · 2026-11-26 20:05 UTC · original
@vibryxcx thank you for the Windows pair and the whole-suite run, and for saying plainly that the two fixed paths were not exercised there (no 5 s timeout on Windows / RDNA2); that matches what I expected: they only matter where a readback times out, which here is under Wine. I copied your two
xcl-smokeblocks into Regression run with credit. @SlopTart thanks too for the two-lane rerun at this head.AI use: Claude Code (Claude Opus 5.5) wrote this reply.
@SlopTart on GitHub · 2026-11-26 21:09 UTC · original
Dual Wine re-check after the amd-dev rewind (heads re-verified at post time: this PR
344ce7b5, branch tip nowb5c0275f, an ancestor of your old basec32c91a3).We re-ran the current tip on both our Wine lanes: the stand-in-build deadlock still fires in isolation (solo panic 9.967s on the rig, identical signature at
c32c91a3, at this PR head, and atb5c0275f), so rebasing this PR onto the new tip will not dodge it. Full branch-state data (including the 22-red NVIDIA-lane picture where wine-10 survives to finish the suite) in our follow-up here: https://git.gtahub.st/github/xcl-dev--xcl/pulls/2764#2764AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.
@GreemSC on GitHub · 2026-11-27 04:23 UTC · original
Closing: ivall ported this into
amd-devas5a44e4ff("Port #2842", same diff:sparse.rs+151 −25), now underbf7c82ee, with84d63fd1(a fence per title queue) on top.@SlopTart thanks for re-running both Wine lanes. Since you get the same 9.96 s panic at
b5c0275f,c32c91a3and this head, the stand-in-build deadlock ina_dispatch_with_a_pipeline_still_building_waits_at_the_submitcomes from before this PR inamd-dev. Closing this PR doesn't change that. It needs its own issue if nobody has opened one.AI use: Claude Code (Claude Opus 5.5) checked the port and wrote this; I read it before posting.
Pull request closed