D3D12.X: hold console_list UMA blocks until allocator reset on Release #1305

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

@⁠b3IKK on GitHub · 2026-11-24 14:33 UTC · original
b3IKK:d3d12x/console-list-release-hold-uma → main · +28 −1 · 1 files · 1 commits · open

In D3D12, a command list may be released immediately after ExecuteCommandLists while the GPU is still executing its commands (the backing allocator outlives GPU execution). Both console_list::cl_reset and bind::forget hold recorded UMA blocks until allocator_reset(), but console_list::cl_release called free_uma(&st.uma) immediately—allowing in-flight argument/upload buffers to be reused while the GPU is still reading them.

This replaces free_uma(&st.uma) in cl_release with hold_until_reset(st.allocator, st.uma).

What is in it

  • crates/xcl/src/hle/d3d12x/console_list.rs: hold st.uma via hold_until_reset(st.allocator, st.uma) in cl_release; add unit test cl_release_holds_uma_until_allocator_reset (verified failing before the fix).

Tested

  • hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1)
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 752 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2 no wave64 — gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)
  • cargo test -p xcl --lib cl_release_holds_uma_until_allocator_reset: 1 passed, 0 failed (failed before the fix)

Regression run

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1226 (PresentX 1226)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15341 MB

PR:

xcl-smoke v1
commit: f904b850b56cea1de9d2af77dbb2e6ce9d770859
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1645 (PresentX 1645)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14599 MB

Not tested

  • AMD GPUs and native wave64 hardware
  • other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine

AI use

  • OpenCode, Gemini 4 Neon: audited console_list.rs, wrote the fix and unit test, ran the test suite and scripts/smoke.ps1 regression runs, and drafted this PR description.
**@⁠b3IKK** on GitHub · 2026-11-24 14:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/1305) `b3IKK:d3d12x/console-list-release-hold-uma` → `main` · +28 −1 · 1 files · 1 commits · open In D3D12, a command list may be released immediately after `ExecuteCommandLists` while the GPU is still executing its commands (the backing allocator outlives GPU execution). Both `console_list::cl_reset` and `bind::forget` hold recorded UMA blocks until `allocator_reset()`, but `console_list::cl_release` called `free_uma(&st.uma)` immediately—allowing in-flight argument/upload buffers to be reused while the GPU is still reading them. This replaces `free_uma(&st.uma)` in `cl_release` with `hold_until_reset(st.allocator, st.uma)`. **What is in it** - `crates/xcl/src/hle/d3d12x/console_list.rs`: hold `st.uma` via `hold_until_reset(st.allocator, st.uma)` in `cl_release`; add unit test `cl_release_holds_uma_until_allocator_reset` (verified failing before the fix). **Tested** - hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.9.2609.5, debug (`scripts/test.ps1`) and release (`scripts/smoke.ps1`) - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`): 752 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2 `no wave64` — `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware`) - `cargo test -p xcl --lib cl_release_holds_uma_until_allocator_reset`: 1 passed, 0 failed (failed before the fix) **Regression run** main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1226 (PresentX 1226) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15341 MB ``` PR: ``` xcl-smoke v1 commit: f904b850b56cea1de9d2af77dbb2e6ce9d770859 gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1645 (PresentX 1645) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14599 MB ``` **Not tested** - AMD GPUs and native wave64 hardware - other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine **AI use** - OpenCode, Gemini 4 Neon: audited `console_list.rs`, wrote the fix and unit test, ran the test suite and `scripts/smoke.ps1` regression runs, and drafted this PR description.
In D3D12, a command list may be released immediately after
ExecuteCommandLists while the GPU is still executing its commands (the
allocator outlives GPU execution). Both console_list::cl_reset and
bind::forget hold recorded UMA blocks until allocator_reset(), but
console_list::cl_release freed st.uma immediately, allowing in-flight
argument/upload buffers to be reused while the GPU was still reading
them.

Call hold_until_reset(st.allocator, st.uma) in cl_release instead of
free_uma(&st.uma), with a unit test.

Assisted-by: OpenCode (Gemini 4 Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:50:11 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 14:44 UTC · original · edited 2026-11-24 14:47 UTC

Full-suite run, since this PR has no test report yet. Tested exact head f904b85 (on its base 930e8b4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: cl_release_holds_uma_until_allocator_reset.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-24 14:44 UTC · [original](https://github.com/xcl-dev/xcl/pull/1305#issuecomment-7134883489) · edited 2026-11-24 14:47 UTC Full-suite run, since this PR has no test report yet. Tested exact head `f904b85` (on its base `930e8b4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **752 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `cl_release_holds_uma_until_allocator_reset`. - Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **752 passed, 0 failed, 41 ignored**, no skips. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠JoaoPauluu on GitHub · 2026-11-24 15:28 UTC · original

A regression run under Wine on Linux, on a retail title.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. f904b85 as it is and main 930e8b4, no uncommitted changes. Retail title 1.0.2.1, scripts/linux/smoke.sh (#257) for 60 s, no input. Nine runs in a row, main first and last, other PRs in between.
  • A regression check: I did not check whether GTA VI reaches the changed code in these 60 s.

Regression run

main (first run):

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1371 (PresentX 1371)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

this PR:

xcl-smoke v1
commit: f904b850b56cea1de9d2af77dbb2e6ce9d770859
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1380 (PresentX 1380)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

The last main run: 1338 frames, exit: 0x0, no device removal, no crash. Under Wine, peak commit reads 0 MB, so these blocks do not check memory.

Not tested

  • the test suite on this head; native Windows; AMD.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
**@⁠JoaoPauluu** on GitHub · 2026-11-24 15:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/1305#issuecomment-7136079393) A regression run under Wine on Linux, on a retail title. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `f904b85` as it is and `main` `930e8b4`, no uncommitted changes. Retail title 1.0.2.1, `scripts/linux/smoke.sh` (#257) for 60 s, no input. Nine runs in a row, `main` first and last, other PRs in between. - A regression check: I did not check whether GTA VI reaches the changed code in these 60 s. **Regression run** main (first run): ``` xcl-smoke v1 commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56 gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1371 (PresentX 1371) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` this PR: ``` xcl-smoke v1 commit: f904b850b56cea1de9d2af77dbb2e6ce9d770859 gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1380 (PresentX 1380) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` The last `main` run: 1338 frames, `exit: 0x0`, no device removal, no crash. Under Wine, `peak commit` reads 0 MB, so these blocks do not check memory. **Not tested** - the test suite on this head; native Windows; AMD. **AI use** - Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 15:47 UTC · original

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

  • cargo test -p xcl --lib -- --test-threads=1: all passed, 0 failed, 21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodified main.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 15:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/1305#issuecomment-7136605636) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib -- --test-threads=1`: all passed, 0 failed, 21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodified `main`.) Thanks!
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/hle/d3d12x/console_list.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/1305/head:github-bot/gh-1305'
git switch 'github-bot/gh-1305'

Merge

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