Recompiler: fold split-wave64 reduction tail v_readlane exchanges #981
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!981
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/981/head"
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?
@zondy1i on GitHub · 2026-11-24 09:52 UTC · original
zondy1i:recomp/x64-reduction-tails→main· +375 −24 · 3 files · 1 commits · merged 2026-11-25 01:07 UTCIn 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
@eizispark on GitHub · 2026-11-24 10:02 UTC · original
Hardware check of
9e2c7a566574700755c2da4971bb2e882f56f506(verified clean merge withmain9aec53d): pass.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profilecargo test --workspace -- --test-threads=4:715 passed, 3 failed, 41 ignored(GPU tests skipped on this adapter:none; the 3 failures are the pre-#923placed_title_textures_share_vram_and_preserve_pixelsconcurrent global-table race on base077ce40plus its 2 downstreamPoisonErrortests —cargo test -p xcl --lib hle::d3d12x -- --test-threads=1:115 passed, 0 failed, 1 ignored)split_wave64_reduction_tail_rules,gpu_split_wave64_reduction_tails(both native wave64 and forcedXCL_SPLIT_WAVE64=1:1 passed, 0 failed),gpu_wave32_program_in_wave64_hardware, andgpu_geometry_wave32_prefix_count_over_a_maskall passedRegression run
main(6bac4b4):PR (
9e2c7a5):Not tested
AI use
scripts/smoke.ps1harness on this machine and formatted this report.@DavidM1911 on GitHub · 2026-11-24 11:06 UTC · original
Independent verification, merged onto current
main384f7f7locally (clean merge).Machine: Windows 11, Ryzen 9 7900X Radeon iGPU (gfx1036 RDNA2) + RTX 3060 Ti; Rust stable MSVC, debug.
XCL_ADAPTER=radeon XCL_SPLIT_WAVE64=1 cargo test -p xcl --lib split_wave64_reduction: 2 passed —split_wave64_reduction_tail_rulesandgpu_split_wave64_reduction_tailson the Radeon.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
@LANgmas on GitHub · 2026-11-24 11:11 UTC · original
Independent validation — NVIDIA RTX 3050 Laptop (wave32-only)
Tested PR head:
9e2c7a566574700755c2da4971bb2e882f56f506PR target base at validation:
9aec53dActual merge-base:
077ce40Current upstream/main at validation:
384f7f7f8c79fa4d4dee59336d650a4021af4c7e(approximately 30 commits ahead of the PR's merge-base).Tested the exact PR head in an isolated detached worktree.
Hardware / environment
d3d12SDKLayers.dllunavailableXCL_*variables unsetFocused tests — PASS
split_wave64_reduction_tail_rulesgpu_split_wave64_reduction_tailsv_min_u32v_add_f32v_add_f16upper-16-bit preservationv_add_f64EXECxcl_x_rla_uniformexchanges for the tested reduction tail.Full official test wrapper — PASS
Command:
.\scripts\test.ps1Result: 718 passed, 0 failed, 41 ignored, across 17 test binaries. Exit code 0.
The wrapper reported two GPU tests skipped due to lack of native wave64.
Additional skip reconciliation:
XCL_SAMPLE_*variables were unset. This is an estimate from source gates and observed runtimes, not an exhaustive per-test audit.Not tested
The PR's actual merge-base was approximately 30 commits behind current upstream main at validation time. This report describes the exact PR head tested, not merge-time validation against current main.
Interpretation
The focused GPU test confirms that the split-wave64 reduction-tail fold is exercised and produces the expected results on a real NVIDIA wave32-only adapter.
This provides independent NVIDIA validation complementary to the author's RTX 3060 Ti results and the AMD RX 9070 XT report.
No independent FPS or retail-game performance improvement is claimed from this test.
AI use
Devin (SWE-2 Max) assisted with test execution and result reconciliation. The contributor reviewed the results and authorized this report.
@DavidM1911 on GitHub · 2026-11-24 12:25 UTC · original
Independent verification, merged onto current
main384f7f7locally (clean merge).Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug; DXC 1.8.2502.11.
cargo test -p xcl --lib reduction_tail: 2 passed, 0 failed —split_wave64_reduction_tail_rules(emission rules) andgpu_split_wave64_reduction_tails(GPU, real hardware).cargo test -p xcl --lib wave64: 17 passed, 0 failed, 3 ignored — no regressions in the surrounding wave64 lowering.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
@DavidM1911 on GitHub · 2026-11-26 03:32 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin