D3D12.X: a mid-list split gets its next segment before it closes the list #2717
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!2717
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2717"
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?
@Kalmarv on GitHub · 2026-11-26 08:17 UTC · original
Kalmarv:split-close-order→main· +254 −23 · 3 files · 2 commits · openA mid-list split (a
Wait64BitValueXafter aWrite64BitValue*in the same list) closed the title's list before it had the next segment. When the next segment could not be made (CreateCommandListfailed), the split gave up with the list already closed: the title went on recording into a closed list. All of it was lost, Write64 cell writes included, and the title's ownClosethen failed. Now the split gets the next segment first: a spare, or a new list made closed withCreateCommandList1. It is opened on the allocator only after the Close, because an allocator backs one recording at a time. When none can be had, the list stays open and the wait stays in it, as when the split is turned off (XCL_SPLIT_MIDLIST_WAIT=0).Part of #1452. This may not be what stops the reporter's run (#1452), where a Write64 cell is recorded and never submitted. That log shows a successful split (
#1) and, in what was posted, nomid-list split … CreateCommandList failedwarning. This is one path that gives that state; #2691 (a list forgotten after the runtime frees it, so a new list at its address loses its Write64s) is another. The dump line that tells them apart is in #2718 (stacked on #2244). @xpatfussy69x, if you can: one run of your route with that PR andnvidia-smi dmon -s pucm -o Tbeside it, plus anymid-list splitlines from the log.What is in it
crates/xcl/src/hle/d3d12x/list_x.rs:splittakes the next segment (next_segment_list) before it closes the list. A failed Close puts the segment back as a spare. A failed Reset of it releases that list (title_list::release_segment) and falls back toCreateCommandListon the allocator, as before.crates/xcl/src/hle/d3d12x/real.rs:create_closed_pc_command_list(CreateCommandList1, closed, no allocator), next tocreate_raw_pc_command_list.23d3131(luckyteagirl's review): before, a next segment whose Reset failed was dropped without a Release, and now a fresh CreateCommandList1 list could take that path. It is released before the fallback is made. Testa_split_whose_next_segment_fails_its_reset_releases_that_list_once: the Reset fails (a test-only switch), once with the fallback made and once with it failing too. Each time the list's reference must be released exactly once.a_split_without_a_next_segment_leaves_the_list_recording: a split with no next segment to be had (a test-only switch), then one that makes its segment with CreateCommandList1. A GPU write recorded after each wait must land, and both Write64s must count as submitted.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4at23d31316(onmainb49be183): 1435 passed, 2 failed, 47 ignored. The 2 aregpu::recomp::link_tests::gpu_linked_memory_accessorsandlinked_programs_keep_their_declarations: this machine's DXC (Windows SDK, 1.7.2308) rejects[WaveSize]on a function that is not an entry point. They fail the same way onmain's code.V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32),heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsa_split_without_a_next_segment_leaves_the_list_recordingfails withmain'ssplitand the same switch (the list is closed after the failed split, so the next split's Close fails and no segment is made: 1 segment, expected 2), and passes with this change.a_split_whose_next_segment_fails_its_reset_releases_that_list_oncefails with therelease_segmentcall taken out (the list's reference is still held:the split released the list whose Reset failed, once), and passes with it.7fce129(#2717):a_split_without_a_next_segment_leaves_the_list_recordingpasses on an AMD Radeon RX 9070 XT (driver 32.0.32029.2010).cargo test -p xcl --lib -- d3d12x::gave 255 passed, 0 failed, 2 ignored on it and on an RTX 3060 (driver 32.0.16.1088). The test uses the default adapter, so it did not run on the RTX 3060.7fce129under Wine 11.21 + vkd3d-proton on an RTX 4070 (#2717): 2 runs with and 2 without, each with one successful mid-list split and no difference between the two.a_split_without_a_next_segment_leaves_the_list_recordingpassed under Wine. The failure path this PR changes (a split whose next segment cannot be made, or whose Reset fails) was not reached in those runs.23d3131on an RTX 4060 8 GB (driver 621.14), release. Both split tests passed, includinga_split_whose_next_segment_fails_its_reset_releases_that_list_once;title_list::3,list_x::42 andreal::60 passed, with no skips. A paired 60 s smoke of another title,mainb49be18against23d3131: 1518 against 1547 frames, no device removal, no crash. The full suite, AMD, Intel and Wine were not run there.Regression run
main (
b49be18):this PR (
23d3131):Not tested
23d3131's test on AMDCreateCommandListor Reset failure: the tests switch them offsplit command listline in either log), so they check the rest of the runtime onlyAI use
🤖 Generated with Claude Code
@DarkPanda69 on GitHub · 2026-11-26 08:36 UTC · original · edited 2026-11-26 13:38 UTC
Update for head
23d3131: rerun onmainb49be18, same cards and--nocapture. The filtera_split_gives 2 passed, no SKIPPED, on the RX 9070 XT (the default adapter these tests use):a_split_without_a_next_segment_leaves_the_list_recordingand the new fault-injecteda_split_whose_next_segment_fails_its_reset_releases_that_list_once.d3d12x::gives 256 passed, 0 failed, 2 ignored, no SKIPPED, on both the RX 9070 XT and the RTX 3060.AMD run (listed as untested): the new test passes on an RX 9070 XT, and the
d3d12x::tests pass on it and on an RTX 3060.Head
7fce129applied onmainb49be18, debug, Windows 11 Pro 26200, card chosen withXCL_ADAPTER, run with--nocapture:a_split_without_a_next_segment_leaves_the_list_recording: ok, no SKIPPED. The test makes its device on the default adapter, which is the RX 9070 XT (RDNA4, driver 32.0.32029.2010) on this machine.cargo test -p xcl --lib -- d3d12x::: 255 passed, 0 failed, 2 ignored, no SKIPPED, on both the RX 9070 XT and the RTX 3060 (12 GB, driver 32.0.16.1088).Not tested: the reporter's route on the RTX 3060. There is no title here, and the new test always uses the default adapter, so it did not run on the RTX 3060. Also not tested: Intel, a real
CreateCommandListfailure.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@luckyteagirl on GitHub · 2026-11-26 08:37 UTC · original · reviewed
At exact head
7fce129on current mainb49be18, a failed Reset abandons an owned command-list reference. This is a source-derived review; I did not inject a D3D12 Reset failure.The no-spare path now gets
nextfromcreate_closed_pc_command_list, whose normal-device branch transfers ownership withinto_raw()and adopts it. After the current list closes,splittriesreset_list(next, …). If that Reset fails, the branch atlist_x.rs:2834–2845replacesnextwith a separately created fallback list or returnsNone; neither outcome releases or pools the failednext. The earlier code had a similar hole for a popped spare, but this PR makes a fresh list reachable through the failure path too, including when resource pressure is already causing Reset/creation failures.Could the failed
nextbe released through the adopted-list cleanup path before trying the fallback (rather than reusing a list whose Reset failed)? A fault-injected Reset failure with both successful and failed fallback creation could assert that the abandoned list's COM reference is released exactly once.AI assistance: three GPT-6.2 Sol agents independently identified the ownership path; GPT-6.2 Astra checked the exact-head source and wording.
@Royalflamejlh on GitHub · 2026-11-26 10:09 UTC · original
The title ran the same with this pull request as without it, in 2 runs of each under Wine + vkd3d-proton on an RTX 4070. Each run split one list around a mid-list Wait, 0.6 to 2.5 s after the title's first call to the stub
ID3D12GraphicsCommandList10::#101, logged nomid-list splitwarning, and had stopped presenting by 2.0 to 3.3 s after that#101. The split was the same in both trees, with the same log line and no failure, so the new order changed nothing the runs could see. The case it fixes, a split whose next segment cannot be made, did not happen in these runs.a_split_without_a_next_segment_leaves_the_list_recordingpassed under Wine (-- split --test-threads=4: 35 passed, 1 ignored).Setup:
mainb49be18+ #684 (e56dbc3, which our runs need to get this far; merged as4044c646), against the same + this pull request (7fce1295), release, Wine 11.21 Staging + vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch,VKD3D_CONFIG=ignore_shared_fence, RTX 4070 12 GB, driver 615.71.09. 120 s each, A pressed once the title presented steadily,XCL_PSO_PRELOAD=0, the first-run screens completed once, no story progress.#101main+ #684main+ #684D3D12.X: split command list (type 2) around mid-list Wait after Write64 (#1).Read: the split now takes its next segment (a spare, else
CreateCommandList1) atlist_x.rs:2772, before the Close at 2813, and the early returns at 2780 and 2818 put it back as a spare. The runs never reached the failed-Reset branch at 2834–2845, where luckyteagirl's review asks for that segment to be released.Not tested: Windows; a split whose next segment cannot be made, in the title; the whole test suite.
AI use: Claude Code (Claude Opus 5.5) ran the title and the tests and wrote this comment.
Posted without review by a person: the account owner was away and reads replies later.
@Decodere on GitHub · 2026-11-26 12:10 UTC · original
Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2717 at
23d313161e3a3a09bbd9353f9a183865373c31bf(parent7fce1295e919607e3db30c3bc4a31755cf3209d2; merge-baseorigin/mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7). Measurements and targeted test results only; not a full source review.Setup
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200rustc 1.100.0 (0ef1bc386 2026-11-09), DXC1.9.2609.5, release builds, warm DXIL/pipeline caches, quiet machine (zero concurrent builds/tests during timed runs)title: 29640639viascripts/smoke.ps1 -Seconds 60(XCL_NETWORK=0 XCL_ACTIVITY=1, default flags, no input)Targeted RTX 4060 release unit tests (
23d31316)cargo test --release -p xcl --lib a_split_without_a_next_segment_leaves_the_list_recording -- --nocapture: 1 passed, 0 failed, 0 ignored (0.25 s, exit0).cargo test --release -p xcl --lib a_split_whose_next_segment_fails_its_reset_releases_that_list_once -- --nocapture: 1 passed, 0 failed, 0 ignored (0.20 s, exit0).cargo test --release -p xcl --lib hle::d3d12x::title_list:: -- --test-threads=4: 3 passed, 0 failed, 0 ignored (0.02 s,0skipped, exit0).cargo test --release -p xcl --lib hle::d3d12x::list_x:: -- --test-threads=4: 42 passed, 0 failed, 0 ignored (0.70 s,0skipped, exit0).cargo test --release -p xcl --lib hle::d3d12x::real:: -- --test-threads=4: 60 passed, 0 failed, 0 ignored (0.65 s,0skipped, exit0).Observations
a_split_without_a_next_segment_leaves_the_list_recordingand the updated failed-Reset cleanup regression testa_split_whose_next_segment_fails_its_reset_releases_that_list_once) plus all 105 targetedtitle_list::,list_x::, andreal::tests passed cleanly in--releaseon native Windows 11 / RTX 4060 with0skips.exit: 0x0,1547frames shown,60 60 60steady-state presents per 2 s,0device removals,0crashes,13977 MBpeak commit vsorigin/mainb49be183's14018 MB/1518frames).Paired 60 s RTX 4060 smoke (
b49be183vs23d31316)Merge-base
origin/main(b49be183):PR #2717 head (
23d31316):Limits of coverage
23d31316(only targetedtitle_list::,list_x::, andreal::release tests plus paired quiet 60 s smoke).Resetrelease paths are covered by the two targeted unit tests above.26200) / discrete RTX 4060 only; no AMD, Intel, or Wine/Linux run on this host.AI use
Ran the targeted release unit tests and paired quiet 60 s smoke runs with assistance from Google Antigravity (Gemini 4 Neon); all test counts and smoke blocks were taken directly from
cargo testandscripts/smoke.ps1outputs.@Kalmarv on GitHub · 2026-11-26 12:14 UTC · original
@luckyteagirl Thanks, confirmed and fixed in
23d3131, a commit on top of7fce129, so that commit is the whole change since your review. When the next segment's Reset fails,splitnow releases that list throughtitle_list::release_segment(the same Release andbind::forgetthe wrapper's own Release does for its segments), then makes the fallback. The newa_split_whose_next_segment_fails_its_reset_releases_that_list_oncefails the Reset with a test-only switch, once with the fallback made and once with it failing too. It holds an extra reference on the list and checks that its own Release afterwards is the last one. That fails with therelease_segmentcall taken out and passes with it. Suite at23d3131on an RTX 5070 Ti: 1435 passed, 2 failed (the two DXC 1.7link_tests, as onmain), 47 ignored. Our new smoke pair at23d3131is in the description.Thanks @DarkPanda69 for the RX 9070 XT and RTX 3060 runs of
7fce129, and @Royalflamejlh for the four Wine + vkd3d-proton title runs on an RTX 4070. In Royalflamejlh's runs each split succeeded, so they did not reach the failure path this PR changes. Neither of those runs covers23d3131. Thanks too @Decodere for the RTX 4060 run of23d3131: both split tests passed, the fault-injected one included, and so did the paired smoke (1518 against 1547 frames, no removal). All three are in Tested.AI use: Claude Code, Claude Opus 5.5 wrote the fix, the test and this reply.
github-bot referenced this pull request2026-11-26 12:40:17 +00:00
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.