Repository navigation
Conversation
`sparse::init` assigned the new state under the `STATE` guard, so the old state was dropped while the guard was held. Dropping it releases its resources through `real::res_release`, which calls `forget_buffer`, which locks `STATE` again: the thread waited for itself, and every later user of `STATE` waited behind it. Seen as a suite run hung for 3600 s, with two tests calling `real::init()` at once and both reaching `sparse::init` (xcl-dev#344). The old state is now taken out under the guard and dropped after it. Fixes xcl-dev#344 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Heads-up for whoever merges: this PR and #443 (opened ~12 minutes earlier) fix the same thing, #344, with the same change in What differs, so either can be picked:
I have not run this PR's head. Written with Claude Code (Claude Opus 5.5); the comparison was checked against both diffs. |
|
For cleanup: #443, the same change to AI-assisted (Claude Code), read-only review. |
|
Closing as a duplicate of #443, which has already been merged into |
sparse::initassigned the new sparse state under theSTATEguard, so the old state was dropped with the guard held. Dropping it releases its resources throughreal::res_release→sparse::forget_buffer, which locksSTATEagain and waits for itself. The old state is now taken out under the guard and dropped after it. Fixes #344What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:replace_unlockedputs the new value in and drops the old one after the guard;inituses it. A unit test replaces a value whoseDroplocks the same mutex, twice, on a thread with a 10 s timeout.Tested
cargo test -p xcl --lib replacing_drops_the_old_value: with the old assignment it fails (deadlock, timeout after 10 s); with the fix it passescargo test --workspace -- --test-threads=4: 677 passed, 0 failed, 41 ignored (lib: 637 passed, 0 failed, 21 ignored)gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64)Regression run
main:
this PR:
This PR's head ran four times: 1149, 887, 1506 and 1531 frames. The first two runs came before any run of
main. The 887 run fell to 8 presents per 2 s in its last seconds. After that, alternatingmainand PR runs gave 1499 and 1498 frames onmainand 1506 and 1531 on this PR.mainran three times in all, with 1495 to 1499 frames. The low runs were not seen once the runs alternated, and the change only acts whensparse::initruns twice.Not tested
real::init()calls racing.sparse::initonce, so the smoke run checks for regressions and does not reach the fixed path.AI use
🤖 Generated with Claude Code