D3D12.X: XCL_DRED=1 starts a recording at a console list's Reset (#2462) #2510

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

@⁠oni-swr on GitHub · 2026-11-25 21:09 UTC · original
oni-swr:t3/xcl-fix-2462-dred-reset-leak → main · +127 −0 · 2 files · 1 commits · draft

With XCL_DRED=1, a console command list's Reset never started a new DRED recording. Reset #10, and #139 on the newer layout, goes title_list::reset / list_x::reset_x → list_x::reset_pc, and KickoffX resets in list_x::kickoff_x. Both call the native Reset directly, bypassing real::cl_reset, which is the only Reset path that calls dred::reset. So every SetPipelineState of every frame was appended to the list's first recording. That recording grew without bound (the 4-recording limit never ran), and a fault was matched to frame 1's markers, without the pipeline that Reset or KickoffX bound.

reset_pc and kickoff_x now call dred::reset after a successful native Reset and mark the initial pipeline, the same way cl_reset does. reset_pc is also the path for the stand-in list of a Reset made while the last submit is still on the GPU (reset_stand_in). A failed Reset still returns before any of this, so it starts no recording.

Fixes #2462

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: dred::reset + dred::mark_pipeline after the native Reset in reset_pc and in kickoff_x.
  • crates/xcl/src/hle/d3d12x/dred.rs: test-only ON_FOR_TEST thread-local, which turns DRED on for one test's thread so other tests' fake lists are never marked, and recordings_for_test.
  • list_x.rs test xcl_dred_starts_a_recording_with_the_initial_pipeline_at_each_reset: a fake PC list goes through 10 reset_x "frames", each with its own labelled initial pipeline and 3 binds. After each frame the test checks four things: the number of recordings is min(frame + 1, 4); the newest recording holds exactly that frame's 4 markers; its first label is that frame's initial pipeline; and bound_at for a fault at the first dispatch names it. The test also checks that the initial pipeline's SetMarker reached the list (40 markers).

