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

Closed
slopgobblercobbler wants to merge 1 commit from upstream-pr/1622 into main
slopgobblercobbler commented 2026-11-24 18:22:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by slopgobblercobbler on 2026-11-24T18:22:37Z.


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

<!-- greyfinch-sync:ivall/xcl:issue:6588566331 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1622). Originally posted by [slopgobblercobbler](https://github.com/slopgobblercobbler) on 2026-11-24T18:22:37Z. --- ## 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
gut0to commented 2026-11-24 19:06:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T18:26:25Z.

Review: COMMENTED


Because this changes runtime code, CONTRIBUTING.md requires both the full workspace GPU suite and a real-title scripts/smoke.ps1 comparison on main and this head. The Tested section reports only cargo test -p xcl -- console_list, and Not Tested says the retail run was not done under XCL_CONSOLE_LISTS=1. Please add the full GPU suite and paired smoke results with the option enabled before merge. AI-assisted review; I checked the requirements against the guide.

<!-- greyfinch-sync:ivall/xcl:review:6045021382 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1622#pullrequestreview-6045021382). Originally posted by [gut0to](https://github.com/gut0to) on 2026-11-24T18:26:25Z. **Review:** COMMENTED --- Because this changes runtime code, CONTRIBUTING.md requires both the full workspace GPU suite and a real-title `scripts/smoke.ps1` comparison on `main` and this head. The Tested section reports only `cargo test -p xcl -- console_list`, and Not Tested says the retail run was not done under `XCL_CONSOLE_LISTS=1`. Please add the full GPU suite and paired smoke results with the option enabled before merge. AI-assisted review; I checked the requirements against the guide.
upstream-sync closed this pull request 2026-11-24 21:07:10 +00:00
Anon64 commented 2026-11-24 21:08:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-24T19:33:23Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7142266078 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1622#issuecomment-7142266078). Originally posted by [Anon64](https://github.com/Anon64) on 2026-11-24T19:33:23Z. --- 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.
throny commented 2026-11-24 21:09:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-24T20:15:31Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7143262702 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1622#issuecomment-7143262702). Originally posted by [throny](https://github.com/throny) on 2026-11-24T20:15:31Z. --- <!-- 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.
DavidM1911 commented 2026-11-24 21:09:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T20:37:52Z.


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

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

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7143842873 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1622#issuecomment-7143842873). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T20:37:52Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. Thanks!
ivall commented 2026-11-24 21:09:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-24T20:43:17Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7143966515 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1622#issuecomment-7143966515). Originally posted by [ivall](https://github.com/ivall) on 2026-11-24T20:43:17Z. --- 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

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