Commit Graph
9200 Commits
Author SHA1 Message Date
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 e170e6647e Harness: the gauge list names every count of a live object kind
What: the harness's named() list gains lod_clamp_variants, render_contents, attachment_views and
device_samplers, and its doc says what the list holds: every count of an object kind the runtime
keeps live, with the byte and age gauges and the thread ids left out.

Why: its doc said "all of them, so the matrix's @drop check covers every kind of resource", but
the list held 11 of the runtime's 15 object counts, so a leak of LOD-clamp sampler variants,
render contents, attachment views or device samplers never reached the matrix's @drop check or
its reading between the 100th and 200th runs. The byte and age gauges stay out: they move with
load between those runs (an idle age grows by itself) and would read as growth. The runtime's
own teardown test already holds every gauge at 0 after the device drops (tests/device.rs), so
the four new @drop lines are expected 0 on every leg.

Verified: the harness check job named in the next message; development's checks follow.
2026-11-23 01:01:15 -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 3ab0b39a57 Translator: SEMANTICS_VERSION 2285 for MSL 3.2's program-scope buffer bindings
What: SEMANTICS_VERSION 2284 -> 2285.

Why: a module carrying !air.global_bindings was refused whole (ProgramScopeBinding); a bound
buffer's loads now become buffer parameters at its slot, and the other shapes are refused apart
(ProgramScopeResource, ProgramScopeSharedSlot, ProgramScopeLinked, ProgramScopeRead). That changes
output under an unchanged key. 2284 is the closed cell of an array of buffer pointers, so this change takes 2285.

Verified: the translation census of the private corpus at the change (6c139875fb, the same product diff as this
branch's 0294be2f6f before its rebase) against its
base (98f2025df8), every row at the current fingerprint, on runtime-floor and gate-lavapipe
(potluck job m3-max-70364 on the M3 Max, arms built in m3-max-70344): 17,210 rows each, 79 moved
on each profile, every one from ProgramScopeBinding to translated, internal 0, budget stops 0.
The golden table is re-blessed on development.
2026-11-23 00:51:23 -08:00
Anees Iqbal bcceea1a97 Authored case: program-scope buffers read the stage's buffers at their indices, qualified on Metal
Case bfeea3f0e697 over the owned fixture kernel_program_scope_buffers (one threadgroup of 64
threads): a constant struct and a constant word table bound at program scope at buffer(1) and
buffer(2), read only through their globals, and a device uint * bound at program scope at
buffer(0), the slot of the kernel's own buffer(0) parameter, of the same type. Each thread writes
word * 3 + bias through the parameter and the bits of gain[i & 3] * (word & 0xff) through the
global, 64 words further on, over a 0xab fill. Compared exactly.

Qualified on an Apple M3 Max under macOS 27.0.1 (environment apple-m3-max-macos27.0.1) in potluck
job m3-max-70378: output sha256 89229be57934..., the value computed ahead of the run from the
inputs under the reading that a global and a parameter of one type at one index fill from the one
buffer bound there.
2026-11-23 00:51:11 -08:00
Anees Iqbal 8c44de343b API surface: metal2vulkan-air's table lists abi::GlobalBinding
The new public struct of the program-scope bindings, an addition (no line removed or changed).
Found by metal2vulkan-air's api_surface test in potluck job m3-max-70373.
2026-11-23 00:51:11 -08:00
Anees Iqbal 80187ce5d1 Refusals: the three program-scope shapes Metal was measured to take declare metal-takes
ProgramScopeResource, ProgramScopeSharedSlot and ProgramScopeLinked are refusals Metal does not
make: an Apple M3 Max under macOS 27.0.1 runs each (potluck jobs m3-max-70268 and m3-max-70306).
Each declares it as its doc comment's last line, so the refusal surface counts them under
metal-takes (3 translator rows, from 0). ProgramScopeRead stays derived (ours): Apple's compiler is
not seen to write such a read. docs/REFUSALS.md regenerated; refusal_surface.py --check passes.
2026-11-23 00:51:11 -08:00
Anees Iqbal 8816cb11b2 Validation test: program-scope bindings are required buffers at their slots, after the entry's parameters
Over the owned fixture kernel_program_scope_buffers: the case checker's interface lists the three
bound globals as required buffers at slots 1, 2 and 0, numbered after the entry's two parameters,
beside the kernel's own buffer(0). Run in the lane's check job.
2026-11-23 00:51:11 -08:00
Anees Iqbal 4c3cac2956 Fixture: kernel_program_scope_buffers' companions, its inventory rows and its golden printout
The companions compiled from our MSL by scripts/regen-air-fixtures (Apple metal 32023.922,
macOS SDK 27.2), the engine inventory's two rows (both translate in every column) and the
air_input printout, blessed in potluck job m3-max-70338 on the M3 Max.
2026-11-23 00:51:11 -08:00
Anees Iqbal 2dde97928f Tests: the program-scope binding test reads the pruned module's globals through its parts
Compile fix for the test of the previous commit: Module has no globals(); the pruned module's
parts hold them (job m3-max-70339: E0599 and an unused import).
2026-11-23 00:51:11 -08:00
Anees Iqbal e4f4cbd550 Fixture source: kernel_program_scope_buffers, our MSL reading and writing through program-scope buffers
One kernel: a constant struct and a constant word table bound at program scope (buffer 1 and
2), written through its own buffer(0) parameter and through a program-scope device uint *
bound at the same index, which Metal fills from the one buffer bound there. The companions
follow from scripts/regen-air-fixtures on the M3.
2026-11-23 00:51:11 -08:00
Anees Iqbal 9017de1aa2 Validation: a case checks against an entry's program-scope bindings as parameters at their slots
The case checker's AIR-layer interface had no program-scope bindings (`!air.global_bindings`),
so a manifest could not bind the buffer a bound global reads, and a case that left it out
passed the checker while Metal read whatever the slot held. Each binding is now a parameter of
its role at its node's slot, numbered after the entry's own; no LLVM parameter carries it, so
what the code does through it is not traced, and every binding of the module is required.
2026-11-23 00:51:10 -08:00
Anees Iqbal 058fd25a7b Translator: MSL 3.2 program-scope buffer bindings become buffer parameters; other shapes refused apart
What: `!air.global_bindings` decodes into `AirAbi::global_bindings` (`GlobalBinding`: the
global, and its node's role, type information and name, read by the parameter-node decoder;
the node's index is -1). Canonicalization (`canon::global_binding`, beside the global
built-ins) makes each plain load of a bound buffer's pointer (device or constant space, one
stated slot) a read of a parameter: the entry's own parameter of the binding's role and type
where it takes one, else one appended, shared by the bindings of one role and type. Lowering
then binds it where a `[[buffer(n)]]` parameter binds; the runtime binds nothing new.

Why: the whole module was refused as ProgramScopeBinding (78 functions in 1 library of the
private corpus on runtime-floor and gate-lavapipe: kernels, one constant struct buffer each,
read only by plain loads of its pointer). Metal fills a bound global from the executing stage's
own argument table. Measured on an Apple M3 Max under macOS 27.0.1:
- m3-max-70268: a kernel's globals read and write the buffers bound at their indices;
  reflection lists each as a binding at its index; a parameter and a global of one type at one
  index, and two globals of one type at one index, read the one buffer; a vertex and a fragment
  function reading one global each read their own stage's buffer at its index.
- m3-max-70306: Metal also takes a bound texture and sampler, bound threadgroup memory, a bound
  sampler array, and a linked visible function of another library that reads a bound buffer.

What stays refused, each a refusal of its own (docs/REFUSALS.md regenerated):
ProgramScopeResource (a texture, sampler or threadgroup memory, one or an array),
ProgramScopeSharedSlot (a binding at a slot an entry parameter or another binding binds with
another role or type), ProgramScopeLinked (bindings in a linked or dynamic-library module),
ProgramScopeRead (a read of a bound buffer other than a load of its pointer, which
`xcrun metal` 32023.922 does not write). ProgramScopeBinding is gone: a consumer's exhaustive
match on Feature breaks, and a consumer's AirAbi literal needs the new field (git grep of the
consumer's checkout at aed8655a62: 0 hits for ProgramScopeBinding and for `AirAbi {`).

