Commit Graph
10266 Commits
Author SHA1 Message Date
Anees Iqbal 2fb00a15ae CI: qualify kernel_handle_word_joins's four cases on lavapipe
The public case step now runs the four authored cases of the owned fixture kernel_handle_word_joins
(a sampler or a texture taken from a branch merged at a join, as integer words in a phi and in a
select, and as pointers in a phi) against their Metal observations.

Verified: syntax only (bash -n); the cases' Metal observations and the step's run come next.
2026-12-03 05:57:30 -08:00
Anees Iqbal 4457fd001f Validation: authored cases for kernel_handle_word_joins's four entries
Four cases, one for each entry of the owned fixture kernel_handle_word_joins: sixteen threads
take a sampler or a texture from a branch merged at a join (as integer words in a phi, as words in
a select, and as pointers in a phi) and write what it samples or reads.

The sampler entries read element slot[gid] & 3 of an array<sampler, 1> through a run-time GEP
index; slot holds 4g, so the index is always the array's one element. The case checker binds only
the first slot of a sampler array (the case schema has no sampler-array resource), which is why
the array has one element; engine_handle_words compiles the same entries over an
array<sampler, 8>. The texture entry reads element slot[gid] & 3 of an array<texture2d, 4>.

Installed by corpus-case-check --install at c5bbdb25b7 (job m3-max-83477, msi), which also
translated the fixture's Metal twin (kernel_handle_word_joins.air.ll through metal-as) for all four
entries (spirv-val PASS) and ran engine_handle_words, 7 of 7 passed.
2026-12-03 05:57:29 -08:00
Anees Iqbal 2b45afa2ab Fixture: kernel_handle_word_joins's sampler entries load the element at a run-time index
The sampler entries read samplers[slot[gid] & 3] again, the structure under test: a word loaded
from a sampler-array element at a run-time index (a GEP whose index is a value, not element 0)
meets the constexpr sampler's bits at a join. The array stays an array<sampler, 1>: the authored
case checker binds only the first slot of a sampler array (the case schema has no sampler-array
resource), so the cases' slot values make the index 0 and Metal reads the one element.

engine_handle_words compiles the same three sampler entries over an array<sampler, 8>, a text edit
of the fixture's byval, GEP and argument metadata types, on every committed profile under both
policies, and checks the element's load is the clamped load over its run-time index range.

Verified: nothing yet at this commit; the next job runs the tests and llvm-dis of the twin.
2026-12-03 05:57:29 -08:00
Anees Iqbal 6bd7161ae7 Fixture: kernel_handle_word_joins's sampler entries read a one-element sampler array
The authored cases bind a sampler array's parameter at its first slot
only (the case schema has no sampler-array resource; the checker
refuses samplers 1-3 of an array<sampler, 4> as bound to nothing), so
the sampler entries now read the one element of an array<sampler, 1>
at a constant index, and their unused slot parameter is gone. The
texture entry keeps its four-element array read at a run-time index,
the same element lowering for either class. The typed twin follows
(reassembled with metal-as and linked with metallib on the M3), and
merged_handle_words_are_handle_indices expects the sampler entries'
static element load.
2026-12-03 05:57:29 -08:00
Anees Iqbal 3dbea580f1 Translator: SEMANTICS_VERSION 2346 for handle words merged at a join; their docs
Handle words merged at a join now compile where they were refused
(Lowering(Access) HandleUse), and a handle phi of a constant with one
candidate of its class where it was ConstantOperand: the output for an
unchanged key changes, so the version moves above development's 2342 (2343, which the audit lane's item also targets; renumbered at landing).

lower::access::handle's module doc says what the word webs are and
when they lower; AccessCause::ConstantOperand's doc says a handle phi's
constant is refused only without one candidate of its class.

The runtime guard's inputs are untouched (the build's hash over them,
recomputed the way build.rs does, is the committed
runtime-sources.sha256), and docs/REFUSALS.md regenerates unchanged.

