Repository navigation
[upstream #1111] Recompiler: propagate split-wave64 lane-local masks through 64-bit bitwise SALU ops - #48
Closed
ufoptg wants to merge 1 commit into
Closed
[upstream #1111] Recompiler: propagate split-wave64 lane-local masks through 64-bit bitwise SALU ops#48ufoptg wants to merge 1 commit into
ufoptg wants to merge 1 commit into
Conversation
Owner
Author
|
Upstream PR xcl-dev#1111 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.
Reduces
xcl_x_ballot()cross-half exchanges in split-wave64 (docs/wave64-on-wave32.md) by propagating lane-local mask liveness through 64-bit bitwise SALU ops inx64_masks.rs.Why
x64_masks.rs,v_cmp*and carry outputs (v_add_co_u32/v_sub*_co_u32) already avoid a cross-halfxcl_x_ballot()exchange (xcl_x_ballot_local()) when they feed only per-lane readers (v_cndmask_b32,v_add_co_ci_u32,v_sub*_co_ci_u32).s_and_b64,s_or_b64,s_xor_b64,s_andn2_b64,s_orn2_b64,s_nand_b64,s_nor_b64,s_xnor_b64,s_not_b64,s_mov_b64,s_cselect_b64,s_cmov_b64,s_wqm_b64) before feedingv_cndmask_b32. Previously,x64_maskstreated every SALU instruction as reading its source SGPR pairs whole, forcingxcl_x_ballot()on all upstream compares even when neither the result mask norsccwas ever read whole.xcl_x_ballot_local()leaves each 32-lane half's own word exact (low dword on half 0, high dword on half 1) and none of these 64-bit lane-wise ops crosses the 32-lane boundary, each half produces its own exact 32-lane result word without exchanging the inputs — provided:EXECis always whole-live, so writes toEXECstay exchanged);scc(all excepts_mov_b64/s_cmov_b64/s_cselect_b64),sccis dead afterward (tracked jointly in the backward liveness pass, includingLOOP_GUARDexits and kernel-mode end readback);vccz(251) /execz(252) still markVCC/EXECwhole-live.What is in it
crates/xcl/src/gpu/recomp/x64_masks.rs: tracksccliveness alongside whole-live SGPRs (reads_scc, conservativewrites_sccmatchingemit.rs,lane_wise_salu64, andflow()), propagate non-whole-live masks through even-aligned 64-bit lane-wise SALU ops, update three existing tests that used a deads_mov_b64 s[2:3], vccas a dummy whole-reader, and add 6 unit tests covering bitwise chains, live vs overwrittenscc,s_and_saveexec_b64/EXECwrites,s_cselect_b64/s_cmov_b64,vccz/ odd alignment, andLOOP_GUARDexits readingscc.crates/xcl/src/gpu/recomp/emit.rs: requiren & 1 == 0when emittingxcl_x_ballot_localintoDst::S(n)so low/high half alignment is guaranteed globally.crates/xcl/src/gpu/recomp/tests.rs: add GPU testgpu_split_wave64_bitwise_lane_masksverifying both 0-exchange bitwise mask chains (s_and_b64,s_andn2_b64,s_not_b64,s_or_b64,s_mov_b64,s_cselect_b64→v_cndmask_b32) and kept exchanges whensccis read (s_and_b64matching upper half only →s_cselect_b32).Measured impact (RTX 3060 Ti, split-wave64)
xcl_x_ballot()calls drop from 210,324 → 170,561 (−39,763 exchanges, −18.9%).cs_6_6) and NVIDIA D3D12 PSO compile benchmarks on three retail compute shaders (before384f7f7→ after02d65c8):xcl_x_ballot513 → 433(−15.6%), DXIL834,160 → 803,648 B(−3.7%), DXC23,166 → 14,804 ms(−36.1%), cold PSO28,780 → 21,316 ms(−25.9%).xcl_x_ballot420 → 370(−11.9%), DXIL512,592 → 494,064 B(−3.6%), DXC12,011 → 8,786 ms(−26.9%), cold PSO16,405 → 11,792 ms(−28.1%).xcl_x_ballot135 → 75(−44.4%), DXIL152,752 → 130,920 B(−14.3%), DXC3,455 → 1,874 ms(−45.8%), cold PSO4,106 → 3,108 ms(−24.3%).Tested
x86_64-pc-windows-msvc), debug + release.cargo test -p xcl --lib x64_masks -- --test-threads=1: 22 passed, 0 failed.cargo test -p xcl --lib gpu_split_wave64 -- --test-threads=1: 6 passed, 0 failed (including newgpu_split_wave64_bitwise_lane_masks).cargo test --workspace -- --test-threads=1: 744 passed, 0 failed, 41 ignored (1 SKIPPED GPU test:gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)).Regression run
(local folder name redacted to
retail-titlein both blocks; all metrics are exact output of the warm-cache 60 s runs withXCL_NETWORK=0)main:
PR:
Not tested
x64_masksonly runs whensplit_wave64is active on wave32-only GPUs or forced viaXCL_SPLIT_WAVE64=1).AI use
xcl_x_ballotconsumers across the shader corpus, designed and implemented thex64_masks.rsscc+ bitwise propagation pass, wrote unit/GPU tests, ran the DXC/PSO benchmarks, and drafted the PR description; all tests, benchmarks, and paired smoke runs were executed locally on the hardware above and the diff was reviewed line by line.Mirror of xcl-dev#1111 (auto-synced, do not edit).