Repository navigation
Conversation
|
Test run of Tested
Review: Taking the buffer's pins out before the release and dropping them outside the sparse-state lock removes the second wait-for-each-other path (allocator reset holding the lock vs. the release callback taking it), the same pattern #443 used for the device replacement. I found nothing to change. Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
|
Test report: with
Hardware: Intel Core i7-7700K, 16 GB RAM, NVIDIA GeForce RTX 5080 16 GB (driver 610.47), Windows 10 22H2 (19045), Agility SDK 620, rustc 1.100.0. AI use: Claude Code with Claude Fable 5.2 read the thread dumps (XCL frames symbolised from the build's PDB) and wrote this; the runs are from the machine named. |
|
The same cycle on AMD (RDNA4), from a retail run that froze at 5 s and stayed frozen for 20 minutes until it was stopped. Two title threads in the thread dump, symbolised with the PDB of a rebuild of the run's tree (
The run had Setup: AMD Radeon RX 9070 XT 16 GB (driver 26.11.2), Ryzen 7 5800X3D, 32 GB, Windows 10 IoT Enterprise LTSC 21H2 (19044), release build. I haven't run #789 itself here. Written with Claude Code (Claude Opus 5.5) from the run's log and thread dump. |
|
Retail DRED startup lock on AMD RDNA4 Tested
Not tested — #789 alone, clean upstream main, or rendered gameplay. AI use — OpenAI Codex ( |
|
Test report: the same result on AMD RDNA4 (RX 9070 XT), with
The merged trees differ from The retail title of #505, release builds,
This covers the two cases @deepdev237's RDNA4 report leaves out: this PR on its own, and clean "Still from" is the last 2 s activity line. No crash or device removal in any run. #789's "could not retire owned block" warning appears in none of the six logs. These runs have no thread dumps, so I can't say where
Hardware: AMD Radeon RX 9070 XT 16 GB (RDNA4, driver 26.11.2), Ryzen 7 5800X3D, 32 GB RAM, Windows 10 IoT Enterprise LTSC 21H2 (19044), rustc 1.100.0 MSVC, DXC 1.9.2609.5. Not tested: this PR's head on its own base ( Written with Claude Code (Claude Opus 5.5): it made the merges and the run script, ran the test suite and wrote this report. The title runs are mine, on the machine named. |
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
`res_release` and `mem_heap_release` gave a block from `sparse::alloc` back with `sparse::free`, which takes the sparse state's lock (`STATE`, through `decommitted`). D3D12 can make a resource's or a heap's last Release inside a call of its own on another thread, and `before_execute` calls D3D12 with `STATE` held: the two threads then wait for each other. xcl-dev#1981 fixed this for a placed buffer's pins (`forget_buffer`); this is the other half of xcl-dev#789. The release now queues the block (`release_owned_block`). The block stays reserved and committed, so its address is not handed out again, until the next `alloc`, `alloc_in` or `before_execute` decommits it and gives it back (`reclaim_released_blocks`, through `free`), without `STATE` held and outside any D3D12 callback. One thread reclaims at a time (`RECLAIMING`): a caller that finds the queue empty while another thread gives blocks back waits until they are back. Tests: a_buffer_or_heap_released_while_the_state_is_held_does_not_wait_to_free_its_block (with the two hooks calling `free` again it fails after its 5 s timeout: "a last Release waited for the sparse state's lock to free its block"), an_owned_block_released_while_the_state_is_held_does_not_wait_for_it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
d5723ae to
b4f9aaf
Compare
|
@DavidM1911 thanks, rebased onto
Written with Claude Code (Claude Opus 5.5) from the runs on the machine named. |
This is what is left of #789 after #1981.
#789 had two halves. #1981 fixed the first one: a placed buffer's last Release (
forget_buffer)no longer waits for the sparse state's lock (
STATE). This PR is the second half.res_releaseandmem_heap_releasegive back a block that XCL took withsparse::alloc. Onmain(
8b957be) they still callsparse::free, which takesSTATEthroughdecommitted. D3D12 canmake a resource's or a heap's last Release inside one of its own calls on another thread (a list's
Resetin D3D12Core, in the thread dumps below).before_executecalls D3D12 withSTATEheld(
begin_slot→ID3D12CommandAllocator::Reset). So the two threads can wait for each other, thesame deadlock as in #789.
Now the release only queues the block (
release_owned_block). The block stays reserved andcommitted, so its address cannot be handed out again yet. The next
alloc,alloc_inorbefore_executedecommits it and gives it back (reclaim_released_blocks, throughfree). Thatruns without
STATEheld and outside any D3D12 callback. One thread reclaims at a time(
RECLAIMING): a caller that finds the queue empty while another thread is giving blocks backwaits until they are back.
RECLAIMINGis only taken beforeSTATE, never with it held, andalloc/alloc_inalready takeSTATE(throughcommitted), so the reclaim adds no new lock tothose paths. A reclaimed block goes through
free→decommittedas before: its tiles are parked,and
main'sflush_parkedand quarantine unmap and free them. #1981'sFORGOTTENpath isunchanged.
What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:release_owned_block,reclaim_released_blocks,RELEASED_BLOCKS,RECLAIMING.alloc,alloc_inandbefore_executereclaim first. Two tests.crates/xcl/src/hle/d3d12x/real.rs:res_releaseandmem_heap_releasecallrelease_owned_blockin place offree. Two#[cfg(test)]helpers that give a test buffer orheap a block.
Tested
NVIDIA GeForce RTX 5080 16 GB (driver 610.88), Intel Core Ultra 7 265, 32 GB RAM, Windows 11
build 26300, Rust 1.96.0 MSVC, release build (the suite in its default debug test profile).
This head (
b4f9aaf, rebased onmain8b957be):cargo build --locked --release -p xcl --bin xclsucceeds. Its one warning (
vram.rs:1110,RetiringBatch::heapsis never read) ismain's.cargo test --workspace -- --test-threads=4on this head (aftercargo build --workspace):1448 passed, 0 failed, 47 ignored (SKIPPED GPU tests: 25 forms of 15 tests, none of them a
sparse test. 21 are "no wave64": this card has none. 3 are f16 forms the lowering refuses
(
V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32, gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426). 1 is "no heap windows":gpu_compute_e2e::heap_window_out_of_memory_falls_back_to_the_switch_form.) Both new testspassed. Of the sparse tests only
early_commit_timingis ignored, as onmain.The 25 SKIPPED lines
New tests:
a_buffer_or_heap_released_while_the_state_is_held_does_not_wait_to_free_its_block(GPU,ran on the RTX 5080): a real buffer and a real heap get their last Release while another
thread holds
STATE. With the two hooks callingfreeagain, it fails after its 5 s timeout:"a last Release waited for the sparse state's lock to free its block".
an_owned_block_released_while_the_state_is_held_does_not_wait_for_it: the release does notwait for
STATE, and the queued block keeps its reservation, its pages and its contents untilit is reclaimed. After the reclaim it is given back.
Earlier runs of the same change, on older bases:
d5723aeonmain9633138:cargo check --release --testsclean, andcargo test -p xcl --lib -- sparse --test-threads=4: 26 passed, 0 failed, 1 ignored(
early_commit_timing, ignored onmaintoo).main7b9eabb:cargo build --workspace --frozenwithout warnings; the sparse tests22 passed / 1 ignored in 8 runs;
cargo test --workspace -- --test-threads=4: 1093 passed,0 failed, 46 ignored (
SKIPPED: 13 tests, all "no wave64", "no heap windows" or refused f16forms; none of them a sparse test).
Reports in this thread, all on the earlier head
bc82410(the first half, now onmainasD3D12.X: a buffer's last release does not wait for the sparse state's lock #1981, with D3D12.X: the late-release drain gets the sparse queue without the sparse state's lock #968 for
queue()). They show the deadlock pattern this PR closes the rest of:STATEheld across a D3D12 call while a release hook inside D3D12Core waits for it. None of themran this head.
dump of the cycle; with
bc82410+ D3D12.X: the late-release drain gets the sparse queue without the sparse state's lock #968 a retail title runs withXCL_DRED=1(918 / 910 / 920frames against 1 frame on
main).the same cycle from a retail run frozen for 20 minutes; then
bc82410+ D3D12.X: the late-release drain gets the sparse queue without the sparse state's lock #968 onmain930e8b4: 1104 / 1179 frames against 1 frame, and the suite754 passed, 0 failed, 41 ignored, no SKIPPED tests.
(RDNA4): the same cycle from a release PDB;
bc82410+ D3D12.X: the late-release drain gets the sparse queue without the sparse state's lock #968 cleared the startup stall.the suite on
bc82410merged ontomaine50836b, 706 passed, 0 failed, 41 ignored, and a review.Regression run
scripts/smoke.ps1 -Game <the retail title of #505> -Seconds 120 -Title 'retail title of 505', release builds, RTX 5080, both with the same environment:XCL_DIRECT_DXIL=1 XCL_PIPELINE_THREADS=8 XCL_PIPELINE_MAX_KB=0(XCL_DIRECT_DXIL=1sends compute through the direct translator, in the launch preparation and in game; the other two only affect the preparation: 8 driver compiles at once, and no size cap, which otherwise stops the launch). Same shader cache for both; no input.main:
PR:
main's run started right after its launch preparation had built the cache's last 98 large pipelines, which likely explains its lower frame count (791 against 3,307); the PR's run started on the warm cache. Both stayed on the title's first screens (no input) and neither removed the device or crashed.
Not tested
heap_release→console_heap::unregisterstill callssparse::freefrom afinal Release. D3D12.X: decommit released sparse blocks outside the driver callback #789 did not change it, and neither does this PR.
AI use
main, ranthe build and the suite on the machine named, and wrote this description.
🤖 Generated with Claude Code