Landed with SEMANTICS_VERSION 2346 (renumbered above development's 2345: ZeroAddress 2343, finding 1 2344 and 2345). runtime-sources.sha256 recomputed on development, unchanged (a92fe0a8).
2026-12-03 05:57:20 -08:00
Anees Iqbal 0367a0607a Tests: handle words merged at a join, their refusal edges, and the fixture's Metal twin
The fixture kernel_handle_word_joins.ll states in its header that it is
written from our own source and today's compiler's output for it;
kernel_handle_word_joins.air.ll is its typed-pointer twin, which xcrun
metal-as assembles for the Metal oracle (assembled and linked with
metal-as and metallib on the M3).

engine_handle_words adds:
- merged_handle_words_are_handle_indices: each entry's element load is
  the clamped element, the select merge a handle select, and each
  inttoptr (and the texture parameter's ptrtoint) a handle copy;
- an_observed_handle_word_is_refused: a merged integer with an
  arithmetic use, or stored, keeps Lowering(Access) HandleUse;
- a_handle_word_of_another_class_is_refused: a web merging a sampler's
  bits with a texture's, and one whose inttoptr makes a texture of a
  sampler's bits, are HandleAsPointer;
- a_handle_phi_of_a_constant_that_is_no_handle_of_its_class_is_refused:
  a sampler phi of a constant GEP of the sampler state is
  HandleAsPointer (provenance's class conflict refuses it before
  lowering's ConstantOperand);
- a_handle_phi_of_null_is_the_null_handle.

The fixture inventory gains the pair's eight rows, ok on every profile
(the .ll rows as the red test's run at e32daf9d9b compiled them; the
.air.ll rows expected, taken from the expectations off macOS).
2026-12-03 05:57:19 -08:00
Anees Iqbal 9e6b0df231 Translator: handles copied as integers and merged at a join are the handle of the branch taken
An older Metal frontend spells `cond ? samplers[i] : constexpr_sampler`
by copying each branch's handle as a 64-bit integer (an element of a
handle array as a plain integer load through its address, a constexpr
sampler or a handle parameter as the ptrtoint of its pointer), merging
the integers in a phi or select, and turning the merged integer back
into a handle with inttoptr. Lowering refused the integer load
(Lowering(Access), HandleUse), and the same merge of the pointers
themselves, today's form, was refused for its constant incoming value
(ConstantOperand).

Provenance now finds these word webs by structure alone
(memory::provenance::words): integers merged by phi, select, or freeze,
each a plain integer load, a ptrtoint of a pointer, a ptrtoint
constant expression, or another merge, all as wide as the pointer, and
every use another merge or an inttoptr as wide (a sink). Any other use
of an integer (arithmetic, a compare, a store, a call) or any other
operand of a merge leaves the web out, and its inttoptrs stay pointers
made from an integer. A sink of a merge joins its sources' facts while
each is a handle (a load through a handle-array element, the bits of a
handle parameter, a constexpr sampler, or null), so its candidates are
the same merge's of the handles; its class is seeded from the arrays
and merged with the converted pointers, so a web mixing classes is a
class conflict. The bits of a handle such a web carries are not an
escape.

Lowering plans each web whose sinks, loads, ptrtoints and constants all
hold one class's handles (each constant with exactly one candidate):
its integers are handle indices (HandleWord::Joined), its selects and
freezes routed to the access family, and each constant its handle
index. A handle phi takes a constant incoming value in only when the
constant has exactly one candidate of the phi's class (the null handle
or a constexpr sampler's; under the identity domains an argument
buffer's sampler takes only null, as its nil ID); any other keeps the
ConstantOperand refusal.
2026-12-03 05:57:19 -08:00
Anees Iqbal 5a6495e57c Red: name every refused entry and profile 2026-12-03 05:57:19 -08:00
Anees Iqbal 6f4090a5e0 Red: handles copied as integers and merged at a join (kernel_handle_word_joins), refused today 2026-12-03 05:57:18 -08:00
Anees Iqbal 0f4114c882 Tests: every public fixture compiles on every profile without a translator bug, at every landing
The merge check passes over golden_hashes_match_the_table and the public fixtures' inventory
tests, which are often due for a bless, so the one sweep that compiles every public fixture's
subjects on every committed profile under the runtime's policy, and refuses a translator bug (an
internal error, such as a strategy's read of an unplaced push field), ran at no landing. This
test builds the same table with the golden check's own builder and compares no hash: it fails
only on a translator bug, and its name is outside the bless-due filter.
2026-12-03 05:55:31 -08:00
Anees Iqbal 011540217d Translator: a mode-2 fragment write to a texture buffer held as words rounds half and small floats to nearest even
A texture buffer of a format a device holds as words is written by lower/texture/words.rs's
write_texel, which rounded a half-float or RG11B10Float channel toward zero at either
textureWriteRoundingMode. Metal's texture buffer rounds those to nearest even at mode 2, as its
storage texture does (the probe below). So a fragment function in a mode-2 pipeline that wrote a
half-float or RG11B10Float texture buffer on a device holding that format as words stored a code
one below Metal's on 36% to 44% of the probe's channels, and 65504 where Metal stores the infinity.

Now, where Write::half_up marks the write (a fragment function's, in a pipeline of mode 2):
- a half-float channel (R16Float and RG16Float, the half-float formats a device may hold as
  words) takes ChannelWrite::FloatNearestEven, a finite value past the largest to the infinity, as
  Metal's RGBA16Float texture buffer stores it;
- an RG11B10Float channel takes nearest even too, and a lane that rounds to the infinity from a
  finite value is held at its format's largest finite value (65024 for the 11-bit channels, 64512
  for the 10-bit one), as Metal's stores it; an infinity stays, and a NaN is the quiet NaN still.
The RGB9E5Float word's half-up rounding is unchanged; the probe shows Metal's texture buffer
storing the same bytes as its storage texture there. A write at mode 0 or 1, and every kernel's
write, still rounds toward zero.

The probe is committed as crates/metal2vulkan-conformance/probes/texture_buffer_write_rounding.m:
texture_write_rounding_storage.m with texture_buffer<T, access::write> targets, made from a Shared
buffer with MTLTextureTypeTextureBuffer and written at texel y * 256 + x, over the same 65,536
texels. On an Apple M3 Max under macOS 27.0.1 (job m3-max-83395), mode 0 matched toward zero on
every channel, and mode 2 matched nearest even on every channel that is not a NaN: RGBA16Float
float texels 262,112 of 262,112 (to the infinity past the largest), RG11B10Float float and half
texels 196,583 of 196,583 each (held at the largest), and RGB9E5Float 65,536 of 65,536 at both
texel types (half up, its hashes equal to the storage texture's).

Docs: words.rs's module doc, Write::half_up and write_texel; API.md's words line names mode 2.

SEMANTICS_VERSION moves above development's: a texture buffer write's answer changes.

Verified on the CPU with no device (job m3-max-83575): the color_write and words tests pass (79), the
golden table differs from development's (semantics 2334) in 109 cells, as at a535f1dc17, and the
refusal surface is unchanged; cargo fmt, clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd),
Rustdoc, the API reference check and the doctests pass; the suites pass 3740 of 3741 (24 skipped),
the one failure golden_hashes_match_the_table, bless due; the validation suite passes 1340 (3
skipped) and the conformance suite 1052. The states-only plays of this tree (m3-max-83669) make
what 126ee4fdf5's make (m3-max-83443): the gb-3090-r2 stream 10643 render and 15299 compute
states, the 780M windrag stream 8972 and 225, none refused.
2026-12-03 05:55:06 -08:00
Anees Iqbal 9aa7d9e7b0 Translator tests: a texture buffer's half-float and RG11B10Float words against Metal's at either mode
A texture buffer of a format a device holds as words (an R32_UINT view whose texels shaders convert)
is written by lower/texture/words.rs's write_texel. Write::half_up marks a fragment function's write
in a pipeline of textureWriteRoundingMode 2, but write_texel applies it to the RGB9E5Float word
alone: a half-float or RG11B10Float channel is rounded toward zero at either mode. Metal's texture
buffer rounds those to nearest even at mode 2, as its storage texture does: the conformance probe
texture_write_rounding_storage with texture buffers for targets, on an Apple M3 Max under macOS
27.0.1 (job m3-max-83395), matched toward zero on every channel at mode 0, and at mode 2 nearest
even on every channel that is not a NaN: an RGBA16Float channel past the largest finite value to the
infinity (262,112 of 262,112), an RG11B10Float one held at the largest finite value (196,583 of
196,583, for float texels and for texels rounded to half).

This adds a no-device test of the words against the probe's hashes, the way
rgb9e5_words_are_metals_at_either_mode holds the RGB9E5Float word, through the test hook
texture::written_words: lower/arith/tests/color_write.rs
half_and_small_float_words_are_metals_at_either_mode runs the words on the interpreter over the
probe's 65,536 texels and compares the FNV-1a hash of the words with Metal's at each mode:
RGBA16Float's texel (float texels) as RG16Float's words of red and green and of blue and alpha,
since RG16Float and R16Float are the half-float formats a device may hold as words and RGBA16Float
is not one, and RG11B10Float's (float texels and texels rounded to half).

At this commit the test fails at mode 2; mode 0 matches Metal.

Verified on the CPU with no device (job m3-max-83575): with words.rs at this commit the test fails
at mode 2, and half_and_small_float_words_convert_only_values_in_range passes.
2026-12-03 05:55:06 -08:00
Anees Iqbal aa2355716b Translator: a half-float or RG11B10Float texel held as words converts only values in range
lower/texture/words.rs's small_float_bits, which gives the codes of a half-float or RG11B10Float
texel a texture buffer held as words stores, computed every lane's denormal code (the lane's
value times 2^(14 + m), converted by OpConvertFToU) before a select kept it only for a denormal
lane. A normal lane of 2^(18 - m) or more (256 for a half float, 4096 for an 11-bit float, 8192
for a 10-bit one), and every infinity or NaN, reached the conversion past u32, which SPIR-V leaves
undefined; the select dropped what it gave, so no device was seen to store a wrong code, but the
module relied on an undefined operation for every such write.

Now a normal lane (an infinity and a NaN included) converts zero: the lane's magnitude bits are
selected to zero before the multiply, so every conversion takes a value below 2^m. A denormal
lane's code is unchanged, and the select still takes a normal lane's code from its exponent and
fraction. One select more per texel write.

SEMANTICS_VERSION moves above development's: the module of a write to a texture buffer held as
words changes.

Verified on the CPU with no device (job m3-max-83575): with words.rs at 16777dc811 the test
half_and_small_float_words_convert_only_values_in_range fails, the interpreter trapping
ConversionOutOfRange, and with this commit's words.rs it passes. The golden table differs from
development's (semantics 2334) in 109 cells at this commit and in 80 at 126ee4fdf5.
2026-12-03 05:55:05 -08:00
Anees Iqbal 5458510f15 Translator tests: a half-float or RG11B10Float texel held as words converts only values in range
A texture buffer of a format a device holds as words (an R32_UINT view whose texels shaders
convert) is written by lower/texture/words.rs's write_texel, whose half-float and RG11B10Float
codes come from small_float_bits. That function computes every lane's denormal code, the lane's
value times 2^(14 + m) converted by OpConvertFToU, before a select keeps it only for a denormal
lane. A normal lane of 2^(18 - m) or more (256 for a half float, 4096 for an 11-bit float, 8192
for a 10-bit one), and every infinity or NaN, reaches that conversion past u32, and SPIR-V leaves
OpConvertFToU of a value its result type cannot hold undefined, whatever a device returns for it.

This adds a no-device test and the hook it needs (texture::written_words, a write_texel of a
format held as words, under cfg(test) alone): lower/arith/tests/color_write.rs
half_and_small_float_words_convert_only_values_in_range writes RG16Float and RG11B10Float texels
of normal, past-largest, infinite and denormal lanes on the interpreter, which traps an
out-of-range conversion, and checks each texel's words against the format's codes.

At this commit the test fails: the interpreter traps ConversionOutOfRange on RG16Float's first
texel (256, -65504).
2026-12-03 05:55:05 -08:00
Anees Iqbal 7e8d556729 Translator: place_zero_address says where it places ZeroAddress unread
A read at an offset the memory plan proves one value is checked at emission only where its
emitted offset is not a constant, which placement cannot know, so the field follows every read
of a checked device-address slot and is placed unread where each such read's emitted offset is a
constant: 17 golden cells on Linux's profiles move for that (fragment_discard_hoist's
hoisted_written_read on 12, kernel_dynamic_cursor_across_a_call on 5; job m3-max-83594).

Moving the check decision into the plan (an access the memory plan proves fixed is not checked)
places the field exactly, but drops the in-shader check from every such access whose emitted
offset is not a constant: 90 golden cells moved (job m3-max-83613). That widens containment's
behaviour beyond this fix and is not taken here.
2026-12-03 05:54:55 -08:00
Anees Iqbal ba12a233ef Tests: the mixed-load sweep says why it covers every push field a strategy reads
The plan lists the fields it places; its strategies read theirs at emission, which refuses a read
of any field the plan did not place, so a compile that succeeds read none: the sweep checks every
field for its kernel, not ZeroAddress alone.
2026-12-03 05:54:55 -08:00
Anees Iqbal d27d09854d Runtime tests: the select load runs in the address form too, on every device
A device's description without pipelineRobustness makes its translator reach a kernel's buffers
at their device addresses, the form the unplaced ZeroAddress broke; the test asserts the form
and names it beside the device, so a run on a card that binds its kernels' buffers shows both.
2026-12-03 05:54:55 -08:00
Anees Iqbal b13f800a04 Tests: the mixed-load sweep takes a profile's typed refusal of the 64-bit atomic as its answer
moltenvk-m3 and runtime-floor lack shaderBufferInt64Atomics and refuse the kernel's typed
atomic, a typed refusal and not a placement failure (job m3-max-83546).
2026-12-03 05:54:54 -08:00
Anees Iqbal 237ed8d8c5 Runtime tests: a load through a select of a typed atomic's slot and another reads both slots on every device
The translator's ADDRESSED_AND_VIEWED kernel in one threadgroup of 64 through the runtime: the
atomics are exact, each load reads its slot's memory (1 to 64 for words[0], at most the sum for
wide's low word), and nothing past the last thread's word changes.
2026-12-03 05:54:54 -08:00
Anees Iqbal 423fbce843 Translator: ZeroAddress is placed where a read may be checked on a device-address slot
Under the identity domains a kernel whose load reaches a typed atomic's device-address slot or
another slot through one pointer select ended in the invariant 'a strategy reads the unplaced
push field ZeroAddress' on every committed profile in the address form (lavapipe, RADV, ANV,
NVIDIA's address form): the select's load is at an offset the memory plan proves constant, so it
noted no variable read and placed no ZeroAddress, but a store at a variable offset made its slot
checked, and the emitted load, whose offset is not a constant there, took the check and read
the zero range outside.

