Skip to content

D3D12.X: clear dispatch_chain shared scratch on list lifecycle transitions - #2543

Open
ramon-victor wants to merge 1 commit into
xcl-dev:mainfrom
ramon-victor:fix/dispatch-chain-shared-scratch-reset
Open

ramon-victor wants to merge 1 commit into
xcl-dev:mainfrom
ramon-victor:fix/dispatch-chain-shared-scratch-reset

Conversation

@ramon-victor

Copy link
Copy Markdown
Contributor

Clears dispatch_chain::SHARED entries when command lists are created, released, recycled as split segments, or reset/closed via console_list, preventing a new recording from reusing an in-flight recording's split-dispatch scratch buffer.

Previously real::dispatch_chain::list_reset was called only from list_x::reset_copy_scratch, never from list_x::on_create, list_x::on_release, list_x::clear_segment_state, or console_list (create_with_allocator, cl_reset, cl_release, close). When a command list recording split compute dispatches on allocator A was submitted and released while in flight, a newly created command list reusing the same pointer on A (or a recycled Wait64 split segment or reset console list) matched SHARED[list] and reused the active scratch buffer without synchronization.

Part of #2459 (specifically item 1; item 2 is tracked separately by #2333/#2519).

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: call super::real::dispatch_chain::list_reset in on_create, on_release, and clear_segment_state alongside title_textures::list_reset.
  • crates/xcl/src/hle/d3d12x/console_list.rs: call super::real::dispatch_chain::list_reset for the backing PC list in create_with_allocator, cl_reset, cl_release, and close.
  • crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs: add tests::list_lifecycle_transitions_clear_shared_scratch verifying that list_x::on_release, list_x::on_create, list_x::clear_segment_state, and console_list Reset/Release all clear SHARED so subsequent scratch_for calls allocate a fresh scratch buffer.

Tested

  • Hardware / toolchain: NVIDIA GeForce RTX 3070 8 GiB (driver 621.24, wave32), AMD Ryzen 7 5700X, 32 GiB RAM, Windows 11 Pro (26300), rustc 1.99.0 (x86_64-pc-windows-msvc), DXC/DXIL 1.8.2502.11 (Windows SDK 10.0.26100.0).
  • Failing-first before fix: cargo test -p xcl --lib list_lifecycle_transitions_clear_shared_scratch -- --nocapture failed (0 passed, 1 failed: on_release must clear shared dispatch scratch).
  • After fix: cargo test -p xcl --lib hle::d3d12x::real::dispatch_chain::tests -- --test-threads=1: 3 passed, 0 failed, 0 ignored.
  • Full workspace suite (.\scripts\test.ps1, debug): 1424 passed, 0 failed, 46 ignored (skipped on this adapter: wave64-only GPU tests, unsupported per-lane semantics variants, no heap windows).
  • Release build (cargo build --release -p xcl) and clean 60 s retail smoke run (.\scripts\smoke.ps1).

Regression run

Baseline (main):

xcl-smoke v1
commit: f087b998d0d51a9f11bbfa0761967a63e778edd9
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14467 MB

PR (12141cc):

xcl-smoke v1
commit: 12141ccbfa162b7e169d913a20c1b7e3fd1bf1dd
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1628 (PresentX 1628)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14070 MB

Not tested

  • Multi-queue retail stress triggering live command-list address reuse across in-flight split dispatches (covered deterministically by list_lifecycle_transitions_clear_shared_scratch).
  • AMD / Intel GPUs and Wine / macOS hosts.

AI use

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@xpatfussy69x

xpatfussy69x commented Nov 25, 2026 •

Copy link
Copy Markdown

Test run on exact head 12141cc (12141ccbfa162b7e169d913a20c1b7e3fd1bf1dd, on its base e1d84b7), clean tree.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (driver 32.0.16.2124, 32-lane waves only), AMD Ryzen 5 7500F, Windows 11, Rust 1.100.0; debug build for the tests, release for the smoke runs
  • cargo test --workspace -- --test-threads=4: 1424 passed, 0 failed, 46 ignored
  • SKIPPED (25): 21 × no wave64; 1 × no heap windows; 3 × per-lane form refused V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32 (on main too)
  • cargo test -p xcl --lib list_lifecycle: 1 passed, 0 failed
  • This PR's new tests in the workspace run:
    • list_lifecycle_transitions_clear_shared_scratch: ok
  • Conflicts with D3D12.X: reserve split compute scratch before allocating it #2532 in crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs (git merge-tree of both heads); whichever lands second needs a rebase

