Commit Graph
9157 Commits
Author SHA1 Message Date
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
Anees Iqbal 8210cb0b70 Fixtures: rt6_unwritten, a vertex function that declares its slice and viewport and writes neither
An owned MSL source: the vertex function rt6_unwritten declares [[render_target_array_index]]
and [[viewport_array_index]] and writes neither, so Apple's compiler returns both undef; the
fragment function rt6_unwritten_read reads both. Its companions follow from
scripts/regen-air-fixtures on the M3.
2026-11-23 00:09:49 -08:00
Anees Iqbal 867d41a4d5 Translator: SEMANTICS_VERSION 2281 for the storage cube's 2D-array element under the identity domains
What: SEMANTICS_VERSION 2279 -> 2281.

Why: under the identity domains a storage cube or cube array written or read
by face now lowers to the 2D-array storage element of its faces, where it was
refused as IdentityDomains (texture argument S). That changes output under an
unchanged key. The AMD fix takes 2280, so this change takes the next number.

Verified: the translation census of the private corpus at the change
(f521ab4c14) against its base (a677cb74b3), every row at the current
fingerprint, on runtime-floor and gate-lavapipe (job m3-max-70149): 17,209
rows each, defects 0, budget stops 0, gates pass, slowest row 823 and 827 ms,
peak resident 218 and 222 MB. On each profile 30 functions move from
unsupported to translated, 2 stay unsupported with the refusal now naming
their texture slot 1 instead of slot 0, and no other row changes. The golden
table is re-blessed on development.
2026-11-23 00:09:49 -08:00
Anees Iqbal 2e53759543 Authored cases: a storage cube and a cube array written by face, and their sizes, qualified on Metal
Three public cases over the owned cube_face_writes fixture (2 by 2
RGBA32Float, grid 2 x 2 x 6, each output filled with 0xab first):

- write-each-face-of-a-storage-cube-by-its-face-index (51a16094...): every
  texel of all six faces of a write-only texturecube holds (x, y, face, 1).
- write-each-face-of-the-second-cube-of-a-storage-cube-array (0d4f03eb...):
  slices 6 to 11 of a two-cube write-only texturecube_array hold the same
  writes, and slices 0 to 5 keep their fill.
- storage-cube-width-height-and-cube-array-size (6072ce40...): get_width,
  get_height and get_array_size read 2, 2 and 2.

Verified: corpus-case-check accepted and installed all three, and
corpus-metal qualified them on the M3 (apple-m3-max-macos27.0.1, job
m3-max-70124). Each Metal output equals the values the kernel writes, computed
on the CPU, byte for byte.
2026-11-23 00:09:49 -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 ac0ea4c6d8 Fixture: cube_face_writes' companions, its inventory rows and its golden printout
scripts/regen-air-fixtures cube_face_writes (Apple metal 32023.922.4, macOS
SDK 27.2, LLVM 21.1.8) writes the .ll and .air.ll companions and the
TOOLCHAIN line; the engine inventory bless adds the fixture's two rows, ok on
every profile, and changes no other; the air_input bless adds its printout
(job m3-max-70105).
2026-11-23 00:09:49 -08:00
Anees Iqbal f732f769ef Test: the storage-cube test pushes the integer-channel word of its 32-bit images
The plan of the storage-cube kernel under the identity domains carries
PushField::TextureIntegerChannels for each of its two uint storage slots
(a slot without a format), which the test's push loop did not fill and
panicked on (job m3-max-70068, msi, at f521ab4c14). The images are 32-bit
channels, so the word is 0 and each lane stores as written.
2026-11-23 00:09:49 -08:00
Anees Iqbal f84d576295 Fixture source: cube_face_writes, our MSL writing a storage cube and a cube array by face
One kernel writes (x, y, f, 1) at texel (x, y) of face f of a texturecube<float, write> at level 0,
and of face f of the second cube of a texturecube_array<float, write>. Thread 0 stores the cube's
width and height and the array's cube count. The companions come from scripts/regen-air-fixtures
on the M3.
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 d17a643504 Test: a storage cube written by face under the identity domains is the 2D-array element of its faces
A kernel writes (x, y, face, 7) at texel (x, y) of every face of a texturecube<uint, write> slot
and of the second cube of a texturecube_array<uint, write> slot, and stores the cube's width and
the array's cube count. Under the identity domains, on lavapipe and moltenvk-m3, the test asserts
that the kernel compiles and links, that no ImageViewShape fact is stated, and that both slots
are elements of the one 2D-array storage class at their pushed resource IDs. On the CPU
interpreter the writes land on layers 6 * cube + face of those elements, and the width and cube
count are the elements'.

