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

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

@⁠nova-aryan on GitHub · 2026-11-24 10:04 UTC · original
nova-aryan:contrib/allocator-reset-errors → main · +92 −2 · 2 files · 1 commits · draft

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.

**@⁠nova-aryan** on GitHub · 2026-11-24 10:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/994) `nova-aryan:contrib/allocator-reset-errors` → `main` · +92 −2 · 2 files · 1 commits · draft 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.
Propagate replacement GetDevice/CreateCommandAllocator failures instead of letting the Reset hook fall back to the original backing. Add synthetic COM coverage for failure and retry paths; execution remains pending at the user's request. Fixes #989.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:39:44 +00:00
Author
Owner

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

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.

**@⁠dcastell1** on GitHub · 2026-11-24 10:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/994#issuecomment-7128493711) 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.
Author
Owner

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

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.

**@⁠SlopTart** on GitHub · 2026-11-24 11:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/994#issuecomment-7130726832) 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.
Author
Owner

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

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.

**@⁠DavidM1911** on GitHub · 2026-11-24 12:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/994#issuecomment-7131299919) 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.
Author
Owner

@⁠Toons29 on GitHub · 2026-11-25 03:09 UTC · original

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.

**@⁠Toons29** on GitHub · 2026-11-25 03:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/994#issuecomment-7151652295) 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.
This pull request has changes conflicting with the target branch.
  • README.md
  • crates/xcl/src/hle/d3d12x/alloc_pool.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/994/head:github-bot/gh-994'
git switch 'github-bot/gh-994'

Merge

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