Regression run (60 s, default settings, a retail title)

main:

xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 3060
title: c3f791f3
seconds: 60
exit: 0x0
frames shown: 1091 (PresentX 1091)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14814 MB

this PR:

xcl-smoke v1
commit: 12141ccbfa162b7e169d913a20c1b7e3fd1bf1dd
gpu: NVIDIA GeForce RTX 3060
title: c3f791f3
seconds: 60
exit: 0x0
frames shown: 1137 (PresentX 1137)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14777 MB

No crash or device removal; frames 104 % of main's, peak commit 100 %.

Not tested

  • Whether the title runs a split compute dispatch on a released and recreated list in this run: a regression check only
  • The PR merged into current main (tested on its own base; it merges into e1d84b7 without conflicts)
  • AMD / native wave64

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and both smoke runs on the machine above and wrote this report.

@DarkPanda69

Copy link
Copy Markdown

AMD run (listed as untested; the reports above are NVIDIA): the new test passes on an RX 9070 XT.

Head 12141cc applied on main e1d84b7, debug, Windows 11 Pro 26200, RX 9070 XT (RDNA4, driver 32.0.32029.2010):

  • cargo test -p xcl --lib -- list_lifecycle_transitions_clear_shared_scratch --nocapture: 1 passed, 0 failed, no SKIPPED.
  • The test makes its command lists on the default adapter (D3D12CreateDevice(None, ..)), which is the RX 9070 XT here, so they ran on the AMD driver, not WARP.

Not tested: the whole suite with this PR, Intel, a title.
AI use: Claude Code (Claude Opus 5.5) ran the test on this machine and wrote this report.

@emirduran707

Copy link
Copy Markdown
Contributor

Independent AMD RDNA4 (native wave64) verification of exact PR head 12141ccbfa162b7e169d913a20c1b7e3fd1bf1dd on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver 32.0.31044.16, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC 1.9.2602.17).

Tested

  • cargo build --workspace (debug): passed (0 errors).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1422 passed, 2 failed, 46 ignored (8 SKIPPED: 6 per-lane DXIL forms refused by host adapter/driver, 1 heap_window_out_of_memory_falls_back_to_the_switch_form no heap windows, 1 pso_measurement_compiles_an_exact_synthetic_record Windows Developer Mode off).
    • The new test hle::d3d12x::real::dispatch_chain::tests::list_lifecycle_transitions_clear_shared_scratch passed.
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 and fuzz_validate_and_gpu_3) are pre-existing on unmodified main on this RX 9060 XT / driver 32.0.31044.16.
  • cargo build --release -p xcl + 60 s retail-title smoke test (scripts/smoke.ps1, offline):
xcl-smoke v1
commit: 12141ccbfa162b7e169d913a20c1b7e3fd1bf1dd
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1582 (PresentX 1582)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13932 MB

(Compare against main 68a284a on this machine: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • NVIDIA / Intel GPUs, Linux / Wine.

AI use

  • Verification run and report prepared with Antigravity (Gemini 4 Neon); all build, test, and smoke results are from live runs on this machine.

@KOLESNiii KOLESNiii mentioned this pull request Nov 25, 2026
@SlopTart

Copy link
Copy Markdown

Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

gpu_ suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
Targeted run of list_lifecycle_transitions_clear_shared_scratch: passed.

Not tested: retail titles (no title data on this lane, counts only).

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

rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
…ry (port upstream xcl-dev#2469 + xcl-dev#2532 + xcl-dev#2543 + xcl-dev#2629)

(cherry picked from commit bc14f1d8b191b3935c9829a539454b6226c542d0)
@Prime1997 Prime1997 mentioned this pull request Nov 26, 2026
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.

6 participants