Commit Graph
9256 Commits
Author SHA1 Message Date
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
Anees Iqbal 6462199fad Tests: the AMD pin's bless at d04f88f2cd (golden table, authored compile census)
The golden table moves to semantics 2287: 11,475 cells change under unchanged keys, because a
deep kernel's WorkgroupSize parts are now plain specialization constants; 3,565 rows before and
after, none added or gone. The authored compile census's verdicts are equal on every case and
profile; only its artifact hashes move, with ARTIFACT_FORMAT_VERSION 593.

Verified: the bless job m3-max-70594 on the M3 (inventory, golden, printouts, opened chains and
the census all exit 0); verdicts compared with the artifact hashes stripped, 2,355 lines equal.
2026-11-23 02:28:46 -08:00
Anees Iqbal d04f88f2cd Tests: the linked store_const kernel's spec table holds its seven threadgroup constants
store_const_passes_the_pipeline_on_every_m1_profile still counted four specialization constants in
the linked kernel's table (LocalSize X, Y and Z, and DeepThreadgroup). Since the WorkgroupSize
composite's parts are plain specialization constants of their own, the table holds those three as
well, seven in all. At c1e0b2cbd5 the suite (msi, job m3-max-70535) failed this one assertion,
"moltenvk-m3, left: 7, right: 4"; at 99f90c7503 the same test had stopped earlier, at the
check_artifact expectation that c1e0b2cbd5 fixed.

Test-only. Verified by the plain clippy and the translator suite at this commit (job named in the
lane's report).
2026-11-23 02:08:05 -08:00
Anees Iqbal c1e0b2cbd5 Tests: the threadgroup_constants edit's leftovers, and the skeleton kernel's declared constants
Test files only. At 99f90c7503 plain clippy (job m3-max-70512, msi) refused the mechanical
edit's leftovers: two `let n` products no longer read, a SpecKey import, and the `form` parameter
of dispatch/tests.rs's run_region, run_partial and check_dispatch, which chose only whether to
write FlatLocalSize, now always written by the call. The translator suite (m3-max-70516, msi:
2782 of 2784, the golden table bless-due aside) failed engine_skeleton's
store_const_passes_the_pipeline_on_every_m1_profile, whose kernel now declares the three
WorkgroupSize constants after DeepThreadgroup, every bit of them read, and reads no bit of
LocalSize or DeepThreadgroup (unread_bits all ones), which only the old OpSpecConstantOp parts
read; the expectation says so.
2026-11-23 01:57:35 -08:00
Anees Iqbal 99f90c7503 Translator: SEMANTICS_VERSION 2287 and ARTIFACT_FORMAT_VERSION 593 for a deep kernel's plain WorkgroupSize parts
What changed in the output (ac5c562a08): every kernel of the Spec local-size form (all but
compute-derivative kernels) declares its WorkgroupSize as a composite of three plain
specialization constants, SpecKey::WorkgroupSize(X, Y, Z), defaulting to its LocalSize defaults,
where it had OpSpecConstantOp Select parts over IMul products of LocalSize; the body is
unchanged. A runtime writes the new keys with the threadgroup's others from
pipeline::threadgroup_constants. The artifact format gains the SpecKey::WorkgroupSize member
(the_version_593_member_round_trips).

Checks for this tip, run before it lands: the translator suite, the runtime guard and rt on
lavapipe (msi), clippy in every configuration and Rustdoc, rt's device tests and the
conformance replay on AMDVLK and RADV on the RX 7900 XTX and a Radeon 780M, the cold #424 make
on AMDVLK, and the translation census against f8181e2a6c.
2026-11-23 01:50:29 -08:00
Anees Iqbal c77d2b4214 Validation: the runtime guard's hash for lower/dispatch.rs's threadgroup_constants
lower/dispatch.rs is one of the runtime guard's inputs (the dispatch-region encoding). Its change
here is the deep kernel's WorkgroupSize parts, which the compile emits into the pipeline the
artifact digests, and threadgroup_constants, which writes for a threadgroup the values the
runtime wrote before (LocalSize, FlatLocalSize, DeepThreadgroup) plus the WorkgroupSize parts,
which take the values the old OpSpecConstantOp parts computed: no run on a conforming driver
changes, so the hash alone moves (7e32c33f29ba265f1d48f88e8dab3760cab59cd2907c8d2c58d18d444711f23b). Computed with the build's rule (path, NUL, length, bytes
over the sorted inputs), which gives the committed hash at f8181e2a6c and the one job
m3-max-70464's guard test printed at e285df75ba; the guard test checks it at this tip.
2026-11-23 01:49:51 -08:00
Anees Iqbal b2260c771b Tests: every hand-built kernel spec map takes its threadgroup's keys from pipeline::threadgroup_constants
A kernel that declares DeepThreadgroup takes its Vulkan workgroup from the WorkgroupSize parts
alone, so a spec map that writes LocalSize without them runs workgroups of the parts' defaults:
at the previous commit's form 249 of the translator's 2782 tests ran one-invocation workgroups in
the interpreter (job m3-max-70464, msi, at its first cut e285df75ba). Every test site that wrote a
kernel's LocalSize by hand (three inserts, a loop over the axes, or a literal map; with their
FlatLocalSize and DeepThreadgroup) now extends its map with the one call, which writes all of
them; none writes a WorkgroupSize key itself. Mechanical: 68 files, 83 calls.

