D3D12.X: drop overflow pooled resources and preludes outside bind locks #2710

Open
github-bot wants to merge 1 commit from github-bot/gh-2710 into amd-dev AGit
Owner

@⁠Saksukella on GitHub · 2026-11-26 07:55 UTC · original
Saksukella:fix/bind-release-drop-outside-lock → amd-dev · +16 −0 · 1 files · 1 commits · open

What is in it

  • crates/xcl/src/hle/d3d12x/bind.rs (release_allocator_res): collect overflow FREE_RES, FREE_IO, and FREE_PRELUDE entries into local Vecs and drop them only after releasing the pool mutexes.
  • Previously, once FREE_PRELUDE reached FREE_PRELUDE_CAP (256), dropping an excess PreludeEntry inside the FREE_PRELUDE.lock() scope released its adopted ID3D12CommandAllocator, re-entering real::alloc_release -> console_list::allocator_reset -> bind::release_allocator_res -> FREE_PRELUDE.lock() on the same thread (re-entrant self-deadlock).
  • Target branch: amd-dev (where FREE_PRELUDE / release_allocator_res live).

Tested

  • Hardware: AMD Radeon RX 9070 XT (driver 32.0.32029.2010), 24-thread x86_64 CPU, 32 GB RAM, Windows; rustc 1.100.0 (0ef1bc386 2026-11-09); debug (tests) and release (xcl.exe).
  • cargo test -p xcl --lib bind::tests -- --test-threads=1: 41 passed, 0 failed (0.43s).
  • Live-verified in 180s 3D workload where thread-dump symbolization (XCL_THREAD_DUMP_AT=62) had previously caught the exact bind::release_allocator_res -> real::alloc_release -> console_list::allocator_reset -> bind::release_allocator_res deadlock at t=56s; with this fix the deadlock is eliminated completely.

Regression run

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: AMD Radeon RX 9070 XT
title: b8db18c2
seconds: 60
exit: 0x0
frames shown: 1624 (PresentX 1624)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19700 MB
xcl-smoke v1
commit: 7602c356365d698a50c6ed3a5bd3c0423347ee57
gpu: AMD Radeon RX 9070 XT
title: b8db18c2
seconds: 60
exit: 0x0
frames shown: 1666 (PresentX 1666)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15597 MB

Not tested

  • NVIDIA and Intel GPU adapters (tested on AMD Radeon RX 9070 XT only).

AI use

  • Antigravity (Google Gemini frontier model): assisted with thread-dump PDB symbolization of the FREE_PRELUDE re-entrant deadlock, editing release_allocator_res, and running unit tests and smoke verification. All diffs and results were reviewed and verified locally on hardware.
**@⁠Saksukella** on GitHub · 2026-11-26 07:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/2710) `Saksukella:fix/bind-release-drop-outside-lock` → `amd-dev` · +16 −0 · 1 files · 1 commits · open **What is in it** - `crates/xcl/src/hle/d3d12x/bind.rs` (`release_allocator_res`): collect overflow `FREE_RES`, `FREE_IO`, and `FREE_PRELUDE` entries into local `Vec`s and drop them only after releasing the pool mutexes. - Previously, once `FREE_PRELUDE` reached `FREE_PRELUDE_CAP` (256), dropping an excess `PreludeEntry` inside the `FREE_PRELUDE.lock()` scope released its adopted `ID3D12CommandAllocator`, re-entering `real::alloc_release` -> `console_list::allocator_reset` -> `bind::release_allocator_res` -> `FREE_PRELUDE.lock()` on the same thread (re-entrant self-deadlock). - Target branch: `amd-dev` (where `FREE_PRELUDE` / `release_allocator_res` live). **Tested** - Hardware: AMD Radeon RX 9070 XT (driver `32.0.32029.2010`), 24-thread x86_64 CPU, 32 GB RAM, Windows; `rustc 1.100.0 (0ef1bc386 2026-11-09)`; debug (tests) and release (`xcl.exe`). - `cargo test -p xcl --lib bind::tests -- --test-threads=1`: 41 passed, 0 failed (`0.43s`). - Live-verified in 180s 3D workload where thread-dump symbolization (`XCL_THREAD_DUMP_AT=62`) had previously caught the exact `bind::release_allocator_res` -> `real::alloc_release` -> `console_list::allocator_reset` -> `bind::release_allocator_res` deadlock at `t=56s`; with this fix the deadlock is eliminated completely. **Regression run** ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: AMD Radeon RX 9070 XT title: b8db18c2 seconds: 60 exit: 0x0 frames shown: 1624 (PresentX 1624) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19700 MB ``` ``` xcl-smoke v1 commit: 7602c356365d698a50c6ed3a5bd3c0423347ee57 gpu: AMD Radeon RX 9070 XT title: b8db18c2 seconds: 60 exit: 0x0 frames shown: 1666 (PresentX 1666) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15597 MB ``` **Not tested** - NVIDIA and Intel GPU adapters (tested on AMD Radeon RX 9070 XT only). **AI use** - Antigravity (Google Gemini frontier model): assisted with thread-dump PDB symbolization of the `FREE_PRELUDE` re-entrant deadlock, editing `release_allocator_res`, and running unit tests and smoke verification. All diffs and results were reviewed and verified locally on hardware.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 07:58:15 +00:00
This pull request can be merged automatically.
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/2710/head:github-bot/gh-2710'
git switch 'github-bot/gh-2710'

Merge

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