D3D12.X: preserve busy allocators when replacement fails #988

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

Imported from ivall/xcl. Originally posted by nova-aryan on 2026-11-24T10:04:51Z.


When a busy command allocator needs another backing, failure in GetDevice or CreateCommandAllocator currently returns None from title_reset. The caller interprets that as permission to reset the original allocator, even though its recordings are still held. Return the failure HRESULT instead and preserve the backing and recording associations. Fixes #989.

This is a failure-path fix following #897/#907. It does not establish the cause of the retail world-loading watchdog or null-write reports.

What is in it

  • alloc_pool.rs: propagate replacement errors instead of falling through to the original Reset; synthetic COM regression for device-lookup failure, allocation failure, retries, recording associations and reference cleanup.
  • README.md: describe failed replacement behavior. One commit, no new dependencies or game data.

Tested

  • Source inspection of the caller and replacement paths on main 9aec53d.
  • git diff --check: exit 0.
  • No local build, test executable, GPU workload or game was run for this change. Local execution is disabled at the user's request; no local passing test counts are claimed.
  • Independent report by @dcastell1: this PR's patch applied to main@02bfd1d, Windows 11 10.0.26300, RTX 5090 driver 621.24, Rust 1.100.0/MSVC 14.44.35207, debug; cargo test --workspace -- --test-threads=4: 728 passed, 0 failed, 41 ignored versus baseline 727/0/41. Report prepared using opencode (model not specified). This is an external patch-on-main run, not an exact-head retail smoke run; GPU skip counts were not reported.

Regression run
Not run. Main/head retail smoke blocks are missing; this remains a draft pending Windows validation.

Not tested

  • Local compilation/execution, actual allocation pressure and retail gameplay. The independent suite report above does not replace paired main/head retail smoke runs.
  • Expected negative control by source inspection: the unmodified path returns None for both injected failures, so the new HRESULT assertions should fail. This has not been executed.
  • The existing successful replacement path is unchanged. Other allocator failure cases and the title's response to an allocation error remain outside this patch.

AI use
Codex (GPT-6) inspected the code, wrote the patch and regression, and prepared this description. The exact backend model identifier was not provided in this session.

