D3D12.X: a wait an earlier signal covers does not make a signal a cycle #2042

Closed
nicolasabosch wants to merge 1 commit from upstream-pr/2052 into main
nicolasabosch commented 2026-11-25 02:02:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by nicolasabosch on 2026-11-25T02:02:39Z.


would_signal_close_cycle took every armed wait on the target cell with val <= sig_val as one that waits on the new Write64 signal. A wait that an earlier signal of the same cell already satisfies (submitted on the GPU, or released on the CPU) does not depend on the new one. With pipelined frames (queue A waits on cell X >= N; queue B then signals X = N + 1 after waiting on something A signals later), every such frame was reported as a cycle. The signal then went out on the CPU, and its waiters were released before the GPU work they wait for had run.

Found while working on #1269 (a retail title on an RTX 4070 Laptop). A local trace of the world load showed queue 1 waiting on a cell >= 0x6db, a wait already covered by queue 2's earlier 0x6db signal. That wait was counted against queue 2's 0x6dc signal, and the "cycle" was broken on the CPU. Each run of that load broke 14–32 such cycles.

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: the target waiters are only the armed waits no earlier signal covers (val > max(submitted_max, cpu_signaled_max)).
  • Same file, test pipelined_next_frame_write_is_not_false_cycle: case 3 reproduces the traced case (no cycle), then turns the wait into one that only the new signal satisfies (a true cycle, still detected). Without the fix, the new no-cycle assertion fails.

