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

Closed
broccolize wants to merge 1 commit from upstream-pr/2164 into main
broccolize commented 2026-11-25 06:42:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by broccolize on 2026-11-25T06:42:08Z.


Superseded on upstream main

Upstream now clears sparse-upload wait and fence caches before it drops the retired queue’s final reference. I verified four queue-generation, retirement, and sparse-wait tests on clean main at 9dfbe3e. Cache invalidation commit · Queue retirement commit

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

<!-- greyfinch-sync:ivall/xcl:issue:5486543135 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2164). Originally posted by [broccolize](https://github.com/broccolize) on 2026-11-25T06:42:08Z. --- **Superseded on upstream `main`** Upstream now clears sparse-upload wait and fence caches before it drops the retired queue’s final reference. I verified four queue-generation, retirement, and sparse-wait tests on clean `main` at `9dfbe3e`. [Cache invalidation commit](https://github.com/xcl-dev/xcl/commit/4a4c5f7be0463317cbd558620d5fc5567e8785a3) · [Queue retirement commit](https://github.com/xcl-dev/xcl/commit/9dabfe85b61ac86eb30dc4708eb1c9041e1a2934) 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://github.com/xcl-dev/xcl/pull/2164#issuecomment-7155983099) **Regression run** Independent seven-second retail startup comparison on an AMD Radeon RX 6800M. [Report by luckyteagirl](https://github.com/xcl-dev/xcl/pull/2164#issuecomment-7155983099) 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
broccolize commented 2026-11-25 08:08:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by broccolize on 2026-11-25T07:07:09Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7155508168 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2164#issuecomment-7155508168). Originally posted by [broccolize](https://github.com/broccolize) on 2026-11-25T07:07:09Z. --- 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!
DavidM1911 commented 2026-11-25 08:08:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T07:20:34Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7155753759 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2164#issuecomment-7155753759). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T07:20:34Z. --- 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!
luckyteagirl commented 2026-11-25 08:08:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-25T07:33:00Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7155983099 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2164#issuecomment-7155983099). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-25T07:33:00Z. --- 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.
github-actions[bot] commented 2026-11-29 07:40:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:40:18Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7252617634 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2164#issuecomment-7252617634). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T07:40:18Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
broccolize commented 2026-11-30 11:22:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by broccolize on 2026-11-30T11:22:04Z.


This draft fixes skipped sparse-upload waits after D3D12 queue reuse. The rebase and fresh retail smoke reports are the remaining work.

<!-- greyfinch-sync:ivall/xcl:comment:7276925696 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2164#issuecomment-7276925696). Originally posted by [broccolize](https://github.com/broccolize) on 2026-11-30T11:22:04Z. --- This draft fixes skipped sparse-upload waits after D3D12 queue reuse. The rebase and fresh retail smoke reports are the remaining work.

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