Tests: a wait for a later signal on another queue gets past sparse uploads #603

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

@⁠Kalmarv on GitHub · 2026-11-24 02:22 UTC · original
Kalmarv:test/sparse-1047-cross-queue → main · +70 −0 · 1 files · 1 commits · open

A title's queue may GPU-wait for a fence that another of its queues signals only in a later submit; async compute does this. sparse::before_execute uploads the CPU's writes into the sparse windows before each submit. A fix for the uploads' cross-queue writes (#262) that makes XCL's upload queue wait for the submitting queue's earlier work would make that wait for itself: A waits for B, B's submit waits for the upload, and the upload waits for A. This test guards against that. It changes no runtime code.

Part of #262. The other test for #262, that an upload waits for the title queue's writes into the same window (debug layer message 1047), fails on main. It follows in a later PR together with the fix.

What is in it

  • crates/xcl/tests/sparse_queue_waits.rs: a_wait_for_a_later_signal_on_another_queue_does_not_hang, in its own process. Queue A waits for fence F; the CPU writes and A submits. The CPU writes again; compute queue B submits and only then signals F. A must finish within 5 s. If it doesn't, the test signals F from the CPU so that the process can end, then fails. A's two submits use two empty lists, so that no list is submitted again before its first run has finished.

Tested

  • RTX 5070 Ti (NVIDIA 610.74), Ryzen 9 9950X, Windows 11 Pro 25H2 (26200.9711), rustc 1.99.0, debug.
  • cargo test --workspace -- --test-threads=4 on 7a1794c, an earlier version of this commit (the skips printed instead of calling runner::skip_test, and A submitted one list twice): 678 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware.
  • cargo test --workspace -- --test-threads=4 on the head fc7336c merged onto main 9e3831e (a clean merge, cb10791): 777 passed, 0 failed, 41 ignored (the xcl library: 727 passed, 21 ignored; sparse_queue_waits: 1 passed). SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • sparse_queue_waits on its own, on the head commit fc7336c, 3 runs: passes 3 of 3, in 0.2 to 0.4 s.
  • Under the D3D12 debug layer (a local copy that turns it on and counts the InfoQueue's error and corruption messages), 2 runs: 0 errors. 0b33cf8 submitted A's list twice and got 1 error in each of 2 runs: ExecuteCommandLists: Failed to execute a command list … because the command queue fence has not advanced past previous executions of the command list (message 553), as thehollowedone found in review.
  • AMD Radeon RX 9060 XT (RDNA4), by MesshM on 0b33cf8 merged onto main cb868b2 (report): .\scripts\test.ps1 686 passed, 0 failed, 41 ignored, no SKIPPED; the test on its own passes 3 of 3.
  • On WARP, as on CI without a GPU: XCL_ADAPTER does not reach this test (it takes the default adapter, create_device(None), as texture_states.rs does). So a local copy that opens EnumWarpAdapter ("Microsoft Basic Render Driver") was run instead. sparse::init makes no sparse windows there, and the test skips with SKIPPED a_wait_for_a_later_signal_on_another_queue_does_not_hang: no sparse windows and exits 0. With XCL_REQUIRE_GPU=wave64 the same skip fails, through runner::skip_test.
  • What it guards against, measured on 7a1794c: with the upload made to wait on the GPU for the submitting queue's earlier work (a fence that queue signals, waited on by XCL's upload queue; a local change only, not in this PR), it fails 3 of 3 with "queue A did not finish in 5 s".

