Skip to content

D3D12.X: a split whose Close fails leaves that list out and goes on - #2925

Draft
KOLESNiii wants to merge 5 commits into
xcl-dev:mainfrom
KOLESNiii:d3d12x-split-fail-closed
Draft

KOLESNiii wants to merge 5 commits into
xcl-dev:mainfrom
KOLESNiii:d3d12x-split-fail-closed

Conversation

@KOLESNiii

@KOLESNiii KOLESNiii commented Nov 27, 2026 •

Copy link
Copy Markdown

Part of #2787 (item 4): when the Close that ends a mid-list split's segment fails, that list no longer stays in the recording.
Stacked on #2717; only the top three commits (a089b840, b926dd4f, a8eafbd8) belong here.

Measured on an RTX 2070 SUPER (driver probe):

  • a list whose Close failed removes the device when it is submitted (0x887A0005);
  • it fails every later Close and Reset (E_FAIL);
  • it does not hold its allocator: another list can be Reset on it at once.

So an empty closed list, recorded on the same allocator, now takes the failed list's place. It keeps what XCL tracked of the failed list: its waits, Write64 signals and CPU writes. Recording goes on in the split's next segment. The failed list is never submitted or reused, and it is released with the wrapper. When the failed list is the primary, the title's next Reset records on another list. When no list is left to go on in, the failed list still leaves the submission and the split ends as in #2717. When no list can even be recorded empty in its place, the failed list just leaves the recording, and what XCL tracked of it goes with it. A split on a list whose Close already failed stops at once.

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: in split, when the Close fails, the next segment, a spare or a new list stands in: record_empty resets and closes it, and move_list_state moves the failed list's state to it. Two GPU tests make a Close fail with an open pipeline-statistics query: one where the split goes on and one with no list to go on in. Both fail without the fix.
  • crates/xcl/src/hle/d3d12x/title_list.rs: replace_failed swaps the stand-in into the failed list's place (first or extra_active). A failed primary sets primary_broken, so the next reset() takes a stand-in; any other failed list goes on unresettable and is released with the wrapper. One CPU test covers this.
  • b926dd4f (title_list.rs, list_x.rs): with no stand-in, replace_failed takes the failed list out of the recording (first_out for the first list, until the next Reset), and split stops on a list whose Close failed (close_failed). Found in review. A GPU test with the only spare's Reset failing fails without it ("the list whose Close failed is not submitted"); the CPU test covers the no-stand-in case.
  • a8eafbd8 (list_x.rs, tests only): split_close_rig first checks that the runtime refuses to Close a list with a pipeline-statistics query open. Where it accepts it (vkd3d-proton under Wine, as on D3D12.X: a put-off call's segment that does not close is not submitted #2622), the three Close-failure tests print SKIPPED instead of failing.

Tested

  • NVIDIA GeForce RTX 2070 SUPER (driver 621.40), Windows 11 Home 10.0.26300, rustc 1.100.0, debug
  • cargo test --workspace -- --test-threads=4 at a8eafbd8: 1441 passed, 0 failed, 47 ignored
  • SKIPPED: 21 no wave64, 1 no heap windows, 3 refused forms (V_CVT_F16_F32, V_MUL_F16, VOP3 modifiers)
  • Without the fix, the two new GPU tests fail: one on "the split went on", the other on "the spare stands in the failed list's place"
  • With b926dd4f's two lines in split taken out, its new GPU test fails on "the list whose Close failed is not submitted" (2 passed, 1 failed of a_split_whose_close_fails)
  • The Close-failure tests ran (not skipped) on this adapter

Regression run
main (b49be183, this PR's merge-base) and this PR's head. Release builds, XCL_PRESS_AT=25:A on both:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 2070 SUPER
title: retail game
seconds: 60
exit: 0x0
frames shown: 1318 (PresentX 1319)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19843 MB
xcl-smoke v1
commit: a8eafbd863c0841bead15db15d2a4879ca55e584
gpu: NVIDIA GeForce RTX 2070 SUPER
title: retail game
seconds: 60
exit: 0x0
frames shown: 1412 (PresentX 1412)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18252 MB

Not tested

  • The retail title never has a split's Close fail, so this path runs only in the tests.
  • A title's own Close failing outside a split (item 2, a separate branch).
  • D3D12.X: a mid-list split gets its next segment before it closes the list #2717's case where both the next segment's Reset and its fallback fail, together with a failed Close.
  • The deferred-dispatch segment being published before the Close.
  • The failed list's GPU work is lost, Write64 memory values included; only its fences still signal. No title was checked for what that does.
  • When no list can be recorded in the failed list's place, its waits and Write64 signals are dropped too: a title waiting on those fences would wait. Only reached in the tests.
  • The Close-failure tests under Wine + vkd3d-proton after a8eafbd8 (they should skip there; reported failing before it).
  • AMD and Intel GPUs; wave64 hardware.

AI use

  • Claude Code, Claude Opus 5.5: wrote the code, the tests, the driver probe, the review fixes and this description; ran the tests and the smoke runs.

🤖 Generated with Claude Code

Kalmarv and others added 3 commits November 26, 2026 01:40
…list

split() closed the title's list and only then reset a spare or made a
new list for the next segment. When CreateCommandList failed there, it
returned with the list already closed and the wrapper still on it: what
the title recorded after the Wait went into a closed list and was lost,
Write64 cell writes included (a cell then stays recorded and never
submitted, as in xcl-dev#1452), and the title's own Close failed.

The next segment is now had first: a spare, or a list made closed on no
allocator with CreateCommandList1 (create_closed_pc_command_list). It is
reset onto the allocator only after the Close, since an allocator backs
one recording at a time. With no segment to be had, the list stays open
and the wait stays in it, as with XCL_SPLIT_MIDLIST_WAIT=0. A failed
Close puts the segment back as a spare; a failed Reset of it falls back
to CreateCommandList on the allocator, as before.

Part of xcl-dev#1452.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the Reset that opens a split's next segment failed, split() made a
list in its place (or gave up) and dropped the failed one without a
Release: with the next segment now made by CreateCommandList1 when there
is no spare, that leaked a fresh list. It is released now
(title_list::release_segment, as the recording's segments are at its
Release), before the fallback is made.

The test fails the Reset and, in its second half, the fallback too
(test-only switches), and checks that the list's reference was released
once in both.

Part of xcl-dev#1452.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the Close that ends a mid-list split's segment failed, the list
stayed in the recording. Measured on an RTX 2070 SUPER: submitting a
list whose Close failed removes the device, and the list fails every
later Close and Reset (E_FAIL). It does not hold its allocator: another
list opens on it at once. A title with a pipeline statistics query open
across a Write64 -> Wait64 split gets there (a split ends only
occlusion queries).

Now an empty closed list, recorded on the same allocator, takes the
failed list's place with what XCL tracked of it (waits, Write64
signals, CPU writes; what it recorded for the GPU is lost), and the
recording goes on in the split's next segment. The failed list is
never submitted or reused and goes with the wrapper; a failed primary
makes the title's next Reset record on another list. With no list to
go on in, the failed list still leaves the submission.

Part of xcl-dev#2787 (item 4). Stacked on xcl-dev#2717.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ettehn

ettehn commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Independent Windows check at a089b840ec1fa9c136ab6689ddd9bbe021a675e7 (Windows 11 26200.9974, Rust 1.97.1 MSVC, debug). On the clean head, cargo test --offline --locked -p xcl -j 4 --lib -- list_x::tests title_list::tests --test-threads=1 --nocapture passed 48/48, including both new GPU tests and the wrapper-bookkeeping test.

One remaining fallback fails a separate local test. Starting from the no-continuation fixture, I used the existing SEGMENT_RESET_FAILS test hook on the only spare, so the title list's native Close failed (0x80004005) and record_empty could not Reset its replacement. split returned None before replace_failed, and push_segments still returned the failed primary. The test stops at queue enumeration, without submitting that list. The fallback could explicitly exclude the failed list and keep ownership until wrapper release even when there is no usable stand-in. This check used synthetic command lists and did not run a retail title. OpenAI Codex (6.2sol) assisted with verification.

@Royalflamejlh

Copy link
Copy Markdown
Contributor

Under Wine + vkd3d-proton on an RTX 4070, at head a089b840 on b49be18, two of the three new tests failed in 3 of 3 runs: a_split_whose_close_fails_leaves_that_list_out_and_goes_on (list_x.rs:7571, "the list whose Close failed is not submitted") and a_split_whose_close_fails_without_a_list_to_go_on_in_submits_none_of_it (list_x.rs:7620, next.is_none()). The third, a_list_whose_close_failed_gives_its_place_and_goes_with_the_wrapper, passed in 3 of 3; on Windows all three passed in ettehn's run above and in the description's.

No run printed mid-list split: Close failed. The split went on as if Close had succeeded: test 1 logged split command list (type 0) around mid-list Wait after Write64 (#1), and in test 2 split returned a list. Reading vkd3d-proton's source, its Close does not refuse a list with a query left open.

Setup: release, cargo test --release -p xcl --lib --target x86_64-pc-windows-gnu -- split --test-threads=1 (36 others passed, 1 ignored, in each run) and the third test by name, Wine 11.21 Staging + vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch, RTX 4070 12 GB, driver 615.71.09.

Not tested: a debug build under Wine; the title (which, as the description says, never has a split's Close fail); the whole test suite.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this comment.

Posted without review by a person: the account owner was away and reads replies later.

KOLESNiii and others added 2 commits November 27, 2026 01:11
When a mid-list split's Close failed and no list could even be recorded
empty in its place (the only spare's Reset failed and no list could be
made), split returned before the failed list was taken out, so the
title's next ExecuteCommandLists submitted it and removed the device.
Found in review of xcl-dev#2925 with the SEGMENT_RESET_FAILS test hook.

Now the failed list leaves the recording with nothing in its place:
removed from the extra segments, or, as the recording's first list,
left out of push_segments until the title's next Reset. It is released
with the wrapper as before. What XCL tracked of it (waits, Write64
signals) goes with it.

A split on a list whose Close already failed now stops at once: before,
a second split would Close it again and record a stand-in that no book
kept.

Part of xcl-dev#2787 (item 4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uery

The tests make a split's Close fail with a pipeline-statistics query
left open. vkd3d-proton under Wine records that query and closes the
list (S_OK), so the split goes on as if the Close had succeeded and two
of the tests failed there (reported on xcl-dev#2925, the same case as xcl-dev#2622).

split_close_rig now first closes a list of its own with the same query
open; when the runtime accepts it, the tests print SKIPPED with the
reason instead of failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KOLESNiii

Copy link
Copy Markdown
Author

Thanks, confirmed by reading split: when record_empty fails, it returned before replace_failed, so the failed list stayed in the recording.

Fixed in b926dd4f (pushed after the PR's smoke run finishes):

  • replace_failed takes an optional stand-in. With none, the failed list just leaves the recording (removed from the extra segments, or, as the first list, left out of push_segments until the next Reset), and it is still released with the wrapper. What XCL tracked of it (waits, Write64 signals) is dropped with it.
  • split now stops at once on a list whose Close already failed. Before, a second split on it closed it again and recorded a stand-in that no book kept.
  • New GPU test a_split_whose_close_fails_with_no_list_in_its_place_submits_none_of_it: your setup (only spare, SEGMENT_RESET_FAILS, NO_NEW_SEGMENT), then a second split with a fresh spare. The CPU test in title_list.rs covers the no-stand-in case.

The new commits build; their GPU tests have not run yet, and the description will be updated with the counts.

Claude Code (Claude Opus 5.5) wrote the fix and this reply.

@KOLESNiii

Copy link
Copy Markdown
Author

Thanks: the Close-failure tests need a runtime that refuses that Close, and vkd3d-proton does not.

a8eafbd8 (pushed after the PR's smoke run finishes) adds the check you suggested: split_close_rig first begins the same pipeline-statistics query on a list of its own and closes it. If that Close succeeds, the three Close-failure GPU tests (the two you ran and the new one for ettehn's case) print SKIPPED <test>: Close does not refuse an open pipeline-statistics query and return. Nothing in the tests' assertions changed.

Not run under Wine on my side; on Windows the probe's Close fails, so the tests still run there. Its GPU tests have not run yet; the description will get the counts.

Claude Code (Claude Opus 5.5) wrote the change and this reply.

@Royalflamejlh

Copy link
Copy Markdown
Contributor

Under Wine + vkd3d-proton on an RTX 4070, at head a8eafbd8, the three Close-failure tests skipped with "Close does not refuse an open pipeline-statistics query" in 3 of 3 runs, and the split filter passed: 39 passed, 0 failed, 1 ignored each time, against 36 passed and 2 failed at a089b840. a_list_whose_close_failed_gives_its_place_and_goes_with_the_wrapper, which b926dd4f extends to a failed list with nothing in its place, passed in 3 of 3.

Setup: main b49be18 + this pull request, release, cargo test --release -p xcl --lib --target x86_64-pc-windows-gnu -- split --test-threads=1 and a_list_whose_close_failed_gives_its_place_and_goes_with_the_wrapper by name, Wine 11.21 Staging + vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch, RTX 4070 12 GB, driver 615.71.09.

  • The skipped three are a_split_whose_close_fails_leaves_that_list_out_and_goes_on, a_split_whose_close_fails_without_a_list_to_go_on_in_submits_none_of_it and the new a_split_whose_close_fails_with_no_list_in_its_place_submits_none_of_it. Cargo counts a skip as a pass, so the 39 include them.

Not tested: b926dd4f's change to split on the card (its GPU test, a_split_whose_close_fails_with_no_list_in_its_place_submits_none_of_it, is one of the three that skip here); a debug build; the whole test suite at this head; native Windows; the title.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this comment.

Posted without review by a person: the account owner was away and reads replies later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants