Skip to content

D3D12.X: a list reset while its last submit runs records on a spare - #2163

Merged
raylitebull merged 2 commits into
xcl-dev:mainfrom
throny:d3d12x-resubmit-spare-list
Nov 25, 2026
Merged

raylitebull merged 2 commits into
xcl-dev:mainfrom
throny:d3d12x-resubmit-spare-list

Conversation

@throny

@throny throny commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #2160; only the top commit (78fba7b) belongs here.

The retail title resets a command list and submits its new recording on the same queue while the GPU still runs the list's previous submit. A console allows that; PC D3D12 does not (debug layer id 553), and on NVIDIA the device is removed soon after (#1452). With this change such a recording goes onto a spare PC list instead, the way alloc_pool already swaps allocators, so no PC list is submitted again while it runs. No CPU wait.

The title resets through the newer console list layout's #139 (allocator, NULL, 0). The title list's wrapper forwards that slot to the PC list it records on, where it reaches list_x::reset_x, bypassing the wrapper's own #10 Reset. So reset_x now sends a reset of a wrapped list's PC list to the wrapper's Reset, which decides between the primary PC list and a stand-in.

Part of #1452. It does not fix the device removal on its own, see below.

What is in it

  • crates/xcl/src/hle/d3d12x/title_list.rs: SegmentBook::first, a PC list recording in place of the primary while the primary's last submit runs. Reset puts the new recording on it, push_segments submits it in the primary's place, and the next Reset after the GPU is done returns to the primary. pop_spare skips spares still on the GPU, put_spare is new, and release frees first.
  • crates/xcl/src/hle/d3d12x/list_x.rs: reset_stand_in (a finished spare or a new PC list, reset like the primary). reset_x routes a wrapped list's reset through the wrapper; the old body is reset_pc. Side effect: a DXC memory gate: reserve only the running compiles' growth, no stampede after a minute #139 Reset on a split list now resets from the primary and reclaims the extra segments, where before it reset only the last segment.
  • crates/xcl/src/hle/d3d12x/alloc_pool.rs: in_flight(list).
  • GPU test a_reset_while_the_last_submit_runs_records_on_another_pc_list, through Olympus: harden GameSave read results #10 and through reset_x on the PC list, as DXC memory gate: reserve only the running compiles' growth, no stampede after a minute #139 resolves. A queue Wait holds the first submit; three Reset and submit rounds must use three different PC lists with no resubmit, then the primary again once the GPU is done. Without the change it fails ("the new recording must not be on the PC list still on the GPU").

Tested

