Skip to content

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

Merged
raylitebull merged 1 commit into
xcl-dev:mainfrom
KOLESNiii:d3d12x-split-fail-closed
Nov 29, 2026
Merged

raylitebull merged 1 commit into
xcl-dev:mainfrom
KOLESNiii:d3d12x-split-fail-closed

Conversation

@KOLESNiii

@KOLESNiii KOLESNiii commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Part of #2787 (item 4): when the Close that ends a mid-list split's segment fails, only that list leaves the recording and the recording goes on. One commit on main e429936c; it is no longer stacked on #2717.

On main, a failed split Close fails the whole recording closed (211fc45, 25ad57f): the wrapper goes to a closed standby, and until the title's next Reset only that standby is submitted, so the segments recorded before the split and everything recorded after it are lost.

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 the split now reserves a second closed list before it closes the producer. If the Close fails, that list is recorded empty on the producer's allocator and takes the failed list's place, with what XCL tracked of it (waits, Write64 signals, CPU writes), and recording goes on in the split's next segment. What the failed list recorded for the GPU is lost. The failed list is never submitted or reused and is released with the wrapper; a failed primary makes the title's next Reset record on another list. When no list can be recorded in its place, the recording fails closed as on main.

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: split reserves the stand-in, record_empty resets and closes it on the producer's allocator, move_list_state moves the failed list's state to it. GPU tests a_split_whose_close_fails_leaves_that_list_out_and_goes_on and a_split_whose_close_fails_with_no_list_in_its_place_fails_the_recording_closed (a pipeline-statistics query held open across the split makes the Close fail). They skip where the runtime accepts that Close (vkd3d-proton under Wine, as on D3D12.X: a put-off call's segment that does not close is not submitted #2622).
  • crates/xcl/src/hle/d3d12x/title_list.rs: replace_failed swaps the stand-in into the failed list's place; CPU test a_list_whose_close_failed_gives_its_place_and_goes_with_the_wrapper.

Tested

Regression run

Current head 9f92e8c8, rebased onto main 765b2c5b on 2026-11-28 to resolve conflicts with main. RTX 2070 SUPER, the retail game, 60 s, XCL_PRESS_AT=25:A, XCL_PREPARE=0 (no startup shader preparation), release builds; each run started from a copy of the same DXIL cache (one queue job: main, then PR heads one after the other).

main:

xcl-smoke v1
commit: 7db2f391cefd748d47c7de63d50dd43ebb852185
gpu: NVIDIA GeForce RTX 2070 SUPER
title: retail game
seconds: 60
exit: 0x0
frames shown: 1530 (PresentX 1530)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 17023 MB

This PR's head:

xcl-smoke v1
commit: 9f92e8c8fb60f4d859d3891fe2fb75b862d154ec
gpu: NVIDIA GeForce RTX 2070 SUPER
title: retail game
seconds: 60
exit: 0x0
frames shown: 1505 (PresentX 1505)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 17241 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.
  • 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.
  • The GPU tests under Wine + vkd3d-proton (they should skip there).
  • The regression runs skip startup shader preparation (XCL_PREPARE=0), on main and on this PR alike.
  • AMD and Intel GPUs; wave64 hardware.

AI use

  • Claude Code, Claude Opus 5.5: wrote the code, the tests, the driver probe and this description; ported it onto main's fail-closed splits; ran the tests and the smoke runs.

🤖 Generated with Claude Code

@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

Copy link
Copy Markdown
Contributor 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
Contributor 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.

KOLESNiii added a commit to KOLESNiii/xcl that referenced this pull request Nov 27, 2026
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>
KOLESNiii added a commit to KOLESNiii/xcl that referenced this pull request Nov 27, 2026
…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>
@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.

@KOLESNiii
KOLESNiii marked this pull request as ready for review November 28, 2026 03:22
KOLESNiii added a commit to KOLESNiii/xcl that referenced this pull request Nov 28, 2026
When the Close that ends a mid-list split's segment fails, main fails the
whole recording closed: the wrapper goes to a closed standby, and until
the title's next Reset only that standby is submitted, so the segments
recorded before the split and everything the title records after it are
lost. Measured on an RTX 2070 SUPER: a list whose Close failed removes the
device when it is submitted and fails every later Close and Reset
(E_FAIL), but 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).

