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

Closed
ksanjeev284 wants to merge 1 commit from upstream-pr/1051 into main
ksanjeev284 commented 2026-11-24 10:55:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ksanjeev284 on 2026-11-24T10:55:51Z.


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.
<!-- greyfinch-sync:ivall/xcl:issue:6580204536 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1051). Originally posted by [ksanjeev284](https://github.com/ksanjeev284) on 2026-11-24T10:55:51Z. --- 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.
copilot-pull-request-reviewer[bot commented 2026-11-24 11:05:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-24T10:56:05Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:ivall/xcl:review:6037943154 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1051#pullrequestreview-6037943154). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/copilot-pull-request-reviewer%5Bbot%5D) on 2026-11-24T10:56:05Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
DavidM1911 commented 2026-11-24 12:05:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T11:13:38Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7129822663 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1051#issuecomment-7129822663). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T11:13:38Z. --- 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.
upstream-sync closed this pull request 2026-11-24 13:02:52 +00:00
ksanjeev284 commented 2026-11-24 13:03:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ksanjeev284 on 2026-11-24T12:38:33Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7131721712 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1051#issuecomment-7131721712). Originally posted by [ksanjeev284](https://github.com/ksanjeev284) on 2026-11-24T12:38:33Z. --- Closing as 384f7f7 (#1009) just landed on main covering reusable allocator retention across a failed Reset.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1044
No description provided.