Tests: the ABI decode of a binding (a node with a parameter's index, or a global that is not the
externally initialized undef constant, is malformed); canonicalization over a kernel with three
bound buffers (two appended parameters, one shared with the entry's own) and the refused
shapes; linking and dynamic-library refusals.
2026-11-23 00:51:10 -08:00
Anees Iqbal 338803bb03 Translator: SEMANTICS_VERSION 2284 for the closed cell of an array of buffer pointers
What: SEMANTICS_VERSION 2283 -> 2284.

Why: a kernel that stores an entry buffer's pointer as a value into a thread's private array of
device pointers was refused as Unsupported{Lowering(Access)} under the identity domains, because
the array stayed an open cell. The provenance change before this one closes the cell in two
shapes (an aggregate that stays a value; a whole-slot zero fill beside run-time-indexed
accesses), so those functions now give modules under an unchanged key.

Verified:
- Translation census of the private corpus, every row at the current fingerprint, on
  runtime-floor and gate-lavapipe. Before (8ab24c9753, 2283; potluck job m3-max-70360): 17,214
  rows; runtime-floor 15,352 translated, gate-lavapipe 15,589, 13 Lowering(Access) on each.
  After (this tree; m3-max-70379): 17,217 rows (3 new to the index); runtime-floor 15,361
  translated, gate-lavapipe 15,598, 7 Lowering(Access) on each, defects 0 and failed 0 on both.
  The six functions of the two libraries this change targets translate on both profiles; the
  other seven rows keep Lowering(Access), another shape. Slowest row 813 ms (runtime-floor) and
  823 ms (gate-lavapipe), peak resident 221 MB and 226 MB: within 20 s and 500 MiB.
- Suites at this tree (m3-max-70381): metal2vulkan and metal2vulkan-air 3,354 of 3,355; the one
  red is the golden table, stale by 45 new cells (kernel_buffer_pointer_arrays' rows), 0 gone,
  0 changed, re-blessed on development. Doctests 0 failed.
- fmt, clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd) and workspace Rustdoc, rc 0
  (m3-max-70382).
- Earlier on the branch: red before (m3-max-70329), the two authored cases qualified on Metal
  (m3-max-70355) and matched on lavapipe (m3-max-70363).
2026-11-23 00:51:00 -08:00
Anees Iqbal 9232c98373 Fixture: kernel_buffer_pointer_arrays' inventory rows and its golden printout
bless_engine_inventory adds kernel_buffer_pointer_arrays' six rows (both companions, the
pick, by-value and zero-filled entries), each ok on all 15 profiles; no other cell moves. The
air_input bless adds its printout and changes no other (job m3-max-70361, on the M3 Max at
d627145f66).
2026-11-23 00:38:00 -08:00
Anees Iqbal 3d40f2f39d Authored cases: an array of buffer pointers in an array_ref by value, and a zero-filled one moved at run-time indices, qualified on Metal
Two public cases over the owned kernel_buffer_pointer_arrays fixture, one threadgroup of 64
threads over a 0xab fill of the output (buffer 3):
- pointer-array-in-an-array-ref-by-value-reads-and-writes-through-run-time-elements (9fafc659...):
  out[i] = {a, b}[(1 + i) % 2][i] + i, read through one element of {a, b, out} and written through
  element 2, a[k] = 0x1000 + k, b[k] = 0x200000 + 7k; loop free.
- zero-filled-pointer-array-moves-and-reads-elements-at-run-time-indices (9bdd6be4...): count = 3,
  out[i] = (a[i] * 31 + b[i]) * 31 + c[i], wrapping, c[k] = 0x30000000 + 13k; both loops run
  min(count, 3) times (authored bounded).
