Recompiler: lower wave64 VS/PS whole-wave reductions to WaveActive* #1126
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!1126
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1126"
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?
@GamingChelsea on GitHub · 2026-11-24 12:09 UTC · original
GamingChelsea:fix/wave32-partial-reduction→main· +755 −43 · 4 files · 1 commits · closed without mergingRecognise whole-wave integer reductions in wave64 VS / PS programs and lower them to HLSL
WaveActive*intrinsics so partial waves on 32-lane and 64-lane GPUs do not read unlaunched lanes (which read 0 instead of the reduction's identity element and lack the console's inactive-lane partial results).Note on docs: this addresses the partial-wave whole-wave reduction gap described in
docs/wave64-on-wave32.md("What is still not exact") andHANDOFF.mditem 5.What is in it
crates/xcl/src/gpu/recomp/upper_lanes.rs: track inactive-lane (unlaunched + helper) mask bits (inact_lo, treatingS_WQMasAny), inactive-lane VGPR constants (inact_const), and per-lane 64-bit reduction sets (VReduce/SReduce) acrossV_MIN_U32,V_MAX_U32,V_MIN_I32,V_MAX_I32,V_OR_B32,V_AND_B32,V_XOR_B32, andV_ADD_NC_U32(enforcing identity match and disjoint sets for non-idempotentxor/add); recordreduction_seedsandreduction_resultsplus unit tests.crates/xcl/src/gpu/recomp/mod.rsandcrates/xcl/src/gpu/recomp/emit.rs: capturexcl_red_<pc> = WaveActiveMin/Max/BitOr/BitAnd/BitXor/Sum(vN)before the first cross-lane step of a recognised reduction and substitute it at the finalv_readlane/v_readfirstlane(enabled for wave64 VS / PS on all GPUs; upper-lanexcl_hw32/Read::Const/Read::Shadowremain gated onsplit_wave64).crates/xcl/tests/wave32_partial_reduction.rs: standalone synthetic GPU tests (no retail files orXCL_SAMPLE_*) covering 3-quad and 1-quad partial-wave PS draws (V_MIN_U32,V_MAX_U32,V_MAX_I32over negative values) and a 3-vertex partial-wave VS draw (V_MIN_U32,V_MAX_U32,V_MIN_I32).Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2602.17, debug (tests) and release (smoke).cargo test --workspace -- --test-threads=4: 744 passed, 0 failed, 41 ignored.SKIPPEDGPU tests on this adapter (Wave32-only):gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64cargo test -p xcl --test wave32_partial_reduction -- --test-threads=1 --nocapture: 2 passed, 0 failed, 0 ignored (0 skipped).Regression run
main:
PR head:
Not tested
XCL_SAMPLE_RPF).AI use
@bjarngard on GitHub · 2026-11-24 12:45 UTC · original
Test report for head
1f6666f(AMD, native wave64)Tested
XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 744 passed, 0 failed, 41 ignored, no SKIPPEDXCL_REQUIRE_GPU=wave64:--lib whole_wave4 passed,--test wave32_partial_reduction2 passedgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwareNot tested: retail titles, RDNA3/RDNA4.
AI use: the tests were run and this report was written by an AI agent, Claude Code (Claude Opus 5.5), on the hardware above. The numbers are copied from the actual test output.
@0xTehuti on GitHub · 2026-11-24 12:59 UTC · original
Test report on NVIDIA GeForce RTX 2070 SUPER (Turing, wave32)
Commit tested
1f6666fe1e16992b87cdc667fc71d063c6ee767b(PR #1126 head)Tested
cargo test -p xcl --lib recomp:189 passed; 0 failed; 18 ignored; 0 measured; 513 filtered out; finished in 5.66scargo test --test wave32_partial_reduction:2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.54sgpu_wave32_partial_vs_min_max_reductions ... okgpu_wave32_partial_ps_min_max_reductions ... okWaveActive*operations.Not tested
AI use
@Cecerw on GitHub · 2026-11-24 14:09 UTC · original
Tested on NVIDIA Ampere (32-lane waves, split wave64): passes
1f6666f(base47efa2e)main930e8b4.\scripts\test.ps1(cargo test --workspace -- --test-threads=4), no local changes; the merge was done locally, no conflictswhole_wave_reduction_is_recognised_for_all_ops: ok; the existing wave64 VS / PS GPU tests (gpu_wave64_ps_whole_wave_reductionsand the others) pass in the split form this GPU usesgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware)Not tested: AMD, any title (no smoke run).
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
@JoaoPauluu on GitHub · 2026-11-24 14:35 UTC · original
A run on Linux under Wine.
Tested
x86_64-pc-windows-gnu.1f6666fas it is (based on47efa2e), no uncommitted changes. The lib test binary runs under Wine, one test per process (--exact).gpu::recomp::upper_lanes::tests::whole_wave_reduction_is_recognised_for_all_ops: ok, no SKIPPED.Not tested
AI use
@ddaikodaiko on GitHub · 2026-11-24 15:54 UTC · original · edited 2026-11-24 16:34 UTC
Test report for head
1f6666f, merged ontomain930e8b4— Windows 10 + Agility SDK.Tested
32.0.16.108810.0.19045.78461.620.2(%LOCALAPPDATA%\XCL\D3D12) — the recompiler GPU tests ran, no fallback to inbox SM 6.51.8.2502.11(Windows SDK10.0.26100.0)1.100.0x86_64-pc-windows-msvc, release1f6666fmerged intomain930e8b4locally, no conflicts, no other changescargo test -p xcl --test wave32_partial_reduction --release -- --test-threads=1 --nocapture: 2 passed, 0 failed, 0 skipped.cargo test --workspace --release -- --test-threads=4: 754 passed, 0 failed, 41 ignored, 2 SKIPPED (the usualno wave64:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware).s_or_saveexec,v_cndmaskwith the identity, DPP8 xor 1/2/4, row_mirror,v_permlanex16,v_readlane32, combine,v_readlane0) on a 6-pixel / 3-quad triangle, asserting the min and sum over its odd pixels. Onmain930e8b4it fails withmin 0where the console gives2(sum 20is correct). On this PR head the same test passes (min 2,sum 20). So the lowering recognises the real console idiom, not only the synthetic sequence inwave32_partial_reduction.rs.wave32_partial_reduction.rscovers min/max (u32 and i32) only, while the description also claimsV_OR_B32,V_AND_B32,V_XOR_B32andV_ADD_NC_U32. A local 3-quad PS test with the same idiom for those four ops (mask + identity, odd pixels 2 and 18):mainb7aa9f3:V_AND_B32returns 0, expected 2 (its identity is all ones, so unlaunched 0 wins); the run stops at that assertion.So the bitwise / add lowering is exercised too, not only min/max.
Not tested
xcl-smoke(the retail assets are still downloading here; noXCL_SAMPLE_*was set).AI use: OpenCode with DeepSeek V4.1 Flash built the tree, ran the tests and wrote this report; every number is from those runs.
@DavidM1911 on GitHub · 2026-11-25 08:02 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@GamingChelsea on GitHub · 2026-11-26 12:13 UTC · original
Closing as superseded: main now includes whole-wave reduction lowering (self.reductions / wave32_reductions).
Pull request closed