Commit Graph
964 Commits
Author SHA1 Message Date
Anees Iqbal 511f31b0ba Translator: an index past an array field's array sends its private-arena access to the sink, not onto the last element
a992aa6929 bounded a GEP into an array field of a thread variable to its
array, so a struct holding handles beside a run-time-indexed array closes
as a forwarding cell. In the private arena it held every run to that bound
by clamping each run-time index to the array's last element. A store past
the array then landed on the array's own last word. The runtime's
private_sinks contract wants such a store kept off every word a thread
reads, as a store past a private array is. On lavapipe at development
8a2f155883 (job m3-max-80535),
every_device_keeps_a_store_past_a_private_array_off_its_words failed: the
fold over the arrays moved by about 193,700, which is b[k]'s store of
t + 200000 over b[N - 1]. The same test at 8a2f155883 with a992aa6929
reverted (scratch tree, job m3-max-80554) is the cause check.

The bound only promises that no run reaches outside the variable; where an
out-of-range index lands is undefined in MSL. So the GEP's offset is now
the sink's, 2^32 - 1, where any run-time index is above its array's last
element: ULessThanEqual per index, LogicalAnd across them, and one select.
No arena holds that offset, so the access's existing containment check
makes it a zero load or no store, as an access past a private array is,
off the array's words and every other's. The forwarding analysis keeps
relying on the in-field assumption alone (memory::provenance, unchanged).
parked_heap_handles' run-time-indexed array fields stay bounded and the
struct still closes (access.private.gep.array, 3 uses).

docs/API.md's accepted difference says it: a read past the end of an array
field reads zero and a write is dropped, in the private arena as in a
variable of its own. The local, provenance and parked-handles docs say the
same. The device-arena budget test's run-time-index shapes cost one
instruction more than the clamp (a compare and a select in place of a
UMin): bounds 14, 13 and 25. SEMANTICS_VERSION 2321 (development holds
2320).
2026-12-02 15:16:20 -08:00
Anees Iqbal e93d7e6b1b Docs: a fragment's primitive id behind tessellation is the patch's position without a patch index buffer
The evaluation stage's varying carries Metal's patch index, which is the
patch's position in its draw only where no patch index buffer is bound. With
one, Metal's [[primitive_id]] stays the patch's position while its patch
index is the buffer's entry (an Apple M3 Max, job m3-max-80366), so the
docs now say which draws the varying's value is Metal's for, and that the
runtime records no patch draw through a patch index buffer
(DrawKind::PatchIndexBuffer stays refused). The translator module docs,
lower_inputs, the tessellation link module, docs/API.md and the runtime
README say so; no code changes.

Doc lines past 100 columns in stage_io/plan.rs, lower_inputs.rs, the
tessellation link module and the engine_device_arena and engine_draw_bases
tests are rewrapped, and the patch test's println is shortened under the
limit.
2026-12-02 14:41:35 -08:00
Anees Iqbal 5689683788 Translator: a fragment function's primitive id behind a post-tessellation function is the patch's position
Behind an evaluation stage, Metal's [[primitive_id]] is the patch's position
in its draw, patch start included, the same in every instance and for every
triangle the tessellator makes of the patch (an Apple M3 Max, job
m3-max-80266: draws of two patches from patch 0 over two instances read 0
and 1 in both instances; two patches from patch 2 read 2 and 3). Vulkan's
PrimitiveId there counts the draw's patches from 0 and restarts in each
instance (the specification's PrimitiveId: "The index of the first primitive
generated by a drawing command is zero ... reset to zero between each
instance drawn ... In a fragment shader, it will contain ... the value that
would have been presented as input to the geometry shader had it been
present"), so it differs once patchStart is not 0. The translator refused
such a pipeline at link, NotImplemented(Tessellation), which a walk's
pipeline met behind its post-tessellation [[base_instance]].

The fragment function now reads it through the primitive ID's flat varying
(IoRole::PrimitiveId), on every device, one form: a post-tessellation
vertex function compiled under LoweringInputs::primitive_id_varying writes
Metal's patch index, its patch input at PATCH_INDEX_LOCATION, to that
varying at each return (stage_io::PrimitiveIdStore::Patch). Without a patch
index buffer the patch index is the patch's position; the runtime draws no
patches through one (DrawKind::PatchIndexBuffer stays refused), and the docs
state the value for draws without one. The same value
reaches every vertex of the patch, so the provoking vertex does not matter.
Device::compile_render_pipeline and the render keys decide the varying for a
post-tessellation vertex stage as they do on a device without a fragment
PrimitiveId; the library answers that without decoding the function (a
metallib function's TESS tag, a module entry's air.patch), and a compiled
stage from its interface. Link refuses a fragment function compiled to read
Vulkan's PrimitiveId behind an evaluation stage as NeedsInput(PrimitiveId),
where it refused every such fragment as NotImplemented(Tessellation);
docs/REFUSALS.md is regenerated.

The varying takes a location as any other: the evaluation stage's outputs
are held to maxTessellationEvaluationOutputComponents when it is planned,
and link numbers the fragment's inputs below maxFragmentInputComponents / 4,
each a typed InterfaceComponents limit refusal past it.

Tests: a_fragment_primitive_id_behind_tessellation_is_the_patch_index_varying
(MoltenVK's and RADV's profiles: the evaluation stage reads the patch-index
input, the fragment stage one flat input and no PrimitiveId, L3), the link
test of a fragment that reads Vulkan's PrimitiveId, and the runtime test
every_device_reads_a_patch_s_position_as_its_fragments_primitive_id, green on
lavapipe (llvmpipe), job m3-max-80338.
2026-12-02 14:41:35 -08:00
Anees Iqbal a992aa6929 Translator: a GEP into an array field of a thread variable stays inside its array
A thread struct that holds pointers or heap handles beside an array field
indexed at run time was open to pointer forwarding: provenance made the
offset of any run-time index unknown, so the data access could overlap a
pointer slot. A heap handle stored into such a struct then fell to the
handle family's catch-all, Lowering(Access). That is the refusal of a
post-tessellation vertex function a walk met (two render pipeline states
refused).

The Metal Shading Language leaves an index past an array undefined. So a
thread-space getelementptr whose first index is a constant, each of whose
run-time indices steps over an array its own type path names, and whose
every use is a load or store address, is a GEP into an array field
(provenance::array_geps). Over a base whose roots are stack allocations at
constant offsets, its offsets are its displacement plus at most
(len - 1) * stride per run-time index. These keep unknown offsets: a
flattened offset (a run-time pointer index), a run-time vector lane, an
address another GEP offsets or that is merged or stored, a base that may
be null, and memory outside the thread space. A run-time index at a struct
level has no IR form.

Lowering holds every run to the bound. In the private arena, where
objects lie side by side, such a GEP takes each run-time index as
min(index, len - 1) (access.private.gep.array). A typed object's access
already never leaves its levels. docs/API.md records the accepted
difference: an index past the end of an array field of a local struct
does not reach its neighbouring fields; it is undefined in MSL. The
struct then closes as a forwarding cell, and its heap-handle stores that
no load reads take the cell's unread store (the previous commit).

Verified:
- red: m3-max-80079, b9d9dfc9ba (parked_heap_handles refused at its
  handle store, block 0 instruction 11).
- green: gate m3-max-80143 at the same tree on a scratch branch
  (lavapipe tests 47 passed; validation 1315 passed, 3 skipped;
  conformance 1047 passed; the translator suite's only failures are the
  tables development re-blesses: the engine inventory with four new
  parked_heap_handles rows, the golden printout, and 315 golden hash
  cells under SEMANTICS_VERSION 2319).
- L0: a_gep_into_an_array_field_is_bounded_to_the_array (the bound, and
  each disqualifying shape staying unknown).
- read-back, whole-struct copy (a memcpy) and a stepped address stay
  Lowering(Access).
- the walk's two metallibs on the XTX node (m3-max-80156): the handle
  store's refusal is gone; the vertex function next met the two
  refusals the following commits remove.

Cost: one UMin per run-time index into a private-arena array, the bound
itself. The device-arena budget test's word bounds move by one each (13
for a word load, 12 for a word store, 24 for a float4 load).
SEMANTICS_VERSION 2320 (development holds 2319).
2026-12-02 14:41:34 -08:00
Anees Iqbal f124b1489f Translator: an access refusal names the structure it met
Feature::Lowering(LowerFamily::Access) with Needs::NotImplemented covered
about 235 refusal sites behind one name, so a walk's log line could not say
which without the AIR. Unsupported gains `cause: Option<Cause>`; an access
refusal carries Cause::Access(AccessCause), one variant per structure the
sites refuse: the access's shape, the type it moves or the memory it
reaches. Sites that refuse the same structure share a variant, wherever
they are; none is named by a file, a line or a string of its own.

The five helpers that build the refusal (lower/access/mod.rs refuse() and
memory/{alloca,leaf,plan,provenance}.rs not_lowered()) take the cause, so
the compiler makes every site name one; the three direct constructions in
memory/handles.rs and lower/access/handle.rs do too, through
Unsupported::access. Feature stays Lowering(Access), so validation's
outcome key (feature_key, the Debug of the feature) and the census are
unchanged. Display prints the cause after the feature:
"Lowering(Access): PointerStore; needs NotImplemented at ...".

Storage: nothing stores the cause. Validation keys a refusal by
feature_key(&u.feature) (engine.rs); a FALLBACK repro bundle keeps the
failure as text (repro.rs, whose only serde record is the device); the
runtime's cache marks a refused translation with fixed bytes. No version
bump.

A buffer argument of a count other than one outside an argument table
names BufferArray, apart from an index or count the metadata does not fix
(UnfixedLocation).

Tests: the error module's Display test of an access refusal; the plan's
table gaps assert ArgumentTable, and its typed-depth, initializer and
buffer-array refusals PrivateType, Initializer and BufferArray.
runtime-sources.sha256 rewritten: memory/handles.rs's two refusals name
their cause, and no run behaves otherwise. api_signatures blessed (Cause,
AccessCause, Unsupported.cause), api_surface lists the two enums,
REFUSALS.md regenerated (the access refusals are built in error/mod.rs),
docs/API.md's error table names the field.

Consumer uses (consumer-uses.sh, read-only, plus git grep, over the
consumer's development 22cfe51a54 and its lane tips of the last day): no
struct literal or exhaustive destructuring of the translator's Unsupported
("Unsupported {" hits only its video crate's own Unsupported(String),
codec/encode.rs:494-502). Its rt platform builds refusals in tests with
Unsupported::not_implemented (rt_platform/diag.rs:3076, 3078, 3490;
rt_platform/unbuilt.rs:1203, 1293), whose cause is None, so their keys
("Translation-Lowering") hold. It reads u.feature where it names a refusal
(rt_platform/diag.rs:1082) and where it says one (rt_platform/unbuilt.rs:
507); each shows the cause once it reads u.cause too.
2026-12-02 14:24:11 -08:00
Anees Iqbal c1f999eb06 rt: pipeline states answer Metal's allocatedSize as their translated SPIR-V's bytes
ComputePipelineState::allocated_size and RenderPipelineState::allocated_size
answer MTLAllocation's allocatedSize, which both Metal pipeline states adopt.
The answer is our code's size, not the driver's compiled binary, which the
runtime does not measure. A compute state answers its kernel's module, the
one its interface is read from. A render state answers its stages' modules,
summed. Both numbers are taken from the translation when the content is made
and kept as a u64 in the content (a compute content's Answers, a field of
RenderCompiled); no module is kept for them. Every device takes the same form.

No variant counts: not the emulated-SIMD-group or partial-threadgroups
variant lowered with a compute state, not one made at a dispatch (the
emulated-partial variant), and not a render content made later for a pass.
So the answer never changes once a state is made, and two states of one
content answer one size.

docs/API.md's accepted differences (Heaps and memory) gets the entry.
MTLAllocation.allocatedSize stays missing in the coverage ledger: buffers,
textures and heaps still lack it. Its note now names the pipeline states'
answers, and docs/METAL-COVERAGE.md is regenerated. api_signatures.tsv is
blessed with the two methods.

Tests:
- state_answers: a new test. block_scan (plain module) and sample_down
  (partial-threadgroups variant) answer non-zero. Each equals the bytes of
  the module the state keeps (a test-only Kernel::module_bytes). The
  render state of first_texel_fragment answers the sum of the translator's
  compile_render_pipeline stages' SPIR-V lengths. Two states of one content
  answer one size.
- translate.rs: the ragged-grid test on emulated SIMD groups now also checks
  that a state's answer is the same after the dispatches that make the
  variant later.

Verified: job m3-max-79929 on lavapipe, a check of this tree.
- signatures --check, coverage --check, clippy (plain, m2v_gpu,
  m2v_cpu_icd), workspace doc and the runtime's private doc: all 0.
- The runtime suite: 928 passed, 3 skipped.
- The two tests rerun with output: both pass. On lavapipe the variant
  already emulates its SIMD groups, so the ragged test makes nothing at a
  dispatch there. No card run yet.
2026-12-02 14:24:11 -08:00
Anees Iqbal 06d2d22bf7 Translator: a library keeps each module in an allocation of its own, and a function keeps its module, not its library
A pipeline state keeps its descriptor's functions to lower its later variants from, and a
function held its whole library through an Arc: a guest that made a state of one function of a
metallib of many, then released the library, kept every module of it alive as long as the
state lived.

At load, a library now splits the one copy it makes of the loaded bytes: each module (each run
of bytes one or more functions' bitcode covers, so functions over one module, as a Core Image
kernel library's or a dynamic library's exported functions, share one) in an allocation of its
own, and every other byte (header, function list, metadata, other sections, padding) in one
more. A function holds its library's function table (rows, content hash, type, install name,
dependencies), its own module's allocation and its index, and the library weakly. So a state
keeps exactly its functions' modules whether the library lives or not: while it lives, the
same allocations the library holds, each module once; nothing is copied at a state's make.

Public changes (api_signatures.tsv, docs/API.md, the doc comments):
- Library::bytes() returns an owned Vec<u8>, assembled from the allocations, equal byte for
  byte to the loaded bytes (of a universal file, its AIR slice, as before); content_hash() is
  their SHA-256, computed at load as before.
- Function::library() returns Option<Library>: the library while a Library value of it lives,
  None after; MTLFunction names no library either.
- Function::library_content_hash() (new): the library's content hash, kept with the table.
- Function::bitcode() (now public, infallible): the function's own module (a metallib
  function's wrapped module, a bare module's whole module, a dynamic library's one module); its
  doc says the bytes are the guest's shader, never committed or sent anywhere.
- Function's PartialEq and Eq: equal tables (each holding its library's content hash) and
  indices.
