Commit Graph
9267 Commits
Author SHA1 Message Date
Anees Iqbal 3bc285acaa Translator: SEMANTICS_VERSION 2293 for a kernel's floor tail returning at entry
A kernel's lowering under a floor tail changed (3a4fe0d314: the entry return in place of a select
per pushed field), so every such kernel's output moved under an unchanged key. Render stages'
output is unchanged.

Verified card-free (job m3-max-71203, gb-3090-r3 and gb-780m-u2 lowered on nvidia-rtx50-linux,
amd-780m-radv and intel-irisxe-anv): 2,818 kernel modules changed, each by select -N, branch +1,
return +1, and split - tip equals b3fd1a568c - 059835018a in every instruction count; 5,025 of
5,025 render states' stage modules byte-identical to the tip's.
2026-11-23 06:43:13 -08:00
Anees Iqbal 3a4fe0d314 Translator: a kernel's floor tail returns at entry again; a render stage's folds into its other pushed fields
Since 059835018a every stage folded its tail's test into each other pushed field through a
select. A kernel's entry also returns invocations before its body where its dispatch passes its
grid (dispatch::emit_entry), so a return at entry is a kernel's own shape, and the selects cost
kernels on three vendors. A fragment stage has no other return at its entry; AMD's open driver
(AMDVLK 2025.Q2.1) died making one whose body ran under the never-taken return, which is what the
fold removed.

Now the stage kind decides it, the same on every device:
- Stage::Kernel loads its push fields in placement order, then returns where the tail holds what
  the consumer never pushes (EmitCx::emit_tail_guard, lower::push::return_never_pushed), as
  before 059835018a. The tail's read is in the first block, and everything the kernel does after
  the return depends on it.
- A render pipeline's stage (vertex, fragment, object, mesh) keeps the fold as shipped
  (EmitCx::fold_tail, lower::push::fold_never_pushed): no branch on the tail.
- EmitCx::tail_test reads the tail and makes its test for both; load_fields loads the fields a
  filter takes, in placement order.
- Docs: lower/push.rs, lower/emit.rs, the arena test's module doc, docs/API.md section 5.

Same pushed bytes, same placement, no interface change.
2026-11-23 06:26:25 -08:00
Anees Iqbal c2d505c30c Tests: a kernel returns at entry where its floor tail holds what is never pushed (red)
The floor's tail test folds into every pushed field through a select in every stage since
059835018a. A kernel's entry already returns invocations past its grid before its body, so a
return at entry is a kernel's own shape, and the fold costs kernels a select per pushed field.

- a_kernel_returns_at_entry_where_its_tail_holds_what_is_never_pushed: many_of(3), a kernel, on
  PROFILES and runtime-floor: the tail's test is the condition of one branch and of no select,
  and the module returns twice. Fails at the tip (4 selects, no branch, one return).
- the_floor_s_tail_folds_into_the_other_pushed_fields_with_no_branch narrows to render stages as
  a_render_stage_s_tail_folds_into_its_other_pushed_fields_with_no_branch: the same reads in a
  fragment function (many_in(true, 3)), one select per pushed field, no branch, one return.
- many_in builds many_of's reads as a kernel or a fragment function; tail_test_uses reads the
  tail test's uses for both tests.
2026-11-23 06:26:24 -08:00
Anees Iqbal 38c5f2e96a rt: decide's lifetime is elided, and the cache-directory test reads the observer's two modules again
Fixes forward e59c621e48, whose compile job m3-max-71176 failed two ways:

- clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd): needless_lifetimes at encoder.rs decide().
  Its one reference input since the restore is `compiled`, so the returned kernel's lifetime is
  elided.
- every_device_takes_the_kernels_a_device_before_it_lowered_from_the_cache_directory on lavapipe:
  `left: (3, 0)`, `right: (2, 0)`. The restore makes an observing kernel's state lower its plain
  module and its partial-threadgroups variant again, so the first device translates three modules
  (the tiling kernel's and the observer's two) and the second loads three from the directory. The
  test's counts, its comment and its doc go back to their values before d8eb5ea024 (the test of
  a103b4dc5a), which had moved them to two when the variant became the state's only module. The
  code is right; the expectation was the series'.

The other 684 rt tests on lavapipe passed in m3-max-71176, among them the 10 observer and
ragged-grid tests.
2026-11-23 06:23:17 -08:00
Anees Iqbal e59c621e48 rt: an observing kernel's whole grids, threadgroup dispatches and indirect dispatches run its plain module again; its partial-threadgroups variant runs ragged grids only
This restores 28e1026b3d's routing, in a new commit past four that changed it:
- 6453edbea7 ran an observer's whole grids on its partial-threadgroups variant;
- f090d99c9a added its indirect dispatches;
- 9a01f1e8ee kept the plain module only where the variant's vote word passed the limit;
- a103b4dc5a lowered the variant alone unless keeps_plain held.

The variant's predicated walk and partial-group answers cost each whole grid. The series was
measured at 3.5% slower a dispatch on an RX 7900 XTX when it landed (README known gap,
m3-max-67284), and the guest's GPU fall on the 3090 lies in 28e1026b3d..f979769faf, which holds
the series.

- encoder.rs decide(): the observer route goes. A dispatch runs choose()'s module: whole grids,
  threadgroup dispatches and indirect dispatches the plain module, a ragged grid the variant, and
  a threadgroup that is not whole SIMD groups the emulated variant. decide() takes the device's
  threadgroup memory bytes alone, for the vote word's refusal site. The ragged grid's
  threadgroup memory check is unchanged: a ragged grid whose lengths with the variant's vote word
  pass the limit is still Limit::ThreadgroupMemory (9a01f1e8ee's refusal, kept).
- pipeline.rs: an observing kernel's state lowers its plain module and its variant beside it,
  always (Partial::Alone and keeps_plain go). Its main pipelines at the declared size are two,
  as before the series: the plain module's (main_key, now the whole module's by decide) and the
  variant's ragged grid (ragged_key). finish_pipeline makes both, a kernel past the stage bound
  makes both at the creation, and a first use of either is an unfinished-pipeline wait. No
  variant is made lazily at a first ragged grid.
- Metrics::partial_variant_whole_grids stays, and reads 0. The conformance runner's
  dispatch-forms line prints only where it is above 0.
- Docs: the rt README's compute pipeline states (the routing, and the main pipelines), with the
  known-gap bullet the series added (3.5% XTX, 2.7% Iris) gone; docs/API.md section on the
  variant's regions; the Metrics docs; decide(), choose(), dispatch_threads and pipeline.rs's
  module docs.

No translation changes: the translator's modules and keys are the same, so there is no SEMANTICS
or ARTIFACT bump and no bless. Only rt files change.

Tests (red at 8a2f9109aa, green here):
- every_device_runs_an_observing_kernel_at_its_own_threadgroup_size: its whole grids,
  threadgroup and indirect dispatches add 0 to partial_variant_whole_grids, its ragged grids
  count in partial_variant_ragged_grids, and the creation lowers two modules.
- every_device_keys_a_dispatch_by_the_pipeline_it_runs: the whole, threadgroup and indirect
  entries share the plain module's key; the ragged ones take the variant's.
- every_device_finds_made_what_prepare_dispatch_made: a ragged grid and u32::MAX threads each make
  the variant's pipeline.
- every_device_keeps_a_kernel_that_reads_across_rows_after_a_barrier_at_its_own_size and
  every_device_makes_a_declared_bound_s_grids_with_the_state: a declared size makes two pipelines
  with the state, and its whole and ragged grids make nothing and wait for nothing.
