D3D12.X: hold UMA blocks until allocator reset on console list release (#1488) #1622

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

@⁠slopgobblercobbler on GitHub · 2026-11-24 18:22 UTC · original
slopgobblercobbler:fix/console-list-uma-hold → main · +54 −4 · 1 files · 1 commits · closed without merging

Summary

Defers freeing UMA argument-table and IO blocks on console command list release until command allocator reset in crates/xcl/src/hle/d3d12x/console_list.rs (Issue #1488, finding XCL-BT-022):

  1. In-flight UMA lifetime safety:
    • In D3D12, titles are permitted to release a closed command list immediately after submission via ExecuteCommandLists while the GPU is still executing (only the backing command allocator must remain alive until execution completes).
    • In console_list.rs, cl_release previously called free_uma(&st.uma) immediately when the command list refcount dropped to 0, recycling argument tables and IO blocks out from under in-flight GPU execution.
    • Replaced immediate free_uma in cl_release with hold_until_reset(st.allocator, st.uma), matching cl_reset and bind::forget. UMA blocks are now safely deferred into PENDING[st.allocator] and reclaimed only when the caller resets the command allocator after GPU completion.
  2. Unified cleanup:
    • Reused hold_until_reset across both cl_reset and cl_release.
  3. Unit tests:
    • Added uma_blocks_are_held_until_allocator_reset_on_release in console_list.rs verifying refcounting, retention of UMA blocks until allocator reset, and clean deallocation on allocator_reset.

Changes

  • crates/xcl/src/hle/d3d12x/console_list.rs:
    • Defer UMA block freeing in cl_release via hold_until_reset.
    • Unit test verifying UMA lifetime preservation across command list release and allocator reset.

Tested

  • Windows 11 x64, Rust MSVC stable.
  • cargo test -p xcl -- console_list: 7 passed, 0 failed.
  • Clean diff: zero trailing whitespace, clean rebase on latest upstream/main, GPL-2.0-only compliant, zero retail game data or keys.

Not Tested

  • Real-time retail title execution under XCL_CONSOLE_LISTS=1.

AI Use

Co-Authored-By: Claude Code (Claude Opus 5.5) / Gemini Antigravity

**@⁠slopgobblercobbler** on GitHub · 2026-11-24 18:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1622) `slopgobblercobbler:fix/console-list-uma-hold` → `main` · +54 −4 · 1 files · 1 commits · closed without merging ## Summary Defers freeing UMA argument-table and IO blocks on console command list release until command allocator reset in `crates/xcl/src/hle/d3d12x/console_list.rs` (Issue #1488, finding `XCL-BT-022`): 1. **In-flight UMA lifetime safety**: - In D3D12, titles are permitted to release a closed command list immediately after submission via `ExecuteCommandLists` while the GPU is still executing (only the backing command allocator must remain alive until execution completes). - In `console_list.rs`, `cl_release` previously called `free_uma(&st.uma)` immediately when the command list refcount dropped to 0, recycling argument tables and IO blocks out from under in-flight GPU execution. - Replaced immediate `free_uma` in `cl_release` with `hold_until_reset(st.allocator, st.uma)`, matching `cl_reset` and `bind::forget`. UMA blocks are now safely deferred into `PENDING[st.allocator]` and reclaimed only when the caller resets the command allocator after GPU completion. 2. **Unified cleanup**: - Reused `hold_until_reset` across both `cl_reset` and `cl_release`. 3. **Unit tests**: - Added `uma_blocks_are_held_until_allocator_reset_on_release` in `console_list.rs` verifying refcounting, retention of UMA blocks until allocator reset, and clean deallocation on `allocator_reset`. ## Changes - `crates/xcl/src/hle/d3d12x/console_list.rs`: - Defer UMA block freeing in `cl_release` via `hold_until_reset`. - Unit test verifying UMA lifetime preservation across command list release and allocator reset. ## Tested - Windows 11 x64, Rust MSVC stable. - `cargo test -p xcl -- console_list`: 7 passed, 0 failed. - Clean diff: zero trailing whitespace, clean rebase on latest `upstream/main`, GPL-2.0-only compliant, zero retail game data or keys. ## Not Tested - Real-time retail title execution under `XCL_CONSOLE_LISTS=1`. ## AI Use Co-Authored-By: Claude Code (Claude Opus 5.5) / Gemini Antigravity
Finding XCL-BT-022 (issue #1488): In cl_release, replace immediate
free_uma(&st.uma) with hold_until_reset(st.allocator, st.uma), matching
cl_reset and bind::forget. This prevents freeing UMA argument and IO blocks
while in-flight GPU execution proceeds on closed command lists.

Add unit test verifying UMA blocks are held until allocator reset on release.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:59:45 +00:00
github-bot closed this pull request 2026-11-26 04:59:45 +00:00
Author
Owner

@⁠Anon64 on GitHub · 2026-11-24 19:33 UTC · original

Regression run for this PR: head 31fe507, based on main 9e3831e. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s, scripts/smoke.ps1 on a retail title for 60 s, in one batch with the main run.

main 9e3831e:

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1536 (PresentX 1536)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 97380 MB

this PR:

xcl-smoke v1
commit: 31fe5070457ba43aa4915de0d69c2fc5625e1046
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1525 (PresentX 1525)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 102345 MB

No device removals or crashes; 99 % of main's frames, 105 % of its peak commit.

Peak commit on this machine is mostly the pipeline preload's DXC compiles (#1035) and varies from run to run, so it says little about this PR.

Not tested: the whole suite; whether the title reaches the changed code in these 60 s.

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

**@⁠Anon64** on GitHub · 2026-11-24 19:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/1622#issuecomment-7142266078) Regression run for this PR: head `31fe507`, based on `main` `9e3831e`. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s, `scripts/smoke.ps1` on a retail title for 60 s, in one batch with the `main` run. main `9e3831e`: ``` xcl-smoke v1 commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1536 (PresentX 1536) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 97380 MB ``` this PR: ``` xcl-smoke v1 commit: 31fe5070457ba43aa4915de0d69c2fc5625e1046 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1525 (PresentX 1525) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 102345 MB ``` No device removals or crashes; 99 % of main's frames, 105 % of its peak commit. Peak commit on this machine is mostly the pipeline preload's DXC compiles (#1035) and varies from run to run, so it says little about this PR. **Not tested:** the whole suite; whether the title reaches the changed code in these 60 s. Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Author
Owner

@⁠throny on GitHub · 2026-11-24 20:15 UTC · original

Two contributors checked independently and found that this PR makes the same change as #1305 (for #1488): #1607, group D33. They suggest keeping #1305. If you agree, closing this PR or joining the other one would save the maintainers a review. If the two differ in a way the checks missed, a note in #1607 helps.

This is a hint, not a request from the maintainers; nobody from the project has adopted #1607 so far.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

**@⁠throny** on GitHub · 2026-11-24 20:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/1622#issuecomment-7143262702) <!-- xcl-1607-hint:D33 --> Two contributors checked independently and found that this PR makes the same change as #1305 (for #1488): #1607, group D33. They suggest keeping #1305. If you agree, closing this PR or joining the other one would save the maintainers a review. If the two differ in a way the checks missed, a note in #1607 helps. This is a hint, not a request from the maintainers; nobody from the project has adopted #1607 so far. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Author
Owner

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

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 20:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/1622#issuecomment-7143842873) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. Thanks!
Author
Owner

@⁠ivall on GitHub · 2026-11-24 20:43 UTC · original

Closing this as a duplicate: #1305 makes the same change and was opened first (a released console list holds its unified-memory blocks until its allocator resets). It stays open and is the one that will be reviewed and merged.

This says nothing about the quality of the code here. I compared the two diffs; the pair was also found by independent checks in #1607. If this PR covers a case #1305 does not, or #1305 is closed without being merged, say so and I'll reopen it. A test that is only here is welcome on #1305.

Thank you for the work.

AI use: Claude Code (Claude Opus 5.5) compared the diffs and wrote this comment; the decision is the maintainer's.

**@⁠ivall** on GitHub · 2026-11-24 20:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/1622#issuecomment-7143966515) Closing this as a duplicate: #1305 makes the same change and was opened first (a released console list holds its unified-memory blocks until its allocator resets). It stays open and is the one that will be reviewed and merged. This says nothing about the quality of the code here. I compared the two diffs; the pair was also found by independent checks in #1607. If this PR covers a case #1305 does not, or #1305 is closed without being merged, say so and I'll reopen it. A test that is only here is welcome on #1305. Thank you for the work. AI use: Claude Code (Claude Opus 5.5) compared the diffs and wrote this comment; the decision is the maintainer's.

Pull request closed

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