Placement now follows use. note_variable records every read's slot at any offset
(AccessPlan::read) and no longer places the field; place_zero_address decides it once the slots'
forms are final: placed where a slot of variable that a read reaches is in the device-address
form (a memory-plan slot or a pulled fetch's own source), and removed elsewhere, which subsumes
the bound form's removal where no checked slot was left.

SEMANTICS_VERSION 2342 -> 2343: the push layout of a kernel with such a read moves.
2026-12-03 05:54:54 -08:00
Anees Iqbal 2bd4f51c59 Tests: every push field a load through an address or a view reads is placed, on every identity profile (red)
Under the identity domains a kernel whose load may reach a typed atomic's device-address slot
or another slot ends in the invariant 'a strategy reads the unplaced push field ZeroAddress'
on some profiles. The test compiles and links ADDRESSED_AND_VIEWED on every committed profile
in the address form and the bound form and lists each that fails.
2026-12-03 05:54:54 -08:00
Anees Iqbal b5b1be55e0 Runtime: the device tests' failed allocation is no seam in the product
Core::fails_private stood in the product build as a method that always
returned false, called on every allocation; only its field was gated to the
device tests. The method now carries the field's cfg
(all(test, any(m2v_gpu, m2v_cpu_icd))), and allocate_spilling calls it only
in that cfg: the product build's first allocation is the plain allocate
call.

Verified in job m3-max-83684 (lavapipe): clippy of metal2vulkan-runtime with
all features (lib, bins, examples) and, under --cfg m2v_cpu_icd and
--cfg m2v_gpu, all targets, each EXIT=0; the product build's expanded source
(cargo rustc --lib -Zunpretty=expanded, 70,849 lines) holds neither
fails_private nor fail_private; the device tests that set the field,
tests::spill::on_device::every_device_spills_private_memory_out_of_device_memory
and tests::sites::on_device::every_device_counts_each_allocation_site_apart,
2 passed.
2026-12-03 05:54:54 -08:00
Anees Iqbal b01c896bf8 rt README: the RX 7900 XTX makes the extended linear image of a texture written through a view
The view-storage known gap lists the cards whose own linear query makes the extended image of a
2 by 2 RGBA8Unorm_sRGB texture written through its RGBA8Unorm view. The RX 7900 XTX (RADV NAVI31)
now answers too, from job m3-max-83587 at 13c13835b0, run through the device tests in
storage_element and copy_cause, all 5 passed:
- over a Shared block of the runtime's, None for both the viewed and the written texture, so it is
  made in place;
- over host memory's import, HostMemory, the copy every discrete card makes there;
- over a dma-buf's import, DmaBuf, as the RX 550 and the 780M answer;
- under the stand-in that refuses the extended image, ViewStorage, with the copy pair moving
  (2, 32), and in place refused for ViewStorage.

Docs only. The README is no runtime-sources input.
2026-12-03 05:54:54 -08:00
Anees Iqbal e28e41be55 rt README: which cards make the extended linear image of a texture written through a view
The known gap for OverCause::ViewStorage now names what the lab's cards answered, read from
every_device_lands_a_write_through_a_view_of_a_texture_over_a_buffer's own-query arm at 13c13835b0
for a 2 by 2 RGBA8Unorm_sRGB texture written through its RGBA8Unorm view, with PixelFormatView
usage and without:

- RTX 3090 (NVIDIA 620.70.06, job m3-max-83540) and RTX 2080 (job m3-max-83541): in place over a
  Shared block; HostMemory over host memory's import (discrete, so the external query is never
  asked); no memory type taken for a udmabuf.
- RX 550 (RADV, Mesa 26.2.6, job m3-max-83542): in place over a Shared block; HostMemory over host
  memory; DmaBuf over a dma-buf, with the stand-in and without, so not a refusal of the extended
  plan.
- Radeon 780M Phoenix (job m3-max-83545) and Hawk Point (job m3-max-83560): in place over a Shared
  block and over host memory's import; DmaBuf over a dma-buf as on the RX 550.
- Iris Xe (ANV, Mesa 26.2.6, job m3-max-83544) and lavapipe (job m3-max-83537): in place over all
  three.

So no lab card reached makes the plain linear image and refuses the extended one. The RX 7900 XTX
waited behind the consumer's GPU job, the RTX 5080 Laptop was held for a pin's round legs, and the
UHD 630 (Windows) was not reached; the README already records that the UHD 630's optimal query
makes no extended image, so its plan is never extended and this copy cannot arise there.
2026-12-03 05:54:54 -08:00
Anees Iqbal 440a65cddf Tests: the view-storage make test names its memories' type
Clippy's type_complexity under --cfg m2v_gpu and --cfg m2v_cpu_icd (job m3-max-83521) refused the
memories' inline tuple type; it is the alias Memory now.
2026-12-03 05:54:54 -08:00
Anees Iqbal b927c5c38a Tests: the view-storage make test asks a dma-buf's import too; the in-place test keeps its probes
every_device_lands_a_write_through_a_view_of_a_texture_over_a_buffer now also makes both textures
over a dma-buf's one import (Linux, through /dev/udmabuf, where the device imports dma-bufs and takes
a type for it), whose linear image the device's external query answers for the dma-buf's handle: the
answer it prints for each card is whether that query makes the image extended for the views'
storage. Under the stand-in the expected cause now follows the device's own answer over the same
memory: ViewStorage where its own was in place or ViewStorage, its own elsewhere (HostMemory over
host memory on a discrete device, a dma-buf's on a device without the foreign queue family).

every_device_refuses_in_place_alone_a_texture_whose_linear_image_stores_no_view failed on the RTX
2080 (job m3-max-83526): it compared the textures gauge across the refusals while the texture it had
just made to read the optimal image's usage was being freed by the reaper, which lowers the gauge
when it frees it. It now keeps each such texture until every make is refused, as copy_cause's test
keeps its textures. The same test passed on the RTX 3090 (job m3-max-83525) and lavapipe (job
m3-max-83492), where the free had landed first.
2026-12-03 05:54:53 -08:00
Anees Iqbal 52d9228512 RUNTIME_VERSION 2560: a texture over a buffer whose linear image is made plain alone for its views' storage is the counted copy
A run of an unchanged artifact may now do something else: where a texture over a buffer, planned
extended for its views' storage, had a linear image the device makes plain alone, the write through
the view that was Gap::StorageElement (Unextended) at dispatch now runs and lands through the counted
copy (OverCause::ViewStorage), and new_texture_in_place refuses that texture
(TextureNotInPlace { cause: ViewStorage }) where it made it plain in place. Main renumbers at
landing.
2026-12-03 05:54:53 -08:00
Anees Iqbal f1347e5d1f rt: a texture over a buffer whose linear image is made plain alone for its views' storage is the counted copy
Where a texture over a buffer was planned extended for its views' storage (Plan::extended: shader
writes, an own format the device does not store, and a listed view format it does, which the
optimal image format query took), and the linear image query (for the buffer's import handle where
it has one) refused the extended linear image or a listed format's linear tiling lacked the storage
features while the plain linear image held, check_over made the texture plain in place. A write
through the stored view then had no storage element: Gap::StorageElement,
StorageElementCase::Unextended at dispatch, and the guest's write did not land. Metal keeps it.