The translator refuses this kernel today, naming "texture argument SlotRef { .. }: a type the
identity arrays hold no element of", so the test fails until storage cubes get an identity class.
2026-11-23 00:09:48 -08:00
Anees Iqbal fd0771d944 Tests: the pin's bless at 98f2025df8 (golden table, authored compile census)
What:
- golden_hashes.tsv: semantics 2277 -> 2280. 868 of 1,305 rows change (12,907 cells), 2 rows
  are new (kernel_agx_shfl's .air.ll and .ll), 0 are gone. The bulk is the floor's tail fold
  (059835018a), which changes the words of every module that reads a pushed field; the bicubic
  and llvm.agx2.shfl cells are among them.
- authored-compile.tsv: 12 cases (7 of the owned bicubic cases, 5 private-corpus cases) move
  from not_supported{unsupported:not_implemented IdentityDomains} to compiled on all 9
  profiles (108 cells), from the bicubic sample at pixel coordinates and the shared bicubic
  switch under the identity domains. 8,923 compiled cells keep their outcome and change their
  artifact digest (the tail fold). Two new rows: the agx_shfl_pairs and agx_shfl_sweep cases.

Why: the golden class failed on development since the bicubic and shfl commits (2278, 2279)
and the tail fold (2280), and the authored compile census was stale since the bicubic work.

The tail fold's 3% check (gpu_busy, total GPU-busy time over glbench frames 30-400, fix over
base, three alternating rounds after a warm play of each arm):
- Radeon 780M on RADV: -0.43% (m3-max-70218).
- Iris Xe on ANV: +2.71% (m3-max-70219); every fix play is 2.3-2.9% above every base play, a
  real cost of the selects, inside the 3% bar.
- RTX 3090: -3.13% (m3-max-70207), its fix arm spreading 23%, so no sign can be read.
Cold makes of the one state found, #424 of the setup2 stream, each from an empty driver cache
on AMDVLK 2025.Q2.1 (Radeon 780M): 24 of 24 crashed before the fix (m3-max-70250), 12 of 12
made at it (m3-max-70252).

Corrections to two earlier messages on this branch:
- 059835018a says the owner's Windows driver died making the same stream's states. We do
  not know which state his driver died on. The crash was reproduced on AMD's open driver in
  the lab, and the fix is unverified on his Windows driver until his retry.
- 64cb2002f0 says "Verified: not yet; the suite job follows". It was verified after:
  m3-max-70095 at 64cb2002f0, and m3-max-70165 at 98f2025df8 (3,592 of 3,593, the golden
  table the one red, which this commit blesses).

Verified: the bless job m3-max-70275 on the M3 at 98f2025df8 (inventory, golden, printouts,
opened chains and the authored compile census each exit 0).
2026-11-23 00:07:53 -08:00
Anees Iqbal 98f2025df8 Spill test: follow only the tail's fold of the parameter block's address
64cb2002f0 let the spill test's disassembly trace step through any
OpSelect of a ulong whose false hand is a push load. The bounds checks'
selects of a slot's address against the zero range's pushed address
have that form too, so the trace also counted the 24 slot reads through
them: amd-780m-hawkpoint-radv read (36, 36, 12) where 12 lines were
spilled. The trace now steps only through the fold's own form, a
select whose true hand is the ulong null (lower::push::fold_never_pushed).

