Commit Graph
3412 Commits
Author SHA1 Message Date
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 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 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 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 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 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 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 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 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 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 477f4dc86f rt: a render pipeline state whose functions may reach indirect command buffers is built
What: draws() no longer refuses a render pipeline state whose functions may reach an indirect
command buffer (PipelineInterface::reaches_command_buffers) as Gap::RenderPipeline{DrawInput}. A
vertex or fragment function that takes an argument buffer with a command_buffer member, or
encodes commands through one, now makes its state, as Metal makes it. Gap::RenderPipeline{DrawInput}
stays for its other causes; no refusal's name or text moves, so docs/REFUSALS.md is unchanged.

Why: the refusal was undocumented, and Metal compiles and runs such a state. The compute twin
(KernelInputKind::CommandBuffers) went in 22ae7df766; this one was left in b29fcccdc9's draws().
It caught the translator's newly admitted vertex functions that index past an encoder whose first
member is a command buffer (icb_encoder_tail's tail_bind).

Ordering: a draw that writes the commands writes through an address outside its slots, which the
interface states (writes_unbound_resources counts indirect-command operations). The render pass's
end records, or owes, a barrier of ALL_COMMANDS and MEMORY_WRITE to ALL_COMMANDS and
MEMORY_READ | MEMORY_WRITE (Reach::Commands). That barrier reaches a later encoder's
vkCmdExecuteGeneratedCommandsEXT, preprocess included.

- render.rs: the one condition goes.
- README (Indirect command buffers): the commands a kernel or a render pipeline state's function
  encodes; an execution in a later encoder of the draw's command buffer reads what the draw wrote.
- tests/indirect.rs: every_device_binds_commands_from_the_words_past_an_encoder records tail_bind's
  draw (rasterization disabled, N = 4 instances of a point) and the execution of the commands it
  rebound as two render encoders of one command buffer. An execution that read the commands as
  icb_indexed_16 left them would draw command i's own mark; it draws command N - 1 - i's, as the
  direct draws do.

Verified on lavapipe (llvmpipe, LLVM 23.1.1), under the validation layer, which fails a test on
any message:
- Red before: at 4cebdafbce the tail_bind state is refused, "a render pipeline state with
  DrawInput is not built" (job m3-max-70415).
- With this change applied over 4cebdafbce (job m3-max-70428): both past_an_encoder tests pass
  ("4 commands a draw rebound from the addresses past an encoder, executed later in its command
  buffer, draw as their draws direct"), and all 25 tests of indirect:: pass.
2026-11-23 01:17:56 -08:00
Anees Iqbal 21a189388c Runtime tests: the words past an encoder whose first member is the commands' word
Two device tests over the owned fixture icb_encoder_tail, on every device of the cfg's kind that
enables VK_EXT_device_generated_commands (lavapipe under --cfg m2v_cpu_icd), with a real indirect
command buffer's gpu_resource_id at the encoder's field 0:
- tail_count's threads read and write the words past the encoder by a signed run-time index:
  each written word is the word after it plus 7, every other word and the encoder's own 16 bytes
  keep theirs;
- tail_bind, a vertex function with rasterization disabled drawn as 4 instances of a point,
  rebinds the vertex and fragment buffer 0 of the 4 commands icb_indexed_16 encoded to the
  addresses past the encoder, and the execution draws texel for texel as the same draws direct
  through those buffers.
2026-11-23 01:17:56 -08:00
Anees Iqbal 3fa6edff99 Floor test: a check below the floor reads its error by expect_err
What: tests/floor.rs reads decide()'s refusal with expect_err in place of err().expect.

Why: with floor::Capabilities now Debug (c01b2e02dc), Result<Capabilities, BelowFloor>::expect_err
is available, and clippy's err_expect lint refuses the old spelling under -D warnings
(potluck job m3-max-70433: clippy exit 101 on that line alone, plain and under m2v_gpu).

Verified: the check job dispatched with this commit.
2026-11-23 01:08:45 -08:00
Anees Iqbal c01b2e02dc Runtime: floor::Capabilities' Debug is written out; Features is not Debug
What: b30d81ad8b derived Debug on floor::Capabilities and floor::Features. That does not
compile: the workspace takes ash with default features off and without its `debug` feature,
so vk::PhysicalDeviceFeatures, the Vulkan 1.1-1.3 feature structures and
vk::PhysicalDeviceMemoryProperties have no Debug (potluck job m3-max-70430: clippy exit 101,
22 errors in metal2vulkan-runtime). Features gets its old derives back, and Capabilities gets a
Debug of its own that prints the answers its forms take (float16, storage reads without a
format, the 64-bit atomics and floats, maximal reconvergence, subgroup-uniform control flow,
the texel offset operand, attachment reads, the feedback loop), the extensions, the queue
family and the indirect-command limits, and leaves out the feature structures and the memory
properties (finish_non_exhaustive). The signature table is re-blessed.

Why: one line of a device's query answers in a consumer's log, without turning on ash's debug
feature for a published crate.

Verified: the signature check passes after the bless (source only); the build is the check job
dispatched with this commit.
2026-11-23 01:07:23 -08:00
Anees Iqbal b30d81ad8b Runtime: floor::Capabilities and floor::Features are Debug
What: #[derive(Debug)] on floor::Capabilities, and Debug added to floor::Features' derives
(which Capabilities holds); the signature table is re-blessed for the two rows.

Why: Capabilities holds the answers the runtime's query-chosen forms take (float16, storage
reads without a format, 64-bit atomics and floats, maximal reconvergence, subgroup-uniform
control flow, the texel offset operand, attachment reads, the feedback loop) and what device
creation enables. A consumer that logs a device's answers once at start could print them only
field by field. Nothing breaks for a consumer: a derive only adds an impl.

Verified: the signature check passes after the bless (source only); the build is the check job
dispatched with this commit, and development's checks follow.
2026-11-23 01:04:32 -08:00
Anees Iqbal 3aa557a978 Runtime README: an evicted kernel variant's re-make time, measured
The known gap on a kernel's 64 variants now gives the time to make a variant,
have the cap evict it, and make it again. Kernel: the runtime's step test
kernel (tests::kernel_variants' every_device_makes_an_evicted_variant_again).
Release test binaries of ded6f8d532, with no validation layer and the drivers'
disk caches off.

- lavapipe (llvmpipe, LLVM 23.1.4): 313.0 us, then 104.0 us.
- RTX 3090: 2,727.1 us, then 5.1 us. Its clock state was sampled every 200 ms
  through the run: 5 samples P0 at 1950/9751 MHz, 7 at 210/405 MHz (6 P8).
  The make is the driver's CPU-side compile.

Both ran in one exclusive job, m3-max-70404, which also passed the other four
kernel_variants tests on the RTX 3090 under the validation layer.
2026-11-23 00:53:53 -08:00
Anees Iqbal 4b516662a9 Runtime: the kernel_variants gauge counts what work held at its module's last make
Its doc said the variants past the 64 a module keeps are those work not yet
retired holds. A module evicts the idle ones at its next make, so between a
command buffer's retirement and that make the gauge also counts the ones that
command buffer held. Doc only.
2026-11-23 00:53:53 -08:00
Anees Iqbal 45a2e23184 Runtime: a kernel keeps 64 variants, and lengths round up to 16 bytes
A kernel module's VkPipelines, one per threadgroup size, threadgroup memory
lengths, imageblock size and tiles, lived in 8 lock-free cells and then an
unbounded list. Each one lived until the content's last state went, and each
dispatch past the cells searched the whole list under the lock. One kernel
can reach 30,343 threadgroup sizes at 1,024 threads, 66 imageblock sizes, and
any length of each threadgroup argument the encoder sets.

How: the 8 cells stay. Past them a module lists at most 56, ordered by
dispatch, the least recently dispatched first. A make past 56 evicts the
least recently dispatched idle ones to the reaper, so 55 remain before the
new one is listed. Idle means the list holds the only count. A command buffer
holds each listed variant it dispatches from its first such dispatch until it
retires: one count per variant per command buffer, taken under the list's
lock. No hold is taken for a cell, or for a dispatch that reuses the encoder's
last pipeline. Where every listed variant is held, the make evicts none. So
the variants grow only by what work not yet retired holds, there is no
refusal and no wait, and a pipeline is destroyed only once every command
buffer that encoded it has retired. A variant evicted and dispatched again is
made again through the device's pipeline cache.

The lengths in the key and in the specialization constant are each rounded
up to a multiple of 16 bytes, the only lengths Metal takes. Lengths 17 and 32
run one variant. The threadgroup memory check rounded each region to 16
already.

New gauge kernel_variants: every kernel variant alive, the cells' included.
It is added to the signature table, the device teardown list, the replay's
named gauges and the harness's.

Tests (tests::kernel_variants): 17 and 32 bytes run one variant. 70 keys,
each in its own command buffer retired before the next, keep the first 8 and
the 56 dispatched last, and the gauge reads min(n, 64). One command buffer
runs 70 keys and holds all 70. After it retires, the next make keeps 64. A
200-iteration loop reads 64 at iterations 100 and 200. Every test reads 0 at
device drop. An evicted variant is made again, timed without the validation
layer.

Verified: see the lane's report (jobs named there).
2026-11-23 00:53:53 -08:00
Anees Iqbal 3c86a2a45f Translator: a vertex function's slice and viewport index are stored as it writes them
Metal requires the same [[render_target_array_index]] and [[viewport_array_index]] at every
vertex of a primitive ("If values differ, the behavior and value passed to the fragment function
are undefined.", the Metal Shading Language specification), and Vulkan asks the same of Layer and
ViewportIndex (VUID-VkPipelineShaderStageCreateInfo-stage-02596 and -02597). The translator stored
an index only where the function's structure showed it the same among a primitive's vertices
(uniform_varyings over the raw index varyings) and refused every other one,
NotImplemented(LayeredRendering), on every device. A program that keeps Metal's rule keeps
Vulkan's with the index stored as written, and one that breaks it has no Metal answer to match,
so plan::index_store now stores the index to its builtin wherever the device stores it from a
vertex function (shaderOutputLayer, shaderOutputViewportIndex, both in the floor), whatever the
structure shows; a device without the output is refused needing it, as before. The store keeps
index < count ? index : 0 against the pushed length and viewport count, and an index never written
is still stored as 0. uniform_varyings now lists user varyings alone (the raw index keys decided
nothing else), and uniform_index is gone.

Where a program breaks Metal's rule the layer or viewport is the device's choice: the runtime
README's layered line and docs/API.md (section 4 and section 10's accepted differences) say so in
one sentence, the viewport paragraph and set_viewports no longer name a geometry stage, and
docs/REFUSALS.md is regenerated (LayeredRendering is now a device refusal alone). The runtime's
layered device test draws rt6_per_primitive's three triangles into slices 1, 1 and 2 through
viewports 0, 1 and 1 of a 2D array, checking every texel, in place of the refusal it asserted.

SEMANTICS_VERSION 2283: modules for such functions instead of the refusal, and uniform outputs
without the raw index keys.
2026-11-23 00:13:45 -08:00
Anees Iqbal 29e54794ca Runtime: a sampler state bound with LOD clamps of its own samples with them
A bind's LOD clamps (setSamplerState:lodMinClamp:lodMaxClamp:atIndex:, its
vertex and fragment forms and the range forms) that read otherwise than the
state's own were Gap::LodClamps. Metal takes the call; on the M3 Max
(conformance cases sampler-bind-lod-clamps-kernel and -fragment) the pair
replaces the state's clamps, a lower bound above the upper reads at the upper's
level, and a plain bind afterwards reads the state's own clamps again.

How: such a bind takes the state's variant of the pair, the state's descriptor
with the pair as its clamps, its device samplers from the shared sampler table,
placed at a variant element of set 1's sampler arrays. The three sampler arrays
grow from 4,000 to 8,000 elements in the runtime's layout; elements 4,000 to
7,999 are the variants'. Shaders declare the heap arrays unsized, so the
translator is unchanged: a slot's sampler index is the runtime's push, and an
argument buffer's sampler index of 4,000 or more still reads element 0, so no
program-written ID reaches a variant. A state keeps its 16 most recently bound
variants; a new one past them takes the place of the least recently bound one
no command buffer holds, and where work holds all 16 the new one is held by its
command buffer alone. Past 4,000 live variants a bind is
Limit::LodClampVariants { max: 4000 }. The lod_clamp_variants gauge counts the
live variants. A NaN bound, which Metal documents no answer for, binds the
state as it is.

The floor's sampler limits rise to 24,000 (maxPerStage and maxDescriptorSet
UpdateAfterBindSamplers) and 286,144 (maxUpdateAfterBindDescriptorsInAllPools);
the lab's least are 500,000 (MoltenVK on the M3 Max) and 1,048,576 (Intel UHD
Graphics 630 on Windows), and Vulkan requires 500,000 of each with
descriptorIndexing.

Gap::LodClamps goes; REFUSALS.md, basis.rs, the signature table, the Metal and
conformance coverage pages regenerate. The validation replay plays clamped
binds (no skipped_clamped_samplers). The ledger drops three rows the clamped
binds now answer (compute-plural-texture-and-sampler-binding steps 11 and 14,
render-state-unread-slots). The compute single clamp form's coverage row named
set_sampler_state; it names set_sampler_state_with_lod_clamps.

Tests: a kernel samples through the binds as Metal reads them; a state's 16
kept variants filled past that; the 4,000 variant elements filled past their
capacity; the gauge flat across a bind and retire loop and zero at device
drop. Verified: see the lane's report (jobs named there).
2026-11-23 00:11:19 -08:00
Anees Iqbal 58148264f8 Conformance: compute-imageblock-sizes, one encoder's dispatches before any imageblock size and at two it sets
A compute step for setImageblockWidth:height: on both sides, and a case that runs
a4_imageblock_extent three times in one encoder: before the encoder sets a size (one
thread, Metal's 1 by 1), then at 4 by 2 and at 4 by 4, each one threadgroup of the
imageblock's extent, into a guarded slot each. The case's test holds Metal's recorded
answer equal to the fixture's own at each extent.

The runtime README states the size as a specialization: each size a kernel runs at is
one VkPipeline made at prepare_dispatch or at the dispatch, a first-use wait, where Metal
changes the size with no compile (m3-max-69983); prepare_dispatch and dispatch_variant
take the size. REPLAY-STREAM and VALIDATION say the player and the engine candidate set
it; the ledger row for the state's imageblock length drops the dispatch refusal.

The recording follows in its own commit (taken on the M3).
2026-11-23 00:09:50 -08:00
Anees Iqbal afbcfec9a7 Runtime: the compute encoder's imageblock size; a kernel's explicit imageblock is dispatched
ComputeCommandEncoder::set_imageblock_size is Metal's setImageblockWidth:height:. The encoder
keeps the size, 1 by 1 until a call sets one (Metal's size for an encoder that never sets one),
and a dispatch of a kernel that reaches an explicit imageblock runs at it: the translator's
SpecKey::ImageblockWidth and ImageblockHeight are specialized per VkPipeline (Constant::Imageblock),
as a threadgroup memory length is. The dispatch's refusal (Gap::KernelInput naming
RuntimeFact::ImageblockSize) goes.

- encoder: Sizes carries the encoder's threadgroup memory lengths and imageblock size to decide()
  and threadgroup_memory(); Lengths holds the imageblock size for a kernel that reaches one (0 by
  0 otherwise, so other kernels keep one pipeline whatever the encoder set), and its cells
  (w x h x cell bytes, rounded to 16) count in Limit::ThreadgroupMemory with the lengths.
- pipeline: Variant keeps its Lengths (the key is ([u32; 3], &Lengths, bool)); an imageblock
  kernel has no main pipeline, as a kernel that takes a threadgroup memory length has none;
  keeps_plain counts the imageblock as encoder-sized memory.
- Refusal::ImageblockSize: a side that is not a power of two (0 included) or more than 1024
  cells, whatever the state's maxTotalThreadsPerThreadgroup, as Metal's validation layer stops
  them at the call (probe crates/metal2vulkan-conformance/probes/imageblock_size_rules.m, job
  m3-max-70002, M3 Max, macOS 27.0.1).
- prepare_dispatch and dispatch_variant take the imageblock size as a fourth argument ([1, 1]
  where the encoder set none); a size the encoder would refuse makes nothing and answers None.
  The consumer's two call sites take the argument (planner, through main).
- Validation: the engine candidate sets a case's explicit imageblock size and passes it to
  prepare_dispatch; KernelImageblock narrows to a tile pass's implicit imageblock (the runtime
  builds no tile function). No executor ABI bump: no recorded row ran an explicit imageblock
  case, which the requirement refused. The replay player plays setImageblockWidth:height:, and the
  pre-pass passes each dispatch's size.

Form (step 0, jobs m3-max-69983, m3-max-69984): Metal compiles nothing for a new size (a new
size's first dispatch 202-312 us median against 205-228 us second use and 222 us at the control
size, a state's make 15-20 ms); a pushed size would size the Workgroup arena at Metal's 1024
cells on every dispatch. A new size here is one VkPipeline make at its first dispatch, a known gap.

Tests: tests::imageblock (replacing tests::kernel_input): a dispatch never sized runs 1 by 1; one
encoder runs 4 by 2 and 4 by 4, each read back, two first-use variant waits and no main
pipeline; the setter's refusals.
2026-11-23 00:09:50 -08:00
Anees Iqbal f016ff5098 rt: the counters name each kind of counted copy once, at its first copy, up to 256 kinds
What: Counters::over_copy_kinds(from) answers the kinds of texture over a buffer the device copied
into an image of its own and back, each once, in the order first copied: an OverCopyKind with its
OverCause (now public), pixel format, width, height and usage. The set keeps the first 256 kinds;
once it holds 256, a copy of a kind not among them counts in Metrics::over_copies_unkept_kind, so a
reader knows the kinds are full. The copy record (OverCopy) carries the kind in place of the cause;
each copy's count (Counters::over_copied) takes it.

Why: the over-copy counters give bytes by cause only; a walk could not say which textures are
copied. A consumer that logs the kinds past the number it has read names each one once.

The README's host-memory gap now also says that every driver asked offers and binds the linear
image over host memory's import, so the bar is the undefined start that
VUID-VkImageCreateInfo-pNext-01443 makes mandatory, not the driver. The probe (a Python ctypes
query, not kept): vkGetPhysicalDeviceImageFormatProperties2 with
VkPhysicalDeviceExternalImageFormatInfo (HOST_ALLOCATION), LINEAR, 13 colour formats by 5 usages
(transfer, plus sampled, storage, colour attachment) and mutable with the sRGB pair, then the image
made at 256x256 and 1920x1080, an anonymous mapping of its size imported, and the image bound:
- lavapipe and RADV 780M (Mesa 26.2.6), m3-max-70177: offered 77 of 77 rows the plain linear query
  offers, bound 154 of 154; RADV refuses dma-buf with LINEAR on every row.
- RTX 3090 (NVIDIA 620.70.06), m3-max-70178: offered 77 of 77, bound 154 of 154.
- Iris Xe (ANV, Mesa 26.2.6), m3-max-70179: offered 77 of 77, bound 154 of 154.
- M3 Max (KosmicKrisp, Mesa 26.3.1), m3-max-70180: offered 34, every read and read-write row;
  every row with the colour attachment usage is refused by the plain linear query too; bound 68
  of 68.

Tests: the_counters_name_each_copied_kind_once_up_to_their_bound (device-free: kinds named once in
first-copy order, a read from a number, filled 3 past the bound, unkept copies counted each time,
a kept kind's never); every_device_counts_each_textures_copies_under_its_cause now also checks that
each copied texture's kind is named once with its format and size, and an in-place one names none.

Verified: see the compile and lavapipe jobs named in the landing.
2026-11-23 00:09:50 -08:00
Anees Iqbal 39498a602f Translator: a vertex function's slice or viewport index it never writes is stored as 0
A vertex function that declares [[render_target_array_index]] or [[viewport_array_index]] and
never writes it returns the index undef (Apple's compiler inserts nothing into the returned
struct's field). The translator took undef as divergent among a primitive's vertices (each use of
OpUndef may read another value) and refused the function, NotImplemented(LayeredRendering).
Metal gives such an index no value, so an index undef at every return
(stage_io::returns_undefined: an undef or poison inserted there, a member of one, or a member no
insertion writes into one) is stored as 0 wherever it is stored (PlannedOutput::unwritten: the
Layer and ViewportIndex builtins and their raw varyings), the same at every vertex, as Vulkan
asks (VUID-VkPipelineShaderStageCreateInfo-stage-02596 and -02597), and uniform_varyings lists
it among the uniform outputs. The offset of a draw of one amplification and the count each
index is held below apply as to any written index. The member walk returns_no_nan used is
shared (returned_member); its answers are unchanged.

SEMANTICS_VERSION 2282: modules for such functions instead of the refusal.
2026-11-23 00:09:50 -08:00
Anees Iqbal 72ebd5edb4 Runtime test: a storage cube and a cube array are written by face through their 2D-array storage elements
every_device_writes_a_storage_cube_and_a_cube_array_by_face runs the owned
fixture cube_face_writes through the runtime's public API on each device:
a 2 by 2 RGBA32Float cube and a cube array of two, filled with -1, written
by face at level 0. Every face of the cube and of the array's second cube
holds its writes, the first cube keeps its fill, and the width, height and
cube count read 2, 2 and 2.
2026-11-23 00:09:49 -08:00
Anees Iqbal 82f0ceca53 Identity domains: a storage cube written or read by face is the 2D-array element of its faces
The translator declares every storage cube and cube array as the 2D array of its faces, at layer
6 * cube + face (cube_as_array). Under the resident-table domains the binder supplies that view.
Under the identity domains no class held it, so a kernel that writes a cube by face was refused
with "texture argument S: a type the identity arrays hold no element of". In the private corpus
on runtime-floor that refusal covered 30 guest functions alone, and 6 more together with a
sampled cube read by face.

Now:
- Translator: identity_class takes a storage declaration that views a cube as an array as the
  2D-array storage class, and a storage cube states no ImageViewShape fact under the identity
  domains. A sampled cube read by face (access::read or access::sample) still has no class and
  stays refused.
- Runtime: a cube's or cube array's storage element, for a texture and for a texture view, is a
  VK_IMAGE_VIEW_TYPE_2D_ARRAY view of its 6N layers (storage_view_type). Vulkan takes that view
  of any cube-compatible image, so every device gets the same form, at no copy and no cost. The
  sampled element stays the cube view.
- docs/API.md states the storage element a consumer holds for a cube. The runtime README says
  what a cube's storage view is, and its identity-domain gap list keeps only sampled cubes read
  by face.
- The same README list adds the refusal of a storage texture written at a run-time level, with
  what Metal does on Intel Macs: an owned kernel's writes at levels 1 and 2, read from a buffer,
  landed exactly on a Radeon Pro 5300M and a UHD 630 under macOS 26.7.1, with Metal's
  validation off, with API validation, and with shader validation (job m3-max-70040, probe built
  in m3-max-70037).

Under the resident-table domains nothing changes: both translator changes apply only under the
identity domains.
2026-11-23 00:09:48 -08:00
Anees Iqbal 12f8a9f06a Identity domains: a bicubic sample at pixel coordinates
The identity domains refused every function that samples a 2D texture through a bicubic
constexpr sampler at pixel coordinates ("a bicubic filter at pixel coordinates"), though its
lowering is the normalized sample's with no position step: a pixel coordinate is already in
texels, so the emulation reads the coordinate itself, the level-0 size by OpImageQuerySizeLod of
the bound image (which under the identity domains is the slot's set-1 element), and the format's
treatment from the slot's PushField::BicubicTexels, as at normalized coordinates. Nothing in it
reads state the identity domains do not source, so the refusal goes: SamplerPlan::bicubic_pixel
and BICUBIC_PIXEL_FORM are deleted. Metal's front end admits pixel coordinates only with clamping
modes (MSL 2.10), and a mirrored axis at pixel coordinates stays refused by bicubic::check, as on
the resident-table domains. A bicubic sample of a 1D texture keeps its own refusal.

The runtime README's known gaps and docs/API.md no longer list the form.

No SEMANTICS bump of its own: 2278, beside the shared bicubic switch fix, covers both.

Metal reads the two forms alike: in the committed M3 observations of the three bcu_address cases
(macOS 26.7 and 27.0.1), the clamp-to-edge and clamp-to-zero samples at pixel coordinates equal
the same samplers' samples of the same point at normalized coordinates, bit for bit, on 64 of 64
lanes each. The sample keeps PrecisionNote::BicubicFilterArithmetic, as at normalized
coordinates.
2026-11-22 22:54:11 -08:00
Anees Iqbal 4551aa9f3c Float depth upload note: names what each measured device keeps
The note RestrictedDepthUpload and the runtime README's known-gap line now say what
the upload kept on one card per vendor, under the validation layer 1.4.363.0, on a
Private 4x4 Depth32Float filled by a blit's copy_from_buffer with 16 values:

- NVIDIA 620.70.06 (RTX 3090, m3-max-69834) kept every value bit for bit and
  compared it unclamped, as Metal does.
- RADV, Mesa 26.2.6 (Radeon 780M, m3-max-69832), and ANV, Mesa 26.2.6
  (Iris Xe, m3-max-69833), clamped to [0, 1]. NaN of either sign, -inf, negatives,
  denormals and -0.0 became +0.0, and +inf with values above 1 became 1.0.
  Comparisons followed the stored value.
- The validation layer reported none of these copies.

The note's line "a value within [0, 1] is copied exactly" now excepts a denormal
and -0.0, which RADV and ANV store as +0.0.

Docs only: artifact.rs, the runtime's texture.rs, docs/API.md, the runtime README.
2026-11-22 22:40:56 -08:00
Anees Iqbal 11ef6b17fd Runtime tests: the float depth unit test compares aspect bits; replace_region's error list rewrapped 2026-11-22 22:40:56 -08:00
Anees Iqbal aae58c6acb Runtime: an upload into a 32-bit float depth is the device's copy, under a static note
What: replace_region, upload_region and the blit's copy_from_buffer(_with_options) into a
32-bit float depth (Depth32Float, or Depth32Float_Stencil8's depth) no longer answer
Gap::FloatDepthUpload, which is gone: each is the plain vkCmdCopyBufferToImage into the depth
aspect, on every device, and carries Texture::FLOAT_DEPTH_UPLOAD_NOTE
(PrecisionNote::RestrictedDepthUpload, metal2vulkan-degrade-restricted-depth-upload). A value
within [0, 1] is copied exactly; one outside it is the device's, as
VUID-vkCmdCopyBufferToImage-pRegions-07931 leaves it without VK_EXT_depth_range_unrestricted,
which the runtime enables nowhere. No byte is read and no query chooses anything.

Translator: the new note's variant, codec tag (ARTIFACT_FORMAT_VERSION 592), validation's
allowance (unbounded), the conformance degradation (not native, as restricted-depth-range is
not) and docs/API.md's catalogue; RestrictedDepthRange's docs name the upload note.

Conformance: the rt side announces the note at each upload into a 32-bit float depth; the
compare cases declare it; heap_sizes' round trip writes depths within [0, 1] for Depth32Float.
2026-11-22 22:40:56 -08:00
Anees Iqbal 88e59e3a38 Runtime README: an argument buffer's texture buffer is no identity-domain refusal; its parts are
What: the known gaps of pipeline states list, under the identity domains' forms, the argument-
buffer textures the identity arrays hold no element of. That list named "a texture buffer"; it
now names "a texture buffer's parts".

Why: since 817463704e an argument buffer's texture_buffer member, as a slot, is the element of set
1's texel-buffer arrays its resource ID holds (lower/texture/slot.rs identity_class maps Dim::Buffer
to a texel-buffer class), so a pipeline that declares one is not Unsupported{IdentityDomains}.
identity_class still answers None for a declaration with parts (decl.parts), and its doc names "a
texture buffer's parts" among what the identity arrays hold no element of.

How verified: read from the tree at fc8d0ccd15: identity_class and its doc
(crates/metal2vulkan/src/lower/texture/slot.rs), and tests::engine_identity's
a_texture_buffer_is_the_texel_buffer_element_its_resource_id_names, which compiles
rlm_runtime_limits' rlm_member_texture_buffer (an argument buffer's texture buffer) to binding 5
under the identity domains and passes L3. Docs only; nothing built or run.
2026-11-22 22:38:14 -08:00
Anees Iqbal fc8d0ccd15 Runtime README: a consumer that answers YES owns a dropped sample-position set
What: the known gap for programmable sample positions no longer says the consumer answers the
query NO until the setter is built. It says what is true: the runtime has no setter and answers
nothing, every multisample pass rasterizes at the standard locations (Metal's defaults at 1, 2
and 4 samples), and a consumer that answers YES owns counting and dropping a set that differs
from the defaults.

Why: the consumer answers YES, as the guest's Mac does; it counts a differing set under its
unbuilt render-pass items and announces it, and none has been seen in its recorded logs. The
NO clause in 375e4770bf was a ruling that has been withdrawn.

Verified: doc-only; the workspace Rustdoc line runs on development after the merge.
2026-11-22 22:36:39 -08:00