check_over now answers OverCause::ViewStorage there (Spilled where the block spilled), whatever made
the plan extended (PixelFormatView with ShaderWrite, or an 8-bit sRGB texture's unorm sibling with
ShaderWrite alone), and the plain-in-place fallback is gone. One decision serves all three calls:
Buffer::new_texture makes the counted copy (rule 3's existing clause for a format query that offers
no linear image for the format and usage), whose optimal image keeps the extended plan, so the write
lands and its copies count in over_copies_view_storage; new_texture_in_place and its fenced form
refuse with TextureNotInPlace { cause: ViewStorage }; texture_copy_cause answers ViewStorage. No new
form and no rule 2 clause. Over a buffer, Unextended is now reachable only where the optimal query
itself refuses the extended image (the copy's image takes that plan too), as for Device::new_texture.

Docs: the runtime README's extended-usage entry, the over-copy cause list, texture_copy_cause's
descriptor-only causes and a known gap naming ViewStorage's copies and their two counters; the
public docs of new_texture, new_texture_in_place and texture_copy_cause; View's unextended.
docs/REFUSALS.md and api_signatures.tsv regenerated, no change here; runtime-sources fingerprint
unchanged (pin-compute).
2026-12-03 05:54:53 -08:00
Anees Iqbal b9eb93c4c0 Tests: a write through a view of a texture over a buffer whose linear image is not extended lands (red)
A texture over a buffer that shaders write through a view of another format (PixelFormatView with
ShaderWrite, or an 8-bit sRGB texture's unorm sibling with ShaderWrite alone), whose own format the
device does not store, needs its image extended for that view's storage. Where the device's linear
image query refuses the extended image but makes the plain one, check_over makes the texture plain
in place, its view has no storage element, and the guest's write is Gap::StorageElement
(StorageElementCase::Unextended) at dispatch and does not land. Metal keeps it.

This commit adds what the fix needs to name and the tests that fail without it:

- OverCause::ViewStorage, with Metrics::over_copies_view_storage and
  over_copy_bytes_view_storage, counted like every other cause (the device-free over_causes test
  covers its pair; the replay player's metric list, its over-frames own-image part and the
  stream test's decline list name it). No code answers it yet.
- A device-test stand-in, Core's extended_linear_refused, which makes linear_extent answer no
  image for an extended plan, as a device whose linear tiling or external image query makes the
  plain image alone does. The field and its read exist only under
  cfg(all(test, any(m2v_gpu, m2v_cpu_icd))), as fail_private's field does.
- storage_element.rs: every_device_lands_a_write_through_a_view_of_a_texture_over_a_buffer (both
  textures, over a Shared block and host memory's import, with the device's own query, which it
  prints, and with the stand-in: the cause answered, the form made equal to it, the view-storage
  pair counted, the write through the RGBA8Unorm view landing in the buffer's bytes);
  every_device_refuses_in_place_alone_a_texture_whose_linear_image_stores_no_view
  (new_texture_in_place, without an index, and fenced: TextureNotInPlace naming the cause, no
  texture, no copy, no fence call); every_device_keeps_in_place_a_texture_over_a_buffer_that_
  shaders_do_not_write (PixelFormatView without ShaderWrite stays in place).

api_signatures.tsv blessed for the new variant and fields; docs/REFUSALS.md regenerated (no
change); the runtime-sources fingerprint is unchanged (pin-compute).
2026-12-03 05:54:53 -08:00
Anees Iqbal 14c37cc76d Bless at pin S: the golden hash table and the authored compile census
The golden hash table moves 50 rows, 154 cells, and its semantics line goes from 2334 to 2342.
150 of the cells are in the three ANV profiles that hold a texture buffer as words
(intel-irisxe-anv, intel-irisxe-rplp-anv and intel-uhd770-rpls-anv, 50 each), and 4 in
runtime-floor (a8r_buffers and tb_word_formats). Every moved subject reaches a texture buffer, as the
usage-keyed words (1c68dd10f4) do; ARL and every other profile are unchanged. The engine inventory
and the air_input printouts bless unchanged, and the metallib half of
committed_air_fixtures_parse_and_link passes on the M3's SDK (bless job m3-max-83447, at
126ee4fdf5; the commits after it touch only the validation crate's word scan).

The authored compile census recompiled every cell: 2369 cases, 9 profiles, 21,321 cells, 0 cached;
19,106 compiled, 2,215 refused, 0 failed, 0 regressions (census job m3-max-83675, on a Linux lab node
that holds a copy of the private corpus; its run at pin R, m3-max-83628, gave the M3's table at R
exactly, every artifact digest included). Its two differences are the helper-thread case's
new identity, f03c5415 replaced by aa05a38c3b41 (31b2964425); 111 rows move only their artifact
digests, and the artifacts_at line moves to this build.

The census's first run at 126ee4fdf5 (m3-max-83448) stopped 432 cells, the 48 linked
quantized-matrix-multiply cases on every profile, at the case worker's deadline: the output-word
scan hung at admission, which the three commits before this one fix.
2026-12-03 05:43:42 -08:00
Anees Iqbal 579badf5c9 Validation tests: the loop-carried pointer's phi lists its two steps before the buffer
What: the phi of a_pointer_a_loop_carries_on_two_paths_is_answered_once lists the pointers its
two steps carry before the buffer argument.

Why: the old recursion stopped reading a phi's arms at the first whose object differs from its
first arm's. With the buffer first, the first step's answer (the cut, through the cycle) differed
at once and the second step was never read, so the test passed on the old scan (red-green job
m3-max-83650, Linux: 2 of the 3 bounded tests failed red). With the steps first, the first two
arms both answer the cut, each read in full, and the old walk answers about 2^32 values.

Verified: nothing run at this commit yet; its red run puts output_words.rs at 6a2870813f.
2026-12-03 05:33:50 -08:00
Anees Iqbal 6de0ea00f9 Validation: the output-word scan answers each value once in base, address and affine
What: the scan's three recursive analyses (the object a pointer points into, a store's offset
from its buffer argument, and an integer affine in a grid component) each keep one answer per
instruction of the entry, filled by one iterative walk (solve) that reads each operand's answer
once. A value is answered from the module once a scan instead of once for every path to it.

Why: each analysis recursed into every operand with no memo, bounded only by depth 64. A select
or phi reads both arms and an add both operands, so a shared chain cost 2^depth answers, and a
pointer a loop carries on two paths through one phi cost about 2^32 per call. The 48 quantized
matrix-multiply cases of pin S's authored-compile census (432 cells) stopped at their 380 s
ceiling in the scan's admission, before any compile: a model of base() over the bisected case's
AIR counts about 1.8e11 answers in writes() alone, from eight calls through its loop-carried
pointer phis.

How the answers stay the same: the old cut (depth > 64 answers Base::Other or None) is absorbing
in every combination (a GEP or cast passes its operand's answer on, a select or phi of differing
objects is Other, and every affine and address step is None where an operand is), so the old
answer at depth 0 is the cut exactly where a chain of more than 64 links lies below the value,
and otherwise the uncut combination. The memo keeps each value's longest chain below it (capped
at 65) and answers the cut past 64. A value read again while it is being answered lies on a
cycle, whose chain has no end: it answers the cut, as the old recursion did where it ended. An
affine operator other than +, -, *, << and | is None without reading its operands, as before. No
version moves: the scan's answers are unchanged.

The visit counter (cfg(test)) counts one visit for each value an analysis answers from the
module; the three tests of the previous commit bound it at 1,000.
2026-12-03 05:30:46 -08:00
Anees Iqbal 6a2870813f Validation tests: the output-word scan answers each value of shared index and pointer chains within a counted bound
What: a cfg(test) counter of the values the scan's three recursive analyses (base, address,
affine) answer, which panics past the bound a test sets, and three tests over synthetic kernels
of our own: a GEP index built from 40 adds of the last link to itself, a store pointer through
40 and through 70 selects of one pointer, and a pointer a loop carries on two paths through one
phi. Each asserts the scan's answer (the placed store at 2^42 * tid bytes, the store into the
buffer, the unrooted pointer past 64 links and on the cycle) within 1,000 answered values.

Why: pin S's authored-compile census stopped 432 cells (the 48 quantized matrix-multiply cases
on all 9 profiles) at their 380 s ceiling with no compile, first bad commit e31bc61172 (main's
bisect). The scan's recursions answer a shared operand again for every path to it, bounded only
by depth 64: a model of base() over the bisected case's loop-carried pointer phis counts about
1.8e11 answers in writes() alone. These tests are red at this commit (the old walk passes the
bound) and turn green with the memo that follows.

Verified: nothing run yet at this commit; the red and green run is one Linux potluck job.
2026-12-03 05:27:03 -08:00
Anees Iqbal 126ee4fdf5 Runtime: a restoring make waits for its restore's batch, not for a group's command buffers
A texture made in place over host memory's import on a unified device restores the bytes under
its image inside the make, and waits for the progress value Work::flush gives: the submit thread's
next submission's. Where a group goes at that turn, the flushed uploads went ahead of the group's
command buffers in the same batch, with one signal at the batch's end, so the make waited for the
guest's command buffers too. The consumer's walk on the Iris Xe saw restoring makes take up to
63.9 ms (9 spans of one photo-decode step, 67.4 ms in all) where the runtime's own makes take
about 3.5 ms.

Now a flush the host waits for (Work::flush, the staging waits, the surface and block ready
waits) marks its uploads awaited. Where a group's submission takes them, WorkState::close gives
them the progress value below the group's first, the value the flush returned, and submit has the
last of them signal it: their batch ends there, ahead of the group's, in the same vkQueueSubmit2.
The make waits for that batch alone. The pre-wait for the work already submitted is unchanged, so
a group submitted between that wait and the flush still lands ahead of the restore on the queue,
and the make still waits for it.