Verified: m3-max-70095 (msi-laptop) showed the (36, 36, 12) failure at
64cb2002f0, with workspace clippy and the other 3591 tests of the gate's
first suite line passing (golden hashes aside, re-blessed on
development); this commit's run follows.
2026-11-22 23:31:56 -08:00
Anees Iqbal 64cb2002f0 Writes: the status address traces through the floor's tail fold
Since the floor's tail folds into each other pushed field through an
OpSelect against null (059835018a), the ExecutionStatusAddress the
product's status words are written through is a select of its push
load, and the writes trace stopped there: a multisampled fragment that
only counts resident misses (WIDE_READ) read as writing memory of its
own. The trace now steps through an OpSelect whose one hand is a
constant, and an OpIAdd of two values ends at the status member when
one hand is that member's load, folded or not. A selection of two
values still ends the trace as the function's.

The writes test builds its miss-counting fragments with the floor's
tail folded into every field too; the spill test's disassembly trace
follows the select from the parameter block's pushed address.

Verified: not yet; the suite job follows.
2026-11-22 23:16:52 -08:00
Anees Iqbal 059835018a Translator: the floor's tail folds into each other pushed field through a select, not a never-taken return
The floor's tail guard read the tail in the first block and returned where it held a value the
consumer never pushes, so every stage that pushes more than one field ran its whole body under a
never-taken branch. AMD's open driver (AMDVLK 2025.Q2.1, LLPC) dies in vkCreateGraphicsPipelines
making a fragment stage of that shape whose loop holds convergent instructions under
MaximallyReconvergesKHR (an implicit-LOD sample and an f32-f16-f32 round trip): the setup
streams' render content 295d5723 ([65] RG16Float, 1 sample) died on the Radeon 780M, and the
owner's Windows driver died making the same stream's states.

Now the stage reads the tail in its first block, tests it as before (lower/push.rs
tail_never_pushed), and each other field read from its push member is, as every use of it
recalls it, its member's value where the test fails and the null of its type where it holds
(fold_never_pushed, EmitCx::fold_tail): a select per field, no branch, no return. The tail's load
lives while any other push read does, which is what the tail is for (a driver that uploads push
bytes up to the highest one a stage reads). A tail field of the stage's own folds into the others
alone. The fields read from their members load first, then the tail folds, then the spilled and
derived fields, which may read through the folded parameter block's address. Same pushed bytes,
same placement, no interface change.

- lower/push.rs: emit_tail_guard becomes tail_never_pushed (the test) and fold_never_pushed.
- lower/emit.rs: load_push_fields loads, folds (fold_tail), then loads the rest; emit_module no
  longer calls a guard.
- SEMANTICS_VERSION 2280.
- Test: the_floor_s_tail_folds_into_the_other_pushed_fields_with_no_branch (one select per
  other pushed field, no branch on the tail's test, one return), which fails on the guard.
- Docs: lower/push.rs, PushField docs, docs/API.md section 5.
2026-11-22 23:09:52 -08:00
Anees Iqbal b3fd1a568c command-replay: the state options' type named 2026-11-22 22:56:07 -08:00
Anees Iqbal 50ac881fc0 Replay player states: a pooled make's state is dropped at once (the device's map keeps its content) 2026-11-22 22:56:07 -08:00
Anees Iqbal 00cef89ec5 Replay player: a play's pipeline state makes are written as they happen, on its own threads where asked
WIP: compile check pending.
2026-11-22 22:56:07 -08:00
Anees Iqbal a677cb74b3 docs/API.md: the bicubic catalogue's RGBA16Float figure names what lavapipe measured at the edges
What: the precision-note catalogue's largest RGBA16Float difference under the bicubic filter
note now also gives 4.73e-4, measured on lavapipe in the authored bicubic edge cases
(bicubic-edges-of-random-texels-in-a-12x10-rgba16-float, at values in [1, 2), where a half step
is 9.77e-4), at normalized and at pixel coordinates alike. The conformance case's 3.74e-4 stays.

Why: the catalogue changes with the behaviour it describes. The pixel-coordinate form beneath
this commit put those cases through the runtime, and their largest RGBA16Float difference is
above the listed figure. The normalized column of each case shows the same difference, so it is
the note's arithmetic, not the pixel form.

Verified: read from the bicpix lane's run m3-max-69926 on lavapipe at 86bea53a4e (the same tree
as these commits before their rebase): all 7 cases NotedDifference, the pixel column equal to the
normalized column on 64 of 64 lanes in the candidate and in Metal.
2026-11-22 22:54:13 -08:00
Anees Iqbal 138158140a Translator: SEMANTICS_VERSION 2279 for llvm.agx2.shfl's lowering and the AgxUnmodeled relabel
What: SEMANTICS_VERSION 2278 -> 2279.

