D3D12.X: XCL_DRED=1 starts a recording at KickoffX's Reset (#2462) #2500

Open
oni-swr wants to merge 1 commit from upstream-pr/2510 into main
oni-swr commented 2026-11-25 21:09:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T21:09:37Z.


With XCL_DRED=1, KickoffX never started a new DRED recording. list_x::kickoff_x closes and submits a console list and resets it on the same allocator, calling the native Reset directly. That bypasses real::cl_reset, which calls dred::reset. So every SetPipelineState after a KickoffX was appended to the previous recording: it grew without bound (the 4-recording limit never ran), and a fault was matched to markers older than the pipeline KickoffX bound.

The Reset half of kickoff_x moves into restart_after_kickoff (no change in behaviour) so a test can reach it without a queue. It now calls dred::reset and marks the initial pipeline after a successful native Reset, as cl_reset does. A failed Reset starts no recording.

reset_pc (Reset #10/#139, and the stand-in list of a Reset while the last submit runs) already does this on main, so it is not changed here.

Fixes #2462

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: restart_after_kickoff (the Reset tail of kickoff_x moved out, plus dred::reset and dred::mark_pipeline after a successful native Reset).
  • crates/xcl/src/hle/d3d12x/dred.rs: test-only ON_FOR_TEST thread-local (DRED on for one test's thread only) and recordings_for_test.
  • list_x.rs test xcl_dred_starts_a_recording_with_the_initial_pipeline_at_each_kickoff: a fake PC list goes through 10 kickoffs, each with its own labelled initial pipeline. It checks one recording per kickoff holding exactly that pipeline, the last 4 kept oldest first, one marker per kickoff reaching the list, and that a failed native Reset (settle called with false, Err returned) starts no recording.
  • list_x.rs test xcl_dred_starts_a_recording_with_the_initial_pipeline_at_each_reset (guards the reset_x path that main already has): its marker counter is now per thread, so it does not race with the new test.

Tested

  • Windows 11 build 26200, RX 7800 XT machine, debug, XCL_ADAPTER=NONE_CPU_ONLY; no GPU test and no title was run for this head.
  • cargo test -p xcl --lib -j 4 -- --test-threads=4 hle::d3d12x::dred:: xcl_dred list_x::tests::reset on head a81c5d8c: 7 passed, 0 failed, 0 ignored (2480 filtered out).
  • Without the dred::reset / mark_pipeline calls in restart_after_kickoff the new test fails at kickoff 0 (0 recordings, expected 1); the reset_x test still passes.
  • cargo test -p xcl --lib hle::d3d12x -- --test-threads=4 on the parent of this rebase (before it moved onto the newest main): 1139 passed, 0 failed, 3 ignored; SKIPPED: two_pass_binds_set_the_shared_view_heap (no heap windows).
  • cargo test --workspace did NOT complete: it was stopped to free the GPU. Its xcl lib run aborted with a device removal (0x887a0006) in the GPU tests; gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 failed. I did not check whether that also happens on main. The integration test targets that ran before the stop passed.

Regression run

  • scripts/smoke.ps1 -Game <title folder> -Seconds 60, release builds, same title (menu only, no world load), RX 7800 XT (driver 32.0.31035.1003), one run after the other with XCL_PREPARE=0, XCL_NETWORK=0, a fresh isolated copy of the shader cache and of the title's user data per run, and XCL_DRED not set. main is 227d2cb3, this PR's head is a81c5d8c (clean tree). The PR's run had 1577 frames, 99 % of main's 1597, with no device removal and no crash; its peak commit was 14560 MB against 14581 MB (100 %).

main:

xcl-smoke v1
commit: 227d2cb388f103268dac7635ea720eb3e5352d4e
gpu: AMD Radeon RX 7800 XT
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1597 (PresentX 1597)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 14581 MB

This PR's head:

xcl-smoke v1
commit: a81c5d8c63093204172fce7698eddd4627130c07
gpu: AMD Radeon RX 7800 XT
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1577 (PresentX 1577)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14560 MB

Not tested

  • The whole suite on a GPU (the workspace run was stopped, see Tested).
  • The smoke runs above have XCL_DRED off, so they show only that the PR breaks nothing with DRED off; they do not exercise the changed code (the kickoff_x test does, on a fake list). No title run with XCL_DRED=1; no world load; no real device fault matched end to end.
  • kickoff_x itself with a live queue: the test reaches the Reset tail through restart_after_kickoff, not the submit before it.
  • NVIDIA / Intel.

AI use

  • Claude Code, Claude Sonnet 5.5: rebased the PR onto main, moved the Reset tail of kickoff_x into a helper, wrote the new test, ran the tests and the paired smoke runs above and rewrote this description. The original fix was written with Claude Code (Claude Opus 5.5).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5499222769 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2510). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T21:09:37Z. --- With `XCL_DRED=1`, `KickoffX` never started a new DRED recording. `list_x::kickoff_x` closes and submits a console list and resets it on the same allocator, calling the native Reset directly. That bypasses `real::cl_reset`, which calls `dred::reset`. So every `SetPipelineState` after a `KickoffX` was appended to the previous recording: it grew without bound (the 4-recording limit never ran), and a fault was matched to markers older than the pipeline `KickoffX` bound. The Reset half of `kickoff_x` moves into `restart_after_kickoff` (no change in behaviour) so a test can reach it without a queue. It now calls `dred::reset` and marks the initial pipeline after a successful native Reset, as `cl_reset` does. A failed Reset starts no recording. `reset_pc` (Reset #10/#139, and the stand-in list of a Reset while the last submit runs) already does this on `main`, so it is not changed here. Fixes #2462 **What is in it** - `crates/xcl/src/hle/d3d12x/list_x.rs`: `restart_after_kickoff` (the Reset tail of `kickoff_x` moved out, plus `dred::reset` and `dred::mark_pipeline` after a successful native Reset). - `crates/xcl/src/hle/d3d12x/dred.rs`: test-only `ON_FOR_TEST` thread-local (DRED on for one test's thread only) and `recordings_for_test`. - `list_x.rs` test `xcl_dred_starts_a_recording_with_the_initial_pipeline_at_each_kickoff`: a fake PC list goes through 10 kickoffs, each with its own labelled initial pipeline. It checks one recording per kickoff holding exactly that pipeline, the last 4 kept oldest first, one marker per kickoff reaching the list, and that a failed native Reset (settle called with `false`, `Err` returned) starts no recording. - `list_x.rs` test `xcl_dred_starts_a_recording_with_the_initial_pipeline_at_each_reset` (guards the `reset_x` path that `main` already has): its marker counter is now per thread, so it does not race with the new test. **Tested** - Windows 11 build 26200, RX 7800 XT machine, debug, `XCL_ADAPTER=NONE_CPU_ONLY`; no GPU test and no title was run for this head. - `cargo test -p xcl --lib -j 4 -- --test-threads=4 hle::d3d12x::dred:: xcl_dred list_x::tests::reset` on head `a81c5d8c`: 7 passed, 0 failed, 0 ignored (2480 filtered out). - Without the `dred::reset` / `mark_pipeline` calls in `restart_after_kickoff` the new test fails at kickoff 0 (0 recordings, expected 1); the `reset_x` test still passes. - `cargo test -p xcl --lib hle::d3d12x -- --test-threads=4` on the parent of this rebase (before it moved onto the newest `main`): 1139 passed, 0 failed, 3 ignored; SKIPPED: `two_pass_binds_set_the_shared_view_heap` (no heap windows). - `cargo test --workspace` did NOT complete: it was stopped to free the GPU. Its `xcl` lib run aborted with a device removal (0x887a0006) in the GPU tests; `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` failed. I did not check whether that also happens on `main`. The integration test targets that ran before the stop passed. **Regression run** - `scripts/smoke.ps1 -Game <title folder> -Seconds 60`, release builds, same title (menu only, no world load), RX 7800 XT (driver 32.0.31035.1003), one run after the other with `XCL_PREPARE=0`, `XCL_NETWORK=0`, a fresh isolated copy of the shader cache and of the title's user data per run, and `XCL_DRED` not set. `main` is `227d2cb3`, this PR's head is `a81c5d8c` (clean tree). The PR's run had 1577 frames, 99 % of `main`'s 1597, with no device removal and no crash; its peak commit was 14560 MB against 14581 MB (100 %). `main`: ``` xcl-smoke v1 commit: 227d2cb388f103268dac7635ea720eb3e5352d4e gpu: AMD Radeon RX 7800 XT title: 2c508222 seconds: 60 exit: 0x0 frames shown: 1597 (PresentX 1597) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 14581 MB ``` This PR's head: ``` xcl-smoke v1 commit: a81c5d8c63093204172fce7698eddd4627130c07 gpu: AMD Radeon RX 7800 XT title: 2c508222 seconds: 60 exit: 0x0 frames shown: 1577 (PresentX 1577) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14560 MB ``` **Not tested** - The whole suite on a GPU (the workspace run was stopped, see Tested). - The smoke runs above have `XCL_DRED` off, so they show only that the PR breaks nothing with DRED off; they do not exercise the changed code (the `kickoff_x` test does, on a fake list). No title run with `XCL_DRED=1`; no world load; no real device fault matched end to end. - `kickoff_x` itself with a live queue: the test reaches the Reset tail through `restart_after_kickoff`, not the submit before it. - NVIDIA / Intel. **AI use** - Claude Code, Claude Sonnet 5.5: rebased the PR onto `main`, moved the Reset tail of `kickoff_x` into a helper, wrote the new test, ran the tests and the paired smoke runs above and rewrote this description. The original fix was written with Claude Code (Claude Opus 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
SlopTart commented 2026-11-25 22:06:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T21:21:54Z.


First cold-cache gpu_ suite run: 163 passed / 4 failed, the trio plus gpu_geometry_wave32_prefix_count_over_a_mask. Second run, same head: 164 passed / 3 failed (baseline trio only). Solo runs of the wave32 test, twice: passed both. Known flaky family on this lane, unrelated to DRED recording; logging it so it is not attributed to this PR.
Targeted run of xcl_dred_starts_a_recording_with_the_initial_pipeline_at_each_reset: passed.

<!-- greyfinch-sync:ivall/xcl:comment:7174977714 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2510#issuecomment-7174977714). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-25T21:21:54Z. --- First cold-cache `gpu_` suite run: `163 passed / 4 failed`, the trio plus `gpu_geometry_wave32_prefix_count_over_a_mask`. Second run, same head: `164 passed / 3 failed` (baseline trio only). Solo runs of the wave32 test, twice: passed both. Known flaky family on this lane, unrelated to DRED recording; logging it so it is not attributed to this PR. Targeted run of `xcl_dred_starts_a_recording_with_the_initial_pipeline_at_each_reset`: passed.
DavidM1911 commented 2026-11-25 22:06:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T21:24:02Z.


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:7175025271 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2510#issuecomment-7175025271). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T21:24:02Z. --- 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!
oni-swr commented 2026-11-28 07:15:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-28T07:15:30Z.


Rebased onto current main (e429936c); new head b1487ab2.

main now starts a DRED recording in reset_pc and in the mid-list split (db4dd270, list_x.rs), so I dropped that half of this PR. What is left is kickoff_x, which still resets the list without dred::reset / mark_pipeline. The test (xcl_dred_starts_a_recording_with_the_initial_pipeline_at_each_reset) drives reset_x, so it now passes on main too and does not cover the kickoff_x change; I have not added a kickoff_x test.

Tested (CPU/WARP only, XCL_WARP=1, no retail title, no smoke run): cargo test -p xcl --lib -j 4 dred: 6 passed, 0 failed, 0 ignored. Full suite and regression run not repeated.

AI use: Claude Code, Claude Sonnet 5.5 (rebase, dropping the duplicate, targeted tests).

<!-- greyfinch-sync:ivall/xcl:comment:7235818146 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2510#issuecomment-7235818146). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-28T07:15:30Z. --- Rebased onto current `main` (e429936c); new head b1487ab2. `main` now starts a DRED recording in `reset_pc` and in the mid-list split (db4dd270, `list_x.rs`), so I dropped that half of this PR. What is left is `kickoff_x`, which still resets the list without `dred::reset` / `mark_pipeline`. The test (`xcl_dred_starts_a_recording_with_the_initial_pipeline_at_each_reset`) drives `reset_x`, so it now passes on `main` too and does not cover the `kickoff_x` change; I have not added a `kickoff_x` test. **Tested (CPU/WARP only, `XCL_WARP=1`, no retail title, no smoke run):** `cargo test -p xcl --lib -j 4 dred`: 6 passed, 0 failed, 0 ignored. Full suite and regression run not repeated. **AI use:** Claude Code, Claude Sonnet 5.5 (rebase, dropping the duplicate, targeted tests).
oni-swr commented 2026-11-28 23:23:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-28T23:23:21Z.


Rebased onto main 227d2cb3 and pushed a81c5d8c. Only kickoff_x is left (reset_pc is on main); added a test for it (xcl_dred_starts_a_recording_with_the_initial_pipeline_at_each_kickoff, via a new restart_after_kickoff helper). CPU-only: cargo test -p xcl --lib -j 4 -- --test-threads=4 hle::d3d12x::dred:: xcl_dred list_x::tests::reset -> 7 passed, 0 failed, 0 ignored; the new test fails without the dred::reset calls. The full workspace suite and the smoke blocks are not run for this head (still needed). Claude Code, Claude Sonnet 5.5.

<!-- greyfinch-sync:ivall/xcl:comment:7247397532 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2510#issuecomment-7247397532). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-28T23:23:21Z. --- Rebased onto `main` 227d2cb3 and pushed `a81c5d8c`. Only `kickoff_x` is left (`reset_pc` is on `main`); added a test for it (`xcl_dred_starts_a_recording_with_the_initial_pipeline_at_each_kickoff`, via a new `restart_after_kickoff` helper). CPU-only: `cargo test -p xcl --lib -j 4 -- --test-threads=4 hle::d3d12x::dred:: xcl_dred list_x::tests::reset` -> 7 passed, 0 failed, 0 ignored; the new test fails without the `dred::reset` calls. The full workspace suite and the smoke blocks are not run for this head (still needed). Claude Code, Claude Sonnet 5.5.
Foniass commented 2026-12-01 08:13:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:13:13Z.


Triage (#1607) – head a81c5d8

No open or merged PR makes the same change. On main, kickoff_x still resets the list without calling dred::reset, unlike reset_pc and the mid-list split, which already do. This PR moves the Reset tail into restart_after_kickoff and starts the recording only after a successful native Reset.
No problems found in the diff. The description says the reset_x DRED test exists on main, but at this base it is new in this PR, so the description needs a fix.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7305030330 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2510#issuecomment-7305030330). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:13:13Z. --- **Triage (#1607)** – head a81c5d8 No open or merged PR makes the same change. On main, `kickoff_x` still resets the list without calling `dred::reset`, unlike `reset_pc` and the mid-list split, which already do. This PR moves the Reset tail into `restart_after_kickoff` and starts the recording only after a successful native Reset. No problems found in the diff. The description says the `reset_x` DRED test exists on main, but at this base it is new in this PR, so the description needs a fix. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2510:upstream-pr/2510'
git switch 'upstream-pr/2510'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2510'
git switch 'upstream-pr/2510'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2510'
git switch 'upstream-pr/2510'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2510'
git switch 'main'
git merge --squash 'upstream-pr/2510'
git switch 'main'
git merge --ff-only 'upstream-pr/2510'
git switch 'main'
git merge 'upstream-pr/2510'
git push origin 'main'
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!2500
No description provided.