D3D12.X: two-pass indirect commands with groups D3D12 forbids run nothing #3056
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3056"
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 Kalmarv on 2026-11-27T18:15:31Z.
For every indirect two-pass ExecuteIndirect (
make_scaled_args_buffer), the pass that rewrites an ExecuteIndirect's arguments (SCALE_ARGS_HLSL) clamped every command's groups to the record cap. So a command whose groups D3D12 does not allow for DispatchMesh (a dimension over 65,535, or over 2^22 in all) still rancapgroups of the compute pass andcap×splitmesh groups over records nothing wrote, and reported an uncappedraw_nto GPU feedback. Such words are not a count the title can mean; those commands now run no groups in either pass (raw_n = 0,n = 0). Legal counts run exactly as before.This changes one internal shader, not the translated-program cache, so it stands alone. It does not claim to be the cause of any hang: counts D3D12 forbids are simply not run.
What is in it
crates/xcl/src/hle/d3d12x/bind.rs:SCALE_ARGS_HLSLgives a command 0 groups (andraw_n = 0) when x, y or z > 65,535 or x·y·z > 2^22 (x·y fits 32 bits after the per-dimension test; z is tested against 2^22 / (x·y), so no product overflows).gpu_indirect_two_pass_counts_d3d12_forbids_are_not_run: 11 commands (cap 1000, split 2), each over-limit form runs 0 groups in both passes, the limits themselves (65,535 × 64, 2^22 exactly) and small counts run in full (including a rejected command between live commands 7 and 9 preserving their identities).gpu_indirect_two_pass_groups_go_in_x: its case of 70,000 per dimension is now a legal 60,000 × 60 × 1 (same expectations), since 70,000 is now rejected.Tested
3edfb048onmain227d2cb3(NVIDIA GeForce RTX 5070 Ti, driver 610.74, Windows 11 Pro 26200, DXC 1.9.2609.5, debug):cargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 2,596 passed, 0 failed, 49 ignored across all 41 test binaries, 26SKIPPED:no wave64(RTX 5070 Ti is wave32 hardware:gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole, 4recomp::lowerwave64 tests, 14recomp::lower_dxilwave64 tests,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware)#1426semantics (f16_programs_on_the_gpuarithmetic/packed,f32_programs_on_the_gpuconversions)no heap windows (opt-in: XCL_HEAP_WINDOWS=1)(two_pass_binds_set_the_shared_view_heap,heap_window_out_of_memory_falls_back_to_the_switch_form)gpu_indirect_two_pass: 4/4 passed, 0 skipped;gpu_scale_args_reports_uncapped_group_count_feedback: 1/1 passed, 0 skipped) also passed under Windows SDK DXC 1.7.2308.9cb19274(pre-rebase onnvidia-dev): DarkPanda69 ran9cb19274on AMD RX 9070 XT and NVIDIA RTX 3060 (62/62 passed, 3 of 3 runs each).Regression run
Paired 150 s retail smoke runs on RTX 5070 Ti (warm
PC-SBMcache,XCL_UMA_WINDOWS=16,XCL_HEAP_WINDOWS=1,XCL_DRED=1,XCL_DIRECT_DXIL=all,XCL_DIRECT_SPLIT_INSTRUCTIONS=0, DXC 1.9.2609.5,XCL_PSO_JOURNAL=0).mainexited0x0with a 0 B minidump (crashes: 1); head3edfb048exited0x0with 0 crashes and 0 device removals.main(227d2cb3):PR head (
3edfb048):Not tested
3edfb048; Intel; Wine; opt-inXCL_HEAP_WINDOWS=1unit tests.AI use
9cb19274).main(227d2cb3->3edfb048), kept illegal counts atraw_n = 0for the GPU feedback path, ran the full workspace test suite and paired 150 s retail smoke on3edfb048, and updated this description.Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-27T20:11:57Z.
AMD run (listed as untested), with an RTX 3060 in the same PC: the new GPU test passes on both.
Tested: pass, head
9cb1927applied on its basenvidia-devd1be810, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, card picked withXCL_ADAPTER(Radeon/3060; the existing pooled-scratch test logsPOOLED_SCRATCH_ADAPTER=with the right card each time, but I didn't check which device helper the new test uses).cargo test -p xcl --lib -- hle::d3d12x::bind hle::d3d12x::alloc_pool --test-threads=4 --nocapture, 3 runs each:nvidia-devalone 61 passed.The only result change on both cards is
gpu_indirect_two_pass_counts_d3d12_forbids_are_not_run, ok. SKIPPED is the same with and without the PR:two_pass_binds_set_the_shared_view_heap(no heap windows).Not tested: a world run with
XCL_TWO_PASS_BATCH=2, Intel, release.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T00:30:47Z.
merge-check claim
head:
9cb1927436Imported from ivall/xcl. Originally posted by akimfomin on 2026-11-28T00:56:21Z.
PortBridge confirmed the
9cb1927conflict with currentnvidia-devba9d1f9incrates/xcl/src/hle/d3d12x/bind.rs. The 25,000-input CPU model comparison of the dimension/product guard matched a wide-integer reference. Continued #2523 suggests one different control for the rebased GPU fixture: put a rejected dispatch between two live ones and verify both live commands keep their identities, and the rejected one neither runs nor advances the next live slot. That complements the existing zero-group checks.Exact comparisons and controls. If this workflow is useful, your team or agent can send the next public PR URL, target SHA, and behavior to preserve via PortBridge #98. No install is needed.
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T01:14:24Z.
merge-check
base:
f8de0bf4(nvidia-dev at the time of the run; the branch has moved toba9d1f94since and GitHub now shows this PR as conflicting)head:
9cb1927436merge: clean on
f8de0bf4; conflicts on the current branch headbuild: cargo build --workspace -> ok (on
f8de0bf4)tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1834 passed, 8 failed, 48 ignored (27 SKIPPED lines); the 8 failures are the base's own on this GPU, the same six names with and without the PR
review: the arithmetic is right (the product cannot overflow after the per-dimension check) and the new test's expectations check out; it fails without the change. Two things to fix or decide: (1) the description says the change applies with XCL_TWO_PASS_BATCH=2 only, but the scaling shader it changes runs for every indirect two-pass ExecuteIndirect (make_scaled_args_buffer); (2) behaviour: before, a command with a group count D3D12 forbids was clamped to the cap in both passes; now it draws nothing. For a garbage count that removes stray work; for a count the console would honour it removes geometry that used to be drawn in part. I could not check the console's limits.
performance: a few ALU operations per command; the internal shader compiles once more (reasoned).
verdict: not yet: rebase on the current nvidia-dev (conflict) and correct the description; then I will rerun.
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-28T23:29:19Z.
Rebased onto
main(227d2cb3->3edfb048) after the #3203 merge and updated the description per @throny's review (applies to every indirect two-passExecuteIndirectthroughmake_scaled_args_buffer, not justXCL_TWO_PASS_BATCH=2). Onmain's GPU feedback path (9ae803e3), illegal counts also stay atraw_n = 0so they do not report bogus uncapped counts.Targeted GPU tests on
3edfb048(RTX 5070 Ti, debug, Windows SDK DXC 1.7.2308):gpu_indirect_two_pass: 4 passed, 0 failed, 0 ignored, 0 skippedgpu_scale_args_reports_uncapped_group_count_feedback: 1 passed, 0 failed, 0 ignored, 0 skippedNot run yet on
3edfb048: full workspace suite and refreshed exact-head smoke pair.AI use: Antigravity (Gemini 4 Neon) rebased the branch, ran the targeted GPU tests, updated the PR body, and posted this comment.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T00:20:40Z.
Updated PR description with full workspace test suite and paired exact-head 150 s retail smoke on
3edfb048(RTX 5070 Ti, DXC 1.9.2609.5):cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 2,596 passed, 0 failed, 49 ignored, 26SKIPPED(21no wave64, 3#1426per-lane refusals, 2no heap windows).ea3b5e4d):main227d2cb3= 2,914 frames / 32,755 MB peak commit vs head3edfb048= 3,550 frames / 33,626 MB peak commit, 0 crashes, 0 device removals.scripts/pr_check.py --local:description ok.AI use: Antigravity (Gemini 4 Neon) ran the workspace test suite and paired smoke, updated the PR body, and posted this comment.
Imported from ivall/xcl. Originally posted by throny on 2026-11-29T00:30:00Z.
merge-check claim
head:
3edfb048d8Re-check of the head rebased onto main.
Imported from ivall/xcl. Originally posted by throny on 2026-11-29T00:46:57Z.
merge-check
base:
fa204595head:
3edfb048d8merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2609 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at
fa204595: 2608 passed, 0 failed, 49 ignored.review: re-check of the rebased head. Both points of my earlier check are answered: the description now names every indirect two-pass ExecuteIndirect through the scaling pass, and the conflict is gone. The code sits on main's feedback shader now: counts that are not legal give a raw count of 0, otherwise the product, which cannot overflow after the per-dimension check; such a command reports the value the existing code already treats as culled. One decision stays with the maintainers and is not a defect: forbidden group counts used to be clamped and now draw nothing, on the argument that such words cannot be a count; nobody has checked the console's limits.
performance: none. No translator source.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-30T02:40:00Z.
NVIDIA and AMD full-suite run of head
3edfb048, on its own base227d2cband merged with currentmain53e85fb1, to go with the reports above by throny, since none of them covers AMD. Nothing here fails because of this PR. On the Radeon the lib test binary stops partway on this base and onmainalike (#3488), so the AMD runs are partial. The bare-head runs come first.Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace --no-fail-fast -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::bridged_dpp_agrees_with_hlsl_on_the_gpu --skip hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap --skip gpu::dxil::fuzz_tests: 2583 passed, 0 failed, 47 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,dispatch_chain_native_wave64_builds_whole,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.XCL_ADAPTER=radeon),cargo test --workspace --no-fail-fast -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 --skip two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs: 138 passed, 0 failed, 20 ignored, incomplete: thexcllib test binary stopped itself partway (exit code0x80004005, aftersparse upload preparation still failed after bounded retries), so most of its tests did not run. That stop comes from #2959 onmainand is not this PR's: #3488.--skipleaves out tests that fail on main53e85fb1too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh,bridged_dpp_agrees_with_hlsl_on_the_gpu(no wave64 on this card) andtwo_pass_binds_set_the_shared_view_heap(heap windows are opt-in,XCL_HEAP_WINDOWS=1) fail the same way;gpu::dxil::fuzz_testsstays skipped as in earlier runs (seeds 70, 545, 1019 and 1507 failedCreateComputePipelineStatewithE_OUTOFMEMORYon this card; they passed on this main's baseline). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6).two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobsfails on main too, since #2959 (#3441). The AMD run does not setXCL_REQUIRE_GPU.main53e85fb1(git merge --no-ff, clean, local only), same commands and skips. NVIDIA: 2779 passed, 1 failed, 47 ignored; the one failure isconcurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, which fails onmainitself since #2369 (already reported there: https://github.com/xcl-dev/xcl/pull/2369#issuecomment-7264263758). AMD: 138 passed, 0 failed, 20 ignored, incomplete: the same #3488 stop, and before itgpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form(new onmainwith #3263) fails the same way on baremain53e85fb1.main53e85fb1on both cards, same commands without skips, for comparison: NVIDIA fails the skipped tests plus the #2369 test; the Radeon stops at the same place.Not tested
AI use
Imported from ivall/xcl. Originally posted by AAsobu on 2026-11-30T19:26:45Z.
merge-check claim
head:
3edfb048d8Imported from ivall/xcl. Originally posted by AAsobu on 2026-11-30T19:49:35Z.
merge-check
base:
ff0c364b3dhead:
3edfb048d8merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2890 passed, 0 failed, 51 ignored; SKIPPED: 28 (22 no wave64, 2 no heap windows, 3 no D3D12 debug layer / d3d12SDKLayers.dll, 1 no GPU_UPLOAD heaps); failing: none. In the full run the
gpu_compute_e2ebinary hung (4 tests "running for over 60 seconds", one thread waiting on a compute pipeline still being built, GPU idle) and I killed it after ~5 min; rerun alone on the same tree it passed 9/9 twice (5-6 s). Those tests do not useSCALE_ARGS_HLSL, and the same binary passed in my earlier runs of other PRs on this machine, so I count it as an intermittent hang, not this PR's; the counts above use the rerun for that binary.review: none. Read the whole diff (+33/-7,
crates/xcl/src/hle/d3d12x/bind.rs): the legality test cannot overflow (x, y <= 65,535 so xy fits 32 bits; z is compared with 2^22 / (xy), guarded for 0), legal counts give the sameraw_n/nas before, and the removed saturating product is no longer needed because a legal product is at most 2^22. The new test's expectations match those limits (40961025 and 204820482 rejected, 65,53564 and 64641024 kept).gpu_indirect_two_pass_counts_d3d12_forbids_are_not_runand the existinggpu_indirect_two_pass_*tests pass here.performance: by default only a few more integer compares per command in the args pass; nothing measurable expected. Retail title on this machine (one run, release,
XCL_PREPARE=0 XCL_DIRECT_DXIL=1 XCL_PSO_WAIT_MS=1000 XCL_TEXTURE_LEVEL_PAGES=1 XCL_HUGE_PSO_CONCURRENCY=4 XCL_HUGE_PSO_WANTED_CONCURRENCY=4 XCL_DXC_THREADS=4 XCL_NETWORK=0 XCL_DRED=1, warm caches): loading normally (up to 1761 draws / 3756 dispatches per 2 s at 120 s), then a device removal (0x887a0005) at 250 s during a pipeline-build stall, DRED page fault at GPU VA 0x0, allocations[], device state 0, no breadcrumbs; system commit 53.8 of 66.2 GB. The last 24 recorded operations were all plain computeDispatch, no two-pass work. This is not this PR's:mainalone (abec7ce9) was removed the same way at 188 s, andmainff0c364b+ #3052 at 816 s and 300 s. On this machine every tree afterd52ff48chas had this removal (5 of 5 runs), whiled52ff48cran ~10 min in the world without it (one run only), so #1355 / #1221 (merged in between) may be worth a look for #2920.verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 3090 24 GB (driver 621.24, wave32 only), Intel Core i5-10600K, 32 GB, Windows 11 Home build 26300, rustc 1.100.0 / Claude Code (Claude Opus 5.5), results checked by me
Imported from ivall/xcl. Originally posted by AAsobu on 2026-12-01T00:01:36Z.
Correction to my report above, about the device removal it mentions (0x887a0005, DRED "page fault at GPU VA 0x0", no breadcrumbs): on this machine it was most likely NVIDIA's 512 MB shader-heap limit (#2403), not a bug of
mainand not a regression range.xcl nvprofile status(from #2590) showed thatxcl.exehad no profile here, so the driver's default 512 MB applied. #3277 had the same signature and timing on another RTX 3090 and it went away with the profile.mainff0c364btwice, #3528 twice) stayed in the world for ~220-270 s with no removal, where before 13 of 13 runs past the loading screen lost the device, at 143-816 s from start (5-50 s after world entry in the 8 runs where I timed it).d52ff48c(a run without the removal, "a possible regression range"): that one run most likely just had less shader code in use.Hardware: NVIDIA GeForce RTX 3090 24 GB (driver 621.24), Intel Core i5-10600K, 32 GB, Windows 11 Home build 26300. Tool and model: Claude Code (Claude Opus 5.5), results checked by me.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:34:37Z.
merge-check
base:
7d86c5d2b7head:
3edfb048d8merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2897 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (bind.rs). An indirect two-pass DispatchMesh command with a dimension over 65,535 or more than 2^22 groups in all used to run
capgroups and now runs none; legal counts behave as before. Findings: (1) rejected commands are never counted or logged:indirect_guardreports the counts it zeroes, but this check (~3141 after the merge) is silent, so missing geometry wouldn't show in any log; and the 2^22 limit is hard-coded instead ofindirect_guard::max_groups()(XCL_INDIRECT_MAX_GROUPS). (2) A direct two-passdispatch_mesh(~3411) still runs the same counts, cut to the record buffer, so direct and indirect calls now disagree. (3) The description says the mesh pass ran "over records nothing wrote", but the compute pass runs the samengroups the mesh pass reads (dst.Store3(d + offset, n)), so those records were written; nothing shows what the console does with such counts. (4) The PR's smoke runs used non-default settings (XCL_HEAP_WINDOWS=1,XCL_DIRECT_DXIL=all, ...). The PR's CI failures (fourpipeline_library/warm_librarytests, a race since fixed on main) don't appear in the run above. Fine: the check can't overflow (x*y fits in 32 bits; z is compared by division), the new GPU test fails without the fix and skips without a GPU, the deferred path (defer_execute_indirect) uses the same shader, and #3504's split indirect path still uses this rewrite with no code overlap.performance: 60 s smoke of a retail title, main
7d86c5d2vs this merge (4347565e): 1663 -> 1669 frames shown (100 %; last presents per 2 s: 60 60 61), peak commit 17153 -> 17082 MB, 0 device removals, 0 crashes.verdict: not yet: dropped commands are never counted or logged, direct and indirect dispatch_mesh now disagree on the same counts, and the stated rationale (records nothing wrote) doesn't match the code
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
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.