Why: llvm.agx2.shfl now lowers (4 functions in 2 libraries that refused as AgxUnmodeled translate),
and an unmodelled AGX call that takes or returns a pointer is refused as AgxUnmodeled instead of
Lowering(Access) (18 functions in 6 libraries move). Both change output under an unchanged key.
The bicubic pixel-coordinate change beneath this one took 2278, so this change takes the next
number; the earlier commit's body that says 2276 -> 2277 predates both rebases.

Verified: the version only; the golden table is re-blessed on development.
2026-11-22 22:54:13 -08:00
Anees Iqbal 720deb7bf6 Authored cases: llvm.agx2.shfl on edge and random pairs and over every 16-bit value, qualified on Metal
Two public cases over the owned kernel_agx_shfl fixture:

- agx-shfl-interleaves-the-bits-of-edge-and-random-pairs (8e51bda5...): 134 pairs in one
  threadgroup (0/0, ffff/ffff, ffff/0, 0/ffff, aaaa/5555, 5555/aaaa, each single bit alone in
  either operand, in both and against its mirror, and 64 LCG pairs), each result read back
  over a 0xab fill.
- agx-shfl-over-every-16-bit-value-matches-the-bit-by-bit-interleave (93662f10...): 65,536
  threads, four pairs each ((t, 0), (0, t), (t, ~t), t with a hash of t), counting the results
  that differ from a bit-by-bit interleave and summing every result two ways.

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-69889). Metal's outputs equal the interleave contract's
exactly: the pairs' sha256 f616d0f9... is that of the 134 interleaves computed on the CPU, and
the sweep reads 0 differences, 0xfffe8000 and 0x643d0000, the CPU's values.

An exhaustive 2^32-pair case is not committed: every public case runs on lavapipe with one thread
in the public leg, where it is not cheap; the exhaustive measurement on the M3 (all 2^32 pairs,
zero differences) is the one that decided the contract.
2026-11-22 22:54:13 -08:00
Anees Iqbal dc1d07e63d Fixture: kernel_agx_shfl's companions, its inventory rows and its golden printout
scripts/regen-air-fixtures compiled kernel_agx_shfl on the M3 (Apple metal 32023.922, SDK 27.2,
recorded in TOOLCHAIN as this fixture's toolchain; LLVM 21.1.8): .ll and .air.ll, the calls of the
declared agx_shfl renamed to llvm.agx2.shfl, which metal-as declares nounwind speculatable
memory(none). 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-69866).
2026-11-22 22:54:12 -08:00
Anees Iqbal 9590f1fe67 Fixture source: kernel_agx_shfl, our MSL calling llvm.agx2.shfl through an air-rename
Two kernels: agx_shfl_pairs interleaves the halves of each input word, and agx_shfl_sweep
interleaves four pairs per thread over every 16-bit value and counts the results that differ
from the bit-by-bit interleave, beside two wrapping sums of every result. The companions follow
from scripts/regen-air-fixtures on the M3.
2026-11-22 22:54:12 -08:00
Anees Iqbal 1a20cbc15f Validation: the specialization audit takes --hash-file and reports each selected row
corpus-triage refused --hash-file for every audit but translation. The specialization audit now
reads it the same way and plans and attempts those rows alone (the selection applies before
--limit, in rows_to_plan and pending), then prints, per profile, one specialization-row line per
selected row: a 12-character prefix of its hash, its plain outcome and key, how many sets it was
attempted and translated under, whether it translates under every set, some, none, or was not
attempted, and each other outcome with the number of sets that reached it.

The sweep's parameters (jobs, summary-only, limit, selection) travel together as one Run.

