D3D12.X: keep reusable allocator in aside when Reset fails (#1004) #1051

Closed
github-bot wants to merge 1 commit from gh-pr/1051/head into gh-pr/1051/base
Owner

@⁠ksanjeev284 on GitHub · 2026-11-24 10:55 UTC · original
ksanjeev284:pr-1004-alloc-pool-reset → main · +112 −42 · 1 files · 1 commits · closed without merging

Fixes #1004.

In alloc_pool::title_reset, the reusable-backing branch removed the spare candidate from aside and cleared its marks before calling reset_pc_allocator. If Reset returned an error, the spare was no longer in aside or cur, so it leaked out of the pool and a retry would allocate a new backing instead of reusing it.

What is in it

  • crates/xcl/src/hle/d3d12x/alloc_pool.rs: factor the state transition into State::reset_title, call reset_pc on the reusable candidate before removing it from aside and clearing its marks, and add failed_reset_keeps_reusable_allocator_in_aside_for_retry covering failed Reset, retry reuse without allocating a new backing, and publication to cur.

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce RTX 3070 Ti (8 GB), Windows 11, Rust 1.88.0 (cargo +1.88.0), debug tests + release xcl.exe
  • cargo +1.88.0 test -p xcl --lib alloc_pool -- --nocapture: 2 passed (failed_reset_keeps_reusable_allocator_in_aside_for_retry, a_recording_outlives_the_reset_of_the_titles_allocator), 0 failed
  • cargo +1.88.0 test --workspace --no-fail-fast -- --test-threads=4 on base 6efdabc: 724 passed, 3 failed (pre-existing in this sandboxed environment: xmem_virtual_query_marks_cpu_readable_memory and 2 unbuilt e2e testtitle tests), 41 ignored (SKIPPED GPU tests: gpu_geometry_wave32_prefix_count_over_a_mask: no wave64, gpu_wave32_program_in_wave64_hardware: no wave64)

Regression run

main:

xcl-smoke v1
commit: 6efdabcdaac93ce5cc123a85e85deba5d49cb294
gpu: NVIDIA GeForce RTX 3070 Ti
title: retail_title_smoke
seconds: 35
exit: 0x0
frames shown: 321 (PresentX 321)
presents per 2 s (last 3): 0 2 38
device removals: 0
crashes: 0
peak commit: 16096 MB

PR:

xcl-smoke v1
commit: efa54c63089530283993929596e9f3acf3db9dd3
gpu: NVIDIA GeForce RTX 3070 Ti
title: retail_title_smoke
seconds: 35
exit: 0x0
frames shown: 329 (PresentX 329)
presents per 2 s (last 3): 2 31 60
device removals: 0
crashes: 0
peak commit: 15736 MB

Not tested

  • AMD RDNA / wave64 GPUs
  • Triggering a real driver Reset failure on a live retail title (covered by the isolated state-machine unit test)

AI use

  • Antigravity (Gemini 3.1 Pro) wrote the fix, unit test, and PR description and ran the tests and smoke runs under author review.
**@⁠ksanjeev284** on GitHub · 2026-11-24 10:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1051) `ksanjeev284:pr-1004-alloc-pool-reset` → `main` · +112 −42 · 1 files · 1 commits · closed without merging Fixes #1004. In `alloc_pool::title_reset`, the reusable-backing branch removed the spare candidate from `aside` and cleared its marks before calling `reset_pc_allocator`. If `Reset` returned an error, the spare was no longer in `aside` or `cur`, so it leaked out of the pool and a retry would allocate a new backing instead of reusing it. **What is in it** - `crates/xcl/src/hle/d3d12x/alloc_pool.rs`: factor the state transition into `State::reset_title`, call `reset_pc` on the reusable candidate before removing it from `aside` and clearing its marks, and add `failed_reset_keeps_reusable_allocator_in_aside_for_retry` covering failed `Reset`, retry reuse without allocating a new backing, and publication to `cur`. **Tested** - hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce RTX 3070 Ti (8 GB), Windows 11, Rust 1.88.0 (`cargo +1.88.0`), debug tests + release `xcl.exe` - `cargo +1.88.0 test -p xcl --lib alloc_pool -- --nocapture`: 2 passed (`failed_reset_keeps_reusable_allocator_in_aside_for_retry`, `a_recording_outlives_the_reset_of_the_titles_allocator`), 0 failed - `cargo +1.88.0 test --workspace --no-fail-fast -- --test-threads=4` on base `6efdabc`: 724 passed, 3 failed (pre-existing in this sandboxed environment: `xmem_virtual_query_marks_cpu_readable_memory` and 2 unbuilt `e2e` testtitle tests), 41 ignored (SKIPPED GPU tests: `gpu_geometry_wave32_prefix_count_over_a_mask: no wave64`, `gpu_wave32_program_in_wave64_hardware: no wave64`) **Regression run** main: ``` xcl-smoke v1 commit: 6efdabcdaac93ce5cc123a85e85deba5d49cb294 gpu: NVIDIA GeForce RTX 3070 Ti title: retail_title_smoke seconds: 35 exit: 0x0 frames shown: 321 (PresentX 321) presents per 2 s (last 3): 0 2 38 device removals: 0 crashes: 0 peak commit: 16096 MB ``` PR: ``` xcl-smoke v1 commit: efa54c63089530283993929596e9f3acf3db9dd3 gpu: NVIDIA GeForce RTX 3070 Ti title: retail_title_smoke seconds: 35 exit: 0x0 frames shown: 329 (PresentX 329) presents per 2 s (last 3): 2 31 60 device removals: 0 crashes: 0 peak commit: 15736 MB ``` **Not tested** - AMD RDNA / wave64 GPUs - Triggering a real driver `Reset` failure on a live retail title (covered by the isolated state-machine unit test) **AI use** - Antigravity (Gemini 3.1 Pro) wrote the fix, unit test, and PR description and ran the tests and smoke runs under author review.
Fixes #1004. In alloc_pool::title_reset, call reset_pc_allocator on the reusable candidate before removing it from aside and clearing its marks, so a failed Reset leaves the spare tracked and reusable on retry instead of leaking it.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:41:53 +00:00
github-bot closed this pull request 2026-11-26 04:41:53 +00:00
Author
Owner

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

