D3D12.X: a buffer released during a placement keeps the new one (#2457) #2528
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!2528
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2528"
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?
@xpatfussy69x on GitHub · 2026-11-25 21:45 UTC · original
xpatfussy69x:d3d12x/sparse-place-buffer-forgotten→main· +88 −4 · 1 files · 1 commits · openPart of #2457 (item 2 only; item 1 is claimed on the issue).
place_bufferholds the sparseSTATEacrossCreateReservedResource. A placed buffer whose lastReleaseruns meanwhile cannot takeSTATE, soforget_bufferqueues it inFORGOTTENfor the nextlock_state. When the new reserved resource gets the released one's address,place_bufferrecorded the new buffer under it, and the nextlock_statelet it go: its tiles were unpinned while the buffer was live on the GPU. The new buffer is now recorded byrecord_buffer, which lets the queued buffers go first (the issue's second fix direction).What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:record_buffer(pins the new buffer's tiles and records it, afterforget_released);place_bufferuses itcrates/xcl/src/hle/d3d12x/sparse.rs:a_buffer_released_during_a_placement_does_not_take_the_new_one_with_it: an old buffer at an address is queued as released, a new one is recorded there, thenlock_state's drain runs. Fails without the fix (the new buffer's entry is gone), passes with it.test_state()builds aStateover a D3D12 device (WARP without a GPU) asa_pool_retired_a_moment_ago_is_taken_backdoesTested
cargo test --workspace -- --test-threads=4: 1424 passed, 0 failed, 46 ignoredV_MUL_F16/V_PK_MUL_F16/V_CVT_F16_F32(onmaintoo; #2182 removes them)cargo test -p xcl --lib d3d12x::sparse: 18 passed, 0 failed, 1 ignoredRegression run
main:
PR:
Not tested
AI use
@DavidM1911 on GitHub · 2026-11-25 22:10 UTC · original
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!
@emirduran707 on GitHub · 2026-11-25 22:24 UTC · original
Independent AMD RDNA4 (native wave64) test report on exact head
237882e85be2919904333b6b084baee4cc4c4411(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: 1422 passed, 2 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::sparse::tests::a_buffer_released_during_a_placement_does_not_take_the_new_one_with_it.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599) are pre-existing on unmodifiedmainon this GPU.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
@SlopTart on GitHub · 2026-11-25 23:07 UTC · original
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.Targeted run of
a_buffer_released_during_a_placement_does_not_take_the_new_one_with_it: passed.Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
@xpatfussy69x on GitHub · 2026-11-26 00:18 UTC · original
Heads-up for merge order: #2531 renames
State::quarantinedtoretirement. This PR'stest_state()builds aStatewithquarantined: VecDeque::new(). Git merges the two without a textual conflict, but the merged tree's tests do not build:error[E0560]: struct sparse::State has no field named quarantined(sparse.rs:1946, a local merge of6d7f8b9and237882e,cargo test -p xcl --lib --no-run). Whichever lands second needs that one field renamed; I'll rebase this one if #2531 goes first.AI use: Claude Code (Claude Opus 5.5) found this by building the merge.
@throny on GitHub · 2026-11-26 00:58 UTC · original
Two contributors checked independently and found that #2539 solves the same problem (for #2457) in a different way: #1607, group D122. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@xpatfussy69x on GitHub · 2026-11-26 01:17 UTC · original
Thanks for the hint. #2539 and this PR fix the same item (2) of #2457 the two ways the issue suggests; this one was opened first (21:45 vs 22:12 UTC).
STATEacrossCreateReservedResourceand only lets the queued releases go (forget_released) before the new buffer is recorded – the smallest change that closes the race.STATEacross the driver call, which needs the window to be checked again afterwards and an abort path when it went away.If not holding the lock across the driver call is wanted for its own sake, #2539 is the more complete fix and I'm happy to close this one in its favour; if the minimal fix is preferred, this one. I'll leave the choice to the maintainer and won't push either way.
AI use: Claude Code (Claude Opus 5.5) compared the two diffs; I checked the comparison.
@upipibi on GitHub · 2026-11-26 04:25 UTC · original
NVIDIA test report for
237882e: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug.cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4(thehle::xaudio2tests hang on this machine, onmaintoo):hle::d3d12x::sparse::tests::a_buffer_released_during_a_placement_does_not_take_the_new_one_with_itpanicked atsparse.rs:1838:9, "the old buffer's tile is still pinned".--test-threads=1 --nocapture, 3 runs: passes each time.6d12f58, same command: 1289 passed, 0 failed, 26 ignored (it does not have the test).RESinto the globalFORGOTTENand then drains it into its own state, but another test that callslock_state()in parallel can takeFORGOTTENfirst, so the test's state never lets the old buffer go.Lib tests only; no title run.
AI-assisted (Claude Code, Claude Opus 5.5).
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.