Repository navigation
Conversation
Owner
Author
|
Upstream PR xcl-dev#981 was closed or merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 xcl-dev#917 (v_writelane_b32spill shadows) and xcl-dev#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
Mirror of xcl-dev#981 (auto-synced, do not edit).