Not tested

  • Intel GPUs. AMD only on 0b33cf8 (MesshM's run above), not on the head commit. On WARP the test only skips: it needs sparse windows, and WARP gets none.
  • Only the deadlock is checked. Whether the uploads still race the title queue's writes (1047) is the other test's job, in the fix PR.

AI use

  • Claude Code with Claude Opus 5.5 wrote the test, ran it and wrote this description.

🤖 Generated with Claude Code

**@⁠Kalmarv** on GitHub · 2026-11-24 02:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/603) `Kalmarv:test/sparse-1047-cross-queue` → `main` · +70 −0 · 1 files · 1 commits · open A title's queue may GPU-wait for a fence that another of its queues signals only in a later submit; async compute does this. `sparse::before_execute` uploads the CPU's writes into the sparse windows before each submit. A fix for the uploads' cross-queue writes (#262) that makes XCL's upload queue wait for the submitting queue's earlier work would make that wait for itself: A waits for B, B's submit waits for the upload, and the upload waits for A. This test guards against that. It changes no runtime code. Part of #262. The other test for #262, that an upload waits for the title queue's writes into the same window (debug layer message 1047), fails on `main`. It follows in a later PR together with the fix. **What is in it** - `crates/xcl/tests/sparse_queue_waits.rs`: `a_wait_for_a_later_signal_on_another_queue_does_not_hang`, in its own process. Queue A waits for fence F; the CPU writes and A submits. The CPU writes again; compute queue B submits and only then signals F. A must finish within 5 s. If it doesn't, the test signals F from the CPU so that the process can end, then fails. A's two submits use two empty lists, so that no list is submitted again before its first run has finished. **Tested** - RTX 5070 Ti (NVIDIA 610.74), Ryzen 9 9950X, Windows 11 Pro 25H2 (26200.9711), rustc 1.99.0, debug. - `cargo test --workspace -- --test-threads=4` on `7a1794c`, an earlier version of this commit (the skips printed instead of calling `runner::skip_test`, and A submitted one list twice): 678 passed, 0 failed, 41 ignored. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware`. - `cargo test --workspace -- --test-threads=4` on the head `fc7336c` merged onto `main` `9e3831e` (a clean merge, `cb10791`): 777 passed, 0 failed, 41 ignored (the `xcl` library: 727 passed, 21 ignored; `sparse_queue_waits`: 1 passed). SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware` (no wave64), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - `sparse_queue_waits` on its own, on the head commit `fc7336c`, 3 runs: passes 3 of 3, in 0.2 to 0.4 s. - Under the D3D12 debug layer (a local copy that turns it on and counts the InfoQueue's error and corruption messages), 2 runs: 0 errors. `0b33cf8` submitted A's list twice and got 1 error in each of 2 runs: `ExecuteCommandLists: Failed to execute a command list … because the command queue fence has not advanced past previous executions of the command list` (message 553), as thehollowedone found in review. - AMD Radeon RX 9060 XT (RDNA4), by MesshM on `0b33cf8` merged onto `main` `cb868b2` ([report](https://github.com/ivall/xcl/pull/603#issuecomment-7120263856)): `.\scripts\test.ps1` 686 passed, 0 failed, 41 ignored, no SKIPPED; the test on its own passes 3 of 3. - On WARP, as on CI without a GPU: `XCL_ADAPTER` does not reach this test (it takes the default adapter, `create_device(None)`, as `texture_states.rs` does). So a local copy that opens `EnumWarpAdapter` ("Microsoft Basic Render Driver") was run instead. `sparse::init` makes no sparse windows there, and the test skips with `SKIPPED a_wait_for_a_later_signal_on_another_queue_does_not_hang: no sparse windows` and exits 0. With `XCL_REQUIRE_GPU=wave64` the same skip fails, through `runner::skip_test`. - What it guards against, measured on `7a1794c`: with the upload made to wait on the GPU for the submitting queue's earlier work (a fence that queue signals, waited on by XCL's upload queue; a local change only, not in this PR), it fails 3 of 3 with "queue A did not finish in 5 s". **Not tested** - Intel GPUs. AMD only on `0b33cf8` (MesshM's run above), not on the head commit. On WARP the test only skips: it needs sparse windows, and WARP gets none. - Only the deadlock is checked. Whether the uploads still race the title queue's writes (1047) is the other test's job, in the fix PR. **AI use** - Claude Code with Claude Opus 5.5 wrote the test, ran it and wrote this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A title's queue may GPU-wait for a fence that another of its queues signals
only in a later submit (async compute does). sparse::before_execute uploads
the CPU's writes into the sparse windows before each submit. A fix for the
uploads' cross-queue writes (#262) that makes XCL's upload queue wait for the
submitting queue's earlier work would make that wait for itself: A waits for
B, B's submit waits for the upload, and the upload waits for A.