Verified: corpus-case-check accepted and installed both, and corpus-metal qualified both on the M3
(apple-m3-max-macos27.0.1, job m3-max-70355). Metal's outputs equal the words computed on the CPU:
sha256 477dc52f... and 5984245e....
2026-11-23 00:38:00 -08:00
Anees Iqbal 674cf321a9 Provenance: an aggregate that stays a value, and a whole-slot zero fill beside run-time-indexed pointers, keep a cell closed
What: two rules of the pointer-cell verification (memory/provenance/cells.rs).
- An insertvalue whose aggregate stays a value (its every use, and every use of each aggregate
  built on it, is an extractvalue, the aggregate operand of an insertvalue, or an incoming value
  of a phi of such aggregates) no longer opens the allocas of the pointer it inserts. Provenance
  already reads each extractvalue through its insertion chain as the inserted pointer, and the
  arith family forwards it, so the pointer's accesses are the extraction's, which the walk sees.
- A zero fill beside pointer accesses at an unknown offset keeps the cell closed when every such
  access lies at a multiple of the pointer's size (its offset's proven alignment) and so does each
  end of the fill; exact slots must still be covered wholly or not at all. A load at an unknown
  offset already reads null wherever the cell has zero bytes.

Why: a thread's array of entry buffer pointers stayed an open cell in two shapes, and under the
identity domains a static buffer pointer stored into an open cell is refused
(Unsupported{Lowering(Access)} from pointer::store_pointer, which takes only a buffer destination).
Closed, each element holds its static fat pointer (root, offset) and each access through a loaded
element switches among the slots stored there, the form an array of buffer pointers indexed at run
time already took: no device address, the same form on every device. In the private corpus's
census (runtime-floor) this was 6 functions in 2 libraries: 4 that put the array's address into an
array_ref of a struct passed by value to inlined helpers (refused under every specialization: the
real-make rows), and 2 that zero the array with a memset beside a loop that loads, moves and stores
back an element at a run-time index (plain census only; their specializations translate). The
other route, storing the static pointer's address into the open cell, would make each loaded
element a device address; it is not taken.

How verified: the owned kernel_buffer_pointer_arrays' by-value and zero-filled kernels were refused
at the guest rows' site at the parent (CLI on runtime-floor and gate-lavapipe, m3-max-70315; the
test, m3-max-70329) and compile, pass L3 and compute Metal's words on the CPU interpreter on every
identity profile here (m3-max-70341); the plain array kernel compiled before and after. Lint:
fmt, clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd), workspace Rustdoc (m3-max-70346). The
translator suites, the census and the golden cells that move are in the SEMANTICS commit's body.
2026-11-23 00:38:00 -08:00
Anees Iqbal f4093dc549 Tests: a thread's array of slot pointers, its address in an array_ref by value or the array zero-filled, is a closed cell
Over the owned kernel_buffer_pointer_arrays on every profile the identity domains derive: each of
its three kernels compiles in the identity form, moves its pointers through cell stores and loads
(3/1, 3/2 and 4/2), passes L3, and computes Metal's words on the CPU interpreter (count 2 and 3 for
the zero-filled one), leaving the other slots as they were. The identity pointer tests' push
placement now fills the stage's parameter block where a profile's push window spills, as
runtime-floor's does for five slots.