Test: a_selection_plans_and_attempts_its_rows_alone_and_each_has_a_verdict builds its own
synthetic index (three rows, a plain census) and holds the selection before the limit in both
selections and each verdict (every, some, none, unattempted).
2026-11-22 22:54:12 -08:00
Anees Iqbal a8349dd5ef Translator: llvm.agx2.shfl lowers to its measured bit interleave; an unmodelled AGX call taking a pointer is refused as AgxUnmodeled
llvm.agx2.shfl, i32 (i16 a, i16 b), interleaves its operands' bits: bit 2i of the result is bit i
of a, bit 2i + 1 is bit i of b. Measured on an M3 Max over all 2^32 operand pairs, with zero
differences against the interleave and 2^31 against a control with one table bit wrong. MSL
documents the same contract for interleave(ushort, ushort), which compiles to air.interleave.i32
instead. The lowering is per-thread integer arithmetic on every device, with no feature and no
subgroup operation: each operand, held zero-extended in its 32-bit container, is spread to the
even bits by four mask-and-shift steps (0x00FF00FF, 0x0F0F0F0F, 0x33333333, 0x55555555), and the
second is shifted up by one and ORed in. The decode names it AgxOp::Shfl with that signature;
every other AGX operation keeps its refusal (igemm is undocumented and the M3 cannot compile it).

The memory analysis refused a call with no signature that takes or returns a pointer as
Lowering(Access). For an AGX call that means an operation whose contract is not modelled, so it
is now refused as AgxUnmodeled, the refusal the lowering gives the same operation without a
pointer. The census by kind ranks the work, so the label has to name the cause.

SEMANTICS_VERSION 2276 -> 2277 (the shfl rows' modules, and the relabelled refusal class).
api_signatures.tsv gains AgxOp::Shfl: a consumer's exhaustive match on metal2vulkan-air's AgxOp
breaks (git grep AgxOp in the consumer's checkout at 3c4979983e: 0 hits). docs/REFUSALS.md does
not move: AgxUnmodeled is still built at its one helper.

Red before: m3-max-69816 (msi, a0e15aed00, llvm-as 23.1.1): the shfl kernel refused as
AgxUnmodeled, and the wide emask load refused as Lowering(Access).
2026-11-22 22:54:12 -08:00
Anees Iqbal 92aae68e8c Tests: llvm.agx2.shfl interleaves its operands' bits; an unmodelled AGX call taking a pointer is refused as AgxUnmodeled
Red before the lowering: the shfl kernel is refused as AgxUnmodeled on every profile, and the
wide emask load (an unmodelled AGX call with a device pointer) is refused by the memory analysis
as Lowering(Access).

The interleave's contract was measured on an M3 Max over all 2^32 operand pairs: bit 2i of the
result is bit i of the first operand, bit 2i + 1 is bit i of the second.
2026-11-22 22:54:12 -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 d0139665fe Test: a bicubic sample at pixel coordinates under the identity domains
engine_identity's bicubic test now compiles bcu_address (one 2D texture sampled through bicubic
samplers at normalized and at pixel coordinates) under the identity domains and validates it: its
slot's BicubicTexels field pushed, no specialization constant. bcu_forms (a 1D texture) stays
refused with its own form. The shared bicubic switch's identity runs take the pixel sampler too:
its words per arm and every lane against the resident-table domains' lane of its candidate alone.

Red at this commit: the identity domains refuse a bicubic sample at pixel coordinates
("a bicubic filter at pixel coordinates").
2026-11-22 22:54:11 -08:00
Anees Iqbal 52113199ee Translator: the shared bicubic switch reads each arm's image and format bits under the identity domains
A switch-at-use whose arms all take a bicubic sample (an array of textures, or textures chosen by
a function constant, sampled through one bicubic constexpr sampler) emulates once: a facts
dispatch yields the named candidate's size and format bits, and a taps dispatch reads its texels.
Both read each arm's combined binding and its BicubicTexels specialization, which the identity
domains do not declare, so every such switch under the runtime's domains failed with "internal
error: combined binding ... is not declared".

Under the identity domains an arm's image is now its texture slot's element of the set-1 array at
the index its pushed resource ID holds (emit::identity_image, the image half of the sampled image
a candidate's own sample makes), and its bits the slot's PushField::BicubicTexels, which the plan
already pushed (bicubic::format_bits, the one reading of a slot's bits the own and the shared
emulation share). The resident-table form is unchanged.

SEMANTICS 2278 (with the pixel-coordinate form that lands beside it): modules that failed now translate.
2026-11-22 22:54:11 -08:00
Anees Iqbal a1abb9e7e5 Test: the shared bicubic switch under the identity domains
The shared emulation of a switch-at-use (an array of textures sampled per lane through one
bicubic constexpr sampler) is now also compiled, validated and run on the interpreter under the
identity domains, the runtime's: its words per arm do not depend on the emulation's, and every
lane equals the resident-table domains' lane of its candidate alone, the null texture zero. The
identity domains refuse a bicubic sample at pixel coordinates, so there the forms are a repeating
and a clamping sampler at normalized coordinates.

Red at this commit: the shared form reads the resident-table domains' combined bindings, which
the identity domains do not declare, and fails with an internal error.
2026-11-22 22:54:11 -08:00
Anees Iqbal a8c1acc9a1 Tests: the pin's bless at 64be1d50ae (golden table, engine printout, authored compile census)
What:
- golden_hashes.tsv: semantics 2276 -> 2277, and the 15 cells of the fixture
  kernel_threadgroup_constant_index_outside_the_array (both its .air.ll and .ll rows): 15 new,
  0 changed, 0 gone.
- tests/air_input/kernel_threadgroup_constant_index_outside_the_array.txt: that fixture's golden
  printout, which its commit left out.
- authored-compile.tsv: the 303 kernel visible-function-table cases now compile on every
  profile (they read not_supported{tooling_requirement:kernel_function_table} before compute
  function tables were built), and two new rows: the authored table case and the
  threadgroup-constant-index case.

Why: the golden class failed on development since the threadgroup arena commits, and the
authored compile census was stale since the table work.

Verified: the bless job m3-max-69975 on the M3 at 64be1d50ae (inventory, golden, printouts,
opened chains and the authored compile census each exit 0). The 302 private kernel-table cases
match Metal as runtime candidates on lavapipe (m3-max-69951, 302/302).
2026-11-22 22:46:49 -08:00
Anees Iqbal 64be1d50ae Conformance coverage: regenerated for the float depth upload's ledger rows
The ledger has ten fewer rows (18 dropped, 8 added), and one more module (format_copies)
declares a notice. Generated by scripts/conformance-coverage/coverage.py at 72e5c3e571
(m3-max-69942).
2026-11-22 22:40:56 -08:00
Anees Iqbal f66ad563cc Conformance test: the fresh-contents depth row declares the upload's note, and no other row
The test held each texture row to its compression and storage declarations alone. The
Depth32Float row now also declares restricted-depth-upload, so the test counts it and asserts
that only that row declares it. Failed on bd98479373's suite (m3-max-69900: left 2, right 1).
2026-11-22 22:40:56 -08:00
Anees Iqbal 64f9fb8687 Conformance: the cases a float depth upload reaches declare its note; the ledger drops its rows
Removing Gap::FloatDepthUpload let 18 rows of known-gaps-rt.tsv run past the upload. The lavapipe
replay (m3-max-69820, llvmpipe LLVM 23.1.1, Mesa 26.2.4) then reported:

- fresh-texture-depth32float-private and the nine sampler-compare rows now match Metal. Their
  rows are dropped.
- The six format-copies pairs with Depth32Float now stop at the copy between the textures. rt
  refuses that copy typed as one Metal documents as invalid, the accepted difference the Depth16
  and Stencil8 pairs already hold. Each row now carries that text. The M3 Max (macOS 27.0.1,
  m3-max-69887) copied the bytes with API validation off, and its validation layer stops each
  of the six: "Copy From Texture Validation [sourceTexture pixelFormat](MTLPixelFormat...) must
  equal [destinationTexture pixelFormat](MTLPixelFormat...)".
- texture-fills-252 and -260 now stop at fillTexture:level:slice:region:bytes:length:, which the
  rt side answers Unavailable. Their rows carry the text of the family's other fillTexture rows.

The notes these runs now announce are declared where the case's work makes them:

- restricted-depth-upload (the upload's note) in format-copies, the Depth32Float row of
  fresh-contents, and texture-fills 252 and 260. Each loosens the notices site alone.
- simdgroup-access-order on the compare rows of sampler-filtering and sampler-crossings. Their
  kernel rrp_mc_compare writes out[5 * i + k], which the translator does not prove disjoint
  between threads, so the note is static on every device.

How it was verified:

- the M3 validation probe above;
- the replay's listing in m3-max-69820;
- the check that follows on this commit.
2026-11-22 22:40:56 -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
Anees Iqbal 375e4770bf Runtime README: until the sample-position setter is built, the consumer answers its query NO
What: the known gap of programmable sample positions now says what the consumer answers
programmableSamplePositionsSupported until setSamplePositions:count: is built: NO. The paragraph's
lines are reflowed.

Why: the planner's ruling on the row (11-22): the README names the consumer's answer while the
setter is unbuilt, so a guest is told it cannot set positions rather than having its set dropped.

How verified: docs only; nothing built or run.
2026-11-22 22:32:46 -08:00
Anees Iqbal 0cc88f6dd7 Runtime README: programmable sample positions are not built
What: a known gap of render encoders. The render pass descriptor has no field for
setSamplePositions:count:, and the runtime answers no programmableSamplePositionsSupported, so
every multisample pass rasterizes at Vulkan's standard sample locations (standardSampleLocations,
in the floor), Metal's default positions at 1, 2 and 4 samples. A pass whose set differs from the
defaults samples at the defaults, with no refusal. VK_EXT_sample_locations, Vulkan's form for set
positions, is not enabled.

Why: a guest sets sample positions (arm64 GL walks on the Mac host), and the README did not say
that the runtime does not take them. The consumer answers the support query itself.

How verified: read from the tree at d825e52482. RenderPassDescriptor (pass.rs) has no
sample-position field; no runtime source names sample locations but floor.rs's
standardSampleLocations limit; docs/METAL-COVERAGE.md lists setSamplePositions:count: and
programmableSamplePositionsSupported as missing. Docs only; nothing built or run.
2026-11-22 22:29:27 -08:00
Anees Iqbal d825e52482 Validation: the suite's pins for the table work
- runtime-sources.sha256: the runtime inputs include the translator's bind
  module, where function_table_header and function_table_entry_offset became
  public; they lay out the words the shader already read, and no run of an
  unchanged artifact does anything else, so RUNTIME_VERSION does not move.
- public_linked_modules_resolve_by_hash_without_a_private_store lists the
  new public linked module visible_table_ops.
- coverage.tsv: MTLFunctionHandle's counterpart is the translator's
  FunctionHandle (the runtime re-exports it), and
  visibleFunctionTableDescriptor is VisibleFunctionTableDescriptor's Default,
  as the coverage test finds items.

The three failed in the validation suite at dabc455312 (m3-max-69738:
1291 passed, 3 failed).
2026-11-22 22:11:30 -08:00
Anees Iqbal ee96eca15b Validation: name the bound tables' type in the runtime candidate
clippy's type_complexity refused the dispatch's binding tuple once it held
the tables (m3-max-69738, clippy plain, m2v_gpu and m2v_cpu_icd).
2026-11-22 22:11:30 -08:00
Anees Iqbal d11697b000 Conformance: the twelve compute visible-table cases match Metal on the runtime
The replay on lavapipe (m3-max-69685, llvmpipe of Mesa 26.2.4) compares
every visible-tables-compute case exactly with the M3's recordings, so their
known-gaps rows, which recorded the runtime's Slot refusal, are dropped.
The six render-stage cases stay refused as recorded. CONFORMANCE-COVERAGE.md
is regenerated.
2026-11-22 22:11:30 -08:00
Anees Iqbal 11d8892858 Validation: an authored case calls through a kernel's visible-function table
visible-table-entry-by-thread-calls-add-mul-null-sub (af884d65cb): twelve
threads of the owned visible_table_dispatch each call entry tid % 4 of a
table of four, linking table_add, table_mul and table_sub from the owned
module visible_table_ops, entry 2 left null. Installed with
corpus-case-check and qualified on Metal on the M3 in the primary reference
environment (m3-max-69730: three runs, 3, 3, 0xfffffffd, 0, 7, 15,
0xfffffffd, 4, 11, 27, 0xfffffffd, 8).

The public qualification (CI's lavapipe step) now also runs it and the
public table-query case 3a8f75e182, which the runtime refused before.
2026-11-22 22:11:30 -08:00