D3D12.X: reuse split dispatch scratch when growth fails #2459
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2469"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by razormontana on 2026-11-25T19:39:12Z.
A split compute dispatch can use smaller slabs when a command list’s scratch buffer holds at least one thread group. If allocating a larger buffer failed, XCL discarded that option and built or bound the whole compute pipeline. Reusing the buffer avoids bringing an additional whole pipeline into use on this path. Part of #2403.
What is in it
real/dispatch_chain.rs, reuse the same recording’s scratch after a failed growth request if one group fits. Report reuse to the command recorder so it issues its UAV barrier. Only a successful allocation updates scratch usage and replaces the shared buffer.README.mddescribes when split dispatches can continue with the recording’s existing scratch buffer.Tested
f2062cda,cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-outputreported 1,443 passed, 0 failed and 47 ignored. The pass count includes 26 explicit GPU skip notices.cargo build --offline --locked --release -p xclsucceeded.Regression run
Both release builds ran the same retail title offline for 60 seconds on the RTX 3070. Both used the Series S profile, direct DXIL and copies of the same starting cache. This pair uses
e120925, the preceding main commit. At8b957be, smoke reached its startup deadline during #2555 shader preparation. The PR merges cleanly into8b957be; the combined retail run remains unverified. The initial pair showed 703 frames on main and 378 on the PR. For this repeat, both started from copies of the cache left by the first main run, after builds completed.Main
PR head
Not tested
The CPU test injects scratch allocation failure. The retail smoke checks startup and presents. It does not establish a reduction in shader-code usage during world loading.
AI use
Codex GPT-6.2 wrote and reviewed the code and tests, rebased the branch, ran the checks, and updated this description.
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T20:35:53Z.
Review: COMMENTED
No concrete defect found. Fallback reuse is capacity-safe, slabbed within its existing allocation, and inserts the required UAV barrier; current Windows CI is green. Nonblocking coverage gap: the test injects select_scratch failure rather than exercising the real D3D12 allocation-failure -> command-recording/slab path. A seam/integration test would strengthen it, but I found no blocker.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T20:22:00Z.
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!
Imported from ivall/xcl. Originally posted by Ritolino on 2026-11-26T18:07:29Z.
Independent Windows 11 x64 + NVIDIA GeForce RTX 4080 (
wave32) verification of#2469headf2062cdamerged cleanly onto currentmain(8b957bec):Tested
wave32),rustc 1.100.0(stable-x86_64-pc-windows-msvc), debugcargo build --workspace: succeededhle::d3d12x::real::dispatch_chain::tests::failed_scratch_growth_reuses_a_buffer_that_fits_a_group:okcargo test --workspace --no-fail-fast -- --test-threads=4 --skip blob_enumeration_sees_one_submitted_update:xcl --lib:1318 passed, 0 failed, 27 ignored, 1 filtered out128 passed, 0 failed, 20 ignored1446 passed, 0 failed, 47 ignored, 1 filtered out(blob_enumeration_sees_one_submitted_updateskipped due to pre-existing#2421/#2373).AI use: Antigravity with Gemini 4 Hydrogen (Medium) ran the merge/build/test pass and drafted this report; reviewed by human.
Imported from ivall/xcl. Originally posted by a-DuckGod on 2026-11-26T19:15:38Z.
Independent Windows 11 / NVIDIA test report on exact PR head
f2062cdaeb31bbf83e442cce27066409b8162cb4(clean detached checkout; merge-basee120925e).Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)(x86_64-pc-windows-msvc), Windows SDK DXC1.8.2502.11, D3D12 debug layer installed, debug build.cargo build --workspace: succeeded.cargo test -p xcl --lib failed_scratch_growth_reuses_a_buffer_that_fits_a_group -- --nocapture: 1 passed, 0 failed, 0 ignored, 0 skipped.cargo test --workspace --no-fail-fast -- --test-threads=4: 1442 passed, 1 failed, 47 ignored (including alle2etests under the D3D12 debug layer and DRED).hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory(vram.rs:2040:26,HRESULT(0x80004005)under parallel GPU load).cargo test -p xcl --lib d32s8_targets_take_their_own_size_of_video_memory -- --nocapture: 1 passed, 0 failed, 0 ignored (2.83 s).SKIPPEDGPU tests (26): 21no wave64(RTX 3080 Ti is 32-lane waves only), 3 per-lane #1426 refused forms (V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32), 1shaders::tests::pso_measurement_compiles_an_exact_synthetic_record(cannot disable driver cache; Windows Developer Mode required), 1heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).Not tested
scripts/smoke.ps1run,XCL_SAMPLE_*tests, live OOM scratch-growth fallback during a game dispatch, AMD / Intel / native wave64 GPUs.AI use
f2062cda(dispatch_chain.rsandREADME.md), ran the build and tests, and drafted this report. I checked it before posting.Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T19:22:35Z.
Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2469 rebased head
f2062cdaeb31bbf83e442cce27066409b8162cb4(exact parent & merge-basee120925e3abc9956a8b9bae631969d32e8ccd43c). Measurements and targeted test results only; not a full source review.Setup
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200rustc 1.100.0 (0ef1bc386 2026-11-09), DXC1.9.2609.5, release builds, warm DXIL/pipeline caches, quiet machine (zero concurrent builds/tests during timed runs)title: 29640639viascripts/smoke.ps1 -Seconds 60(XCL_NETWORK=0, default flags, no input)Targeted RTX 4060 release unit & GPU tests (
f2062cda)cargo test --release -p xcl --lib failed_scratch_growth_reuses_a_buffer_that_fits_a_group -- --nocapture: 1 passed, 0 failed, 0 ignored (0.00 s,0SKIPPED).cargo test --release -p xcl --lib hle::d3d12x::real::dispatch_chain::(3 consecutive parallel passes): 3 passed, 0 failed, 0 ignored on all 3 passes (0.25 s/0.17 s/0.17 s,0SKIPPED).cargo test --release -p xcl --lib hle::d3d12x::real::: 64 passed, 0 failed, 0 ignored (0.36 s,0SKIPPED).Paired 60 s RTX 4060 smoke (exact parent
e120925evsf2062cda)Both runs completed cleanly at steady 60/2 s pacing with
0device removals and0crashes (f2062cdavse120925excl.log:6,176/6,115 MBvs6,114/6,114 MBpeak/end local VRAM,4,651 MBend non-local VRAM on both,19,450vs19,588translated draws /1,024dispatches with0skipped).Exact parent (
e120925e):PR #2469 head (
f2062cda):Limits of coverage
f2062cda(onlyfailed_scratch_growth_reuses_a_buffer_that_fits_a_group, 3 parallel passes ofdispatch_chain::,hle::d3d12x::real::, release build, and exact-parent paired 60 s smokes).0split-compute programs (compute split: 0 programs split, 0 pieces built, 0 chained dispatches issued in 0 slabs; scratch 0 MiB), so scratch-growth failure fallback and buffer reuse were exercised by the targeted release unit test above rather than live split-compute OOM pressure.RTX 4060) on native Windows 11; no AMD, Intel, or Wine/Linux run on this host.AI use
Ran the targeted release unit/GPU tests, release build, and exact-parent paired quiet 60 s smoke runs with assistance from Google Antigravity (Gemini 4 Neon); all test counts, timings, memory figures, and smoke blocks were extracted directly from
cargo test,xcl.log, andscripts/smoke.ps1outputs.Imported from ivall/xcl. Originally posted by thiagocalile on 2026-11-26T20:10:17Z.
Independent test and smoke report for head
f2062cdaeb31bbf83e442cce27066409b8162cb4on an AMD Radeon RX 6600 (8 GB VRAM, RDNA2, native wave64).Tested
32.0.21045.29003,XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (10.0.26200.0), Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.8.2502.11.XCL_ADAPTER=radeon cargo test --no-fail-fast -p xcl --lib -- dispatch_chain --test-threads=4: 11 passed, 0 failed, 0 ignored (0skipped).Not tested: full workspace suite, 60 s smoke run on this head, NVIDIA/Intel GPUs, or Linux/Wine.
AI use: Antigravity (Gemini 4 Neon) ran the builds, tests, and smoke runs and drafted this report; the account owner reviewed and approved posting.
Imported from ivall/xcl. Originally posted by UncommonDLL on 2026-11-27T17:09:24Z.
merge-check
base:
6089122a1chead:
f2062cdaebmerge: clean
build: cargo build --workspace -> ok, exit 0 in 29.45 s
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1462 passed, 4 failed, 47 ignored, 0 filtered. Exit 101 in 87.92 s. All 38 targets completed. The logs contained 26 explicit runtime skip notices, including subcases within passing tests.
review: No blocking finding after reviewing both changed files on local merge c27cf681baed24ecc9a0e017de1979d86d6f07da. Source inspection confirmed that failed growth preserves the recording’s existing scratch buffer and allocation counters. Reuse requires capacity for at least one thread group. The recorder bounds each slab to that capacity and issues a UAV barrier before reuse. The injected allocation-failure test passed. The suite exercised the physical RTX on other checks. A real D3D12 scratch-growth allocation failure remains untested.
performance: Assessed from source. Successful growth retains its allocation behavior. After failed growth, reuse can avoid building or binding a whole pipeline. Smaller slabs can require additional dispatches and barriers. Frame time and memory were unmeasured.
verdict: safe to merge
hardware / tool and model: Windows 11 Pro build 26200, Ryzen 7 7800X3D, RTX 5070 Ti, NVIDIA 621.40. OpenAI Codex ran the build, tests and source review using Git, PowerShell and Cargo. Rust/Cargo 1.100.0 MSVC x64, DXC 1.9.2609.5. Exact Codex variant and reasoning setting: not recorded.
Baseline comparison: cargo test -p xcl --lib -- --test-threads=4 reproduced all four failures on the pinned base. On both revisions, gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0, _1, _2 and _3 failed at seeds 70, 545, 1019 and 1507 respectively. Each stopped at CreateComputePipelineState with 0x8007000E before reaching the scratch-buffer path changed by this PR.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T17:30:59Z.
merge-check
base:
6089122a1chead:
f2062cdaebmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1466 passed, 0 failed, 47 ignored; failing: none (including the new dispatch_chain test failed_scratch_growth_reuses_a_buffer_that_fits_a_group; base
6089122apasses 1465 passed, 0 failed, 47 ignored across 38 test binaries)review: none (read the full 2-file merged diff, +42/-10 across README.md and crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs, and the full dispatch_chain.rs file: select_scratch preserves the normal allocation and no-growth reuse paths, keeps LIVE/PEAK/SHARED untouched when scratch_buffer returns None, falls back to the recording's existing scratch buffer only when capacity >= group with used = true so record_dispatch_chain emits the required UAV barrier and dispatch_slabs sizes slabs to (s.bytes / group).max(1), falls through cleanly to chain.whole() when no usable buffer exists, holds no lock across CreateCommittedResource, and covers all branches in the new unit test)
performance: No default frame-time or memory regression (reasoned from the full diff): when scratch allocation succeeds or no growth is needed, runtime behavior is identical to base
6089122a. The fallback only activates after a CreateCommittedResource failure during split-dispatch scratch growth, where reusing the recording's existing buffer in smaller slabs avoids both additional VRAM allocation and lazy compilation of the unsplit whole compute PSO.verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 (driver 32.0.16.2114), Intel Core i5-11400F, Windows 11, Rust 1.100.0; Google Antigravity (Gemini 4 Neon)
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:07:52Z.
Triage (#1607) – head
f2062cdNo open or merged PR makes this change: main's
scratch_forinreal/dispatch_chain.rsstill returnsNonewhenscratch_bufferfails, so the chain falls back to the whole pipeline. The PRs sharing #2403 (#2496, #2526, #2590, #2641) change other things.select_scratchfalls back to the list's existing buffer only when it holds one group, and returns it withused = trueso the recorder keeps its UAV barrier;dispatchsizes the slabs from the returned buffer'sbytes. On the!makepath the new filter is a no-op (scratch_bytesonly returnsmake = falsewhen the buffer holds at least one group). No problems found in the diff.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.