Repository navigation
D3D12.X: a buffer released during a placement keeps the new one (#2457) - #2528
xpatfussy69x wants to merge 1 commit into
Conversation
…dev#2457) place_buffer holds the sparse STATE across CreateReservedResource. A placed buffer whose last Release runs meanwhile cannot take STATE, so forget_buffer queues it in FORGOTTEN for the next lock_state. If the new reserved resource gets the released one's address, place_buffer recorded the new buffer under it and the next lock_state let it go: its tiles were unpinned while the buffer was live on the GPU. The new buffer is now recorded by record_buffer, which lets the queued buffers go first. This is item 2 of xcl-dev#2457; item 1 (the fence quarantine on unpin) is claimed on the issue and not in this change. Test: the old buffer at an address is queued as released, a new one is recorded there, then lock_state's drain runs. Without the fix the new buffer's entry is gone; with it the entry and its pin stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
|
Tested: current PR head merged onto current
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. |
|
Heads-up for merge order: #2531 renames AI use: Claude Code (Claude Opus 5.5) found this by building the merge. |
|
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. |
|
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).
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. |
|
NVIDIA test report for
Lib tests only; no title run. AI-assisted (Claude Code, Claude Opus 5.5). |
…#2528 + xcl-dev#2539) (cherry picked from commit 95bc8198b89ff2c73a556cb370ab5055bbf821ec)
|
Independent desktop NVIDIA verification of PR #2528 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib a_buffer_released_during_a_placement_does_not_take_the_new_one_with_it -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1324 filtered out × 3 (0.22s, 0.19s, 0.19s, 0 skipped — live D3D12 execution on RTX 4060) |
cargo test --release -p xcl --lib hle::d3d12x::sparse:: -- --test-threads=1 (3 consecutive runs) |
18 passed; 0 failed; 1 ignored; 1306 filtered out × 3 (1.32s, 1.34s, 1.32s, 0 skipped) |
cargo build --release -p xcl |
Clean build (1m 07s, exit 0, 0 new warnings) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact parent & merge-base (6d12f58a229bc73889878a448c64dc3af25eeba0, cached baseline on the same machine):
xcl-smoke v1
commit: 6d12f58a229bc73889878a448c64dc3af25eeba0
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1606 (PresentX 1606)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14004 MB
PR #2528 (237882e85be2919904333b6b084baee4cc4c4411):
xcl-smoke v1
commit: 237882e85be2919904333b6b084baee4cc4c4411
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1610 (PresentX 1610)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14007 MB
Runtime log observations (xcl.log)
9225log lines,0[ERROR]/ device-removal / panic lines.- Final draw/memory telemetry in log:
18508 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14006 MB committed by the process; video memory 6116 MB local, 4682 MB non-local.
Limits of coverage
- Protecting a newly placed sparse buffer when an earlier buffer at the same pointer address is released concurrently during placement was directly exercised on desktop D3D12 / RTX 4060 via
a_buffer_released_during_a_placement_does_not_take_the_new_one_with_it(3/3,0skipped) andhle::d3d12x::sparse::(18/0/1× 3). - The 60 s retail smoke on
title: 29640639exercises live sparse VRAM allocation (7445 MBsparse) with zero device removals or crashes (frame-count delta vs. cached parent reflects single-run startup variance, not this PR).
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Part 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; Recompiler: the per-lane form takes f16 converts and products from #1426 #2182 removes them)cargo test -p xcl --lib d3d12x::sparse: 18 passed, 0 failed, 1 ignoredRegression run
main:
PR:
Not tested
AI use