Red before the cells change that follows: pointer_array_by_value is refused as
Unsupported{Lowering(Access)} at block 0, instruction 2, the store of its first buffer into the
array (job m3-max-70329).
2026-11-23 00:38:00 -08:00
Anees Iqbal 24a93a1c14 Fixture: kernel_buffer_pointer_arrays' companions
scripts/regen-air-fixtures compiled kernel_buffer_pointer_arrays on the M3 (Apple metal 32023.922,
SDK 27.2, recorded in TOOLCHAIN as this fixture's toolchain; LLVM 21.1.8), job m3-max-70305. In
pointer_array_by_value the kernel inserts the array's address into the array_ref member it passes
(insertvalue), and move_word extracts it; pointer_array_zero_filled's memset covers elements 1 to
15 before element 0 is stored. Its inventory rows and golden printout follow the lowering.
2026-11-23 00:37:23 -08:00
Anees Iqbal 0c371b2c49 Fixture source: kernel_buffer_pointer_arrays, a thread's array of entry buffer pointers read and written at run-time indices
Three kernels over our own MSL, each storing its buffer arguments into a thread's array of device
pointers and reaching memory through elements read at an index only the run knows:
- pointer_array_pick: the array alone, read through element (pick + i) % 3;
- pointer_array_by_value: the array's address in the array_ref member of a struct passed by value
  to a noinline external function, which reads through one element and writes through another;
- pointer_array_zero_filled: an array of 16 pointers zeroed by a memset, its first elements set,
  each moved on (a load and a store back at a run-time index) and read through.
The struct holds an array_ref because Apple's compiler passes a struct member by member and an
array_ref member as one aggregate value (compile probes m3-max-70297, 70300, 70304): the kernel
inserts the array's address into it, as the shape the translator refused does. The companions
follow from scripts/regen-air-fixtures on the M3.
2026-11-23 00:37:23 -08:00
Anees Iqbal e50427cfe5 Test: the floor's set-1 sampler array is its 24,000 update-after-bind samplers
0eb982e471 raised the runtime floor profile's update-after-bind sampler limits from 12,000 to
24,000 for the LOD-clamp variants, and an_argument_sampler_array_has_the_heap_sampler_capacity
still asserted the floor's array at 12,000: it failed on development's tip (m3-max-70331 at
8ab24c9753, engine_handles.rs:4496). The lane's checks ran the runtime, validation and
conformance suites, not the translator's. The array follows heap_sampler_capacity, which reads
the profile, so the assertion and the doc comment now say 24,000; no product line moves.

Verified: not yet; the translator suite at this commit follows (named in the pin line).
2026-11-23 00:32:33 -08:00
Anees Iqbal da966cb37a Tests: the pin's bless at 8ab24c9753 (golden table, authored compile census)
What:
- golden_hashes.tsv: semantics 2280 -> 2283 and six new rows, the .air.ll and .ll of
  cube_face_writes, rt6_unwritten and rt6_per_primitive; 0 rows change, 0 are gone.
- authored-compile.tsv: 32 cases move (288 cells) and 5 cases are new.
  - The 52 cases that read not_supported{tooling_requirement:kernel_imageblock} under census
    version 8:
    - 25 with an explicit imageblock move: 18 compile, 6 now stop at
      not_supported{needs_input:StorageTextureFormat} and 1 at the IdentityDomains refusal;
    - 26 with a tile pass's implicit imageblock keep the requirement;
    - the one case with no imageblock field, icb_imageblock_encode (an indirect command
      buffer encoding a compute command), read kernel_imageblock beside
      indirect_compute_commands and now reads indirect_compute_commands alone. Before the
      change, case_requirements gave the requirement only to a case with an imageblock field,
      so that cell is expected to have been stale, cleared by version 9's re-key (unaudited).
  - 4 cases move from LayeredRendering to compiled (the plain store of the slice and viewport
    index), and 2 from IdentityDomains to compiled (the storage cube by face).
  - New rows: the three storage-cube cases, the never-written slice and viewport case, and the
    per-triangle slice and viewport case.

Why: the golden class and the authored compile census were stale since SEMANTICS 2281 to 2283
and AUTHORED_COMPILE_CENSUS_VERSION 9 landed.

Verified: the bless job m3-max-70332 on the M3 at 8ab24c9753 (inventory, golden, printouts,
opened chains and the authored compile census each exit 0).
2026-11-23 00:29:24 -08:00
Anees Iqbal 8ab24c9753 Fixture: rt6_per_primitive's inventory rows and its golden printout; rt6_first_vertex's rows translate
bless_engine_inventory adds rt6_per_primitive's four rows (both companions, both entries), each ok
on all 15 profiles, and moves rt6_first_vertex's four vertex rows from
Unsupported{LayeredRendering; NotImplemented} to ok on all 15; no other cell moves. The air_input
bless adds rt6_per_primitive's printout and changes no other (job m3-max-70261, on the M3 at
7579f5aa42).
2026-11-23 00:13:45 -08:00
Anees Iqbal d0c4a00d1c Authored case: a slice and viewport read per triangle from a device buffer draw each triangle through the one layer and viewport, qualified on Metal
Case 44f95cb5f9dd: rt6_per_primitive draws four triangles, two to each half of a 4x4 rgba32_uint
target with no pixel center on an edge, each reading its index from a device buffer at
vertex_id / 3 (0x0000, 0x0001, 0x0102, 0x0103: slices 0 to 3, viewports 0, 0, 1, 1), and the case
observes the flat varying that carries the index. In a one-layer pass with Metal's one default
viewport, a slice index at or past renderTargetArrayLength is interpreted as 0 and a viewport index
past the count draws through viewport 0 or the clamped one, here the same (the Metal Shading
Language specification, 5.10), so each triangle covers its own pixels. Every vertex of a triangle
writes the same slice and viewport, as Metal requires; nothing in the function's structure shows
it.

