D3D12.X: a mid-list split gets its next segment before it closes the list #2717

Open
github-bot wants to merge 1 commit from github-bot/gh-2717 into main AGit
Owner

@⁠Kalmarv on GitHub · 2026-11-26 08:17 UTC · original
Kalmarv:split-close-order → main · +167 −23 · 2 files · 1 commits · open

A mid-list split (a Wait64BitValueX after a Write64BitValue* in the same list) closed the title's list before it had the next segment. When the next segment could not be made (CreateCommandList failed), 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 own Close then failed. Now the split gets the next segment first: a spare, or a new list made closed with CreateCommandList1. 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, no mid-list split … CreateCommandList failed warning. 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 and nvidia-smi dmon -s pucm -o T beside it, plus any mid-list split lines from the log.

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: split takes 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 falls back to CreateCommandList on the allocator, as before.
  • crates/xcl/src/hle/d3d12x/real.rs: create_closed_pc_command_list (CreateCommandList1, closed, no allocator), next to create_raw_pc_command_list.
  • Test 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

  • NVIDIA GeForce RTX 5070 Ti, driver 610.74; AMD Ryzen 9 9950X; Windows 11 (10.0.26200.9711); Rust 1.99.0, debug
  • cargo test --workspace --no-fail-fast -- --test-threads=4 at 7fce1295 (on main b49be183): 1434 passed, 2 failed, 47 ignored. The 2 are gpu::recomp::link_tests::gpu_linked_memory_accessors and linked_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 on main's code.
  • SKIPPED (144): 119 validator 1.7 < 1.8 (validation step only), 21 no wave64, 3 wave32 per-lane form refused (V_MUL_F16, V_PK_MUL_F16, V_CVT_F16_F32), heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
  • The new test fails with main's split and 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.

Regression run
main (b49be18):

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1216 (PresentX 1216)
presents per 2 s (last 3): 6 13 36
device removals: 0
crashes: 0
peak commit: 25264 MB

this PR (7fce129):

xcl-smoke v1
commit: 7fce1295e919607e3db30c3bc4a31755cf3209d2
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1289 (PresentX 1289)
presents per 2 s (last 3): 46 42 34
device removals: 0
crashes: 0
peak commit: 26356 MB

Not tested

  • The reporter's card (RTX 3060) and route; whether this is the cause there (see above)
  • AMD and Intel GPUs
  • A real CreateCommandList failure: the test switches the creation off
  • The split in a title run: neither 60 s smoke run makes a mid-list split (no split command list line in either log), so they check the rest of the runtime only

AI use

  • Claude Code, Claude Opus 5.5: found the path, wrote the change, the test and this description.

🤖 Generated with Claude Code

**@⁠Kalmarv** on GitHub · 2026-11-26 08:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/2717) `Kalmarv:split-close-order` → `main` · +167 −23 · 2 files · 1 commits · open A mid-list split (a `Wait64BitValueX` after a `Write64BitValue*` in the same list) closed the title's list before it had the next segment. When the next segment could not be made (`CreateCommandList` failed), 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 own `Close` then failed. Now the split gets the next segment first: a spare, or a new list made closed with `CreateCommandList1`. 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 (https://git.gtahub.st/github/xcl-dev--xcl/issues/1452), where a Write64 cell is recorded and never submitted. That log shows a successful split (`#1`) and, in what was posted, no `mid-list split … CreateCommandList failed` warning. 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 and `nvidia-smi dmon -s pucm -o T` beside it, plus any `mid-list split` lines from the log. **What is in it** - `crates/xcl/src/hle/d3d12x/list_x.rs`: `split` takes 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 falls back to `CreateCommandList` on the allocator, as before. - `crates/xcl/src/hle/d3d12x/real.rs`: `create_closed_pc_command_list` (CreateCommandList1, closed, no allocator), next to `create_raw_pc_command_list`. - Test `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** - NVIDIA GeForce RTX 5070 Ti, driver 610.74; AMD Ryzen 9 9950X; Windows 11 (10.0.26200.9711); Rust 1.99.0, debug - `cargo test --workspace --no-fail-fast -- --test-threads=4` at `7fce1295` (on `main` `b49be183`): 1434 passed, 2 failed, 47 ignored. The 2 are `gpu::recomp::link_tests::gpu_linked_memory_accessors` and `linked_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 on `main`'s code. - SKIPPED (144): 119 validator 1.7 < 1.8 (validation step only), 21 no wave64, 3 wave32 per-lane form refused (`V_MUL_F16`, `V_PK_MUL_F16`, `V_CVT_F16_F32`), `heap_window_out_of_memory_falls_back_to_the_switch_form`: no heap windows - The new test fails with `main`'s `split` and 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. **Regression run** main (`b49be18`): ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1216 (PresentX 1216) presents per 2 s (last 3): 6 13 36 device removals: 0 crashes: 0 peak commit: 25264 MB ``` this PR (`7fce129`): ``` xcl-smoke v1 commit: 7fce1295e919607e3db30c3bc4a31755cf3209d2 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1289 (PresentX 1289) presents per 2 s (last 3): 46 42 34 device removals: 0 crashes: 0 peak commit: 26356 MB ``` **Not tested** - The reporter's card (RTX 3060) and route; whether this is the cause there (see above) - AMD and Intel GPUs - A real `CreateCommandList` failure: the test switches the creation off - The split in a title run: neither 60 s smoke run makes a mid-list split (no `split command list` line in either log), so they check the rest of the runtime only **AI use** - Claude Code, Claude Opus 5.5: found the path, wrote the change, the test and this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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 #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 #1452.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:20:16 +00:00
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-26 08:36 UTC · original

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 7fce129 applied on main b49be18, debug, Windows 11 Pro 26200, card chosen with XCL_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 CreateCommandList failure.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

**@⁠DarkPanda69** on GitHub · 2026-11-26 08:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/2717#issuecomment-7186799523) 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 `7fce129` applied on `main` `b49be18`, debug, Windows 11 Pro 26200, card chosen with `XCL_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 `CreateCommandList` failure. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 08:37 UTC · original · reviewed

At exact head 7fce129 on current main b49be18, 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 next from create_closed_pc_command_list, whose normal-device branch transfers ownership with into_raw() and adopts it. After the current list closes, split tries reset_list(next, …). If that Reset fails, the branch at list_x.rs:2834–2845 replaces next with a separately created fallback list or returns None; neither outcome releases or pools the failed next. 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 next be 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.

**@⁠luckyteagirl** on GitHub · 2026-11-26 08:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/2717#pullrequestreview-6070818939) · **reviewed** At exact head `7fce129` on current main `b49be18`, 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 `next` from `create_closed_pc_command_list`, whose normal-device branch transfers ownership with `into_raw()` and adopts it. After the current list closes, `split` tries `reset_list(next, …)`. If that Reset fails, the branch at `list_x.rs:2834–2845` replaces `next` with a separately created fallback list or returns `None`; neither outcome releases or pools the failed `next`. 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 `next` be 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.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2717/head:github-bot/gh-2717'
git switch 'github-bot/gh-2717'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2717'
git switch 'github-bot/gh-2717'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2717'
git switch 'github-bot/gh-2717'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2717'
git switch 'main'
git merge --squash 'github-bot/gh-2717'
git switch 'main'
git merge --ff-only 'github-bot/gh-2717'
git switch 'main'
git merge 'github-bot/gh-2717'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.