Recompiler: direct DXIL folds all-ones EXEC and skips dead VGPR reads #1791
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1801"
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 xADEL on 2026-11-24T20:54:43Z.
Direct DXIL
entry_execalready initializesEXECto all ones on full-wave compute and mesh shaders, andLw::guardedalready skips branches when its condition is constant1, butlanebit/lanebit_atemitted(w >> lane31) & 1 != 0without foldingw == u32::MAXtotrue, so full-wave lane guards and deadold/curVGPR reads were still emitted. Part of #1269.What is in it
crates/xcl/src/gpu/dxil/lanes.rs: fold constant0andu32::MAXmasks inlanebitandlanebit_at, and skip the upper-half compare inlanebit_atwhenhi == lo.crates/xcl/src/gpu/dxil/lower.rs: foldOr(x, mask) => maskand same-operand integer identities inLw::bin(sos_or_saveexec -1restores constant all-onesEXEC), and addLw::wr_ifto skip deadoldVGPR reads whencondis constant.crates/xcl/src/gpu/dxil/lower_valu.rs,lower_wide.rs,lower_gfx.rs,lower_image.rs: route guarded writes throughwr_ifand readcurlazily only in RMW instructions (includingvalu_f32_rmadded by #1679).crates/xcl/src/gpu/dxil/kernel.rs: bumpTRANSLATOR_VERSIONfrom 7 to 8.crates/xcl/src/gpu/dxil/core_tests.rs: disassembly/validation and GPU tests (full_wave_exec_folds_away_lane_guards_and_dead_vgpr_reads,exec_folding_and_rmw_match_expected_on_gpu).Tested
32.0.16.2124), Intel Core i5-12450HX, 24 GB RAM, Windows 11 Pro (10.0.26300),rustc 1.100.0, Windows SDK10.0.26100.0(dxcompiler.dll/dxil.dll1.9.2602.17), debug tests + release sweep/smoke.XCL_ADAPTER="rtx 3050" cargo test --workspace -- --test-threads=4(rebased heade00963fonmain8e87fc7): 992 passed, 0 failed, 45 ignored (both new EXEC-folding tests and all upstreamcore_tests/round_tests/msaa_tests/geometry_testspassed).SKIPPEDGPU tests on this adapter (24): 19no wave64(gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,lower::tests::*,lower_dxil::tests::*wave64 arms), 3 per-lane wave32 unsupported f16/cvt arms (f16_programs_on_the_gpu,f32_programs_on_the_gpu), 1no heap windows(heap_window_out_of_memory_falls_back_to_the_switch_form), 10x887A002DDeveloper Mode required (pso_measurement_compiles_an_exact_synthetic_record).shaders.rpfsweep (xcl shaders <pack> --direct --validate --sample 500 --seed 1, release): 408/408 translated (100.0%: 33 CS, 11 GS, 155 MS, 164 PS, 45 VS), 0 validator errors, 0 panics (2.1 s).Regression run
(Note:
smoke.ps1runs withoutXCL_DIRECT_DXIL=1, so this regression check verifies no runtime regression on the default path and is not a gameplay FPS claim for the direct-DXIL optimization.)Not tested
XCL_HEAP_WINDOWS=1runtime runs,XCL_DIRECT_DXIL=1full title runs, andXCL_SAMPLE_*tests.AI use
8e87fc7(extending lazycurtovalu_f32_rmand bumpingTRANSLATOR_VERSIONto8), ran the workspace suite,--direct --validatesweep, andsmoke.ps1runs on this machine, and drafted this description.upstream-sync referenced this pull request2026-11-24 22:06:54 +00:00
Imported from ivall/xcl. Originally posted by lewisnic94-max on 2026-11-24T23:19:13Z.
Review: COMMENTED
Independent review of
5623328.All 128 GPU lane results matched the CPU reference across four execution masks on an RTX 3080.
No actionable defects identified within the reviewed scope. AMD and Intel hardware were not tested.
AI-assisted review and validation by Codex.
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T23:53:27Z.
Full-suite run, since this PR has no test report yet. Tested exact head
271b0da(on its base20cf130).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::dxil::fuzz_tests: 968 passed, 0 failed, 43 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.full_wave_exec_folds_away_lane_guards_and_dead_vgpr_reads,exec_folding_and_rmw_match_expected_on_gpu.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 977 passed, 0 failed, 45 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 main62265d3too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651) and the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests (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 lewisnic94-max on 2026-11-25T00:51:15Z.
Review: COMMENTED
Revalidated the EXEC-mask and accumulator changes at
e00963fafdae4420f88333e7b2eb75d1ab9a994aagainst merge base8e87fc7b62a87ea589ccb9ea6182f514016cf7db. The original four-mask wave32 test passed all 128 lane checks.With runtime rounding toward +infinity, −infinity and zero, I compared 1,152 lane results for
V_FMAC_F32,V_FMAC_LEGACY_F32andV_MAC_F32. Every result matched the merge base bit for bit. Thirty active legacy FMAC results differed from the arithmetic reference on both builds. With input denormals preserved, the smallest positive subnormal times +infinity plus 1 returned 1.0. The reference expected +infinity. Native RDNA2 confirmation of that legacy case is still pending.Head totals were 9 passed, 1 failed, 0 ignored and 0 skip notices. The merge base had 7 passed, 1 failed, 0 ignored and 0 skip notices. The failure was the same new legacy assertion. The five stock
gpu::dxil::round_testspassed on both builds. Windows 11 build 26200.9974, Ryzen 7 5800X, RTX 3080 driver 616.92, Rust 1.100.0 MSVC, DXC 1.9.2602.17. The other head filters werebatch002_dynamic_exec,full_wave_exec_folds,exec_folding_and_rmw,followup_directed_accumulatorandfollowup_accumulator_readback_matrix. Coverage was limited to synthetic inputs on this adapter.Codex (GPT-6) assisted with the test fixtures, GPU readbacks and comparison.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T01:04:47Z.
Focused Intel Arc regression run for exact head
e00963fafdae4420f88333e7b2eb75d1ab9a994a. The checkout was clean before and after testing, and the live PR head matched after the run.Tested
32.0.101.9175, Ryzen 7 3800X, Windows 11 Enterprise Evaluation build26200.9974, Rust/Cargo1.100.0(stable-x86_64-pc-windows-msvc), debug profile. The test binary loggeddxcompiler.dllanddxil.dllversion1.9.2609.5from%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64viaXCL_DXC_DIR. Used an isolated target and TEMP/TMP onL:, two build jobs, andCARGO_INCREMENTAL=0.cargo +stable-x86_64-pc-windows-msvc test -j 2 -p xcl --lib --no-run. Both tests usedXCL_REQUIRE_GPU=wave64,mesh. The dispatch test usedXCL_ADAPTER=A770and ran inside& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { ... }. The build and disassembly test ran outside the lock.Each command reported 1 passed, 0 failed, 0 ignored, 0 skip notices. The disassembly assertions checked full-wave guard folding and the retained accumulator load. The GPU test executed direct-translated DXIL and checked lane and memory readbacks for zero, half-active, restored and dynamically narrowed EXEC masks. D3D12 reported a wave lane range of 8–32 on this adapter, so the dispatch test exercised split wave64 and native wave32.
Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T06:19:49Z.
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:50:15Z.
Triage (#1607) – head
e00963fNo open or merged PR makes the same change. #1356 does EXEC elision on the HLSL path, and #3530 touches the same direct-DXIL write sites for other reasons and will conflict.
wr_ifkeeps the old semantics: a constant-false condition writes nothing where the old code wroteold, and the guarded-region join still merges correctly. Thea == bfolds apply only in the integerbinpath. The SDWA change reads the old register only for DST_UNUSED=preserve with a sub-dword DST_SEL, which matchessdwa_dst. No problems found in the diff. It conflicts with main and needs a rebase (and a freshTRANSLATOR_VERSIONbump).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.