Skip to content

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

Draft
oni-swr wants to merge 1 commit into
xcl-dev:mainfrom
oni-swr:t3/xcl-fix-2462-dred-reset-leak
Draft

oni-swr wants to merge 1 commit into
xcl-dev:mainfrom
oni-swr:t3/xcl-fix-2462-dred-reset-leak

Conversation

@oni-swr

@oni-swr oni-swr commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

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

…-dev#2462)

A console list's Reset (xcl-dev#10, and xcl-dev#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 <noreply@anthropic.com>
@oni-swr
oni-swr marked this pull request as draft November 25, 2026 21:09
@SlopTart

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
…ream xcl-dev#2510)

(cherry picked from commit ea0ecdc89e6dd985819988ad7257d091f8573d81)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

D3D12.X: XCL_DRED=1 leaks memory unboundedly and reports Frame 1 pipeline labels because list_x::reset_pc and kickoff_x bypass real::cl_reset

3 participants