Commit Graph

2 Commits

Author SHA1 Message Date
26fabdbba8 rdna2spirv: guard native DPP FI=0 shuffle source 2026-11-24 18:27:48 -05:00
4d65bae6b2 rdna2spirv: run DPP's ballot and shuffle in every lane under SPIRV-Cross (SHADER-529)
SPIRV-Cross (MoltenVK) inlines a single-use result into the expression that
uses it. The DPP lowering put the source-EXEC ballot on the right of an
OpLogicalAnd (a short-circuiting && in MSL) and the shuffle in the arm of a
scalar OpSelect (a ternary), so lanes out of their row skipped the ballot and
the shuffle read from lanes that never ran it: row_shr:1's lane 1 found lane 0
inactive and kept its old value (cs_dpp_ops on MoltenVK).

Both results are now stored to a Function variable of their own (Gen.eager)
and loaded back; a store is a statement every lane runs. Only the DPP path
changes: of the 217 GPU test shaders that assemble here, exactly the nine
cs_dpp* ones translate differently, all still pass spirv-val, and SPIRV-Cross
1.3.239's MSL now computes the ballot and the shuffle as their own statements.

tests/semantic/test_dpp_eager_subgroup.py models SPIRV-Cross's single-use
forwarding and fails on the old lowering for all 11 DPP16/DPP8 forms tested;
it also checks the values in spirv_wave_interp.py against a DPP reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GN11jbD4AeqgwR5C5Z5Xs9
2026-11-22 21:09:28 +00:00