Commit Graph
9139 Commits
Author SHA1 Message Date
Anees Iqbal 64cb2002f0 Writes: the status address traces through the floor's tail fold
Since the floor's tail folds into each other pushed field through an
OpSelect against null (059835018a), the ExecutionStatusAddress the
product's status words are written through is a select of its push
load, and the writes trace stopped there: a multisampled fragment that
only counts resident misses (WIDE_READ) read as writing memory of its
own. The trace now steps through an OpSelect whose one hand is a
constant, and an OpIAdd of two values ends at the status member when
one hand is that member's load, folded or not. A selection of two
values still ends the trace as the function's.

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

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

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

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

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

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

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

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

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

Verified: corpus-case-check accepted and installed both, and corpus-metal qualified both on the
M3 (apple-m3-max-macos27.0.1, job m3-max-69889). Metal's outputs equal the interleave contract's
exactly: the pairs' sha256 f616d0f9... is that of the 134 interleaves computed on the CPU, and
the sweep reads 0 differences, 0xfffe8000 and 0x643d0000, the CPU's values.

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

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

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

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

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

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

The interleave's contract was measured on an M3 Max over all 2^32 operand pairs: bit 2i of the
result is bit i of the first operand, bit 2i + 1 is bit i of the second.
2026-11-22 22:54:12 -08:00
Anees Iqbal 12f8a9f06a Identity domains: a bicubic sample at pixel coordinates
The identity domains refused every function that samples a 2D texture through a bicubic
constexpr sampler at pixel coordinates ("a bicubic filter at pixel coordinates"), though its
lowering is the normalized sample's with no position step: a pixel coordinate is already in
texels, so the emulation reads the coordinate itself, the level-0 size by OpImageQuerySizeLod of
the bound image (which under the identity domains is the slot's set-1 element), and the format's
treatment from the slot's PushField::BicubicTexels, as at normalized coordinates. Nothing in it
reads state the identity domains do not source, so the refusal goes: SamplerPlan::bicubic_pixel
and BICUBIC_PIXEL_FORM are deleted. Metal's front end admits pixel coordinates only with clamping
modes (MSL 2.10), and a mirrored axis at pixel coordinates stays refused by bicubic::check, as on
the resident-table domains. A bicubic sample of a 1D texture keeps its own refusal.

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

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

Metal reads the two forms alike: in the committed M3 observations of the three bcu_address cases
(macOS 26.7 and 27.0.1), the clamp-to-edge and clamp-to-zero samples at pixel coordinates equal
the same samplers' samples of the same point at normalized coordinates, bit for bit, on 64 of 64
lanes each. The sample keeps PrecisionNote::BicubicFilterArithmetic, as at normalized
coordinates.
2026-11-22 22:54:11 -08:00
Anees Iqbal d0139665fe Test: a bicubic sample at pixel coordinates under the identity domains
engine_identity's bicubic test now compiles bcu_address (one 2D texture sampled through bicubic
samplers at normalized and at pixel coordinates) under the identity domains and validates it: its
slot's BicubicTexels field pushed, no specialization constant. bcu_forms (a 1D texture) stays
refused with its own form. The shared bicubic switch's identity runs take the pixel sampler too:
its words per arm and every lane against the resident-table domains' lane of its candidate alone.

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

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

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

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

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

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

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

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

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

How it was verified:

- the M3 validation probe above;
- the replay's listing in m3-max-69820;
- the check that follows on this commit.
2026-11-22 22:40:56 -08:00
Anees Iqbal 4551aa9f3c Float depth upload note: names what each measured device keeps
The note RestrictedDepthUpload and the runtime README's known-gap line now say what
the upload kept on one card per vendor, under the validation layer 1.4.363.0, on a
Private 4x4 Depth32Float filled by a blit's copy_from_buffer with 16 values:

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

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

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

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

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

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

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

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

Verified: doc-only; the workspace Rustdoc line runs on development after the merge.
2026-11-22 22:36:39 -08:00
Anees Iqbal 375e4770bf Runtime README: until the sample-position setter is built, the consumer answers its query NO
What: the known gap of programmable sample positions now says what the consumer answers
programmableSamplePositionsSupported until setSamplePositions:count: is built: NO. The paragraph's
lines are reflowed.

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

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

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

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

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

