D3D12.X: unpin retired split segments from alloc_pool and guard title_list::release ABA #1453

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

@⁠b3IKK on GitHub · 2026-11-24 16:19 UTC · original
b3IKK:d3d12x/title-list-segment-leak-and-aba → main · +83 −3 · 2 files · 1 commits · open

Fixes two lifecycle bugs in title_list split segments and wrapper release:

  • When a title_list split onto an extra PC segment and later returned that segment to spares via Reset or KickoffX, alloc_pool::forget_list was never called on the retired segment. The segment stayed pinned in its backing allocator's users set indefinitely, preventing reuse of that backing allocator and leaking new PC ID3D12CommandAllocators on subsequent Resets.
  • In title_list::release, after f(pc) freed the primary PC command list, WRAPPER_OF.remove(&pc) and bind::forget(pc) ran unconditionally. If another thread created a new command list that reused the freed pc heap address in the window after f(pc), the old wrapper's cleanup detached the new wrapper and wiped the new list's bind state.

This calls alloc_pool::forget_list(list) inside list_x::clear_segment_state (covering both title_list::reset and KickoffX) and before releasing spare segments; in title_list::release, it only removes WRAPPER_OF entries still mapped to this and skips the redundant bind::forget(pc) when pc was adopted (already cleaned up inside real::cl_release).

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: call alloc_pool::forget_list(list) in clear_segment_state.
  • crates/xcl/src/hle/d3d12x/title_list.rs: guard WRAPPER_OF removal against address reuse, skip redundant bind::forget(pc) for adopted lists, forget spare segments from alloc_pool before release, and add unit tests reset_releases_retired_split_segment_from_alloc_pool and release_does_not_remove_reused_pc_from_wrapper_map (both verified failing before the fix).

Since the last push: rebased onto main 06c9f55. The conflicts were in the test module (main's newer_layout_slot_139_resets_primary_and_reclaims_split_segments and slot_139_keeps_the_title_caller_for_the_backing_layout_guard, both kept) and in release's loop, where main iterates extra_active, spares and first: the PR's ABA guard now applies to all three.

Tested

  • hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1)
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 1267 passed, 0 failed, 46 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses, no heap windows, and cannot disable the driver cache (Windows Developer Mode is required))
  • cargo test -p xcl --lib title_list: 3 passed, 0 failed (both new tests failed before the fix)

Regression run

main (426a5a7, clean tree, no local changes):

xcl-smoke v1
commit: 426a5a745db4d5e4b037449ede0b70cb342f5192
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1642 (PresentX 1642)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15158 MB

PR (0bfea00, clean tree, no local changes):

xcl-smoke v1
commit: 0bfea00ee34df738436dbf2d2f098b6c36f2ed1e
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1638 (PresentX 1639)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16322 MB

(The main block is 426a5a7, an ancestor of the current main, from the same machine and data folder.)

Not tested

  • AMD GPUs and native wave64 hardware
  • other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine

AI use

  • OpenCode, Claude Fable 5.2: rebased onto main 06c9f55, resolved the conflicts, ran the suite and the scripts/smoke.ps1 pair at the head above.