The split now reserves a second closed list before it closes the
producer. If the Close fails, that list is recorded empty on the
producer's allocator and takes the failed list's place in the recording,
with what XCL tracked of it (waits, Write64 signals, CPU writes; what it
recorded for the GPU, texture writes and transitions included, 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. When no list can be
recorded in its place, the recording fails closed as before.

Adapted from a089b84 and b926dd4 (xcl-dev#2925, part of xcl-dev#2787 item 4), ported
onto main's fail-closed splits (211fc45, 25ad57f).

Tests: a_split_whose_close_fails_leaves_that_list_out_and_goes_on (GPU:
the earlier work and the next segment reach the GPU, the Write64 is
signalled in the failed list's place, the next Reset records on another
list; on main only the standby is submitted),
a_split_whose_close_fails_with_no_list_in_its_place_fails_the_recording_closed
(GPU), and a_list_whose_close_failed_gives_its_place_and_goes_with_the_wrapper
(book). The GPU tests skip where Close keeps an open pipeline-statistics
query (vkd3d-proton under Wine, xcl-dev#2622).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KOLESNiii
KOLESNiii force-pushed the d3d12x-split-fail-closed branch from a8eafbd to cfb83d2 Compare November 28, 2026 13:01
KOLESNiii added a commit to KOLESNiii/xcl that referenced this pull request Nov 28, 2026
When the Close that ends a mid-list split's segment fails, main fails the
whole recording closed: the wrapper goes to a closed standby, and until
the title's next Reset only that standby is submitted, so the segments
recorded before the split and everything the title records after it are
lost. Measured on an RTX 2070 SUPER: a list whose Close failed removes the
device when it is submitted and fails every later Close and Reset
(E_FAIL), but 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).

The split now reserves a second closed list before it closes the
producer. If the Close fails, that list is recorded empty on the
producer's allocator and takes the failed list's place in the recording,
with what XCL tracked of it (waits, Write64 signals, CPU writes; what it
recorded for the GPU, texture writes and transitions included, 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. When no list can be
recorded in its place, the recording fails closed as before.

Adapted from a089b84 and b926dd4 (xcl-dev#2925, part of xcl-dev#2787 item 4), ported
onto main's fail-closed splits (211fc45, 25ad57f).

Tests: a_split_whose_close_fails_leaves_that_list_out_and_goes_on (GPU:
the earlier work and the next segment reach the GPU, the Write64 is
signalled in the failed list's place, the next Reset records on another
list; on main only the standby is submitted),
a_split_whose_close_fails_with_no_list_in_its_place_fails_the_recording_closed
(GPU, the book only: submitting main's closed standby, made closed and never
recorded, removed the device here), and a_list_whose_close_failed_gives_its_place_and_goes_with_the_wrapper
(book). The GPU tests skip where Close keeps an open pipeline-statistics
query (vkd3d-proton under Wine, xcl-dev#2622).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KOLESNiii
KOLESNiii force-pushed the d3d12x-split-fail-closed branch from cfb83d2 to bb28100 Compare November 28, 2026 13:27
When the Close that ends a mid-list split's segment fails, main fails the
whole recording closed: the wrapper goes to a closed standby, and until
the title's next Reset only that standby is submitted, so the segments
recorded before the split and everything the title records after it are
lost. Measured on an RTX 2070 SUPER: a list whose Close failed removes the
device when it is submitted and fails every later Close and Reset
(E_FAIL), but 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).

The split now reserves a second closed list before it closes the
producer. If the Close fails, that list is recorded empty on the
producer's allocator and takes the failed list's place in the recording,
with what XCL tracked of it (waits, Write64 signals, CPU writes; what it
recorded for the GPU, texture writes and transitions included, 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. When no list can be
recorded in its place, the recording fails closed as before.

Adapted from a089b84 and b926dd4 (xcl-dev#2925, part of xcl-dev#2787 item 4), ported
onto main's fail-closed splits (211fc45, 25ad57f).

Tests: a_split_whose_close_fails_leaves_that_list_out_and_goes_on (GPU:
the earlier work and the next segment reach the GPU, the Write64 is
signalled in the failed list's place, the next Reset records on another
list; on main only the standby is submitted),
a_split_whose_close_fails_with_no_list_in_its_place_fails_the_recording_closed
(GPU, the book only: submitting main's closed standby, made closed and never
recorded, removed the device here), and a_list_whose_close_failed_gives_its_place_and_goes_with_the_wrapper
(book). The GPU tests skip where Close keeps an open pipeline-statistics
query (vkd3d-proton under Wine, xcl-dev#2622).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KOLESNiii
KOLESNiii force-pushed the d3d12x-split-fail-closed branch from bb28100 to 9f92e8c Compare November 28, 2026 19:57
@github-actions github-actions Bot added area:d3d12 D3D12.X runtime, command lists, resources, sparse memory gpu:nvidia Code is specific to NVIDIA / wave32 GPUs (scope tag; see needs:nvidia-test) labels Nov 28, 2026
@Kalmarv

Kalmarv commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

merge-check
base: fa20459
head: 9f92e8c
merge: clean (trial merge 1fe4435e56c4f1c5d99c3669dde1a02db4703929, local, not pushed)
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609) -> 2611 passed, 0 failed, 49 ignored; SKIPPED: 26 (21 no wave64 on this 32-lane GPU, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows). The new Close-failure tests ran on the GPU and passed: a_split_whose_close_fails_leaves_that_list_out_and_goes_on, a_split_whose_close_fails_with_no_list_in_its_place_fails_the_recording_closed, a_put_off_call_whose_close_fails_is_not_submitted and close_failure_keeps_effects_and_query_bookkeeping_on_the_producer (their rig first checks that Close really refuses an open pipeline-statistics query on this driver, so they did not skip), plus the title_list test.
review: none blocking; whole diff read (list_x.rs, title_list.rs). Before a mid-list split closes the open segment, the split now reserves a stand-in closed segment. If Close fails and the stand-in records empty (reset + Close), move_list_state carries the failed list's bookkeeping over to the stand-in, and replace_failed swaps it into the wrapper's segment list, so the submit leaves only that segment out and the recording goes on. Its waits, Write64 signals, sparse writes and CPU writes move to the stand-in (any state the stand-in held is cleared); its texture writes and transitions are dropped, since nothing of the failed recording reaches the GPU. If no stand-in can be had or it doesn't record, the recording fails closed as before (the stand-in is quarantined, a deferred segment goes back to the spares). When Close succeeds, the stand-in goes back to the spares. Both warnings are rate-limited through one counter. Note, not blocking: every split now takes a closed spare up front, so a wrapper holds one more list while a split is open, and when every spare is in flight reserve_closed_segment creates one (CreateCommandList1). prepare_split reserves room for both the producer and a failed stand-in in unresettable, so the failure path doesn't allocate.
performance: one extra spare list per open split (see review), no work on the success path beyond taking and returning it. Title run (release build of the merge, scratch/fast-world.py fast profile, about 85 s in world): exit 0, 0 crashes, 0 device removals, world entry 112.3 s, peak commit 30,386 MB, 83 WARN lines, failed_pipelines 0, no translation errors. Against a main fa20459 run on the same harness (world entry 76.8 s, peak commit 33,027 MB, 86 WARN lines) no new WARN kind except Windows' "the system is running out of commit", which came from other jobs on this shared machine at the time. Both runs show 0 fps in the world because the cache doesn't match the translator identity; world-entry differences track cache contents and machine load (an earlier run of this merge, killed by a node restart, reached the world at 91.5 s). The title never hit a failing Close (no "Close failed" line), so at run time only the reserve-and-return path ran.
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, release build for the title run, DXC 1.9.2609 via XCL_DXC_DIR. Claude Code, Claude Opus 5.5: merge, build, suite, title run and full-diff review; this report.

@github-actions github-actions Bot added needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:nvidia-test Needs a test report or merge-check on an NVIDIA GPU needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) and removed needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:nvidia-test Needs a test report or merge-check on an NVIDIA GPU labels Nov 29, 2026
@throny

throny commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

merge-check claim
head: 9f92e8c

@throny

throny commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

merge-check
base: d8bd9a3
head: 9f92e8c
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2621 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at d8bd9a3: 2618 passed, 0 failed, 49 ignored.
review: no blocking finding. Every split reserves a second closed list; when the producer's Close fails, that list is reset and closed empty on the title's allocator and takes the failed list's place, and recording goes on. The reservation covers the fallback branch and the stand-in goes back to the spares on success. Two small notes from reading, neither reached by a path I found: replace_failed returns early when the failed list is in neither tracked set, which would leave the stand-in untracked; and returning two spares on the deferred-failure path can go past the reservation made in prepare_split, which matters only for the rule of not allocating under the lock. Cost: one more list per split. The first new test fails on main; the second is a regression guard that also passes there.
performance: not measured.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

@github-actions github-actions Bot added ready-to-merge Has 2 independent safe merge-checks on current head (#3041) and removed needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) labels Nov 29, 2026
@raylitebull
raylitebull merged commit 0ae5be4 into xcl-dev:main Nov 29, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:d3d12 D3D12.X runtime, command lists, resources, sparse memory gpu:nvidia Code is specific to NVIDIA / wave32 GPUs (scope tag; see needs:nvidia-test) ready-to-merge Has 2 independent safe merge-checks on current head (#3041)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants