From 03e13a12c962f3e12b010a63784d64be7b989e0f Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sun, 22 Nov 2026 00:13:44 -0800 Subject: [PATCH] Docs: object and mesh SIMD-group functions are a recorded refusal; the vertex quad row says shuffles - docs/API.md, "Mesh pipelines": an object or mesh function that calls a SIMD-group, quad-group or SIMD-group matrix function is refused on every device, including a device that lists the task and mesh stages in subgroupSupportedStages. The translator models no subgroup facts for those stages (device/subgroup.rs, UNMODELED_STAGE). [[thread_index_in_simdgroup]] alone compiles there (the Linear tier). Until now no doc recorded this open gap where a user reads it. Of the corpus index's 14 object and 32 mesh functions, none calls an air.simd* or air.quad* intrinsic. - fixtures/public/engine/README.md, gsm2_vertex_quad_permutes' row: it said the translation emits Vulkan's quad instructions where the vertex stage takes them. It lowers each one to a subgroup shuffle through the ballot of the live lanes, on every device: a group plan takes quad instructions only in a kernel, as tests::engine_simd's vertex_quad_permutes_shuffle_through_the_live_lanes asserts. The runtime-sources.sha256 move from 032b641117 (device/derive.rs and device/subgroup.rs are runtime inputs) is a hash-only re-pin at landing, with no RUNTIME_VERSION bump. A run's behaviour does not change: the device's enables and caps are the same, and only the translator's subgroup model loses a field. --- .../fixtures/public/engine/README.md | 2 +- docs/API.md | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/README.md b/crates/metal2vulkan-validation/fixtures/public/engine/README.md index 0437c9b09..58ccebe24 100644 --- a/crates/metal2vulkan-validation/fixtures/public/engine/README.md +++ b/crates/metal2vulkan-validation/fixtures/public/engine/README.md @@ -273,7 +273,7 @@ threadgroup's threads); an authored case that executes a loop declares it | `gsm2_helper_threads_msl22` | `fragment_helper_threads_after_a_terminating_discard`, `fragment_helper_thread_alone_after_a_terminating_discard` | the helper queries after a discard with terminate semantics (MSL 2.2): quad ballots after it keep the discarded thread running as a helper, and the pixel's own answers alone let it terminate. Loop-free. | | `gsm2_quad_ops` | `quad_fills`, `quad_pair_fills`, `quad_typed_fills`, `quad_bitwise`, `quad_float_scans`, `quad_half_scans`, `quad_int_scans`, `quad_ops_divergent`, `quad_first_in_a_speculated_arm`, `quad_ops_in_a_vertex_function`, `quad_reductions_in_a_vertex_function`, `fragment_quad_fills`, `fragment_quad_fills_and_rotations`, `fragment_quad_scans`, `fragment_quad_bitwise`, `fragment_quad_ops_divergent`, `fragment_quad_first_in_a_speculated_arm`, `fragment_simd_fills` | the quad group operations in kernels, vertex functions and fragment functions: `quad_shuffle_and_fill_up`/`_down` with and without a modulo (constant and runtime, 2 or 4), `quad_shuffle_rotate_up`, `quad_broadcast_first`, `quad_and`/`_or`/`_xor`, `quad_product`, `quad_sum` and the quad prefix sums and products of `float`, `float2`, `half`, `half2`, `int`, `uint`, `short`, `ushort` and `uchar`, over full quads, partial quads and every mask of active lanes, and `simd_shuffle_and_fill_up`/`_down` in a fragment function; the float inputs are 1, -1, 2, -2, 0.5 and -0.5. `quad_first_in_a_speculated_arm` and its fragment twin are the arm shape Metal's backend speculates, which the translator speculates as Metal does (`air::canon::speculate`). Loop-free. | | `gsm2_simd_products` | `simd_float_products`, `simd_half_products`, `simd_int_products`, `simd_products_divergent`, `simd_rotate_up`, `simd_products_in_a_vertex_function`, `simd_rotate_up_in_a_vertex_function` | `simd_product`, `simd_prefix_inclusive_product` and `simd_prefix_exclusive_product` of `float`, `float2`, `half`, `half2`, `int`, `uint`, `ushort`, `uchar` and `short`, in divergent control flow too, and `simd_shuffle_rotate_up` by 3, by a buffer's 35, and by 31, in kernels and in vertex functions over rasterization-disabled points; the float inputs are 1, -1, 2, -2, 0.5 and -0.5, so every product of any association order is exact, and the integer inputs odd | Metal runs them in both stages and writes the same words on the M3 Max and the M4 over full simdgroups and over partial ones (the twelve `simd-*product*` and `simd-shuffle-rotate-up-*` cases; measured on the M3 Max and an M4); the exclusive product of the first active lane is 1; a vertex function needs subgroup operations in the vertex stage | -| `gsm2_vertex_quad_permutes` | `quad_permutes_in_a_vertex_function`, `quad_pair_permutes_in_a_vertex_function`, `quad_permutes_in_branches_of_a_vertex_function` | `quad_broadcast` of each lane 0 to 3 and `quad_shuffle_xor` by masks 1, 2 and 3, by constants, of `float`, `float2`, `half`, `int`, `short` and `uchar`, in vertex functions over rasterization-disabled points: whole quads, lane pairs of a partial quad, and two branches whose quads read only their active lanes | Metal on the M4 draws the words of the cases `quad-broadcasts-and-shuffle-xors-by-constants-in-a-vertex-function-of-64-points`, `...-of-40-points`, `quad-broadcasts-and-shuffle-xors-within-lane-pairs-in-a-vertex-function-with-a-partial-quad` and `quad-broadcasts-and-shuffle-xors-by-constants-in-branches-of-a-vertex-function` (measured on an M4); the translation emits Vulkan's quad instructions where the vertex stage takes them and shuffles from the same lanes elsewhere (MoltenVK); a device needs subgroup operations in the vertex stage. Loop-free. | +| `gsm2_vertex_quad_permutes` | `quad_permutes_in_a_vertex_function`, `quad_pair_permutes_in_a_vertex_function`, `quad_permutes_in_branches_of_a_vertex_function` | `quad_broadcast` of each lane 0 to 3 and `quad_shuffle_xor` by masks 1, 2 and 3, by constants, of `float`, `float2`, `half`, `int`, `short` and `uchar`, in vertex functions over rasterization-disabled points: whole quads, lane pairs of a partial quad, and two branches whose quads read only their active lanes | Metal on the M4 draws the words of the cases `quad-broadcasts-and-shuffle-xors-by-constants-in-a-vertex-function-of-64-points`, `...-of-40-points`, `quad-broadcasts-and-shuffle-xors-within-lane-pairs-in-a-vertex-function-with-a-partial-quad` and `quad-broadcasts-and-shuffle-xors-by-constants-in-branches-of-a-vertex-function` (measured on an M4); the translation lowers each to a subgroup shuffle through the ballot of the live lanes on every device (`vertex_quad_permutes_shuffle_through_the_live_lanes`); a device needs subgroup operations in the vertex stage. Loop-free. | | `gsm2_vertex_votes_shifts` | `simd_votes_in_a_vertex_function`, `simd_shifts_in_a_vertex_function` | `simd_all` and `simd_any` of `x > 0` and of `x > 100`, and `simd_shuffle_up` by 3, `simd_shuffle_down` by 5 and `simd_shuffle_and_fill_up(x, -x, 2, 32)`, in vertex functions over rasterization-disabled points | Metal runs them there and draws the same words on the M3 Max and the M4 over 64 points, and the votes over 40, whose second simdgroup is the eight vertices 32 to 39 (cases `simd-all-and-any-in-a-vertex-function-of-64-points`, `simd-all-and-any-in-a-vertex-function-with-a-partial-simdgroup`, `simd-shuffle-up-down-and-fill-up-in-a-vertex-function-of-64-points`; measured on the M3 Max and an M4); a device needs subgroup operations in the vertex stage | | `dsx_coverage_chain` | `chain_rects`, `chain_spans`, `chain_span_edges`, `chain_edges`, `chain_coverage`, `chain_color_discarding`, `chain_color`, `chain_gradient`, `chain_gradient_lod0`, `chain_gradient_hoisted` | the consumer's icon notch: a coverage chain through an `RG16Float` attachment, as a path renderer builds one: instanced rectangles or span quads (one per vertical edge of a disc's outline) add weights under additive blending, a fetch under early tests leaves the coverage, and a colour pass reads it by framebuffer fetch and discards where it is 0; or a gradient's fill reads the colour and the coverage, discards, samples a 32x32 noise texture (between its discards, at LOD 0, or before them), discards again, and writes the colour or mixes it over the fetched one. Dyadic values a `half` holds exactly. Loop-free | Metal's answer in each cell's shape and the clear elsewhere; plain Metal draws it on the M4 (every case) and the M3 Max (the cases without a gradient). Through MoltenVK on an M4 without a workaround the gradient's fills lose whole 8x4 blocks: a demoting discard, a sample from an argument buffer and an optnone call (SPIRV-Cross's `NoContraction` add) in a branch only discarded lanes take drop the SIMD group's later texture writes, a defect of Metal's own that plain Metal reproduces | | `dsx_fetch_returned_depth` | `fetch_returned_depth` | a fragment function without early tests that reads its color attachment, writes back half of it plus a quarter, and returns the depth its buffer holds (`[[depth(any)]]`) | beside a depth attachment it stores before the tests (`TestedStorageWrites` without an early-tests variant); a draw whose depth test can drop a fragment runs the variant that tests the returned depth in the shader (`tests::engine_fragment`, at one sample and at four) | diff --git a/docs/API.md b/docs/API.md index 3cad4f1bf..981e9ab18 100644 --- a/docs/API.md +++ b/docs/API.md @@ -999,6 +999,13 @@ stages are task and mesh shaders, which need `VK_EXT_mesh_shader` with `meshShad pipeline and each of its object and mesh functions (`Unsupported{MeshShading}`, naming what it lacks). +An object or mesh function that calls a SIMD-group, quad-group or SIMD-group matrix function is +refused on every device (`Unsupported{SubgroupOperations}`, `QuadOperations` or `SimdgroupMatrix`, +naming the stage's `VkProperty::SubgroupStage`), a device that lists the task and mesh stages in +`subgroupSupportedStages` included: the translator models no subgroup facts for those stages. Metal +gives both stages `[[thread_index_in_simdgroup]]`, which compiles, the lane derived from the linear +thread index as a kernel's is. + The mesh lowering is only compiled and validated: no mesh draw it makes has been compared with Metal on a GPU, and the runtime makes no mesh pipeline (its README's known gaps of render pipeline states). What follows is what the lowering emits.