Two cases keep the group's signal:
- uploads that use memory another API shares (a surface plane or an exported block, held or read
  by the uploads' copies) signal no value of their own: that memory is the other API's again only
  at the first part's release, after the part's command buffers, so the wait is for the part's
  value, as before;
- a batch signals a timeline semaphore once (Vulkan 1.4, section 7.2), so where nothing follows
  the uploads in their part, parts gives the part's value in place of theirs.

A flush nobody waits for (the half-region staging flush, the release of held bytes) adds no batch:
its uploads go with the group's command buffers as before.

Docs: submit.rs's module doc and the flush docs; texture.rs's restore comment, RestoreFence and
Buffer::new_texture; Block::wait_until_ready and Surface::wait_until_ready; the runtime README's
restore paragraph, the fence's span, the known gap's span sentence and the two ready waits.

RUNTIME_VERSION moves to the next number above development's: a restoring make, a getBytes read
and the ready waits now end at the uploads' own batch.

Tests:
- restore_batch.rs each_device_returns_from_a_restoring_make_ahead_of_a_groups_command_buffers
  (the commit before this one) passes;
- plane_parts.rs uploads_with_a_value_of_their_own_end_a_batch_that_signals_it_once: uploads that
  signal their own value end a batch of their own ahead of the group's segment, and alone in their
  part they signal the part's value once.

runtime-sources.sha256 is unchanged (a92fe0a8): it covers none of the files this edits.

Verified:
- red, submit.rs at the commit before this one: restore_batch hangs and fails after 10 s, and
  plane_parts' new test fails (the uploads' value and the part's in one batch), on lavapipe
  (llvmpipe, LLVM 23.1.1, job m3-max-83370) and on the Iris Xe (RPL-P, ANV, job m3-max-83373);
- green: restore_batch passes, the make returning with the fill's command buffer Scheduled, and
  plane_parts 4 of 4, on both; the runtime's suite on lavapipe 985 passed (4 skipped), job
  m3-max-83370, and on the Iris Xe 987 passed (4 skipped), job m3-max-83383;
- job m3-max-83370: fmt, the signatures, clippy plain, with --cfg m2v_gpu and with
  --cfg m2v_cpu_icd, rustdoc, the private rustdoc and the API reference check passed; the suites
  3738 of 3739 passed (24 skipped), the one failure the golden table, a bless due on development;
  validation 1337 passed (3 skipped); conformance 1052 passed; the doctests passed.
2026-12-03 04:41:35 -08:00
Anees Iqbal b975709ed0 Runtime tests: a restoring make whose restore goes with a group's command buffers
A texture made in place over host memory's import on a unified device restores the bytes under
its image inside the make: the make flushes the upload that saves them, moves the image home and
writes them back, and waits for the progress value the flush gives (texture.rs). That value is the
submit thread's next submission's. Where a group goes at that turn, its command buffers ride in the
same batch behind the upload, with one signal at their end, so the make waits for them too. The
consumer's walk on the Iris Xe saw restoring makes take up to 63.9 ms where the runtime's own
makes take about 3.5 ms.

This adds a device test that puts the restore and a group's command buffer in one submission and
holds the group's batch back on the GPU, and the test hooks it needs, under the device cfgs alone:
- Work::pause and Work::resume hold the submit thread between passes;
- Work::flushing says whether a flush waits for the thread to send the uploads;
- Work::hold_next has the first segment of the next submission of a group's command buffers wait
  on the GPU for a timeline semaphore the test signals.

restore_batch.rs each_device_returns_from_a_restoring_make_ahead_of_a_groups_command_buffers: on
a unified device whose texture over the import is in place, the test pauses the submit thread,
commits a fill of a buffer of its own, makes the texture on a thread of its own until its restore
is flushed, holds the fill's segment behind the test's semaphore and lets the thread pass. The make
must return while the fill's command buffer has not completed. Ten seconds after the thread passes
again, the test signals the semaphore and fails.

At this commit the test fails: the make waits for the fill's command buffer. Verified with
submit.rs at this commit under the next commit's tests:
- on lavapipe (llvmpipe, LLVM 23.1.1), job m3-max-83370: "the make did not return within 10s
  while the fill's command buffer, in the same submission as its restore, waited for the test's
  semaphore";
- on the Iris Xe (RPL-P, ANV), job m3-max-83373: the same.
2026-12-03 04:41:35 -08:00
Anees Iqbal 4b328ca9e2 Validation: a fragment function's render-target words are fed by the colour it returns
What: the word scan (check::output_words) now follows a fragment case's render target to the
colour its entry returns for that attachment, as it already followed a kernel's output buffer to
its stores. Before, every render-target word was fed by Family::Unknown, so every recorded note
reached every word of every fragment case by fall-back.

How:
- The scan records a fragment entry's returned value by field (Stores::returned): the
  families of each lane of each field, joined over its returns. Where a return or a
  air.discard_fragment sits in a block that does not post-dominate the entry, every lane is also
  fed by every branch condition, as a conditional store is.
- A render target's words (render_target_words): each channel of a texel takes the families of
  the lane of the returned colour it holds (every lane where the colour has fewer lanes than the
  format has channels), with those of the entry's other live outputs that decide whether or how
  the write lands: a depth, a sample mask, a stencil reference, the second blend source. The
  facts repeat every texel (every word for a texel under four bytes); the word's lanes still come
  from the target's format. A target with no live colour from the entry (an imageblock writes
  it), an attachment index that is not a constant, a vertex case's observed render target, and a
  returned value the scan does not follow keep the fall-back.
- air.quad_is_helper_thread and air.simd_is_helper_thread feed Family::Group: whether a thread is
  a helper is its place in its quad, which FragmentSimdgroupGrouping and QuadsSplitByClipping
  concern. They fed Family::Unknown before.

Tests (check::output_words::tests): a_render_targets_words_take_the_returned_colours_operations
(the public case unclamped-and-clamped-lod-of-a-texture-selected-per-quad: red and green fed by
the texture queries and the position, blue and alpha by nothing, so a texture note reaches the
first two words of a texel and NativeDot none) and
a_helper_query_and_a_discard_feed_a_render_targets_words (helper queries and quad ballots feed
Group alone; a discard the position decides adds the position and its arithmetic). Both read
every word as Unknown without the change.

ENGINE_EXECUTOR_ABI is v216: rows record different word facts for fragment render targets, and
how their differing words are judged changed.