Test crates/xcl/tests/sparse_queue_waits.rs, in its own process: queue A
waits for fence F, the CPU writes and A submits; the CPU writes again, compute
queue B submits and only then signals F. A must finish within 5 s (then the
test signals F from the CPU so that the process can end). No runtime change.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:26:52 +00:00
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 02:33 UTC · original

Test run of 0b33cf8629be37562824ca4610246457bada580b on AMD RDNA4; the PR was tested on NVIDIA only. The branch is based on 7ebf1b8, so I merged it onto current main cb868b2 locally (clean merge, one new file) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4) on the merge: 686 passed, 0 failed, 41 ignored, exit code 0
  • 0 SKIPPED, so the test got a device and sparse windows here and did not skip; a_wait_for_a_later_signal_on_another_queue_does_not_hang passes
  • the test on its own, 3 more runs: 3 of 3 passed (0.22–0.25 s each, far below the 5 s limit)

Review: the test sets up the case the description gives: queue A waits for F before its second submit, the CPU writes into the sparse windows before each submit (before_execute with the written addresses), and the compute queue B signals F only after its own upload. On a timeout it signals F from the CPU before failing, so a regression fails the test instead of hanging the run, and it is in its own process (crates/xcl/tests/), so XCL_UMA_MB / XCL_COHERENT_MB set at its start reach sparse::init and touch no other test. On current main it passes, as expected for a guard written ahead of the #262 fix. Small thing: the sparse block from alloc_in is not freed at the end; harmless in a process of its own. I found nothing to change.

Not tested: no retail title (not needed for a test-only change), release build, the second #262 test (the description says it follows with the fix).

Run and report by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

**@⁠MesshM** on GitHub · 2026-11-24 02:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/603#issuecomment-7120263856) Test run of `0b33cf8629be37562824ca4610246457bada580b` on AMD RDNA4; the PR was tested on NVIDIA only. The branch is based on `7ebf1b8`, so I merged it onto current `main` `cb868b2` locally (clean merge, one new file) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`) on the merge: **686 passed, 0 failed, 41 ignored**, exit code 0 - **0 `SKIPPED`**, so the test got a device and sparse windows here and did not skip; `a_wait_for_a_later_signal_on_another_queue_does_not_hang` passes - the test on its own, 3 more runs: 3 of 3 passed (0.22–0.25 s each, far below the 5 s limit) **Review:** the test sets up the case the description gives: queue A waits for F before its second submit, the CPU writes into the sparse windows before each submit (`before_execute` with the written addresses), and the compute queue B signals F only after its own upload. On a timeout it signals F from the CPU before failing, so a regression fails the test instead of hanging the run, and it is in its own process (`crates/xcl/tests/`), so `XCL_UMA_MB` / `XCL_COHERENT_MB` set at its start reach `sparse::init` and touch no other test. On current `main` it passes, as expected for a guard written ahead of the #262 fix. Small thing: the sparse block from `alloc_in` is not freed at the end; harmless in a process of its own. I found nothing to change. **Not tested:** no retail title (not needed for a test-only change), release build, the second #262 test (the description says it follows with the fix). Run and report by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 02:49 UTC · original

