D3D12.X: refresh fence mirrors after queued rewinds #906

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

@⁠rison1337 on GitHub · 2026-11-24 08:00 UTC · original
rison1337:fix/fence-slot12-rewind → main · +98 −20 · 2 files · 1 commits · open

Fence slot 12 could keep returning 40 after a blocked queue lowered the native fence to 3. The completion event could fire before the queue reached that signal.

What is in it

  • Keep completion events and sample for missed changes after a 10 ms idle wait. A timer tick only stores a changed value.
  • Add a D3D12 regression test that holds the queue until the early refresh is visible.

Tested

  • Windows 11 build 26300, RTX 4060 driver 32.0.16.2101, Ryzen 5 7500F, Rust 1.100.0 MSVC. Local NTFS debug build, XCL release builds for smoke.
  • Focused test on f4ce27c with only the test applied reproduced native 3 and mirror 40. It passed on 29e21fb.
  • cargo test --locked --workspace --no-fail-fast --target x86_64-pc-windows-msvc -- --test-threads=4 --nocapture: 699 passed, 3 failed, 41 ignored, 4 reported skips (2 wave64, 2 D3D12 debug layers). The cubemap assertion matches #447. The other two failures followed from the poisoned mutex.
  • Serial full workspace retest: 702 passed, 0 failed, 41 ignored, 3 reported skips (2 wave64, 1 D3D12 debug layer). The reported skips are counted as passing by the Rust harness.

Regression run

xcl-smoke v1
commit: f4ce27ceb6d1b0576d0c659b713b674778bf1968
gpu: NVIDIA GeForce RTX 4060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 952 (PresentX 952)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 9319 MB
xcl-smoke v1
commit: 29e21fb0e299131bee0bb23d49ed2051c4a16e36
gpu: NVIDIA GeForce RTX 4060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1325 (PresentX 1325)
presents per 2 s (last 3): 61 60 62
device removals: 0
crashes: 0
peak commit: 9325 MB

Not tested

AMD and gameplay past startup.

AI use

Codex (gpt-6.2-sol) wrote the code and test and summarized the contributor's Windows runs.

**@⁠rison1337** on GitHub · 2026-11-24 08:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/906) `rison1337:fix/fence-slot12-rewind` → `main` · +98 −20 · 2 files · 1 commits · open Fence slot 12 could keep returning 40 after a blocked queue lowered the native fence to 3. The completion event could fire before the queue reached that signal. **What is in it** - Keep completion events and sample for missed changes after a 10 ms idle wait. A timer tick only stores a changed value. - Add a D3D12 regression test that holds the queue until the early refresh is visible. **Tested** - Windows 11 build 26300, RTX 4060 driver 32.0.16.2101, Ryzen 5 7500F, Rust 1.100.0 MSVC. Local NTFS debug build, XCL release builds for smoke. - Focused test on `f4ce27c` with only the test applied reproduced native 3 and mirror 40. It passed on `29e21fb`. - `cargo test --locked --workspace --no-fail-fast --target x86_64-pc-windows-msvc -- --test-threads=4 --nocapture`: 699 passed, 3 failed, 41 ignored, 4 reported skips (2 wave64, 2 D3D12 debug layers). The cubemap assertion matches [#447](https://github.com/ivall/xcl/pull/447). The other two failures followed from the poisoned mutex. - Serial full workspace retest: 702 passed, 0 failed, 41 ignored, 3 reported skips (2 wave64, 1 D3D12 debug layer). The reported skips are counted as passing by the Rust harness. **Regression run** ``` xcl-smoke v1 commit: f4ce27ceb6d1b0576d0c659b713b674778bf1968 gpu: NVIDIA GeForce RTX 4060 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 952 (PresentX 952) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 9319 MB ``` ``` xcl-smoke v1 commit: 29e21fb0e299131bee0bb23d49ed2051c4a16e36 gpu: NVIDIA GeForce RTX 4060 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1325 (PresentX 1325) presents per 2 s (last 3): 61 60 62 device removals: 0 crashes: 0 peak commit: 9325 MB ``` **Not tested** AMD and gameplay past startup. **AI use** Codex (gpt-6.2-sol) wrote the code and test and summarized the contributor's Windows runs.
A threshold completion event can fire while the GPU is still
waiting to signal the lower value. Keep the event path and also
sample the native fence after a 10 ms idle wait. Only write
changed values on timeout so the polling does not wake the title
while its fence is idle.

Exercise a rewind queued behind a blocked fence on a real D3D12
queue. Without the fix the native fence becomes 3 and its cell
stays at 40.

Assisted-by: Codex (gpt-6.2-sol)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:36:28 +00:00
Author
Owner

@⁠dcastell1 on GitHub · 2026-11-24 08:16 UTC · original

Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean main@beaa245 (713 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
714 passed; 0 failed; 41 ignored   (exit 0)

One more passing test than main: the fence-mirror refresh after queued rewinds is covered and runs green; nothing else changes verdict.

Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

**@⁠dcastell1** on GitHub · 2026-11-24 08:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/906#issuecomment-7125945214) Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean `main@beaa245` (713 passed, 0 failed, 41 ignored on this box): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 714 passed; 0 failed; 41 ignored (exit 0) ``` One more passing test than main: the fence-mirror refresh after queued rewinds is covered and runs green; nothing else changes verdict. Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
Author
Owner

@⁠Diskuss on GitHub · 2026-11-24 08:21 UTC · original · edited 2026-11-24 09:29 UTC

Tested on AMD Radeon RX 9070 XT (RDNA4) at 29e21fb0e299131bee0bb23d49ed2051c4a16e36

Ryzen 7 5700X3D, 32 GB RAM, Windows 11 Pro build 26300.9974, GPU driver 32.0.32015.7029, Rust 1.100.0 (x86_64-pc-windows-msvc), DXC 1.9.2602.17, debug build.

Tested:

  • cargo build --workspace: succeeded.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: summed over all test result: lines, 702 passed, 0 failed, 41 ignored.
  • the_cell_follows_a_delayed_queue_rewind: passed in the full suite. Run on its own 5 times with cargo test -p xcl --lib the_cell_follows_a_delayed_queue_rewind -- --test-threads=1, it gave "1 passed" every time (5/5, about 0.1 s each).
  • SKIPPED lines: 0. Device removal: none seen in the log.
  • Comparison with main (1ec4c98): main gave 715 passed, 0 failed, 41 ignored; this PR gives 702 passed, 0 failed, 41 ignored. The 13 fewer passed tests are expected: the PR branch is 21 commits behind main, so it has fewer tests.
  • Until now this PR was tested only on an RTX 4060, so this run covers an AMD driver.

Not tested: retail title / scripts/smoke.ps1 (no game files), release build.

Report written by Claude Code (Claude Sonnet 5.5) from a real run on this machine.

Correction (hidden skips): "0 SKIPPED" above means no SKIPPED line appeared in the normal run. A later -- --nocapture run on this machine shows that two tests skip silently, because the D3D12 debug layer is not installed (no Graphics Tools / d3d12SDKLayers.dll). libtest captures their output, so they show as ok: e2e::test_title_draws_with_a_root_signature_under_the_debug_layer and texture_states::uploads_start_from_each_subresources_state. Neither is related to this change, and all other GPU tests ran on the RX 9070 XT.

**@⁠Diskuss** on GitHub · 2026-11-24 08:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/906#issuecomment-7126045781) · edited 2026-11-24 09:29 UTC **Tested on AMD Radeon RX 9070 XT (RDNA4) at `29e21fb0e299131bee0bb23d49ed2051c4a16e36`** Ryzen 7 5700X3D, 32 GB RAM, Windows 11 Pro build 26300.9974, GPU driver 32.0.32015.7029, Rust 1.100.0 (x86_64-pc-windows-msvc), DXC 1.9.2602.17, debug build. **Tested**: - `cargo build --workspace`: succeeded. - `cargo test --workspace --no-fail-fast -- --test-threads=4`: summed over all `test result:` lines, 702 passed, 0 failed, 41 ignored. - `the_cell_follows_a_delayed_queue_rewind`: passed in the full suite. Run on its own 5 times with `cargo test -p xcl --lib the_cell_follows_a_delayed_queue_rewind -- --test-threads=1`, it gave "1 passed" every time (5/5, about 0.1 s each). - SKIPPED lines: 0. Device removal: none seen in the log. - Comparison with main (1ec4c98): main gave 715 passed, 0 failed, 41 ignored; this PR gives 702 passed, 0 failed, 41 ignored. The 13 fewer passed tests are expected: the PR branch is 21 commits behind main, so it has fewer tests. - Until now this PR was tested only on an RTX 4060, so this run covers an AMD driver. **Not tested**: retail title / `scripts/smoke.ps1` (no game files), release build. Report written by Claude Code (Claude Sonnet 5.5) from a real run on this machine. **Correction (hidden skips):** "0 SKIPPED" above means no `SKIPPED` line appeared in the normal run. A later `-- --nocapture` run on this machine shows that two tests skip silently, because the D3D12 debug layer is not installed (no Graphics Tools / `d3d12SDKLayers.dll`). libtest captures their output, so they show as `ok`: `e2e::test_title_draws_with_a_root_signature_under_the_debug_layer` and `texture_states::uploads_start_from_each_subresources_state`. Neither is related to this change, and all other GPU tests ran on the RX 9070 XT.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 09:34 UTC · original

Linux / AMD RDNA3 datapoint.

Merged state: head 29e21fb onto main 09940bb, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 706 passed, 11 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). post-rewind fence-mirror refresh green; mirror-upload flake hit in this lane.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-24 09:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/906#issuecomment-7127603944) Linux / AMD RDNA3 datapoint. **Merged state:** head `29e21fb` onto main `09940bb`, clean merge. **Full suite, `cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4`:** **706 passed, 11 failed, 41 ignored**; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). post-rewind fence-mirror refresh green; mirror-upload flake hit in this lane. **Not tested:** retail titles (none here), Windows, RDNA4. Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. My Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 09:31 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 09:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/906#issuecomment-7158438656) 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

@⁠xpatfussy69x on GitHub · 2026-11-25 11:42 UTC · original

Test report for head 29e21fb as pushed (not merged onto current main) – NVIDIA, wave32.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.2124; AMD Ryzen 5 7500F; 32 GB RAM; Windows NT 10.0.26300; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.2609.5
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 702 passed, 0 failed, 41 ignored
  • SKIPPED GPU tests on this adapter: 2 (no wave64)
  • this PR's tests: the_cell_follows_a_delayed_queue_rewind ran and passed
  • no XCL_SAMPLE_* data set (game-data tests not run)

Not tested

  • a smoke run on a title; AMD / native wave64; release build; the head merged onto current main

AI use

  • Claude (Claude Opus 5.5) wrote the script that ran the suite on my PC, read the log and wrote and posted this report with my approval; the run is mine.
**@⁠xpatfussy69x** on GitHub · 2026-11-25 11:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/906#issuecomment-7161401677) Test report for head `29e21fb` as pushed (not merged onto current `main`) – NVIDIA, wave32. **Tested** - NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.2124; AMD Ryzen 5 7500F; 32 GB RAM; Windows NT 10.0.26300; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.2609.5 - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`): 702 passed, 0 failed, 41 ignored - SKIPPED GPU tests on this adapter: 2 (no wave64) - this PR's tests: `the_cell_follows_a_delayed_queue_rewind` ran and passed - no `XCL_SAMPLE_*` data set (game-data tests not run) **Not tested** - a smoke run on a title; AMD / native wave64; release build; the head merged onto current `main` **AI use** - Claude (Claude Opus 5.5) wrote the script that ran the suite on my PC, read the log and wrote and posted this report with my approval; the run is mine.
Author
Owner

@⁠4usphs on GitHub · 2026-11-25 11:52 UTC · original

AMD run on the exact head 29e21fb (29e21fb0e2), as pushed on its base f4ce27c (not merged onto current main), on two AMD adapters with native 64-lane waves: RDNA4 and the console's generation, RDNA2.

Tested

  • Ryzen 7 9800X3D, Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug, clean checkout, XCL_TRANSLATED_CACHE=0; adapter picked with XCL_ADAPTER.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4:
    • AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32029.2010: 702 passed, 0 failed, 41 ignored
    • AMD Radeon(TM) Graphics, the 9800X3D's iGPU (RDNA2, gfx1036), driver 32.0.21045.29003: 699 passed, 3 failed, 41 ignored
  • No SKIPPED tests on either adapter.
  • This PR's test the_cell_follows_a_delayed_queue_rewind runs and passes on both adapters.
  • The 3 iGPU failures in the first run were the title-texture group (placed_title_textures_share_vram_and_preserve_pixels at its cubemap reuse check, transitions_apply_when_their_list_is_submitted, d32s8_targets_take_their_own_size_of_video_memory): the intermittent failure of #718, which takes the other two with it (#673). They pass on their own on this head, and a second cargo test -p xcl --lib -- --test-threads=4 on this head passed on both adapters (661 passed, 0 failed, 21 ignored).

Not tested

  • smoke or a retail title (I have none), a release build, Linux.

AI use

  • Claude Code (Claude Opus 5.5) read the diff, ran the tests and the base-commit controls on my PC and wrote this report. I have not reviewed the code.
**@⁠4usphs** on GitHub · 2026-11-25 11:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/906#issuecomment-7161619501) AMD run on the exact head `29e21fb` (29e21fb0e299131bee0bb23d49ed2051c4a16e36), as pushed on its base `f4ce27c` (not merged onto current `main`), on two AMD adapters with native 64-lane waves: RDNA4 and the console's generation, RDNA2. **Tested** - Ryzen 7 9800X3D, Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug, clean checkout, `XCL_TRANSLATED_CACHE=0`; adapter picked with `XCL_ADAPTER`. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`: - AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32029.2010: **702 passed, 0 failed, 41 ignored** - AMD Radeon(TM) Graphics, the 9800X3D's iGPU (RDNA2, `gfx1036`), driver 32.0.21045.29003: **699 passed, 3 failed, 41 ignored** - No `SKIPPED` tests on either adapter. - This PR's test `the_cell_follows_a_delayed_queue_rewind` runs and passes on both adapters. - The 3 iGPU failures in the first run were the title-texture group (`placed_title_textures_share_vram_and_preserve_pixels` at its cubemap reuse check, `transitions_apply_when_their_list_is_submitted`, `d32s8_targets_take_their_own_size_of_video_memory`): the intermittent failure of #718, which takes the other two with it (#673). They pass on their own on this head, and a second `cargo test -p xcl --lib -- --test-threads=4` on this head passed on both adapters (661 passed, 0 failed, 21 ignored). **Not tested** - smoke or a retail title (I have none), a release build, Linux. **AI use** - Claude Code (Claude Opus 5.5) read the diff, ran the tests and the base-commit controls on my PC and wrote this report. I have not reviewed the code.
Author
Owner

@⁠ClosetPie107 on GitHub · 2026-11-25 12:19 UTC · original

Linux / AMD RDNA4 (RADV) test report for head 29e21fb merged locally onto main 1a0bbe3 (clean merge).

Environment

  • AMD Radeon RX 9070 16 GB (RDNA4, RADV GFX1201, Mesa 26.3.1, native wave64), Ryzen 5 9600X, 30 GiB RAM, CachyOS
  • Proton Experimental (experimental-11.0-20261112), vkd3d-proton v3.1 (#257 + dxil-spirv 53aac418), DXVK v3.1.1-209, DXC 1.9.2609.5, x86_64-pc-windows-gnu cross-compile

Tested (debug test binary under Wine, XCL_ADAPTER=9070 XCL_REQUIRE_GPU=wave64, --test-threads=1 --nocapture)

  • hle::d3d12x::fence_x: 2 passed, 0 failed, 0 ignored, 0 skipped (0.10 s), including the_cell_follows_a_delayed_queue_rewind and the_cell_follows_the_fence on RX 9070 / RADV.

Not tested: full workspace suite, retail title run, native Windows.

AI use: T3 Code / Antigravity (Gemini 4 Neon) merged, built, ran the tests on this machine, and drafted this report.

**@⁠ClosetPie107** on GitHub · 2026-11-25 12:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/906#issuecomment-7162221507) Linux / AMD RDNA4 (RADV) test report for head `29e21fb` merged locally onto `main` `1a0bbe3` (clean merge). **Environment** - AMD Radeon RX 9070 16 GB (RDNA4, RADV GFX1201, Mesa 26.3.1, native wave64), Ryzen 5 9600X, 30 GiB RAM, CachyOS - Proton Experimental (`experimental-11.0-20261112`), vkd3d-proton v3.1 (`#257` + `dxil-spirv` `53aac418`), DXVK `v3.1.1-209`, DXC `1.9.2609.5`, `x86_64-pc-windows-gnu` cross-compile **Tested** (debug test binary under Wine, `XCL_ADAPTER=9070 XCL_REQUIRE_GPU=wave64`, `--test-threads=1 --nocapture`) - `hle::d3d12x::fence_x`: **2 passed, 0 failed, 0 ignored, 0 skipped** (0.10 s), including `the_cell_follows_a_delayed_queue_rewind` and `the_cell_follows_the_fence` on RX 9070 / RADV. **Not tested:** full workspace suite, retail title run, native Windows. **AI use:** T3 Code / Antigravity (Gemini 4 Neon) merged, built, ran the tests on this machine, and drafted this report.
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/906/head:github-bot/gh-906'
git switch 'github-bot/gh-906'

Merge

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