D3D12.X: forget sparse upload waits when queues are replaced #2164

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

@⁠broccolize on GitHub · 2026-11-25 06:42 UTC · original
broccolize:d3d12x/sparse-queue-wait-lifetime → main · +61 −7 · 3 files · 1 commits · draft

A new D3D12 command queue can reuse a released queue’s address while a sparse upload is pending. XCL caches upload-fence waits by queue address, so the replacement queue can inherit the old entry, skip its own wait, and start GPU work before the upload completes.

What is in it

  • list_x.rs and real.rs record wait invalidations on final release and command queue adoption. sparse.rs applies them the next time it takes the sparse state lock, so the callbacks can return while a submit holds that lock.
  • sparse.rs adds a regression test that models address reuse, checks that release can return while sparse state is locked, and verifies that another live queue retains its wait.

Tested

  • Windows x64 debug on an NVIDIA GeForce GTX 1650. Host metadata reports driver 32.0.16.1714, Intel Core i5-10300H, and Windows 11 26H2 build 26300.9974. The focused reruns used Rust 1.100.0 (MSVC) and DXC 1.9.2609.5.

  • The saved workspace build on 11221ff succeeded. The workspace suite reported 1,153 passed, 2 failed, and 46 ignored. It printed 25 SKIPPED diagnostics for unavailable wave64 (20), unsupported wave32 f16 cases (3), an unavailable driver-cache toggle (1), and unavailable heap windows (1). The original workspace invocation flags are unavailable.

  • console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk reported DXIL not compiled yet in the head workspace run and in a focused run on the original base 6ea813a.

  • cargo test --locked --offline --jobs 4 -p xcl --lib hle::d3d12x::bind::tests::execute_indirect_reads_the_arguments_written_before_it -- --exact --test-threads=1 failed at CreateComputePipelineState with HRESULT 0x80070057 on both main (568e7db) and PR head (11221ff), built in separate Cargo target directories. The earlier head workspace run reached dispatch and reported incorrect group counts on 20 of 40 dispatches. That dispatch-count failure remains unresolved.

  • cargo test --locked --offline --jobs 4 -p xcl --lib hle::d3d12x::sparse::tests -- --test-threads=4 on 11221ff reported 16 passed, 0 failed, and 1 ignored. The queue-reuse test passed and failed at the fence-wait assertion in the saved negative-control run.

  • An independent sparse test run on an AMD Windows host reported 16 passed, 0 failed, 1 ignored, and 0 skipped on 11221ff. The release workspace build passed. AMD verification

Regression run

Independent seven-second retail startup comparison on an AMD Radeon RX 6800M. Report by luckyteagirl

Main (6020a33)

xcl-smoke v1
commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 6934 MB

PR head (11221ff)

xcl-smoke v1
commit: 11221ff186e68b6375bd630c21d86ca18b57b499
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 6851 MB

Not tested

Sustained retail gameplay, live D3D12 queue-address reuse during an in-flight upload, Intel GPUs, macOS, and Linux. Both retail startup runs reached one frame and logged zero draws or dispatches.

AI use

OpenAI Codex (GPT-6) assisted with the patch and regression test, verified the saved logs and ran the focused checks