Tested

  • CPU-only pass: AMD Ryzen 7 5700X3D, Windows 11 build 26200, rustc 1.100.0, debug. XCL_ADAPTER=NONE_CPU_ONLY, no GPU test was run.
  • cargo test -p xcl --lib -- --test-threads=4 hle::d3d12x::dred:: list_x::tests::reset_commits list_x::tests::xcl_dred: 6 passed, 0 failed, 0 ignored (1319 filtered out).
  • With the reset_pc hunk removed, the new test fails in frame 0: left: 3, right: 4 (the recording has the 3 binds but not the Reset's pipeline).
  • cargo test --workspace --no-run -j 4: builds.
  • cargo clippy --all-targets -p xcl: nothing on the changed lines. It exits with 3 existing approx_constant errors in gpu/dxil/lower_valu.rs, gpu/dxil/lower_wide.rs and gpu/recomp/lower.rs, files this PR does not touch.
  • rustfmt --check (edition 2021): the added lines are clean. The files as a whole are not, as before.

Regression run

  • Not run yet. The smoke run needs the GPU (RX 7800 XT), which another job was using during this pass. The two xcl-smoke blocks, on main and on this PR's head, will be added before this PR leaves draft. Until then the PR description check is expected to fail.

Not tested

  • Physical GPU execution: the whole cargo test --workspace suite on a GPU, scripts/smoke.ps1, and any real title with XCL_DRED=1. This was a CPU-only pass.
  • The kickoff_x hunk has no unit test: KickoffX needs a live queue to submit to. It mirrors the reset_pc one.
  • No device fault was produced to check the DRED log output end to end.
  • NVIDIA / Intel.

AI use

  • Claude Code (Claude Opus 5.5): read the issue and the code paths, wrote the fix, the test and this description, and ran the commands above.

🤖 Generated with Claude Code

**@⁠oni-swr** on GitHub · 2026-11-25 21:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/2510) `oni-swr:t3/xcl-fix-2462-dred-reset-leak` → `main` · +127 −0 · 2 files · 1 commits · draft With `XCL_DRED=1`, a console command list's Reset never started a new DRED recording. Reset #10, and #139 on the newer layout, goes `title_list::reset` / `list_x::reset_x` → `list_x::reset_pc`, and `KickoffX` resets in `list_x::kickoff_x`. Both call the native Reset directly, bypassing `real::cl_reset`, which is the only Reset path that calls `dred::reset`. So every `SetPipelineState` of every frame was appended to the list's first recording. That recording grew without bound (the 4-recording limit never ran), and a fault was matched to frame 1's markers, without the pipeline that Reset or KickoffX bound. `reset_pc` and `kickoff_x` now call `dred::reset` after a successful native Reset and mark the initial pipeline, the same way `cl_reset` does. `reset_pc` is also the path for the stand-in list of a Reset made while the last submit is still on the GPU (`reset_stand_in`). A failed Reset still returns before any of this, so it starts no recording. Fixes #2462 **What is in it** - `crates/xcl/src/hle/d3d12x/list_x.rs`: `dred::reset` + `dred::mark_pipeline` after the native Reset in `reset_pc` and in `kickoff_x`. - `crates/xcl/src/hle/d3d12x/dred.rs`: test-only `ON_FOR_TEST` thread-local, which turns DRED on for one test's thread so other tests' fake lists are never marked, and `recordings_for_test`. - `list_x.rs` test `xcl_dred_starts_a_recording_with_the_initial_pipeline_at_each_reset`: a fake PC list goes through 10 `reset_x` "frames", each with its own labelled initial pipeline and 3 binds. After each frame the test checks four things: the number of recordings is `min(frame + 1, 4)`; the newest recording holds exactly that frame's 4 markers; its first label is that frame's initial pipeline; and `bound_at` for a fault at the first dispatch names it. The test also checks that the initial pipeline's `SetMarker` reached the list (40 markers). **Tested** - CPU-only pass: AMD Ryzen 7 5700X3D, Windows 11 build 26200, rustc 1.100.0, debug. `XCL_ADAPTER=NONE_CPU_ONLY`, no GPU test was run. - `cargo test -p xcl --lib -- --test-threads=4 hle::d3d12x::dred:: list_x::tests::reset_commits list_x::tests::xcl_dred`: 6 passed, 0 failed, 0 ignored (1319 filtered out). - With the `reset_pc` hunk removed, the new test fails in frame 0: `left: 3, right: 4` (the recording has the 3 binds but not the Reset's pipeline). - `cargo test --workspace --no-run -j 4`: builds. - `cargo clippy --all-targets -p xcl`: nothing on the changed lines. It exits with 3 existing `approx_constant` errors in `gpu/dxil/lower_valu.rs`, `gpu/dxil/lower_wide.rs` and `gpu/recomp/lower.rs`, files this PR does not touch. - `rustfmt --check` (edition 2021): the added lines are clean. The files as a whole are not, as before. **Regression run** - Not run yet. The smoke run needs the GPU (RX 7800 XT), which another job was using during this pass. The two `xcl-smoke` blocks, on `main` and on this PR's head, will be added before this PR leaves draft. Until then the `PR description` check is expected to fail. **Not tested** - Physical GPU execution: the whole `cargo test --workspace` suite on a GPU, `scripts/smoke.ps1`, and any real title with `XCL_DRED=1`. This was a CPU-only pass. - The `kickoff_x` hunk has no unit test: `KickoffX` needs a live queue to submit to. It mirrors the `reset_pc` one. - No device fault was produced to check the DRED log output end to end. - NVIDIA / Intel. **AI use** - Claude Code (Claude Opus 5.5): read the issue and the code paths, wrote the fix, the test and this description, and ran the commands above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A console list's Reset (#10, and #139 on the newer layout) reaches its PC
list through title_list::reset / list_x::reset_x -> list_x::reset_pc, and
KickoffX resets the list in list_x::kickoff_x; both call the native Reset
directly. Only real::cl_reset (the PC path), the mid-list split and
CreateCommandList started a new DRED recording, so with XCL_DRED=1 every
SetPipelineState of every frame went into a console list's first
recording: it grew without bound (the 4-recording limit never applied),
and a fault was matched to frame 1's markers, without the pipeline the
Reset or KickoffX bound.

reset_pc (also used for the stand-in list of a Reset while the last
submit runs) and kickoff_x now call dred::reset and mark the initial
pipeline after a successful native Reset, as cl_reset does. A failed
Reset starts no recording.

The test drives reset_x on a fake PC list with DRED on for its thread
only (dred::ON_FOR_TEST). Without the change it fails at the first frame:
the recording holds 3 markers (the binds), not 4 (the Reset's pipeline too).

Assisted-by: Claude Code (Claude Opus 5.5)

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

@⁠SlopTart on GitHub · 2026-11-25 21:21 UTC · original

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.

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

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

Merge

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