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

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

@⁠nicolasabosch on GitHub · 2026-11-25 02:02 UTC · original
nicolasabosch:d3d12x/false-gpu-cycle → main · +68 −1 · 1 files · 1 commits · draft

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

**@⁠nicolasabosch** on GitHub · 2026-11-25 02:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/2052) `nicolasabosch:d3d12x/false-gpu-cycle` → `main` · +68 −1 · 1 files · 1 commits · draft `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)
`would_signal_close_cycle` took every armed wait on the target cell with
`val <= sig_val` as waiting on the new signal. A wait that an earlier
signal of the cell already satisfies (submitted on the GPU or released on
the CPU) does not depend on it. 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, signalled on
the CPU and its waiters released before the GPU work they wait for ran.

A retail title on an RTX 4070 Laptop broke 14-32 such "cycles" in each
run's world load (traced: queue 1 waiting on 0x...fde0 >= 0x6db, covered
by queue 2's earlier 0x6db signal, counted against queue 2's 0x6dc
signal). With the fix: no cycle break in two runs of the same load.

The waiters taken now are those no earlier signal covers
(`val > max(submitted_max, cpu_signaled_max)`); a test reproduces the
traced case and keeps the true cycle detected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:16:48 +00:00
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 02:13 UTC · original

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).
**@⁠raylitebull** on GitHub · 2026-11-25 02:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/2052#issuecomment-7150471443) 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).
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 04:41 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 04:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/2052#issuecomment-7153081099) 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!
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/2052/head:github-bot/gh-2052'
git switch 'github-bot/gh-2052'

Merge

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