fix(shader): prove half-wave reduction keys through selected and merged lane bits #2449
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2449"
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 boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T21:27:56Z.
What
#1268 reads lanes 31 and 63 of a wave64 DPP row scan as subgroup reductions, and returns the identity for lane 63 on a 32-lane host subgroup. It does this only when it can prove that the scan's keys are the identity outside the entry EXEC (
EntryLaneWalk::ZeroBit). When the key select's mask is written inside a divergent branch, the mask reaches the select as aSelectU1of boolPhis, and the proof gave up. The read then threw at preparation:ZeroBitnow also accepts:false;SelectU1whose two values both prove it;Phiwhose inputs all prove it, with the same cycle handlingWorduses for mask Phis.No new semantics: the emitted reduction is #1268's.
Before #639 such a shader failed only when the draw ran. Preparation now compiles it at the ABI helper, so the throw stops the title there.
Touches
core/shader/recompiler/SpirvBackend/src/SpirvAlu/SpirvAluEmitterMath.cpp.Tested
maina8b032b236: ctest 495/495.tools/check_conventions.pypasses.agc_shader_memory,verifyHalfWaveReduction: the UMin scan with its key mask written inside ans_and_saveexec_b64/s_cbranch_execzbranch reads lane 31 as a subgroup UMin on 32 lanes. Onmainit throws the lane 63 line above. The existing refusals (entry-EXEC keys, WQM mask,bound_ctrl, wrong permlane or join op) still throw.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T22:46:49Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
8a581853, merged ontomain09a3462ein one build with #2473, which currentmainneeds to build on Windows, and 3 other new PRs.agc_shader_memoryandagc_shader_bindless.No title was run.
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-09T22:50:19Z.
Tested on Linux (CachyOS x86_64, Intel RPL-S iGPU / Mesa 26.3.0-devel / Vulkan 1.4.363, GCC 16.2.1) at
8a581853:/tmp/anyps5_build) with zero warnings/errors.python3 tools/check_conventions.py --base origin/main --head HEAD-> PASS (0 errors).SpirvAluEmitterMath.cpp. Correctly proves reduction validity across selected/merged lane bit patterns.LGTM!