From 0cd07d6612c9a60eaa3f27cf093f81ceecc305db Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 2 Dec 2026 19:04:58 -0800 Subject: [PATCH] Docs: API.md states the local size contract of a kernel on subgroups, which its shuffles rely on A translator consumer that is not metal2vulkan-runtime read nowhere in docs/API.md that a kernel stating RuntimeFact::LocalSizeConstraint runs only threadgroups whose size is a multiple of it, and that a dispatch at any other size runs the kernel's EmulatedSimdgroups variant. A half simdgroup sum or product on the Direct and Cluster32 tiers now reads its sibling lanes by xor shuffles in a block every lane executes, which name an inactive lane in a partial subgroup. Section 6 now says so, and that the emulated variant gives Metal's answers for the partial simdgroup, as the runtime's variant choice does (pipeline.rs: a module with multiples gets KernelVariant::EmulatedSimdgroups). Verified: docs only; the contract read from device::subgroup::requirement and the runtime's variant choice. --- docs/API.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/API.md b/docs/API.md index 11683a042..39268a650 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1370,7 +1370,12 @@ establishes no other bit. ## 6. At bind time A kernel's dispatch runs as one or more regions, each a group count with its specialization and -push constants, and each distinct specialization is one `VkPipeline`. A kernel's +push constants, and each distinct specialization is one `VkPipeline`. A kernel whose simdgroups +run on subgroups states `RuntimeFact::LocalSizeConstraint { multiple }`: each region's local size +is a multiple of `multiple`, so every subgroup is full and, in a block every lane executes, a +simdgroup operation reads its sibling lanes by plain shuffles, none of them inactive. A dispatch +whose threadgroup size is not such a multiple runs the kernel's `EmulatedSimdgroups` variant, as +`metal2vulkan-runtime` does, which gives Metal's answers for the partial simdgroup. A kernel's partial-threadgroups variant (`LoweringInputs::partial_threadgroups`) runs a grid that is not whole threadgroups as the threadgroups its threads fill at the dispatch's threadgroup size, the last along an axis Metal's partial threadgroup, so every remainder takes the same `VkPipeline`; a