Qualified on the M3 Max (job m3-max-70249, macOS 27.0.1, output c140c91e): every pixel holds the
index its triangle read, all four triangles drawn.
2026-11-23 00:13:45 -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 4136135089 Translator test: a slice and viewport index the structure does not show alike are stored as written
indices_are_stored_as_the_vertex_function_writes_them replaces the test that held such a vertex
function refused as not implemented. rt6_per_primitive (its index read per triangle from a device
buffer at vertex_id / 3) and rt6_first_vertex (read per vertex) must compile on lavapipe,
moltenvk-m3, lavapipe without geometryShader and the runtime floor, declare Layer and
ViewportIndex, and make a valid pipeline of their vertex and fragment stages alone; on the floor
without shaderOutputLayer the pipeline is refused needing that feature alone. The test of an index
never written no longer asks for the index among the uniform outputs, which hold user varyings
alone after the change it tests.

Red before the change: every such function is refused NotImplemented(LayeredRendering).
2026-11-23 00:13:34 -08:00
Anees Iqbal 1221889c38 Fixtures: rt6_per_primitive's companions
scripts/regen-air-fixtures/regen-air-fixtures.sh rt6_per_primitive on the M3 (job m3-max-70231:
Apple metal 32023.922, macOS SDK 27.2, llvm-dis and llvm-as 21). The vertex function loads its
index at udiv vertex_id 3 from its device buffer and returns its low byte as the slice, its shift
by 8 as the viewport and the index as a flat varying.
2026-11-23 00:13:34 -08:00
Anees Iqbal 6a3f4ba5e8 Fixtures: rt6_per_primitive, a vertex function that reads its slice and viewport per triangle
An owned MSL source: the vertex function rt6_per_primitive reads one index per triangle from a
device buffer at vertex_id / 3 and writes its low byte as [[render_target_array_index]], the rest
as [[viewport_array_index]], and the index as a flat varying, so every vertex of a triangle writes
the same slice and viewport, as Metal requires, though nothing in its structure shows it. The
fragment function rt6_per_primitive_read reads all three. Its companions follow from
scripts/regen-air-fixtures on the M3.
2026-11-23 00:13:34 -08:00
Anees Iqbal 5a1d657ed4 Conformance: Metal's timing of sampler-bind-lod-clamps-kernel and -fragment
Taken on the M3 Max with conformance times --runs 8 --write (job m3-max-70276);
times::every_case_is_timed::every_case_carries_its_timing failed without them (job
m3-max-70138).
2026-11-23 00:11:46 -08:00
Anees Iqbal 0eb982e471 Runtime floor profile, conformance notices and ledger rows for the LOD-clamp variants
The committed runtime-floor profile (and its generator's RUNTIME_FLOOR block) states the
floor's raised sampler limits: 24,000 maxPerStage and maxDescriptorSet
UpdateAfterBindSamplers, 286,144 maxUpdateAfterBindDescriptorsInAllPools.
tests::floor::the_floor_profile_states_exactly_the_floor failed without it on lavapipe
(job m3-max-70138) and on the 780M, Iris Xe and RTX 3090 (m3-max-70152, -70153, -70151).

The two sampler-bind-lod-clamps cases declare pixel-sampler-scaling, the static note of a
sample through a runtime sampler slot, which fired on every venue (same jobs). The kernel
case takes the ledger's dispatch_type row every compute-pass case of the rt side takes.
compute-plural-texture-and-sampler-binding now compares its four-bindings site on
lavapipe, which reads lavapipe's one-ulp 8-bit conversion, as compute-inline-bytes does
over the same texture and kernel: a llvmpipe row. The cards compared it exact.
2026-11-23 00:11:46 -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 a95921603a Conformance: Metal's recordings of sampler-bind-lod-clamps-kernel and -fragment
Recorded on the M3 Max, macOS 27.0.1 (job m3-max-70027 on 87c11aff15), three runs folded into
one outcome each. In both a bind's pair replaces the state's clamps: the state of (1, 3) bound
with (0, 4) reads levels 0 to 4, where narrowing would read 1 to 3. A pair whose lower bound is
above the upper reads every sample at the upper's level ((3, 1) level 1, (4, 0) level 0), and a
plain bind after a clamped one reads the state's own clamps again; the range form reads as the
single form. Metal's validation layer refuses no pair: the fragment leg ran with no message, and
the kernel leg's two messages are an unused binding at sampler index 0 and a redundant setting
of the same state.
2026-11-23 00:10:32 -08:00
Anees Iqbal 61a3ab7b16 Conformance: the LOD-clamp bind cases drop the NaN pairs, take a negative and a past-the-levels pair, and test their recordings
The M3 Max's first recording of the two cases (job m3-max-70005 on 6342618acb) read every pair
as replacing the descriptor's clamps, and a lower bound above the upper as the upper twice. It read
(NaN, 4) as the state's own clamps and (0, NaN) as levels up to 2: Metal documents no NaN clamp,
so no case holds a device to that, and the two rows go. Two rows join: (-2, 2) and (6, 9).

The rt side of the suite binds the six LOD-clamped steps (compute, vertex and fragment, single and
range) through the runtime's own calls, where it answered Unavailable.
2026-11-23 00:10:32 -08:00
Anees Iqbal db4b90f1ef Conformance: sampler-bind-lod-clamps cases, kernel and fragment (unrecorded)
Two cases put a sampler state's bind-time LOD clamps to Metal: one state (nearest filters, a
nearest mip filter, lodMinClamp 1, lodMaxClamp 3) over a 16 by 16 R32Float texture of five
levels, each level's texels its level plus 1. The kernel case samples at explicit levels 0 to 7
(unv_rpos2d) after each row's binds in one compute pass; the fragment case draws a 10 by 2
target whose q-th quad samples at level q (alv_rect, mip_implicit_fragment), one pass a row.
Rows: a plain bind, the state's own pair, pairs wider, inside, overlapping below and above, wholly
below and above, unbounded, two whose lower bound is above the upper, NaN in each bound, the
range form, and a plain bind after a clamped one and the reverse.
2026-11-23 00:10:32 -08:00
Anees Iqbal 86131b36ca api_signatures: the first-copy line's public items
9914598d31 made OverCause public and added OverCopyKind, Counters::over_copy_kinds and
Metrics::over_copies_unkept_kind, and left the committed table behind: the signatures check
failed on the stack's tree (m3-max-70244, STEP signatures, and the_public_signatures_are_the_
committed_table in m3-max-70245). All 21 lines are additions, so nothing breaks for a consumer:
OverCause and OverCopyKind are non_exhaustive.

