D3D12.X: a buffer's last release does not wait for the sparse state's lock #1981
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!1981
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1981/head"
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?
@Eterst on GitHub · 2026-11-25 00:22 UTC · original
Eterst:fix/sparse-forget-buffer-deadlock→main· +74 −10 · 1 files · 1 commits · merged 2026-11-25 01:14 UTCforget_bufferno longer waits for the sparse state's lock.before_executeholdsSTATEaround D3D12 calls, and D3D12 can make a placed buffer's lastReleaseinside a call of its own on another thread; thatReleasereachesforget_buffer, which tookSTATE. The D3D12 call under the lock then waits for D3D12's lock and theReleaseinside D3D12 forSTATE. On a retail title this stopped presents after the third frame on every start (black screen), with both threads in those waits in a thread dump. #968 fixed the other half of the same cycle (queue()); this is the remaining half.What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:forget_bufferqueues the resource inFORGOTTENand takesSTATEonly if it is free (try_lock); every other user of the state takes it throughlock_state, which first lets the queued buffers go (forget_released→forget_in, the old body). Testa_buffer_released_while_the_state_is_held_does_not_wait_for_it.Tested
cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4on892177b: 976 passed, 0 failed, 45 ignored. SKIPPED on this adapter (no wave64 / refused forms): thegpu::recomp::lowerandlower_dxilGPU comparisons,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,heap_window_out_of_memory_falls_back_to_the_switch_form.main689f2db(forget_buffer waited for the sparse state's lock, after its 5 s timeout) and passes here.hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memoryand threelist_xGPU tests (0x887A0005) fail now and then in parallel runs, onmainas well (3 of 8 parallelmainruns); they passed in the run above.Regression run
main:
this PR:
Not tested
mainthe 60 s smoke run does not hit the deadlock (it needs aReleasefrom inside D3D12 whileSTATEis held); the black screen was seen on an earlier base (930e8b4) before #968, so the smoke runs only check for regressions.AI use
🤖 Generated with Claude Code
github-bot referenced this pull request2026-11-26 05:31:09 +00:00
@futurepro62 on GitHub · 2026-11-25 00:56 UTC · original · edited 2026-11-25 01:07 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
892177b(on its base689f2db).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 966 passed, 0 failed, 43 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.a_buffer_released_while_the_state_is_held_does_not_wait_for_it.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 975 passed, 0 failed, 45 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main7994cd1too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests andconst_and_null_mask_operands_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
@raylitebull on GitHub · 2026-11-25 01:12 UTC · original
Code review on
892177b:sparse::STATEsynchronously onforget_bufferpreventslate_release::drain_knowndeadlocks whenSTATEis held across GPU resource/allocator work, and RTX 4070 SUPER + RTX 5070 Ti runs pass cleanly.CIworkflow approved (currently running).Remaining before merge:
Build and test (Windows, no GPU)finishing green plus an AMD verification pass on892177b.@DavidM1911 on GitHub · 2026-11-25 03:19 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!