Thanks, confirmed and fixed in fc7336c. Under the D3D12 debug layer (a local copy that turns it on and counts the InfoQueue's error and corruption messages), 0b33cf8 gives the same error in 2 of 2 runs, message 553: ExecuteCommandLists: Failed to execute a command list … because the command queue fence has not advanced past previous executions of the command list. So the debug layer dropped A's second submit. With A's second submit on its own empty DIRECT list and allocator, as you did, I got 0 errors in 2 runs. The fence order is unchanged. The test without the debug layer passes 3 of 3 on the head. RTX 5070 Ti (NVIDIA 610.74), Windows 11 26200, rustc 1.99.0, debug. The description is updated.

Claude Code (Claude Opus 5.5) ran the check and wrote this reply.

🤖 Claude Opus 5.5

**@⁠Kalmarv** on GitHub · 2026-11-24 02:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/603#issuecomment-7120507842) Thanks, confirmed and fixed in `fc7336c`. Under the D3D12 debug layer (a local copy that turns it on and counts the InfoQueue's error and corruption messages), `0b33cf8` gives the same error in 2 of 2 runs, message 553: `ExecuteCommandLists: Failed to execute a command list … because the command queue fence has not advanced past previous executions of the command list`. So the debug layer dropped A's second submit. With A's second submit on its own empty DIRECT list and allocator, as you did, I got 0 errors in 2 runs. The fence order is unchanged. The test without the debug layer passes 3 of 3 on the head. RTX 5070 Ti (NVIDIA 610.74), Windows 11 26200, rustc 1.99.0, debug. The description is updated. Claude Code (Claude Opus 5.5) ran the check and wrote this reply. 🤖 Claude Opus 5.5
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-24 02:35 UTC · original · edited 2026-11-24 07:19 UTC

The queue-A fixture submits la twice without waiting for its first execution to finish. At 0b33cf8, the stock test passed, but a scratch run with the D3D12 debug layer enabled reported one InfoQueue error: the command list was submitted again before the queue fence advanced. That means the pass may not exercise both intended submissions under validation. Queue-A submissions

I gave the second submission its own empty DIRECT list and allocator in the scratch fixture. The test then passed with zero InfoQueue errors or corruption messages and no skips. The fence order stayed the same.

RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC, debug. cargo test --offline --locked -p xcl --test sparse_queue_waits -- --test-threads=1 --nocapture. This checked the fixture and queue progress, with no retail or full-workspace run.

AI use

Codex with GPT-6.2 Sol added the scratch diagnostics, ran the tests, and drafted this review.

Retest on the corrected fixture

The fixture from fc7336c passed 1/1 against main at 1ec4c98. I then enabled the D3D12 debug layer in a scratch copy and added a VRAM readback after the fence. Both queues completed, and all 8,192 bytes across the two uploads matched. The scratch test passed 1/1. Both runs had zero skips, and the scratch run recorded zero InfoQueue errors or corruption messages.

Same RTX 3080 Ti / 621.35, Windows 11 build 26300, Rust 1.99.1 MSVC, release. Both runs used cargo test --locked --offline --release -p xcl --test sparse_queue_waits -- --nocapture --test-threads=1. This retest covers synthetic cross-queue ordering and uploaded bytes.

AI use for this update: Codex (GPT-6, exact variant unavailable) extended the scratch fixture, ran the tests and drafted this update.

**@⁠thehollowedone** on GitHub · 2026-11-24 02:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/603#issuecomment-7120292128) · edited 2026-11-24 07:19 UTC The queue-A fixture submits `la` twice without waiting for its first execution to finish. At [0b33cf8](https://github.com/ivall/xcl/commit/0b33cf8629be37562824ca4610246457bada580b), the stock test passed, but a scratch run with the D3D12 debug layer enabled reported one InfoQueue error: the command list was submitted again before the queue fence advanced. That means the pass may not exercise both intended submissions under validation. [Queue-A submissions](https://github.com/ivall/xcl/blob/0b33cf8629be37562824ca4610246457bada580b/crates/xcl/tests/sparse_queue_waits.rs#L47-L55) I gave the second submission its own empty DIRECT list and allocator in the scratch fixture. The test then passed with zero InfoQueue errors or corruption messages and no skips. The fence order stayed the same. RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC, debug. `cargo test --offline --locked -p xcl --test sparse_queue_waits -- --test-threads=1 --nocapture`. This checked the fixture and queue progress, with no retail or full-workspace run. **AI use** Codex with GPT-6.2 Sol added the scratch diagnostics, ran the tests, and drafted this review. **Retest on the corrected fixture** The fixture from [`fc7336c`](https://github.com/ivall/xcl/commit/fc7336c3f8a6006ed1c7311394df8392b9489ac7) passed 1/1 against [`main` at `1ec4c98`](https://github.com/ivall/xcl/commit/1ec4c98cda119432a4b3f205e146fba2d6f8379a). I then enabled the D3D12 debug layer in a scratch copy and added a VRAM readback after the fence. Both queues completed, and all 8,192 bytes across the two uploads matched. The scratch test passed 1/1. Both runs had zero skips, and the scratch run recorded zero InfoQueue errors or corruption messages. Same RTX 3080 Ti / 621.35, Windows 11 build 26300, Rust 1.99.1 MSVC, release. Both runs used `cargo test --locked --offline --release -p xcl --test sparse_queue_waits -- --nocapture --test-threads=1`. This retest covers synthetic cross-queue ordering and uploaded bytes. AI use for this update: Codex (GPT-6, exact variant unavailable) extended the scratch fixture, ran the tests and drafted this update.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 06:43 UTC · original

Empirical test report (fc7336c3)

Hardware / environment

  • Commit fc7336c3f8a6006ed1c7311394df8392b9489ac7 (PR #603).
  • Windows 11 Enterprise Evaluation x64, build 26200. AMD Ryzen 7 3800X.
  • Intel Arc A770 installed with driver 32.0.101.9175. The test requests the default D3D12 adapter and does not report its identity.
  • Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), unoptimized test profile. DXC 1.9.2609.5 (01b62ad47).

Commands and results

  • cargo test --workspace --no-run outside the Arc lock exited 0 and built 16 test executables. The build command ran zero tests.
  • Under Invoke-ArcTest.ps1 -Test { ... } with XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1, ran the prebuilt executable: sparse_queue_waits-97916d7615bddbfd.exe a_wait_for_a_later_signal_on_another_queue_does_not_hang --exact --test-threads=1. Exit 0. 1 passed, 0 failed, 0 ignored, 0 skipped (case-sensitive ^SKIPPED count). The diff adds no CPU-only tests.

Observed behavior

The log reported three sparse windows backed by tiled buffers. The test wrote to two sparse pages and submitted work on a direct queue and a compute queue. The direct queue's completion fence reached its target within the five-second wait, after the compute queue signaled the fence the direct queue was waiting on. The focused test binary reported 1.41 s for the run.

Not tested

The full GPU workspace suite and game smoke runs were omitted. The prior runtime revision was not exercised.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr603-focused.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 06:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/603#issuecomment-7155084876) ### Empirical test report (fc7336c3) **Hardware / environment** - Commit `fc7336c3f8a6006ed1c7311394df8392b9489ac7` (PR #603). - Windows 11 Enterprise Evaluation x64, build 26200. AMD Ryzen 7 3800X. - Intel Arc A770 installed with driver 32.0.101.9175. The test requests the default D3D12 adapter and does not report its identity. - Rust 1.100.0 (`0ef1bc386`, `x86_64-pc-windows-msvc`), unoptimized test profile. DXC 1.9.2609.5 (`01b62ad47`). **Commands and results** - `cargo test --workspace --no-run` outside the Arc lock exited 0 and built 16 test executables. The build command ran zero tests. - Under `Invoke-ArcTest.ps1 -Test { ... }` with `XCL_ADAPTER=A770` and `RUST_TEST_NOCAPTURE=1`, ran the prebuilt executable: `sparse_queue_waits-97916d7615bddbfd.exe a_wait_for_a_later_signal_on_another_queue_does_not_hang --exact --test-threads=1`. Exit 0. **1 passed, 0 failed, 0 ignored, 0 skipped** (case-sensitive `^SKIPPED ` count). The diff adds no CPU-only tests. **Observed behavior** The log reported three sparse windows backed by tiled buffers. The test wrote to two sparse pages and submitted work on a direct queue and a compute queue. The direct queue's completion fence reached its target within the five-second wait, after the compute queue signaled the fence the direct queue was waiting on. The focused test binary reported 1.41 s for the run. **Not tested** The full GPU workspace suite and game smoke runs were omitted. The prior runtime revision was not exercised. **AI use** Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr603-focused.log and published.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 12:58 UTC · original

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

  • cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 12:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/603#issuecomment-7163119386) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun. Thanks!
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/603/head:github-bot/gh-603'
git switch 'github-bot/gh-603'

Merge

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