Verified (at 33873ab651, this commit's tree):
- Gate: fmt, clippy with --workspace --all-targets --all-features -D warnings plain, under
  --cfg m2v_gpu and under --cfg m2v_cpu_icd, and rustdoc -D warnings, all exit 0 (job
  m3-max-83339). Validation suite: 1339 passed, 3 skipped (job m3-max-83340); in the same job the
  two new tests pass, and both fail with output_words.rs and words.rs put back to the parent.
- The public cases (1,168), noted / matched only within bounds / mismatch cases (batch-words),
  before at 31b2964425 and after:
  - lavapipe (x86): 156 / 27 / 10 before (job m3-max-83318) and after (job m3-max-83341); every
    row keeps its outcome and gap; 15 rows lose their fall-back words. Cases with a word on the
    fall-back: 571 to 488; with a differing one: 37 to 22.
  - AMD Radeon 780M (RADV PHOENIX, Mesa 26.2.6): 171 / 24 / 16 before (job m3-max-83332), 170 /
    24 / 17 after (job m3-max-83385). Every mismatch is held by a gap, before (21) and after (22):
    no new mismatch. One row moves: three-color-inputs-tag-attachment (c261f487), from a noted
    difference to a mismatch held as ordered_fetch_within_draw. Its target is the r32_uint tag,
    tag * 5 + as_type<uint>(color.x) of the attachments it fetches: no half conversion feeds it,
    so NativeHalfConversion, which reached its 16 differing words only by fall-back, no longer
    excuses them; UnorderedFetchWithinDraw reaches them. Cases with a word on the fall-back: 605
    to 515; with a differing one: 58 to 33.

Landed with ENGINE_EXECUTOR_ABI vulkan-engine-v217 (renumbered above development's v216, the half-arithmetic family); docs/VALIDATION.md merged by hand with that change's half family wording. runtime-sources.sha256 unchanged (a92fe0a8).
2026-12-03 04:36:37 -08:00
Anees Iqbal a3c5682883 AGENTS.md: rule 3's first exception is a texture over a buffer of any storage mode
The planner's wording ruling of 12-03. Rule 3 named the linear-image exception for "a texture
over a Shared buffer", but the runtime takes the device's linear image in place over a buffer of
every storage mode (texture.rs check_over and over_descriptor; the runtime README's
Buffer::new_texture entry): Private, Managed (its device copy), Shared and the imports. Metal's
newTextureWithDescriptor:offset:bytesPerRow: aliases the buffer's bytes in every mode, and an
optimal image there would need a copy per use, which rule 3 forbids. So the code is right and
the sentence was narrower than meant. This is a wording correction, not a growth: still two
exceptions, no new form, no new copy. Rule 2's unified-memory clause is unchanged.

Found by the audit lane's read of rule 3 against the code at 6e83de343d; the planner read the
same sites at 9211eb3c10.
2026-12-03 04:29:37 -08:00
Anees Iqbal 9211eb3c10 Translator: half +, -, *, / and fma on the 16-bit instructions record NativeHalfConversion
Under the 16-bit float controls, a half +, -, * or / and a half fused multiply-add run on the
device's 16-bit instructions, between exact conversions. By the Vulkan spec their results are
Metal's. A driver's compiler may still compute them in float and leave them unrounded. Intel's
Windows driver 101.2145 on a UHD Graphics 630 does:

- A standalone tree of three 16-bit OpFAdds, or Fmas of a product, each decorated NoContraction
  under all three 16-bit controls, ran on 4,096 invocations. 2,284 sums and 4,080 products
  matched neither the half tree nor the float tree rounded once (job m3-max-83092).
- The Iris Xe under Mesa ANV 26.2.6 gave the half tree on every invocation (job m3-max-83093).
- In the runtime's quad test on the UHD, 112 of the 1,536 compared halves are the float chain
  rounded once at the store (job m3-max-82918).

Per the planner's ruling, the operation carries the static note on every device, with no device
check. narrow::computes_half_arithmetic looks in the emitted module for a 16-bit OpFAdd, OpFSub,
OpFMul, OpVectorTimesScalar or OpFDiv, or a GLSL.std.450 Fma. Where it finds one, the pipeline
records NativeHalfConversion, beside the conversion pair's existing cases. A Sqrt alone records
nothing, and neither does the simdgroup half tree's ClusteredReduce.

The note's reach in validation narrows to half arithmetic. Until now it reached every word fed by
any float family. The AIR word scan now feeds a new family, HalfArithmetic, beside the
operation's own family, from these operations:
- an fadd, fsub, fmul, fdiv, frem or fneg with a half result;
- a float cast whose result or operand is a half;
- a call of a modelled family whose result or an argument is a half.
NativeHalfConversion reaches only that family. A half word that only float arithmetic fed,
through a move, is no longer reached. The note stays unbounded at the word, now on the
comparison's stay-unbounded list with its reason. A driver may leave the chain unrounded and
round it once at the store, and with cancellation the two answers differ by more than the stored
value's ulps (40 codes measured on the UHD). How far rests on the operands, which a word does
not carry.

Docs:
- The note's API.md catalogue entry and its PrecisionNote doc said those operations "take no such
  rounding". They now say the operations record the note, and give the UHD 630 measurement beside
  NVIDIA's fold and RADV's fusion.
- The DeviceHalfDenormals entry points to it.
- VALIDATION.md names the half family among those the word scan reads.

Tests:
- engine_native_half: the controlled-conversion test's sum kernel now records the note, as every
  kernel there does.
- engine_float_call_notes sets the module-level note aside for 16-bit arithmetic, as it does for
  the conversion pair.
- half_simd_reductions accepts, where the quad pipeline records the note, a quad word whose
  every half is Metal's or the float operations rounded once. The model is the new devtools
  quads_once.
- In validation:
  - the scan's packed-halves test expects HalfArithmetic on the half word alone;
  - a words test shows the note reaching a half word only when half arithmetic feeds it;
  - the reach row is pinned.

SEMANTICS_VERSION 2340 -> 2341 (precision notes added).
ENGINE_EXECUTOR_ABI vulkan-engine-v215 -> v216 (the word scan feeds HalfArithmetic, and the
note's reach narrows to it).

Golden hashes: no cell moves. The cells hash the final SPIR-V, which the note does not touch.
Job m3-max-83293 (Linux) ran golden_hashes_match_the_table twice: at this change, and with
compile.rs and cache/mod.rs at f42e61aa84. Both failed with the same 2 changed-cell lines, 0
lines differing between them: development's table is due its own bless. The fixtures that need
metal-as were skipped on Linux.

runtime-sources.sha256 is unchanged: no edited file is a fingerprint input.

Note-bounds figures (noted / matched within bounds / mismatches over the 1,168 public cases),
each arm built in one job, at 702916d9d3 and at this change on it (6edabebff2):
- lavapipe (Mesa 26.2.4, LLVM 23.1.1; job m3-max-83272): 151 / 27 / 15 before and after;
- Radeon 780M (RADV PHOENIX; job m3-max-83273): 166 / 24 / 21 before and after.
Every case's outcome and bounded line is the same in both arms, so no row is new. Only the per-note
word attribution moves: NativeHalfConversion's noted words fall from 3,267 to 1,168 on lavapipe and
from 3,558 to 1,276 on the 780M, as other notes reaching those words now take them.

Verified, at the probe db2bceb3f6, whose tree is this commit's (gate job m3-max-83293):
- the four red tests pass here and three fail with compile.rs at f42e61aa84 (EXIT=100);
- STEP clippy_plain EXIT=0, clippy_gpu EXIT=0, clippy_cpu EXIT=0;
- doc EXIT=0, privdoc EXIT=0;
- the translator's and AIR's suites minus the bless-due tables: EXIT=0;
- on lavapipe (host Mesa 26.2.6):
  - runtime: 983 passed, 4 skipped; half_simd_reductions 0 differ in all three pipelines;
  - validation: 1338 passed, 3 skipped, the runtime-sources guard among them.
- The conformance replay in the pinned lavapipe image (CI's venue, LLVM 23.1.1), at f42e61aa84
  and at this change (job m3-max-83337): 0 ledger drift in both arms, 4661 rows as expected.
  On the gate job's host lavapipe (Mesa 26.2.6, LLVM 23.1.4) its replay printed 12 drift lines,
  the bicubic-texel-classes rows among them. That run has no base arm.

The device legs of the half test:
- UHD Graphics 630, Intel's Windows driver 101.2145, at 6edabebff2 (this change on 702916d9d3;
  job m3-max-83288): every_device_sums_and_multiplies_half_simdgroups_as_metal passed.
  - The quad pipeline records NativeHalfConversion. 0 of 768 words differ from Metal's, and 96
    more are the float result rounded once.
  - The simd and masked pipelines: 0 differ.
- Apple M3 Max, KosmicKrisp (Mesa 26.3.1), at db2bceb3f6 (archive m3-max-83294, run
  m3-max-83297): passed. 0 words differ in each pipeline and none takes the rounded-once
  admission.

Landed with SEMANTICS_VERSION 2342 (renumbered above development's 2341); runtime-sources.sha256 recomputed on development, unchanged (a92fe0a8). States-only plays at the change (job 83345): gb-3090-r2 render 10643 and compute 15299 made, 0 refused; windrag-780m-b4 render 8972 and compute 225 made, 0 refused, equal to pin R.
2026-12-03 04:14:29 -08:00
Anees Iqbal e87fdd5a23 Tests: a half +, - or * on the 16-bit instructions records NativeHalfConversion (red)
Under the 16-bit float controls a half sum, product or chain is the device's 16-bit OpFAdd or
OpFMul between exact conversions. Intel's Windows driver 101.2145 on a UHD Graphics 630 computes
such operations in float and leaves them unrounded: a standalone tree of three of them came back
at float precision (jobs m3-max-83092 on the UHD 630 and m3-max-83093, the Iris Xe under Mesa ANV
26.2.6, as the control). The planner ruled that the operation carries the static note,
NativeHalfConversion, on every device.

The tests now expect that note:
- native_half_rounding_records_its_kind: on the half sum, on lavapipe and on RADV;
- nvidia_computes_half_on_16_bit_floats_under_the_float_controls: on each of the 16-bit
  kernels.

Red until the product records it.
2026-12-03 04:14:21 -08:00
Anees Iqbal 6e83de343d Translator: under the identity domains a slot's element of its set-1 array is its own-pixel binding
StageModule::own_pixel_textures lists the fragment function's texture slots whose every texel
read is at the fragment's own pixel. The runtime reads it for the copy form of attachment reads:
on a device without the attachment feedback loop, a draw that reads its own pass's target
through such a slot copies the rectangle of its scissor, a pixel wider each way, into the
target's shadow, and through any other slot the whole level and layer (crate::shadow).

The analysis seeded the slots from their descriptor variables. Under the identity domains, which
the runtime ships, no variable holds one slot's image: the image is the element of its class's
set-1 array at the low word of the resource ID that PushField::SlotGuestBase pushes. So the list
was empty for every function, and every such draw copied the whole level and layer, beyond what
Metal copies (rule 3).

Now the analysis also seeds a slot from each access chain into a set-1 image array whose first
index is the slot's ID's low word: OpAccessChain(array, CompositeExtract(OpLoad(OpAccessChain(push
block, member)), 0)), the member being the slot's SlotGuestBase. The ID's parts may go nowhere
else: the member's pointer only to its load, the ID only to an extract of its low or high word,
and the low word only to such an access chain's first index or to an equality test (the nil
test). Any other use leaves the slot out (a store, arithmetic, a phi, a select, a call, an access
chain into the member's words). So does a slot whose ID the stage reads from its parameter block,
or whose levels a run of the array holds (TextureLevelBase), since those reads reach the array
through no binding the analysis follows. The analysis takes the stage's push placement for this.

SEMANTICS_VERSION moves to the next number above development's: a stage's interface answers
differently.

Tests:
- pipeline/compile/tests.rs the_interface_states_the_textures_read_at_the_fragments_own_pixel
  now runs every profile under the identity domains too, the clamped form included: tob_read
  states slot 0, and tob_sample, tob_read_buffer and tob_solid state none. At the base, under
  identity, tob_read stated none.
- spirv/requirements/own_pixel/tests.rs under_the_identity_domains_a_slots_element_is_its_binding,
  on hand-built modules: an own-pixel fetch through a slot's element qualifies; an element only
  size-queried reads no texel; the ID stored, its low word plus one indexing another element, its
  low word loaded through an access chain into its member, a TextureLevelBase field and an ID in
  the parameter block each leave the slot out.

Verified on the CPU with no device and on lavapipe (llvmpipe, LLVM 23.1.4), job m3-max-83281 at
this commit:
- red, own_pixel.rs, its tests and compile.rs at the base: the compile test fails at its
  identity rows;
- green: the compile test, the own_pixel, compile and link tests, 142 of 142; the runtime's
  attachment-read, over-read, held-loop, shadow and translator-field tests on lavapipe, 18 of 18
  (lavapipe reads through the feedback loop, so its copy form is not exercised there);
- the refusal surface check, fmt, the signatures, clippy plain, with --cfg m2v_gpu and with
  --cfg m2v_cpu_icd, rustdoc, the private rustdoc and the API reference check passed; the suites
  3737 of 3738 passed (24 skipped), the one failure the golden table, which fails at the base on
  the same 80 cells (a bless due on development); validation 1337 passed (3 skipped);
  conformance 1052 passed; the doctests passed.
The change in copied bytes on a device without the feedback loop is not measured: no runtime
test draws under a scissor smaller than the target there.
2026-12-03 04:13:32 -08:00
Anees Iqbal d0fb4f3381 Translator: delete StageModule::level_reads, which nothing reads
StageInterface::level_reads and StageModule::level_reads stated, per texture slot, the levels of
its bound view the stage's reads reach (LevelReads, SampledLevels, SamplerLevels and the
structural analysis spirv::requirements::level_reads). Nothing reads them:
- the runtime: git grep -nw -e level_reads -e LevelReads -e SampledLevels -e SamplerLevels
  -e finite_texels -e highest_lod -e lowest_lod at 401d9d5949 over every crate but the translator
  finds one hit, the runtime's translator_fields test, which lists the field as a fact the runtime
  does not apply;
- the consumer: the same search at a20576e1fd finds 0 hits.
Under the identity domains, which the runtime ships, the analysis also seeded nothing, since no
variable holds one slot's image there. Rule 4: deleted rather than seeded.

Removed: the two fields, the three public types with their methods, the analysis and its tests,
their codec entries and footprint, their rows in tests/api_signatures.tsv and the api_surface
table, the API guide's "Levels a slot reads" section and HOWTO's mention of it, and the runtime
test's listing. own_pixel's helpers that the analysis shared are private again.

ARTIFACT_FORMAT_VERSION moves to the next number above development's: StageInterface's and
StageModule's encodings lose a field. No translation answer changes, so SEMANTICS_VERSION stays.

Verified on the CPU with no device and on lavapipe (llvmpipe, LLVM 23.1.4), job m3-max-83281 at
the next commit, which holds this one: fmt, the signatures, clippy plain, with --cfg m2v_gpu and
with --cfg m2v_cpu_icd, rustdoc, the private rustdoc, the refusal surface check and the API
reference check passed; the suites 3737 of 3738 passed (24 skipped), the one failure the golden
table, which fails at the base on the same 80 cells (a bless due on development); validation 1337
passed (3 skipped); conformance 1052 passed; the doctests passed.
2026-12-03 04:13:32 -08:00
Anees Iqbal 31b2964425 Validation observation: Metal's row of the simdgroup fills over a 7x7 target's cut quads
Qualified on the Apple M3 Max under macOS 27.0.1, three executions (job m3-max-83312):
aa05a38c3b41, output sha256 de1a61a9.

Every word is a real lane's: all 196 words (49 pixels, four fills each) equal what the packing
model reads from an active lane (8x4 blocks from (0, 0), quads row by row, a quad's lanes row by
row; a lane runs when its quad holds a covered pixel), and no fill reads an inactive lane. Each
value is one of those lanes' x + 64y or its filling data, 10000 more. Over the old 7x5 target, the
same model read lane 31 of the lower block, which ran no thread, for (0, 4)'s fill up by 1.
2026-12-03 04:02:13 -08:00
Anees Iqbal d071e32f79 Validation case: the simdgroup fills over cut quads draw a 7x7 target, whose every fill reads an active lane
The case simdgroup-fills-in-a-fragment-function-over-cut-quads (engine/gsm2_quad_ops,
fragment_simd_fills) drew a 7x5 target. On the M3 Max a simdgroup holds an 8x4 pixel block,
its quads row by row; the lower block's rows 4 and 5 fill lanes 0 to 15, and lanes 16 to 31 run
no thread. simd_shuffle_and_fill_up by 1 at pixel (0, 4), lane 0, reads lane 31's filling data:
a read of an inactive lane, which MSL 4.1 section 6.10.2 leaves undefined ("A thread needs to
only read data from another active thread in the SIMD-group"). Metal answered 0.0 there, which no
lane holds; lavapipe and the Radeon 780M answered the pixel's own fill, 10256. It was the one
differing word of the ten helper-thread cases that none of the four mechanisms explains.

At 7x7 the last column and row are still quads the target cuts, and each 8x4 block holds a
covered pixel in every quad, so all 32 lanes of both blocks run. A model of the M3's packing
(8x4 blocks from (0, 0), quads row by row, a quad's lanes row by row), checked against the
committed Metal rows, reproduces every word of the 8x8 case (256 of 256) and every word but
(0, 4)'s first of the 7x5 one (139 of 140); over a 7x7 target it reads no inactive lane in any
of the four fills, where the 7x5 target read one. The case's rationale states the undefined read.

Installed with corpus-case-check (job m3-max-83299): the new identity is
aa05a38c3b411ed862539df3e52691addc8e8b612e1d80e4b8425284cb73045d, and the old identity's Metal
row is removed. Its Metal qualification follows in the next commit. The authored compile census
still lists the old identity, for the next bless.
2026-12-03 03:55:29 -08:00
Anees Iqbal f42e61aa84 Docs: the helper-thread words' four mechanisms, and what a split quad's helper query answers
The read of the ten cases held as helper_thread_words (lavapipe, job 83263; Radeon 780M, jobs
83264 and 83267) explained 454 of their 455 differing words by four mechanisms: Apple's partial
quads, lavapipe's clip seam, RADV's lane order and x86 lavapipe's 8-lane subgroup. The docs said
otherwise in two places:

- QuadsSplitByClipping said each run of a split quad combines fewer active lanes than Metal's.
  Each piece's run keeps all four lanes; what differs is the helper query, which names the other
  piece's covered pixels as helpers where Metal's quad, shaded once, names none. The note's doc
  comment, its API.md catalogue entry and the validation gap's doc now say that.
- FragmentSimdgroupGrouping gains the fill past a subgroup under 32 lanes: it reads an inactive
  lane, which MSL 4.1 section 6.10.2 leaves undefined, and the device reads the calling lane in its
  place (lower::simd's PartialFragment read).

docs/VALIDATION.md's verdict section names the four mechanisms and what lavapipe and the 780M do
under each, where the next reader of a held case looks. The gap's doc in c3.rs no longer says the
cause is unread.

Docs and doc comments only. pin-compute.py over the tree gives the committed runtime-sources
fingerprint (artifact.rs is not one of its inputs), so no re-pin. cargo fmt --all is clean.
2026-12-03 03:48:23 -08:00
Anees Iqbal f0077ea01b Translator: an identity fetch of an A8Unorm colour held in red reads Metal's alpha through its view
Under the identity domains, a fragment function reads a colour attachment through the
sampled-texture array's element pushed for it (PushField::FetchedColor). That element is the
texture's own view, the shadow's or the feedback loop's. On a device without an A8_UNORM image,
an A8Unorm texture is held in R8_UNORM, and its view has the components (ZERO, ZERO, ZERO, R)
(metal::format, the A8Unorm candidate). Vulkan's Component Swizzle applies them to every texel
input instruction, a fetch included. So the element already reads Metal's (0, 0, 0, a).

lower/fragment/color.rs still applied the input attachment's alpha-in-red conversion to that
read, (0, 0, 0, texel.r), and recorded the colour in StageIo::alpha_in_red_colors. A guest saw
two things on such a device (lavapipe, intel-arl-anv, intel-irisxe-anv, amd-rdna2-apu-radv,
nvidia-pascal-linux, nvidia-rtx50-linux and runtime-floor among the committed profiles; the device
check below prints how the device it runs on holds the format):
- A function that reads an A8Unorm colour and also writes it read (0, 0, 0, texel.r), and the
  view's red is 0: alpha 0, a wrong value (on lavapipe at the base, the device check below read
  (0, 0, 0, 0) at texel (0, 0)).
- A function that reads one and never writes it was refused at link with
  NeedsInput(ColorWrites), which nothing answers. color_writes::wanted_alpha_in_red counts
  written colours and input attachments, and an identity fetch is neither.

Now the identity read takes no conversion and records nothing (ColorInput::alpha_red is false
under the identity domains). The input-attachment read of the resident domains keeps its
conversion, since an input attachment's view takes no swizzle. Link's set and the function's then
agree, and link is unchanged.

The extended-range half of the same link check is a docs line: an identity fetch of an
extended-range attachment is refused by the lowering and by link, so no shader reaches
wanted_extended_range's omission of FetchedColor colours. color_writes' docs of both wanted_*
functions now say why a FetchedColor read is in neither set.

SEMANTICS_VERSION moves to the next number above development's: a refusal goes and a fetch's
answer changes.

Tests:
- pipeline/compile/tests.rs an_identity_fetch_of_an_alpha_held_in_red_reads_through_the_view: on
  lavapipe's profile (no A8_UNORM image), without the pixel interlock, under the identity policy,
  fetch_blend with an A8Unorm colour 2 that it reads and never writes links. Colour 2 is read
  through FetchedColor, no input attachment is used, and every stage passes spirv-val. At the base
  it is refused NeedsInput(ColorWrites).
- metal2vulkan-runtime tests/fetch.rs every_device_fetches_an_a8unorm_attachment_as_metals_alpha
  (device check): a pass clears an A8Unorm target to alpha 51/255. a8r_fill writes 204/255 over
  the lower left half. a8r_fetch reads the attachment at every texel and stores what it read, and
  every texel must read (0, 0, 0, a) of its own alpha.

Verified on lavapipe (llvmpipe, LLVM 23.1.1), which holds A8Unorm in R8_UNORM (the check prints
"A8Unorm held as Ok(AlphaInRed)"), job m3-max-83219 at this commit:
- red, lower/fragment/color.rs at the base: the structural test refused
  NeedsInput(ColorWrites); the device check read (0, 0, 0, 0) at texel (0, 0).
- green: the structural test, the compile tests and engine_fragment passed; the runtime's fetch
  tests on lavapipe, 7 of 7, the device check reading Metal's (0, 0, 0, a) at every texel.
- the refusal surface check, fmt, the signatures, clippy plain, with --cfg m2v_gpu and with
  --cfg m2v_cpu_icd, rustdoc and the private rustdoc passed; the suites 3738 of 3739 passed (24
  skipped), the one failure the golden table below; validation 1323 passed (3 skipped);
  conformance 1052 passed; the doctests and the API reference check passed.
- the golden table fails at this commit and at its base alike, on the same two cells
  (a8r_buffer_read_write and tb_word_formats on runtime-floor): a bless due on development, none
  of it this change's.

Landed with SEMANTICS_VERSION 2340 (renumbered above development's 2339); runtime-sources.sha256 recomputed on development, unchanged (a92fe0a8).
2026-12-03 03:43:38 -08:00
Anees Iqbal f683293b4b Docs: a fetch may read the texel from before its draw, so overlapping read-modify-writes leave one
UnorderedFetchWithinDraw's words said a pixel that overlapping fragments of one draw fetch and
write "holds the result of some order of the draw's fragments", "not necessarily Metal's". The
Radeon 780M (RADV, Mesa 26.2.6) shows otherwise. Job m3-max-83259 ran the eight authored cases
the ordered_fetch_within_draw gap holds (n instances of the companion's fullscreen triangle in
one draw, so n identical fragments at every pixel or sample) five times at 702916d9d3. All five
outputs were identical. Every differing word is the fragment function applied once to the
texel as it stood before the draw. Each case's chain f^k(initial), computed from its own inputs,
gives Metal's stored output at k = n on every word, and the 780M's at k = 1 on every word that
differs, all four lanes of each texel alike. All n fragments are identical, so every order of
them gives Metal's value: the 780M's value is no order's result. Lavapipe matches Metal on the
seven cases it runs (job m3-max-83255).

The note now says what a fetch can observe there: it may read the texel from before its draw,
so overlapping read-modify-writes of one draw may leave one application. Changed in docs/API.md's
precision-note catalogue, PrecisionNote::UnorderedFetchWithinDraw's doc comment and the runtime
README's known gap. Docs only, no behaviour change. The runtime-sources pin is unchanged
(pin-compute.py gives a92fe0a8...).

Verified: cargo fmt --all; nothing built.
2026-12-03 03:35:47 -08:00
Anees Iqbal 702916d9d3 Validation: helper-thread words and ordered fetch are answer gaps a row's words decide
FragmentSimdgroupGrouping, QuadsSplitByClipping and
UnorderedFetchWithinDraw only record a device behaviour now: none of
them excuses a word. The cases whose differing words they reach turned
from noted differences into mismatches, and nothing held them open, so
a round's public leg would read them as new mismatches. Two answer
gaps now hold them open. Both are decided by structure (the note and
the words its operations reach), never by case id:

- HelperThreadWords (helper_thread_words): every unexcused word is
  reached by FragmentSimdgroupGrouping, or every one by
  QuadsSplitByClipping.
- OrderedFetchWithinDraw (ordered_fetch_within_draw): every unexcused
  word is reached by UnorderedFetchWithinDraw.

How:
- For each only-recorded note, the word judge counts the unexcused
  words that note reaches (Judgement::recorded).
- AnswerGap::held_by_words picks the gap one of whose notes reaches
  every unexcused word of a mismatch, where both outputs have one
  length. The engine's difference_status calls it for a mismatching
  verdict, and the batch-run line names the gap (held_open_by=).
- Every device has both gaps, since why the device's words differ is
  not read yet. The reviewed list refuses an entry under either gap.
- A row's content check accepts such a gap only on differing bytes from
  a run that recorded one of its notes, and status_holds re-derives the
  gap from the row's words.
- C3 names a word gap as a mismatch's reason after a deferral and after
  a listed gap.
- docs/VALIDATION.md states both gaps.

ENGINE_EXECUTOR_ABI stays vulkan-engine-v215, above development's v214.

The three figures, public cases (1,168): noted cases / cases that
match only within bounds / mismatches, then how many mismatches an
answer gap holds and how many are new.
- lavapipe (Mesa 26.2.4 image):
  - before, development 965e707277, job m3-max-83220: 188 / 0 / 5;
    5 held, 0 new.
  - after, job m3-max-83166: 151 / 27 / 15; 15 held (5
    clipped_primitive_split, 10 helper_thread_words), 0 new.
- Radeon 780M (RADV PHOENIX, Mesa 26.2.6, the device pinned alone):
  - before, development 22861fde72, jobs m3-max-82940 and
    m3-max-82966: 206 / 0 / 5; 5 held, 0 new.
  - after, job m3-max-83177: 166 / 24 / 21; 21 held (5
    clipped_primitive_split, 8 helper_thread_words, 8
    ordered_fetch_within_draw), 0 new.

The after runs ran this commit's library code. Only a C3 test changed
after them.

Verified (tests at this tree):
- gate A, m3-max-83232: fmt check, clippy plain, --cfg m2v_gpu and
  --cfg m2v_cpu_icd, and rustdoc each exit 0.
- gate B, m3-max-83236: the validation suite exits 0, 1337 passed,
  3 skipped. Each red check exits 100 with its fix reverted: the
  engine's word-gap hold, the judge's recorded-note count, the
  denormal boundary, the note reach, the recorded rule-5 notes and the
  recorded review notes.
2026-12-03 03:27:51 -08:00
Anees Iqbal 41712a1ec5 Translator docs: NativeNanEncoding covers a NaN's payload moved through loads, stores and selects
What: NativeNanEncoding's rustdoc and its docs/API.md catalogue entry say what validation now
reads it as covering: a NaN's payload moved through loads, stores and selects as well as one an
operation computes. Validation excuses a word in any float lane only where Metal's answer and
the device's are both NaNs of the lane's format.

Why: the planner accepted reading the note as reaching every float lane, bounded to two NaNs.
The public case nan-model-loads-stores-and-selects-of-nan-halves differs on lavapipe only in
half NaN payloads its entry moves without an operation (e.g. Metal 0x7e01 against 0x7e00,
m3-max-82836), which the note's own text already records at every read of a half from its bits.

Text only: no output and no recorded note changes, so SEMANTICS_VERSION stays; artifact.rs is
not a runtime source input.
2026-12-03 03:27:51 -08:00
Anees Iqbal 0def48a4f6 Validation: every note whose doc keeps a difference a mismatch for review is only recorded
What: the notes whose rustdoc says "a difference stays a mismatch for review" are Recorded in
the allowance table, as rule 5 made QuadsSplitByClipping and DeviceInterpolation:
ExtrapolatedInterpolation, FragmentSimdgroupGrouping, BlendedWriteRounding,
CoverageReadsRoundedAlpha, DeviceAlphaCoverage, RotatedBlendRounding, HalfOutputPrecision,
DevicePointSize, LoopedSampleOutputs, NativeLogicOperation and UnorderedFetchWithinDraw (whose
doc says it without "and no explanation"). ViewBaseTexelOffset, DeviceColorConversion,
LinkedSamplerNumbering and DeviceInterpolationOffset already were. A word they reach that
differs is a mismatch unless another note excuses it.

C3's deferral of a near-equivalent (FragmentSimdgroupGrouping, BlendedWriteRounding,
CoverageReadsRoundedAlpha, RotatedBlendRounding among them) reads the run's recorded notes
(ExecutedCensus::all_notes) rather than the unbounded class, which no longer names a recorded
note: a row that ran one stays open as before.

The review-sentence lines of the note docs drop their design citation ("deferred in C3", "which
C3 names"), and the table's rows say what each note records. The NativeNanEncoding row says it
covers a payload moved through loads, stores and selects (the reach the previous commits gave
it), and the DeviceDenormals row lists the operations measured to keep a denormal.

Why: the planner ruled that rule 5 applies to every note carrying the sentence; the code read
them as unbounded, so a difference they reached was a noted difference against their docs.
ClippedCoverageSplit says "no tolerance and no explanation" but not "a mismatch for review", and
its cases are held open through it; it is unchanged.

Verified on lavapipe (Mesa 26.2.4, the lavapipe image), the 1,168 public cases, job
m3-max-82941 (this tree with the next commit's doc text) against m3-max-82873 (rule 5 alone):
ten cases are mismatches, every differing word of each on the fall-back; eight of them were
noted differences that FragmentSimdgroupGrouping explained: 1daf00c7, 243237a9, 8926b0e1, aa65ed07, b1f22cbf, c8195f48 (helper threads),
8aac224c and f03c5415 (simdgroup fills); 524be944 and 60db147e are rule 5's. Two runs
of that job ended in a device wait timeout under the host's load (2e81b17c, 35d576e0) and are
rerun at the tip. Each note's row is tested (every_precision_note_has_its_table_row), and a red
check that turns NativeLogicOperation back to Unbounded fails it.
2026-12-03 03:27:51 -08:00
Anees Iqbal 31231e3d67 Validation: QuadsSplitByClipping and DeviceInterpolation keep a difference a mismatch
What: both notes' rows of the allowance table are Recorded, as their rustdoc states
("Validation derives no tolerance and no explanation from it: a difference stays a mismatch for
review"): a word they reach that differs is a mismatch unless another note excuses it. The
table's doc rows, its test rows, the C3 test of a DeviceInterpolation row (its class is the
census's, Exact) and a word test of both notes follow.

Why: the code read both as unbounded, so a difference they reached was a noted difference,
against the documented contract.

Verified on lavapipe (Mesa 26.2.4, the lavapipe image), the 1,168 public cases, job
m3-max-82873 (this tree) against m3-max-82854 (the tree before it): match 773 -> 773,
noted_difference 161 -> 159, mismatch 5 -> 7. Red, both render targets whose words every note
reaches (the fall-back), where only QuadsSplitByClipping explained them:
- 524be944 helper-threads-in-a-fragment-function-over-full-quads: 32 of 256 words, Metal 0
  against the device's 0xe or 1 (25:00000000/0000000e, 29:00000000/00000001, ...);
- 60db147e helper-threads-in-a-fragment-function-over-cut-quads: 20 of 140 words
  (17:00000000/00000008, 49:00000000/00000007, 113:0000000c/0000000e, ...).
The other seven cases these two notes excused first stay noted under another note that reaches
the same words: six helper-thread cases under FragmentSimdgroupGrouping, and
memory-write-per-sample-4x under NativeHalfConversion. Tests: m3-max-82874 (137 passed, the
touched modules).
2026-12-03 03:27:51 -08:00