The public qualification (CI's lavapipe step) now also runs it and the
public table-query case 3a8f75e182, which the runtime refused before.
2026-11-22 22:11:30 -08:00
Anees Iqbal f8b7752902 Validation fixtures: the companions of the linked module visible_table_ops
scripts/regen-air-fixtures --dir linked visible_table_ops on the M3
(m3-max-69721: Apple metal 32023.922, macOS SDK 27.2; its --check of the
directory passed). Three [[visible]] functions of the type uint(uint, uint)
that a case links into visible_table_dispatch's table.
2026-11-22 22:11:29 -08:00
Anees Iqbal 755b4b712d Runtime tests: name the entry function type in function_tables
clippy's type_complexity refused the bare fn-pointer slice under the device
cfgs (m3-max-69685, clippy_gpu).
2026-11-22 22:11:29 -08:00
Anees Iqbal 28e2b0e6ca Validation: a kernel case's visible-function tables run through the runtime
The runtime candidate makes each table the case binds of the pipeline
state (newVisibleFunctionTableWithDescriptor: of its size, each authored
entry set to the handle of its linked function made with the case's
constants, as the Metal oracle sets it) and binds it at its buffer index.
ToolingRequirement::KernelFunctionTable, which held such cases to Metal
alone, is retired; a render stage's table stays the runtime's limit
(RenderFunctionTable). ENGINE_EXECUTOR_ABI does not move: no recorded row
ran a kernel table case (they were refused).

The runtime README states the device answer, the encoder's bind, the
state's handles and tables, and the known gaps (a table's 64 KiB block, a
consumer-compiled kernel's handles, an argument buffer's table). The
coverage table marks the compute items implemented; METAL-COVERAGE.md and
CONFORMANCE-COVERAGE.md are regenerated. Adds the owned linked module
visible_table_ops.metal, whose companions scripts/regen-air-fixtures
writes on the Mac.

Verified: the lane's jobs.
2026-11-22 22:11:29 -08:00
Anees Iqbal bbb3d53484 Runtime: a compute state's visible-function tables call the functions their entries hold
A compute pipeline state answers functionHandleWithFunction: for its linked
functions (the translator's FunctionHandle words), makes visible-function
tables (newVisibleFunctionTableWithDescriptor:) whose words sit in a Shared
block the runtime takes, writes their entries (setFunction:atIndex:,
setFunctions:withRange:) and answers each table's gpuResourceID. The compute
encoder binds a table at a buffer index (setVisibleFunctionTable:atBufferIndex:)
through its buffer path, and the command buffer keeps the words until it
retires. The device answers supportsFunctionPointers YES. An entry past a
table's size is Refusal::FunctionTableIndex and writes nothing.

The translator's bind module makes the table's header and entry offsets
public, so the runtime writes the layout the shader reads.

Tests: function_tables (device cfg) dispatches through tables of two orders,
a null entry, no entries, an unbound slot and an entry set after encoding,
and compares every word; the conformance rt side runs the compute
visible-table cases. Evidence is in the lane's jobs.
2026-11-22 22:11:28 -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 0ace70d4fb Translator test: 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 builds an access chain past the arena's word array, which the builder's
range rule rejects, so the translation fails with an internal error. This test makes that atomic
through from_queries on every test profile and expects the module to build, every thread's atomic
to answer 0, and no arena word to take the add. It fails until the fix that follows.
2026-11-22 21:52:51 -08:00
Anees Iqbal fb69c81915 Authored case: the outside-the-array case's rationale says what holds, with no commit named
The rationale named the fix by a commit that a rebase replaced. It now says why the access cannot
be an access chain and what the translator makes of it. The rationale is outside the case's
identity, so its case id, input and Metal observation are unchanged.
2026-11-22 21:19:30 -08:00
Anees Iqbal 9d1c71e0b2 Authored case: a threadgroup load and store at a constant index outside the array, qualified on Metal
threadgroup-constant-index-outside-the-array-in-a-branch-no-thread-takes, over the owned
kernel_threadgroup_constant_index_outside_the_array fixture: two threadgroups of 64 threads, each
storing 3 t + 1 at tg[t], with flag = 0, so no thread runs the branch whose load and store
Apple's compiler writes at the constant index 0xFFFFFFFF of the array (an offset outside the
arena, undefined in Metal). Each thread writes out[gid] = tg[(t + 1) & 63] + tg[t]: 6 t + 5
below t = 63 and 191 at t = 63. Compared exactly.