- kernel_map's shared-content test: the observing content lowers twice.
The ragged-grid tests stay as they were:
- every_device_runs_a_stage_in_kernels_partial_threadgroup;
- every_device_runs_a_1024_thread_observers_ragged_grid_in_the_limit_less_its_vote_word;
- every_device_runs_a_kernel_without_a_vote_word_at_a_length_past_its_answer;
- every_device_runs_an_observer_on_its_plain_module_where_the_vote_word_passes_the_limit.
2026-11-23 06:16:29 -08:00
Anees Iqbal 8a2f9109aa rt README: the layered-resolve gap names the card it was measured on
The line from af268e90c8 named the Radeon 780M too, on a record that both AMDVLK cards gave the
same result; no job output shows the 780M's layered resolve (m3-max-70391 ran both cards but
prints no per-card case lines, and the repro m3-max-70937 ran the RX 7900 XTX alone). The line
names the RX 7900 XTX alone, as measured.
2026-11-23 05:15:37 -08:00
Anees Iqbal 45fa4d2d7a rt README: AMD's open driver resolves a slice above 0 of a multisample array from slice 0
A known gap of render encoders, where a user reads it. Under AMD's open Linux driver (AMDVLK
2025.Q2.1), a render pass resolve of a 2D view of a slice above 0 of a multisample array texture
writes the right slice of the resolve texture with the samples of the array's slice 0: the
conformance case layered-resolve-places reads 64 of 64 texels 0 in the resolved slice (job
m3-max-70391, the RX 7900 XTX); RADV on the same card is exact. Vulkan's resolve combines the
samples of the attachment's own view (vkspec 8.7; VkImageSubresourceRange::baseArrayLayer), so it is
the driver's, with no rt form (workaround ladder rungs 3 and 4).

Verified: a standalone Vulkan repro with no runtime code (dynamic rendering, a TYPE_2D view of layer
N of a 4-sample 3-layer R32_SFLOAT image resolved with AVERAGE into layer N of a single-sample
array) on the RX 7900 XTX in one job, m3-max-70937: AMDVLK fails 5 of 7 runs (every layer 1 and 2
run; with the multisample layers cleared first, the resolved layer holds layer 0's clear, 0.5),
passes layer 0, and vkCmdResolveImage shows the rendering itself in the right layer; RADV (Mesa
26.2.6) passes 7 of 7. The upstream draft is staged for the owner (report 143). No replay stream
resolves: 0 resolve attachments over the 26 streams (census jobs m3-max-70810, 70811, 70812), so
no form search. No ledger row: known-gaps-rt.tsv holds no row for the AMDVLK venue for any case,
and the case has no row on the matrix venues, where it matches.
2026-11-23 05:15:31 -08:00
Anees Iqbal 06058348cd Golden tables: blessed at bd37a327d0 (SEMANTICS 2287 -> 2292)
The pin's one bless, at the pin candidate bd37a327d0 (job m3-max-70960 on the M3: inventory,
golden hashes, printouts, opened chains and the authored-compile census, each exit 0). Only the
two tables change; no source.

golden_hashes.tsv, classed:
- 120 cells changed, all amdquad's (211c10a594, a fragment's quad reductions through quad
  instructions): 5 subjects (gsm2_quad_ops fragment_quad_bitwise, fragment_quad_ops_divergent,
  fragment_quad_scans; rch_helper_tangle rch_tangle_quad_after, rch_tangle_quad_before) in both
  fixture forms, on the 12 profiles with quad control; moltenvk-m3, nvidia-pascal-linux and
  runtime-floor unchanged.
- 30 cells new: rag429's fixture kernel_stage_in_groups (stage_in_neighbour, both forms, 15
  profiles), recorded as its refusal class NeedsInput{StageInputDescriptor} (the table lowers
  without a stage-input descriptor).
- quadvote (de44227e11) changes no cell: no golden fixture has a fragment quad vote.
- Nothing else moved; no row removed.

authored-compile.tsv: the product fingerprint; 5 quad-control cases' compiled artifacts (the
quad reductions' new form); rag429's Metal case ff2af27df7f8 added as
not_supported{tooling_requirement:kernel_stage_input}.
2026-11-23 05:15:04 -08:00
Anees Iqbal bd37a327d0 Translator: SEMANTICS_VERSION 2292 for a stage-in kernel's partial-threadgroups variant
The variant of a kernel that reads a stage-input region was a refusal and is a module since
c6feccf773, under the same key, so cached translations of it are stale. c6feccf773's message names
2290 and its red test by the sha before this branch was rebased (9089b4eea2, now f4ae2c826f): the
quad vote form took 2291 on development first, and this bump is the one that commit describes. No
plain module changes.

Verified with the rebased tree's compile job (named in the landing report).
2026-11-23 04:48:13 -08:00
Anees Iqbal a2eefc6b3d Case: a stage-in fetch in a partial threadgroup beside a barrier, qualified on Metal
stage-in-fetch-in-a-partial-threadgroup-beside-a-barrier (case ff2af27df7f8) runs the public
fixture kernel_stage_in_groups' stage_in_neighbour as a grid of 25 threads in threadgroups of
1,024 (dispatchThreads), over a stage-in region at origin 7 of size 1,024 whose data ends at the
last thread's element, and records all 26 uint4 of its output buffer: each thread's neighbour's
attribute, threads_per_threadgroup, its grid position and its index, and the 26th uint4 untouched.

