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

Manually merged
github merged 2 commits from gh-pr/797/head into gh-pr/797/base 2026-11-26 04:32:55 +00:00
Owner

@⁠gsucristo on GitHub · 2026-11-24 05:33 UTC · original
gsucristo:d3d12x/wait64-midlist-split → main · +2461 −87 · 5 files · 2 commits · merged 2026-11-24 05:58 UTC

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.
**@⁠gsucristo** on GitHub · 2026-11-24 05:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/797) `gsucristo:d3d12x/wait64-midlist-split` → `main` · +2461 −87 · 5 files · 2 commits · merged 2026-11-24 05:58 UTC 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 #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.
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`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:32:52 +00:00
github manually merged commit 285560fae4 into gh-pr/797/base 2026-11-26 04:32:55 +00:00
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 05:51 UTC · original

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.

**@⁠MesshM** on GitHub · 2026-11-24 05:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/797#issuecomment-7123339585) 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.