Skip to content

D3D12.X: split title_list command lists around mid-list Wait64 after Write64 - #797

Merged
theaustinayers merged 2 commits into
xcl-dev:mainfrom
gsucristo:d3d12x/wait64-midlist-split
Nov 24, 2026
Merged

theaustinayers merged 2 commits into
xcl-dev:mainfrom
gsucristo:d3d12x/wait64-midlist-split

Conversation

@gsucristo

Copy link
Copy Markdown
Contributor

Stacked on #795; only the top commit belongs here.

Split title_list-backed command lists around mid-list Wait64BitValueX / Wait32BitValueX calls that follow a Write64BitValueX in the same list, avoiding cross-queue cycles where a consumer queue waits on the prefix write before signaling the value the suffix waits on. Related to #505 (note: open #708 also splits lists at recorded waits; this approach extends title_list with F_PRIMARY/F_BACKING segment tracking, reuses closed spare PC lists on the same allocator across Reset/KickoffX, and integrates directly with #795's exact cycle graph).

What is in it

  • crates/xcl/src/hle/d3d12x/title_list.rs: separate F_PRIMARY (0x2FF0) and F_BACKING (0x2FF8) slots so QueryInterface/AddRef/Release stay pinned to the primary PC list while recording advances across split segments; expand all segments via push_segments; reclaim spare closed segments on Reset (calling list_x::reset_x directly) and KickoffX (reclaim_for_kickoff).
  • crates/xcl/src/hle/d3d12x/list_x.rs, bind.rs, real.rs: add try_split_for_wait (opt-out via XCL_SPLIT_MIDLIST_WAIT=0), carry active D3D12 and UMA bindings (bind::inherit_for_split) across split segments, expand wrapped lists in q_execute_command_lists, and add mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares verifying 2-frame splitting, spare reuse, and zero CPU cycle breaks.

Tested

  • NVIDIA GeForce RTX 4090 (driver 610.57.04), AMD Ryzen 9 7950X3D, Linux + Proton Experimental / vkd3d-proton (relaxed vtable check), rustc 1.98.1 (x86_64-pc-windows-msvc cross-compile), debug.
  • cargo test --workspace --no-fail-fast --target x86_64-pc-windows-msvc -- --test-threads=4 --skip a_freed_block_is_decommitted_before_its_address_is_reused: 706 passed, 4 failed (pre-existing Wine-only failures: hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime, test_title_runs_and_game_folder_is_untouched, disk_free_space_ex_reports_pls_quota, set_predication_buffer_state_and_kickoff), 41 ignored, 1 filtered (a_freed_block_is_decommitted_before_its_address_is_reused).
  • SKIPPED GPU tests: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware (no wave64).
  • New GPU test passed on RTX 4090: hle::d3d12x::list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares (2 frames, 2 segments, spare reused, 0 CPU cycle breaks).

Regression run

  • Pending native Windows scripts/smoke.ps1 runs on a retail title (Linux/Proton environment only).

Not tested

  • Native Windows 10/11, AMD RDNA, Intel GPUs, scripts/smoke.ps1 retail regression run.

AI use

  • Antigravity (Google DeepMind; exact model version not exposed to the agent) — assisted with code, tests, and PR description; reviewed, built, and run on hardware by the author.

Bridge monotonic `Wait64BitValueX` / `Wait32BitValueX` and `Write64BitValueX`
sequences across queues via real `ID3D12Fence` `queue.Wait` / `queue.Signal`
instead of blocking the CPU submission thread until timeout (related to xcl-dev#505).

Track submitted and pending wait/signal dependencies as an exact `(queue, seq)`
directed graph (including same-cell write/wait edges and same-queue FIFO
ordering) so genuine cross-queue cycles are detected and broken deterministically
at Signal time without false positives on pipelined frames, backed by a GPU
completion watchdog and unit/GPU regression tests.
…Write64

When a single command list records `Write64BitValueX` followed later in the
same list by `Wait64BitValueX` / `Wait32BitValueX` on a value produced by
another queue that waits on the earlier write, executing the list as a single
atomic `ExecuteCommandLists` submission creates a cross-queue cycle.

Extend `title_list` with separate `F_PRIMARY` and `F_BACKING` slots so
`list_x` can transparently split `title_list`-backed command lists around
mid-list waits after writes (opt-out via `XCL_SPLIT_MIDLIST_WAIT=0`),
carrying active D3D12/UMA bindings across segments, expanding all segments on
`ExecuteCommandLists`, and reusing closed spare PC lists on the same command
allocator across `Reset` and `KickoffX`.
@MesshM

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

Test run of 285560fae476d6501355d2f3fcfccadeb1558a20 on AMD RDNA4. I merged it onto current main e50836b locally (clean merge), so the tree tested includes the PR under it (#795).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200 (native Windows, not Wine), Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 711 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 670 passed, 0 failed, 21 ignored
  • 0 SKIPPED; the title_list / guard tests pass.

Review: Stacked on #795; I reviewed the top commit's structure only. It splits lists at mid-list waits, which #708 (open) also does, so the same choice applies as for #795.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

@theaustinayers
theaustinayers merged commit beaa245 into xcl-dev:main Nov 24, 2026
1 check failed
wondercrash pushed a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
… split

xcl-dev#708 predates xcl-dev#795 (GPU-fence bridge) and xcl-dev#797 (mid-list split) and was
not rebased. Resolution keeps main's split machinery (xcl-dev#797 + xcl-dev#851) and
cpu_writes from xcl-dev#850 (the xcl-dev#708 per-queue workers with xcl-dev#873's
diagnostics), and ports xcl-dev#708's core change onto it:

- wait_gate.rs (from xcl-dev#708): a queue-side gate the CPU opens once it
  sees the progress value.
- PendingWait::gate: a Wait64 GE, full mask, on a non-sparse value the
  CPU can read, in a direct/compute title list, that starts its PC
  segment (split by xcl-dev#797/xcl-dev#851, or nothing recorded before it).
- execute_with_waits_on / KickoffX: gated waits arm a wait_gate instead
  of the xcl-dev#795 GPU-fence bridge; with sparse writes at or after the list
  in the batch they take the bounded CPU wait (xcl-dev#708's rule). Other waits
  keep the xcl-dev#795 bridge. Arming failure stops the title (xcl-dev#708).
- Dropped from xcl-dev#708: its own title_list piece/split machinery,
  split_recording, restore_after_reopen, open-query / split-barrier
  tracking and the Result-returning execute_with_waits.
- wait_tests.rs (from xcl-dev#708) adapted to push_segments /
  execute_with_waits_on.
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.

3 participants