Verified: scripts/api-signatures/signatures.py --check passes on this tree (it reads source
text only).
2026-11-23 00:09:51 -08:00
Anees Iqbal b44edbbb6d Authored compile census: version 9, for an explicit imageblock's kernel case
The imageblock dispatch commits before this one stop giving a kernel case with an explicit
imageblock the KernelImageblock requirement: its run sets the imageblock's size. The authored
compile census stored that refusal for those cases, 25 of the 52 cases whose cells read
not_supported{tooling_requirement:kernel_imageblock} in authored-compile.tsv (the other 26 have
a tile pass's implicit imageblock and keep it; one has no imageblock). Their cells are keyed on
the census fingerprint, the executor ABI and this version, and nothing in those commits moved
the last two, so a warm census could hand back the old refusal. Bumping the version re-keys
every cell; the expectation file is re-blessed at the next pin.

Verified: the counts are a search of authored-compile.tsv and the case shards at this tree; no
build ran for this one-line change.
2026-11-23 00:09:51 -08:00
Anees Iqbal 8f368b0f70 Conformance: compute-imageblock-sizes' module doc names its guard byte without a link to a private item
Rustdoc -D warnings refused the link to the private GUARD (lint job m3-max-70077).
2026-11-23 00:09:51 -08:00
Anees Iqbal 3c5485a207 Conformance: compute-imageblock-sizes declares the SIMD-group access note and its dispatchType row
The runtime's pipeline of a4_imageblock_extent records the static simdgroup-access-order
note on every device, which the card replays announced at the notices site (RTX 3090,
Radeon 780M, Iris Xe: m3-max-70084, 70085, 70086); the case declares it, as
compute-threadgroup-memory-reads-zero does for its kernel, and every value still compares
exactly. The encoder's dispatchType is the consumer's own on every venue, the same ledger
row the other compute-pass cases carry. Every byte of the output compared equal to
Metal's on the three cards.
2026-11-23 00:09:51 -08:00
Anees Iqbal 809f791396 Conformance: compute-imageblock-sizes' Metal recording, and the coverage it adds
Recorded on an Apple M3 Max, macOS 27.0.1 (26A434), job m3-max-70065: three runs, one
outcome, the validated leg ran with nothing announced, and the timing kept. Metal's 832
bytes equal the fixture's answer at each extent: the dispatch before the encoder set a
size read 1 by 1 (its cell and the extent 1, 1), then 4 by 2 and 4 by 4, every byte past
each dispatch's words still its guard.

docs/CONFORMANCE-COVERAGE.md regenerated: MTLComputeCommandEncoder's
setImageblockWidth:height: is now an implemented item the Metal leg exercises (29
implemented, 26 exercised).
2026-11-23 00:09:50 -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 9863aaa96b Fixture: rt6_unwritten's inventory rows and its golden printout
bless_engine_inventory adds exactly its four rows (both companions, both entries), each ok on all
15 profiles, and moves no other cell; the air_input bless adds its printout and changes no other
(job m3-max-70061, on the M3 at 273ac30971).
2026-11-23 00:09:50 -08:00
Anees Iqbal aece31bf60 Authored case: a slice and viewport index never written draw through the one layer and viewport, qualified on Metal
a-slice-and-viewport-index-never-written-draw-through-the-one-layer-and-viewport (571c7dea...)
draws rt6_unwritten's triangle (both indices undef) once into a 4x4 rgba32_float target of one
layer with Metal's one default viewport, observing the position: every pixel center at z 0.5,
w 1.

Verified: corpus-case-check accepted and installed it, and corpus-metal qualified it on the M3
(apple-m3-max-macos27.0.1, job m3-max-70054): output sha256 187ca9f8..., the same bytes as
a-viewport-index-past-the-one-viewport-draws-through-it's Metal observation, a full-target
triangle through viewport 0.
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 7a7482974a Translator test: a vertex function's slice and viewport it never writes are stored as 0
indices_a_vertex_function_never_writes_are_stored_as_zero compiles engine/rt6_unwritten (both
indices undef in the return) on lavapipe and runtime-floor and asks for both among the uniform
outputs, Layer and ViewportIndex declared, the pipeline with rt6_unwritten_read valid, and no
store to either builtin reading an OpUndef. It fails here: the translator refuses the function
as not implemented LayeredRendering. The next commit makes it pass.
2026-11-23 00:09:49 -08:00
Anees Iqbal 62d065dab9 Fixtures: rt6_unwritten's companions
scripts/regen-air-fixtures/regen-air-fixtures.sh rt6_unwritten on the M3 (job m3-max-70024:
Apple metal 32023.922, macOS SDK 27.2, llvm-dis and llvm-as 21). The vertex function's return
inserts only the position into an undef struct, so the slice and the viewport index are undef.
2026-11-23 00:09:49 -08:00