What: in a fragment function, a quad reduction (sum, product, min, max,
and, or, xor) now asks OpGroupNonUniformQuadAnyKHR whether each of the
four quad lanes takes part ("the quad lane is j"), and reads each lane's
value with OpGroupNonUniformQuadBroadcast from constant lane j. The four
lanes then fold in Metal's order, (x0 op x1) op (x2 op x3), with a lane
that takes no part counted as the identity, as before. Every lane folds
the same four values in the same order, so each gets the same bits.
Kernels and vertex functions have no helpers and keep the ballot form
(the ballot of the active lanes, then a shuffle per lane). The IR gains
GroupInst::QuadAny: QuadControlKHR, SPV_KHR_quad_control and
shaderQuadControl, with no scope operand. The interpreter, the
serializer, the requirement deriver and the builder follow.
Why: Metal's helpers take part in a quad reduction. Vulkan section 9.31
runs quad group operations over the quad's helpers in every entry, and
its other group operations (a ballot, a shuffle) over them only where
the entry declares MaximallyReconvergesKHR. AMD's open Vulkan driver
leaves a helper out of the ballot even though the entry declares
MaximallyReconvergesKHR beside RequireFullQuadsKHR. The device test
quad_control's pixel [0,0] read [322,95,67] against [320,95,30]: quad
lane 1, the helper, was missing from AND and XOR. A form with only quad
instructions is right by the spec on every device, whatever the entry's
reconvergence (rung 1).
What full_quads asks: unchanged, shaderQuadControl. A fragment
reduction's operation class moves from Ballot and Shuffle to Quad.
Vulkan requires the Quad class wherever shaderQuadControl is supported
(vkspec: "If the shaderQuadControl feature is supported,
supportedOperations must include VK_SUBGROUP_FEATURE_QUAD_BIT"). No new
query.
Votes: a fragment's quad votes, quad_ballot, prefix sums, shuffles and
broadcasts keep the ballot form in this commit, as does every fragment
simdgroup operation. The planner ruled this item to reductions alone:
no stream's fragment calls a quad or simdgroup function, and 43 corpus
fragment rows need full quads. Under that driver a vote read through
the ballot is expected to carry the same defect (unverified).
Also: the simd module doc no longer says ClusteredReduce(4) for quad
reductions and votes. The Helpers paragraph and full_quads state what
9.31 gives under RequireFullQuadsKHR.