The translator's own uses of a function's library read the table (compile.rs's dependency
order and EntryNotFound's count); linked_sources no longer fails.

The consumer's call sites (reims-vgpu development 53e7385993, read only; search: git grep -n -E
'\.(bytes|library)\(\)' over crates/reims-vgpu-vulkan and crates/reims-vgpu, and \.library\(\)
over the whole tree; every other hit is a string's, a NAL's, a staging buffer's or
graphics().library()): crates/reims-vgpu-vulkan/src/rt_platform/diag.rs:1860 and :1863 (the
kept-AIR bundle: the container while the library lives, else the function's own module through
bitcode(), the line naming which), diag.rs:1934 (FunctionName::of: library_content_hash()),
diag.rs:3495 (test; unchanged, the bytes compare equal) and unbuilt.rs:653 (test; a function
keeps bitcode().len()).

Tests: the red test's two states (lavapipe; their test accessors now read a kept function's
library where it lives, else its own module); a_live_library_and_its_states_hold_each_module_once
(two compute states and a render state share the library's own allocations);
tests/library_modules.rs: bytes() equals the loaded input for a plain metallib, a Core Image
kernel library (shared module), a dynamic library, each universal header and a bare module, the
content hash their SHA-256; a function holds its module (one allocation per module, shared over
a shared module), names no library once it is released, keeps the content hash and compiles
under the same keys to the same words. The runtime's README says what a state keeps.
2026-12-02 14:24:11 -08:00
Anees Iqbal ac220d6f52 rt: the heap size query answers every storage mode alike; a Shared heap's texture is refused at its placement where the image takes no Shared type
On the RTX 2080 (NVIDIA 620.70.06, job m3-max-79682) the device's optimal images take no Shared
memory type. Two things followed from that:
- The parent commits' size query, which checked a Shared descriptor against the Shared type,
  refused Shared descriptors there. heap.rs's two Private-block tests size Shared descriptors, and
  both failed at their size query.
- A guest that sizes a texture with a Shared descriptor would have lost an answer it had before.

The size query now checks the Private type for every descriptor, as it did before this series.
Its answer does not depend on the storage mode. The Shared type is checked where the texture is
placed in a Shared block, and the placement is Gap::HeapTexture where the image does not take
it.

Follow-on changes:
- The Shared-heap device test expects the size query to answer on every device and the placement
  to be refused exactly where `Device::heap_image_fits` says the image does not take the Shared
  type.
- The conformance side holds a Shared query to the placement and read-back steps in a Shared heap,
  and to step 1 where that placement is Gap::HeapTexture (docs/API.md section 10 says so).
- churn_rest finds out once, by placing a texture for views in a Shared block and releasing it,
  whether the device places its Shared heap texture. Where it does not, the row leaves the kind
  out, naming it with the reason.
- The rt README's known gaps of textures name where a Shared heap's texture is placed: lavapipe
  and the Radeon 780M take it (jobs m3-max-79654 and m3-max-79685); the RTX 2080 does not. The
  Gap::HeapTexture doc says the same.

Ledger: the five rows of the RGB10A8_2P_XR10 heap cases (texture-fills-550, texture-fills-551,
texture-fills-heap-run-550-b5, texture-fills-heap-run-551-b5 and two-plane-heap-blits) take the
Err the replay at 1e1c3f39b8 pasted (lavapipe, job m3-max-79680). Their Shared heap no longer
refuses first, so the format's own Gap::TextureFormat answers. Their venue stays *, since the
format check comes before the placement on every device, and their justification already names
Gap::TextureFormat. CONFORMANCE-COVERAGE.md is regenerated and unchanged.
2026-12-02 14:24:09 -08:00
Anees Iqbal 13951e8daf rt: a texture is placed in a Shared heap as in a Private one, where the device's image takes the Shared type
Metal places textures in a Shared heap: the M3 Max makes them, in automatic and placement heaps
(job m3-max-79576). The runtime refused every texture in a Shared block as Gap::HeapTexture. Now
new_heap_texture and new_heap_texture_for_views bind the device's optimal image in a Shared block's
memory exactly as in a Private block's. That is one form, with no linear image and no copy.

- heap_source refuses an exported block alone, whose memory is dedicated to its buffer.
- heap_fit takes the heap's memory class. At the placement, the class is the block's (Bind::Heap
  carries it). At heap_texture_size_and_align, it is the class the descriptor's storage mode names:
  Shared for Shared, Private for any other, as before.
- Gap::HeapTexture stays typed for an image the device requires an allocation of its own for, or
  whose memoryTypeBits leave out the heap's type, at the size query and at the placement. The
  consumer counts it.

The host reaches such a texture as any texture's, through replace_region and get_bytes. Their
copies go through the GPU and flush or invalidate only their staging bytes. The block's mapping
over the image holds the device's own layout, so the image's range needs no flush or invalidate of
its own. A command buffer that uses the heap (use_heap) flushes and invalidates its whole Shared
block, as it did for the heap's buffers.

Nothing in the runtime asks which Mac the guest has. Whether a guest may make a Shared heap at all
is the consumer's decision; the runtime has no heap object and hands a Shared block to any take.

Docs:
- the rt README's heap paragraph covers Shared heaps;
- the Gap::HeapTexture doc is updated, and REFUSALS.md regenerated;
- docs/API.md's heap-size entry: a Shared descriptor is now held to the placement and read-back
  steps in a heap of a Shared block, as the conformance side's heap_sizes::hold now does;
- the known-gap sentence of the UHD 630 Windows texel-buffer refusal gains its trigger: a second
  device above the floor whose formats lack those buffer features, or a walk that meets the
  refusal.

The test is the parent commit's. Verification is to follow in the handover: lavapipe red then
green, one card per vendor, the gate, and the conformance replay.
2026-12-02 14:24:09 -08:00
Anees Iqbal ce471296d5 rt: an Accumulate pass writes its visibility results as a Reset pass does, on every device
set_visibility_result_mode refused Boolean and Counting in a pass whose
visibilityResultType is Accumulate (Gap::Draw{AccumulatedVisibilityResults}, counted in
Metrics::accumulated_visibility_refused). MTLRenderPass.h documents Accumulate in one
sentence, "Accumulate visibility results data across multiple render passes." Measured
(the conformance recordings, values.rs VisibilityResultType): Metal on an Apple M3 Max
(macOS 27.0.1) adds a Counting result into the word's low 32 bits and ORs a Boolean one,
while Metal on a Radeon Pro 5300M and a UHD Graphics 630 (macOS 26.7.1) writes it in
place of the word, as Reset does. The documented sum needs an add of a query's count into
a buffer word: a scratch copy of the query results and a kernel of the runtime's own after
the rendering, which is not built. The planner ruled that the runtime answers Accumulate
as Reset on every device until that sum is built, which then replaces it everywhere.

So the setter takes every mode in an Accumulate pass as in a Reset pass, and the
encoder no longer keeps the pass's visibilityResultType, which nothing reads now.
Removed public items: DrawKind::AccumulatedVisibilityResults and
Metrics::accumulated_visibility_refused (the consumer's checkout names neither in code;
two doc comments and one test of its rt platform describe the refusal:
rt_platform/render.rs:76 and its test at :2299, rt_platform/descriptor.rs:21).
DrawKind::VisibilityResultInterrupt stays refused, its doc now saying why: its answer
needs the same add. docs/API.md's accepted differences records the measured answers; the
rt README, VisibilityResultType's doc, the validation replay's docs and
docs/REPLAY-STREAM.md follow. The validation replay test of an Accumulate stream now
holds that its modes write as a Reset pass's, nothing skipped. REFUSALS.md regenerated
(Gap::Draw loses one site); api_signatures blessed (the two removed records).
2026-12-02 14:24:08 -08:00
Anees Iqbal 2dc8b1c002 rt: the triangle fill mode of raw value 2 draws as Fill on every device
set_triangle_fill_mode refused TriangleFillMode::Points, the raw value 2 that no SDK
header declares (MTLRenderCommandEncoder.h declares Fill and Lines alone), as
Gap::Draw{FillMode} on every device. Apple's OpenGL renderer sends it for
glPolygonMode(GL_POINT). Metal refuses it on no Mac measured, and the Macs disagree: an
Apple M3 Max and an Intel UHD Graphics 630 draw a triangle's vertices as points, an AMD
Radeon Pro 5300M fills the triangle. The planner ruled that the runtime takes the Fill
answer, which needs no device feature, no pipeline of its own and no precision note.

The setter now takes Points as Fill. DrawKind::FillMode keeps one case, Lines on a
device without fillModeNonSolid. docs/API.md's accepted differences records the
measured answers and that a points form waits for a guest's report that the points
answer matters; the rt README's fill modes and known gaps say the same. REFUSALS.md
regenerated, unchanged (it lists no DrawKind text).

Verified: tests::raster::on_device::every_device_draws_the_fill_mode_of_raw_value_2_as_fill
on lavapipe, red at the test's commit (the setter refused), green here.
2026-12-02 14:24:07 -08:00
Anees Iqbal 7a1da6cb22 rt: a draw through buffers bound at a multiple of 4 below their alignment draws the state's word-bound content
Row L97 (the draw residual). A dispatch of a function's kernel whose buffer
argument of 8 or 16 is bound at a multiple of 4 below that alignment runs a
variant of its kernel that holds the slot to 4 (8 where a 64-bit atomic may
reach it). A draw refused such a bind (Refusal::BufferOffsetAlignment). It
now draws the same way.

- RenderPipelineState::for_words(device, words) makes the state's content
  with LoweringInputs::word_bound_buffers set for its vertex function (bits
  0..31) and fragment function (bits 32..63). The device's map of contents
  keeps it under the state's key with that mask (KernelKey.words widens to
  u64). Like a pass's 2D-array content, it has no cache record of its own.
  Its samplers are numbered at the state's indices; a mismatch is
  Gap::KernelInput (ConstexprSampler).
- RenderCommandEncoder keeps the state set (`base`) apart from the state it
  draws through (`pipeline`). Where a draw's facts are not held (a bind or
  the state changed), bind_words reads the base's buffer address fields. A
  slot of mask 7 or 15 whose bound address is a multiple of 4 but not of
  its alignment sets its bit. The mask is ANDed with the slots the state
  lowers from AIR (word_slots: a function the consumer compiled has none,
  and its bind stays refused). A new mask switches `pipeline` to that
  content, or back to `base`. An execution of an indirect command buffer
  draws through `base`.
- The draw's own checks then hold each slot to the content's alignment: an
  address off a multiple of 4 is still refused, as is one off 8 that a
  64-bit atomic may reach.

Cost: a draw bound aligned keeps the state it was set with, and the scan of
its address fields runs only where the draw's facts are found again
(expected from the code, not measured). The first draw of a new mask lowers
both functions again and makes the content's VkPipeline (a first-use wait),
as the compute variant does. A later draw of that mask finds the content.

