D3D12.X: execute two-pass mesh shaders on DispatchMesh and ExecuteIndirect #724
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!724
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/724/head"
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?
@Cattn on GitHub · 2026-11-24 04:06 UTC · original
Cattn:two-pass-dispatch-mesh→main· +462 −9 · 4 files · 1 commits · closed without mergingConsole mesh shaders translated to a two-pass pair (compute + mesh/PS,
TwoPassPso) were already built duringCreatePipelineState, but there was no execution path for them:DispatchMeshwas not hooked on the console command list vtable, andExecuteIndirectdid not run the compute pass or bind the record buffer (u1) before the mesh pass.What is in it
crates/xcl/src/hle/d3d12x/console_list.rs: track the console mesh root-argument layout (inline_msacross 16 SGPRs froms16with the spill table pointer ins[8:9]) viauser_data_ms, and recycle per-allocator two-pass record buffers onallocator_reset.crates/xcl/src/hle/d3d12x/device_x.rs: increate_command_signature_x, create a companionDISPATCHcommand signature alongside non-root-changingDISPATCH_MESHcommand signatures and register(sig, companion, byte_stride, mesh_offset).crates/xcl/src/hle/d3d12x/real.rs: hookDispatchMeshat console command list slot127(newer layout slot129) and addlist_devicehelper.crates/xcl/src/hle/d3d12x/bind.rs: implementdispatch_meshandTwoPassPsohandling inexecute_indirect: allocate/recycle aDEFAULT-heap UAV record buffer per command list, bindu0(io),u1(res),u2..u5(UMA), run Pass 1 compute -> UAV barrier -> Pass 2 mesh+PS -> UAV barrier, and scale indirectDispatchMeshgroup counts on the GPU whenmesh_groups_per_record > 1.console_list::tests::mesh_arguments_go_in_user_sgprs_from_s16andbind::tests::dispatch_mesh_signature_tracking_returns_companion_and_layout.Tested
rustc 1.93.1 (01f6ddf75 2026-02-11), debug for workspace tests, release for regression runs.cargo build --workspace && cargo test --workspace -- --test-threads=4on2624f00: 703 passed, 0 failed, 41 ignored.gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware.7f4b2c91past loading:128+two-passExecuteIndirect(DispatchMesh)calls executed cleanly and rendered 3D world geometry (streetlights, gantries, foliage) without device removal.Regression run
main:
PR:
Not tested
DispatchMeshor indirectExecuteIndirect(DispatchMesh)withmesh_groups_per_record > 1on a standalone GPU unit test (observed calls on title7f4b2c91hadsplit 1).DISPATCH_MESHcommand signatures (skipped as before).AI use
@lordon1a on GitHub · 2026-11-24 04:15 UTC · original
Independent test report on
2624f00:Tested
616.64, wave32, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200),rustc 1.100.0(x86_64-pc-windows-gnullvm), debug build, DXC1.9.2609.5(01b62ad4)cargo test -p xcl --lib hle::d3d12x -- --test-threads=110.65s(includingdispatch_mesh_signature_tracking_returns_companion_and_layoutandmesh_arguments_go_in_user_sgprs_from_s16)Not tested
xcl-smoke)AI use
2624f00in a detached worktree, audited the diff, ran the test suite, and posted this report.@thehollowedone on GitHub · 2026-11-24 04:28 UTC · original
Independent GPU readback for the split >1 indirect-argument scaler at
2624f00. Windows 11 build 26300, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11, debug build.A temporary synthetic fixture called the PR’s
make_scaled_args_bufferon 65 records with a 32-byte stride and a 64-byte source offset. With a split factor of 4, only mesh X changed. All 520 output words matched, and all 536 source words were unchanged. Both fresh runs passed (1 passed, 0 failed, 0 ignored, 0 skipped each) with zero D3D12 InfoQueue errors or corruption messages, first with the standard debug layer and again with GPU-based validation enabled.cargo test --offline --locked -p xcl --lib gpu_scales_padded_mesh_arguments_at_nonzero_offset -- --nocapture --test-threads=1This covers the argument scaler. End-to-end
ExecuteIndirect, rendered output, and retail gameplay were outside this test. AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the fixture and drafted this report.@MesshM on GitHub · 2026-11-24 04:39 UTC · original
Test run of
2624f00c4e2d8b87aa1828233fb2f60899eb9533on AMD RDNA4. I merged it onto currentmain64b3f35locally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 703 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 662 passed, 0 failed, 21 ignoredSKIPPED;gpu_mesh_mode_two_passes,dispatch_mesh_signature_tracking_returns_companion_and_layoutandretail_mesh_pipelines_through_the_hookpass; this adapter has mesh shaders, so the two-pass mesh tests ran for real rather than skipping.Review: The PR adds the missing execution path:
DispatchMeshon the console list andExecuteIndirectnow run the compute pass and bind the record buffer before the mesh pass, with per-allocator record buffers recycled on reset. At 471 lines I reviewed the structure, not every line; nothing stood out.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@badoomtch on GitHub · 2026-11-24 06:52 UTC · original
A retail data point for the
ExecuteIndirectargument path on Windows, RTX 5080. These were local builds based onaf20b4b38e5a, with code from #630, #304 and parts of this PR, a bounded two-pass implementation and extra resource-state checks. We ran withXCL_INDIRECT_MESH=1and the slot-24 remap enabled.The title created one pure mesh-dispatch signature and no mixed or root-changing signatures. In one run, our check withheld 1,450 calls before recording. The argument resource was a coherent console buffer in 1,074 cases and a sparse buffer in 376. In both groups the recording had no known native read state. This is a count from our guard, not a failure count for this PR.
In a separate run, reading from a verified alias of the same coherent backing allowed eight calls to be recorded. At the end, all eight scratch owners were still pending and no readback had retired. We therefore have no measured GPU acceptance, capacity drops or visible geometry from those eight. Reporting calls recorded, readbacks retired and GPU-side rejected records separately would make that distinction visible when testing this path on a title.
AI use: Codex (GPT-6) reviewed the local runtime reports and drafted this comment.
@NathanTheophile on GitHub · 2026-11-24 07:32 UTC · original
Review of
2624f00, from readingbind.rsand checking two points on the GPU. I'm interested because #529 (drawing the records with a VS on GPUs without mesh shaders) would build on this execution path.1. The record buffer is not sized to the dispatch, and root UAVs have no bounds check.
ensure_res_buffercaps the buffer at 128 MiB (bind.rs:321,.min(128 << 20)), andExecuteIndirectalways asks for 32 MiB (bind.rs:547). The compute pass writes recordgid.xwith no bound (emit.rs:4301). With the retail transform record of #304 (21 params + clip distance: 11,908 dwords, 47,632 B), 32 MiB holds 704 groups and 128 MiB holds 2,817. To check where the excess goes, I ran the NGG fixture ofgpu_mesh_mode_two_passeswith its record buffer as a 64 KiB placed resource and a zeroed buffer placed right after it in the same heap. 14 groups fit and left the next buffer untouched. With 20 groups, 101 dwords of the next buffer were overwritten, and the headers of records 15–19 (nv = 3, np = 1) sit exactly where they would fall past the end. In the runtime, that is whatever the driver placed after the record buffer.2. Indirect arguments with Y or Z > 1 lose groups. The direct path flattens
x·y·z(bind.rs:487-499), but the companionDISPATCHatbind.rs:549runs the title's(x, y, z)as given. The translated program, and the pass-through, index records bygid.xonly (emit.rs:4301,:4310for v5,:4670). Same fixture, compute pass only: with(2,1,1)the two records are group 0 (x0 = -1) and group 1 (x0 = 0). With(1,2,1), record 0 is group 0 and record 1 stays empty (nv = np = 0): the second group wrote record 0 again, as group 0. The mesh pass then draws record 0y·ztimes.3. Not run, from reading only: the 65,535 groups-per-dimension limit.
Dispatch(groups, 1, 1)andDispatchMesh(groups · split, 1, 1)put the whole count in X (bind.rs:496,:499), and the indirect scaler multiplies X by the split. ADispatchMesh(256, 256, 1)that is valid on its own becomesDispatch(65536, 1, 1). With #304's split of 7, any dispatch over 9,362 groups goes past the limit.I did not check 1 and 2 through the console-list hooks themselves, only with a direct D3D12 harness around this branch's translated compute pass. The probe is a temporary runner function and a test, and I can post it if useful. One possible direction: pass the record capacity (and the dispatch width, for a linear record index) to the compute pass in
io, skip groups past the capacity, and count the drops in the log.Tested: RTX 4060 Laptop GPU (driver 32.0.16.1687), i7-13650HX, Windows 11 25H2 (26200), Rust 1.100.0 MSVC, DXC 1.8.2502.11, debug.
2624f00plus the temporary probe:cargo test -p xcl --lib -- --exact gpu::recomp::tests::review_probe_724_records --nocapture, 1 passed. The probe was not committed.AI use: Claude Code (Claude Opus 5.5) read the diff, wrote and ran the probe, and drafted this review. Each point was checked by the user before posting.
@iggyvilla on GitHub · 2026-11-24 07:34 UTC · original
A test report on
2624f00c4e2d8b87aa1828233fb2f60899eb9533and a review of the diff, from an AMD RDNA2 (Navi 23) card. The head is still2624f00. Its merge base withorigin/mainisf4ce27ceb6d1b0576d0c659b713b674778bf1968— which is also the "main" commit of the PR's own smoke block — so I ran that base itself for the second half of the regression instead of thedd2ae9ablock on file.Tested
AMD Radeon RX 6650 XT (RDNA2, gfx1032), driver 32.0.21045.29003; AMD Ryzen 7 5700X (8C/16T), 31.9 GB RAM, Windows 11 Home 26H2 build 26300.9974; rustc 1.100.0 (
0ef1bc386 2026-11-09), cargo 1.100.0; noXCL_SAMPLE_*set.Detached, clean worktrees for head
2624f00and basef4ce27c; debug for the tests, release-p xclfor the smokes.cargo test --workspace --no-fail-fast -- --test-threads=4on2624f00(debug): 700 passed, 3 failed, 41 ignored, exit 101. This is the same test set as the NVIDIA and RDNA4 reports, which list 703 passed and 41 ignored: here the same 703 tests are 700 passed + 3 failed, with the same 41 ignored. This card's 3 known failures are:hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels— assertioncubemap extra_pages must be reused at same va(issue #470). Fails alone too (0 passed; 1 failed).hle::d3d12x::title_textures::tests::transitions_apply_when_their_list_is_submittedandhle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory— bothPoisonErrorfrom the #470 panic's lock; each passes alone (1 passed; 0 failed).No other test fails; the PR adds no failure.
No
SKIPPEDlines at this head on this card. The two tests the NVIDIA report lists as skipped (gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware,gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask) run and pass here, as dogpu_mesh_mode_two_passes(including its split=4 pass-through pixel comparison),gpu_mesh_mode_reads_memory_windows,mesh_split_wave64_form,retail_mesh_pipelines_through_the_hook, and the PR'sdispatch_mesh_signature_tracking_returns_companion_and_layoutandmesh_arguments_go_in_user_sgprs_from_s16.Targeted,
--test-threads=1:-p xcl --lib hle::d3d12x104 passed, 3 failed (the same three), 1 ignored;-p xcl --lib gpu_mesh2 passed;-p xcl --lib wave325 passed.Smoke with
XCL_NETWORK=0,scripts/smoke.ps1 -Game C:\games\retail -Seconds 60, head and merge base built release in their own worktrees, two pairs in the order below. All four runs: exit0x0, 0 device removals, 0 crashes.2624f00(first)f4ce27c(second)f4ce27c(third)2624f00(fourth)The 29-frame head/base gap of pair 1 does not reproduce when the order is reversed (4 frames, 1.3 %), so it follows run order/warm-up rather than the commit. All four runs are in the slow state this machine shows (270–320 frames), well below the 700+ of earlier sessions, so only the paired comparison is meaningful; there is no measurable regression and no crash, removal or exit difference.
Head block (pair 1):
Base block (pair 1):
Base block (pair 2):
Head block (pair 2):
Review
The shape is right: the console mesh root-argument layout is tracked per pipeline, the companion signature replaces only the 12-byte
DISPATCH_MESHargument with the 12-byteDISPATCHone soByteStrideis unchanged, both passes use the ABI root signature with its 6 UAV parameters (so writingu0–u5is in range), UAV barriers bracket the record buffer, and record buffers are held until their allocator resets. Points I would fix before this reaches a title with 8 GB of video memory:ensure_res_buffer(this, 32 << 20)(bind.rs:547) requests a fixed 32 MB DEFAULT-heap record buffer for every two-passExecuteIndirect, while the directDispatchMeshpath sizes fromgroups * record_dwords * 4(bind.rs:492).FREE_REScaches up to 16 buffers per device (bind.rs:55), so up to ~512 MB can sit idle on an 8 GB card plus one live buffer per command list. Size the request frommax * tp.record.record_dwords() * 4with the existing 4 MB floor (and a smaller cache); as it stands,max * record_dwords * 4 > 32 MBalready loses records (UAV out-of-bounds writes are dropped), and a size-from-maxrequest above the 128 MB cap would too, so clamp or split the call there.DISPATCH_MESHsignature that also carries a constant/CBV/SRV/UAV argument is root-changing, gets no companion (device_x.rs:1028-1045), and then falls throughbind.rs:543-581tobind.rs:583-602: because a two-pass PSO is in neitherTRANSLATED_GRAPHICSnorTRANSLATED_COMPUTE, that is the "PC pipeline" path, so it setsrs_gfxand runs the mesh signature without pass 1 having writtenres— stale/zero records rather than the "skipped as before" in the description. Iftwo_pass_of(pso).is_some()and the signature is not a known mesh one, skip with a warning instead ofpc().indirect_arg_bytesreturns0for unknown argument codes (device_x.rs:1001-1012) and only consoleDispatchX(105) is translated, so any other console code placed before theDISPATCH_MESHargument makesmesh_offsettoo small; withmesh_groups_per_record > 1the scaler then multiplies the wrong dword of every record and silently corrupts the following arguments. Make it return anOptionand only record the mesh signature when every preceding argument has a known size; otherwise do not scale (or skip with a log).DISPATCH_MESH_SIGSis keyed by the title's command-signature address, is never pruned, and the companion is never released (bind.rs:250-261,device_x.rs:1044-1045). If the title releases a signature and the runtime hands the same address to a new one, the new signature inherits the old companion/stride/offset (wrong signature executed; the companion also leaks). Release it with the signature, or key it by something stable.ensure_res_buffer/make_scaled_args_bufferdo aGetDevice+ QI + Release per growth/scaled call (bind.rs:326,bind.rs:460) — cache the device inState;scale_indirect_pipelinecompiles its HLSL with DXC synchronously on the first use (bind.rs:412), which can hitch the render thread mid-frame once; and the compute pass always assumes the measured MS convention (table pointer ins[8:9], inline froms16,bind.rs:369,console_list.rs:173) with no fallback whenlayout.inline_msis 0 while the root signature has parameters — a one-time log there would make a compiler whose user-SGPR count differs visible.Not tested
DispatchMeshwith a translated two-pass pipeline, and no indirectDispatchMeshwithmesh_groups_per_record > 1on the title; those paths are covered only by the GPU tests above, not end to end.XCL_SAMPLE_*/ real-shader sample runs, no long run (fps/VRAM decline), no Intel or other-vendor GPU, no release-build workspace tests (release was built only for the smokes), and the PR was not merged onto the currentorigin/main.AI use
opencode with DeepSeek V4.1 Flash (opencode-go/deepseek-v4.1-flash) built both worktrees, ran the full workspace suite, reran each failing test alone, ran the targeted groups and the two 60 s smoke pairs, and wrote this report and review. It made no code changes; every review point was checked against the diff at
2624f00.@raylitebull on GitHub · 2026-11-24 10:40 UTC · original
Great progress on two-pass
DispatchMesh/ExecuteIndirect, though a few blockers need addressing before merge: (1) bounds/clamping on the record buffer to prevent >32 MiB OOB writes on large indirect dispatches, (2) a shared/capped scratch buffer to avoid unbounded per-allocator VRAM growth, and (3) safe tracked-state transitions on indirect argument buffers.@oeirughrepuiohg on GitHub · 2026-11-24 13:00 UTC · original
Review and test report on
2624f00.1. The two-pass
ioblock never gets the UMA base.bind_two_pass_stagebuildsiofromuser_data_ms/user_data_gfx, resizes it toKERNEL_SGPRSwith zeros, and never setsio[IO_UMA_BASE_HI]. The normal binds do (bind.rsio[crate::gpu::recomp::IO_UMA_BASE_HI] = (u.base() >> 32) as u32, and the same inconsole_list.rs). The translated mesh-mode program loads it in its prologue (xcl_uma_base = io.Load(448u)in a dumped two-pass compute HLSL) and picks the memory window ashi - xcl_uma_base. With 0 there,xcl_w = hi - 0is 4–7 for every title address when UMA's base is at 16 GiB (base >> 32= 4 here), so every access falls into the accessors'defaultarm: the compute pass reads zeros and its stores are dropped, and the mesh pass draws records that were never written. One line fixes it:Tested (Linux, Wine/GE-Proton 11, vkd3d-proton with XCL's patch, RTX 4070 Ti 12 GB, NVIDIA 620.x;
x86_64-pc-windows-gnurelease build ofmain09940bb+ this PR + #684 and other open PRs we run; retail title, own copy):DispatchMesh, 8192+ExecuteIndirect(DispatchMesh)) and no MMU fault was seen in two runs; both runs still stall at the same point (a queue's 64-bit fence stops advancing), which we also see without this PR and do not attribute to it.XCL_PSO_WAIT_MS), not this PR.Not tested: Windows, AMD, the full test suite (the crate is built for Windows only; we run it under Wine).
AI use: Claude Code, Claude Opus 5.5 - found the missing field while debugging the world-load fault, wrote this comment; the runs are ours.
@Rodriguerra on GitHub · 2026-11-24 15:55 UTC · original
Two heads-up from testing two-pass Mesh Shaders rebased onto current
main(RTX 3060 12 GB):main(which addedIO_UMA_BASE_HI), make surebind_two_pass_stagealso writesio[crate::gpu::recomp::IO_UMA_BASE_HI] = (u.base() >> 32) as u32;— without it, two-pass MS + attached PS readxcl_uma_base == 0and return zeros for every UMA read whenu.base() != 0.translated_mesh_pso, skipping subobject14(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY) avoids0x80070057(E_INVALIDARG) rejections on retail MS pipeline streams.@ivall on GitHub · 2026-11-24 21:06 UTC · original
This is the piece #541 needs: at
maine9e94cenothing runs a two-pass pipeline.two_pass_ofhas no caller outside tests and one log line, andbind::execute_indirectsends such a pipeline down the PC branch with the title's root signature, sou1is not bound. I think that is the cause of the device removals reported on #541 (details there). So this should land before #541.What is open here, from the reviews above, before it can be merged:
main;io[IO_UMA_BASE_HI]inbind_two_pass_stage(@oeirughrepuiohg, @Rodriguerra): without it every unified-memory access of the pair misses its window;@Cattn, are you still on it? If not, say so here and someone can take it over with your commits kept. Splitting it would help the review, for example direct
DispatchMeshwith the bound first and indirect dispatch second.Not tested: I have not built or run this PR; the list is from its reviews and from reading
main.AI use: Claude Code (Claude Opus 5.5) read the code and the thread and wrote this, on the maintainer's behalf.
@PracticalStudios on GitHub · 2026-11-24 21:37 UTC · original
@Cattn are you still on the points @ivall listed above? If not, I can take them: rebase onto
mainand fix 2–5 as separate commits on top of yours (your authorship kept), tested on an RTX 3090 (wave32, mesh shaders). I'm starting now; if you're already on it, say so and I'll hand you the commits instead.AI use: Claude Code (Claude Opus 5.5) wrote this comment.
@PracticalStudios on GitHub · 2026-11-24 22:23 UTC · original · edited 2026-11-24 22:47 UTC
@Cattn @ivall the points above are done on
PracticalStudios/xclmesh/two-pass-execution: #724's commit rebased ontomain1d027e5(authorship kept), then one commit per point:d41d2f3the two-pass io block getsIO_UMA_BASE_HI;ee561d0groups stay inside the record buffer (ExecuteIndirect args are rewritten with X capped);ccfe5c1indirect Y / Z > 1 are folded into X;e284043the args are read through unified memory instead of transitioning the title's buffer; scratch is per-list 1 MiB blocks, 16 MiB per recording, reuse pool capped at 256 MiB;b718955one more test case;3442b58an ExecuteIndirect withmax > 1runs one command at a time (compute, then mesh), so commands no longer overwrite each other's records; commands past a count buffer's count get no groups.Each fix has a test that fails without it. RTX 3090 (wave32, mesh shaders), Windows 11, debug:
cargo test --workspace --no-fail-fast: 966 passed, 1 failed, 43 ignored. The failure (kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory) fails the same way onmainhere.Still open: two-pass ExecuteIndirect calls whose arguments are outside unified memory are skipped with a warning. Not tested: a title run.
Cattn, pull it into #724 if you like; otherwise I'll open it as a PR that supersedes this one.
AI use: Claude Code (Claude Opus 5.5, with Claude Sonnet subagents) wrote the code, the tests and this comment.
@veyn-sudo on GitHub · 2026-11-24 23:11 UTC · original
Measurements on the mesh shader's user SGPRs, for the rebased branch (
PracticalStudios/xclmesh/two-pass-execution, read at3442b58), from a retail title's shader pack:FIRST_SGPR_MS = 16is right, and none of them reads the table address thatuser_data_msputs in s8/s9.user_data_msstops at the arguments, so on this branch those registers are 0 and such a shader reads its descriptors from address 0 on. The pass-through draw's PS has the same gap, throughuser_data_gfxintwo_pass_io.Once #1803 and this have both landed, it should be a small follow-up: append
with_heapsin both cases oftwo_pass_io. I can send that PR with a test.Not tested: I only read the branch; I did not build or run it. The layouts are a sample of 40, not all of them. I have not run mesh draws in the title.
AI use: Claude Code (Claude Opus 5.5) made the measurements, read the branch and wrote this.
@cafeoh on GitHub · 2026-11-25 01:49 UTC · original
RTX 2080 Ti (Turing):
PracticalStudios/xclmesh/two-pass-executionat3442b58with #541, in a retail title. The mesh draws now run (2 000 to 10 000 draws per 2 s in the world, about 200 without them), but the scene's depth targets stay at their clear value, and the device is removed (0x887a0005) at 155 to 160 s in 3 of 3 runs (and at 152 and 249 s in 2 of 2 runs with #724's own head2624f00). Appending the heap addresses intwo_pass_io, as @veyn-sudo suggests, did not change either (1 run).Setup: RTX 2080 Ti 11 GB (32-lane waves), driver 617.14, Windows 10 19045, release. Retail 1.0.2.1. Tree:
main689f2db+ #684, #1053, #929, #1323, #1766, #640, #1329, #1732, #1405, #1464, #1102, #541 (6bd8f64), then3442b58; run 123 also #1803 (cb00751) andwith_heapsintwo_pass_io(MS and PS stage), plus local diagnostics and a local split of very long command lists (my comment in #505).XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_COHERENT_HEAPS=0 XCL_COHERENT_MB=512 XCL_UMA_SHADOW=1 XCL_PSO_WAIT_MS=50. Not a clean tree.What I looked at: a render-target dump at present (Palmwave's
XCL_RT_DUMP, ported locally), frames 930 to 945 of each run, which are in the world (the intro's credits are drawn over them):R32G8X24,R24G8), the 1024×4096 / 2048×2048 shadow depths and theR32G32_UINT/R32_UINTtargets hold one value; in run 122 one pixel of one depth target differs;0x887a0006) at 90 s, no dispatch open (XCL_GPU_CULPRIT)2624f000x887a0005at 249 s / 152 s3442b58instead0x887a0005at 155 s / 160 stwo_pass_io0x887a0005at 157 sAfter each removal the title stops at
int3+0x2474606, as in @Ariorh1337's run 51. In run 119XCL_GPU_CULPRITnamedcs 03e5007cf739d41d(1×1×1 groups) as the one dispatch not done; in runs 117, 120 it found none open.XCL_DRED=1stopped the title at 6 s (6 presents), so I have no fault address.Not tested: the test suite on this tree (the two-pass GPU tests pass alone,
--test-threads=1; with 4 threads one failed and others skipped, which I have not looked into); AMD; a cleaner tree; more than one run per row.AI use: Claude Code (Claude Opus 5.5) merged the trees, ran the runs on this machine, read the dumps and wrote this comment.
@CharlyRien on GitHub · 2026-11-25 02:45 UTC · original
RTX 3090 (Ampere, 32-lane waves),
mesh/two-pass-executionat3442b58with #541 in a retail title: same picture as @cafeoh above, plus where it stops. The mesh draws run, but in every non-empty record the compute pass has written (vertices, primitives) = (1, 1), occasionally (2, 2), so the pass-through has nothing to rasterise. Most indirect mesh draws also arrive with 0 groups.Setup
main689f2dbmerged locally with #1329 (+ #1326, #1327), #1448, #1323, #889, #684, #929, #640 (ported), #1850, #765, #1982, #1405, #1464, three allocator-lifetime commits fromwondercrash/xcl(150e635,761ada5,9b70233), then #541 (6bd8f64), the rebased #724 branch at3442b58, #1887 and #1803, plus local diagnostics (counters, a capture of each ExecuteIndirect's argument records and of the two-pass records as the calls read them, target dumps) and a local readback change insparse.rs(one fence per title queue, see #1329). A local switch refuses the mesh pipelines again for the "off" arm on the same build.XCL_UMA_SHADOW=1 XCL_HEAP_WINDOWS=1 XCL_NETWORK=0 XCL_ACTIVITY=1, noXCL_PSO_WAIT_MS(nothing skipped), compute pipelines the title uses prebuilt with--precompile --used-only. The title's own stall watchdog is neutralised locally. WindowsTdrDelay30 s.What the title asks for (pipeline streams logged as it passes them): sub-object 24 holds the console container, there is no sub-object 25 and no VS. The container is a single NGG hardware stage with a mesh interface: 128 threads, at most 128 vertices and 128 primitives, 7 vertex outputs. No amplification stage. Without #541 XCL refuses 6 685 distinct ones in a run (the log cap of 40 hides that). The title issues them both ways: direct
DispatchMesh(console slots 127 / 129) and ExecuteIndirect with one signature of stride 12; it does not use argument type 107 here.A/B on the same build, 600 s runs
Where it stops (one more run, two world frames captured)
So two separate things keep the depth empty here:
InstanceCount0 and most indirect dispatches with 0 thread groups in these frames (with or without the mesh pipelines). That is upstream of this PR.Not tested: AMD, native 64-lane waves, #1984, #1936 / #1937 (no pipeline was rejected at creation here), the GPU time of the two passes (not timed by my markers).
AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the merges, the captures and the runs) did this and drafted the report.
@CharlyRien on GitHub · 2026-11-25 03:44 UTC · original
Follow-up on the (1, 1) records from my comment above: it is the SGPR base of the mesh stage's root arguments, not the translation. With the title's most common root signature the arguments land one register too late with
FIRST_SGPR_MS = 16, so the program reads the wrong descriptor table. The binding looks per shader, from metadata in the container, rather than a fixed base.Same setup as above (RTX 3090,
main689f2db+ the stack listed there + #541 + this branch at3442b58+ #1887 + #1803).What the title's mesh programs compute (three bound programs read from their translated code): the program takes a 32-bit descriptor table from
s17; slot 0 of that table is the meshlet buffer; it reads the entry at16·group + 12and sendsvertices = (entry & 0x7F) + 1,primitives = ((entry >> 7) & 0x7F) + 1withs_sendmsgGS_ALLOC_REQ, from thread 0 only. No bit count, ballot or compaction is involved (v_mbcntonly appears with −1, as the lane index), and the GS_ALLOC_REQ decode inemit.rsis right. (1, 1) simply means the entry read as 0.Offline: the real program, run in the split-wave64 compute pass on the GPU with inputs I control, writes exact counts: (64, 100), (32, 50), (128, 128). So the translation and the two-pass compute are fine for it.
In the title
s17has a 128-byte block of float 1.0 in slot 0: per-draw constants, not the meshlet buffer. 1.0f gives count 0, entry 0, hence (1, 1).[table, table, table, root SRV, 2 constants]. Starting the arguments ats16puts the second table ins17and the third table plus the low half of the SRV address ins[18:19], which the program uses as one 64-bit address. Starting ats15givess17= third table ands[18:19]= the SRV address, which is what the code expects. The other 6 binds are[table, table, root SRV, 2 constants]and fits16.s3ands16–s24are read): both bases satisfy it, the difference is which root argument lands ins17ands[18:19].0x10904; types0x300and0x302, which I read as table and descriptor; descriptor offsets0x18against0x20). So the mapping of root arguments to SGPRs is probably described per shader there. I have not decoded it.Tried:
FIRST_SGPR_MS = 15as a blunt experiment (plus a unit test with this layout, and a GPU test that runs the real program throughuser_data_ms: (1, 1) with 16, real counts with 15). In the title, for the first time records carry real counts (292 records between 1 and 128 in three frames, e.g. (128, 120) ×42, (98, 86), (126, 120)), but (1, 1) is still the majority, and the other layout is now the broken one (136 of 1 200 probed binds get the SRV's high word ins18). So a fixed base cannot be right for both; it needs the per-shader binding.And one more wall behind it: the root SRVs of these draws point at addresses with high words
0xe,0x12,0x13, outside every unified-memory window on this tree (the windows cover high words 1 – 4 here). That is the situation of issue #697 (the title's large 64 KiB-page reservations fall back to plain memory, buffer views there get an empty V#, root views read 0), so the vertex data would not be readable even with the right counts. Nothing reaches depth yet.Not tested: depth coverage with the experiment (the run ended in a device removal at 134 s, before the dumps; one run, so I cannot say the change caused it), AMD, the 0x10904 decode.
I can post the two tests and the probe if useful.
AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the code reading, the offline reproduction and the runs) did this and drafted the report.
@PracticalStudios on GitHub · 2026-11-25 03:47 UTC · original
Opened as #2092 so the branch above can be reviewed and merged: this PR's commit (authorship kept) + the five review points + the shared-heap bind fix, rebased on
main, with the suite and a smoke pair. @Cattn, if you'd rather pull the commits into this PR, say so and I'll close #2092. The (1, 1) records @cafeoh and @CharlyRien found are listed there as not fixed.AI use: Claude Code (Claude Opus 5.5) wrote this note.
@CharlyRien on GitHub · 2026-11-25 05:00 UTC · original
Correction to my follow-up above:
FIRST_SGPR_MS = 16is right, and my "one register too late" reading was wrong. The container states the placement per stage, I have decoded it for every stage of the title's shader pack, and it agrees with XCL's packing of the root arguments everywhere. What the mesh programs are missing is the descriptor-heap base addresses after the arguments (s23/s24for the most common layout).Setup: offline only. A standalone Python decoder over the retail title's shader pack (no XCL code involved), plus
xcl disasm(a build ofmain689f2dbwith the stack of my first comment; the disassembler is not affected by it) on three mesh programs to check registers against code. No run of the title is behind this comment; the in-title check is running now and I will add its result.The per-stage table (the metadata I had not decoded; the tag
0x10904I quoted is the tail of one of its entries)u32 type | u32 offset in the table (dwords) | u32 user SGPRs | u32 base register | u8 first user-data dword | u8 root slot | u16 0. Types seen: 0 constants, 1 root descriptor, 3 descriptor table (one entry per range), 4 static sampler, 5 view-heap base, 6 sampler-heap base; nothing else in 5.2 million entries, and the last two bytes are always 0.u8 kind (0 SRV, 1 sampler, 2 CBV, 3 UAV) | u8 root type | u16 0 | u32 table offset | u32 | u32 | u8 descriptor dwords | u8 first user-data dword | u8 root slot | u8 0. For every non-sampler entry its (root type, dword) equals the root-layout entry of the same slot: 0 mismatches in 445 625 entries.s(i)in compute,s(i + 8)in mesh programs (checked against the disassembly of two programs), and VS / PS start at dword 8.victory-shader/src/native.rs, GPL-3.0) as a reference; no code was taken, and the byte layout above was worked out from the data by a decoder written without its source.What the tables say about XCL
s16in mesh programs) and the rest follow contiguously with no even alignment for root descriptors. XCL's packing gives the same register for every argument of every stage: 0 differences. No mesh stage starts ats15.The most common mesh layout, register by register (root signature
[table, table, table, root SRV, 2 constants], 87 % of the mesh stages)s16s17s18s[19:20]s21,s22s21 & 0x3ff= a descriptor indexs23s23 + index × 32s24With base 16 everything is right except
s23/s24, which stay 0. With my base 15 every argument is off by one.Why my experiment looked right: the probe and the GPU test read
s17ands[18:19]the way the 4-slot programs do ([table, table, root SRV, constants], 18 stages, no heap base) and applied that to binds of the 5-slot layout. For that pairing 15 does line things up, but the tables pair the 5-slot layout with other programs, which reads[19:20]ands23. The 54 / 6 split I reported is just the split between the two layouts. The "real counts" I saw in the title with 15 are not explained by this and should not be read as a sign that 15 is right.Inferred, being checked in the title now: that the (1, 1) records of the 5-slot programs come from
s23 = 0(the meshlet data is reached through a V# taken from the view heap by index).One thing for #1803 from the same tables: 1 735 stages use only the sampler heap (1 176 pixel, 417 vertex, 128 mesh, 10 compute, 2 + 2 others) and expect its base right after their arguments. If their root signature also has the view-heap flag, a flag-based rule puts the view heap there. That may be the 102 pixel pipelines that "do not take m0 from after the arguments"; I could not match them offline (the pack has no pipelines). The per-stage table would settle which heaps a stage wants.
I can post the decoder (about 300 lines of Python) if useful.
AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the decoder and the cross-checks) did this and drafted the comment.
@CharlyRien on GitHub · 2026-11-25 05:16 UTC · original
In-title result, as promised: the explanation I inferred above is wrong on my tree. With base 16 the two-pass compute pass does get the heap bases in
s23/s24, and the records are still (1, 1). So base 16 stands (the tables say so), but missing heap bases are not what keeps the counts at (1, 1) here.Setup: same tree as my first comment above (
main689f2db+ the stack listed there + #541 + this branch at3442b58+ #1887 + #1803), with two local additions: the two-pass compute pass takes #1803's heap addresses (with_heapsoveruser_data_ms, a few lines; neither this branch nor #1803 does that alone), and a switch for the first register, set to 16 for this run. Release,XCL_UMA_SHADOW=1 XCL_HEAP_WINDOWS=1 XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_GPU_WAIT_RELEASE_MS=250, warm caches; local switches as before (the title's own stall watchdog neutralised, compute programs of 4 MB of DXIL or more not handed to the driver). RTX 3090 24 GB (driver 616.56), Windows 11 22631,TdrDelay30 s. One run, world reached at about 85 s, numbers from one frame at 113 s.Measured
s16–s22hold the arguments,s23the view-heap address ands24the sampler-heap address. That is the placement the per-stage tables give.DispatchMeshcalls; 1 192 × (0, 0) in indirect calls whose records were never written; 2 × (2, 2); no other counts.So: with the registers as the console compiler states them, the 5-slot programs still read a zero meshlet entry. What is left between the registers and the entry is the V# they load from
s23 + index × 32(what the view-heap slot holds for that index) and the buffer it points to. My earlier note that the root SRVs of these draws point outside the unified-memory windows (#697) still applies to the vertex data; whether the meshlet buffer behind that heap slot is in the same situation is the next thing I will measure.For this PR and #2092 that leaves two concrete points: keep
FIRST_SGPR_MS = 16, and pass the heap addresses to the compute pass once #1803 is in. Neither is enough for the title on its own.Not tested: the unit test for the 16 + heaps layout (written, not run); base 15 without heap bases gave the same picture in one run that the memory guard cut short, so I do not count it.
AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the code reading and the runs) did this and drafted the comment.
@JJAutoCompare on GitHub · 2026-11-25 06:18 UTC · original
Empirical test report (
2624f00c)Hardware / environment
2624f00c4e2d8b87aa1828233fb2f60899eb9533, tested from a clean detached worktree.32.0.101.9175, and AMD Ryzen 7 3800X. Windows build10.0.26200.9974.1.100.0 (0ef1bc386 2026-11-09), hostx86_64-pc-windows-msvc. DXC and DXIL1.9.2609.5. Unoptimized test profile with incremental compilation and debug info disabled.Commands and results
cargo test --workspace --no-runexited 0 and built 16 test executables. This step only compiled the tests.xcl-00e28da3621caf64.exe --exact hle::d3d12x::bind::tests::dispatch_mesh_signature_tracking_returns_companion_and_layout hle::d3d12x::console_list::tests::mesh_arguments_go_in_user_sgprs_from_s16 --test-threads=1withXCL_ADAPTER=NONE_CPU_ONLY, outside the Arc wrapper. Exit 0. 2 passed / 0 failed / 0 ignored / 0 skipped.xcl-00e28da3621caf64.exe --exact gpu::recomp::tests::gpu_mesh_mode_two_passes --test-threads=1insideInvoke-ArcTest.ps1, withXCL_ADAPTER=A770. Exit 0. 1 passed / 0 failed / 0 ignored / 0 skipped.RUST_TEST_NOCAPTURE=1. Skip counts use case-sensitive^SKIPPEDlines in the captured output.Observed behavior
The new CPU tests verified companion signature and layout tracking, and mesh inline arguments starting at
s16with the table pointer ins8:s9. The existing GPU test checked compute-generated records, expected triangle pixels and clear pixels, and identical rasterization with split mesh output.Not tested
The GPU test uses the recompiler harness. The PR's console
DispatchMeshandExecuteIndirecthooks, including indirect argument scaling, were not directly exercised on the GPU. The full GPU workspace suite and game smoke runs were omitted.AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr724-focused.log and published.
@DavidM1911 on GitHub · 2026-11-25 11:38 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.@pickles976 on GitHub · 2026-11-25 17:44 UTC · original
RTX 4060 Laptop / Wine verification of the current PR logic (ported onto a local integration tree, not a clean PR-head run):
mesh_arguments_go_in_user_sgprs_from_s16: 1 passed / 0 failed.dispatch_mesh_signature_tracking_returns_companion_and_layout: 1 passed / 0 failed.gpu_mesh_mode_two_passes: 1 passed / 0 failed on the RTX 4060 through Wine/vkd3d-proton; the test rendered the expected split mesh output.I then ran the retail title with #541 and this PR ported together. A 7.5 GiB VRAM guard stopped it at 120.6 s (
7,614 MiBGPU,2,797 MiBsystem RAM available). It reached frame 2420 at 25.9 fps over the last 300 frames, but the captured frame was still loading artwork, not the world. No crash, device removal,E_OUTOFMEMORY, or two-pass error appeared. I saw no two-pass execution log in this interval, so the title run does not prove that the title exercised this path; the GPU unit test is the direct execution evidence here.Hardware/runtime: NVIDIA GeForce RTX 4060 Laptop GPU 8 GiB, driver 590.48.1, Linux 6.17, Wine 11, vkd3d-proton 2576c0b4, DXC 1.9.2609.5, Rust 1.98.1 MSVC cross-build. I used OpenAI Codex (GPT-5.6 Sol) to port the conflicting PR, run the tests/title, and inspect the logs and captured frame; I reviewed this report before posting.
@CalvyPZ on GitHub · 2026-11-25 22:36 UTC · original
This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
Pull request closed