Repository navigation
fix(shader): prove half-wave reduction keys through selected and merged lane bits - #2449
Merged
oneandonlydean merged 1 commit intoOct 10, 2026
Conversation
…ed lane bits The half-wave reduction read (v_readlane_b32 of lane 31 or 63 after a DPP row scan) is exact on a narrower host subgroup only when the scan's keys are the identity outside the entry EXEC. EntryLaneWalk::ZeroBit now also proves that through a constant false, a SelectU1 whose two values both prove it, and a bool Phi whose inputs all do. A mask written inside a divergent branch reaches the key select in that form, so such a scan threw that lane 63 is outside the 32-lane host subgroup.
Contributor
|
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
No title was run. 🤖 Addressed by Claude Code |
Contributor
|
Tested on Linux (CachyOS x86_64, Intel RPL-S iGPU / Mesa 26.3.0-devel / Vulkan 1.4.363, GCC 16.2.1) at
LGTM! |
This was referenced Oct 9, 2026
This was referenced Oct 10, 2026
oneandonlydean
added a commit
to oneandonlydean/AnyPS5
that referenced
this pull request
Oct 10, 2026
oneandonlydean
added a commit
to oneandonlydean/AnyPS5
that referenced
this pull request
Oct 10, 2026
SleglJan
pushed a commit
to SleglJan/AnyPS5
that referenced
this pull request
Oct 10, 2026
…e-lane-bits fix(shader): prove half-wave reduction keys through selected and merged lane bits
This was referenced Oct 12, 2026
10 tasks done
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.
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
maina8b032b: 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)