**@⁠broccolize** on GitHub · 2026-11-25 06:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/2164) `broccolize:d3d12x/sparse-queue-wait-lifetime` → `main` · +61 −7 · 3 files · 1 commits · draft A new D3D12 command queue can reuse a released queue’s address while a sparse upload is pending. XCL caches upload-fence waits by queue address, so the replacement queue can inherit the old entry, skip its own wait, and start GPU work before the upload completes. **What is in it** - `list_x.rs` and `real.rs` record wait invalidations on final release and command queue adoption. `sparse.rs` applies them the next time it takes the sparse state lock, so the callbacks can return while a submit holds that lock. - `sparse.rs` adds a regression test that models address reuse, checks that release can return while sparse state is locked, and verifies that another live queue retains its wait. **Tested** - Windows x64 debug on an NVIDIA GeForce GTX 1650. Host metadata reports driver `32.0.16.1714`, Intel Core i5-10300H, and Windows 11 26H2 build `26300.9974`. The focused reruns used Rust `1.100.0` (MSVC) and DXC `1.9.2609.5`. - The saved workspace build on `11221ff` succeeded. The workspace suite reported **1,153 passed, 2 failed, and 46 ignored**. It printed **25 `SKIPPED` diagnostics** for unavailable wave64 (20), unsupported wave32 f16 cases (3), an unavailable driver-cache toggle (1), and unavailable heap windows (1). The original workspace invocation flags are unavailable. - `console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk` reported `DXIL not compiled yet` in the head workspace run and in a focused run on the original base `6ea813a`. - `cargo test --locked --offline --jobs 4 -p xcl --lib hle::d3d12x::bind::tests::execute_indirect_reads_the_arguments_written_before_it -- --exact --test-threads=1` failed at `CreateComputePipelineState` with HRESULT `0x80070057` on both `main` (`568e7db`) and PR head (`11221ff`), built in separate Cargo target directories. The earlier head workspace run reached dispatch and reported incorrect group counts on 20 of 40 dispatches. That dispatch-count failure remains unresolved. - `cargo test --locked --offline --jobs 4 -p xcl --lib hle::d3d12x::sparse::tests -- --test-threads=4` on `11221ff` reported **16 passed, 0 failed, and 1 ignored**. The queue-reuse test passed and failed at the fence-wait assertion in the saved negative-control run. - An independent sparse test run on an AMD Windows host reported 16 passed, 0 failed, 1 ignored, and 0 skipped on `11221ff`. The release workspace build passed. [AMD verification](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2164) **Regression run** Independent seven-second retail startup comparison on an AMD Radeon RX 6800M. [Report by luckyteagirl](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2164) Main (`6020a33`) ```text xcl-smoke v1 commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09 gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 7 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 6934 MB ``` PR head (`11221ff`) ```text xcl-smoke v1 commit: 11221ff186e68b6375bd630c21d86ca18b57b499 gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 7 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 6851 MB ``` **Not tested** Sustained retail gameplay, live D3D12 queue-address reuse during an in-flight upload, Intel GPUs, macOS, and Linux. Both retail startup runs reached one frame and logged zero draws or dispatches. **AI use** OpenAI Codex (GPT-6) assisted with the patch and regression test, verified the saved logs and ran the focused checks
A command queue can reuse a released queue address while a sparse upload is still pending. Invalidate remembered waits at final release and adoption, and defer the bookkeeping so queue callbacks do not take the sparse state lock.

Assisted-by: OpenAI Codex (GPT-6)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:21:26 +00:00
Author
Owner

@⁠broccolize on GitHub · 2026-11-25 07:07 UTC · original

Could someone with a retail title that already runs in XCL help with the smoke test for this draft?

Please run the same title on the same PC for 60 seconds on both main and the exact PR head 11221ff. From each clean checkout, run:

cargo build --release -p xcl
.\scripts\smoke.ps1 -Game 'D:\path\to\your\title' -Seconds 60

Please reply here with both xcl-smoke blocks and label which one is from main and which is from the PR head. Thanks!

**@⁠broccolize** on GitHub · 2026-11-25 07:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/2164#issuecomment-7155508168) Could someone with a retail title that already runs in XCL help with the smoke test for this draft? Please run the same title on the same PC for 60 seconds on both `main` and the exact PR head `11221ff`. From each clean checkout, run: ```powershell cargo build --release -p xcl .\scripts\smoke.ps1 -Game 'D:\path\to\your\title' -Seconds 60 ``` Please reply here with both `xcl-smoke` blocks and label which one is from `main` and which is from the PR head. Thanks!
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 07:20 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 07:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/2164#issuecomment-7155753759) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-25 07:33 UTC · original

Independent Windows AMD check of exact PR head 11221ff186e68b6375bd630c21d86ca18b57b499. The author requested a 60-second title pair; this host could complete a seven-second startup pair only, so the blocks below are labeled with their actual duration.

Tested

  • Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M driver 30.0.13002.13003; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5. Debug tests, release smoke.
  • cargo test --locked -p xcl --lib -j 2 hle::d3d12x::sparse::tests -- --test-threads=1 --show-output: 16 passed, 0 failed, 1 ignored, 0 SKIPPED, including a_reused_queue_address_repeats_its_sparse_upload_wait and the_queue_is_answered_while_the_state_is_locked. I also ran the built test executable directly with the same filter and counts under a temporary Windows high-performance per-app preference, then restored the previous setting. This matters because some tests call D3D12CreateDevice(None), which otherwise selects this laptop's integrated AMD GPU. A separate adapter-LUID probe verified the preference selects the RX 6800M (00000000:00014d72); the tests do not print their device LUID.
  • cargo build --locked --workspace --release -j 2: passed.

Regression run

Guarded seven-second launches of the same owned title, with isolated data and DXIL caches. The clean main commit has the same runtime source as this PR's 568e7db base. Neither guard fired.

xcl-smoke v1
commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 6934 MB
xcl-smoke v1
commit: 11221ff186e68b6375bd630c21d86ca18b57b499
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 6851 MB

These startup runs reached one frame and logged zero draws or dispatches. They do not show queue-address reuse during an in-flight sparse upload or sustained world loading. I did not complete the requested 60-second run or a full workspace suite on this head. The focused regression models the queue-reuse behavior.

AI-assisted checkout, testing, adapter-selection verification, smoke monitoring, and report drafting with OpenAI Codex (GPT-6). No game data was uploaded.

**@⁠luckyteagirl** on GitHub · 2026-11-25 07:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/2164#issuecomment-7155983099) Independent Windows AMD check of exact PR head `11221ff186e68b6375bd630c21d86ca18b57b499`. The author requested a 60-second title pair; this host could complete a **seven-second startup pair only**, so the blocks below are labeled with their actual duration. **Tested** - Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M driver `30.0.13002.13003`; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5. Debug tests, release smoke. - `cargo test --locked -p xcl --lib -j 2 hle::d3d12x::sparse::tests -- --test-threads=1 --show-output`: **16 passed, 0 failed, 1 ignored, 0 SKIPPED**, including `a_reused_queue_address_repeats_its_sparse_upload_wait` and `the_queue_is_answered_while_the_state_is_locked`. I also ran the built test executable directly with the same filter and counts under a temporary Windows high-performance per-app preference, then restored the previous setting. This matters because some tests call `D3D12CreateDevice(None)`, which otherwise selects this laptop's integrated AMD GPU. A separate adapter-LUID probe verified the preference selects the RX 6800M (`00000000:00014d72`); the tests do not print their device LUID. - `cargo build --locked --workspace --release -j 2`: passed. **Regression run** Guarded seven-second launches of the same owned title, with isolated data and DXIL caches. The clean `main` commit has the same runtime source as this PR's `568e7db` base. Neither guard fired. ```text xcl-smoke v1 commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09 gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 7 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 6934 MB ``` ```text xcl-smoke v1 commit: 11221ff186e68b6375bd630c21d86ca18b57b499 gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 7 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 6851 MB ``` These startup runs reached one frame and logged zero draws or dispatches. They do not show queue-address reuse during an in-flight sparse upload or sustained world loading. I did not complete the requested 60-second run or a full workspace suite on this head. The focused regression models the queue-reuse behavior. AI-assisted checkout, testing, adapter-selection verification, smoke monitoring, and report drafting with OpenAI Codex (GPT-6). No game data was uploaded.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/2164/head:github-bot/gh-2164'
git switch 'github-bot/gh-2164'

Merge

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