Verified: corpus-case-check installed it (m3-max-69680: case c97238d294b9, input_sha256
91077149e913), and corpus-metal qualified it on the M3 (apple-m3-max-macos27.0.1, m3-max-69691)
with output_sha256 01a9ad8b1b5c..., the sha256 of those 128 words computed apart from Metal.
2026-11-22 21:18:45 -08:00
Anees Iqbal 44472b664c Fixture: a threadgroup load and store at a constant index outside the array, compiled from owned MSL
kernel_threadgroup_constant_index_outside_the_array reads and writes tg[t - 1u] of a 64-word
threadgroup array, the arena's only object, in a branch where t == 0 and a buffer's flag is not 0.
Apple's compiler, knowing t == 0 there, writes both as the constant GEP [67108863, 63] of the
array: the arena offset 0xFFFFFFFC, outside the arena. It is the public form of the corpus shape
that failed with an internal error (the corpus's is an inbounds GEP [0, 4294967295] instruction;
both reach the arena access with that constant offset). Compiled by scripts/regen-air-fixtures on
the M3 (metal 32023.922, SDK 27.2, recorded in TOOLCHAIN); its inventory rows are ok on every
profile.

Verified: the base translator (da020e5d7b plus a probe report) refuses the fixture's .ll with
"internal error: Build: SPIR-V builder rejected construction: Operand { op: AccessChain, rule:
Range(1) }" on runtime-floor (m3-max-69680), the corpus rows' error.
2026-11-22 21:18:45 -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 75c3e49bd6 Conformance coverage: regenerated for the overlapping-copies row's new refusal
docs/CONFORMANCE-COVERAGE.md quotes each ledger row's reason; the row's words moved with its
refusal (python3 -I scripts/conformance-coverage/coverage.py).
2026-11-22 21:06:39 -08:00
Anees Iqbal 5f4067050a Runtime test: the any-offset buffer copy test names each device and copy it ran
So a card's run shows the copies ran on that card (the path line a device leg prints).
2026-11-22 21:06:39 -08:00
Anees Iqbal c358d9afd7 Runtime: a copy between buffers takes any offsets and size, as plain Metal copies them
A guest's blit copy of 62,302 bytes at offsets 0 and 0 met Refusal::BufferCopyUnaligned. Apple's page
for copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size: asks for multiples of 4 on macOS,
but plain Metal does not stop or round such a copy: it copies every byte of the range and no other.
vkCmdCopyBuffer has no alignment rule for its regions, so the copy is its one region at the
offsets and size the call names, and the refusal is gone.

Measured with probe crates/metal2vulkan-conformance/probes/blit_buffer_copy_unaligned.m, one
universal binary (built in m3-max-69612), copies (source offset, destination offset, size) =
(0,0,62302) (0,0,1) (0,0,3) (1,0,8) (0,2,8) (3,5,4097) and the controls (0,0,64) (4,8,4096),
each between two Shared, two Managed and two Private buffers, every destination byte read back:
- Apple M3 Max, macOS 27.0.1 (26A434), job m3-max-69613: 24 of 24 exact with validation off
  (AGXG15CDevice), 24 of 24 exact under MTL_DEBUG_LAYER=1 (MTLDebugDevice), which printed only
  its banner and took every copy.
- AMD Radeon Pro 5300M and Intel UHD Graphics 630, macOS 26.7.1 (25G241), job m3-max-69614:
  24 of 24 exact on each, validation off.
Every command buffer completed with no error.

