Direct DXIL: route split-wave64 GS-only entry through gate block #2069
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2079"
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 Decodere on 2026-11-25T03:22:13Z.
What is in it
Route
Block(0)through thegateblock when translating split-wave64 GS-only geometry shaders in Direct DXIL.Part of #1269
crates/xcl/src/gpu/dxil/kernel.rs, whengs_only == true(split && gs_start == Some(0)),translate_on_this_threadcreated agateblock (lw.edge(Block(0), gate)andlw.cond_br(up, exit, h0)) to confine GS-only execution to the lower 32-lane hardware wave and registeredgate(notBlock(0)) as the SSA entry predecessor ofh0andexit. However, line 391 unconditionally terminatedBlock(0)withlw.s.m.br(h0);instead of branching togate. This caused two bugs:pc == 0) is a loop header failed Direct DXIL construction/validation (forward reference ... blocks must be in dominance order) becauseh0's PHIs referenced unreachablegate.gateso both hardware waves (lanes 32..63 in addition to lanes 0..31) executed the GS body in parallel, double-executing global atomics/stores and clobbering LDS.let first = if gs_only { ... gate } else { ... h0 };incrates/xcl/src/gpu/dxil/kernel.rsand terminateBlock(0)withlw.s.m.br(first);.gs_only_testsat the end ofcrates/xcl/src/gpu/dxil/kernel.rs:direct_gs_only_split_routes_entry_through_gate_and_validates_entry_loop: translates and validates a split-wave64 GS-only program whose entry block (pc == 0) is a loop header.gpu_direct_gs_only_split_skips_upper_wave: wave32 Direct DXIL GPU test (guarded byrunner::wave32_supported()) dispatching a 1-group ([64, 1, 1]) split GS-only shader withGLOBAL_ATOMIC_ADDof1tomem[0]and assertingmem[0] == 32(not64).Tested
621.14, wave32), Intel Core i5-11400F, 32 GB RAM, Windows 11 Home build 26200, Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.9.2609.5(01b62ad4).origin/maincbc296ab(debug):direct_gs_only_split_routes_entry_through_gate_and_validates_entry_loop: panicked with"direct DXIL builder error: forward reference to value 106 at instruction 105 (blocks must be in dominance order)".gpu_direct_gs_only_split_skips_upper_wave(withlw.s.m.br(h0);): panicked on RTX 4060 withassertion left == right failed: left: 64, right: 32.fa4bfd11):cargo test --release -p xcl --lib gpu::dxil::kernel::gs_only_tests -- --nocapture(RTX 4060) ->2 passed; 0 failed; 0 ignored(0 skips).XCL_ADAPTER="Microsoft Basic Render Driver" cargo test --release -p xcl --lib gpu::dxil::kernel::gs_only_tests -- --nocapture->2 passed; 0 failed; 0 ignored(CPU entry-loop validation passed; GPU dispatch skipped cleanly viarunner::wave32_supported()).cargo test --release -p xcl --lib gpu::dxil::geometry_tests -- --nocapture(RTX 4060) ->2 passed; 0 failed; 0 ignored(geometry_forms_validateandgpu_geometry_direct_records).fa4bfd11):cargo build --release --workspace+cargo test --release --workspace -- --test-threads=4 --nocapture->1156 passed, 0 failed, 46 ignoredacross 21 test binaries.SKIPPEDlines (27 total, all pre-existing on this wave32 Windows host without Graphics Tools / Developer Mode / heap windows):no wave64skips (4ingpu::recomp::lower::tests,14ingpu::recomp::lower_dxil::tests,2ingpu::recomp::tests).per-lane form: refusedskips ingpu::recomp::lower_dxil::tests(f16 arithmetic,f16 packed,f32 conversions).test_title_draws_with_a_root_signature_under_the_debug_layer: nod3d12SDKLayers.dll;uploads_start_from_each_subresources_state:0x887A002D).shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable driver cache without Windows Developer Mode.heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows.Regression run
Paired 60 s retail title runs with
scripts/smoke.ps1(release build, same title, clean working tree) onorigin/main(cbc296ab) and this PR (fa4bfd11):main:this PR:
Not tested
split == false), D3D12 debug layer, heap windows, and Linux/Wine.gs_start == Some(0)); the paired smoke run is a regression check only.AI use
Google Antigravity (Gemini 4 Neon) wrote the fix, tests, and this PR description; all builds, tests, and paired retail smoke runs were executed locally on the hardware listed above.
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-25T03:29:23Z.
Full-suite run, since this PR has no test report yet. Tested exact head
fa4bfd1(on its basecbc296a).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --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::dxil::fuzz_tests: 1144 passed, 0 failed, 44 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,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.direct_gs_only_split_routes_entry_through_gate_and_validates_entry_loop,gpu_direct_gs_only_split_skips_upper_wave.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1155 passed, 0 failed, 46 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on maincbc296atoo, 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_gputestsconst_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, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T03:42:04Z.
Independent focused verification of xcl-dev/xcl#2079 on STOR-WINLAB (2026-11-25).
Tested
fa4bfd1149330ae4e0831702a9ce0eddb327981ebefore and after. The assigned worktree matched that SHA and was clean and detached at both checks.XCL_ADAPTER=A770andXCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64.[1, 1, 1]groups of[64, 1, 1]threads with two 32-lane hardware waves. Starting from zero, the atomic readback satisfiedmem[0] == 32, the fixture's assertion that only the lower wave contributed.powershell.exe -NoProfile -ExecutionPolicy RemoteSignedprocess.Not tested
AI use
upstream-sync referenced this pull request2026-11-25 05:07:03 +00:00
Imported from ivall/xcl. Originally posted by SzczepanGrela on 2026-11-25T04:42:03Z.
Linux/RADV + Wine GPU test report on PR
#2079headfa4bfd1(fast-forward ontoorigin/maincbc296a,rustc 1.97.1, zero compiler warnings).Tested
7.3.0-5-cachyos), AMD Radeon RX 9070 (RADV GFX1201, device0x7550, native wave64, Mesa26.2.5-arch3.1, Vulkan1.4.354),GE-Proton11-12(wine-11.0 (Staging),vkd3d-proton v3.1-1-g8293130eb), DXC1.9.2602.17(21d28f72). Cross-builtx86_64-pc-windows-gnurelease (--lib, 39.37 s) withXCL_REQUIRE_GPU=wave64 XCL_NETWORK=0.gs_only_tests --test-threads=1 --nocapture(direct_gs_only_split_routes_entry_through_gate_and_validates_entry_loopandgpu_direct_gs_only_split_skips_upper_wave): 2 passed, 0 failed in all 4 env modes: default (0.11 s),XCL_SPLIT_WAVE64=1(0.08 s),XCL_DIRECT_DXIL=all(0.08 s), andXCL_DIRECT_DXIL=all XCL_SPLIT_WAVE64=1(0.08 s).gpu::dxil::geometry_tests --test-threads=1(geometry_forms_validate,gpu_geometry_direct_records): 2 passed, 0 failed in default env (0.16 s, vsorigin/maincbc296a0.17 s) andXCL_DIRECT_DXIL=all(0.16 s, vsorigin/maincbc296a0.19 s).gpu::dxil --skip ops_tests::integer_ops_match_cpu --skip ops_tests::uaddc_and_usubb_match_cpu --test-threads=1: 121 passed, 1 failed, 3 ignored (2.64 s), vsorigin/maincbc296a119 passed, 1 failed, 3 ignored (3.26 s; +2 passed fromgs_only_tests, identical single failuregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_2atcrates/xcl/src/gpu/dxil/fuzz_tests.rs:1171:21,seed 1003: res[713] = 0x1, CPU 0x0).gpu::recomp::tests::gpu_ --test-threads=1 --skip gpu_sparse_vram_descriptors_buffers_and_xmem --skip gpu_uma_import_check_at_init --skip gpu_unified_memory_arena:origin/maincbc296a99 passed, 1 failed, 1 ignored (4.50 s); identical failuregpu_nonfused_mad_and_mac_prevent_fma_contraction.XCL_DIRECT_DXIL=all: 96 passed, 4 failed, 1 ignored (2.30 s), vsorigin/maincbc296a96 passed, 4 failed, 1 ignored (2.48 s); identical 4 failures (gpu_f64_math_random,gpu_f64_roots,gpu_image_get_resinfo_1d_array,gpu_nonfused_mad_and_mac_prevent_fma_contraction).XCL_SPLIT_WAVE64=1: run 1 89 passed, 11 failed, 1 ignored (5.03 s) and run 2 90 passed, 10 failed, 1 ignored (4.67 s), vsorigin/maincbc296arun 1 89 passed, 11 failed, 1 ignored (5.27 s) and run 2 89 passed, 11 failed, 1 ignored (4.83 s). PR#2079run 1 matchesorigin/maincbc296arun 2 on the exact same 11 failing tests (includinggpu_grouped_loads_bounds_and_inactive_lanesfailing withs127: 0x0 / 0xffffwhilegpu_split_wave64_masks_read_whole_after_partial_writespassed), and PR#2079run 2 passed both of those tests.Not tested
scripts/smoke.ps1, integration test binaries,--libmodules outsidegpu::dxilandgpu::recomp::tests::gpu_, andXCL_DIRECT_DXIL=1onrecomp(no retail title files locally).gpu::dxil::ops_tests::integer_ops_match_cpuanduaddc_and_usubb_match_cpu(skipped: pre-existingvkd3d-proton v3.1/libvulkan_radeon.soabort exit 3).gpu_sparse_vram_descriptors_buffers_and_xmem,gpu_uma_import_check_at_init, andgpu_unified_memory_arena(skipped: pre-existing Wine in-process COM vtable swap).AI use
Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-25T05:22:09Z.
A run with vkd3d-proton as the host D3D12. The DXIL goes through dxil-spirv and then the NVIDIA Vulkan driver, not the native-Windows path: this PR's 2 new tests pass, none skipped.
Tested
x86_64-pc-windows-gnu.fa4bfd1as it is (merge base withmaincbc296a), no uncommitted changes. The lib test binary runs under Wine, one test per process.direct_gs_only_split_routes_entry_through_gate_and_validates_entry_loop: okgpu_direct_gs_only_split_skips_upper_wave: okNot tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T05:26:48Z.
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!
upstream-sync referenced this pull request2026-11-25 10:09:30 +00:00
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-27T18:36:13Z.
merge-check
base:
6089122a1chead:
fa4bfd1149merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1463 passed, 4 failed, 47 ignored; failing:
gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0to_3(CreateComputePipelineStateE_OUTOFMEMORY). They fail the same way on this machine without this PR (five suite runs today on branches based onmainf9a0cb80) and pass with #1919 merged, so they are not this PR's. Both new tests pass and ran, not skipped:direct_gs_only_split_routes_entry_through_gate_and_validates_entry_loopandgpu_direct_gs_only_split_skips_upper_wave(this adapter has 32-lane waves). 25SKIPPEDlines (no wave64, no heap windows, three recompiler forms refused as unsupported).review: no blocking finding; whole diff read (
gpu/dxil/kernel.rs, +69/-3). Onmainthe GS-only branch oftranslate_on_this_threadrecords the edgeBlock(0)togate, but the entry block's terminator still branches toh0, sogatehas a declared predecessor that never reaches it andh0gets an input its PHIs do not list. The PR branches togatein that case and toh0otherwise; the path that is not GS-only emits what it did before.gateiscond_br(upper, exit, h0): the upper hardware wave leaves, the lower one runs the body. Nothing since the PR's base touchesgpu/dxilonmain, andbuild.rshashes that folder, so cached translations are not reused. Not checked: the validate test on a host without the DXIL validator does nothing (it is guarded), and I did not run it againstmainto see it fail there.performance: reasoned, not measured. Only the GS-only split-wave64 path changes, by one branch target; nothing by default on other shaders, no memory. I did not run a title on the merge result.
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 617.42, 32-lane waves), Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro 26300, rustc 1.100.0, debug. Claude Code with Claude Fable 5.2 ran the merge, build and suite on my machine and wrote this; a Claude Opus 5.5 subagent reviewed the diff and Fable read it in full as well.
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T20:01:13Z.
merge-check claim
head:
fa4bfd1149Imported from ivall/xcl. Originally posted by throny on 2026-11-27T20:17:13Z.
merge-check
base:
6089122ahead:
fa4bfd1149merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1467 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1465 passed, 0 failed, 47 ignored
review: none. On main the entry block records an edge to the gate but still branches to the first half, so the gate is never reached and the upper wave runs the GS; the PR branches to the gate when the program is GS-only and leaves the other path unchanged. Both tests fail on main by reading the code (not run there).
performance: it changes a translator source: every tester re-translates all shaders once. After that only the split GS-only path changes (its upper wave does no work) (reasoned).
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 UncommonDLL on 2026-11-29T19:01:20Z.
We adapted this PR's regression fixtures from Decodere's branch to main
3b6a91ed096d6d6e0fee52cfb86dc0a7d7c8c1b0. The matched parent and candidate had identical test instrumentation. The production difference wasfirst = gate;in the GS-only branch, preserving the captured prologue.With Rust/Cargo 1.100.1 MSVC and DXC/DXIL 1.9.2602.17, both CPU arms passed the validator control. The parent entry-loop test exited 101 with the native PHI diagnostic: block 1 had CFG predecessors
[0, 3, 4]but PHI inputs[3, 4]. The candidate matched[3, 4]in both records and validated its 3,308-byte DXIL container, exit 0.The qualified candidate then passed one exact
gpu_direct_gs_only_split_skips_upper_waverun on native Windows with an RTX 2060 Max-Q and installed NVIDIA driver 621.40 (32.0.16.2140). The hardware guard confirmed Wave32 min/max 32. One single-group dispatch completed at fence 1/1. The complete 64-word readback was 32 followed by 63 zeros, and the originalmem[0] == 32assertion passed. One test passed with zero runtime skips.These results support rebasing the PR onto current main.
This is a local rebase result on the pinned baseline, not a new run of the historical PR head. No parent GPU comparison was run. The aggregate atomic count does not identify the contributing lanes. Runtime barriers, retail behavior, performance, loaded driver-module identity and debug diagnostics were not evaluated.
AI assistance: ChatGPT Work/Codex adapted the fixtures, ran the qualification and reconciled the receipts. Claude Opus independently reviewed the source and measured evidence. Gemini assisted the earlier source qualification.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:18:37Z.
Triage (#1607) – head
fa4bfd1No open or merged PR makes this fix, and main still has the bug. In
translate_on_this_threadthe GS-only branch records the edgeprologue -> gatebut never setsfirst = gate, soBlock(0)branches straight toh0and the upper hardware wave is never gated. Main now haslet mut first = h0for the folded-dispatch gate, so the rebase only needsfirst = gatein thegs_onlybranch.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.