Docs: the runtime README (Render encoders: the draw bullet; Compute
encoders: the variant's paragraph); error.rs's BufferOffsetAlignment;
docs/API.md section 1 and its accepted differences. REFUSALS.md unchanged
(refusal_surface --check 0); api signatures --check 0.

Verified:
- Green on lavapipe, m3-max-79015 (at this commit's tree before its rebase
  onto 8dd00ec58c). Over tests::draw, render_offsets and indirect: 67 of 67
  passed, 838 skipped. The new test draws every case through the content,
  and the second draw of a bind finds it.
- The two draw-alignment tests on a card per vendor, 2 of 2 passed on each:
  - Radeon 780M (RADV PHOENIX, Mesa 26.2.6), m3-max-79076, at this commit;
  - RTX 3090 (NVIDIA 620.70.06), m3-max-79043, and Iris Xe (ANV, Mesa
    26.2.6), m3-max-79051, both before the rebase.
- m3-max-79086, at this commit: workspace clippy (all targets, all
  features, -D warnings) EXIT=0 in all three configurations (plain,
  --cfg m2v_cpu_icd, --cfg m2v_gpu); Rustdoc EXIT=0; the runtime's private
  Rustdoc EXIT=0. The runtime suite on lavapipe: 903 tests run, 903 passed,
  3 skipped.
2026-12-02 09:30:59 -08:00
Anees Iqbal 5d6ac696d0 Runtime and translator: a framebuffer fetch from the first slice of a 2D array that its pass renders alone
Row L223: a fragment function's fetch ([[color(n)]]) of a one-slice 2D array
attachment of a layered pass was refused (Gap::Draw FetchedAttachment), where
Metal reads the attachment at the fragment's pixel. The fetch reads the
texture's second element, which for a 2D array texture holds a 2D_ARRAY view.
Vulkan reads such a view only through an arrayed image (vkspec, image view
validation). The function read every element as a 2D image.

Form (ruled B, the per-state variant, as L97's compute variant):
- Translator: LoweringInputs::arrayed_fetches names the colours read through
  such an element. The fragment function declares that element's class arrayed
  and fetches it at (x, y, 0). The key takes the field only when it is set,
  so every existing function keeps its key and its bytes. No SEMANTICS bump.
- Runtime: set_render_pipeline_state binds, for a pass whose fetched attachment
  is a 2D array texture (a multisample one too), the state's content lowered
  with those colours (RenderPipelineState::for_pass, which also makes the
  content without colours past the pass's last attachment, as before). The
  content is kept in the device's bounded map of contents under the
  descriptor's key and its colour mask (KernelKey::arrays). The cache
  directory's render record is neither read nor kept for it. A failed variant
  leaves the state itself, whose fetching draws are then refused.
- attachment_reads accepts a 2D array texture whose first level and slice the
  pass renders, one layer, where the bound content fetches that colour
  arrayed.

Still refused (README, error.rs): an array whose pass renders more than one
layer, a slice past an array's first, and a view whose first slice is not the
rendered one.

REFUSALS.md and the api_signatures table are regenerated (the new
LoweringInputs field). API.md and the runtime README are updated.

Verified:
- Red, lavapipe, m3-max-78542: the test commit alone fails at fetch.rs:396
  (FetchedAttachment): 10 tests run, 9 passed, 1 failed.
- Green, lavapipe, m3-max-78570: 45 of 45 passed (832 skipped); the one-slice
  array is fetched exactly through the feedback loop.
- Radeon 780M (RADV), m3-max-78604; RTX 3090 (NVIDIA 620.70.06), m3-max-78609;
  Iris Xe (ANV, Mesa 26.2.6), m3-max-78649: the fetch and unattached-colour
  tests, 6 of 6 each, the array fetched exactly through the feedback loop.
- States-only play, m3-max-78602, lavapipe, this change against 118bd0dff7:
  identical on both replay streams (one recorded on the 3090: 10643 render and
  15299 compute states made; one on the 780M: 8972 and 225), 0 refused.
- m3-max-78600 (at the pre-rebase 90726b13b7): clippy, Rustdoc and private
  Rustdoc EXIT 0; runtime 874 of 874 passed (3 skipped), translator 3393 of
  3393 (37 skipped).
- Workspace clippy in all three configurations (plain, --cfg m2v_cpu_icd,
  --cfg m2v_gpu; all targets, all features, -D warnings): m3-max-78645 at
  this change alone on development, and m3-max-78677 at this tree on top of
  the row-1166 tests. Every EXIT=0.
2026-12-02 07:52:24 -08:00
Anees Iqbal 2f16658ac2 Translator, runtime: an OpenCL-mode kernel's 1D images read their 2D textures under the identity domains
L61. A kernel of OpenCL mode that takes a 1D image stated RuntimeFact::OpenClLineTexture for each
such slot. That fact marks the variant in which the table domains read a 1D texture bound there,
as a Radeon Pro 5300M answers. The identity domains source no such fact, so every such kernel's
pipeline was Unsupported{IdentityDomains} when made, whatever else it did.

Apple's OpenCL binds a 2D texture of height 1 for an image1d_t and a 2D array of that height for an
image1d_array_t, and never a 1D texture. The kernel already reads its 1D images as those 2D textures
at row 0 (canon::opencl_1d), as the M3 Max and the 5300M answer. A 1D texture bound there is
outside documented Metal, and the Macs disagree on it: the M3 Max reads texel 0 at every
coordinate, the 5300M the 1D texture's texels, a UHD Graphics 630 layer 0 of an array.

- Translator: under the identity domains a kernel states no OpenClLineTexture and has no such
  variant; it reads the 2D textures. The table domains keep the fact and the variant.
  identity_unsourced no longer names a fact the identity domains never state.
- Runtime: a state records whether its kernel is of OpenCL mode (RuntimeFact::OpenClMode). A
  dispatch of one with a 1D or 1D array texture bound at any of its texture slots is the new
  typed Gap::OpenClLineTexture { slot }, not a read: Apple's OpenCL binds none, and Metal defines
  no reading of one. It is checked where the swizzle and bicubic checks run, when the state or a
  binding changes. Its doc ends in "Basis: ours".
- Docs: the runtime README's known gap is rewritten for the dispatch's refusal. API.md and the
  fact's doc say what the identity domains do. docs/REFUSALS.md and error/basis.rs are regenerated
  (Gap 30 to 31), and api_signatures.tsv is blessed (one variant).
- The runtime test opencl_lines now also binds a 1D texture at each of the kernel's three slots in
  turn. Each dispatch answers Gap::OpenClLineTexture naming that slot and writes nothing.

A refusal becomes a module, so SEMANTICS_VERSION 2316. The translator's refusal sites are
unchanged.
2026-12-02 07:25:18 -08:00
Anees Iqbal 5806b10c13 Translator: a sampled cube read by face samples its cube element under the identity domains
L215 (a). A texturecube or texturecube_array read by face was declared as the binder's 2D-array
view of its faces (RuntimeFact::ImageViewShape), since SPIR-V's OpImageFetch takes no cube. The
identity domains hold a sampled cube's element as its cube view and source no such fact, so
every such read was Unsupported{IdentityDomains}.

Under the identity domains a sampled cube (not a depth cube) that is read is now declared as its
cube element, and the read samples it. It goes through element 0 of its numeric type's sampler
array (binding 2, or 4 for an integer texture), which no ID reaches: the default sampler. It
samples at the direction of the read texel's centre on its face, with the read's level as the
explicit Lod.
- On face f the centre is (sc, tc) = ((2x + 1 - w) / w, (2y + 1 - h) / h), whose numerator is an
  exact integer.
- The direction is Vulkan's cube map face selection read backwards, the table Metal's faces share.
  With m the face's sign, it is (m, -tc, -m*sc), (sc, m, m*tc) or (m*sc, -tc, m).
- Its major axis is the face's, at magnitude 1, so (s, t) on that face is the texel's centre, half
  a texel inside its cell, and nearest reads that texel. Integer Lod l under nearest mip selects
  level l.
- A sample clamps every operand, so the read is checked in the shader on every device
  (ReadCheck::Shader). x and y are tested against the extent at the level, the face against 6, the
  cube index against the cube count, and the level against the level count, with Metal's
  out-of-bounds texel outside (its alpha from the ID's word).
- slot::samples_cube_element is the one rule the declaration and the read's check share.
  SlotPlan::face_sampler gives the sampler use the sampler family declares.
- A depth cube read by face, and a cube whose faces an emulated filter fetches, keep the 2D-array
  view and stay refused under the identity domains. The table domains are unchanged.

The runtime's default samplers now reach every level (maxLod VK_LOD_CLAMP_NONE, was 0), so an
explicit level past 0 reads that level. A sampler element nobody owns holds the default, as do
nil, freed and out-of-range sampler IDs. Their samples could reach only level 0 before; they now
reach the level they ask for.
Existing tests that cover the default samplers:
- tests::arrays' set_1_is_filled_at_creation (both live with set 1);
- tests::device's gauge check (set 1's two default samplers and nothing else);
- tests::argument_sampling's argument_sampler_edges (an argument buffer's sampler against the
  default's answer).
RESOURCE-ID.md states the default sampler and the cube read's contract for a consumer that lays
the arrays out itself. API.md and the runtime README say so too; the README's known gap now names
only the depth cube read.

A refusal becomes a module, so SEMANTICS_VERSION 2315. The golden table's cube_faces cells
change from the refusal, a bless at the next pin. No refusal site was added or removed:
docs/REFUSALS.md regenerates unchanged.
2026-12-02 07:25:18 -08:00
Anees Iqbal 0bb092f8ff API docs: a kernel's write through a channel-permuting swizzled view is stored as written
Section 10's Kernels gains the accepted difference: the runtime stores a kernel's write
through a texture view whose swizzle permutes its format's channels as written, where the
M3 Max stores it through the swizzle (an RGBA8Unorm (Blue, Green, Red, Alpha) view's write
of (0x33, 0x66, 0xb3, 0xcc) leaves (0xb3, 0x66, 0x33, 0xcc); swizzled_view_stores.m, job
m3-max-76829) and Metal's validation refuses the write, the view reporting no ShaderWrite
usage. The OpenCL images paragraph said a write stores the value with the swizzle undone,
which is the M3's answer, not the runtime's; it now states the runtime's rule and points
to the entry.

Docs only; the rule is the runtime's README's ("A swizzle reaches a texture's sampled
element alone") and the lane's write test asserts it.
2026-11-27 05:11:10 -08:00
Anees Iqbal 1a4310899a Runtime tests: OpenGL mode's depth output without a depth attachment, and the void vertex refusal
The old runtime's OpenGL-mode device tests went with it on 11-20 and were never ported, so the
private render state the guest's GL renderer sets on every pipeline lost its guard. This ports
them onto the new runtime's device-test helpers, with the M3 Max's answers as they stood (probe
conformance/probes/opengl_mode.m, macOS 27.0.1):

- opengl_mode_makes_a_depth_output_without_a_depth_attachment: with the mode, a fragment function
  writing depth without a depth attachment makes a state whose colors are those it draws with a
  depth attachment. The old test's other half, the refusal without the mode, is not ported: only
  the M3 Max's driver refuses it and no Metal document states it (MTLRenderPipeline.h, Apple's
  pages for depthAttachmentPixelFormat and makeRenderPipelineState(descriptor:), the MSL spec's
  depth output), so on the planner's ruling the runtime makes the state, recorded in
  docs/API.md's accepted differences.
- without_opengl_mode_a_rasterizing_void_vertex_function_is_refused: the refusal half of the old
  void-vertex test, as the translator's typed DescriptorError::RasterizedVoidVertex; Metal's text
  stays in the module doc, as the runtime's errors carry none.

The module doc names the nine deleted tests not ported and why: point_size_notices' per-draw
notice is gone (the note is the state's), and private_properties' eight tests test Apple's private
device properties, which the consumer answers and the runtime holds none of.

Verified: to run on lavapipe at the branch tip (a CPU job), reported to main with its job.
2026-11-27 03:42:08 -08:00
Anees Iqbal cb77b3f60d Translator: an OpenCL-mode barrier's flags are OpenCL's cl_mem_fence_flags
OpenCL C's barrier(flags) takes cl_mem_fence_flags, which Apple's
cl_kernel.h (OpenCL.framework, "5.9.7 - Synchronization") defines as
CLK_LOCAL_MEM_FENCE = 1U << 0 and CLK_GLOBAL_MEM_FENCE = 1U << 1, and
Apple's OpenCL compiler passes them to air.wg.barrier unconverted (an
internal function passing its parameter on as the barrier's flags).
Metal's mem_flags read the same bits as mem_device (1) and
mem_threadgroup (2), and decode reads every barrier as Metal's, so in a
kernel linked for OpenCL mode barrier(CLK_LOCAL_MEM_FENCE) lowered to
OpControlBarrier(Workgroup, Workgroup, AcquireRelease | UniformMemory):
nothing ordered the __local tiles, and RADV reordered them (a tiled
multiply's outputs wrong on the RX 550, the RX 7900 XTX and the 780M).
CLK_GLOBAL_MEM_FENCE likewise ordered threadgroup memory and left device
memory unfenced.

Specialization now reads each air.wg.barrier's flags again as OpenCL's
in a kernel of OpenCL mode (canon::opencl::barriers, from the
SpecRequest::open_cl_mode fact), after the last SCCP, so an out-of-line
barrier has its own call site's flags: CLK_LOCAL_MEM_FENCE is
mem_threadgroup and CLK_GLOBAL_MEM_FENCE mem_device
(MemFlags::from_cl_mem_fence_flags). It rewrites the call's decoded
operation in the entry's body, which lowering, the lockstep analysis,
the partial-threadgroups variant and the strategy census all read. A
flag outside the two leaves the call an unknown intrinsic, which the
post-check refuses (Unsupported, UnknownIntrinsic, naming
air.wg.barrier), as one outside Metal's mem_flags is. Nothing keys on a
function name. Metal-mode kernels, air.simdgroup.barrier (the header
declares no work_group_barrier or sub_group_barrier) and
air.atomic.fence (mem_fence's flags, which Apple's compiler converts
itself through llvm.bitreverse.i2) keep Metal's reading.

SEMANTICS_VERSION 2308. canon::opencl's module doc, docs/API.md (OpenCL
mode) and docs/ARCHITECTURE.md say what the flags mean and on what that
rests. docs/REFUSALS.md regenerates unchanged: the refusal is the
existing UnknownIntrinsic site.

Tests (tests::engine_opencl_mode):
- an_opencl_mode_barrier_orders_the_memory_its_opencl_flags_name: a
  kernel of barriers 1, 2 and 3 by four routes (air.wg.barrier with the
  constant, the wrapper of two operands, of three, and a parameter each
  of three call sites binds), compiled as a pipeline on every committed
  profile under the runtime's policy: in OpenCL mode WorkgroupMemory
  alone, UniformMemory alone, both; without the mode UniformMemory,
  WorkgroupMemory, both.
- an_opencl_mode_barrier_of_a_flag_opencl_does_not_name_is_refused:
  flags 4, inline and through the wrapper, refused in OpenCL mode and
  ImageMemory without it.
A job at this tip runs them, and once more with this commit's sources
in canon and intrinsics reverted to its parent, where the first fails.
2026-11-27 03:14:48 -08:00
Anees Iqbal b443508375 Runtime, translator docs and validation: the bound form's contract, its README floor entry, and the suites' pins
docs/API.md: section 1's bound kernel buffers (the query's features and every limit set 0's
layout reaches, the four kinds of slot that keep their address by structure), section 5's
SlotBindOffset view, and the accepted difference of a bound buffer's out-of-bounds reach: up to
15 bytes before a buffer off 16 and up to 3 past a length off 4 where
robustStorageBufferAccessSizeAlignment is 4 (none on NVIDIA), reads and writes landing in the
same process's memory, its own or shared with it by name, and past a buffer the consumer placed
by heap_buffer_size_and_align the block's padding (zero or the same device's earlier bytes,
never another device's). The runtime README: the extension row, the Bound kernel buffers floor
entry with its feature table (pool_reach's runs: Iris Xe, 780M, XTX and RTX 3090 bound, jobs
m3-max-75037..75040; the 780M under AMDVLK, which lists no VK_EXT_pipeline_robustness at the
runtime's Vulkan 1.3, in the address form, m3-max-75041/75042), the counters, and the check's
known gap. The placement comments at encoder::view and HEAP_BUFFER_ALIGNMENT.

Suite pins (m3-max-75036): the stage helper's version 3 for its robust compute chain; the
validation runtime-sources pin (RUNTIME_VERSION is already bumped in this change); the profile
subset rules for robust_buffer_access2, robust_buffer_access_update_after_bind (implications)
and robust_storage_buffer_access_size_alignment (a minimum); the enable test's device with room
for set 0's 31 storage buffers; the README floor test's pipeline-robustness feature table.
2026-11-26 05:04:54 -08:00
Anees Iqbal b42ef61b9b Runtime: a buffer bound at a multiple of 4 below its argument's alignment runs the state's variant that holds it to 4
What: a dispatch's alignment check (check_alignments) no longer refuses a buffer whose argument's
alignment is 8 or 16 (mask past 3) bound at a multiple of 4 below it: it answers the mask of those
slots, bit i slot i. A non-empty mask picks the state's variant (PipelineInner::variant, srgbwrite's
sRGB variant generalised to both masks): Compiled::of lowers the state's function with those slots
in LoweringInputs::word_bound_buffers, kept in the device's bounded map of contents under
KernelKey's new words mask (1,024 entries), held by the command buffer that dispatched it. The
dispatch then checks the variant's own alignments strictly, so a buffer a 64-bit atomic may reach,
which the variant holds to 8, is refused off a multiple of 8. A kernel the consumer compiled has no
variant: its own module's strict check refuses the bind as before. One bit per slot: a second class
(8 at a multiple of 8) would need a second mask in the key and the input.

Still refused: an address off a multiple of 4 (off 2 for an alignment of 2), a 64-bit atomic's
buffer off a multiple of 8, every draw's (render_encoder keeps the strict check_alignment: the
draw side would need the render path's variant key), and a consumer-compiled kernel's.
Refusal::BufferOffsetAlignment's doc says so; its message and `alignment` now name the alignment
the function holds the address to, as the variant's 8 for a 16-aligned argument is not the
argument's. The buffer-bind-off-alignment ledger row carries the new message;
docs/CONFORMANCE-COVERAGE.md regenerated (unchanged); REFUSALS.md regenerated (unchanged: its row
takes the doc's first words).

Why: a guest's system texture-decode kernel (library db82b13f114fbeef #0) binds buffer 0 at offset
1871700 (4 mod 16) under a 16-byte argument alignment and met the refusal 60 and 72 times in two
sessions; plain Metal runs it with each element at its own address. Only such a dispatch runs the
variant: an empty mask keeps the state's key, hash and module.

Tests (not yet run): translate.rs every_device_places_each_vector_access_at_its_own_address runs
vwp_vec16 at VEC16_AT_WORDS too, holds Metal's words, and asserts a variant lowered exactly at the
runs off a multiple of 16; every_device_keeps_a_word_bound_variant_in_the_bounded_map_of_contents
(cap 2: one variant a mask, kept, the map at its cap, a forgotten one lowered again);
an_argument_bound_off_its_alignment_is_refused binds vwp_vec16 2 and 3 bytes off (alignment 16).
compute.rs's for_test kernel still refuses all 17 binds (no variant to lower).

Docs: the runtime README's compute-encoder rule and a known gap of pipeline states (the relaxed
form, with the unconditional build's 3090 constant_* rows), docs/API.md sections 1 and 10.
2026-11-25 19:17:03 -08:00
Anees Iqbal aa2b0fc670 Translator: delete the one-row and unit-axes kernel variants, and the unit-axes relief
VariantKey::one_row and VariantKey::unit_axes had no product setter: every
product path builds VariantKey::new() (the runtime's render_variant_key call,
compile_render_pipeline, compile_mesh_pipeline, render_pipeline_key, the stage
entries), and the runtime's kernel route builds its LoweringInputs through
kernel_inputs_read and kernel_variant, which set neither. Their forms ran only
under tests.

Deleted with them:
- LoweringInputs::one_row and ::unit_axes, their key tags ("one-row",
  "unit-axes", appended only when set, so no product key moves);
- RuntimeFact::OneRow (emitted only under the variant) and the one-row
  branches of the lockstep order (OrderKey::one_row, the cleared-rows
  retain); a device's profile now fixes the whole OrderKey, so a stage entry
  keeps one ordered entry (KEPT_ORDERS 2 -> 1);
- RuntimeFact::UnitAxes and its computation (divergent::unit_relief, the
  relief at workgroup.rs and divergent.rs, up to seven uniformity analyses a
  predicated kernel), and the unit-axes support of the uniformity analysis
  (Uniformity::with_unit_axes, the `unit` parameter). Readers checked: the
  runtime ignored it (pipeline.rs, `UnitAxes { axes: 0, .. } => {}`, gone);
  validation, the harness and the conformance suite name it nowhere; the
  CLI's --emit-meta writes every dependency generically, so the fact leaves
  that JSON and nothing there reads it; docs/API.md's paragraph is rewritten.
- Tests of the variants: the one-row halves of
  engine_simd_emulated (now a_row_tile_keeps_its_lockstep_barriers_and_records_row_lockstep),
  engine_simd_lockstep (now ..._clears_a_tree_reduction_in_rows, which asserts
  RowLockstep on the plain pipeline and its absence for the mixed guard), the
  harness's cells test, and the runtime test's relief check (now
  every_device_runs_a_kernel_whose_walk_diverges_by_row, which still runs the
  predicated walk and checks Metal's sums).

ARTIFACT_FORMAT_VERSION 597 -> 598: the codec loses RuntimeFact::OneRow and
::UnitAxes (and, in the next commits, VertexInputState::variant_pulled).
SEMANTICS_VERSION unchanged: no product output changes under a kept key.

Consumer search: consumer-uses.sh at the consumer's 19b32575f (development
and 9 steelbrain/* refs younger than a day): 0 code hits for one_row,
unit_axes, OneRow, UnitAxes, VariantKey, LoweringInputs, RuntimeFact.
In-tree grep after the change: no one_row, unit_axes, OneRow or UnitAxes
outside unrelated locals (dispatch.rs's DeepThreadgroup `one_row` spec value,
conformance locals).

Checked by the lane tip's jobs (quick check, suites, golden diff, states-only
play), named in the lane report.
2026-11-25 17:16:50 -08:00
Anees Iqbal a1b955eec9 indirect_commands: the plumbing only the deleted runtime drove goes
`bind::indirect_commands` kept entry points that the removed in-crate runtime used to execute
indirect command buffers. Nothing calls them now: not the runtime crate, not the command line,
not validation, conformance, harness, devtools or the translator, and not the consumer. Deleted,
each with its own tests, its re-export, its api_surface row, its api_signatures rows and its
docs/API.md sentence:
- `RecordField` (referenced by nothing at all);
- `records_address`, `RECORDS_ADDRESS_BASE`, `RECORDS_ID_LIMIT`, and the crate-private
  `RECORDS_ADDRESS_SHIFT` that only `records_address` read;
- `written_flag_offset`, `WRITTEN_FLAG_BYTES`;
- `BufferBinding::resolve_buffer`, `RegisteredBuffer` (+ `new`), `ResolvedBuffer`, `AddressError`;
- `CommandRecord::resolve_bindings`, `ResolvedBindings`, `BindingError` (tests/inheritance.rs
  tested only these and goes whole);
- `RenderDraws::PRIMITIVES` (its one user, a test, now spells the struct out);
- `RecordView::action`, `barrier`, `kernel_pipeline`, `buffer`, `writes`.
The fixed point inside the module adds `RecordError::Index`, which nothing constructs (its
Display arm alone named it; it was the error of `RecordField`'s indexed fields), and an empty
`impl CommandRecord {}`.

Kept, because a live path calls them inside the module (validation's `CommandBuffer::decode` and
`CommandDescriptor::validate_record`): `BufferStage::of` (descriptor.rs `validate_record`,
host.rs `decode`), `CommandDescriptor::holds` (`validate_record`), `validate_header` (`decode`),
and `RecordView` with the accessors `CommandRecord::decode` reads through `record_into`
(`pipeline`, `retained_pipeline`, `threadgroup_memory_length`, `stage_in_region`,
`imageblock_size`, `record`, `record_into`).

`Bindings::buffers` becomes private: only descriptor.rs and host.rs call it, and validation reads
a record's buffers through `buffers_mut` only. The build at the stack's tip answers whether
anything else used it (an error would mean a user). `BufferBinding`'s doc no longer links it.

Docs that named the deleted items or the deleted runtime say what is true now: the
`bind::indirect_commands` module docs (validation's case model and Metal executor use it),
host.rs's module docs, `BufferBinding::address`, `RecordError`, provenance.rs's
`object_handle_load`, and docs/API.md's indirect-command-buffer section.

Zeros, outside crates/metal2vulkan/src/indirect_commands* and the facade, at metal2vulkan
733b14ed24 and the consumer reims-vgpu d0a7c9614 (whose Cargo.toml pins metal2vulkan 0c9db49765):
- `git grep -nw <name> 733b14ed24 -- 'crates/*.rs' 'docs/*.md'` (the facade and
  tests/api_surface.rs excluded, comment-only lines dropped): 0 for RecordField,
  RECORDS_ADDRESS_BASE, RECORDS_ID_LIMIT, WRITTEN_FLAG_BYTES, resolve_buffer, RegisteredBuffer,
  ResolvedBuffer, AddressError, resolve_bindings, ResolvedBindings, BindingError.
  `records_address`: only other items of the name (metal2vulkan-air intrinsics/objects.rs:449, a
  predicate; provenance.rs:3251-3267, a local and that predicate) and provenance.rs:1831's
  comment, rewritten here. `written_flag_offset`: only docs/API.md:1352, rewritten here.
- `git grep -nF <path> 733b14ed24 -- 'crates/*.rs'` (same exclusions): 0 for
  `RenderDraws::PRIMITIVES`, `RecordView`, `RecordError::Index`.
- Consumer: `git grep -nw <name> d0a7c9614 -- '*.rs'` is 0 for every name above;
  `git grep -nE 'indirect_commands::' d0a7c9614 -- '*.rs'` is 0; `git grep -nE 'metal2vulkan::bind'
  d0a7c9614 -- '*.rs'` names only rt_platform/argument.rs and rt_platform/function_table.rs.

Tables: `scripts/api-signatures/signatures.py --bless` removed 47 rows and added none;
`scripts/refusal-surface/refusal_surface.py` leaves docs/REFUSALS.md unchanged. Build, clippy
and suites run at the stack's tip.
2026-11-25 12:22:04 -08:00
Anees Iqbal 5a722b5c3f Stencil output: a device without VK_EXT_shader_stencil_export draws it by bits, the owner's tenth form
A fragment function's [[stencil]] output is the reference of both faces' stencil test for its
fragment (MSL Table 5.7, 5.2.3.5). On a device without VK_EXT_shader_stencil_export it was refused
at creation (StencilExport). Under the owner's grant (rule 2's tenth form, chosen by that
extension's query alone), such a device now draws it by bits; a device with the extension is
unchanged (FragStencilRefEXT, no fact, no note, the draw issued once).

Translator: the function stores no reference; each return kills the fragment where the draw's new
push field PushField::StencilBit k is below 8 and bit k of the output's low 8 is 0, and keeps
every fragment at 8 or more (one module, no specialization). The function states
RuntimeFact::StencilBitDraws (Mechanism::PushConstant) and its fragment stage the static note
PrecisionNote::StencilOutputOverlap. Refused there, naming the extension (Unsupported
StencilExport): a function that also writes a colour (the colour would be written by every
repeat) or memory, one whose returns cannot kill (an interlocked body, a loop over its covered
samples), a mesh pipeline, and a render pipeline made for indirect command buffers. Where the
device also lacks the pixel interlock, a function writing memory in a raster order group meets
that refusal first (RasterOrderGroups). SEMANTICS_VERSION 2301 -> 2302, ARTIFACT_FORMAT_VERSION
595 -> 596 (new codec members).

Runtime (depth_stencil::BitDraws, render_encoder::draw): with w the low 8 bits of the write masks
of the faces having a Replace operation, a draw whose stencil test is on and w is not 0 is drawn
once with every fragment kept under the reference 0 (Replace zeroes w's bits, every other
operation runs once), then once per bit k of w keeping the fragments whose output holds bit k,
under the reference 255, write mask (1 << k) & mask, Replace kept and every other operation Keep,
and no depth write; where the state writes depth under a compare other than Always and Never, the
first draw writes none and a last draw writes it with stencil write masks of 0. Each draw records
only the dynamic state that differs from the last; the encoder's tests and reference are recorded
again at the next draw. Counted in Metrics::stencil_bit_draws (the draws beyond the first).
Refused at a draw, Gap::Draw of DrawKind::StencilOutput: a face compare other than Always or Never
(the output decides that test), and, where w is not 0, a draw inside a Counting visibility
segment (every draw would add its samples). A Boolean segment is drawn. Vulkan Appendix I: the
repeats change stencil reference, operations and write masks between draws of one pipeline,
which Rule 2 lists as required (write masks) and strongly suggested (stencil parameters) to be
invariant; the note records the one difference the repeats make.

The note (rule 1): fragments of one draw that overlap leave the OR of their values. Where two
fragments of one draw reach one sample under Replace, the sample stores the OR of their outputs'
low 8 bits within the write mask, where Metal stores the later fragment's value; under a depth
test that writes, each fragment's stencil operation is chosen against the depth from before the
draw. Measured on an RTX 3090 (NVIDIA 620.70.06) under the validation layer 1.4.363.0, job
m3-max-73635: two triangles of one draw outputting 0x35 then 0x4a store 0x7f on the 32 texels both
reach, where Metal stores 0x4a, and 0x35 on the 32 one reaches, in 8 bit draws; the 780M (RADV)
and the Iris Xe (ANV), which list the extension, store 0x4a with 0 bit draws.

AGENTS.md rule 2: "for nine only" becomes "for ten only", the list ending with fragment stencil
output (the planner's text, relayed by main, word for word).

Tests: the translator's engine_stencil (every committed profile: the extension or the draws by
bits, L3 both ways; refusals for colour, memory, mesh and indirect command buffers); rt's host test
of BitDraws::of; rt's device cells (stencil_export.rs): the stencil alone and the stencil with the
depth under Always and Less over a quad, exact, texels of stencil 0 among them; the overlap row;
the refusals; the route of a 4-sample Depth32Float_Stencil8 source read at sample 0 into a
single-sample target under Always/Replace 0xff and depth Always with write, beside colour 0
RGBA8 of write mask none; the codec round trip; the mechanism table.

Docs: docs/API.md (the stencil output passage and the catalogue entry
metal2vulkan-degrade-stencil-output-overlap), rt README known gap and floor row,
docs/REFUSALS.md regenerated, api_signatures blessed. The conformance degradation and the
validation allowance (unbounded) of the note. known-gaps-rt.tsv: stencil-output and
stencil-output-loaded on NVIDIA, refused at renderCommandEncoder (draw 3's back face Equal against
the output) and divergent at case/stencil as a result. runtime-sources.sha256: the guard's inputs
changed only by mechanism.rs gaining the new fact's arm, which no existing artifact states, so no
run of an existing artifact changes.

Golden rows and the engine inventory (22 cells) are re-blessed on development: 20 move from the
StencilExport refusal to a module (stx_stencil_by_pixel, stx_stencil_discard,
stx_stencil_with_depth, stx_stencil_ms_by_sample, fragment_depth_stencil on nvidia-pascal-linux,
nvidia-rtx50-linux, nvidia-rtx5080-laptop and runtime-floor), and the 2 cells
stx_stencil_in_order and stx_stencil_ms_in_order on runtime-floor move from StencilExport to
RasterOrderGroups, still refused. Why: the memory-write refusal now runs on the emitted module
(pipeline/compile.rs), after the body's own refusals, so on a profile without the pixel interlock
the raster order group these functions write memory in is refused first; at the base the plan's
entry refused every [[stencil]] output on such a device before any body was lowered.

Verified (this tree, or the rt archive of d6bd77d203 where named; the rt and translator sources
there differ from this tree in the translator's test and a doc comment alone):
- msi check, job m3-max-73648 (this tree): fmt, signatures, refusals, clippy -D warnings with all
  features plain, --cfg m2v_gpu and --cfg m2v_cpu_icd, Rustdoc, the rt nextest archive and the
  conformance binary built; rt's whole suite on lavapipe under the validation layer 1.4.363.0,
  738 tests run: 738 passed, 3 skipped; the lavapipe leg, 7 tests run: 7 passed: export enabled,
  the overlap row storing {4a}, bit draws 0 on every cell.
- RTX 3090 (NVIDIA 620.70.06, layer 1.4.363.0), job m3-max-73635 (d6bd77d203): 7 passed; the
  overlap row above, bit draws 8; the stencil alone and with depth under Always and Less, 64
  texels exact, bit draws [8, 8, 9]; the route exact, bit draws 8; refused a colour beside the
  stencil (StencilExport), Equal and a Counting segment (DrawKind::StencilOutput), a Boolean
  segment drawn. Conformance stencil-output and stencil-output-loaded: refused at
  renderCommandEncoder and divergent at case/stencil (4 elements, largest difference 80), the
  four known-gaps rows.
- RTX 5080 Laptop GPU (NVIDIA 615.71.09, layer 1.4.363.0), job m3-max-73652 (this tree): 7
  passed; overlap {7f} where both reach, {35} where one, bit draws 8; cells exact, bit draws
  [8, 8, 9]; the route exact, bit draws 8; the same refusals; conformance replay with this tree's
  binary matched the four NVIDIA rows (exit 0).
- Radeon 780M (RADV, Mesa 26.2.6), job m3-max-73636 (d6bd77d203), and Iris Xe (ANV, Mesa
  26.2.6), job m3-max-73650 (this tree): 7 passed each, export enabled, overlap {4a}, bit draws 0.
- States-only plays of recorded streams, base 0c9db49765 against d6bd77d203, every play in
  states-only mode, made and refused equal, refused 0: lavapipe, jobs m3-max-73632 and
  m3-max-73631 (two streams: render 10643 and 9014, compute 15299 and 221); the RTX 3090 with
  --device-type gpu, job m3-max-73638 (two streams: render 9834 and 10643, compute 214 and
  15299); the RTX 5080, job m3-max-73652 (two streams: render 9014 and 9645, compute 221 and
  250). Those two carry a library holding a [[stencil]] function that no recorded pipeline state
  uses; no stream on either NVIDIA node makes a [[stencil]] pipeline (job m3-max-73646 and
  m3-max-73652's scan).
- Owed: the translator and validation suites of this tree (the suites of d6bd77d203, job
  m3-max-73627, failed in the memory refusal's test on runtime-floor, the runtime guard's hash
  and the golden and inventory cells above; this tree fixes the first two).
2026-11-25 10:38:03 -08:00
Anees Iqbal 737906832c Runtime: a compute pipeline's module reaches the driver with every specialization constant fixed, its workgroup size the entry point's LocalSize literals
Every compute VkPipeline rt makes is now created from a shader module of its own, made of the
kernel's words with each specialization constant the plain constant of its value and destroyed
once the create returns; the create names no VkSpecializationInfo. Vulkan defines specialization
as exactly this conversion (VUID-VkPipelineShaderStageCreateInfo-pSpecializationInfo-06849), so
what a kernel computes is unchanged; what changes is that no driver is handed a specialization
constant to size a workgroup or an array from.

- Translator: pipeline::specialize(words, values) (spirv::specialize). OpSpecConstant,
  OpSpecConstantTrue/False become OpConstant/OpConstantTrue/False of the given value or the
  default; each OpSpecConstantOp becomes the constant it computes (SpecOp::eval, now product code,
  and SpecOp::opcode, which the serializer shares); OpSpecConstantComposite becomes
  OpConstantComposite; the SpecId decorations go; a WorkgroupSize composite loses its BuiltIn
  decoration and the entry point takes its values as OpExecutionMode LocalSize. The translator's
  output is unchanged (no SEMANTICS_VERSION bump).
- rt: Kernel holds its words (Code::Module(Arc<[u32]>)) instead of a VkShaderModule made at
  Kernel::new; Kernel::make specializes per variant and makes, uses and destroys the module.
  Heavy kernels specialize the same way: the stage request carries the specialized words and no
  ids or data (WIRE_VERSION 3), and the helper compiles them as they are (HELPER_VERSION 2).
  Lowered::Failed and Unmade go: nothing creates a shader module at Kernel::new now.
- Tests: serializer tests specialize (a deep kernel's spec constants, its bool, two Workgroup
  arrays sized by OpSpecConstantOps: values given and defaults, spirv-val under Vulkan 1.2 and
  1.3); rt deep_threadgroups a_kernel_reaches_the_driver_with_its_workgroup_size_as_literals.
- Docs: API.md (section 3), rt README.
2026-11-23 20:59:01 -08:00
Anees Iqbal a38145f53c Translator: a flat grid's tangled instructions take the profile's reconvergence mode, as the partial-threadgroups variant's do
A flat-grid module (LoweringInputs::flat_grid) returns its invocations past the grid before the
body (lower::dispatch::emit_entry), and under call_threadgroups it admits SIMD-group operations
(select.rs's flat call-threadgroups check). lower::simd::together excluded only
partial_threadgroups, so such a module's SIMD-group operation in a block the workgroup uniformity
proves uniform was stated Guaranteed with no mode, which SPIR-V does not support.

The words, SPIR-V 1.6 Revision 8:
- A threadgroup barrier is OpControlBarrier at Workgroup scope (3.3.20): "When Execution is
  Workgroup or larger, behavior is undefined unless all invocations within Execution execute the
  same dynamic instance of this instruction." A module whose past-grid invocations return early
  cannot hold one at all. The partial variant walks them predicated instead, and a flat
  call-threadgroups module refuses one. So this kind is unaffected.
- A SIMD-group operation or simdgroup barrier (OpGroupNonUniform*, 3.3.24; OpControlBarrier at
  Subgroup scope) acts on "the scope restricted tangle". Who is tangled is 2.2.5's rule:
  "Invocations will continue to execute the same dynamic instances as long as they follow the same
  control-flow path"; after a divergent branch, "Invocations may only resume executing the same
  dynamic instances when all invocations reach the same static instruction", and the merge rule
  ("Uniform Control Flow") needs control flow "uniform upon entry", which no longer holds once some
  invocations returned. Only SPV_KHR_maximal_reconvergence lets an invocation that ran OpReturn
  escape reconvergence.

A predicate on the AIR ("no divergent construct passed since entry") is not enough to keep a
narrower set. The lowering adds selections of its own, whose condition differs between
invocations, before a tangled instruction: the bounds-checked load (lower/access/psb.rs:660), the
guarded store (lower/access/emit.rs:411), an atomic's (lower/access/atomic.rs:1064) and a copy's
(lower/access/copy.rs:1343). So a module that returns past-grid invocations early has no tangled
instruction reached together. The partial-threadgroups variant's exclusion is unchanged.

No runtime or consumer path makes a flat-grid module today. `grep -rn 'flat_grid\|call_threadgroups'
crates/metal2vulkan-runtime/src`, tests excluded, gives 0 hits at 62e7af06e5. In the consumer's
checkout at 360eef13f, `git grep 'flat_grid\|call_threadgroups\|folded_groups' -- . ':!*.md'` gives
0 hits. So no guest module changes.

- simd::together: `partial_threadgroups || flat_grid` (returns_early). Its doc states the reason.
- The flat_grid and DeviceReconvergence doc comments, and docs/API.md's catalogue entry, state the
  same.
- New test a_flat_grid_s_shuffle_after_a_merge_takes_the_profile_s_mode, in
  engine_variant_reconvergence.rs. Our kernel holds a shuffle after the merge of a selection on
  the thread's parity. Its plain module is "none"/Guaranteed/no note on every committed profile.
  Its flat call-threadgroups module takes the profile's mode wherever it compiles: maximal and
  Guaranteed, else SubgroupUniformControlFlowKHR or none with ImplementationDefined and the note.
  At the parent the flat module states no mode on every profile, so the test fails there.
- SEMANTICS_VERSION 2300 -> 2301: a flat-grid module with a tangled instruction in a uniform block
  now states the mode or the note.
2026-11-23 20:57:08 -08:00
Anees Iqbal b4aeaab757 Tests: a partial-threadgroups variant may add DeviceReconvergence on a device without maximal reconvergence
The rt test every_device_s_observers_answer_the_same_on_their_variant failed on the UHD 630's
Windows leg (job 72531) after 1b9ea536f6: for the engine's a27_a4_simdgroup_barrier the variant
records DeviceReconvergence and the plain module none. The translator is right and the test was
wrong. The variant's invocations past the grid return before the body, and SPIR-V states
reconvergence over all invocations, those that returned included (SPIR-V 1.6 section 2.2.5,
"Dynamic Instance": "Invocations may only resume executing the same dynamic instances when all
invocations reach the same static instruction"; "Uniform Control Flow" and the merge-block rule
speak of all invocations too). SubgroupUniformControlFlowKHR extends the same rule to each
subgroup and adds nothing for a subgroup that holds a returned invocation. Only
SPV_KHR_maximal_reconvergence lets an invocation that ran OpReturn escape reconvergence. So
lower::simd::together's exclusion of partial threadgroups stays, and the variant takes the
profile's mode, or ImplementationDefined with the note where the profile has no maximal
reconvergence.

- The rt test now allows exactly that exception: on a device without maximal reconvergence the
  variant may add DeviceReconvergence where the plain module has none. Every other answer, and
  the notes on a device with maximal reconvergence, must still be equal. It prints how many
  kernels took the exception.
- A new translator test, a_simdgroup_barrier_s_variant_is_guaranteed_only_under_maximal_reconvergence,
  guards the rule on every committed profile. The plain module is Guaranteed with no note. The
  variant is the same where the profile has maximal reconvergence, and ImplementationDefined with
  the note where it does not (nvidia-pascal-linux, runtime-floor).
- docs/API.md (section 6 and the note's catalogue entry), the DeviceReconvergence and
  partial_threadgroups doc comments, and together()'s doc state the exception and its reason.

No module changes, so SEMANTICS_VERSION is not bumped.

Verified: the reproduction (job m3-max-72749) failed the old equality on nvidia-pascal-linux at
1b9ea536f6's tree, with variant (ImplementationDefined, true) against plain (Guaranteed, false),
and passed at its parent 0a1c4d4a64. The check job named in the hand-in covers fmt, clippy
(plain and under --cfg m2v_cpu_icd), Rustdoc, the metal2vulkan lib tests and rt's lavapipe suite.
2026-11-23 20:11:09 -08:00
Anees Iqbal 1b9ea536f6 Translator: a threadgroup barrier, and a kernel's group operation in uniform control flow, state the reconvergence mode only in a re-entered loop
A program's threadgroup barrier, and a kernel's tangled instruction in a block the workgroup
uniformity proves every thread of the threadgroup runs together, now count as fragreconv counts a
fragment's derivatives: an entry whose tangled instructions are all such (or a fragment's
derivatives) states no MaximallyReconvergesKHR (or SubgroupUniformControlFlowKHR), records
Reconvergence::Guaranteed and no DeviceReconvergence, except where its emitted module holds a
tangled instruction, itself or through a call, in the construct of a loop whose continue target
two or more blocks of the construct branch to; there it takes the profile's mode and note as
before. An entry whose every group operation stands in a block the pass proves uniform for the
threadgroup, with no re-entered loop around it, states no mode and records Guaranteed. An entry
with any other tangled instruction keeps the mode; a kernel compiled for partial threadgroups
proves no block uniform, and the emulated tier keeps its own rule.

Why: without a mode SPIR-V reconverges invocations at the merge of a construct they entered
together and all leave by it (2.2.5, Uniform Control Flow), and an OpControlBarrier of Workgroup
execution scope is defined where every invocation executes the same dynamic instance of it,
which invocations resume only under those conditions (2.2.5, Dynamic Instance). Metal requires
every thread of the threadgroup to reach a threadgroup barrier, and a group operation in a block
every thread runs together sees every lane, so both are Metal's wherever SPIR-V reconverges,
which is everywhere but a continue target entered from several blocks. On the 780M under AMDVLK
the mode with the group operations of one kernel family costs 9.4-11.4x RADV on its own command
buffers, and 2.8-3.0x without the mode (m3-max-72248, m3-max-72261).

How: BarrierPlan::threadgroup records every threadgroup barrier; simd::finish defers an entry
whose tangled instructions are all a fragment's derivatives, threadgroup barriers or a kernel's
instructions in workgroup-uniform blocks (simd::together: partly_live's uniformity, or the same
analysis where it computed none) to SimdPlan::reentry; lower::simd::reentry (quad_loop, renamed)
settles it on the emitted module, its re-entered-loop test now over every tangled instruction
(derivatives, implicit-LOD samples, LOD queries, control barriers, group operations). The emulated
tier clears the deferral where it clears the mode. The simd module doc, the PrecisionNote and
Reconvergence docs and docs/API.md's Precision sentence and catalogue entry say the same.
SEMANTICS_VERSION 2300.

Tests (src/tests/engine_reconvergence_together.rs): a threadgroup barrier alone states no mode on
every committed profile; one in a loop two latches inside a selection re-enter keeps the mode;
a shuffle in a counted loop states no mode; a shuffle after a merge inside a per-thread branch,
and one in a loop with a per-thread exit, keep it.
2026-11-23 17:10:25 -08:00
Anees Iqbal 7360a148bb Translator: a fragment's derivatives state the reconvergence mode only in a loop a back edge re-enters from inside a selection
A fragment entry whose only tangled instructions that depend on reconvergence take derivatives
(dfdx, dfdy, fwidth, implicit-LOD samples, LOD queries) no longer states MaximallyReconvergesKHR
(or SubgroupUniformControlFlowKHR), records Reconvergence::Guaranteed and carries no
DeviceReconvergence, on every device, except where its emitted module holds such an instruction,
itself or through a call, in the construct of a loop whose continue target two or more blocks of
the construct branch to (a continue from inside a selection, or two latches). There it takes the
mode the profile gives a tangled entry, and the note where the profile has no maximal
reconvergence. Entries with group operations or barriers keep today's behaviour.

Why: MSL 6.11.1.1 leaves derivatives undefined within nonuniform control flow, and an implicit
level or LOD query is the derivative of its coordinate, so such an instruction is Metal's only
where the quad reaches it together. Without a mode SPIR-V reconverges invocations at the merge of a
construct they entered together and all leave by it (2.2.5, Uniform Control Flow); only the
continue target of a loop entered from several blocks needs SPV_KHR_maximal_reconvergence to
rejoin the quad for the next iteration. AMDVLK 2025.Q2.1 miscompiles a large fragment function
under the mode (an 8x8-cell grid on the 780M, blockiness 9.15 against RADV's 2.87; the same play
with the mode stripped reads 2.92, job m3-max-71921), and the note logged on every device without
the feature for a case Metal leaves undefined.

How: SelectCx::derivatives marks the derivative and implicit-LOD tangled values; simd::finish
defers a fragment entry with only those to SimdPlan::quad_loops; lower::simd::quad_loop::settle
decides on the emitted module, before verification, and declares the mode with
TypedModule::declare_modes where it applies. The PrecisionNote and Reconvergence docs, the
docs/API.md catalogue entry and its Precision sentence, and the simd module doc say the same.
SEMANTICS_VERSION 2298.

Verified:
- Metal-defined reconvergence cases with the mode stripped equal them with it, and Metal, on the
  780M under AMDVLK 2025.Q2.1 and RADV (m3-max-72068), the RTX 5080 (m3-max-72069), the RTX 3090
  (m3-max-72071), the Iris Xe (m3-max-72070) and lavapipe (m3-max-72077): 0 of 4096 pixels differ
  from Metal either way. Each entry under this change reads one of the two.
- The lettering play on the 780M under AMDVLK to frame 4016 (m3-max-72116, this change against
  its base ff2b13cb96): blockiness 2.92 against the base's 9.15 and RADV's 2.87. In the same job
  under AMDVLK, the runtime's device suite (717 tests, one process each) reads 714 passed and the
  same 3 failed for base and change, 0 verdicts differing; `conformance replay --gpu` gives
  identical verdicts and lines.
- Lowering diff, card-free (m3-max-72134), on every committed profile over five recordings,
  base against change: only fragment-stage modules differ (22514 of 43708 render states, from
  906 fragment entry points); 0 vertex modules and 0 of 16160 compute modules differ; on
  nvidia-pascal-linux and runtime-floor no module differs and only the reconvergence and the
  note move. The golden table's 1079 changed cells are 83 fragment entries (!air.fragment) on
  the 13 profiles with maximal reconvergence (m3-max-72117); its bless is due at the next pin.
- Reach (m3-max-72028, m3-max-72101, m3-max-72194): on the 780M RADV profile, standing for the
  13 maximal profiles, 229 fragment entry points of the lettering recording, 906 of five other
  recordings and 3108 of fifteen more lose the mode; none still states it.
- Timing, base / change / base, each play from empty caches, GPU busy against the base mean:
  the 780M under RADV, 4017 frames (m3-max-72164), +0.07% whole play, +0.06% from frame 250, at
  most +0.96% in any 250-frame window after it; the RTX 3090, 751 frames (m3-max-72163), +0.82%,
  +1.08%, at most +1.71%, clocks alike per arm; the Iris Xe, 751 frames (m3-max-72202), -0.07%,
  -0.04%, at most -0.01%. The RTX 5080's run (m3-max-72128) read noise: its base arms' GPU
  busy stood 3.0-8.5% apart in four of five windows.
- Release translation of the largest row, the 357,837-word lettering fragment module, through
  the command line with spirv-val: 0.28 s and 43.6 MiB, as the base's 0.29 s and 43.5 MiB
  (m3-max-72178). The slowest single pipeline of a recording compiles in at most 0.5 s on a loaded
  host, and its process peaks at 436 MiB (m3-max-72169, m3-max-72177); five recordings' batch,
  75 runs a side interleaved, takes 0.44% longer than the base's (m3-max-72134).
- Tests (engine_quad_loops): derivatives in selections, after merges, after a loop and in a
  one-latch loop state no mode and no note on every committed profile; a two-latch loop around a
  sample or dfdx takes the profile's mode and, without maximal reconvergence, the note; a
  fragment quad operation keeps the mode. With the routing switched off,
  derivatives_outside_a_re_entered_loop_state_no_mode_and_no_note fails and the other two pass
  (m3-max-72117). Gate at this commit (m3-max-72200): fmt, clippy in every configuration, Rustdoc,
  the suites, the doctests and lavapipe's quad_control pass, but for the golden table's bless;
  `conformance replay --cpu` on lavapipe, reconvergence cases included, reads the same as on
  62ab49b966 line for line, and holds the ledger.
2026-11-23 14:19:33 -08:00
Anees Iqbal 932ef756df Lowering: a quad-only kernel takes its quads from the subgroup at the size the device gives below 32
The 32 lanes of a Metal simdgroup are needed only by operations that read outside a quad. A kernel
whose every cross-lane operation is a quad operation (lower::simd::quad_only: some group operation,
each of quad scope, and no simdgroup-scope operation, AGX or matrix multiply-add, or subgroup-scope
barrier or fence) now takes the Direct tier with full subgroups and no required size where the
kernel stage runs full subgroups of its operations and its narrowest subgroup is below 32 lanes
(device::subgroup::quad_free, read from the stage's size range alone). Its requirement
(quad_requirement) sets ALLOW_VARYING_SUBGROUP_SIZE where the stage can take a size, and a local
size that is a multiple of the stage's largest size (VUID-VkPipelineShaderStageCreateInfo-flags-02758);
a threadgroup that is not runs the emulated-simdgroups variant, as a pinned kernel's does. Such a
kernel pins nothing, so the widest-pin rule does not weigh it. The pin to 32 stays where 32 is the
device's narrowest size.

Why it is exact: a quad is four subgroup lanes from a multiple of 4, all in one subgroup (Vulkan
9.27.9), and a compute dispatch runs one subgroup size (9.5.2); the kernel's simdgroup builtins
derive from the linear index (SubgroupId * SubgroupSize + SubgroupLocalInvocationId, reading the
SubgroupSize builtin where no size is pinned), and its quad operations from SubgroupLocalInvocationId
& 3 and & ~3, so every size of 4 lanes or more gives Metal's quads.

The guard min >= 4: a quad must be four lanes of one subgroup. A stage whose narrowest subgroup is
1 or 2 lanes could split a quad across subgroups, so such a stage keeps the tier its class takes.

A kernel with compute derivatives keeps the tier its class takes: their quads need its
two-dimensional local size, which the flattened tiers refuse (ComputeDerivativesWithSimd). Without
this exclusion lavapipe's quad kernels with derivatives, which run emulated today, would be refused.

Where it applies among the committed profiles: the four Intel ANV profiles (8 to 32: multiple 32,
varying), lavapipe and gate-lavapipe-x86_64 (8: multiple 8) and gate-lavapipe (4: multiple 4). Not
on NVIDIA (32), RDNA (32 to 64), moltenvk-m3 (its kernel stage takes no size, so it runs the API's
32 alone) or runtime-floor (no quad class).

Measured on the Iris Xe (RPL-P, ANV), job m3-max-71702, the lane-only form of this change (E: the
base at eda92e1207, Q: this form, E2: the base again; cold plays of the consumer's recording to
frame 345): the regression row's kernel took Q in all 21 of its constant sets (15832 dispatches,
100%); per dispatch E 1.6018 ms, Q 0.7314 ms, E2 1.6006 ms (Q/E 45.7%); values E/Q and E/E2 0
differing of 261 buffers; translation 18 s and 0.92 GiB peak against 17 s and 0.92 GiB. The
driver's executable statistics (job m3-max-71726): Q compiles at SIMD8 (SIMD16 for one state),
15 to 50% fewer instructions than the emulated form, against about 2800 spills a state when pinned
to 32.

SEMANTICS_VERSION 2297 (modules change on the profiles above); ARTIFACT_FORMAT_VERSION 595
(SubgroupRequirement gains `varying`).

Tests: device::tests::subgroup (the predicate over size ranges, the guard, and the committed
profiles it takes), engine_simd (a quad-only kernel's requirement on every committed profile, and
the flattened kernels' constraint), engine_quad_ops (the quad fixture's kernels in the Direct tier at
8 on lavapipe and at 8, 16 and 32 on an Intel profile; the emulated variant on lavapipe),
engine_dispatch (derivatives beside a quad keep lavapipe's emulated tier), and the runtime's
every_device_runs_a_quad_only_kernel_at_the_size_it_gives under a device cfg.
2026-11-23 12:02:56 -08:00
Anees Iqbal ed4b0ecd76 rt: storage textures written or read at a run-time level, through runs of set 1's level elements
What: under the identity domains a storage slot written, read or size-queried at a level other
than the constant 0 indexes a run of set 1's storage-image array instead of being refused as
Unsupported{IdentityDomains} ("an encoder value the function reads as TextureLevels(S)"). The
translator pushes the bound texture's level count (PushField::TextureLevels) and the run's first
element (the new PushField::TextureLevelBase, beside it), states no StorageTextureLevels or
StorageTextureLevelViews fact, and an access at level l takes element
first + min(l, max(n, 1) - 1) of the array, NonUniform, inside l < n. A texture of one level
pushes its own index, nil 0 with count 0.

The runtime's binding 1 grows by 65,536 level elements past its 65,536 textures, 4,096 runs of 16
(floor::LEVEL_ELEMENTS, floor::LEVEL_RUN). The first dispatch or draw that binds a texture of more
than one level to such a slot (the encoder's checks, compute and render stages alike) gives it a
run: a single-level storage view of each level, of its storage element's type (a cube's level as
the 2D array of its faces, a view's from its own first level), written at the run's elements. A
later bind takes the texture's lock and pushes the same two words: no Vulkan call. The run goes
back through the pool and reaper once the texture is released and its work retired: elements null,
views destroyed (Gauges::level_elements). Every run held, or a texture of more than 16 levels, is
the new Limit::LevelElements { max: 4096 }, and the dispatch or draw does not run. The floor's
storage-image limits and both totals rise by 65,536: storage 196,608, per-stage resources 327,688,
pools 351,680; every lab device's profile is far above (llvmpipe 1,015,808 storage, the least).

SEMANTICS_VERSION and ARTIFACT_FORMAT_VERSION bump in the branch's last commit (a new PushField).

Why: 17 guest kernels in 6 libraries were refused at state creation by this form.

Docs: REFUSALS.md and the signatures table regenerated, RESOURCE-ID.md (binding 1 past 65,536),
API.md (storage levels under identity), the runtime README (Set 1, the floor table, the known-gap
line replaced by the Limit), the runtime-floor profile's limits, and the conformance ledger's
level-sizes-storage row removed.

Checked by: engine_texture_levels' identity test and the runtime's storage_levels device tests
(red at 6ad1c33124: jobs m3-max-70886 and m3-max-70892 on lavapipe), engine_identity's
a_storage_slot_written_at_a_run_time_level_is_an_element_of_its_run; the lane's jobs report the
runs per card.
2026-11-23 09:04:38 -08:00
Anees Iqbal 340cbf5591 Docs: HalfTexelConversion's recorded bound names the driver that keeps a 32-bit texel past 65504 at 65504
What: the half-texel-conversion note's recorded bound (PrecisionNote::HalfTexelConversion's doc and
docs/API.md's catalogue entry) now states both answers past +-65504 for a 32-bit float texel read into
`half`. Metal saturates a sample and takes a read to the infinity. The device's rounding takes both to the
infinity. AMD's open Linux driver (AMDVLK 2025.Q2.1, Radeon 780M) keeps both at +-65504, against the 16-bit
float controls the entry declares. Documentation only: no module, refusal or note changes.

Why: under AMDVLK, half-texel-nans-r32f/rg32f/rgba32f's read() sites answered 0x7bff for the largest finite
float texel where Metal answers 0x7c00 (42, 85 and 171 elements a site). The note's text named only the
mirror case (RADV's infinity where Metal saturates a sample), so the static note did not cover what that
driver answers.

How verified (gem10's Radeon 780M; probe branch steelbrain/amdvlkconf-probe, never lands):
- m3-max-71424, built on 7024d568df: every differing element of the four half-texel-nans cases under RADV
  and AMDVLK, read one by one.
  - Under AMDVLK every element is a NaN-encoding difference except the largest-float texel's: read 0x7bff
    against Metal 0x7c00, and the nearest sample 0x7bff equal to Metal's.
  - Under RADV every element is a NaN-encoding difference except that texel's nearest sample: 0x7c00
    against Metal 0x7bff, the case the note already named.
  - The kernels are byte-identical under both drivers. Both declare RoundingModeRTE, DenormPreserve and
    SignedZeroInfNanPreserve for 16 bits, and OpImageFetch -> OpFConvert half carries NoContraction.
- m3-max-71434: a standalone 4x4 repro (our own SPIR-V and C).
  - Under AMDVLK, OpFConvert to half of 65536, 70000 and FLT_MAX gives 0x7c00 from a storage buffer and
    from an R32_SFLOAT texel buffer, but 0x7bff from an R32_SFLOAT 2D image fetch.
  - RADV gives 0x7c00 in every form, and 65519 gives 0x7bff in every form.
  - The Vulkan spec makes OpFConvert correctly rounded, by IEEE 754 roundTiesToEven under RoundingModeRTE,
    so the driver's 2D-image form is its own deviation. A draft report is staged for the owner.
- The old runtime's modules cannot change: this commit touches doc text only.
2026-11-23 08:36:11 -08:00
Anees Iqbal 30d426774d Translator: a kernel's floor tail folds into its pushed fields again (revert of the split)
The split (3a4fe0d314, with its tests c2d505c30c) made a kernel return at entry where its floor
tail holds what the consumer never pushes, in place of the select per pushed field. At pin S
(3bc285acaa) a guest's run of a GPU compute benchmark on the Iris Xe (8086:a7a0, ANV, Mesa
26.2.6) failed the benchmark's own output validation in its first workload, where the same run at
38c5f2e96a passed and every other vendor's run at S passed (3090, RX 7900 XTX, Radeon 780M
RADV). R..S holds the split alone. Until the cause is named, every stage folds the tail as at
38c5f2e96a, which passed on that card.

This commit undoes both commits' changes to lower/emit.rs, lower/push.rs, the arena and identity
tests and docs/API.md section 5; SEMANTICS_VERSION 2293 -> 2294, as every kernel under a floor
tail lowers as at 38c5f2e96a again. The split returns as its own change with its Iris value proof.
2026-11-23 08:03:41 -08:00
Anees Iqbal 3a4fe0d314 Translator: a kernel's floor tail returns at entry again; a render stage's folds into its other pushed fields
Since 059835018a every stage folded its tail's test into each other pushed field through a
select. A kernel's entry also returns invocations before its body where its dispatch passes its
grid (dispatch::emit_entry), so a return at entry is a kernel's own shape, and the selects cost
kernels on three vendors. A fragment stage has no other return at its entry; AMD's open driver
(AMDVLK 2025.Q2.1) died making one whose body ran under the never-taken return, which is what the
fold removed.

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

Same pushed bytes, same placement, no interface change.
2026-11-23 06:26:25 -08:00
Anees Iqbal e59c621e48 rt: an observing kernel's whole grids, threadgroup dispatches and indirect dispatches run its plain module again; its partial-threadgroups variant runs ragged grids only
This restores 28e1026b3d's routing, in a new commit past four that changed it:
- 6453edbea7 ran an observer's whole grids on its partial-threadgroups variant;
- f090d99c9a added its indirect dispatches;
- 9a01f1e8ee kept the plain module only where the variant's vote word passed the limit;
- a103b4dc5a lowered the variant alone unless keeps_plain held.

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

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

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

Tests (red at 8a2f9109aa, green here):
- every_device_runs_an_observing_kernel_at_its_own_threadgroup_size: its whole grids,
  threadgroup and indirect dispatches add 0 to partial_variant_whole_grids, its ragged grids
  count in partial_variant_ragged_grids, and the creation lowers two modules.
- every_device_keys_a_dispatch_by_the_pipeline_it_runs: the whole, threadgroup and indirect
  entries share the plain module's key; the ragged ones take the variant's.
- every_device_finds_made_what_prepare_dispatch_made: a ragged grid and u32::MAX threads each make
  the variant's pipeline.
- every_device_keeps_a_kernel_that_reads_across_rows_after_a_barrier_at_its_own_size and
  every_device_makes_a_declared_bound_s_grids_with_the_state: a declared size makes two pipelines
  with the state, and its whole and ragged grids make nothing and wait for nothing.
- kernel_map's shared-content test: the observing content lowers twice.
The ragged-grid tests stay as they were:
- every_device_runs_a_stage_in_kernels_partial_threadgroup;
- every_device_runs_a_1024_thread_observers_ragged_grid_in_the_limit_less_its_vote_word;
- every_device_runs_a_kernel_without_a_vote_word_at_a_length_past_its_answer;
- every_device_runs_an_observer_on_its_plain_module_where_the_vote_word_passes_the_limit.
2026-11-23 06:16:29 -08:00
Anees Iqbal c6feccf773 Translator: a kernel that reads a stage-input region takes its partial-threadgroups variant
plan_partial_groups refused a kernel's partial-threadgroups variant wherever it had a stage-input
descriptor, so rt refused every dispatchThreads grid that is not whole threadgroups of a kernel
with a [[stage_in]] attribute (Gap::PartialThreadgroups at the translator's site). The probe over
the 11,580 indexed kernels (m3-max-70807) counted 62 such kernels on amd-780m-radv,
nvidia-rtx50-linux and intel-irisxe-anv alike; a consumer's first-time setup meets one of them.

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

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

The two tests of 9089b4eea2 turn green: the translator's interpreter run over a source buffer
ending at the last thread's element and a region that clamps nothing traps on any fetch past the
grid, and rt runs both kernels' partial threadgroup of 25 in 1,024.
2026-11-23 04:48:01 -08:00
Anees Iqbal ac5c562a08 Translator: a deep kernel's WorkgroupSize parts are plain specialization constants, written with every other key its threadgroup decides from one call
AMD's open driver AMDVLK (2025.Q2.1, its LLPC compiler) sizes a compute workgroup from the
WorkgroupSize composite's parts as declared, and reads an OpSpecConstantOp part as 1, while the
body sees the right value: every Spec-form kernel, whose deep-threadgroup form made each part an
OpSpecConstantOp Select over IMul products of LocalSize, ran one invocation per workgroup there.
The Vulkan spec allows such a part (VUID-WorkgroupSize-WorkgroupSize-04426: a specialization
constant or a constant), so this is the driver's bug; the form here is right on every device.

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

Evidence so far: rt's probe with the composite's op parts folded to plain constants (job
m3-max-70461, the RX 7900 XTX; m3-max-70462, a Radeon 780M) cleared 66 of the 67 rt device
tests that failed on AMDVLK; the 67th, quad_control's helper test, fails the same with and
without, a fragment-stage defect of its own.
2026-11-23 01:45:17 -08:00
Anees Iqbal 4c438ca2c6 Translator: under the identity domains a command buffer's field is plain data
An argument buffer's command_buffer member holds, under the identity domains, its word: the
gpuResourceID the program or the host wrote there, the device address of the records
(lower::access::icb). The byte rule of memory::provenance::objects treated it as an opaque
object, so any access other than the exact handle load that might reach its 8 bytes was
Unsupported{ArgumentBufferObjects}: an index past the structure by a signed run-time index, whose
offsets run back to 0, and, once such a buffer's address escaped, every run-time dereference.

Metal lays a Tier 2 argument buffer out as the equivalent C structure (macOS 13 and later), into
whose member the host writes gpuResourceID ("Handle of the GPU resource suitable for storing in an
Argument Buffer", MTLIndirectCommandBuffer.h), and whose contents the GPU and the CPU may both
modify. A plain access of those bytes reads or writes that word, which is all Metal defines of
them. So under the identity domains a command buffer's field is not opaque for either rule
(ObjectLayouts::of takes `words`, from the profile's pointer domain); a pipeline state's field
stays opaque, and under the resident-table domains, the validation executor's, nothing changes.

Tests: the objects rule's unit test (a command buffer's field is opaque only without its word),
and engine_identity_icb's an_access_past_an_encoder_is_a_plain_access_of_its_command_buffers_word
over the owned fixture icb_encoder_tail: both entries compile and validate under the identity
domains on lavapipe and moltenvk-m3, and the resident tables still refuse them.
2026-11-23 01:17:56 -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 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 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 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 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 12f8a9f06a Identity domains: a bicubic sample at pixel coordinates
The identity domains refused every function that samples a 2D texture through a bicubic
constexpr sampler at pixel coordinates ("a bicubic filter at pixel coordinates"), though its
lowering is the normalized sample's with no position step: a pixel coordinate is already in
texels, so the emulation reads the coordinate itself, the level-0 size by OpImageQuerySizeLod of
the bound image (which under the identity domains is the slot's set-1 element), and the format's
treatment from the slot's PushField::BicubicTexels, as at normalized coordinates. Nothing in it
reads state the identity domains do not source, so the refusal goes: SamplerPlan::bicubic_pixel
and BICUBIC_PIXEL_FORM are deleted. Metal's front end admits pixel coordinates only with clamping
modes (MSL 2.10), and a mirrored axis at pixel coordinates stays refused by bicubic::check, as on
the resident-table domains. A bicubic sample of a 1D texture keeps its own refusal.

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

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

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

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

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

Docs only: artifact.rs, the runtime's texture.rs, docs/API.md, the runtime README.
2026-11-22 22:40:56 -08:00
Anees Iqbal 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 de764fc389 Translator: a threadgroup atomic at a constant offset outside the arena writes nothing and yields zero
The sibling of the out-of-arena load and store. An unchecked threadgroup atomic at a constant
offset outside the arena built an access chain past the arena's word array, which the builder's
range rule rejects, an internal error. It now writes nothing and yields zero, as a contained atomic
out of bounds does (`guarded`), decided by the same plain-constant test (`local::outside_arena`):
an atomic inside the arena, or at an offset that is not a constant, is unchanged. Metal leaves the
access undefined. docs/API.md's threadgroup bullet names the atomic too. No census row reaches it.
2026-11-22 21:53:53 -08:00
Anees Iqbal 0b1053f0cc Translator: a threadgroup load or store at a constant offset outside the arena is a zero load or no store
An unchecked threadgroup arena access whose offset is a plain constant outside the arena built an
OpAccessChain into the arena's word array with a constant index past its length, which the SPIR-V
builder rejects (OperandRule::Range), so the function failed with an internal error instead of
translating or refusing. Such an access lies outside every threadgroup object, which Metal leaves
undefined, so it is now decided at translation time as a contained arena's constant access is: a
zero load, or no store. The decision reads the offset and the arena's size as plain constants and
interns nothing, so every access inside the arena, and every module that built before, is
unchanged; an arena whose size is a specialization constant is never decided this way (its word
array has no constant length to break).

The shape: Apple's compiler, knowing t == 0 in a branch, writes tg[t - 1u] of a static
threadgroup array at arena offset 0 as element 0xFFFFFFFF, a wrapped arena offset of 0xFFFFFFFC.
It is the whole of the translation census's internal errors at da020e5d7b (18 functions in 4
libraries on all five profiles, kindcount's m3-max-69549): each a load of an i32 word from a
static [N x i32] or [N x float] threadgroup global through an inbounds GEP [0, 4294967295], in a
branch, on the arena's u32 words.

SEMANTICS_VERSION 2277: those functions' outcome moves from an internal error to a module.

Verified: probe m3-max-69624 (base da020e5d7b plus a report at the builder's range rule) found
that one site and shape for all 18 rows; probe m3-max-69654 reproduced the same internal error
from owned MSL. The new test drives a load and a store at element 4294967295 of a 64-word
threadgroup array through from_queries on four profiles, in an arena of u32 words and one of
float words, and checks L3 and the interpreter's answers (the load reads 0, no word takes the
store).
2026-11-22 21:18:45 -08:00
Anees Iqbal 6adfe028d8 Translator: a half vector joined from read lanes keeps their bits; 20 NaN ledger rows
The RTX 5080 Laptop's replay at 2953064a1c (NVIDIA 615.71.09, job m3-max-68835) read 34 sites of
attribute-format-fetches that known-gaps-rt.tsv does not list.

The 29 at attribute3 (`half2 h`, read as Half or Half2) were ours. The case's inputs there are half
NaNs: attribute_coding.rs's Half codes 0x7E01 and 0xFE01, at threads 9 and 10 in component 0 and 6
and 7 in component 1. Metal's recording returns every attribute3 input unchanged at all 29 leaves.
The 5080 differs at as many elements as there are NaNs (2 at Half, 4 at Half2), first at a NaN
(Metal 0x7e01, ours 0x7fff), and its largest difference, 32258, is 0xFE01 - 0x7FFF. That every
differing element is a NaN is read from the counts, the first element and the largest difference,
not from a full print. The kernel only reinterprets the fetched value (`bitcast <2 x half> to
<2 x i16>`), which the module's own contract keeps as the field's bits (PrecisionNote::
NativeNanEncoding: "a `half` stored back unchanged keeps its bits"), so no note covered it.

The cause: fetch::decode joins the lanes it widened with one OpCompositeConstruct. from_bits noted
each lane's bits, but narrow::known_bits looked through struct members and lane inserts only, so
the bitcast's to_bits found no bits for the vector and encoded it: the device's narrowing of the
device's widening. On NVIDIA a half NaN widens to 0x7fffffff (attribute0's answer on all three
NVIDIA cards) and narrows to 0x7fff. Mesa's widening keeps the payload and its narrowing gives it
back, so the Mesa cards showed nothing; the RTX 3090 and RTX 2080 (620.70.06) showed nothing either
(expected: that compiler folds the round trip; unverified).

The class, at the base: three product sites join half lanes whose bits are noted with a vector
construct and lose them there: the pulled fetch (fetch::decode, for a kernel's [[stage_in]], a
pulled vertex attribute and a post-tessellation attribute), math::unpack_float (air.unpack of the
11/11/10 float formats into half lanes) and chunk::from_words (a chunked bitcast's half lanes), and
one test-only one, the arith tests' own load of a narrow vector. Texture reads, ops::of_lanes_bits
and narrow::unpacked_from_bits widen the whole vector at once and note it; lane inserts were
already followed. So the fix is in known_bits, for the whole class at once:

- spirv::builder records the parts of every OpCompositeConstruct of an f32 vector
  (ModuleBuilder::vector_parts, FunctionBuilder::vector_parts), counted in the builder's
  footprint.
- narrow::constructed_bits: a vector constructed of parts whose bits are each known (noted, a
  constant's, or a lane of a vector's noted bits) has the construct of those bits. Nothing is
  emitted when a part's bits are unknown. known_bits tries it before the lane inserts.
- SEMANTICS_VERSION 2275 -> 2276: the modules of every such vector's store or reinterpretation
  change (the encode becomes the construct of the known bits). The golden table is re-blessed on
  development.
- docs/API.md's native-nan-encoding entry and NativeNanEncoding's doc name the vector join among
  the paths that keep a half's bits.

The other 5 sites (attribute0, the `float4` widening of Half, Half2, Half3, Half4 and FloatRG11B10)
are the device's own answer under device-nan-encoding, as the 3090's rows. The ledger takes each
card's rows from the replays of the round at 2953064a1c, named no wider than the card that ran,
each row's detail equal to what the replay printed and its text the template card's whose answer
it shares:
- RTX 5080 Laptop GPU (job m3-max-68835): every payload bit set (0x7fffffff), as the RTX 3090.
- RTX 2080 (NVIDIA 620.70.06, job m3-max-68939): the same 5 answers as the RTX 3090.
- "AMD Radeon 780M Graphics (RADV PHOENIX)" (Mesa 26.2.6): the PHOENIX run (job m3-max-68941) and
  the HawkPoint run (job m3-max-68942) print that one venue and answer as the RX 7900 XTX:
  0x7fc02000 for the halves, 0x7ffe0000 at 9 RG11B10 elements.
- "AMD Radeon RX 550 / 550 Series (RADV POLARIS12)" (Mesa 26.2.6, job m3-max-68993): the same
  answers as the RX 7900 XTX.
The 2080, 780M and RX 550 runs show no attribute3 site. docs/CONFORMANCE-COVERAGE.md regenerated
(ledger rows 7968 -> 7988).

Tests, each failing at the base's product code and passing with the fix:
- lower::arith::tests::narrow::a_constructed_narrow_vector_keeps_its_lanes_bits (interpreter):
  four decoded lanes, two beside the constants 0 and 1.0, and the harness's loaded vector keep
  0x7E01, 0xFE01, 0x7C01, 0xFDFF and the rest bit for bit, where the encode answers 0x7E00.
- tests::engine_kernel_stage_in::a_half_attribute_reinterpreted_unchanged_encodes_no_half:
  stage_in_fetch with Half2 and Half at attribute 3 holds no OpFConvert to a 16-bit float and no
  PackHalf2x16 on any committed profile, with each half form among them (Controlled, Converted,
  and Device, the profiles without shaderFloat16).

Verified:
- This change on 5f93a64342 (probe 73dead9f70, tree 56642f49), compile job m3-max-69015:
  the two tests against 5f93a64342's product code FAIL, with the fix PASS; fmt,
  signatures, clippy --workspace --all-targets --all-features -D warnings plain, under
  --cfg m2v_gpu and under --cfg m2v_cpu_icd, and workspace Rustdoc -D warnings exit 0; the
  metal2vulkan and metal2vulkan-air suites: 3348 tests passed, 22 skipped, peak 11.3 GiB.
- The tree at 8134bb4201 (on c38852d665; its crates/metal2vulkan/src and
  metal2vulkan-air equal 73dead9f70's), recheck m3-max-68965: against the base's product
  code the engine test reads "30 of 30 modules encode a half": every committed profile with Half2
  and with Half, one OpFConvert to 16 bits each, two PackHalf2x16 each on nvidia-pascal-linux and
  runtime-floor (no shaderFloat16). Compile job m3-max-68956 at 9f921a841c (the same translator
  code): the metal2vulkan and metal2vulkan-air suites 3348 passed, 22 skipped, peak 11.9 GiB.
  golden_hashes_match_the_table passed at SEMANTICS 2276 in both suite runs: 0 cells of those it
  compares on Linux moved, so no "bless due"; the cells that need metal-as are compared at
  development's bless.
- RTX 5080 Laptop GPU (NVIDIA 615.71.09), the conformance replay on rt: at 8134bb4201, job
  m3-max-68961, and at 73dead9f70, job m3-max-69047: exit 0, no unlisted site;
  attribute-format-fetches differs only at its listed rows (the 8-bit unsigned normalized
  formats' 1-ulp rows and the 5 new attribute0 rows), none of the 29 attribute3 sites differs,
  and "the 4607 row(s) above are exactly the open gaps known-gaps-rt.tsv expects on this venue".
- States-only play on lavapipe, 9 streams, every MODE line states-only: 8134bb4201 (job
  m3-max-69001) against c38852d665 (job m3-max-68979). In each stream both made the same render
  and compute states and pipelines (gb-3090-r2: 10643 render, 15299 compute, 568 pipelines;
  glbench-780m-r4-recnil: 3756, 484, 498), refused 0 and left 0 unattempted. 8134bb4201's
  translator code equals 73dead9f70's.
- Not run: the RTX 2080's, the 780M's and the RX 550's rows are as those cards' replays printed at
  2953064a1c; their replays with this change are the next round's. "The RTX 3090 shows nothing at
  attribute3" stays unverified.

The branch is rebased onto development after the jobs; the commits between 5f93a64342 and its
base change runtime files alone (crates/metal2vulkan-runtime), none of this change's.
2026-11-22 15:51:40 -08:00
Anees Iqbal a1ca99880a Stage bound: a subgroup instruction weighs 64, the re-plan takes the lighter module, and a subgroup multiply-add's steps are one loop of paired shuffles
What:
- spirv::roll::bound_weight beside entry_weight: entry_weight with each subgroup instruction
  (OpGroupNonUniform*) counted as SUBGROUP_WEIGHT, 64. Only the stage bound reads it
  (stage_bound::emit); the roll keeps entry_weight as its trigger. ModuleStats::entry_weight
  carries it, so the runtime's in-process or helper choice reads it.
- The re-plan holds both plans and compares them. A kernel past the bound only as the widest pin's
  emulation is planned again keeping the pin: the re-plan takes the pinned module where it weighs
  less than the emulated one by the stage weight; otherwise the emulated one goes on. The other
  plan and module are dropped and their ledger share released.
- tile_mad on a subgroup tier: one vec2 shuffle carries a step's two b cells, one the a cells of
  steps 2m and 2m + 1 (one owner lane: owner_bits keeps bit 0 of k out of the a owner), and the
  dim / 2 step pairs are a DontUnroll loop, the sums in Function variables. Each step reads the
  same cells and accumulates in the same Fma order. The emulated tier is unchanged.
- SEMANTICS_VERSION 2273 -> 2274.

Why: a driver's compile grows with a subgroup instruction far faster than with any other. A
kernel of entry weight 24,814 holding 3,772 subgroup instructions passed 6 GiB compiling on an
RTX 3090 (NVIDIA 620.70.06; job m3-max-67936), where the bound's 39,014 kernel grew 148 MiB. Under
the term it leaves the process; with the cut its module (22,238 instructions, 644 subgroup
instructions, bound weight 62,810) filled in the helper at 2,699 MiB of the consumer's 3,072 MiB
cap in 59 s (m3-max-67936): a thin margin. On the Iris Xe of RPL-P its pinned module, which the
re-plan took whatever it weighed, met the helper's memory (killed at 6,144 MiB, m3-max-67973);
now the emulated module (46,491, no subgroup instruction) goes on, against the pinned one's 56,163
with the cut, and filled at 792 MiB in 18.8 s (m3-max-67863).

Verified:
- Census, states-only (each play's MODE line read): the nine standard streams on the RTX 3090's
  and the Iris Xe's profiles (m3-max-68045, 68047, 68087, 68100, 68101, 68132): 259 distinct
  kernel modules a card, none holding a subgroup instruction, no re-plan, and no pass, render
  stages included, that holds one; a recorded pass on the RX 7900 XTX (m3-max-68146): 819
  compute states, none. The weigh tables of four staged kernels and a 63-kernel library on both
  profiles, no driver compile (m3-max-68033, 68034): on the RTX 3090 two kernels cross, that of
  24,814 and one of 7,470 (615 subgroup instructions, 46,215), which fills in the helper at
  1,011 MiB (m3-max-67690); on the Iris Xe only the kernel of 24,814 re-plans. The library's ten
  kernels past the bound today hold no subgroup instruction.
- Bit-equal and run time: the owned stage-bound fixture (512 multiply-adds a simdgroup, compiled
  by Apple's metal) through the harness, before (development 951285e7a7) and after, the arms
  alternating, 3 rounds of 200 runs, every kernel in the process. Output digest f0794c86d4c553e1
  in every round of both arms on the RTX 5080 Laptop (NVIDIA 615.71.09; m3-max-68191), the RX
  7900 XTX (RADV, Mesa 26.2.6; m3-max-68202) and the Iris Xe (ANV, Mesa 26.2.6; m3-max-68203).
  Steady time, before -> after: RTX 5080 2,781 -> 2,356 us (-15%); RX 7900 XTX 1,856 -> 653 us
  (-65%); Iris Xe 58,962 -> 11,600 us (-80%: there the re-plan now takes the emulated module,
  113,727, over the pinned one, 134,101).
- Translation of the kernel of 24,814, GPU-free (DeviceProfile::compile_entry, the arms
  alternating, m3-max-68190): on the Iris Xe's profile, where both plans are held, 39.0-40.3 ms
  -> 43.3-43.4 ms, ledger peak 11.9 -> 15.8 MiB, resident growth 15.3 -> 20.2 MiB, work units
  823,737 -> 899,773; on the RTX 5080's and the 780M's profiles, no re-plan, 23.5-24.6 ->
  23.4-23.9 ms, ledger peak 7.3 -> 7.0 MiB. Within 20 s and 500 MiB.
- Tests: the_stage_bound_fixture_takes_the_lighter_module_or_states_its_weight (was
  ..._keeps_the_pin_or_states_its_weight): on the Iris Xe's profile the fixture's pinned module
  is under the bound by the entry weight and heavier than the emulated module by the stage
  weight, and the emulated module goes on. With the pin taken whatever it weighs it fails (left
  (Direct, 0), right (Emulated, 1); m3-max-68214). The other two widest-pin tests weigh by the
  stage weight; only_divergent_multiply_adds_ballot_their_lanes counts the loop body's 3 bit
  extracts a multiply-add where the written-out steps held 16.
- clippy --workspace --all-targets --all-features clean; the product suite 3067 of 3068
  (m3-max-68180), the one failure golden_hashes_match_the_table: 176 cells of the matrix and
  multiply-add fixtures move, re-blessed on development.

Docs: the runtime README's "Kernels past the stage bound" (the 64 and why, the re-plan's rule),
docs/API.md's entry_weight, ModuleStats::entry_weight, the stage bound's module docs and the
fixture's MSL comment.
2026-11-22 10:18:19 -08:00
Anees Iqbal a7dd2e846e Translator: the binder's plan goes, with everything only it reaches, and the TexelRows and YCbCrInPlace forms
The runtime never made a plan (it binds each draw and dispatch by the pipeline's interface), and
since the census digests each pipeline's content alone (two commits back) nothing in the tree calls
one. What only the plan reached goes with it:

- bind: BindState, BindShape and their shapes, BindingPlan and its instantiation
  (DispatchCommands, DrawCommands, push, descriptor and root-table templates and writes),
  plan.rs and plan/ (compute, resources, slots), instantiate.rs, resident.rs, the neutral
  resources' plan side, the heap's member planning and table bytes, the mesh arguments pass
  (MeshArguments, MeshArgumentsForm, fold_object_grid, metal_object_grid), ExecutionStatus and
  StatusBits as public items, TextureShape::Buffer, IndirectRef with the four indirect call
  variants (Dispatch::ThreadgroupsIndirect, DrawCall::Indirect, PatchesIndirect,
  MeshThreadgroupsIndirect) and IndexBufferRef::fetch_end. Dispatch, DrawCall and IndexBufferRef
  stay: validation states its cases' calls with them.
- error::BindError leaves the public surface; a crate-private BindError of three variants stays
  as the error of the heap's view derivation, which lower::texture::slot's storage-read check
  reads (bind::heap::tier_read_gaps). That check keeps only the storage view's format: the
  sampled-view branch and ImageViewDesc were reached by the plan alone.
- vk::DrawCommand, the plan's draw output.
- pipeline: ComputePipeline::plan, RenderPipeline::plan; cache: VariantKey::covers and
  large_buffer_form.
- The TexelRows form (bind::texel_rows, LoweringInputs::texel_rows, RuntimeFact and PushField
  TexelRows) and the YCbCrInPlace form (bind::ycbcr_in_place, lower/sampler/in_place.rs,
  LoweringInputs::ycbcr_in_place and ycbcr_planes_sampled, RuntimeFact and PushField
  YCbCrInPlace, PrecisionNote FloatSampleFilter and HalfSampleFilter, Routine::Quad). Only the
  binder set those inputs.
- The tests of the deleted items, and the plan halves of mixed tests. Of 6810 tests (`#[test]`
  functions in the workspace) 309 leave and 11 come in their place: the lowering halves of mixed
  tests, kept without the plan (the heap layout, the stage-in stride and region facts, the
  emulated-simdgroup and bicubic facts, the iris-xe storage classes), and the kept tests of the two
  renamed files. 50 others are edited to drop a plan half or a deleted item (the api_surface round
  trips; the simd_emulated, extended-range, recursion, dynamic-root, handles, heap-storage-read
  and mesh lowering cases). 6512 remain. engine_graphics_binder.rs and engine_heap_binder.rs keep
  one and two tests and are renamed engine_unattached_colors.rs and engine_heap_groups.rs.
- The runtime guard test's list of files the runtime inputs reach without being inputs drops the
  seven no input reaches since the cut: cache/digest.rs, lower/simd/divergent.rs,
  lower/simd/workgroup.rs, pipeline/artifact.rs, pipeline/layout.rs, pipeline/stage_io.rs and
  pipeline/vertex.rs; three of its reasons that named the plan or the binder say what reaches the file now.

559 public items leave (api_signatures.tsv: 55 structs, 26 enums, 140 variants, 245 fields,
52 methods, 24 associated constants, 7 constants, 5 functions, 5 impls). Consumer search, the
consumer's development at 92ffbed817, `git grep -w NAME` of each of the 112 removed names: 0 hits
for 105; the others are the consumer's own items: TessellationFactors 4 (its
Bound::TessellationFactors), YCbCrMatrix 3 (its own string and doc), texel_rows 2 (its own fn),
ThreadgroupsIndirect 6 (its own Dispatch enums and rt::Dispatch::Indirect), DrawIndexed 1 (a doc
naming MTLIndirectCommandType values), covers 109 and plan 105 (generic words; the `.covers(`
calls are its Extent's, the `.plan(` calls its video encoder's rate.plan). Its one import of
metal2vulkan::bind is the argument-buffer layout types, which stay.

The forms' audit. A texture over a buffer: the runtime's
tests::over::every_device_holds_a_texture_over_a_buffer_in_place. A two-plane YCbCr sample: no
runtime test; the runtime makes no texture of a two-plane YCbCr format (Gap::TextureFormat, the
runtime README's "A format is made where the translator's format table maps it" row), the
conformance cases ycbcr_gathers and ycbcr_textures record Metal's answers, and
known-gaps-rt.tsv lists the runtime's refusals (ycbcr-gathers-*, ycbcr-texel-reads-420v).

Versions:
- RUNTIME_VERSION 2550: it covers plan instantiation and the binder's run-time data. Nothing calls
  those since step 2: the runtime never used the binder, and the own-context executor is gone. A
  run of an unchanged artifact does nothing different, so the guard hash (runtime-sources.sha256)
  moves alone, and the RUNTIME_VERSION doc is rewritten to name what it still covers.
- SEMANTICS_VERSION 2273: no output changes for any input that still exists. The TexelRows and
  YCbCrInPlace forms, their facts, push fields and the two notes were reachable only through
  LoweringInputs::ycbcr_in_place, ycbcr_planes_sampled and texel_rows. Only the binder set those;
  the runtime sets none. The function key appended each of them only when set, so every surviving
  key hashes the same bytes. Two type declarations stay where they were, so module words do not
  move: bool in the bicubic types, uvec4 in the bicubic routines. Byte-identical modules are
  expected, not verified here; the 252-row hash probe is the check.
- ARTIFACT_FORMAT_VERSION 591: the codec tags enum variants by name. The removed RuntimeFact,
  PushField and PrecisionNote variants leave their tags unused, which cache/mod.rs's rule says
  needs no bump: an old entry holding one fails to decode, which is a miss. No codec_struct field
  is removed. That is why SamplerDesc.ycbcr stays.

The guard hash (crates/metal2vulkan-validation/runtime-sources.sha256) moves for the bind/
sources this deletes and edits and for vk/draw.rs, which leaves its list. No run of an unchanged
artifact changes: what stays in bind/ computes what it did (the heap's tier check takes the same
storage format; its removed sampled branch had no caller).

Docs: docs/API.md (section 5 is the interface; the binding and plan sections go), README.md,
docs/ARCHITECTURE.md, docs/HOWTO.md, docs/VALIDATION.md, the runtime README's DrawInput and
identity-domain rows, docs/REFUSALS.md (regenerated; the binder's section goes),
api_reference.md, api_signatures.tsv (blessed: removals only), tests/api_surface.rs, the
signatures floor (5000), the bind modules' own docs, and the public field docs of PushField,
RuntimeFact and SpecKey that named BindState, BindShape or BindingPlan. AGENTS.md: the project
table names pipelines and their interfaces, not binding plans; its "core lives in" line stays
true (bind/ still holds what the lowering reads).

Verified on 31692939d4, this commit's tree (steelbrain/cutbinder-probe-6): job m3-max-68107,
fmt, signatures, refusal surface, clippy -D warnings (workspace plain, --cfg m2v_gpu,
--cfg m2v_cpu_icd; the translator with no feature and with each alone; the AIR crate alone),
workspace Rustdoc -D warnings, each crate's private intra-doc links at 0, api-docs; job
m3-max-68109, the product, validation and conformance suites, doctests, and on lavapipe the
validation and runtime suites under --cfg m2v_cpu_icd, the conformance replay and the public
cases' qualification.
2026-11-22 10:15:34 -08:00