Left as they are: declarations of a key (StageSpec, ModuleBuilder::spec), the interpreter's own
tests of a hand-built LocalSize composite and of a value past 32 bits, and key matchers.
2026-11-23 01:49:31 -08:00
Anees Iqbal ac5c562a08 Translator: a deep kernel's WorkgroupSize parts are plain specialization constants, written with every other key its threadgroup decides from one call
AMD's open driver AMDVLK (2025.Q2.1, its LLPC compiler) sizes a compute workgroup from the
WorkgroupSize composite's parts as declared, and reads an OpSpecConstantOp part as 1, while the
body sees the right value: every Spec-form kernel, whose deep-threadgroup form made each part an
OpSpecConstantOp Select over IMul products of LocalSize, ran one invocation per workgroup there.
The Vulkan spec allows such a part (VUID-WorkgroupSize-WorkgroupSize-04426: a specialization
constant or a constant), so this is the driver's bug; the form here is right on every device.

- Such a kernel's WorkgroupSize parts are the plain specialization constants
  SpecKey::WorkgroupSize(axis) (codec member appended).
- One public call, pipeline::threadgroup_constants(size), returns every key a kernel's
  threadgroup size decides: LocalSize on each axis, FlatLocalSize, DeepThreadgroup and the
  WorkgroupSize parts (the threadgroup, or one row of it deeper than DEEP_THREADGROUP). The
  runtime writes exactly those keys from it (Constant::Threadgroup, whose membership is the
  call's own key set), in place of four separate computations. docs/API.md section 3 names it.
- The builder refuses an OpSpecConstantOp WorkgroupSize part (ConstRule::WorkgroupSizeOp), so no
  form can declare one again; serialize test a_workgroup_size_part_is_never_a_spec_constant_op
  covers the old deep shape and two others, and the deep engine test asserts the parts are the
  new keys.
- rt test every_device_runs_every_thread_of_each_workgroup_deep_or_not: an owned kernel stores
  i + 1 at each linear thread index for a deep [1,1,96] threadgroup and two shallow ones.

Evidence so far: rt's probe with the composite's op parts folded to plain constants (job
m3-max-70461, the RX 7900 XTX; m3-max-70462, a Radeon 780M) cleared 66 of the 67 rt device
tests that failed on AMDVLK; the 67th, quad_control's helper test, fails the same with and
without, a fragment-stage defect of its own.
2026-11-23 01:45:17 -08:00
Anees Iqbal f8181e2a6c Tests: the pin's bless at 5ef09c1e70 (golden table, authored compile census)
The golden table moves from semantics 2283 to 2286 and gains 12 rows, 0 changed and 0 gone:
- kernel_buffer_pointer_arrays (the closed cell of an array of buffer pointers, 2284): 6 rows;
- kernel_program_scope_buffers (program-scope buffer bindings, 2285): 2 rows;
- icb_encoder_tail (an argument buffer's command-buffer word as plain data, 2286): 4 rows.

The authored compile census gains 4 cases, 0 changed: 9bdd6be4 and 9fafc659 (the two pointer-array
cases) and bfeea3f0 (program-scope buffers) compile on every profile; b4eb6605 (a kernel's compute
command buffer) reads not_supported{tooling_requirement:indirect_compute_commands} on every
profile, the typed engine gap its case records. The product fingerprint moves with the tree.

Verified: bless job m3-max-70467 on the M3 (inventory, golden, printouts, opened chains and the
census each exit 0). Development's checks at 5ef09c1e70 before it: quick m3-max-70465 green
(signatures, clippy plain / m2v_gpu / m2v_cpu_icd, Rustdoc, lavapipe rt 676/676, conformance build
and lavapipe replay); suites m3-max-70466 product 3,602 of 3,603 with the golden table the one red
("bless due, stale cells only"), validation 1,296/1,296, conformance 1,029/1,029, doctests 0.
2026-11-23 01:35:59 -08:00
Anees Iqbal 5ef09c1e70 Translator: SEMANTICS_VERSION 2286 for an access past an argument buffer that may reach its command buffer's word
What changed in the output (4c438ca2c6): under the identity domains, a command_buffer member's 8
bytes in an argument buffer are plain data, its gpuResourceID word, for both provenance rules: the
per-access rule (Walk::access, ObjectBuffer::touches_object) and the escape and dynamic-deref rule
(classify). An access that may reach them, such as a signed run-time index past the structure
that runs back into it, is a plain read or write of that word. Before, it was
Unsupported{ArgumentBufferObjects, NotImplemented}. Under the resident-table domains it still is.
Every other object member (a pipeline state, a texture, a sampler and the rest) stays opaque under
both domains.

Census of the indexed private corpus, base e50427cfe5 against a5855784a7 (the
branch before its rebase onto development; its product diff is this branch's up to 21a189388c)
(job m3-max-70396), on
runtime-floor and gate-lavapipe, 17216 rows each:
- ArgumentBufferObjects rows go from 50 to 16.
- 34 rows move on each profile. 18 now translate: the 16 vertex functions this slice is for, and
  2 private rows outside them. The other 16 are kernels, now refused as GpuEncodedIndirectCommands.
- Internal errors, defects and budget stops are 0 at both commits.
- Slowest row: 810 ms on runtime-floor and 786 ms on gate-lavapipe. Peak worker RSS is at most
  222 MB.

Cached artifacts and refusals keyed under 2285 would hold the old refusal for those rows, so the
version moves from 2285 to 2286.
2026-11-23 01:18:21 -08:00
Anees Iqbal b6b22422b1 Fixture inventory: icb_encoder_tail's rows in its ABI's entry order, tail_count before tail_bind
The AIR ABI lists a module's entries kernels first, then vertex functions (abi/module.rs), and
the inventory takes each fixture's rows in that order. 7cf0a00279 put tail_bind first, so
llvm_as::part_3_of_8 found the same 219 rows in another order: 0 cells moved, 0 rows new or gone,
but a table that differs (job m3-max-70434 on lavapipe at a1f10382e7). No cell changes. This
commit changes no translation output, so SEMANTICS_VERSION stays at 2286.
2026-11-23 01:17:57 -08:00
Anees Iqbal a63cff8ec0 Fixture: icb_encoder_tail's golden printout
The air_input bless under the pinned LLVM 21 (Homebrew 21.1.8) adds icb_encoder_tail's printout
and changes no other: after the bless, the only change under tests/air_input is this new file
(job m3-max-70431, on the M3 at 4cebdafbce). Without it, engine_fixtures_match_their_golden_printout
cannot read the fixture's golden (m3-max-70385).
2026-11-23 01:17:56 -08:00