**@⁠b3IKK** on GitHub · 2026-11-24 16:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/1453) `b3IKK:d3d12x/title-list-segment-leak-and-aba` → `main` · +83 −3 · 2 files · 1 commits · open Fixes two lifecycle bugs in `title_list` split segments and wrapper release: - When a `title_list` split onto an extra PC segment and later returned that segment to `spares` via `Reset` or `KickoffX`, `alloc_pool::forget_list` was never called on the retired segment. The segment stayed pinned in its backing allocator's `users` set indefinitely, preventing reuse of that backing allocator and leaking new PC `ID3D12CommandAllocator`s on subsequent `Reset`s. - In `title_list::release`, after `f(pc)` freed the primary PC command list, `WRAPPER_OF.remove(&pc)` and `bind::forget(pc)` ran unconditionally. If another thread created a new command list that reused the freed `pc` heap address in the window after `f(pc)`, the old wrapper's cleanup detached the new wrapper and wiped the new list's `bind` state. This calls `alloc_pool::forget_list(list)` inside `list_x::clear_segment_state` (covering both `title_list::reset` and `KickoffX`) and before releasing spare segments; in `title_list::release`, it only removes `WRAPPER_OF` entries still mapped to `this` and skips the redundant `bind::forget(pc)` when `pc` was adopted (already cleaned up inside `real::cl_release`). **What is in it** - `crates/xcl/src/hle/d3d12x/list_x.rs`: call `alloc_pool::forget_list(list)` in `clear_segment_state`. - `crates/xcl/src/hle/d3d12x/title_list.rs`: guard `WRAPPER_OF` removal against address reuse, skip redundant `bind::forget(pc)` for adopted lists, forget spare segments from `alloc_pool` before release, and add unit tests `reset_releases_retired_split_segment_from_alloc_pool` and `release_does_not_remove_reused_pc_from_wrapper_map` (both verified failing before the fix). **Since the last push**: rebased onto `main` `06c9f55`. The conflicts were in the test module (`main`'s `newer_layout_slot_139_resets_primary_and_reclaims_split_segments` and `slot_139_keeps_the_title_caller_for_the_backing_layout_guard`, both kept) and in `release`'s loop, where `main` iterates `extra_active`, `spares` and `first`: the PR's ABA guard now applies to all three. **Tested** - hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.9.2609.5, debug (`scripts/test.ps1`) and release (`scripts/smoke.ps1`) - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`): **1267 passed, 0 failed, 46 ignored** (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses, `no heap windows`, and `cannot disable the driver cache (Windows Developer Mode is required)`) - `cargo test -p xcl --lib title_list`: 3 passed, 0 failed (both new tests failed before the fix) **Regression run** main (`426a5a7`, clean tree, no local changes): ``` xcl-smoke v1 commit: 426a5a745db4d5e4b037449ede0b70cb342f5192 gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1642 (PresentX 1642) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15158 MB ``` PR (`0bfea00`, clean tree, no local changes): ``` xcl-smoke v1 commit: 0bfea00ee34df738436dbf2d2f098b6c36f2ed1e gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1638 (PresentX 1639) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16322 MB ``` (The main block is `426a5a7`, an ancestor of the current `main`, from the same machine and data folder.) **Not tested** - AMD GPUs and native wave64 hardware - other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine **AI use** - OpenCode, Claude Fable 5.2: rebased onto `main` `06c9f55`, resolved the conflicts, ran the suite and the `scripts/smoke.ps1` pair at the head above.
Two bugs in title_list segment and wrapper lifecycle:
- When a title_list split onto an extra PC segment and later returned
  that segment to `spares` via Reset or KickoffX, `alloc_pool::forget_list`
  was never called on the retired segment. The segment stayed in its
  backing allocator's `users` set indefinitely, preventing that backing
  allocator from being reused and leaking new PC allocators on every Reset.
- In `title_list::release`, after `f(pc)` freed the primary PC list,
  `WRAPPER_OF.remove(&pc)` and `bind::forget(pc)` ran unconditionally.
  If another thread created a new command list that reused the freed `pc`
  address in the window after `f(pc)`, the old wrapper's cleanup detached
  the new wrapper and wiped the new list's bind state.

Call `alloc_pool::forget_list(list)` inside `list_x::clear_segment_state`
(covering both `title_list::reset` and `KickoffX`) and before releasing
spare segments; in `title_list::release`, only remove `WRAPPER_OF` entries
still mapped to `this` and skip redundant `bind::forget(pc)` when `pc` was
adopted (already cleaned up inside `real::cl_release`).

Assisted-by: OpenCode (Gemini 4 Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:54:21 +00:00
Author
Owner

@⁠crosettiremi on GitHub · 2026-11-24 16:39 UTC · original

Tested the change at d827520 on Windows with an RX 7900 XT, on a downstream XCL stack that includes #1422 and a local direct texture upload change. Both split-segment tests and the existing in-flight allocator lifetime test passed individually. The release build passed.

I ran one game comparison per build with the same saved Series X profile, separate copies of the same populated DXIL/PSO caches, two DXC workers, a 28 GiB whole-job limit, and the same scripted Player1 selection at 33 s.

Last 2 s sample containing a present Terminal event
Without #1453 96.3 s Guest write to address zero at +0x23cf683
With #1453 238.2 s Guest breakpoint at +0x2474606 after 248 s; sampled process commit reached 28,052 MB

With the patch, at 256 allocator replacements the runtime logged 197 created and 197 put aside. The warm control ended before that counter appeared. An earlier run with the control executable and different cache history reached 256 replacements with 184 put aside. These counts include in-flight work and do not isolate a leak. The later run still had a dark captured frame. I could not verify a visible world or player control. One run per variant does not establish a timing improvement.

**@⁠crosettiremi** on GitHub · 2026-11-24 16:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/1453#issuecomment-7138012773) Tested the change at d827520 on Windows with an RX 7900 XT, on a downstream XCL stack that includes #1422 and a local direct texture upload change. Both split-segment tests and the existing in-flight allocator lifetime test passed individually. The release build passed. I ran one game comparison per build with the same saved Series X profile, separate copies of the same populated DXIL/PSO caches, two DXC workers, a 28 GiB whole-job limit, and the same scripted Player1 selection at 33 s. | | Last 2 s sample containing a present | Terminal event | |---|---:|---| | Without #1453 | 96.3 s | Guest write to address zero at +0x23cf683 | | With #1453 | 238.2 s | Guest breakpoint at +0x2474606 after 248 s; sampled process commit reached 28,052 MB | With the patch, at 256 allocator replacements the runtime logged 197 created and 197 put aside. The warm control ended before that counter appeared. An earlier run with the control executable and different cache history reached 256 replacements with 184 put aside. These counts include in-flight work and do not isolate a leak. The later run still had a dark captured frame. I could not verify a visible world or player control. One run per variant does not establish a timing improvement.
Author
Owner

@⁠LocranKing on GitHub · 2026-11-24 16:55 UTC · original

Independent Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB) test report for d827520e3d4741137e4b569fde77e415024cb186.

Tested

  • Commit: d827520e3d4741137e4b569fde77e415024cb186 (clean tree, merge-base b7aa9f3)
  • Hardware / software: Windows 11 Home Build 26200, AMD Ryzen 5 5500, 31.8 GB RAM, NVIDIA GeForce RTX 3060 Ti (8024 MiB VRAM, driver 32.0.16.2101), rustc 1.100.0 (x86_64-pc-windows-msvc, MSVC 14.44.35207), DXC 1.9.2602.17 (SDK 10.0.26100.0), --release
  • cargo build --release --workspace: ok (exit 0)
  • cargo test --workspace --release --no-fail-fast -- --test-threads=4: 772 passed, 0 failed, 41 ignored, exit 0
    • New tests passed: hle::d3d12x::title_list::tests::reset_releases_retired_split_segment_from_alloc_pool, hle::d3d12x::title_list::tests::release_does_not_remove_reused_pc_from_wrapper_map
    • SKIPPED (no wave64): gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware

Regression run
main baseline (b7aa9f3bd212088e0d927439284dc5ed325ce3c7):

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1508 (PresentX 1508)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14730 MB

PR head (d827520e3d4741137e4b569fde77e415024cb186):

xcl-smoke v1
commit: d827520e3d4741137e4b569fde77e415024cb186
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1597 (PresentX 1597)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14706 MB

Not tested: debug build, XCL_SAMPLE_* tests on this branch, AMD / native wave64 hardware, extended gameplay sessions past 60 s.

AI use: Antigravity (Gemini 4 Hydrogen) ran the build, tests, and smoke runs and drafted this report from the command outputs.

**@⁠LocranKing** on GitHub · 2026-11-24 16:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1453#issuecomment-7138415896) Independent Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB) test report for `d827520e3d4741137e4b569fde77e415024cb186`. **Tested** - Commit: `d827520e3d4741137e4b569fde77e415024cb186` (clean tree, merge-base `b7aa9f3`) - Hardware / software: Windows 11 Home Build 26200, AMD Ryzen 5 5500, 31.8 GB RAM, NVIDIA GeForce RTX 3060 Ti (`8024 MiB VRAM`, driver `32.0.16.2101`), `rustc 1.100.0` (`x86_64-pc-windows-msvc`, MSVC `14.44.35207`), DXC `1.9.2602.17` (SDK `10.0.26100.0`), `--release` - `cargo build --release --workspace`: ok (`exit 0`) - `cargo test --workspace --release --no-fail-fast -- --test-threads=4`: **772 passed, 0 failed, 41 ignored**, exit `0` - New tests passed: `hle::d3d12x::title_list::tests::reset_releases_retired_split_segment_from_alloc_pool`, `hle::d3d12x::title_list::tests::release_does_not_remove_reused_pc_from_wrapper_map` - `SKIPPED` (`no wave64`): `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware` **Regression run** `main` baseline (`b7aa9f3bd212088e0d927439284dc5ed325ce3c7`): ``` xcl-smoke v1 commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7 gpu: NVIDIA GeForce RTX 3060 Ti title: retail-1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1508 (PresentX 1508) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14730 MB ``` PR head (`d827520e3d4741137e4b569fde77e415024cb186`): ``` xcl-smoke v1 commit: d827520e3d4741137e4b569fde77e415024cb186 gpu: NVIDIA GeForce RTX 3060 Ti title: retail-1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1597 (PresentX 1597) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14706 MB ``` **Not tested:** debug build, `XCL_SAMPLE_*` tests on this branch, AMD / native wave64 hardware, extended gameplay sessions past 60 s. **AI use:** Antigravity (`Gemini 4 Hydrogen`) ran the build, tests, and smoke runs and drafted this report from the command outputs.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 18:52 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 18:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/1453#issuecomment-7141280472) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
Author
Owner

@⁠SergeAx on GitHub · 2026-11-26 03:11 UTC · original

Test report: #1453's diff (head 0bfea00) applied onto main b49be183, measured on the parallel-only failure of list_x::tests::a_dispatch_with_a_pipeline_still_building_waits_at_the_submit reported in #42.

That failure is the second bug this PR fixes. In a failing run on main, an instrumented bind::forget removed the dispatch test's stand-in state (pso == 0x7E57_D001) on the thread of a_reset_while_the_last_submit_runs_records_on_another_pc_list, from title_list::release's bind::forget(pc). A split segment the dispatch test had just made had the address of the reset test's freed primary list. bind::dispatch then saw no pending pipeline and stopped splitting (273, 289, 301 or 5 segments instead of 421).

Tested

  • NVIDIA GeForce RTX 5080 (driver 621.14), AMD Ryzen 5 3500X, Windows 10 Pro 22H2 (19045.6466), D3D12 Agility SDK 1.620.2, Rust 1.100.0, debug
  • The xcl lib test binary run as --test-threads=4 hle::d3d12x::list_x, the builds alternating run by run: the dispatch test failed in 13 of 200 runs on main and in 0 of 400 with this PR.
  • Other failures: in 8 of the 400 runs with this PR, another list_x test could not create a queue or allocator (E_OUTOFMEMORY, 0x8007000E). The same error came on a build without this PR too (main plus another change); main itself had 1 other failure in 200 runs, output not kept.

Not tested

  • The full suite and a title with this PR; AMD and Intel GPUs; Windows 11

real::cl_release still forgets a list after the runtime frees it (the same order, with a shorter window); that is not this PR's to fix.

AI use: Claude Code (Claude Opus 5.5) found the cause, ran the measurements and wrote this report.

**@⁠SergeAx** on GitHub · 2026-11-26 03:11 UTC · [original](https://github.com/xcl-dev/xcl/pull/1453#issuecomment-7181476062) Test report: #1453's diff (head `0bfea00`) applied onto `main` `b49be183`, measured on the parallel-only failure of `list_x::tests::a_dispatch_with_a_pipeline_still_building_waits_at_the_submit` reported in #42. That failure is the second bug this PR fixes. In a failing run on `main`, an instrumented `bind::forget` removed the dispatch test's stand-in state (`pso == 0x7E57_D001`) on the thread of `a_reset_while_the_last_submit_runs_records_on_another_pc_list`, from `title_list::release`'s `bind::forget(pc)`. A split segment the dispatch test had just made had the address of the reset test's freed primary list. `bind::dispatch` then saw no pending pipeline and stopped splitting (273, 289, 301 or 5 segments instead of 421). **Tested** - NVIDIA GeForce RTX 5080 (driver 621.14), AMD Ryzen 5 3500X, Windows 10 Pro 22H2 (19045.6466), D3D12 Agility SDK 1.620.2, Rust 1.100.0, debug - The xcl lib test binary run as `--test-threads=4 hle::d3d12x::list_x`, the builds alternating run by run: the dispatch test failed in 13 of 200 runs on `main` and in 0 of 400 with this PR. - Other failures: in 8 of the 400 runs with this PR, another `list_x` test could not create a queue or allocator (`E_OUTOFMEMORY`, `0x8007000E`). The same error came on a build without this PR too (`main` plus another change); `main` itself had 1 other failure in 200 runs, output not kept. **Not tested** - The full suite and a title with this PR; AMD and Intel GPUs; Windows 11 `real::cl_release` still forgets a list after the runtime frees it (the same order, with a shorter window); that is not this PR's to fix. AI use: Claude Code (Claude Opus 5.5) found the cause, ran the measurements and wrote this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 05:27 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 05:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/1453#issuecomment-7183502817) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
Author
Owner

@⁠sage-sage on GitHub · 2026-11-26 07:40 UTC · original

Test report: passes on NVIDIA merged onto current main, and with #2691 the dispatch flake from #2690 did not show in 300 parallel runs. Head 0bfea00e merged locally onto main b49be18 (clean, merge 289952d).

Tested

  • RTX 4080 SUPER (driver 621.40), Ryzen 5 7600X, Windows 11 26H2 build 26300.10075, rustc 1.100.0 MSVC, DXC 1.9.2602.17 (Windows SDK 10.0.26100), debug build
  • cargo test --workspace -- --test-threads=4 on main + this PR: 1437 passed, 0 failed, 47 ignored; on main + #2691 + this PR: 1438 passed, 0 failed, 47 ignored
  • SKIPPED: 29 lines, the same as on main on this machine (wave64, debug layer, Developer Mode, heap windows)
  • main + #2691 + #1453 merged locally (fc8561d), the lib test binary with hle:: --test-threads=12, 300 runs: a_dispatch_with_a_pipeline_still_building_waits_at_the_submit failed 0 times. On main (with only a test-only acphal change, #2700) the same setting failed it 32 times in 300 runs. The other failures in the 300 were acphal::tests::xapu_connect_returns_oom_and_cleans_up_on_failure (5), a test-only flake #2700 fixes.

Not tested

  • This PR's head as it is (187 commits behind main); this PR without #2691 under the stress run; no game; AMD / Intel.

Claude Code (Claude Opus 5.5) ran the tests and wrote this report.

**@⁠sage-sage** on GitHub · 2026-11-26 07:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/1453#issuecomment-7185709794) **Test report: passes on NVIDIA merged onto current `main`, and with #2691 the dispatch flake from #2690 did not show in 300 parallel runs.** Head `0bfea00e` merged locally onto `main` `b49be18` (clean, merge `289952d`). **Tested** - RTX 4080 SUPER (driver 621.40), Ryzen 5 7600X, Windows 11 26H2 build 26300.10075, rustc 1.100.0 MSVC, DXC 1.9.2602.17 (Windows SDK 10.0.26100), debug build - `cargo test --workspace -- --test-threads=4` on `main` + this PR: 1437 passed, 0 failed, 47 ignored; on `main` + #2691 + this PR: 1438 passed, 0 failed, 47 ignored - SKIPPED: 29 lines, the same as on `main` on this machine (wave64, debug layer, Developer Mode, heap windows) - `main` + #2691 + #1453 merged locally (`fc8561d`), the lib test binary with `hle:: --test-threads=12`, 300 runs: `a_dispatch_with_a_pipeline_still_building_waits_at_the_submit` failed 0 times. On `main` (with only a test-only acphal change, #2700) the same setting failed it 32 times in 300 runs. The other failures in the 300 were `acphal::tests::xapu_connect_returns_oom_and_cleans_up_on_failure` (5), a test-only flake #2700 fixes. **Not tested** - This PR's head as it is (187 commits behind `main`); this PR without #2691 under the stress run; no game; AMD / Intel. Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Author
Owner

@⁠KDenKC on GitHub · 2026-11-26 08:18 UTC · original

Source review of 0bfea00e, no run yet. Two things:

1. The spare pool's in-flight check may lose its data. This PR adds alloc_pool::forget_list(list) to list_x::clear_segment_state (list_x.rs:857). title_list::reset calls that for every segment it has just moved to b.spares (title_list.rs:~185-196). forget_list removes the segment's last_submit (alloc_pool.rs:92), and with it its recordings and its entry in the backing's users. But a title may reset a list while its last submission still runs, and pop_spare decides reuse with alloc_pool::in_flight(p) (title_list.rs:285), which reads that same last_submit. So a retired segment still on the GPU now looks idle and can be taken and reset at once. That is the case the check is there for. Keeping last_submit (and the recordings) until the segment is really released or done, and clearing only the list's own state here, would keep the guard working.

2. Our flake looks like yours. On an AMD iGPU (RDNA2, Ryzen 7 9800X3D), with the list_x fixtures pointed at it, a_dispatch_with_a_pipeline_still_building_waits_at_the_submit failed once in 6 parallel runs. The skipped dispatches showed pipeline 0x0 instead of the stand-in, and it gave 317 segments instead of 421. The standalone and serial runs passed. That matches what you describe (273/289/301 instead of 421). We'll run main, #2691, this PR, and both together, 50 times each on that iGPU, and post the counts here.

AI use: Gemini (Antigravity) found point 1 in a review; Claude Code (Claude Opus 5.5) checked it against 0bfea00e and main and wrote this.

**@⁠KDenKC** on GitHub · 2026-11-26 08:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/1453#issuecomment-7186429674) Source review of `0bfea00e`, no run yet. Two things: **1. The spare pool's in-flight check may lose its data.** This PR adds `alloc_pool::forget_list(list)` to `list_x::clear_segment_state` (`list_x.rs:857`). `title_list::reset` calls that for every segment it has just moved to `b.spares` (`title_list.rs:~185-196`). `forget_list` removes the segment's `last_submit` (`alloc_pool.rs:92`), and with it its `recordings` and its entry in the backing's `users`. But a title may reset a list while its last submission still runs, and `pop_spare` decides reuse with `alloc_pool::in_flight(p)` (`title_list.rs:285`), which reads that same `last_submit`. So a retired segment still on the GPU now looks idle and can be taken and reset at once. That is the case the check is there for. Keeping `last_submit` (and the recordings) until the segment is really released or done, and clearing only the list's own state here, would keep the guard working. **2. Our flake looks like yours.** On an AMD iGPU (RDNA2, Ryzen 7 9800X3D), with the `list_x` fixtures pointed at it, `a_dispatch_with_a_pipeline_still_building_waits_at_the_submit` failed once in 6 parallel runs. The skipped dispatches showed pipeline `0x0` instead of the stand-in, and it gave 317 segments instead of 421. The standalone and serial runs passed. That matches what you describe (273/289/301 instead of 421). We'll run `main`, #2691, this PR, and both together, 50 times each on that iGPU, and post the counts here. AI use: Gemini (Antigravity) found point 1 in a review; Claude Code (Claude Opus 5.5) checked it against `0bfea00e` and `main` and wrote this.
Author
Owner

@⁠KDenKC on GitHub · 2026-11-26 09:12 UTC · original

The repetition counts promised in 7186429674: this PR removes the flake on our AMD iGPU.

AMD Radeon integrated graphics (RDNA2) of a Ryzen 7 9800X3D, Windows 11, debug, XCL_ADAPTER=amd with a test-only fixture change so the list_x devices honour it (the fixture printed the AMD adapter on every run), cargo test -p xcl --lib list_x -- --test-threads=4. Up to 50 runs per arm; an arm stopped at its third failure.

arm runs failed segments in the failures (421 expected)
main b49be18 5 3 337, 75, 55
+ #2691 (008fc961) 11 3 51, 77, 81
+ this PR (0bfea00e) 50 0
+ both 50 0

Every failure was a_dispatch_with_a_pipeline_still_building_waits_at_the_submit, with Dispatch with a pipeline that has no translated console shader (0x0) skipped: the stand-in's state was gone, as you describe. The two PRs merge cleanly together.

Point 1 of my earlier comment (the spare pool's last_submit) still stands. These tests don't reach it.

Not tested: NVIDIA (never seen to fail there, 0 of 11 earlier runs); a title.

AI use: Claude Code (Claude Opus 5.5) ran the arms and wrote this.

**@⁠KDenKC** on GitHub · 2026-11-26 09:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/1453#issuecomment-7187584120) **The repetition counts promised in 7186429674: this PR removes the flake on our AMD iGPU.** AMD Radeon integrated graphics (RDNA2) of a Ryzen 7 9800X3D, Windows 11, debug, `XCL_ADAPTER=amd` with a test-only fixture change so the `list_x` devices honour it (the fixture printed the AMD adapter on every run), `cargo test -p xcl --lib list_x -- --test-threads=4`. Up to 50 runs per arm; an arm stopped at its third failure. | arm | runs | failed | segments in the failures (421 expected) | |---|---:|---:|---| | `main` `b49be18` | 5 | 3 | 337, 75, 55 | | + #2691 (`008fc961`) | 11 | 3 | 51, 77, 81 | | + this PR (`0bfea00e`) | 50 | 0 | | | + both | 50 | 0 | | Every failure was `a_dispatch_with_a_pipeline_still_building_waits_at_the_submit`, with `Dispatch with a pipeline that has no translated console shader (0x0) skipped`: the stand-in's state was gone, as you describe. The two PRs merge cleanly together. Point 1 of my earlier comment (the spare pool's `last_submit`) still stands. These tests don't reach it. Not tested: NVIDIA (never seen to fail there, 0 of 11 earlier runs); a title. AI use: Claude Code (Claude Opus 5.5) ran the arms and wrote this.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/1453/head:github-bot/gh-1453'
git switch 'github-bot/gh-1453'

Merge

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