Verified: qualified on the M3 Max (apple-m3-max-macos27.0.1) by corpus-metal in job m3-max-70928,
three runs; the output's hash (835a95a8668c) equals the hash of the bytes the rationale states,
computed apart (threads_per_threadgroup reads 25, the partial threadgroup's size).
2026-11-23 04:48:01 -08:00
Anees Iqbal c6feccf773 Translator: a kernel that reads a stage-input region takes its partial-threadgroups variant
plan_partial_groups refused a kernel's partial-threadgroups variant wherever it had a stage-input
descriptor, so rt refused every dispatchThreads grid that is not whole threadgroups of a kernel
with a [[stage_in]] attribute (Gap::PartialThreadgroups at the translator's site). The probe over
the 11,580 indexed kernels (m3-max-70807) counted 62 such kernels on amd-780m-radv,
nvidia-rtx50-linux and intel-irisxe-anv alike; a consumer's first-time setup meets one of them.

The refusal goes and nothing is added to any module: the fetch already stays inside the grid.
An invocation past its threadgroup's threads returns in dispatch::emit_entry, which the entry
runs before stage_io::emit_entry's fetch. Where the body holds a workgroup barrier the variant
walks it predicated instead, so such an invocation does fetch, but its position in the
threadgroup is lin unflattened over the threads left (local_pos), so along x and y, the only axes
a step reads, it is inside the grid, and its element is one a Metal thread there fetches too; it
runs none of the body. A kernel that does not observe its partition now takes the grid-tiles
variant, whose invocations past the grid return before the fetch as well.

SEMANTICS 2290: the variant of a stage-in kernel was a refusal and is now a module, under the
same key. No plain module changes.

The two tests of 9089b4eea2 turn green: the translator's interpreter run over a source buffer
ending at the last thread's element and a region that clamps nothing traps on any fetch past the
grid, and rt runs both kernels' partial threadgroup of 25 in 1,024.
2026-11-23 04:48:01 -08:00
Anees Iqbal f4ae2c826f Tests: a stage-in kernel's partial threadgroup of 25 in 1,024 (red)
rt's every_device_runs_a_stage_in_kernels_partial_threadgroup dispatches a grid of 25 threads in
threadgroups of 1,024 of engine/kernel_stage_in's stage_in_fetch, which does not observe its
partition, and engine/kernel_stage_in_groups' stage_in_neighbour, which holds a threadgroup
barrier, each under its stage-input descriptor, with the stage-in region at origin 7 and 1,024
elements long over a source buffer that ends at the last thread's element. It checks all 25
threads' words against Metal's, every word past the grid unwritten, and that the walked kernel
counts one ragged grid on its partial-threadgroups variant.

The translator's a_stage_in_kernels_partial_threadgroup_fetches_inside_its_buffer runs both
kernels' partial-threadgroups variants on the CPU interpreter over the same layout, with the
source and output buffers exactly as long as the threads reach and the zero range unmapped, so a
fetch past the buffer or a store past the output traps.

Both fail today: the translator refuses a kernel's partial-threadgroups variant where it reads a
stage-input region (plan_partial_groups), and rt refuses the dispatch as
Gap::PartialThreadgroups at the translator's site.
2026-11-23 04:47:56 -08:00
Anees Iqbal b31e8bc917 Fixture: kernel_stage_in_groups' companions, its inventory rows and its golden printout
Compiled by scripts/regen-air-fixtures on the M3 (job m3-max-70842; metal 32023.922, SDK 27.2),
with the engine inventory and the engine printouts blessed in the same job. Without a stage-input
descriptor the kernel is NeedsInput{StageInputDescriptor} on every profile, as every stage-in
fixture is. The golden rows are blessed on development.
2026-11-23 04:47:56 -08:00
Anees Iqbal add7f28ad0 Fixture source: kernel_stage_in_groups, our MSL fetching a stage-in attribute beside threadgroup memory and a barrier
One kernel, stage_in_neighbour: each thread fetches a uint [[stage_in]] attribute, stores it in
threadgroup memory, and past a threadgroup barrier reports its threadgroup's next thread's word
with threads_per_threadgroup, its grid position and its index. It observes its threadgroup
partition and holds a workgroup barrier, so a dispatchThreads grid that is not whole threadgroups
runs it on the partial-threadgroups variant's predicated walk. The companions follow from
scripts/regen-air-fixtures on the M3.
2026-11-23 04:47:56 -08:00
Anees Iqbal de44227e11 Translator: SEMANTICS_VERSION 2291 for a fragment's quad votes in the quad vote form
What: SEMANTICS_VERSION goes from 2289 to 2291 (2290 is held by another
change). A fragment's quad_all and quad_any are now
OpGroupNonUniformQuadAllKHR and OpGroupNonUniformQuadAnyKHR (1958c34e85),
so its words change under an unchanged key.

Why: a cached artifact of the ballot form would serve AMDVLK's wrong
answer for a quad with a helper.

Verified, base c4aee831e9 (the red test alone) against fix d701f8e921:
- Red/green, um790, m3-max-70847 and m3-max-70857. AMDVLK 2025.Q2.1
  with the base: 12 of the 36 covered pixels wrong on the RX 7900 XTX and
  on the Radeon 780M, each covered pixel of the four diagonal quads
  reading quad_any(x > y) = 0 and quad_all(x <= y) = 1 where Metal
  answers 1 and 0. With the fix 36 of 36 on both cards. RADV (Mesa
  26.2.6) reads 36 of 36 on both cards with both arms. The quad
  reduction test reads its quads whole in all eight arms.
- Checks at d701f8e921 (m3-max-70855, msi): fmt; clippy -D warnings on
  the workspace (all features), on metal2vulkan with no feature and with
  serde, ash and cli alone, and under --cfg m2v_gpu and --cfg m2v_cpu_icd
  for metal2vulkan and the runtime; Rustdoc -D warnings; the
  translator's simd, spirv, quad and golden tests, 499 of 500, the one
  failure the golden table (bless due); the runtime's device suite on
  lavapipe (--cfg m2v_cpu_icd), 683 of 683, quad_votes 36 of 36.
2026-11-23 04:46:39 -08:00
Anees Iqbal f8bd4941e2 rt test: quad_votes' fragment stage holds one quad vote instruction of each kind and no ballot
every_device_votes_over_its_quads_helpers now also checks the translated
fragment stage: one OpGroupNonUniformQuadAllKHR, one
OpGroupNonUniformQuadAnyKHR and no OpGroupNonUniformBallot, so it fails
without the quad vote form on every device, not only where a driver
leaves the helper out of the ballot. The stage's opcodes come from a
helper, fragment_ops, which quad_sum_after_a_return's checks now share.
2026-11-23 04:46:38 -08:00
Anees Iqbal 624c5a38b9 Translator: a fragment's quad votes are OpGroupNonUniformQuadAllKHR and QuadAnyKHR, helpers included
What: in a fragment function, Metal's quad_all and quad_any are now
SPV_KHR_quad_control's OpGroupNonUniformQuadAllKHR and
OpGroupNonUniformQuadAnyKHR of the predicate, in place of the quad's four
bits of the ballot of the predicate (compared with the ballot of the
active lanes for quad_all). Kernels and vertex functions have no helpers
and keep the ballot form. The IR gains GroupInst::QuadAll beside
QuadAny (no scope operand; QuadControlKHR, SPV_KHR_quad_control and
shaderQuadControl), and the builder's group_quad_any becomes
group_quad_vote(all, pred), as group_vote is. The interpreter, the
serializer and the requirement deriver follow. items.txt lists
GroupNonUniformQuadAllKHR, and scripts/regen-spirv-grammar regenerated
spv.rs from SPIRV-Headers vulkan-sdk-1.4.341.0: the opcode loses its
cfg(test); the test parser's table already held it.

Why: Metal's helpers are active lanes of their quad and take part in
its votes. Vulkan section 9.31 runs quad group operations over a quad's
helpers in every entry, and its other group operations, the ballot
among them, only where the entry declares MaximallyReconvergesKHR. AMD's
open Vulkan driver leaves a partly covered quad's helper out of the
ballot even though the entry declares MaximallyReconvergesKHR beside
RequireFullQuadsKHR (report 142), so a vote read through the ballot
missed the helper: the runtime test quad_votes read quad_any(x > y) = 0
and quad_all(x <= y) = 1 on the 12 covered pixels of the diagonal quads,
where Metal answers 1 and 0 (m3-max-70847, AMDVLK 2025.Q2.1 on the RX
7900 XTX and the Radeon 780M; RADV right on both). The quad vote
instructions are right by the spec on every device whatever the entry's
reconvergence (rung 1), the form the quad reductions took (54517169dd).

What full_quads asks: unchanged, shaderQuadControl. A fragment vote's
operation class moves from Ballot to Quad, which Vulkan requires
wherever shaderQuadControl is supported. No new query.

Still through the ballot in a fragment: quad_ballot, the active mask,
is_first, broadcast_first, the quad prefix sums, and every simdgroup
operation.

Tests: operation_classes_follow_the_tier gains a fragment's quad All and
Any (Quad); fragment_quad_votes_are_quad_vote_instructions compiles a
fragment of both votes on every committed profile with quad control (one
QuadAllKHR, one QuadAnyKHR, no ballot) and checks a kernel's votes
(a3_quad_votes_divergent) take neither instruction.
2026-11-23 04:46:38 -08:00
Anees Iqbal 831a7979ac rt test: a fragment's quad votes count the helper of a quad the triangle cuts (red under AMD's open driver, expected)
The input is the test's own fragment, quad_votes: each pixel writes its
quad's quad_any(x > y) and quad_all(x <= y), drawn by the triangle the
quad_control test draws, which covers the pixels with x <= y and cuts
each diagonal quad at its top right pixel, a helper. In a diagonal quad
only the helper is right of the diagonal, so Metal's quad_any holds and
its quad_all does not; in a quad the triangle covers whole the other way
round. Every device of the cfg's kind with quad control makes the state
and each covered pixel must read those votes.

The draw moves into a helper, diagonal(), which the quad_control test
now shares.

Why: under AMD's open Linux driver a fragment's OpGroupNonUniformBallot
leaves out a partly covered quad's helper (report 142), and a quad vote
still reads its quad's bits of the ballot (lower::simd::group, quad_op).
2026-11-23 04:46:38 -08:00
Anees Iqbal b755b42af5 rt docs: two private intra-doc links that no longer resolve or are redundant
CI's "Private intra-doc links" step holds metal2vulkan-runtime at 0 diagnostics; development
carried 2 (found by lane d3dsync's gate, jobs m3-max-70845, 70861, 70891):

- pipeline.rs: a kernel interface's `threadgroups` doc linked `Variant::threadgroup_lengths`,
  a field Variant does not have (the encoder holds the lengths as set; a variant keys them as
  `lengths`, whose words follow `threadgroups`' order, encoder.rs ~1554). It links
  `Variant::lengths` now.
- function_table.rs: `[`MAX_BUFFER_LENGTH`](crate::MAX_BUFFER_LENGTH)` is redundant where the
  name is in scope; the plain link resolves to the same item.

Verified: the private-items Rustdoc pass for every crate, in the job named in the follow-up.
2026-11-23 04:39:56 -08:00
Anees Iqbal 3700faf60f rt: Direct3D 11 planes read twice back to back, and a timing of 64 such reads
Two reads of the planes Direct3D 11 drew, each a command buffer of a
queue of its own so each goes in a submission of its own, the second
committed before the first is waited for: both read picture 1 exactly,
and the two submissions count two in Metrics::d3d11_plane_submissions,
two acquires and two releases, the barriers recorded printed. This is
the case whose first release nothing ordered before the second's
acquire until the global barrier ahead of each acquire; a job may run it
under the validation layer's synchronization checks
(VK_KHRONOS_VALIDATION_VALIDATE_SYNC).

On an instance without the layer, 64 reads committed back to back on one
queue, the last waited for: wall time per command buffer, five runs,
their median and plane-keeping submissions printed only. The read helper
is split so both tests encode the same blits; the import is a helper.

Verified: cargo fmt. The UHD jobs that run them follow.
2026-11-23 04:38:55 -08:00
Anees Iqbal 0a3625b07e rt: a global barrier from and to every stage before a Direct3D 11 plane's acquire
An acquire from VK_QUEUE_FAMILY_EXTERNAL ignores its srcStageMask, so its
first synchronization scope does not apply, and Vulkan 1.4 section 7.7.6
has the release before it happen-before it. Two plane-keeping submissions
in flight together on rt's one queue (two reads with no wait between) had
nothing that ordered the first's release before the second's acquire:
rt meets event waits on the CPU and adds no semaphore wait.

The head command buffer now records a global barrier, ALL_COMMANDS to
ALL_COMMANDS (record::barrier, Reach::Commands), before the acquire. Its
first scope takes the earlier release ("VK_PIPELINE_STAGE_ALL_COMMANDS_BIT
is the only valid stage to wait on or wait for these operations") and its
second the acquire after it. One more barrier per plane-keeping submission,
counted in Metrics::barriers.

Verified: cargo fmt. The test of two reads back to back and the gate and
UHD jobs follow.
2026-11-23 04:38:55 -08:00
Anees Iqbal 35243bc211 rt: each submission that uses a Direct3D 11 plane acquires it at its start and releases it at its end
A Direct3D 11 surface's planes were acquired from VK_QUEUE_FAMILY_EXTERNAL
by Surface::external_writes_done and released by
release_surface_to_external, one call each, which the consumer had to pair
around every Direct3D 11 access. The consumer never called the release
(zero hits in its checkout at 76c55a4074), so rt kept the planes from the
first acquire on while Direct3D 11 drew into them.

Each submission whose command buffers or uploads use a plane now acquires
it from VK_QUEUE_FAMILY_EXTERNAL in a command buffer of rt's own ahead of
everything (the uploads included) and releases it in another after
everything, both GENERAL to GENERAL (VUID-VkImageMemoryBarrier-
srcQueueFamilyIndex-12332, -dstQueueFamilyIndex-12331): Direct3D 11 owns
the planes' memory between rt's submissions. Planes are kept per segment
(keep_texture), so a submission of segments before an event wait, which
the submit thread meets on the CPU, acquires none of the planes the
segments after the wait use; a segment that signals passes its planes to
the next, as a texture bound after a signal is used by the command that
splits. The two command buffers are uploads, so they retire with the
submission, and the release holds the images. The release takes the
last segment's signals, so no VkSubmitInfo2 is added; nor is a submission
or a wait. Metrics::d3d11_plane_submissions counts each such submission,
and each barrier counts in external_acquires or external_releases.

Surface::external_writes_done and release_surface_to_external record
nothing for a Direct3D 11 surface now; no public item is removed. The
consumer's external_writes_done call (d3d11_surface.rs:93 at 76c55a4074)
stays valid.

Docs: d3d11.rs, the runtime README, the Metrics fields and the two calls
state the per-submission hand-over, and that no keyed mutex is used by rt
or on the textures (SHARED | SHARED_NTHANDLE, not SHARED_KEYEDMUTEX).

Tests: the import test asserts that its three submissions that keep the
planes count three, with three acquires and three releases; the drop
test's three drops now send nothing, no upload holding a plane.

Verified: cargo fmt; api signatures and the refusal surface unchanged
(signatures.py --check, refusal_surface.py --check). The device-cfg
builds, clippy, Rustdoc, lavapipe and the UHD 630 run are named in the
next commit or the landing report. AMD and NVIDIA Windows drivers are
unverified: the lab's one Windows GPU is the UHD 630.
2026-11-23 04:38:55 -08:00
Anees Iqbal e4e6635d4c rt: Metrics::d3d11_plane_submissions, and a Direct3D 11 draw in the import test (red)
rt's Direct3D 11 import test wrote its pictures with UpdateSubresource, a
copy. The consumer writes them with draws into render targets, so the
test covered neither the render-target writes nor a count of rt's
hand-overs.

The test now draws pictures 1 and 2: one triangle a plane, with a pixel
shader that computes each texel's bytes. The luma is one byte over 255
into R8_UNORM; the chroma is two bytes packed into R16_UINT. The shaders
are compiled at run time by D3DCompile from d3dcompiler_47.dll. The
UpdateSubresource writer is gone.

New counter: Metrics::d3d11_plane_submissions, the submissions whose
command buffers keep a plane of a Direct3D 11 surface. The test asserts
that rt's three submissions that keep the planes (two reads, one write)
count three. Nothing increments the counter yet, so the test fails at 0
until the next commit makes each such submission acquire the planes
from VK_QUEUE_FAMILY_EXTERNAL at its start and release them at its end.

Verified: cargo fmt only. The red result on the lab's Windows host and
the device-cfg compile come in the jobs named in the next commit.
2026-11-23 04:38:55 -08:00
Anees Iqbal a4cb24f20e Conformance: read-write-srgb-unorm-views' Metal timing, and llvmpipe's two rows
The case's recording now carries native Metal's timing on the M3 Max, macOS 27.0.1 (job
m3-max-70889, conformance times --write; 23 calls), which every case keeps
(times::every_case_is_timed::every_case_carries_its_timing).

The lavapipe replay (job m3-max-70875, llvmpipe LLVM 23.1.1) matches Metal at every site but the
view's read-back on both backings: 438 of the 1024 words one f32 ulp apart (0x33 reads
0x3e4cccce, Metal 0x3e4ccccd). That is the device's own conversion of an 8-bit code
(device-texel-conversion), the same one read-write-tier-held's llvmpipe rows hold, so the ledger
holds the two sites for llvmpipe with that row's words. The swizzle's bytes, by getBytes: and in
the buffer, match Metal exactly there.
2026-11-23 04:33:03 -08:00
Anees Iqbal 684ce1ab7b Conformance: Metal's recording of read-write-srgb-unorm-views
Recorded on the M3 Max, macOS 27.0.1 (build 26A434), job m3-max-70866 on 29dbc6290a: three runs
folded into one outcome, and the API validation layer's run ran. Metal writes the RGBA8Unorm_sRGB
texture through its RGBA8Unorm view on both backings: the swizzle's bytes are the fill's codes in
yxwz order exactly, by getBytes: of the texture and, over the buffer, in the buffer's own bytes
(rows at the texels' pitch of 64 bytes), and the view's read gives each code over 255. Plain and
over a buffer answer alike.

docs/CONFORMANCE-COVERAGE.md regenerated (one more recording and metal_run case; an SDK item
moves from loosened to not loosened).
2026-11-23 04:27:58 -08:00
Anees Iqbal 44fc8fd529 Conformance: read-write-srgb-unorm-views reads the grid back through the view
The texture's own read decodes the codes, and the decode is the device's own answer (rule 1),
not the case's subject. Measured on the M3 Max in the recording run m3-max-70859 (macOS 27.0.1),
Metal decodes the code 0x22 to 0.016117217 where the sRGB formula gives 0.015996293, so an exact
comparison of decoded words would compare two devices' decodes. The case now reads the grid
through the RGBA8Unorm view, whose unorm read is exact on both sides, beside the texture's bytes
and the buffer's. That recording is discarded; the next commit holds the one of this form.
2026-11-23 04:27:58 -08:00
Anees Iqbal edd2e7a91f Conformance: read-write-srgb-unorm-views, an sRGB texture written through its unorm view, plain and over a buffer
A 16 by 16 RGBA8Unorm_sRGB texture of read-write usage, made plainly and over a shared buffer at
its texels' own pitch (64 bytes), starts as the read-write family's fill. format_scout's
scout_read_write_f swizzles every texel through an RGBA8Unorm view of it (the view Metal makes of a
texture of any usage), and scout_read_f then reads every texel through the texture itself,
decoded. The case records that read, the texture's bytes by getBytes:, and, over the buffer, the
buffer's bytes. It is the shape the runtime refused as Gap::StorageElement on every device that
stores no 8-bit sRGB format, and the shape the previous two commits make: one texture2d<float,
access::read_write> at texture 0, read then written at the thread's position in the grid, bound to
a view of another format.

Unrecorded in this commit: the next one holds Metal's recording.
2026-11-23 04:27:58 -08:00
Anees Iqbal 164724785b rt: Metrics::extended_view_dispatches counts the dispatches that write a view through its image's extended storage usage
The previous commit makes a shader-write texture whose own format the device does not store (an
8-bit sRGB texture) with the storage usage for a listed format the device does store
(VK_IMAGE_CREATE_EXTENDED_USAGE_BIT), so its view of that format (the unorm sibling) is written.
No counter showed that such a write ran: a consumer's walk could see the StorageElement refusal
gone, but not that the write then went through the extended image.

A view now records whether its storage element comes from the storage usage its image took for
the view's format alone (the image holds no storage view of its own format), and the compute
encoder's binding check, which runs once after each change of state or bindings, notes whether any
texture slot the kernel writes (write or read_write) is bound to such a view. Each dispatch
recorded under that note adds one to Metrics::extended_view_dispatches. A refused dispatch, a
read-only slot, and a write of a texture through its own storage element add none. Draws are not
counted.

The field is in the API signatures table and the runtime README's view-format paragraph.

every_device_writes_an_srgb_texture_through_its_unorm_view now asserts, on every device it
opens, that the write through the unorm view adds exactly one where it runs and none where it is
refused, and that the read of the texture itself adds none.
2026-11-23 04:27:21 -08:00
Anees Iqbal 312f2866a9 rt: a shader-write texture whose own format does not store takes the storage usage for its views of a format that does
A texture made for shader writes in a format the device does not store (the 8-bit sRGB formats on
every committed Vulkan profile), written through a view of a listed format the device does store
(its unorm sibling), was Gap::StorageElement, case Absent: the image never had the storage usage,
so the view had no storage element. Metal writes it.

The texture's image now takes the storage usage for those views, with
VK_IMAGE_CREATE_EXTENDED_USAGE_BIT (Vulkan 1.1: a usage "supported for at least one of the formats
a VkImageView created from the image can have"), where the device's image format query makes that
image. The decision is the image's, at its creation, from the existing queries alone:

- plan() plans the texture extended where its usage has shader write, it is not multisampled, its
  own format does not store and a format it lists for its views does (view_formats now says so);
  it keeps the extended plan only where the query made it with exactly the plain plan's usage plus
  the storage usage and the same resolves, attachment reads and cube flag (Plan::keeps), else it
  makes the plain plan, as before;
- in place over a buffer (check_over), the linear image is extended where the linear query makes
  it and each listed format's linear tiling holds what storage keeps of its optimal tiling; where
  the plain linear image holds but the extended one does not, the texture stays in place, plain,
  and no copy is made for it. The counted copy form, where a texture over a buffer already took
  it, takes the plan the optimal query took;
- an extended image is at home in the general layout (a storage view's), and its own format's
  views take the usage that format holds (VkImageViewUsageCreateInfo,
  VUID-VkImageViewCreateInfo-usage-02275), so the texture's own sRGB views carry no storage usage;
- a surface plane's image keeps the surface's own rule and is never extended.

What the storage usage costs these images, where the query can say: nothing. Plan::keeps takes the
extended image only where the query keeps every other usage, flag and sample count, so no usage is
ever dropped for it; the test prints each device's image usage. What the query cannot say
(compression or a slower layout for the general home on a given driver) is unaudited.

Where the device does not make the texture extended (optimal query plainly, or in place where the
linear query refuses the extended image and the plain one holds), the texture is made as before and
the dispatch is still Gap::StorageElement, now with the new case StorageElementCase::Unextended in
place of Absent: the view's format is one the device stores and the image lists it, so the gap is
the image's missing extension, not the format's storage. A consumer log then tells "the device
made no extended image" from "the format has no storage on this device". Absent stays for the
texture's own views and for views of formats the device does not store; a surface plane's view is
never Unextended (its image is made by the surface's rule).

The test every_device_writes_an_srgb_texture_through_its_unorm_view now names
StorageElementCase::Unextended in its refused arm. docs/REFUSALS.md (the sites' function renamed
plan -> planned) and the API signatures table (the new variant) regenerated; the runtime README's
view-format and storage-element entries describe the rule.
2026-11-23 04:27:21 -08:00
Anees Iqbal b911c1b1d2 rt: a test that writes an sRGB texture through its unorm view, plain and over a buffer (red)
A Metal texture made for shader writes in RGBA8Unorm_sRGB, written through an RGBA8Unorm view by
a read_write kernel, is Gap::StorageElement (case Absent) on every Vulkan device whose optimal
tiling does not store the sRGB format, which is every committed profile: the texture's image is
made without the storage usage because its own format does not store, so its unorm view, a
format the device does store, has no storage element either.

The device test every_device_writes_an_srgb_texture_through_its_unorm_view makes a 2 by 2
RGBA8Unorm_sRGB texture of shader-read and shader-write usage, Shared, once plainly and once
over a Shared buffer (pitch at the device's minimum linear texture alignment), and writes
(0.6, 0.25, 1, 0.75) through each one's RGBA8Unorm view with the owned fixture kernel
rrp_sw_rwwrite_f. It prints the device's image format query for the sRGB image with
VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_EXTENDED_USAGE_BIT, the view format list
(sRGB, unorm) and the storage usage, optimal and linear, and asserts that where the device does
not store the sRGB format the texture's image has the storage usage exactly where that query
takes the image in its own tiling (optimal plainly or copied; linear in place over the buffer,
where the unorm format's linear tiling also holds what storage keeps of its optimal tiling).
With the storage usage, the texture's bytes must be the codes (153, 64, 255, 191) and the
parent's own read (rrp_sw_read_f) must decode them; without it, the dispatch must be
Gap::StorageElement for slot 0 and RGBA8Unorm.

Red here on every device whose query takes the extended image: the image never has the
storage usage yet. The next commit makes the image extended.
2026-11-23 04:27:20 -08:00
Anees Iqbal 211c10a594 Translator tests: a description cleared of maximal reconvergence is cleared of quad control too
What: emulated_shuffles_keep_metals_reconvergence_without_maximal_reconvergence (lavapipe) and
the_stage_bound_fixture_takes_the_lighter_module_or_states_its_weight (intel-irisxe-rplp-anv)
clear shaderQuadControl beside shaderMaximalReconvergence in the committed profile they edit.

Why: bc0c8ff615 refuses a description that lists quad control without maximal reconvergence,
which no device offers, and these two tests built exactly such a description. They are the two
test descriptions bc0c8ff615's count missed: they clear the reconvergence feature by its JSON
name and never name quad control. Both time compute kernels, which read neither feature for
their quads. Job m3-max-70805 (msi, at a59075a09d) failed them with that refusal; its other
failure is the golden table (bless due, 60 cells, SEMANTICS 2289 above the table's 2287).

Verified: the next job reruns both.
2026-11-23 04:05:52 -08:00
Anees Iqbal 605159b1a8 Translator: SEMANTICS_VERSION 2289 for a fragment's quad reductions in the quad form
What: SEMANTICS_VERSION goes from 2288 to 2289. A fragment's quad reduction now reads its quad
through OpGroupNonUniformQuadAnyKHR and OpGroupNonUniformQuadBroadcast (1c64701191), so its words
change under an unchanged key.

Why: a cached artifact of the old form would serve AMDVLK's wrong answer. The golden table moves
60 cells under an unchanged fixture source and profile fingerprint, all of them this branch's:
gsm2_quad_ops' fragment_quad_bitwise, fragment_quad_ops_divergent and fragment_quad_scans, and
rch_helper_tangle's rch_tangle_quad_after and rch_tangle_quad_before, each on the 12 profiles with
quad control. No refusal class moved. The base f3bb94275b moved 0 cells against the committed
table (job m3-max-70780, msi). The table is blessed on development at a pin.

Verified, base against fix:
- Red/green, um790, m3-max-70746. AMDVLK 2025.Q2.1 with the base read [322,95,67] where
  [320,95,30] was expected, on the RX 7900 XTX and on the Radeon 780M. With the fix both runtime
  quad tests pass on both cards. RADV (Mesa 26.2.6) passes both arms on both cards.
- Green with the fix (both runtime quad tests): RTX 3090 (m3-max-70776), Iris Xe (m3-max-70778),
  780M RADV (m3-max-70779) and lavapipe (m3-max-70747).
- Cold: quad_sum_after_a_return (an early return before a loop of implicit-LOD samples, then a
  quad sum) was made and drawn 12 of 12 times under AMDVLK on the 780M. Each run was a fresh
  process with an empty HOME and XDG_CACHE_HOME (m3-max-70746).
- GPU time: fragment_quad_bitwise, alternated base, fix, base, fix in one exclusive job per card.
  Medians in us:
  - RTX 3090, 40 command buffers of 16 draws at 2048x2048 (m3-max-70776): base 812 and 815, fix
    816 and 815. That is within the base's own 0.4% spread.
  - Iris Xe, same workload (m3-max-70778): base 14633 and 14629, fix 8953 and 8309. The fix is
    39-43% faster; its two arms differ by 7.5%.
  - 780M RADV, 40 command buffers of 32 draws committed back to back (m3-max-70802): base 4539
    and 4536, fix 4127 and 4129. The fix is 9% faster; the base's own spread is 0.07%.
  An earlier 780M run that waited on each command buffer (m3-max-70779) had a within-arm IQR of
  20-33%, so it decided nothing.
- Census A/B over the private corpus on the M3 (m3-max-70775): 2981 fragment rows on each of the
  16 committed profiles, 0 outcomes moved, 0 defects. The quad votes appear in 8 of the 43
  full-quad rows on the AMD and NVIDIA profiles, and in 5 of 39-40 on the Intel and lavapipe ones.
  In release mode the 43 full-quad rows on amd-780m-radv, alternated base, fix, base, fix, took a
  slowest row of 63, 67, 65 and 66 ms and a batch of 206, 209, 207 and 211 ms. Every row is within
  20 s and the worker ceiling (no budget breach).
- What full_quads asks is unchanged: shaderQuadControl, its extension and QuadControlKHR. The
  reduction's class moves from BALLOT|SHUFFLE to QUAD, which every device with shaderQuadControl
  offers. Nothing moves: no refused device may now run, and every committed quad-control profile
  offers ballot, shuffle and quad in its fragment stage.
- Checks at 9ee1e3ff01 (m3-max-70747, msi): clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd) and
  the simd, spirv, quad and golden tests, 497 of 498; the one failure is the golden table, bless
  due.
2026-11-23 04:05:51 -08:00
Anees Iqbal 10c0092814 Translator: Device::from_queries refuses a description listing shaderQuadControl without shaderMaximalReconvergence
What: device::enables::check_invariants refuses (InvalidDescriptor, DeviceDescription) a
description that lists ShaderQuadControl without ShaderMaximalReconvergence.
VK_KHR_shader_quad_control requires VK_KHR_shader_maximal_reconvergence, and a device that
supports that extension supports shaderMaximalReconvergence (Vulkan's Feature Requirements, the
"If VK_KHR_shader_maximal_reconvergence is supported" line), so no device offers the one without
the other. A fragment function that runs its quads whole declares MaximallyReconvergesKHR beside
RequireFullQuadsKHR, because its group operations other than the quad ones reach the helpers only
under that mode (section 9.31). The DeviceReconvergence wording is unchanged. Device::from_queries'
doc and lower::simd's Helpers paragraph now say so. New test:
device_new_refuses_quad_control_without_maximal_reconvergence. The runtime-floor description at
1.2 with both extensions and shaderQuadControl alone is refused, naming both features; with the
reconvergence feature added it is made, and its subgroup model has quad control and maximal
reconvergence. The test also asserts that every committed profile listing quad control lists
both.

In-tree descriptions that claim quad control without the feature: 0 shipped.
- Profiles: 12 of the 16 committed ones (crates/metal2vulkan-validation/profiles/*.json) list
  shaderQuadControl, and all 12 list shaderMaximalReconvergence. below-floor/vk12-floor.json
  lists neither.
- No fixture or other JSON names quad control (git grep over the tree, corpus aside). The command
  line reads the same profiles.
- Tests: 1 synthetic device, in the runtime's floor test quad_control_is_enabled_where_reported,
  lists the extension and reports the feature without the reconvergence feature. It checks the
  floor's enables alone and never reaches Device::from_queries, so it is left as it is.
- No translator test builds a description with quad control by hand.

Left unreachable: nothing to delete.
- The fragment reconvergence choice in simd::finish still serves fragments without full quads,
  vertex functions and kernels.
- PrecisionNote::FragmentSimdgroupGrouping is still attached on every device: by a fragment's
  simdgroup members, and by a discarding function's quad operation beside a helper query. Neither
  depends on reconvergence, so its catalogue row stays.

Surface: docs/REFUSALS.md is unchanged after scripts/refusal-surface/refusal_surface.py (the
refusal is InvalidDescriptor, not a refusal of something Metal accepts). No public item changed,
so the api_surface table is unchanged. SEMANTICS_VERSION does not move: no stored row's verdict
moves, because every committed profile with quad control has the feature.

Runtime guard: enables.rs and derive.rs are runtime inputs, so
crates/metal2vulkan-validation/runtime-sources.sha256 moves to dd90f6ef3f... (computed by the
build's hash rule, which reproduced the committed 7e32c33f29... before the edit). RUNTIME_VERSION
is not bumped: no run on a description Vulkan allows behaves differently; only a description
Vulkan rules out is refused at Device::from_queries.

Consumer: in reims-vgpu at afa5d6c5d1, git grep -E 'DeviceDescription::new|DeviceDescription
\{|from_khronos_json|ShaderQuadControl|ShaderMaximalReconvergence|shaderQuadControl|
with_enabled\(' finds no hand-built description, only one line in docs/accuracy-ledger.md.

Verified: the check job that follows this commit runs the device tests, the runtime guard and
clippy.
2026-11-23 04:05:51 -08:00
Anees Iqbal 6a9be8080a Translator tests: a fragment's quad broadcasts are its reductions' reads, and a kernel's quad reductions take no quad vote
What: fragment_group_operations_run_full_quads now allows a quad broadcast in a full-quad
fragment only as a reduction's read, one per quad vote (fragment_quad_scans holds a quad
product, which 1c64701191 reads by QuadAnyKHR and QuadBroadcast), and still allows no quad
swap. fragment_quad_reductions_read_their_quads_by_quad_instructions no longer asks a kernel's
quad reduction for a ballot: where a kernel's lanes are all known active its word of active
lanes is a constant, with no ballot (gate-lavapipe); the claim kept is that it takes no quad
vote.

Why: both asserted the old form. Job m3-max-70736 (msi, at 7994a15da3) failed them at
engine_simd.rs:1575 (fragment_quad_scans on amd-780m-hawkpoint-radv) and :1662 (quad_bitwise
on gate-lavapipe).

Verified: the next check job runs both.
2026-11-23 04:05:51 -08:00
Anees Iqbal 9f6712f172 Translator: spv.rs names OpGroupNonUniformQuadAnyKHR outside tests
The fragment quad reduction emits it (1c64701191), so items.txt lists it
and scripts/regen-spirv-grammar regenerated spv.rs from SPIRV-Headers
vulkan-sdk-1.4.341.0: the opcode loses its cfg(test). The test parser's
table already held it. 1c64701191 alone does not build without this
commit.
2026-11-23 04:05:51 -08:00
Anees Iqbal 941977891b rt test: a quad sum after a return before a loop of implicit-LOD samples is made and drawn on every device
The input is the test's own fragment, quad_sum_after_a_return. The top
two rows return early. The other pixels sum a sample of their own texel
over a loop whose trip count they load: the sample is at implicit LOD,
and each trip carries the running sum through a half. After the loop the
fragment writes its quad's sum of the result. A driver's compiler once
died making a fragment of this shape (an early return before a loop of
implicit-LOD samples and float-half round trips, under
MaximallyReconvergesKHR); this one adds a quad reduction after the loop.

The test checks the translated fragment stage:
- it holds a loop and an implicit-LOD sample;
- it holds the four quad votes of its reduction (OpGroupNonUniformQuadAnyKHR);
- it prints how many returns it holds.
Every device of the cfg's kind with quad control must make the state
and write each pixel's exact sums: x/16 * 6, and 3k + 0.75 for the quad
of x in {2k, 2k + 1}.
2026-11-23 04:05:51 -08:00
Anees Iqbal 54517169dd Translator: a fragment's quad reduction reads its quad through quad instructions, helpers included
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.
2026-11-23 04:05:51 -08:00
Anees Iqbal 35f0c2d89a rt README: what AMD's open Linux driver answers in four known gaps
Lane amd18 read the conformance cases where AMD's open Linux driver
(AMDVLK 2025.Q2.1) answers apart from RADV on the same cards. This
records what a user of that driver family meets, in the known gaps
that already stand for it:
- alphaToOne: the driver reports none on the Radeon 780M (vulkaninfo,
  m3-max-70426). The line used to say no lab venue runs an AMD driver.
- Indirect command buffers: it lists VK_KHR_maintenance5 but not
  VK_EXT_device_generated_commands, so the Extension route is refused,
  as on the Iris Xe, the UHD 630 and KosmicKrisp.
- Exported surfaces: a fourth copy-form cause, SurfaceCopy::Dedicated.
  The external image format query answers DEDICATED_ONLY on every
  route the runtime tries, on the RX 7900 XTX and the 780M, so the ten
  surface-textures cases are refused at replace_region there; RADV
  answers them exactly.
- fractional-viewport-coverage: the driver loses the far pixel where
  its centre is inside the viewport, matching the Iris Xe in count,
  first texel and largest difference (not compared pixel by pixel).
  The rest is inside the accepted difference.

Docs only. The conformance ledger's rows for that venue are not part
of this change. Its replay there (m3-max-70792, XTX) prints 129
unlisted gaps and 20 RADV rows it no longer holds, a size that goes to
the planner first.
2026-11-23 03:58:43 -08:00
Anees Iqbal 2a75c15d61 rt: Metrics::partial_variant_ragged_grids counts the ragged grids that ran the partial variant
rt counted the dispatches of whole threadgroups that ran a kernel's
partial-threadgroups variant (partial_variant_whole_grids) and nothing
for the dispatches that variant exists for: a dispatchThreads grid that
ends in partial threadgroups. A consumer's walk could therefore show a
ragged grid's refusal gone, but not that the grid then ran on the
variant.

The dispatch now counts a ragged grid that ran Module::Partial in
partial_variant_ragged_grids, and a whole one in
partial_variant_whole_grids as before. A refused ragged grid counts in
neither. The field is in the API signatures table and the runtime
README's partial-variant paragraph.

The told-limit device test
(every_device_runs_a_1024_thread_observers_ragged_grid_in_the_limit_less_its_vote_word)
now asserts, on every device it opens:
- each ragged grid that runs adds exactly one;
- a whole grid or a refused grid adds none;
- the test's total is above zero.
2026-11-23 03:32:38 -08:00
Anees Iqbal f3bb94275b rt: a bind of a texture reached through its views alone to a texture slot is TextureWithoutIndex
A texture made with no index although its usage reaches shaders (Device::new_texture_for_views,
Device::new_heap_texture_for_views, a surface's or a Direct3D 11 surface's plane made with no
index) is reached through its views, each with an index of its own. Bound directly to a
function's texture slot, a dispatch or draw pushed its resource id, index 0, set 1's null
descriptor, so every read answered zero with no refusal (the consumer saw a D3D11 luma plane read
0.0 for every texel this way). ComputeCommandEncoder::set_texture and RenderCommandEncoder's
set_vertex_texture and set_fragment_texture (the runtime's only texture-slot binds) now refuse it,
binding nothing: Refusal::TextureWithoutIndex { index }, the slot's index. The check reads the
texture's own stored facts at the bind (no index, and its descriptor's usage reaching shaders by
the creation rule); nothing is looked up and nothing runs per draw or dispatch.

A texture no shader reaches (a depth or stencil target whose usage asks neither shader reads nor
writes) also has no index, and still binds: Metal binds it, its usage asks no shader read, and a
read of it answers the null descriptor. The previous commit's test expected that case refused;
it now expects it bound, so a guest's bind of such a texture to a slot its function does not read
meets no refusal.

Texture::gpu_resource_id says what an index-free texture's id is (index 0) and that a shader
reading it from bytes (an argument buffer) reads the null descriptor; nothing refuses that, as
the call returns a ResourceId. ResourceId's encoding is unchanged. The runtime has no argument
encoder, no texture-slot range call and no indirect-command texture bind, so the binds are the
whole Result-returning surface; an attachment read of an index-free texture is already
Gap::Draw (FetchedAttachment).

REFUSALS.md and basis.rs regenerated; the runtime README's texture and compute-encoder entries
updated.
2026-11-23 02:54:00 -08:00
Anees Iqbal eb275a1e87 rt: Refusal::TextureWithoutIndex, and a test that binds a texture made without an index (red)
A texture made without an index (Device::new_texture_for_views, a surface or Direct3D 11 plane
with no index, a depth or stencil target no shader reaches) bound to a function's texture slot
pushes resource id 0, set 1's null descriptor, so every read answers zero with no refusal. This
commit adds the refusal the binds will return, its basis line, REFUSALS.md and the signature
table, and the device test bind_without_index, which binds such textures to compute, vertex and
fragment slots and expects the refusal with the slot's index. The binds do not refuse yet, so the
test is red here; the next commit makes them refuse.
2026-11-23 02:54:00 -08:00
Anees Iqbal 1080a17fc1 Docs: CONFORMANCE-COVERAGE.md counts MTLDevice.maxThreadgroupMemoryLength
Device::max_threadgroup_memory_length (5a03a60b6c) made maxThreadgroupMemoryLength an
implemented Metal item, and the generated coverage document was not regenerated with it:
implemented items 636 -> 637, reachable 635 -> 636, of the reachable not exercised 77 -> 78
(no conformance case compares the answer against Metal yet).

Verified: coverage.py --check reads "as derived" after the regeneration; it failed at
904700de35 in development's suites (m3-max-70632, conformance 1,028 of 1,029).
2026-11-23 02:41:37 -08:00
Anees Iqbal 904700de35 rt tests: the evicted-variant test opens the driver the other device tests open
every_device_makes_an_evicted_variant_again opened its instance with Instance::new, which takes
the loader's drivers and ignores M2V_DIRECT_DRIVER. On the Mac leg, where the device tests run
KosmicKrisp as the direct driver, the loader found MoltenVK instead, below the floor
(nullDescriptor, logicOp), and the test panicked opening it: 669 of 670 on KosmicKrisp on the
M3 Max at f8181e2a6c (m3-max-70531). It now opens validation::bare, the instance every other
device test builds on: the direct driver where one is named, the loader's drivers elsewhere, and
no validation layer, which the re-make timings still need.

Verified: the Mac leg at this commit (rt's device tests on KosmicKrisp, M3 Max).
2026-11-23 02:31:24 -08:00
Anees Iqbal 97f3490705 rt test: a second device on a cache directory names the vote word as a refused variant's site
scan_static over the device's maxComputeSharedMemorySize, whose partial-threadgroups variant the
translator refuses for its vote word: the first device on a directory refuses its ragged grid at
the VoteWord site with the kernel's static bytes and the limit, and leaves the vote word's marker
(cache::REFUSED_VOTE) in the directory; a second device on it lowers nothing, reads the directory,
and names the same site. Not yet run.
2026-11-23 02:31:24 -08:00
Anees Iqbal 5a03a60b6c rt: Device::max_threadgroup_memory_length, Metal's maxThreadgroupMemoryLength less the vote word
The answer is the device's maxComputeSharedMemorySize less the 4-byte vote word a kernel's
partial-threadgroups variant may take beside its threadgroup memory, rounded down to 16, and at
most Metal's 32 KiB: 32,752 on a device of 32,768 bytes (AMD's drivers on the 780M, lavapipe,
MoltenVK on the M3), where a Mac answers 32,768; 32,768 on RADV, NVIDIA and ANV. A guest that
sizes its threadgroup memory from it (a length it sets, or source it compiles at run time) runs
its ragged grids, where 32,768 is refused (Gap::PartialThreadgroups for static memory,
Limit::ThreadgroupMemory for a length). The word is one constant, pipeline::VOTE_BYTES, which the
module interface's vote word reads too.

It changes only the answer: every dispatch is still checked against the device's own limit. An
emulated SIMD group's scratch varies by kernel and is not counted; the runtime README records it
with the refusal a kernel past the answer keeps, and the unaudited cost to a guest that rounds the
answer down to a power of two.

Tests: the scan test reads the answer and checks its formula; a kernel whose variant takes no vote
word runs [25,1,1] and [1024,1,1] in [1024,1,1] with a length of 32 KiB, past the answer
(every_device_runs_a_kernel_without_a_vote_word_at_a_length_past_its_answer). METAL-COVERAGE and
the api_signatures table are regenerated. Not yet run.
2026-11-23 02:31:24 -08:00
Anees Iqbal ce2b13dfa8 Translator: SEMANTICS_VERSION 2288 for a partial-threadgroups variant refused for its vote word, which now names the shared-memory limit it passes
The refusal moved from NotImplemented to a need of the Limit of maxComputeSharedMemorySize, and a
runtime keeps why beside the refusal it caches, so keys from before must not be read as it.
2026-11-23 02:31:24 -08:00
Anees Iqbal f17e07ad07 rt: StorageElement names its case and backing; PartialThreadgroups and ThreadgroupMemory name their site and static bytes
A refusal's sentence stays as it was (the known-gaps ledger keys on it); the new facts are typed
fields.

- Gap::StorageElement gains `case` (StorageElementCase: Absent, WriteWithoutFormat,
  ReadWithoutFormat) and `backing` (TextureBacking: Texture, Buffer, SurfacePlane, D3d11,
  Drawable; a view answers its parent's). TextureObject::storage_gap computes both at the four
  sites, and use_resource keeps it for a declared write. SurfaceImage's `general` flag, which only
  a Direct3D 11 import set, is named `d3d11`, and a surface plane's image keeps it.
- Gap::PartialThreadgroups gains `site` (PartialThreadgroupsSite): VoteWord { static_length, max }
  where the translator refused the variant for its vote word, Translator for its other refusals,
  SimdGroups { width } where the threadgroup is not whole SIMD groups of the variant. The cache
  directory keeps why with the refusal (m2v-refused-vote beside m2v-refused), so a warm boot names
  the site too.
- Limit::ThreadgroupMemory gains `static_length`, the state's staticThreadgroupMemoryLength.
- The translator's vote-word refusal is built through Unsupported::needs_any_of, so the refusal
  table derives its basis.

docs/REFUSALS.md and the api_signatures table are regenerated. Tests: the scan test's shape (i)
at 32,768 reads Limit::ThreadgroupMemory with static_length 0 and the limit; shape (ii) reads
PartialThreadgroups at the VoteWord site with its 32,768 static bytes against the limit; the
vote-word test reads the static length; storage_element, texture_buffers and read_write_tier read
the case and backing. Not yet run.
2026-11-23 02:31:24 -08:00
Anees Iqbal 7dd387ca4e Runtime test: a 1,024-thread observer's ragged grid at Metal's 32 KiB and at the limit less its vote word
The scan kernel, in two shapes a guest builds from the maxThreadgroupMemoryLength it is told:
scan_static (a declared array of the bytes) and scan_length (a [[threadgroup(0)]] region the
encoder sets at the bytes, none declared). Each runs at 1,024 threads, its ragged grid [25, 1, 1]
and its whole grid [1024, 1, 1], at Metal's 32 KiB (the device's limit where smaller) and at the
device's maxComputeSharedMemorySize less the 4-byte vote word, rounded down to 16 and at most
32 KiB. Where 32 KiB and the word pass the limit the ragged grids are refused, scan_static's as
Gap::PartialThreadgroups and scan_length's as Limit::ThreadgroupMemory; every other run answers
the program's sums. Replaces the previous scan test at the limit and 4 bytes less.

Not yet run: the legs (lavapipe, a 780M under RADV and AMDVLK) follow.
2026-11-23 02:31:24 -08:00
Anees Iqbal 931275442e Runtime test: a 1,024-thread observer's ragged grid at the shared-memory limit
A Hillis-Steele scan over declared threadgroup memory of the device's
maxComputeSharedMemorySize, of 4 bytes less, and of Metal's 32 KiB where the
device's limit is larger, dispatched [25, 1, 1] and [1024, 1, 1] in
threadgroups of [1024, 1, 1]. Each outcome is printed; it fails where a
dispatch does not run the program's sums.
2026-11-23 02:31:23 -08:00
Anees Iqbal 4c125f8de2 Translator: a variant refused for its vote word names the shared-memory limit it passes
A kernel's partial-threadgroups variant whose predicated walk votes in a word its workgroup memory
cannot hold was refused as Unsupported{PartialThreadgroups, NotImplemented}, the same refusal as
every other site of that feature. It now keeps the check's need: the Limit of
maxComputeSharedMemorySize, the bytes the arena and the word require and the bytes the device has.
The runtime reads the site from it.

Test: engine_partial_threadgroups's scan kernel over 8,192 words on the moltenvk-m3 profile
(32,768 bytes) is refused needing 32,772 of 32,768; over 8,188 words its variant is made. Not yet
run.
2026-11-23 02:31:23 -08:00