Repository navigation
Recompiler: fold split-wave64 reduction tail v_readlane exchanges - #981
Conversation
|
Hardware check of Tested
Regression run PR ( Not tested
AI use
|
|
Independent verification, merged onto current Machine: Windows 11, Ryzen 9 7900X Radeon iGPU (gfx1036 RDNA2) + RTX 3060 Ti; Rust stable MSVC, debug.
AI use: test runs by Devin (Cognition, SWE-2); no code changes. |
|
Independent validation — NVIDIA RTX 3050 Laptop (wave32-only) Tested PR head: Hardware / environment
Focused tests — PASS
Full official test wrapper — PASS Additional skip reconciliation:
Not tested
Interpretation AI use |
|
Independent verification, merged onto current Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug; DXC 1.8.2502.11.
AI use: test runs by Devin (Cognition, SWE-2); no code changes. |
In split-wave64 mode (two hardware wave32 halves per console wave64), wave64 reductions end with a cross-half tail such as
v_readlane_b32 s_tmp, v, 32→v_<op> v, s_tmp, v→v_readlane_b32 s_out, v, 0(or fourv_readlane_b32reads aroundv_add_f64for 64-bit reductions). Previously, everyv_readlane_b32emitted its ownxcl_x_rla_uniformcall — running 2 (or 4 forf64) full cross-halfxcl_x_meet()barrier/spin-wait exchanges even though the first exchange already hands both halves bothv[L]andv[L^32].This folds split-wave64 cross-half reduction tails (and direct
(v, L)/(v, L^32)pairs) inside each basic block into a singlexcl_x_meet()exchange: both halves keep both lane values from the first exchange, run the middle VALU instruction normally so all 64 lanes ofvremain exact, and compute the updated target lane locally under itsEXECbit for the trailingv_readlane_b32without a second exchange. Native wave64, wave32, andPRELUDE_X64are unchanged; this is orthogonal to #917 (v_writelane_b32spill shadows) and #944 (consecutive uniform readlane batching).What is in it
crates/xcl/src/gpu/recomp/emit.rs: addEm::emit_instsandtry_emit_x64_reduction_tailfor split-wave64 mode covering:v_add_nc_u32,v_add_f32,v_min/max_f32/u32/i32,v_and/or/xor_b32, andv_add_f16preserving the upper 16 bits) with modifier-free plain VALU ops, exact operand ordering, andEXEC-bit gating on the target lane;v_add_f64reduction tails (4v_readlane_b32exchanges collapsed into 1 two-wordxcl_x_meet());(v, L)+(v, L^32)pairs.crates/xcl/src/gpu/recomp/mod.rs: route the three basic-block emission loops (emit_block,emit_range, and straight-linebranches == 0) throughem.emit_insts(...).crates/xcl/src/gpu/recomp/tests.rs: addsplit_wave64_reduction_tail_rules(unit test covering 32-bit, 64-bitv_add_f64, direct pair,CLAMP/mismatched-lane/jump-target negative guards, and native wave64 invariance) andgpu_split_wave64_reduction_tails(GPU test verifyingv_min_u32,v_add_f32swapped order,v_add_f16high-16 preservation, 64-bitv_add_f64, direct pair, and inactive lane 0 underEXEC).Across 10,447 wave64 CS/MS programs in a retail shader pack, this removes 869
xcl_x_meet()exchanges (773 × 32-bit tails, 32 × 3 from 64-bitv_add_f64tails, and 3 direct pairs) and cuts wave64 reduction cross-half barrier syncs by 2x (32-bit) and 4x (64-bitf64) at runtime.Measured on three reduction-heavy retail wave64 compute shaders on
origin/main(077ce40) → this commit (9e2c7a5) (RTX 3060 Ti, DXC 1.9.2609.5):130 → 98(-24.6%, 32 × 32-bit tails), DXIL445.5 → 432.3 KB(-3.0%), cold PSO8001 → 7612 ms(-4.9%)242 → 175(-27.7%, 46 × 32-bit + 7 ×f64), DXIL584.8 → 561.1 KB(-4.1%), DXC12149 → 11012 ms(-9.4%), cold PSO11489 → 10693 ms(-6.9%)505 → 388(-23.2%, 84 × 32-bit + 11 ×f64), DXIL1028.9 → 987.5 KB(-4.0%), DXC26055 → 23748 ms(-8.9%), cold PSO22849 → 21830 ms(-4.5%)Tested
x86_64-pc-windows-msvc), debug + release.cargo test --workspace -- --test-threads=1: 718 passed, 0 failed, 41 ignored (2 SKIPPED GPU tests:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)). Both new tests (split_wave64_reduction_tail_rules,gpu_split_wave64_reduction_tails) ran and passed.Regression run
(local folder name redacted to
retail-titlein both blocks;mainbaseline09940bbhas an identical Rust tree to077ce40, which only updatedREADME.md; all metrics are exact output of the 60 s runs withXCL_NETWORK=0)main:
PR:
Not tested
split_wave64is false there so emitted HLSL is unchanged).CreateComputePipelineState).AI use