Heads-up: current main 384f7f7 already contains this fix through the merged allocator-pool series (#994 "preserve busy allocators when replacement fails", #1009, #1012, #1023 — commit f52ec36 "keep reusable allocators after a failed Reset"). alloc_pool.rs on main now has title_reset_in keeping the failed candidate owned, with the regression "the failed candidate is still owned and reusable" — the same behaviour this PR adds, and this branch no longer merges cleanly. Suggest closing as superseded unless there's a remaining delta I'm missing.

AI use: checked by Devin (Cognition, SWE-2); merge attempted locally, no code changes.

**@⁠DavidM1911** on GitHub · 2026-11-24 11:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/1051#issuecomment-7129822663) Heads-up: current `main` `384f7f7` already contains this fix through the merged allocator-pool series (#994 "preserve busy allocators when replacement fails", #1009, #1012, #1023 — commit `f52ec36` "keep reusable allocators after a failed Reset"). `alloc_pool.rs` on main now has `title_reset_in` keeping the failed candidate owned, with the regression "the failed candidate is still owned and reusable" — the same behaviour this PR adds, and this branch no longer merges cleanly. Suggest closing as superseded unless there's a remaining delta I'm missing. AI use: checked by Devin (Cognition, SWE-2); merge attempted locally, no code changes.
Author
Owner

@⁠ksanjeev284 on GitHub · 2026-11-24 12:38 UTC · original

Closing as 384f7f7 (#1009) just landed on main covering reusable allocator retention across a failed Reset.

**@⁠ksanjeev284** on GitHub · 2026-11-24 12:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/1051#issuecomment-7131721712) Closing as 384f7f7 (#1009) just landed on main covering reusable allocator retention across a failed Reset.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.