The variant, its basis line, its REFUSALS.md rows and its api_signatures.tsv line go; the runtime
README says what Metal measured. The conformance ledger's overlapping-copies row now holds the
overlap refusal its first copy meets (the alignment check ran before it). The consumer's checkout
names the variant nowhere (git grep BufferCopyUnaligned at reims-vgpu 6d83a5d4f8: 0 hits).

Test: every_device_copies_between_buffers_at_any_offset_and_size copies the six ranges between
two Shared buffers and reads every byte back; it fails without the change (the refusal).
2026-11-22 21:06:39 -08:00
Anees Iqbal 7b39f0bae9 Runtime README: on the Mac host, the first submission after an idle pause pays for the bytes in the device's residency set
On KosmicKrisp (Mesa 26.3.1, Apple M3 Max, macOS 27.0.1), a bare Vulkan program's
one-fill submission after a 2 s pause started 18.45 / 23.88 / 24.44 ms (p50 / p90 / max)
after its commit while its device held 6 x 64 MiB, 12.32 ms of it in vkQueueSubmit2 at
the median, against 8.49 / 10.74 / 11.06 ms holding nothing (14 each, m3-max-69600; the
earlier m3-max-69540 read alike). After a 0.1 s pause the held bytes cost nothing
measurable (0.77 against 0.79 ms at the median). Read from the driver's source, not
instrumented: every VkDeviceMemory is a heap in one residency set added to the device's
Metal queue, and every vkQueueSubmit2 commits that set and calls requestResidency.

A Metal reference in the same job, arms interleaved, says whose cost it is: a Metal
program holding the same 384 MiB in a residency set added to its queue, committed once
and never requested, started 19.44 / 26.15 / 26.25 ms after a 0.03 ms commit; requesting
residency before each commit moved 13.18 ms (median) into the calls and left the start
where it was (20.96 / 23.74 / 26.46 ms); the same buffers in no set read like an empty
set (7.85 against 8.37 ms at the median). A Metal 4 queue, the kind the driver uses, read
alike. So at this size and pause the delay is Metal's own for bytes in a queue's
residency set, and the driver's per-submission request moves it into vkQueueSubmit2.
The README's queue gaps now state these rows, the jobs, that the machine was shared and
that the driver was read, not instrumented.

Docs only; the workspace Rustdoc (-D warnings) and doctest check of this commit is its
own job, named where the commit is handed in.
2026-11-22 20:56:53 -08:00
Anees Iqbal da020e5d7b Runtime: a compute kernel that reaches an explicit imageblock gets its state; its dispatch is refused
A compute pipeline state whose kernel reaches an explicit imageblock was refused at its make as
Gap::KernelInput of KernelInputKind::RuntimeFact naming ImageblockSize, which every arm64 macOS
guest boot meets once. The state is now made, and what stays refused is the dispatch, where Metal
reads the extent setImageblockWidth:height: set, which the compute encoder does not have:

- interface() takes RuntimeFact::ImageblockSize, keeping its cell bytes as Interface::imageblock,
  and leaves SpecKey::ImageblockWidth and ImageblockHeight at the module's default (0 by 0)
  instead of refusing them as a specialization it does not set.
- encoder::decide, which the dispatch, prepare_dispatch, dispatch_variant and the main pipeline's
  key all go through, refuses a kernel with an imageblock first, as Gap::KernelInput of
  RuntimeFact naming the fact (RuntimeFact::name). So no VkPipeline of such a kernel is made:
  finish_pipeline has no main key, and a pre-pass gets no key. A dispatch of such a kernel that
  writes no memory records nothing and is not refused, as for any kernel without effects.
- imageblock_memory_length_for_dimensions keeps its typed answer, Gap::ImageblockLength, for a
  kernel that declares an imageblock: the one recording of Metal's answer for such a kernel
  (conformance pipeline-facts-compute-imageblock, M3 Max, 256 bytes at 8 by 4 by 3) settles no rule.

