mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 00:22:57 -05:00
The GFX10 lowering of a wave64 reduction scans rows with DPP row_shr 1/2/4/8 and v_permlanex16_b32 under EXEC -1, then joins lanes 31 and 63 with a scalar op. The console fills lanes outside the entry EXEC with the identity, but on the host they can be helpers that sit out subgroup operations or invocations that were never launched: on 64 lanes (RADV) the emulated chain reads 0 or stale values from them, and on 32 lanes lane 63 throws since #997. EmitReadLane now recognises the sequence on any host for UMin, UMax, SMin, SMax, IAdd, AND and OR when the keys are the identity outside the entry EXEC. On 64 lanes, lanes 31 and 63 become subgroup reductions of the keys of invocations 0-31 and 32-63; on 32 lanes or fewer, lane 31 reduces all keys and lane 63 is the identity. It throws without subgroup arithmetic or on a subgroup wider than the wave. VulkanDevice reports GroupNonUniformArithmetic and ShaderValidation checks it.