Repository navigation
Conversation
cl_release dropped what XCL keeps by a PC command list's address (list_x::on_release, bind::forget, dred::forget_list) only after the runtime's final Release had freed the list, so a list created on another thread in between could get the address and lose its bind state, allocator, last submit and DRED marks. As in res_release and xcl-dev#2422, the last reference (AddRef returns 2) now forgets the list first. A fake list whose Release hands its address to a new list at once loses the new list's state on main. The parallel flake a_dispatch_with_a_pipeline_still_building_waits_at_the_submit failed 13/200 on main and 6/200 with this change alone; xcl-dev#1453 closes the longer window in title_list::release (0/400).
|
Tested on the Linux/Wine lane, full standard env (AMD rig: Ryzen 9 9900X, 96 GB DDR5, RX 7900 XT 20 GB, Arch kernel 7.2.15, Mesa 26.2.5 RADV, wine-11.0 Proton, rustc 1.94.0; |
|
RX 6800M verification at exact PR head
I attempted a longer 60-second clean-main control. A separate low-memory monitor stopped that control after about 22 seconds when available commit fell to 1,015 MB, so there is no comparable 60-second result. These short runs show startup and presentation; they do not trigger the command-list address-reuse race or establish world-load/performance behavior. I did not run the full workspace suite on this head. AI-assisted test report with Codex. |
…ease `heap_release`, `mem_heap_release`, `q_release` and `alloc_release` called the driver's Release first and, when it returned 0, removed what XCL keeps by the object's address. Once the driver has freed the object, another thread can create a new one at the same address and record its own entries; the cleanup then removes those. For an ID3D12Heap that is worse than lost bookkeeping: `mem_heap_release` takes the new heap's `HEAP_UMA` entry and frees its block of unified memory while the new heap's buffers live in it. A descriptor heap loses its console slots, a queue or an allocator its list_x / alloc_pool entries. `release_taking_first` takes a reference first; when AddRef returns 2 the caller holds the last one, so the entries are removed while the address is still this object's, and what must outlive the object (the heap's memory block, a descriptor heap's slots and shadow) is freed after the last Release, as before. `console_heap::unregister` is split into `take` and `free` for that. The command list and pipeline releases have the same order; xcl-dev#2691, xcl-dev#1453 and xcl-dev#2422 change those (xcl-dev#2690). Assisted-by: Claude Code (Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Test report: passes on NVIDIA, and with #1453 the dispatch flake from #2690 did not show in 300 parallel runs. Exact head Tested
Not tested
Claude Code (Claude Opus 5.5) ran the tests and wrote this report. |
…ease `heap_release`, `mem_heap_release`, `q_release` and `alloc_release` called the driver's Release first and, when it returned 0, removed what XCL keeps by the object's address. Once the driver has freed the object, another thread can create a new one at the same address and record its own entries; the cleanup then removes those. For an ID3D12Heap that is worse than lost bookkeeping: `mem_heap_release` takes the new heap's `HEAP_UMA` entry and frees its block of unified memory while the new heap's buffers live in it. A descriptor heap loses its console slots, a queue or an allocator its list_x / alloc_pool entries. `release_taking_first` takes a reference first; when AddRef returns 2 the caller holds the last one, so the entries are removed while the address is still this object's, and what must outlive the object (the heap's memory block, a descriptor heap's slots and shadow) is freed after the last Release, as before. Two last-but-one releases at once both miss `AddRef == 2`; the one whose Release ends at 0 then takes the entries after the object is gone, as before this change, so nothing is left behind. `console_heap::unregister` is split into `take` and `free`. The command list and pipeline releases have the same order; xcl-dev#2691, xcl-dev#1453 and xcl-dev#2422 change those (xcl-dev#2690). Assisted-by: Claude Code (Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(port upstream xcl-dev#2520 + xcl-dev#2691) (cherry picked from commit 87b65e230fd1e87fda0839146a41c2bca2420fb3)
|
A data point from our AMD iGPU (RDNA2), AI use: Claude Code (Claude Opus 5.5) ran the arms and wrote this. |
Apply thehollowedone's patch and reference-count regression from xcl-dev#2622 comment 7187891221. A list whose Close failed cannot be reset, so release it rather than losing its owner on later spare reuse, and clear its dispatch-chain predecessor. Adjust the suggested initial-refusal Release call to use the adopted vtable too: cl_release must clean address-keyed state instead of bypassing it through orig_fn. This is the same lifecycle class discussed in xcl-dev#1453 and xcl-dev#2691. Assisted-by: Codex (GPT-6.1-Sol)
A cell recorded and never submitted (xcl-dev#1452: rec 0x619, sub 0x0@qNone) did not say which list recorded the value or what became of that list. Each cell now keeps the PC list and time of the recording that set its recorded_max, and each list that recorded a Write64 keeps its last execute, Reset and Release (signal_write64_fences, the KickoffX submit, reset_pc, clear_segment_state, on_release). The cell entry in cells_behind_summary prints them as their time after the recording, or "no": reset or released with no execute is a recording thrown away (xcl-dev#2691's address reuse shows as a release), executed is a miss on the submit side, and none of the three a list the title still holds. Part of xcl-dev#1452. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A cell recorded and never submitted (xcl-dev#1452: rec 0x619, sub 0x0@qNone) did not say which list recorded the value or what became of that list. Each cell now keeps the PC list and time of the recording that set its recorded_max, and each list that recorded a Write64 keeps its last execute, Reset and Release (signal_write64_fences, the KickoffX submit, reset_pc, clear_segment_state, on_release). The cell entry in cells_behind_summary prints them as their time after the recording, or "no": reset or released with no execute is a recording thrown away (xcl-dev#2691's address reuse shows as a release), executed is a miss on the submit side, and none of the three a list the title still holds. Part of xcl-dev#1452. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@SergeAx a small suggestion for the concurrent-release case that the description leaves open, in case it is useful. On
Scope is the binding state only. Test: a GPU-free fake final release that checks a replacement at the same address, an absent old entry, and ordinary final cleanup. On Not tested: a full suite or a title run with the patch. patch on 008fc96AI use: Codex (GPT-6.2-Sol) wrote the patch and test and ran them. Claude Code (Claude Opus 5.5) reviewed it and wrote this. |
|
@KDenKC thanks, the generation check is right for what it covers. I read it against I'd still keep it out of this PR:
If you want to take it on, a follow-up PR stacked on this one, with your test and the guard for all three, is the way I'd go; I'd test it here. AI use: Claude Code (Claude Opus 5.5) checked the patch against the code and wrote this reply. |
|
Independent desktop NVIDIA verification of PR #2691 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib a_new_list_at_a_released_lists_address_keeps_its_state -- --nocapture |
1 passed; 0 failed; 0 ignored; 1336 filtered out (0.00s) |
cargo test --release -p xcl --lib hle::d3d12x::real:: -- --test-threads=4 (3 consecutive runs) |
61 passed; 0 failed; 0 ignored; 1276 filtered out × 3 (0.72s, 0.70s, 0.66s) |
cargo test --release -p xcl --lib hle::d3d12x::list_x:: -- --test-threads=4 (3 consecutive runs) |
40 passed; 0 failed; 0 ignored; 1297 filtered out × 3 (0.62s, 0.62s, 0.61s; a_dispatch_with_a_pipeline_still_building_waits_at_the_submit passed 3/3) |
cargo build --release -p xcl --bin xcl |
Clean build (1m 11s, exit 0) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact parent & merge-base (b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, cached baseline on the same machine):
xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1518 (PresentX 1518)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14018 MB
PR #2691 (008fc9618549088436a454a2247bfd4d62aeb5cc):
xcl-smoke v1
commit: 008fc9618549088436a454a2247bfd4d62aeb5cc
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1599 (PresentX 1599)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14018 MB
Runtime log observations (xcl.log)
9219log lines,0[ERROR]/ device-removal / panic lines.- Final draw/memory telemetry in log:
19507 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14017 MB committed by the process; video memory 6116 MB local, 4683 MB non-local.
Limits of coverage
- Running 3 parallel passes (
--test-threads=4) ofhle::d3d12x::real::andhle::d3d12x::list_x::(3/3 clean ona_dispatch_with_a_pipeline_still_building_waits_at_the_submit) alongsidea_new_list_at_a_released_lists_address_keeps_its_stateand a 60 s retail smoke confirms clean behavior and zero regression on RTX 4060, but 3 runs are not a high-iteration statistical flake stress run (the remainingtitle_list::releaserace window noted in the PR description is tracked separately in#1453). - Frame-count delta vs. the cached exact-parent smoke (
1599vs.1518frames) reflects normal single-run startup variance and is not attributed to this PR.
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
A cell recorded and never submitted (xcl-dev#1452: rec 0x619, sub 0x0@qNone) did not say which list recorded the value or what became of that list. Each cell now keeps the PC list and time of the recording that set its recorded_max, and each list that recorded a Write64 keeps its last execute, Reset and Release (signal_write64_fences, the KickoffX submit, reset_pc, clear_segment_state, on_release). The cell entry in cells_behind_summary prints them as their time after the recording, or "no": reset or released with no execute is a recording thrown away (xcl-dev#2691's address reuse shows as a release), executed is a miss on the submit side, and none of the three a list the title still holds. Part of xcl-dev#1452. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A cell recorded and never submitted (xcl-dev#1452: rec 0x619, sub 0x0@qNone) did not say which list recorded the value or what became of that list. Each cell now keeps the PC list and time of the recording that set its recorded_max, and each list that recorded a Write64 keeps its last execute, Reset and Release (signal_write64_fences, the KickoffX submit, reset_pc, clear_segment_state, on_release). The cell entry in cells_behind_summary prints them as their time after the recording, or "no": reset or released with no execute is a recording thrown away (xcl-dev#2691's address reuse shows as a release), executed is a miss on the submit side, and none of the three a list the title still holds. Part of xcl-dev#1452. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A cell recorded and never submitted (xcl-dev#1452: rec 0x619, sub 0x0@qNone) did not say which list recorded the value or what became of that list. Each cell now keeps the PC list and time of the recording that set its recorded_max, and each list that recorded a Write64 keeps its last execute, Reset and Release (signal_write64_fences, the KickoffX submit, reset_pc, clear_segment_state, on_release). The cell entry in cells_behind_summary prints them as their time after the recording, or "no": reset or released with no execute is a recording thrown away (xcl-dev#2691's address reuse shows as a release), executed is a miss on the submit side, and none of the three a list the title still holds. Part of xcl-dev#1452. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A cell recorded and never submitted (xcl-dev#1452: rec 0x619, sub 0x0@qNone) did not say which list recorded the value or what became of that list. Each cell now keeps the PC list and time of the recording that set its recorded_max, and each list that recorded a Write64 keeps its last execute, Reset and Release (signal_write64_fences, the KickoffX submit, reset_pc, clear_segment_state, on_release). The cell entry in cells_behind_summary prints them as their time after the recording, or "no": reset or released with no execute is a recording thrown away (xcl-dev#2691's address reuse shows as a release), executed is a miss on the submit side, and none of the three a list the title still holds. Part of xcl-dev#1452. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assisted-by: Codex (GPT-5.6-sol)
Fixes #2690.
real::cl_releasedropped what XCL keeps by a command list's address only after the runtime's finalReleasehad freed the list, so a list created on another thread in between could get the address and lose its bind state, allocator, last submit and DRED marks. Asres_releaseand #2422 do, the last reference (AddRefreturns 2) now forgets the list first. When two last-but-one releases race, both miss it and the list is forgotten after its release, as before.What is in it
crates/xcl/src/hle/d3d12x/real.rs:cl_releaseforgets the list before the runtime's finalRelease(forget_command_list).crates/xcl/src/hle/d3d12x/real.rs(list_release_tests):a_new_list_at_a_released_lists_address_keeps_its_state, a fake list whoseReleasehands its address to a new list at once.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4at008fc961(onmainb49be183), with a retail title running on the same GPU: 1430 passed, 6 failed, 47 ignored. The 6: DXIL GPU fuzz tests reproducibly fail with E_OUTOFMEMORY on RTX 5060 #1905 (fuzz_validate_and_gpu_0.._3);vram::tests::d32s8_targets_take_their_own_size_of_video_memory(D3D12.X: a direct list at a released compute list's heap vtable address gets the compute list's methods #2588, which D3D12.X: a list vtable at a reused heap address gets its own methods #2593 fixes);list_x::tests::a_reset_while_the_last_submit_runs_records_on_another_pc_list(GPU test results: NVIDIA RTX 3080 (wave32) and AMD RDNA2 iGPU (no mesh shaders) #42, parallel-only; not explained by this change, see D3D12.X: a command list is forgotten after the runtime frees it, so a new list at its address can lose its state #2690).V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32);heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsmain'scl_release(the new list's bind state is gone) and passes with this change.--test-threads=4 hle::d3d12x::list_x, builds alternating:a_dispatch_with_a_pipeline_still_building_waits_at_the_submitfailed in 13 of 200 runs onmainand 6 of 200 with this change. Most of it istitle_list::release's longer window, which D3D12.X: unpin retired split segments from alloc_pool and guard title_list::release ABA #1453 closes (0 of 400 with D3D12.X: unpin retired split segments from alloc_pool and guard title_list::release ABA #1453, 0 of 400 with both).Regression run
main:
this PR:
Not tested
cl_release: the two conflict there textually (forget_command_listwould take D3D12.X: reclaim idle put-aside allocators and retire orphaned batches #2138's order)AI use