Tested

  • NVIDIA GeForce RTX 4070 Laptop GPU (driver 32.0.16.2124), Intel Core i9-14900HX, Windows 11 build 26300, rustc 1.100.0; debug for the suite, release for the smoke runs.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4 on b67c8f0: 1120 passed, 0 failed, 46 ignored. SKIPPED: 20 × no wave64, 3 × refused (#1426 semantics), 1 × no heap windows.
  • The new assertion fails with the fix reverted (checked on an earlier base with the same code).
  • Retail title (#1269): in two world-load runs of a local build with this fix, there were no cycle breaks. The same load broke 14–32 per run without it. That local build also carries other experiments (read-select windows, a per-frame pipeline wait cap, and the same rule for title ID3D12Fence waits in break_cycles_before_title_signal, which is not in this PR). The title still loses the device later in that load, so this fix alone does not get it further.

Regression run

main:

xcl-smoke v1
commit: 00cf2589f26b0e357852ec943da36f0bbe540ff9
gpu: NVIDIA GeForce RTX 4070 Laptop GPU
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1488 (PresentX 1489)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16515 MB

PR:

xcl-smoke v1
commit: b67c8f0cb5a68434c1a511c848fb53164f44f0bc
gpu: NVIDIA GeForce RTX 4070 Laptop GPU
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1622 (PresentX 1622)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15915 MB

Not tested

  • AMD and Intel GPUs.
  • The 60 s smoke runs stay in the title's menus and do not reach the multi-queue world load where the false cycles happened. That load was only checked with the local build described above.
  • Title ID3D12Fence waits (break_cycles_before_title_signal) have the same pattern. They are left for a separate PR with a test of their own.

AI use

  • Claude Code with Claude Opus 5.5: traced the cycle breaks in the title's log, wrote the fix, the test, the commit message and this description, and ran the tests and smoke runs above.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5483695509 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2052). Originally posted by [nicolasabosch](https://github.com/nicolasabosch) on 2026-11-25T02:02:39Z. --- `would_signal_close_cycle` took every armed wait on the target cell with `val <= sig_val` as one that waits on the new `Write64` signal. A wait that an earlier signal of the same cell already satisfies (submitted on the GPU, or released on the CPU) does not depend on the new one. With pipelined frames (queue A waits on cell X >= N; queue B then signals X = N + 1 after waiting on something A signals later), every such frame was reported as a cycle. The signal then went out on the CPU, and its waiters were released before the GPU work they wait for had run. Found while working on #1269 (a retail title on an RTX 4070 Laptop). A local trace of the world load showed queue 1 waiting on a cell `>= 0x6db`, a wait already covered by queue 2's earlier `0x6db` signal. That wait was counted against queue 2's `0x6dc` signal, and the "cycle" was broken on the CPU. Each run of that load broke 14–32 such cycles. **What is in it** - `crates/xcl/src/hle/d3d12x/list_x.rs`: the target waiters are only the armed waits no earlier signal covers (`val > max(submitted_max, cpu_signaled_max)`). - Same file, test `pipelined_next_frame_write_is_not_false_cycle`: case 3 reproduces the traced case (no cycle), then turns the wait into one that only the new signal satisfies (a true cycle, still detected). Without the fix, the new no-cycle assertion fails. **Tested** - NVIDIA GeForce RTX 4070 Laptop GPU (driver 32.0.16.2124), Intel Core i9-14900HX, Windows 11 build 26300, rustc 1.100.0; debug for the suite, release for the smoke runs. - `cargo build --workspace && cargo test --workspace -- --test-threads=4` on b67c8f0: 1120 passed, 0 failed, 46 ignored. SKIPPED: 20 × no wave64, 3 × refused (#1426 semantics), 1 × no heap windows. - The new assertion fails with the fix reverted (checked on an earlier base with the same code). - Retail title (#1269): in two world-load runs of a local build with this fix, there were no cycle breaks. The same load broke 14–32 per run without it. That local build also carries other experiments (read-select windows, a per-frame pipeline wait cap, and the same rule for title `ID3D12Fence` waits in `break_cycles_before_title_signal`, which is not in this PR). The title still loses the device later in that load, so this fix alone does not get it further. **Regression run** main: ``` xcl-smoke v1 commit: 00cf2589f26b0e357852ec943da36f0bbe540ff9 gpu: NVIDIA GeForce RTX 4070 Laptop GPU title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1488 (PresentX 1489) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16515 MB ``` PR: ``` xcl-smoke v1 commit: b67c8f0cb5a68434c1a511c848fb53164f44f0bc gpu: NVIDIA GeForce RTX 4070 Laptop GPU title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1622 (PresentX 1622) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15915 MB ``` **Not tested** - AMD and Intel GPUs. - The 60 s smoke runs stay in the title's menus and do not reach the multi-queue world load where the false cycles happened. That load was only checked with the local build described above. - Title `ID3D12Fence` waits (`break_cycles_before_title_signal`) have the same pattern. They are left for a separate PR with a test of their own. **AI use** - Claude Code with Claude Opus 5.5: traced the cycle breaks in the title's log, wrote the fix, the test, the commit message and this description, and ran the tests and smoke runs above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
raylitebull commented 2026-11-25 03:05:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T02:13:57Z.


Code review on b67c8f0:

  • Filtering armed_waits in would_signal_close_cycle (crates/xcl/src/hle/d3d12x/list_x.rs) with aw.val > target.submitted_max.max(target.cpu_signaled_max) cleanly stops pipelined next-frame signals from looking like cycles when an earlier GPU or CPU signal already covers the armed wait value.
  • Both new cases in the sync-graph test pin the covered next-frame signal vs true cycle boundary cleanly.
  • Diff audited and CI workflow approved (PR description is green; awaiting Build and test + dual-vendor verification + marking ready for review).
<!-- greyfinch-sync:ivall/xcl:comment:7150471443 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2052#issuecomment-7150471443). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T02:13:57Z. --- Code review on `b67c8f0`: - Filtering `armed_waits` in `would_signal_close_cycle` (`crates/xcl/src/hle/d3d12x/list_x.rs`) with `aw.val > target.submitted_max.max(target.cpu_signaled_max)` cleanly stops pipelined next-frame signals from looking like cycles when an earlier GPU or CPU signal already covers the armed wait value. - Both new cases in the sync-graph test pin the covered next-frame signal vs true cycle boundary cleanly. - Diff audited and `CI` workflow approved (`PR description` is green; awaiting `Build and test` + dual-vendor verification + marking ready for review).
DavidM1911 commented 2026-11-25 05:08:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T04:41:49Z.


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:7153081099 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2052#issuecomment-7153081099). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T04:41:49Z. --- 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!
throny commented 2026-11-30 20:10:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-30T20:10:22Z.


Closing: this change is already on main as commit 4cdb71f1 (brought in by d4a31c1e Merge main (cbc296a) into the NVIDIA world integration). This PR's diff applies in reverse cleanly on current main (ff0c364b), so merging it would change nothing. If something here is not on main, say so and reopen it, or ask and I will.

AI use: Claude Code (Claude Opus 5.5) checked this; part of the duplicate sweep on #3041.

<!-- greyfinch-sync:ivall/xcl:comment:7290515951 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2052#issuecomment-7290515951). Originally posted by [throny](https://github.com/throny) on 2026-11-30T20:10:22Z. --- Closing: this change is already on `main` as commit 4cdb71f1 (brought in by d4a31c1e Merge main (cbc296a) into the NVIDIA world integration). This PR's diff applies in reverse cleanly on current `main` (`ff0c364b`), so merging it would change nothing. If something here is not on `main`, say so and reopen it, or ask and I will. AI use: Claude Code (Claude Opus 5.5) checked this; part of the duplicate sweep on #3041.

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