Recompiler: resolve lanes 32-63 of split wave64 VS / PS in direct DXIL #3795
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3795"
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 raylitebull on 2026-12-03T15:24:09Z.
Stacked on #3793; only the top commit (
1c938a8f) belongs here.A wave64 VS / PS takes the 32-lane form wherever the driver may run it in waves of 32 (
pso::graphics_wave32, which is true on any adapter whose wave range starts at 32, RDNA included). In that form the direct DXIL translator refused it as soon asupper_lanesfound a read of lanes 32–63 that was notNative:wave64 VS / PS in 32-lane waves: a read of lanes 32–63(dxil/kernel.rs). This change resolves those reads the way the HLSL emitter does (Em::upper), so that refusal is gone. It was the lastupper_lanesrefusal for VS / PS.What is in it
dxil/kernel.rs: the refusal is removed. Outside the 32-lane formRead::ConstbecomesNative(asrecomp::translatedoes).GfxLanesis set up when there is a shadowed slot or a constant read. As the HLSL path does,ds_permute_b32in the 32-lane form is still refused, becauseupper_lanesdoes not follow its writes to lanes 32–63. Direct DXIL does not lower it in a VS / PS today (LDS outside compute), so this only keeps that refusal in place if #2228 lands.dxil/lower_gfx.rs:GfxLanes::hw32isWaveGetLaneCount() < 64(xcl_hw32).Lw::upper_constgivesselect(hw32 && lane >= 32, c, read).dxil/lower_valu.rs(v_readlane) anddxil/lower_mem.rs(ds_bpermute, before its EXEC select, as in the HLSL path) use it.Read::Shadowin the 32-lane form uses #3793's shadows.Read::Unknownstays a native read, which is what the HLSL path emits too;wave_hazardsreports it either way.dxil::core_tests::wave64_graphics_with_upper_lane_reads_refused_in_32_lane_modeasserted the refusal this change removes, so it is nowwave64_graphics_upper_lane_reads_translate_in_32_lane_mode. It covers a constant lane 63, a lane from an SGPR,ds_bpermute, and an unknown upper lane, in VS and PS and in both forms. Each translates and validates. The disassembly haswaveGetLaneCountand aselect … i32 5for the constants in the 32-lane form only; there is none for the unknown read or in the 64-lane form.coverage::translate_modereturns Ok, and a split PS withds_permute_b32is refused.recomp::tests::wave64_graphics_spill_shadows_cover_native_partial_wavesnow expects both forms to translate.runner::graphics_wave32()). The VS test also checks the lane-32 identity on direct DXIL wherever it checks it on the HLSL path.Direct-DXIL fallbacks left for VS / PS / MS / GS in
crates/xcl/src/gpu/dxil/, read from the code, not counted on a corpus:graphics whole-wave reduction needs the HLSL path(kernel.rs,graphics_reductions).ds_permute_b32included (LDS outside compute), and GDS (lower_mem.rs).export target).v_interp_movp10 / p20, otherv_interpforms, and an attribute outside ISG1 (lower_gfx.rs).gpu/dxil: an FSPX container in a graphics slot (recomp/pso.rs). PSOs with HS / DS never reach a translator (d3d12x/real.rs).split wave64 geometry: the ES phase exchanges at group barriers(kernel.rs). This applies in the split form with the safe barrier, which is the default.split wave64 LDS access needs the HLSL pathapplies only withXCL_X_LDS_ORDER=0(CS too).s_getreg, an indirect branch, a scalar movrel register, and encodings or opcodes not lowered yet (lower.rsand friends).Tested
cargo check --workspace --all-targets --target x86_64-pc-windows-gnubuilds, with the same warnings asmaina815de93(39 lib, 20 lib test) and none in the changed files.git diff --checkis clean.x86_64-pc-windows-gnu, debug) and run under Wine 9.0 with DXC 1.10.2611'sdxcompiler.dll/dxil.dll(XCL_DXC_DIR), soIDxcValidatorand the disassembler ran. There is no GPU, so every GPU test printedSKIPPED(no GPU). Each module ran in its own process with 2 threads; theuma_drivergroup was left out.1c938a8f): 2547 passed, 75 failed, 35 ignored;hle::netoff::teststimed out (Wine sockets).maina815de93, same setup: 2545 passed, 76 failed, 35 ignored;hle::netoff::teststimed out.hle::d3d12x::frame::tests::origin_events_issue_tokens_and_flips_have_statistics, which failed on themainrun (timing under Wine). The other failures are the same as onmain.Regression run
Pending:
scripts/smoke.ps1frommainand from this head, on Windows with an RX 9070 XT, still to be run.Not tested
IDxcValidatorwas not run on Windows.xcl_hw32is always true.scripts/smoke.ps1and the whole suite on a GPU (pending, RX 9070 XT).xcl shaders --direct): no game data here.AI use
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.