The translator is untouched. Gap and KernelInputKind keep their variants; the docs of
Gap::KernelInput, KernelInputKind::RuntimeFact and Specialization, Gap::ImageblockLength (and its
basis line), the dispatch and the state's make say where the refusal now is. docs/REFUSALS.md,
docs/METAL-COVERAGE.md (setImageblockWidth:height:'s note) and docs/CONFORMANCE-COVERAGE.md are
regenerated. The runtime README's state facts and its known gap are re-worded, with the counts and
jobs kept. The conformance ledger's pipeline-facts-compute-imageblock row moves from case/state to
the facts' label and device (the consumer's own, as for every state) and imageblock_memory_length
(Gap::ImageblockLength). Validation's KernelImageblock requirement doc and its acceptance test's doc
name the dispatch's refusal and the renamed device test.

Test: tests::kernel_input::an_explicit_imageblock_kernel_is_made_and_its_dispatch_refused_as_its_named_runtime_fact
(replacing an_explicit_imageblock_kernel_is_refused_as_its_named_runtime_fact) makes a4_imageblock_extent's
state, reads its imageblock length as Gap::ImageblockLength, gets no dispatch_variant key, and has
one 4 by 2 threadgroup's dispatch refused as Gap::KernelInput of RuntimeFact { fact: "ImageblockSize" }.
2026-11-22 20:15:34 -08:00
Anees Iqbal b2fb0993d7 Runtime README: behind another queue's long work, a command buffer waits for up to two of them
The queue section said a command buffer of another queue committed later
"waits behind no more of it", which reads as the room's 16 ms. That holds for
work within the bound only: a queue always has room for two submissions
whatever their runs, and nothing cuts a command buffer, so behind long ones
another queue's command buffer waits for up to two whole command buffers.

The sentence now says both, and the queue known gaps state the consequence
once: the burst-start count on lavapipe (three command buffers of 30 ms, two
of them, 60 ms, on the VkQueue at an idle queue's commit; job m3-max-69402,
by count, not timing), that the runtime takes no queue priority, and the
Intel Mac's answers on file (UHD 630: commit order unmarked, 0.4 ms beside the
running buffer with the busy queue at a lower GPU priority, job m3-max-68129;
5300M: both at once, job m3-max-68137).

Docs only.
2026-11-22 19:37:38 -08:00
Anees Iqbal e23ac486be Runtime: an indexed draw's command buffer keeps its index buffer until it retires
The draw path kept an indirect draw's arguments' buffer (and an execution's
range buffer) with Building::keep, but never the index buffer of
draw_indexed_primitives or draw_indexed_primitives_indirect, though both docs
say the command buffer keeps it until it retires, as Metal's command buffer
retains what its draws use. A buffer is a view of a block that holds the block
(buffer.rs), so where the buffer was its block's last holder (the consumer's
plain buffers: it drops its block handle once the buffer is made), dropping it
after encoding gave the block back at once (memory.rs Pool::give_back): its
range was a free range of its allocation, a later take could land there and
overwrite the indices before the GPU read them, and with nothing in flight the
allocation itself could go once idle. The index buffer is now kept beside the
arguments' buffer, after the draw's checks and only for a draw that records.

Test: every_device_keeps_index_buffers_dropped_before_the_commit_until_their_draws_retire
(tests/draw.rs): a direct indexed draw and an indexed indirect draw, each index
buffer the one holder of a Shared block, both dropped after encoding and before
the commit, two blocks of the same length then taken and filled with other
indices; the target reads back exact (each half its own draw's colour), neither
block is back in the pool before the retirement, and both are after it.
2026-11-22 19:36:05 -08:00
Anees Iqbal 5110fc3021 Validation: the runtime-row imports live in the Linux-only function that uses them
CI's macOS clippy under --cfg m2v_gpu (run 122057987258 at eb69a32299) denied
two unused imports in candidate/tests/acceptance_pipelines.rs: `RuntimeRow`
and `FunctionConstantValues` serve only `made`, which is
`#[cfg(target_os = "linux")]`. They now sit inside `made`, so every target
that compiles the file uses what it imports. Our own m2v_gpu clippy runs only
on Linux, which is why it did not see them.
2026-11-22 19:35:41 -08:00