Fix whole-wave min reduction over a partial wave (WaveActive* recognition) #1847
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1857"
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?
Imported from ivall/xcl. Originally posted by llegate26 on 2026-11-24T21:58:07Z.
What is in it
v_cndmask_b32+ 3× DPP8 xor 1/2/4 + DPP16 row_mirror +v_permlanex16+v_readlane32/0) and emitWaveActiveMin/WaveActiveMax/WaveActiveBitOrover the launched lanes, suppressing only the within-half DPP steps.v_readlanelane 32 + op + lane 0 steps that combine the two 32-lane halves of a wave64 (cross-half).gpu_wave64_ps_partial_wave_min(synthetic, no game data) and negative tests for the recogniser.Tested
cargo test --workspace -- --test-threads=4: 1060 passed, 4 failed, 26 ignored. The 4 failures arefuzz_validate_and_gpu_*failing withCreateComputePipelineState: 0x8007000E(out of memory) — pre-existing, unrelated to this change.Regression run
scripts/smoke.ps1needs a real title (no title data in this environment).Not tested
scripts/smoke.ps1) on a real title.AI use
WaveActive*emission, and wrote and ran the synthetic tests.Imported from ivall/xcl. Originally posted by upipibi on 2026-11-24T22:07:07Z.
Checked on Ampere: RTX 3070 8 GB (32-lane waves, so wave64 compute is split over two host waves), driver 616.56, Windows 11, debug.
gpu_wave64_ps_partial_wave_minandgpu_wave64_ps_whole_wave_reductionspass onae53d84.A regression in split-wave64 compute.
recognize_whole_wave_reductionsruns for every program, not only graphics. In a wave64 compute program on a 32-lane GPU,WaveActiveMincovers one 32-lane host wave. Thev_readlane …, 32step it skips is what joined the two halves. I ran yourwhole_wave_reduceidiom as a 64-thread wave64 compute program: seed1000 - tid, every lane in the mask, so the minimum (937) is in lane 63, and every lane storess40:b9b6ea6ae53d84969 is the minimum of lanes 0..31 only. A wave64 PS on these GPUs has no populated upper half (
upper_lanes), so the PS tests can't show this. Limiting the recognition to that case, or skipping it when the console wave is split (runner::split_wave64()/ the emitter's x64 mode), would keep compute correct.Test (add next to
gpu_wave64_ps_partial_wave_min)AI-assisted (Claude Code). Synthetic tests only.
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-24T22:21:15Z.
Regression run for this PR: head
ae53d84, based onmainb9b6ea6. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release,XCL_NETWORK=0, A pressed every 4 s from 20 s,scripts/smoke.ps1on a retail title for 60 s, back to back with themainrun.main
b9b6ea6:this PR:
No device removals or crashes; 102 % of main's frames, 74 % of its peak commit.
Peak commit on
b9b6ea6is mostly the pipeline preload's DXC compiles on this machine (#1035, fixed on latermainby #1321), and it varies a lot from run to run.Not tested: the whole suite; whether the title reaches the changed reductions in these 60 s.
Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Imported from ivall/xcl. Originally posted by WebIdentity1 on 2026-11-24T22:51:12Z.
Scoped fix for the split-wave64 compute regression that @upipibi found on #1857, verified on an RTX 3090 at exact head
ae53d8435f346dbe66d47a78bd647060fe74eea9. I adapted their public fixture and kept the patch on this author-owned PR.Tested — native Windows 10 19045, RTX 3090 driver 591.74, Rust 1.98.1 MSVC,
XCL_ADAPTER=3090; direct DXIL and forced split unset. Public synthetic shader only.gpu_wave64_cs_whole_wave_min_spans_both_halvestest on the unmodified head: 0 passed / 1 failed, adapter printedNVIDIA GeForce RTX 3090,split=true,WaveActiveMin=true; all 64 lanes read 969 instead of 937. The intrinsic sees only the first host wave32; the suppressed readlane steps had joined both halves.split=true,WaveActiveMin=false, and all 64 lanes read 937. The threegpu_wave64_ps_controls passed 3/0, including the PR's partial-wave pixel minimum of 2. The rewrite remains enabled there.cargo build --locked --workspace: exit 0 on both snapshots.cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output: control 889 passed / 2 failed / 42 ignored, fix 890 / 1 / 42, across 20 targets with six explicitSKIPPEDlines each. The common failure is the existinggpu_clamp_and_omod_per_instructionon this driver; the extra control failure is this new test. No fix-only failure.Em::x64()'s mode predicate, so the original cross-half sequence stays intact only where a console wave spans two hardware waves.No commit or competing PR from me; please incorporate the small guard and regression if useful:
Two-file patch (40 insertions, one deletion)
Not tested: current-main integration, retail smoke/gameplay, driver compile cost, peak memory, AMD native-wave64, or other reduction idioms. This does not establish merge readiness; the PR description check is still red.
AI use: Codex desktop (GPT-6) adapted @upipibi's fixture, prepared the local patch, ran the Windows tests and drafted this report from the retained logs.
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T22:41:45Z.
Full-suite run, since this PR has no test report yet. Tested exact head
ae53d84(on its baseb9b6ea6).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: 889 passed, 0 failed, 42 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.gpu_wave64_ps_partial_wave_min.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 890 passed, 0 failed, 42 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out five tests where this PR's base has them. They fail on main689f2dbtoo, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns their skips into failures. These areheap_window_out_of_memory_falls_back_to_the_switch_form(#1651) and the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests (follow-up on #1651). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T01:28:46Z.
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T02:01:43Z.
CIworkflow approved for762c36e.Review note on
762c36e:recomp/mod.rsstill callsrecognize_whole_wave_reductions(&insts)unconditionally, so split-wave64 compute/mesh/geometry dispatches on 32-lane GPUs still hit the cross-half regression pointed out above (missing upper-half contribution). Guarding it whenopt.wave64 && opt.split_wave64 && matches!(opt.mode, Mode::Kernel | Mode::Compute(_) | Mode::Mesh(_) | Mode::Geometry(_)), fixing thePR descriptioncheck, and getting fresh AMD + NVIDIA verification on the updated head are needed before merge.Imported from ivall/xcl. Originally posted by upipibi on 2026-11-25T02:37:00Z.
Re-checked
762c36eon the RTX 3070 (driver 616.56, 32-lane waves, so the split form):gpu_wave64_ps_partial_wave_minandrecognize_rejects_wrong_reduction_variantspass withXCL_DIRECT_DXIL=0and1.AI-assisted (Claude Code).
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T00:34:59Z.
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:40:27Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:00:24Z.
Triage (#1607) – head
762c36eMain already fixes this. Commit
fb0931d("Recompiler: rebuild partial-wave graphics reductions") recognizes the same whole-wave min/max/or idiom (identityv_cndmask, DPP8 xor 1/2/4, row_mirror,v_permlanex16,v_readlane32 and 0), checks the saved-EXEC provenance, and rebuilds it with wave operations over the launched lanes.gpu_wave64_ps_whole_wave_reductionsinrecomp/tests.rscovers a partial wave. This PR'srecognize_whole_wave_reductionsalso does not check EXEC, and it skips thev_permlanex16write without checking whether that register is read later. Separately, the description names DeepSeek as the model that wrote the code, and CONTRIBUTING.md does not accept PRs written with it.Recommendation: close (superseded by main commit
fb0931d).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:49:25Z.
Closing as superseded: this change is already on
main(fb0931da). mainfb0931dagraphics_reductions recognises the same cndmask+DPP8 xor steps+row_mirror+permlanex16+readlane 32/0 idiom (min/max/and/or, wave32 and wave64, saved-EXEC provenance) and rebuilds with wave ops; partial-wave GPU tests exist; superset of the PRTwo independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed