Recompiler: direct DXIL folds all-ones EXEC and skips dead VGPR reads #1801
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!1801
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@xADEL on GitHub · 2026-11-24 20:54 UTC · original
xADEL:dxil/fold-all-ones-exec→main· +325 −66 · 8 files · 1 commits · openDirect 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.@futurepro62 on GitHub · 2026-11-24 23:53 UTC · original · edited 2026-11-25 00:07 UTC
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
@JJAutoCompare on GitHub · 2026-11-25 01:04 UTC · original
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
@DavidM1911 on GitHub · 2026-11-26 06:19 UTC · original
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.@lewisnic94-max on GitHub · 2026-11-24 23:19 UTC · original · reviewed
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.
@lewisnic94-max on GitHub · 2026-11-25 00:51 UTC · original · reviewed
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.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.