Skip to content

D3D12.X: KickoffX keeps a failed Close's effects and goes on with a closed list - #2997

Draft
KOLESNiii wants to merge 1 commit into
xcl-dev:mainfrom
KOLESNiii:d3d12x-kickoff-close-fail-closed
Draft

KOLESNiii wants to merge 1 commit into
xcl-dev:mainfrom
KOLESNiii:d3d12x-kickoff-close-fail-closed

Conversation

@KOLESNiii

Copy link
Copy Markdown

KickoffX took a console list's pending waits, Write64 signals and CPU writes before the native Close. When that Close failed, they were lost, and the console list went on recording into, and later submitting, a PC list that D3D12 cannot Reset any more. Now Kickoff reserves a closed stand-in list first and takes the effects only after Close succeeds. If Close fails, the recording moves to the stand-in, and the broken list is never reset, submitted or reused again.

Part of #2787 (item 2). Adapted from 617b493d (fail-closed bookkeeping) and 73898793 (Kickoff) on #2778.

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs:
    • Before changing anything, kickoff_x reserves a closed stand-in: an idle spare, or a new list on its own allocator. It also reserves the bookkeeping for it. If either cannot be had, the work is left to the title's own Close + ExecuteCommandLists, as before.
    • The effects are taken (take_kickoff_effects) only after Close succeeds.
    • A new test drives kickoff_x with a native Close that returns E_OUTOFMEMORY. On main it fails with all waits, signals and CPU writes lost.
  • crates/xcl/src/hle/d3d12x/title_list.rs:
    • prepare_fail_closed / fail_closed: on a failed Close, the wrapper records into and submits the closed stand-in.
    • A failed primary is marked broken, and other failed lists are quarantined: none of them is submitted, reused as a spare or reset.
    • The title's next Reset reopens the stand-in (only once it is idle) and drops the abandoned recording's effects. If nothing can be reopened, Reset returns E_FAIL.
    • No splitting or Kickoff reclaim while a stand-in is active.

Differences from 73898793:

  • Effects wait for a successful Close on every list, not only on wrapped ones.
  • A new stand-in keeps its own allocator alive; the source let it be freed.
  • The failed stand-in is reopened only when idle.
  • The abandoned recording's effects are cleared at the title's next Reset.

Tested

  • NVIDIA GeForce RTX 2070 SUPER (driver 32.0.16.2140), AMD Ryzen 5 3600XT, Windows 10.0.26300, rustc 1.100.0.
  • cargo test --workspace -- --test-threads=4 on 5718395d: 1447 passed, 0 failed, 47 ignored.
  • Release builds for the smoke runs. Both ran with XCL_PRESS_AT=25:A.

Regression run

main (8b957bec):

xcl-smoke v1
commit: 8b957bec6f82495aec940944c6bf47faa02db590
gpu: NVIDIA GeForce RTX 2070 SUPER
title: retail game
seconds: 60
exit: 0x0
frames shown: 1350 (PresentX 1350)
presents per 2 s (last 3): 42 47 55
device removals: 0
crashes: 0
peak commit: 16179 MB

This PR (5718395d):

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

Not tested

AI use

  • Claude Code, Claude Opus 5.5: ported and adapted the change, wrote the test, ran the tests and smoke runs, and wrote this description.

🤖 Generated with Claude Code

…losed list

KickoffX took the list's pending waits, Write64 signals and CPU writes
before the native Close. When Close failed they were gone, and the
console list kept recording into (and later submitting) a PC list that
can no longer be Reset.

Kickoff of a console list now reserves a closed stand-in list (an idle
spare, or one made on an allocator of its own) and the bookkeeping for
it before it changes anything; without them it leaves the work to the
title's Close + ExecuteCommandLists. The effects are taken only after
Close succeeds. On failure the wrapper records into and submits the
closed stand-in, the failed list is never reset, submitted or reused
(the primary is marked broken, other lists are quarantined), and the
title's next Reset reopens the stand-in and drops the abandoned
recording's effects.

The fail-closed bookkeeping in title_list is adapted from 617b493 and
the Kickoff change from 7389879 (xcl-dev#2778), part of xcl-dev#2787 item 2. The new
test drives kickoff_x with a native Close returning E_OUTOFMEMORY; on
main it fails with the waits, signals and CPU writes all lost.

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

ettehn commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Tested on 5718395d2ff928c52cb9bff7a824a3c5bba1d09e: I extended the injected E_OUTOFMEMORY fixture to call the title-facing Close (wrapper slot 9) after KickoffX switches to the already-closed standby. That call returned E_FAIL (0x80004005). Reset reopened the standby and the next wrapper Close returned S_OK. The existing effect-preservation and release assertions still passed. As an independent control, native WARP returned the same E_FAIL when asked to close an already-closed list, and a subsequent Reset and Close succeeded.

Windows 11 build 26200, Rust 1.97.1 MSVC, debug. cargo test --offline --locked -j 2 -p xcl --lib kickoff_close_ -- --test-threads=1 --nocapture: 2 passed, 0 failed or ignored, with a local test-only overlay. The producer failure was injected. No queue submission, physical adapter workload, or retail run. This establishes the HRESULT the caller sees if it checks Close before Reset. The caller’s response to that HRESULT remains untested.

AI use: OpenAI Codex (GPT-6) extended the fixture, ran the two controls and drafted this report.

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.

2 participants