Repository navigation
Conversation
DispatchX(x, y, z, flags) dropped its flags. With USE_THREAD_DIMENSIONS (0x20; 0x8020 with the wave32 bit) x, y, z are thread counts: the console launches ceil(count / numthreads) groups and leaves the lanes past the count out of EXEC. XCL launched the counts as groups: 32-64x the groups for the retail title's BVH builder (its rehydration and reload passes pass node and primitive counts), past D3D12's 65,535 groups for a large mesh, and every extra thread of the unguarded Box32/Box16 rehydration shaders wrote outside its node array. The flags now reach the dispatch (also one put off to the submit). With 0x20 the counts become whole groups of the pipeline's console numthreads (kept with its user SGPRs at creation); a pipeline whose group shape is not known is not launched, skipped and counted as an untranslated one. The thread count of an axis that does not end on a whole group goes to io slots 114..116 (IO_THREAD_LIMIT), where the compute prologue will leave the lanes past it out of EXEC in a following change: until then the last group still runs whole. Each kind of flags is logged once. Part of a stack: EXEC masking of the last group follows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! — Devin |
|
Test report: AMD RX 7800 XT, exact head Hardware / setup
Tested
Extra synthetic checks (local only, not proposed for the PR)
The last column is Not tested
Local test patch (applied on top of a3e820d only for this run)diff --git a/crates/xcl/src/hle/d3d12x/bind.rs b/crates/xcl/src/hle/d3d12x/bind.rs
index 9bb3e030..425cdb1e 100644
--- a/crates/xcl/src/hle/d3d12x/bind.rs
+++ b/crates/xcl/src/hle/d3d12x/bind.rs
@@ -1480,6 +1480,146 @@ void main(uint t : SV_GroupIndex) {
assert_eq!(dispatch_groups(0x7300_00FF, [100, 1, 1], 0), Some(([100, 1, 1], [0, 0, 0])));
}
+ // ---- local verification of PR #2610 (not part of the PR) ----
+
+ /// Sweep: whole groups cover the count, one group fewer would not, limits only on partial axes;
+ /// bounded dimensions: up to 65,535 * numthreads threads stay within D3D12's 65,535 groups.
+ #[test]
+ fn verify2610_group_counts_sweep_and_bounds() {
+ let shapes: [[u32; 3]; 7] = [[64, 1, 1], [32, 1, 1], [256, 1, 1], [1024, 1, 1], [8, 8, 1], [4, 4, 4], [16, 16, 4]];
+ for (i, sh) in shapes.iter().enumerate() {
+ let pso = 0x7310_0000usize + i;
+ real::register_threads_for_test(pso, *sh);
+ for flags in [0x20u32, 0x8020, 0x20 | 0x1] {
+ for n in (0u32..=3000).chain([65_535 * sh[0] - 1, 65_535 * sh[0]]) {
+ let dims = [n, (n % 7) + 1, (n % 3) + 1];
+ let (g, l) = dispatch_groups(pso, dims, flags).unwrap();
+ for k in 0..3 {
+ assert!(g[k] as u64 * sh[k] as u64 >= dims[k] as u64, "{sh:?} {dims:?} {k}");
+ assert!(dims[k] == 0 || ((g[k] - 1) as u64) * (sh[k] as u64) < dims[k] as u64, "{sh:?} {dims:?} {k}");
+ assert_eq!(l[k], if dims[k] % sh[k] != 0 { dims[k] } else { 0 });
+ assert!(g[k] <= 65_535, "{sh:?} {dims:?}: {g:?}");
+ }
+ }
+ }
+ // without 0x20 the counts are groups, whatever the other bits
+ for flags in [0u32, 0x8000, 0x1, 0x10, 0x40] {
+ assert_eq!(dispatch_groups(pso, [70_000, 3, 2], flags), Some(([70_000, 3, 2], [0; 3])));
+ }
+ }
+ // the retail log case: 45 threads of 64 -> one group (main launched 45)
+ assert_eq!(dispatch_groups(0x7310_0000, [45, 1, 1], 0x20), Some(([1, 1, 1], [45, 0, 0])));
+ assert_eq!(dispatch_groups(0x7310_0000, [1, 1, 1], 0x8020), Some(([1, 1, 1], [1, 0, 0])));
+ // the largest count that fits: 65,535 groups; one thread more needs 65,536 (reported, not clamped)
+ assert_eq!(dispatch_groups(0x7310_0000, [65_535 * 64, 1, 1], 0x20), Some(([65_535, 1, 1], [0, 0, 0])));
+ assert_eq!(dispatch_groups(0x7310_0000, [65_535 * 64 + 1, 1, 1], 0x20).unwrap().0, [65_536, 1, 1]);
+ // u32::MAX threads: no overflow in the division
+ assert_eq!(dispatch_groups(0x7310_0000, [u32::MAX, 1, 1], 0x20).unwrap().0, [67_108_864, 1, 1]);
+ // a zero in the console group shape is taken as 1 (no division by zero)
+ real::register_threads_for_test(0x7310_00F0, [0, 1, 1]);
+ assert_eq!(dispatch_groups(0x7310_00F0, [100, 1, 1], 0x20), Some(([100, 1, 1], [0, 0, 0])));
+ }
+
+ /// `DispatchX` (#78) hands its flags to the dispatch: with 0x20 on a translated pipeline whose
+ /// group shape is not known it is skipped before any binding (on main the flags were dropped).
+ #[test]
+ fn verify2610_dispatch_x_forwards_flags() {
+ let mut orig_vt = [0usize; 64];
+ orig_vt[1] = fake_add_ref as usize;
+ orig_vt[2] = fake_release as usize;
+ orig_vt[14] = fake_dispatch as usize;
+ orig_vt[25] = fake_set_pso as usize;
+ orig_vt[29] = fake_set_compute_rs as usize;
+ orig_vt[41] = fake_set_compute_uav as usize;
+ orig_vt[59] = fake_execute_indirect as usize;
+ let mut ext_vt = vec![0usize; 65];
+ ext_vt[0] = orig_vt.as_ptr() as usize;
+ ext_vt[1..].copy_from_slice(&orig_vt);
+ let fake = Box::new(FakeAdoptedList {
+ vt: unsafe { ext_vt.as_ptr().add(1) },
+ refs: AtomicUsize::new(1),
+ dispatch_calls: AtomicUsize::new(0),
+ set_compute_rs_calls: AtomicUsize::new(0),
+ set_compute_uav_calls: AtomicUsize::new(0),
+ set_pso_calls: AtomicUsize::new(0),
+ execute_indirect_calls: AtomicUsize::new(0),
+ });
+ let list_ptr = &*fake as *const FakeAdoptedList as *mut c_void;
+ let pso = 0x7320_0001usize;
+ real::register_translated_compute_for_test(pso);
+ assert_eq!(real::pso_threads(pso), None);
+ reset(list_ptr, 0x7320_0100, pso);
+ for flags in [0x20u32, 0x8020] {
+ let before = counts_snapshot();
+ unsafe { list_x::dispatch_x(list_ptr, 100, 1, 1, flags) };
+ let after = counts_snapshot();
+ assert_eq!(after[DISPATCHES], before[DISPATCHES]);
+ assert!(after[DISPATCHES_SKIPPED] > before[DISPATCHES_SKIPPED]);
+ }
+ assert_eq!(fake.dispatch_calls.load(Ordering::Relaxed), 0);
+ assert_eq!(fake.set_compute_rs_calls.load(Ordering::Relaxed), 0);
+ assert_eq!(fake.set_compute_uav_calls.load(Ordering::Relaxed), 0);
+ assert_eq!(fake.set_pso_calls.load(Ordering::Relaxed), 0);
+ forget(list_ptr);
+ }
+
+ /// On the GPU: the groups `dispatch_groups` gives, launched with a synthetic HLSL shader of
+ /// the same numthreads, run every wanted thread exactly once and launch no more lanes than
+ /// whole groups; the buffer holds a counter and one slot per wanted thread (in-range writes only).
+ #[test]
+ fn verify2610_gpu_whole_groups_cover_threads() {
+ use crate::gpu::recomp::{dxc, runner};
+ let adapter = match runner::adapter() {
+ Ok(a) => a,
+ Err(_) => return runner::skip_test("no GPU"),
+ };
+ if dxc::location().is_err() {
+ return runner::skip_test("no DXC");
+ }
+ eprintln!("verify2610 adapter: {adapter}");
+ if let Ok(want) = std::env::var("XCL_VERIFY_ADAPTER") {
+ assert!(adapter.contains(&want), "adapter {adapter} is not {want}");
+ }
+ let cases: [([u32; 3], [u32; 3], u32); 7] = [
+ ([64, 1, 1], [640, 1, 1], 0x20),
+ ([64, 1, 1], [100, 1, 1], 0x20),
+ ([64, 1, 1], [45, 1, 1], 0x20),
+ ([64, 1, 1], [1, 1, 1], 0x8020),
+ ([8, 8, 1], [20, 16, 3], 0x20),
+ ([4, 4, 4], [9, 5, 7], 0x8020),
+ ([64, 1, 1], [65_535 * 64, 1, 1], 0x20),
+ ];
+ for (i, (sh, dims, flags)) in cases.into_iter().enumerate() {
+ let pso = 0x7330_0000usize + i;
+ real::register_threads_for_test(pso, sh);
+ let (groups, _) = dispatch_groups(pso, dims, flags).unwrap();
+ let src = format!(
+ "RWByteAddressBuffer io : register(u0);\nRWByteAddressBuffer mem : register(u2);\n\
+ [numthreads({}, {}, {})]\nvoid main(uint3 t : SV_DispatchThreadID) {{\n\
+ uint3 lim = uint3(io.Load(0), io.Load(4), io.Load(8));\n\
+ uint o; mem.InterlockedAdd(0, 1, o);\n\
+ if (all(t < lim)) {{ uint idx = (t.z * lim.y + t.y) * lim.x + t.x; mem.InterlockedAdd(16 + idx * 4, 1, o); }}\n}}\n",
+ sh[0], sh[1], sh[2]
+ );
+ let dxil = dxc::compile(&src, "main", "cs_6_6", &[]).unwrap_or_else(|e| panic!("{e}"));
+ let wanted = (dims[0] * dims[1] * dims[2]) as usize;
+ let mem = vec![0u32; 4 + wanted];
+ let out = runner::dispatch(&dxil, groups, &dims, &mem).unwrap_or_else(|e| panic!("{sh:?} {dims:?}: {e}"));
+ let lanes = groups.iter().map(|&g| g as u64).product::<u64>() * sh.iter().map(|&t| t as u64).product::<u64>();
+ let once = out[4..4 + wanted].iter().filter(|&&v| v == 1).count();
+ eprintln!("verify2610 {sh:?} {dims:?} flags {flags:#x}: groups {groups:?}, lanes run {} (expected {lanes}), wanted threads run once {once}/{wanted}", out[0]);
+ assert_eq!(out[0] as u64, lanes);
+ assert_eq!(once, wanted);
+ // main's launch (the counts as groups) for comparison, where it is a valid dispatch
+ if dims.iter().all(|&d| d <= 65_535) && i < 6 {
+ let out = runner::dispatch(&dxil, dims, &dims, &mem).unwrap();
+ let lanes_main = dims.iter().map(|&g| g as u64).product::<u64>() * sh.iter().map(|&t| t as u64).product::<u64>();
+ eprintln!("verify2610 counts as groups (main): groups {dims:?}, lanes run {} (expected {lanes_main})", out[0]);
+ assert_eq!(out[0] as u64, lanes_main);
+ }
+ }
+ }
+
#[test]
fn async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect() {
let mut orig_vt = [0usize; 64];AI use: Claude Code (Claude Opus 5.5), coordinated by Codex (gpt-6.2-sol), ran these tests, wrote the temporary checks and wrote this report. The results come from the runs above on this machine. |
|
Independent dual-PC NVIDIA full-workspace test report on clean head Tested
Not tested
AI use
|
|
Wine cross-check of the new test — passes; scope is the group arithmetic, not GPU execution. Head
This PR is on the world-entry chain for this machine's goal (the #2140 failfast class: retail title, world start), so I'll watch for the stacked EXEC-masking follow-up it mentions. Log: |
|
Tested: current PR head merged onto current
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. |
|
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
Thanks! — Devin |
…l-dev#2610) (cherry picked from commit 432fe8351eab1fb65e98ab75bd759b08f23bdf24)
|
Windows / NVIDIA results for Regression run (default settings, 600 s)
This PR,
Tested
Not tested: what the 45-thread dispatch computes, before or after (no readback); AMD / wave64. AI use: Claude Code (Claude Opus 5.5) built the commit, ran the suite and the runs on my machine, read the logs and wrote this. |
|
Thanks @jennydeth, that is the case this was written for, and your reading is right: with this PR alone the 45-thread AI use: Claude Code (Claude Opus 5.5) wrote this. |
|
Runtime path coverage on a different host and branch. I traced the current At 72.4 s the title made at least 2,048 calls with the Separate indirect signature logging also saw type 105 created. The compute shader associated with the older q0 hang used ordinary type 2 in the observed follow-up calls. These are independent observations. This run measures use of the existing direct flag path and carries no #2610 code or tail masking. OpenAI Codex (GPT-6 family) added and ran the trace. |
|
Independent desktop NVIDIA verification of PR #2610 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib dispatch_x_with_thread_dimensions_launches_whole_groups -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1331 filtered out × 3 (0.00s × 3) |
cargo test --release -p xcl --lib hle::d3d12x::bind:: (3 consecutive runs) |
9 passed; 0 failed; 0 ignored; 1323 filtered out × 3 (0.27s, 0.27s, 0.28s, 0 skipped) |
cargo test --release -p xcl --lib hle::d3d12x::list_x:: -- --test-threads=1 (3 consecutive runs) |
40 passed; 0 failed; 0 ignored; 1292 filtered out × 3 (1.17s, 1.14s, 1.15s, 0 skipped) |
cargo test --release -p xcl --lib gpu::recomp::pso:: (3 consecutive runs) |
24 passed; 0 failed; 1 ignored; 1307 filtered out × 3 (0.08s × 3) |
cargo build --release -p xcl |
Clean build (1m 15s, exit 0, 0 new warnings) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact parent & merge-base (08db8020d323bf478964fcc586152cce54959cfc, cached baseline on the same machine):
xcl-smoke v1
commit: 08db8020d323bf478964fcc586152cce54959cfc
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1588 (PresentX 1588)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14000 MB
PR #2610 (a3e820d8e86fcbd8322fee8e519f4b6593b076ce):
xcl-smoke v1
commit: a3e820d8e86fcbd8322fee8e519f4b6593b076ce
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1617 (PresentX 1617)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14022 MB
Runtime log observations (xcl.log)
9221log lines,0[ERROR]/ device-removal / panic lines.- Final draw/memory telemetry in log:
19717 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14022 MB committed by the process; video memory 6116 MB local, 4681 MB non-local. 0flaggedUSE_THREAD_DIMENSIONSDispatchXor skipped-unknown-shape lines logged during the 60 s retail smoke ontitle: 29640639.
Limits of coverage
- Thread-dimension
DispatchXwhole-group ceiling (USE_THREAD_DIMENSIONS0x20/0x8020), unknown-group-shape skip, andIO_THREAD_LIMITpropagation were verified viadispatch_x_with_thread_dimensions_launches_whole_groups(3/3),hle::d3d12x::bind::(9/9× 3),hle::d3d12x::list_x::(40/40× 3), andgpu::recomp::pso::(24/0/1× 3). title: 29640639did not issue flaggedUSE_THREAD_DIMENSIONSDispatchXcalls in 60 s, so the retail smoke confirms zero regression on standard compute dispatches (1024dispatches,0skipped; frame-count and commit deltas vs. cached parent reflect single-run startup variance, not this PR).
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
|
@jennydeth, the masking follow-up is up as #3015 (stacked on this PR). It adds an opt-in compute entry that ANDs EXEC with the AI use: Claude Code (Claude Opus 5.5). |
…patchX flags) - 0024-0026: XCL_VIEW_FULL_RANGE=1 (view ranges to their real end, a negative cache for tiles without a source, a test fix); - 0027-0028: XCL_RT_WATCH=<frames>, a probe of the acceleration structures' headers, CPU against video memory, and of the builder's DispatchX calls (flag 0x20); record lists from the environment only; - 0029: XCL_DISPATCHX_FLAGS=1, the host half of xcl-dev#2610 by KDenKC (GPL-3.0-or-later): thread dimensions launched as whole groups. All off by default, none touches build.rs TRANSLATOR_SOURCES. Checked with git am --3way on the base in README.md (0001-0029 apply clean) and git diff --check. README: one entry per new patch, measured results, credits and the licence of 0029. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The RTX 4090 baseline capture connects the extra groups to a specific consumer in the retail scene. Two Box32Rehydration dispatches requesting 2,841 and 927 threads wrote the same DWORD of a live skinning input page. Group 206 lane 29 wrote The output VA came from root parameter 2. The first root constant, node index and store immediate reproduce the same byte offset ( AI assistance: OpenAI Codex instrumented the local HLSL replay and checked the readbacks. |
|
@minimalhipster990, that's the missing link: a live page the extra groups overwrite. Added to the description. The lanes past the requested extent inside the last, partial group are the follow-ups: #3015 (masked compute entry) and #3066 (selecting it for partial groups on workers). In the retail title, both AI use: Claude Code (Claude Opus 5.5). |
|
@KDenKC I replayed the cell checkpoint on the RTX 4090 with the group-count change from The two Box32 sections launched 45 and 15 groups. On the exact 128 KiB of source data previously overwritten, the selector stayed 1 from upload through skinning. Of 9,470 valid command-boundary samples, the only zero preceded the upload. At dispatch 4906 the direct resource before and after, the shader heap view and the CPU source matched byte for byte. The three monitored lanes actually read 1 at guest PC I also matched the original eight face triangles by all 128 primitive indices and vertex attributes. Their median edge-length ratio to their neighbors was 86.84 in the deformed baseline draw, and 1.04–1.15 across 71 matching draws with #2610. A separate close-up still shows a triangular protrusion below the ear in both the base-color buffer and the presented image. Its producing draw remains open. For the post-fade courtyard view I matched a baseline and a corrected present with one active page pair in both. Across 53 image correspondences the median registration residual was 1.49 pixels at 2560×1440. The foreground head that was mostly missing in base color has a continuous silhouette in the corrected shot. This answers the #2610-only question on the HLSL capture. The direct-DXIL stack test you asked for remains open. It needs the same page readbacks with the #3066 worker-selected masked pipeline active, including the partial last group. AI assistance: OpenAI Codex adapted the instrumentation, ran the replays and checked the readbacks. |
…pied Two things in one commit, because both touch list_x.rs in the working tree they were tested in: 1. Patches 0024-0028 of CharlyRien's lab-patches/fix-waits (4bfff8e, https://github.com/CharlyRien/xcl), read line by line first and merged by hand where they met this branch (view_mem.rs, bind.rs, list_x.rs): XCL_VIEW_FULL_RANGE (0024, 0025), a test fix (0026), the read-only XCL_RT_WATCH probe (0027, new rt_watch.rs), DispatchX flag 0x20 counted (0028). 0029 is not taken: this tree already has xcl-dev#2610 behind XCL_DISPATCHX_THREADS=1; XCL_DISPATCHX_FLAGS=1 is accepted as another name for it. 2. depth_twin::alias_pair also pairs an R32_UINT UAV texture with the R9G9B9E5 texture at a 64 KiB-aligned address (XCL_ALIAS_ALIGNED=0: not), and list_x::alias_flush tells the texture tracking the copy wrote the R9G9B9E5 texture (title_textures::note_gpu_write), so the CPU view's zeros are not uploaded over it. Both parts are claudetools-gh's finding on xcl-dev#505 (comment 7226090557: a retail title's half-res DoF input read zero and blacked the scene in some views). Measured here (RTX 5070 Ti, Series S profile, 430 s runs): with 2, the alias copies of a run double (262144 against 65536-131072), 3 of 3 runs without a crash at 3.35-3.43 presents/s. With XCL_DISPATCHX_THREADS=1 on top, the room and the yard were complete and free of stray polygons in the albedo target of 3 of 3 runs (0 of 3 without it, same build), no device hang, 3.2 presents/s; the character's head was there in 1 of the 3. Co-Authored-By: CharlyRien <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
@minimalhipster990, thank you. That's the image-level answer for this PR: the deformed face triangles are back to normal proportions and the silhouette is continuous. Added to the description. For the #3066 stack check, the partial last groups we saw in the title were the AI use: Claude Code (Claude Opus 5.5). |
|
@KDenKC I replayed the same RTX 4090 cell checkpoint with the 1 GiB view pool and page budget. Both partial Box32Rehydration dispatches selected the same worker-built direct-DXIL PSO. The skinning input kept its selector.
The capture wrote the computed EXEC words to a side UAV at masked shader entry. All 64 threads in each penultimate group reported full EXEC. Both hardware halves agreed on the last-group masks. Readbacks completed on the fence for the list that issued both dispatches. A second pair at frame 1802 reproduced both masks. The upload set the selector to 1. The GPU read 1 immediately before and after each Box32 dispatch. At skinning command 4886, frame 1767, the direct resource before and after and the shader heap view matched all 128 KiB of the original source (SHA-256 For reproducibility, this was the instrumented checkpoint host with #2610’s group conversion. For partial Box32 it called the #3066 worker, selector and #3015 compiler from AI assistance: OpenAI Codex integrated the capture probes, ran the replay and checked the fenced GPU readbacks. |
|
@KDenKC I closed the missing vertex-store measurement from the RTX 4090 cell replay. On the same checkpoint and 1 GiB budgets, dispatch 4983 (frame 1720) matched dispatch 4886 from the previous capture by all 128 KiB of input and the three vertex signatures. All three read selector 1. With
A second replay ties the remaining visual artifact to a different part of the image. In the post-fade courtyard view, frame 1786 matched the previous camera on 123 points (1.45 px median error at 2560×1440). A thin triangle extends from the neckline into the background in both base color and the final present. For that frame we traced the three vertices from producer 35206 at As in the previous capture, partial Box32 dispatches used the worker-selected masked direct-DXIL variant from AI assistance: OpenAI Codex instrumented the stores, ran the replays and checked the fenced readbacks and camera alignment. |
|
@KDenKC an in-world data point for the group-count conversion, on an RTX 3090. It is not a test of What was ported (patch 0029, credited to you, GPL-3.0-or-later):
Measured (the retail title, one run per row):
@jessenic ran this PR's change in their own tree on an RTX 5070 Ti: scene geometry whole in 3 runs of 3 with it, 0 of 3 without (#505, 7227706772). Not tested
Setup: MacieGx's lab AI use: Claude Code, model Claude Opus 5.5. It ported the change, ran the runs, read the logs and frames, and wrote this. The person running these tests asked for this post. |
|
Thank you @minimalhipster990, @CharlyRien (and @jessenic on #505). Added to #2610 and #3066.
AI use: Claude Code (Claude Opus 5.5). |
Part of a stack: EXEC masking of the last group follows in a second PR.
Related: #1751. The BVH rehydration passes it discusses (
RehydrateRaytracingAccelerationStructureBatched2X) are among the DispatchX calls this fixes. A step on the #1833 roadmap.DispatchX(x, y, z, flags)dropped its flags (list_x::dispatch_x). WithUSE_THREAD_DIMENSIONS(0x20; 0x8020 with the wave32 bit), x, y, z are thread counts: the console launchesceil(count / numthreads)groups and leaves the lanes past the count out of EXEC. XCL launched the counts as groups. That's 32–64× the groups, and past D3D12's 65,535 groups for a large enough count. On the retail title, the BVH builder's rehydration passes have no bounds check of their own, so every extra thread wrote outside the node array.The retail title calls it at world start. This PR's run logged it (127.7 s):
DispatchX with flags 0x20: 45x1x1andflags 0x8020: 1x1x1. Before this change the first launched 45 groups of 64 threads for 45 items.What PR 1 fixes on its own: the 32–64× group overrun and the 65,535-group overflow. Shaders that check their own bounds (the BVH builder's
DecompressHeaderandReloadTriangles) now run correctly.What it doesn't fix yet: the unguarded Box32 / Box16 rehydration still runs the last group whole, so it overruns by up to 63 lanes until the second PR masks them out of EXEC.
What is in it
crates/xcl/src/hle/d3d12x/list_x.rs:dispatch_xforwards its flags; a dispatch put off to the submit (Deferred::Dispatch) keeps them.crates/xcl/src/hle/d3d12x/bind.rs:dispatch_flags+dispatch_groups: with 0x20 the counts become whole groups of the pipeline's consolenumthreads.A pipeline whose group shape isn't known is skipped and counted (launching the counts as groups was the bug).
Each flags value is logged once.
The thread count of an axis that doesn't end on a whole group goes into
io.crates/xcl/src/gpu/recomp/mod.rs:IO_THREAD_LIMIT= io slots 114–116, written now, read by the compute prologue in the second PR. Slot 113 is left for D3D12.X: dispatches of more than 65 535 groups in X are folded into Y #1428.crates/xcl/src/gpu/recomp/pso.rs,hle/d3d12x/real.rs:compute_interfacegives the console'snumthreadswith the user SGPRs; it's kept per pipeline (pso_threads).Test
dispatch_x_with_thread_dimensions_launches_whole_groups.Tested
RTX 5090 32 GB (driver 621.24), Ryzen 7 9800X3D, Windows 11 Pro 26200, Rust 1.99.1; debug tests, release smoke builds. Base
main08db802.The new test fails with
main's behaviour (the counts launched as groups:left: Some(([640, 1, 1], …)),right: Some(([10, 1, 1], …))) and passes with the change.cargo test -p xcl --lib hle::d3d12x -- --test-threads=4: 254 passed, 0 failed, 2 ignored.cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4ona3e820d(
XCL_NETWORK=0): 1426 passed, 4 failed, 47 ignored over 37 test binaries. The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(CreateComputePipelineState0x8007000E, seeds70 / 545 / 1019 / 1507). They fail the same way on
main08db802(pre-existing, DXIL GPU fuzz tests reproducibly fail with E_OUTOFMEMORY on RTX 5060 #1905).--no-fail-fastbecause otherwise those 4 stop cargo before the integration tests.SKIPPED (26 lines): GPU tests or forms that need wave64 (no wave64 on this card); 3 f16/f32 forms the
per-lane lowering refuses (gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426);
heap_window_out_of_memory_falls_back_to_the_switch_form(no heapwindows);
pso_measurement_compiles_an_exact_synthetic_record(needs Developer Mode).Tested by others (thank you):
DispatchXcalls in a world run; the largest, x = 82,606, is launched by the unpatched tree as 82,606 groups (above D3D12's 65,535), and as 1,291 with the conversion. The character was whole in 3 of 3 runs with it, 1 of 3 without, with 0 removals. D3D12.X: a DispatchX with thread dimensions launches whole groups #2610 (comment)main(the failure this fixes): two rehydrationDispatchXcalls asking for 2,841 and 927 threads ran groups up to 206 and 161 (45 and 15 needed), and both wrote the same DWORD of a live skinning input page (ffffffffover1, then0). The group-count conversion here excludes both writers. D3D12.X: a DispatchX with thread dimensions launches whole groups #2610 (comment)nvidia-devaf2cecc4: by 72.4 s the title made at least 2,048DispatchXcalls with the0x20bit, e.g. 4, 29 and 65 threads on a 64-thread program (partial groups and the boundary above one group). D3D12.X: a DispatchX with thread dimensions launches whole groups #2610 (comment)main's 2,047, no removal; the title sends the 45-threadDispatchX(45x1x1 launched as 1x1x1 groups); suite 1,430 passed. D3D12.X: a DispatchX with thread dimensions launches whole groups #2610 (comment)a3e820dagainst its parent: whole suite 1429 passed / 1 failed (the same fuzz test on both); plus a GPU check that the groups run every wanted thread exactly once (e.g. 45 threads: 64 lanes, against 2,880 onmain). D3D12.X: a DispatchX with thread dimensions launches whole groups #2610 (comment)cargo test -p xcl --liball passed with the branch merged on currentmain.main: the new test passes;gpu_suite 165 passed / 3 failed (the lane's known baseline, not this PR). D3D12.X: a DispatchX with thread dimensions launches whole groups #2610 (comment)Regression run
main:This PR (
a3e820d):Both: the retail title,
-Seconds 200,XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1, the same scripted input to the world load, each on a copy of the same cache under a never-used exe name. Both stop presenting at the world load (cold whole forms of split compute programs, #2088), shortly after the DispatchX calls above.Not tested
The masking of the last group's lanes (second PR); until then the unguarded rehydration passes still overrun by up to 63 lanes.
Whether rendering with ray tracing improves: the title stops at world start for other reasons ([OFFICIAL] Swarm: cold PSO compilation to first playable frame #2088, NVIDIA: the device is removed when the pipelines in use need more than 512 MB of shader code (0x887a0005) #2403) before anything is drawn with these acceleration structures.
Indirect
DispatchX(XBOX_ARG_DISPATCH_X, GPU-written counts): still group counts; it needs a GPU pre-pass.The inline console-list record
0x4003_CC00(only withXCL_CONSOLE_LISTS=1): a separate PR.AMD and Intel GPUs, other NVIDIA cards.
AMD test wanted: this has not run on AMD. A run on RDNA2/3/4 would help:
cargo test -p xcl --lib dispatch_x -- --test-threads=4(the new test isdispatch_x_with_thread_dimensions_launches_whole_groups), and if you can,scripts/smoke.ps1on this head againstmain, plus theDispatchX with flagslog lines from a run that reaches the world.AI use
🤖 Generated with Claude Code