<!-- greyfinch-sync:ivall/xcl:issue:5470057992 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/994). Originally posted by [nova-aryan](https://github.com/nova-aryan) on 2026-11-24T10:04:51Z. --- When a busy command allocator needs another backing, failure in `GetDevice` or `CreateCommandAllocator` currently returns `None` from `title_reset`. The caller interprets that as permission to reset the original allocator, even though its recordings are still held. Return the failure HRESULT instead and preserve the backing and recording associations. Fixes #989. This is a failure-path fix following #897/#907. It does not establish the cause of the retail world-loading watchdog or null-write reports. **What is in it** - `alloc_pool.rs`: propagate replacement errors instead of falling through to the original Reset; synthetic COM regression for device-lookup failure, allocation failure, retries, recording associations and reference cleanup. - `README.md`: describe failed replacement behavior. One commit, no new dependencies or game data. **Tested** - Source inspection of the caller and replacement paths on main `9aec53d`. - `git diff --check`: exit 0. - No local build, test executable, GPU workload or game was run for this change. Local execution is disabled at the user's request; no local passing test counts are claimed. - Independent [report by @dcastell1](https://github.com/ivall/xcl/pull/994#issuecomment-7128493711): this PR's patch applied to `main@02bfd1d`, Windows 11 10.0.26300, RTX 5090 driver 621.24, Rust 1.100.0/MSVC 14.44.35207, debug; `cargo test --workspace -- --test-threads=4`: 728 passed, 0 failed, 41 ignored versus baseline 727/0/41. Report prepared using opencode (model not specified). This is an external patch-on-main run, not an exact-head retail smoke run; GPU skip counts were not reported. **Regression run** Not run. Main/head retail smoke blocks are missing; this remains a draft pending Windows validation. **Not tested** - Local compilation/execution, actual allocation pressure and retail gameplay. The independent suite report above does not replace paired main/head retail smoke runs. - Expected negative control by source inspection: the unmodified path returns `None` for both injected failures, so the new HRESULT assertions should fail. This has not been executed. - The existing successful replacement path is unchanged. Other allocator failure cases and the title's response to an allocation error remain outside this patch. **AI use** Codex (GPT-6) inspected the code, wrote the patch and regression, and prepared this description. The exact backend model identifier was not provided in this session.
dcastell1 commented 2026-11-24 11:05:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by dcastell1 on 2026-11-24T10:13:52Z.


Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on main@02bfd1d (baseline 727 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
728 passed; 0 failed; 41 ignored   (exit 0)

One more passing test than the baseline: preserving busy allocators when a replacement fails is exercised and green.

Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

<!-- greyfinch-sync:ivall/xcl:comment:7128493711 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/994#issuecomment-7128493711). Originally posted by [dcastell1](https://github.com/dcastell1) on 2026-11-24T10:13:52Z. --- Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on `main@02bfd1d` (baseline **727 passed, 0 failed, 41 ignored** on this box): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 728 passed; 0 failed; 41 ignored (exit 0) ``` One more passing test than the baseline: preserving busy allocators when a replacement fails is exercised and green. Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
SlopTart commented 2026-11-24 12:05:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-24T11:55:31Z.


Heads-up: this branch no longer merges cleanly.

Rebuild today: pull/994/head onto current main fails to merge - main took PRs #1009 and #1012 (384f7f7, the allocator pool: failed Resets / released lists), which touch the same allocator-recording code this PR's preserve busy allocators when replacement fails sits on. CI here is description-check-only, so the conflict won't surface beyond the merge button. Untested until rebased; I can run it on RDNA3/Wine after that (my allocator-adjacent rows: #1012/#1023 lanes were green here today).

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the checks and drafted this; I checked it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7130726832 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/994#issuecomment-7130726832). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-24T11:55:31Z. --- Heads-up: this branch no longer merges cleanly. Rebuild today: `pull/994/head` onto current main fails to merge - main took PRs #1009 and #1012 (`384f7f7`, the allocator pool: failed Resets / released lists), which touch the same allocator-recording code this PR's `preserve busy allocators when replacement fails` sits on. CI here is description-check-only, so the conflict won't surface beyond the merge button. Untested until rebased; I can run it on RDNA3/Wine after that (my allocator-adjacent rows: #1012/#1023 lanes were green here today). **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile. My Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the checks and drafted this; I checked it before posting.
DavidM1911 commented 2026-11-24 13:03:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T12:20:22Z.


Independent check — this branch no longer merges cleanly into current main 384f7f7.

git merge upstream/main conflicts in crates/xcl/src/hle/d3d12x/alloc_pool.rs (tests module, two hunks). It is not just textual: main's merged allocator-pool work (#1009/#1012/#1023) added a_spare_whose_reset_fails_stays_available_for_retry and released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing in the same spot, and both sides define unsafe extern "system" fn release with different signatures (Device refs vs Fence releases) plus share the unexpected_call/SLOT scaffolding — so the resolution needs a rename, not just keeping both blocks.

Until rebased, the new test a_failed_replacement_keeps_the_busy_allocator cannot run against current main. (I did not resolve it locally — the fix belongs to the author.)

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

<!-- greyfinch-sync:ivall/xcl:comment:7131299919 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/994#issuecomment-7131299919). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T12:20:22Z. --- Independent check — **this branch no longer merges cleanly into current `main` `384f7f7`**. `git merge upstream/main` conflicts in `crates/xcl/src/hle/d3d12x/alloc_pool.rs` (tests module, two hunks). It is not just textual: main's merged allocator-pool work (#1009/#1012/#1023) added `a_spare_whose_reset_fails_stays_available_for_retry` and `released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing` in the same spot, and **both sides define `unsafe extern "system" fn release`** with different signatures (Device refs vs Fence releases) plus share the `unexpected_call`/`SLOT` scaffolding — so the resolution needs a rename, not just keeping both blocks. Until rebased, the new test `a_failed_replacement_keeps_the_busy_allocator` cannot run against current main. (I did not resolve it locally — the fix belongs to the author.) AI use: merge test by Devin (Cognition, SWE-2); no code changes.
Toons29 commented 2026-11-25 04:10:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T03:09:53Z.


Regression run of ff3182f9 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: ff3182f9e37fc51d28b83feb581a402b1975c677
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1628 (PresentX 1629)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14813 MB

Against the limits in CONTRIBUTING.md: 101 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; I checked the blocks before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7151652295 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/994#issuecomment-7151652295). Originally posted by [Toons29](https://github.com/Toons29) on 2026-11-25T03:09:53Z. --- Regression run of `ff3182f9` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: ff3182f9e37fc51d28b83feb581a402b1975c677 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1628 (PresentX 1629) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14813 MB ``` Against the limits in CONTRIBUTING.md: 101 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; I checked the blocks before posting.
github-actions[bot] commented 2026-11-28 07:59:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T07:59:55Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7236294454 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/994#issuecomment-7236294454). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T07:59:55Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 04:36:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:36:31Z.


Triage (#1607) – head ff3182f

Main already does what this PR fixes. Since 8303b3a ("D3D12.X: reset allocator backings outside global state"), the ResetWork::Create branch of alloc_pool::title_reset turns a GetDevice error, a missing device and a CreateCommandAllocator error into Some(error), after cancel_reset. It no longer returns None, so alloc_reset does not fall back to resetting the busy allocator, and the backing and list associations are left as they were.
This PR's title_reset hunk targets the old function body and conflicts. Its mock-COM test could still be useful on top of main as a separate test-only PR. The README line is not needed. #989 can be closed against 8303b3a.
Recommendation: close (superseded by main commit 8303b3a).

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7300907743 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/994#issuecomment-7300907743). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:36:31Z. --- **Triage (#1607)** – head ff3182f Main already does what this PR fixes. Since 8303b3a ("D3D12.X: reset allocator backings outside global state"), the `ResetWork::Create` branch of `alloc_pool::title_reset` turns a `GetDevice` error, a missing device and a `CreateCommandAllocator` error into `Some(error)`, after `cancel_reset`. It no longer returns `None`, so `alloc_reset` does not fall back to resetting the busy allocator, and the backing and list associations are left as they were. This PR's `title_reset` hunk targets the old function body and conflicts. Its mock-COM test could still be useful on top of main as a separate test-only PR. The README line is not needed. #989 can be closed against 8303b3a. Recommendation: close (superseded by main commit 8303b3a). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
throny commented 2026-12-01 12:41:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:41:39Z.


Closing as superseded: this change is already on main (8303b3a1). main alloc_pool.rs ResetWork::Create returns the GetDevice/CreateCommandAllocator HRESULT and cancel_reset(token) instead of returning None; PR's mock-COM test and README sentence are the only remainder

Two independent checks found this: Foniass's close list on #1607 and ours against current main. If something here is still missing on main, say so and reopen it, or ask and I will.

AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

<!-- greyfinch-sync:ivall/xcl:comment:7311510545 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/994#issuecomment-7311510545). Originally posted by [throny](https://github.com/throny) on 2026-12-01T12:41:39Z. --- Closing as superseded: this change is already on `main` (8303b3a1). main alloc_pool.rs ResetWork::Create returns the GetDevice/CreateCommandAllocator HRESULT and cancel_reset(token) instead of returning None; PR's mock-COM test and README sentence are the only remainder Two independent checks found this: Foniass's close list on #1607 and ours against current `main`. If something here is still missing on `main`, say so and reopen it, or ask and I will. AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

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!988
No description provided.