run stand-ins used resubmits logged by #2160 device removed end
1 10 0 no the title's own watchdog at 117 s; 67 queue waits timed out from 85.5 s
2 11 0 at 104.8 s
before this change (same tree with #2160 only) – 8 – 64+ at 89 – 101 s

So the resubmits are gone. The removal still happened in 1 of 2 runs, later, again a few seconds after cross-queue waits started timing out one signal short (#1452). That part is not this.

Regression run

scripts/smoke.ps1, the retail title, 60 s, release builds of both commits, main first.

main:

xcl-smoke v1
commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09
gpu: NVIDIA GeForce RTX 4080
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1606 (PresentX 1606)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15806 MB

PR:

xcl-smoke v1
commit: 78fba7b6609c922cbd944ae78603b1617d5bb69c
gpu: NVIDIA GeForce RTX 4080
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1601 (PresentX 1601)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15848 MB

Not tested

AI use

  • Claude Code (Claude Opus 5.5): measured the cause, reviewed and ran everything above, wrote this description. The change and its test were written by Claude Opus 5.5 sub-agents and reviewed line by line by Claude Code (Claude Opus 5.5).

🤖 Generated with Claude Code

throny and others added 2 commits November 25, 2026 06:41
PC D3D12 does not allow submitting a command list whose previous execution
the GPU has not finished (debug layer id 553: "the command queue fence has
not advanced past previous executions of the command list"); a console lets
a title do it. With the debug layer on, the retail title's world load shows
id 553 from 85.8 s, then cross-queue waits that stop one signal short, then
the device removal (xcl-dev#1452).

alloc_pool::executed signalled a per-queue fence after submits of the
lists it tracks (title lists). It now does so after every submit, so the
PC lists behind console lists are covered too, and remembers each list's
last submit (queue, fence value, recording number). note_resubmits, called
before each ExecuteCommandLists chunk, logs a list whose previous submit is
still running: whether it is the same recording and the same queue (the
first 8, then at powers of two). The only change besides the log is that
extra fence signal on submits of untracked lists.

Part of xcl-dev#1452.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A console lets a title Reset a command list and submit the new recording
on the same queue while the GPU still runs the previous one. The PC does
not let a list be submitted again before its last execution is done
(debug layer id 553, "the command queue fence has not advanced past
previous executions of the command list"); on NVIDIA the device is
removed about 12 s later. The retail title's world load does it (xcl-dev#1452):
note_resubmits logs "a new recording, the same queue", 8 lists at once.

A title's list is a title_list wrapper whose PC lists already change
(mid-list split segments, a spare pool per list), so the fix uses that:
at the title's Reset, when alloc_pool says the primary PC list's last
submit has not completed, the new recording goes onto a spare whose
submits are done (or a new PC list), reset like the primary would be
(reset_pc), and push_segments submits it in the primary's place
(SegmentBook::first). The next Reset after the GPU is done records on the
primary again and the stand-in goes back to the spares. pop_spare now
skips spares still on the GPU, so split segments do not hit the same
error. No CPU wait. When the primary is not in flight nothing changes.

The retail title does not Reset through the wrapper's xcl-dev#10: its runtime
has the newer console list layout, whose Reset is xcl-dev#139 (allocator, NULL,
0). The wrapper's xcl-dev#139 is a thunk to the active PC list (F_BACKING), and
there NEWER_LIST_SLOTS's layout split runs the xcl-dev#10 handler, reset_x, on
that PC list. So the wrapper's Reset, and its in-flight check, never ran
(measured: the stand-in 0 times, 64+ resubmits, each list last reset in
reset_x and still the wrapper's active PC list). reset_x now hands a Reset
of a PC list a wrapper records on to the wrapper's Reset; the PC list's
own Reset is reset_pc, which the wrapper and the stand-in call. This also
resets a split list from its primary on xcl-dev#139, not from its last segment.

Test: a list reset and submitted three times while a queue Wait holds the
first submit records on three different PC lists and note_resubmits sees
none, then on the primary again once the GPU is done; once with the
wrapper's xcl-dev#10 and once with reset_x on the active PC list, as xcl-dev#139 does.
Without the stand-in the second submit is the primary and the test fails;
without the hand-over in reset_x the xcl-dev#139 round fails the same way.

Part of xcl-dev#1452.

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

Copy link
Copy Markdown

Independent Windows x64 + Intel Arc A770 test report on commit 78fba7b6609c922cbd944ae78603b1617d5bb69c.

Environment

  • OS: Windows 11 Enterprise Evaluation x64 (build 26200.9974, Session 0)
  • CPU: AMD Ryzen 7 3800X
  • GPU: Intel Arc A770 16 GiB (driver 32.0.101.9175, Tiled Resources Tier 4, Resource Heap Tier 1, DoublePrecisionFloatShaderOps=0)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5 (01b62ad47)

Command
Executed under serialized Arc A770 GPU mutex (XCL_ADAPTER=A770) with pre/post-mutex executable SHA-256 verified (2AE9743B9D1CFBF3D01EEA418BCF180DA029074D419EE5A4D692D89697F8C277):

xcl-97fdf2b9ff8e1482.exe --exact --nocapture --test-threads=1 `
  hle::d3d12x::alloc_pool::tests::a_resubmit_while_the_previous_submit_runs_is_noticed `
  hle::d3d12x::alloc_pool::tests::a_spare_whose_reset_fails_stays_available_for_retry `
  hle::d3d12x::list_x::tests::a_reset_while_the_last_submit_runs_records_on_another_pc_list `
  hle::d3d12x::list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares

Results

  • Passed: 4, Failed: 0, Ignored: 0, Skipped: 0 (0.48s, exit code 0)
  • All 4 targeted alloc_pool and list_x tests passed without SKIPPED output.

Not tested

  • Full workspace suite and game smoke run.

AI use

  • Verified and published with T3 Code / Antigravity (gemini-4-neon).

@futurepro62

futurepro62 commented Nov 25, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 78fba7b (on its base 6020a33).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1144 passed, 0 failed, 44 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: a_resubmit_while_the_previous_submit_runs_is_noticed, a_reset_while_the_last_submit_runs_records_on_another_pc_list.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1155 passed, 0 failed, 46 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 568e7db too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests, const_and_null_mask_operands_agree_with_hlsl_on_the_gpu and mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@luckyteagirl

Copy link
Copy Markdown
Contributor

Focused Windows check on exact PR head 78fba7b6609c922cbd944ae78603b1617d5bb69c (base 568e7db7729c8fa6c8f0f4b32d798faaf11462bb).

Environment: Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M, driver 30.0.13002.13003; Rust 1.99.0 MSVC. Clean detached worktree.

Tested: Built the XCL lib-test executable with cargo test --locked -p xcl --lib -j 2 a_reset_while_the_last_submit_runs_records_on_another_pc_list -- --test-threads=1 --show-output. Then reran that exact-head executable with --exact hle::d3d12x::list_x::tests::a_reset_while_the_last_submit_runs_records_on_another_pc_list --test-threads=1 --show-output, XCL_REQUIRE_GPU=wave64, and a temporary Windows high-performance per-app preference for that executable. The preference was restored after the run.

Result: 1 passed, 0 failed, 0 ignored, 0 SKIPPED. Both Reset paths in the test completed; the log shows four spare-list reset messages. The test calls create_device(None), so XCL_ADAPTER alone would not select the dGPU. A separate LUID probe on this host under the same per-app preference selected RX 6800M (00000000:00014d72), while the default without it selected the integrated AMD GPU. The test itself does not print a device LUID; the RX 6800M attribution follows from the per-app selection and matching device-creation call.

Scope: Focused test only. I did not run the full workspace suite, reproduce the title's real #139 layout path, or run a paired title smoke test on this PR head.

AI use: OpenAI Codex built and ran the test, checked the GPU-selection method and exact revision, and prepared this report.

@Royalflamejlh

Copy link
Copy Markdown
Contributor

Linux (Wine + vkd3d-proton) + NVIDIA test of 78fba7b against its base #2160 alone (637b82a), 3 runs of 100 s of the title each: with #2160 alone its warning reached #16 (between 16 and 31 resubmits; it prints #1–8, then powers of two) in 3 of 3 runs, and each of the 9 lines it printed per run said a new recording on the same queue. With this change none of that kind was printed, the stand-in line reached #1024, and 1 resubmit of another kind came in 2 of the 3 runs. No run lost the device either way; all six stopped presenting at 76 to 80 s, before the 89 to 101 s where the description sees the removal, so this shows the stand-in working, not its effect on the removal.

Setup: Fedora 44, 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). Both trees on main 568e7db + #684, release, x86_64-pc-windows-gnu, XCL_PSO_PRELOAD=0. Retail title 1.0.2.1, the first-run screens completed once and no story progress, A pressed at about 16 s. Order: #2160 alone, with, with, #2160 alone, with, #2160 alone.

Tested

100 s #2160 alone (3 runs) with 78fba7b (3 runs)
resubmit warnings, last count printed #16, #16, #16 #1, none, #1
"a new recording, the same queue" 9 of the 9 printed 0
"the same recording, the same queue" 0 of the 9 printed 1 (at 7.8 s), 1 (at 18.3 s)
records on another PC list, last count printed – #1024 at about 30 s in all 3 (between 1024 and 2047; it prints #1–4, then powers of two)
last 2 s with a present 80.3, 78.1, 76.1 s 78.5, 80.2, 78.5 s
device removals / NVIDIA kernel messages 0 / 0 0 / 0

Not tested: the test suite; past 100 s; the debug layer (not under vkd3d-proton); Windows; AMD and Intel.

AI use: Claude Code (Claude Opus 5.5) read the change, built the trees, ran the title and wrote this comment.

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

@VolenNakov

Copy link
Copy Markdown

Tried this with #2160 on an RTX 4060 Ti 16 GB: the spare path works, but #2160's line still fires for submits of the same recording with no reset in between, and the device is removed later as before.

Setup

What the run logged

Reading

  • With this PR the reset case goes to a spare, but the title also submits a recording again unchanged while its previous submit runs, and that still reaches the PC list.
  • I can't tell from this run whether those are what removes the device: the early ones (15–22 s) were followed by 150 s of normal running, and the last logged one came 54 s before the removal, not ~12 s.

Not tested: more than one run; the debug layer on this tree; main without #2057.

AI use: Claude Code with Claude Opus 5.5 merged and built the tree, ran it on my PC, read the log and wrote this comment.

@VolenNakov

Copy link
Copy Markdown

Follow-up: the same-recording resubmits don't look like the cause here. On the same tree and caches as above, plus a local diagnostic in #2160's note_resubmits that makes the CPU wait (up to 2 s) for a list's previous submit before it is submitted again:

  • All 20 such submits waited and their previous submit finished first (0–38 ms each), so none reached the PC list while it was still on the GPU.
  • The title still stopped presenting (16 fps at 88 s, then none), GPU waits timed out from 121.8 s (99 in all), the GPU sat at 100 % with 15.95 of 16 GB of video memory in use, and the device was removed (0x887a0005, DRED empty) at 221.3 s, after 65 536 dispatches (32 768 and 172.2 s in the run above).

One run each, so the later end may only be the slower submits. On this card the next things I'd look at are #2195 and video memory, which is full at that point in every run.

AI use: Claude Code (Claude Opus 5.5) wrote the diagnostic, ran it on my PC and wrote this.

@raylitebull
raylitebull merged commit 82e6398 into xcl-dev:main Nov 25, 2026
2 checks passed
@VolenNakov

Copy link
Copy Markdown

Correction to my comments here: the runs in them did not have XCL_NETWORK=0; I listed it in the setup by mistake, and networking was at XCL's default (on). Nothing else in the setup or the results changes. My runs from now on use XCL_NETWORK=0.

AI use: Claude Code (Claude Opus 5.5) made the mistake and wrote this correction.

@throny

throny commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

Related: #929 (shelbykb2) also changes slot #139 on the newer list layout. It makes the wrapper's #139 run title_list::reset, so a list that was split mid-way drops its old segments. This PR handles the other case: a list reset while its last submit is still on the GPU records on a spare.

The two merge without conflicts (git merge of #929 into this head). I haven't built or tested them together yet. With the mid-list split on, both paths run on every reset, so they'd best be tested as a pair before either is merged.

AI use: Claude Code (Claude Opus 5.5).

Edit: one NVIDIA world-load run with both PRs on a 177cd40 base and the split on (RTX 4080): no resubmits, the device still removed at 86.7 s. The pair doesn't fix the NVIDIA world-load stop on its own; that one now looks like the sparse windows' in-flight tile remaps (#262, details on #1269).

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.

8 participants