Commit Graph
3385 Commits
Author SHA1 Message Date
Anees Iqbal b23928b1f7 Record the padded blend cases on the M3 Max; the blend door's bfloat answer documented
Seventeen recordings of padded_blends, Metal on the Apple M3 Max under macOS
27.0.1 (26A434), three plain runs each and the validated leg. A Python rebuild
of each case's inputs reproduces the recorded input digests (the destination
words and the half4 outputs), and an f32 model of the blend unclamped matches
Metal's stored codes within one code at every texel of the linear forms but
for NaN and infinite operands.

metal::format::extended_range_blend's doc names the padded forms and the bfloat
forms' NotRepresentable answer.

(cherry picked from commit 31d3ac25a223d5372f2fe49898bc54ca7f79952b)
2026-11-10 01:35:34 -08:00
Anees Iqbal 0e76f55569 Padded clear read-back: RG10Unorm_X12_sRGB's one; comments on padded shadows and fetches
ExtendedRange::clear_read_back's test expected a clear of 1 into
RG10Unorm_X12_sRGB to read back, but Metal's write table stores 1 as code 137,
which reads 137/1023: the clear is off its codes, as the function answers (the
gem10 run of 5750641750 failed the test there and nowhere else).

Comments: the runtime's half shadow and the translator's leave out a padded
color because the shadow is not built for it (its tile is measured now), and a
fetch's read of a padded tile is what stays unmeasured.

(cherry picked from commit b9a7f3425a802b2107b4f48631b24657637016c4)
2026-11-10 01:35:34 -08:00
Anees Iqbal c6d18a11eb Conformance: blends into the padded 10-bit formats
Seventeen cases, padded_blends: each of R10Unorm_X6, RG10Unorm_X12, their sRGB
twins and RGB10A2Unorm_sRGB blended by rt6_samples' half4 fill under
premultiplied source-over, its float4 fill under one plus one, and xrb_dual's
half4 output and second output under Source1 over its complement; and the
premultiplied blend under a mask of red (RG10Unorm_X12) and of the color
channels (RGB10A2Unorm_sRGB). Each target is 128x64 of random raw words, shared
and of shader-write usage so replaceRegion and the blit out move every word
(a texture Metal keeps in its optimized layout moved only some of a padded
target's texels in the probe), loaded, drawn once full-screen, and read back
whole. The outputs are extended_range_targets' 8,192 (values past [0, 1] on
both sides, NaN, the infinities and both zeros), which the unclamped padded
blend reads as they are.

Recorded on Metal in a later commit; their cost records are named as a bill for
the next whole-set cost run.

(cherry picked from commit a2b0697740657a47c171f8cb5656271b7645b9b4)
2026-11-10 01:35:34 -08:00
Anees Iqbal 880b03cb2b Blend into a padded attachment over unclamped operands; padded tiles announced
Measured on the M3 Max under macOS 27.0.1 (probes/padded_and_bfloat_blends.m,
targets without Metal's optimized layout, whose blits moved every texel):
- Metal clamps nothing before a blend into a padded attachment (R10Unorm_X6,
  RG10Unorm_X12, their sRGB twins, RGB10A2Unorm_sRGB): sources, second
  sources and blend colors past both ends of [0, 1], alpha among them, blend
  as they are. With the operands unclamped, the stored codes of 18 blend states
  under fast and safe math, half and float outputs, match the f32 model within
  one code for the linear forms (16-bit safe-math half outputs exactly in half
  arithmetic), apart from NaN and infinity results; clamped to [0, 1], up to
  1023 codes off in 30-50% of channels.
- A padded attachment's tile holds half through the pass: a premultiplied blend
  of (0, 0, 0, 0.5) over a clear of 0.33371 stored code 171 (the half's), not
  170 (code 341's), and over an unblended draw of values in [-0.5, 1.5] it
  matched the unclamped half in every channel (65,536 texels of R10Unorm_X6,
  131,072 channels of RG10Unorm_X12).

So blend::extended_ranges is None for a padded form (native() clamps nothing),
source_range drops its padded arm, and the model test clamps no padded lane:
every_blend_is_the_devices_arithmetic's random sources past the range fail it
with the clamp. The runtime's extended-range-blends-stored-codes now covers
padded colors (render.rs extended_colors), and ExtendedRange::clear_read_back
answers a padded form's clear by its codes' values (c / 1023, the sRGB twins'
transfer, RG10Unorm_X12_sRGB linear), so a blend over a clear between two codes
is announced as for the extended-range forms. Docs: the blend-source notes, the
stored-codes kind and its catalogue entry, ExtendedRangeColor.

(cherry picked from commit 5750641750642bdb7800da8e9618f98919d2cc9f)
2026-11-10 01:35:19 -08:00
Anees Iqbal 17cf2bf636 Bfloat blend refusal: tests, docs, refusal surface; SEMANTICS 2012
The translator test of bfloat targets expects Metal's pipeline error for a
blended bfloat attachment, in the translation and at link with no fragment
function, with the unblended unwritten pipeline as its negative control. A new
engine test (engine_padded_blends) checks the same on every committed profile
through compile_render_pipeline, under a full mask and a mask of no channel, and
without a fragment function, with the unblended pipeline made as its control.

Docs: stage_io::extended_color, input_blend, ExtendedRangeColor::blended (any
blend now, not factors one and zero), DescriptorError::ColorAttachment (a
blended bfloat attachment). docs/REFUSALS.md regenerated. SEMANTICS_VERSION
2012 (a refusal's class changed, padded blends translate). A clippy literal in
extended_range's tests grouped.

(cherry picked from commit 8ef001f0a0eeed4c1b51a31df2ae093285dfbe9c)
2026-11-10 01:35:19 -08:00
Anees Iqbal ebaf3554ca Refuse a blend into a bfloat attachment as Metal does; padded blends at the format door
Metal makes no render pipeline that blends into an R16Bfloat, RG16Bfloat or
RGBA16Bfloat attachment: its pipeline validation asserts that the format is not
blendable (an Apple M3 Max under macOS 27.0.1, plain and under the validation
layer, with a fragment function writing the attachment, under a mask of no
channel, and with no fragment function; probes/padded_and_bfloat_blends.m).
Link, stage_io::extended_color and fetch::plan now refuse such a blend
InvalidDescriptor(ColorAttachment) instead of NotImplemented(Format). A second
output planned to an extended-range attachment is an invariant (stage_io
consumes it as the blend's second source or stores it nowhere).

metal::format::extended_range_blend answers a padded form as it answers the
others now that the function blends one (storage form and input attachment),
and a bfloat form NotRepresentable(Format), as the runtime's formats answer what
Metal refuses. The runtime's Blend answer for the padded formats follows it.

Tests: fetch's door test over the padded and bfloat forms; the runtime's
padded and bfloat Blend answers.

(cherry picked from commit 7e68307bc7cc6dbac926132502b2a0d2189734a0)
2026-11-10 01:35:13 -08:00
Anees Iqbal 13467f9bca Probe: padded targets without Metal's optimized layout
Blits moved only some texels of a private padded target in Metal's optimized
(compressed) layout: a write mask of no channel stored the uploaded word in 36%
of an R10Unorm_X6 target, in blocks. The targets now set
allowGPUOptimizedContents to NO, which changes the memory layout alone.

(cherry picked from commit 8e418e5df5a36114ad13b30c86d85efa913a2b3a)
2026-11-10 01:35:13 -08:00
Anees Iqbal 00e16d8612 Probe: render the padded blends into private targets
The rerun's blits brought back words no write makes (0xFFFF, 0xABAB, whole rows of zeros) from
the shared padded 10-bit targets, while the shared RGB10A2Unorm_sRGB and BGR10_XR targets came
back sound. Private storage, a render target's usual storage, is what the probe's targets take
now, and the round trip reports the texels whose codes came back other.

Verified: not yet; the M3 run follows.
(cherry picked from commit 4c16b29b2ba547553921ca4b1d1b299a8c1201e5)
2026-11-10 01:35:13 -08:00
Anees Iqbal 2f3d297a49 Probe: a blended bfloat attachment of mask none, and without a fragment function
Whether Metal's assertion on a blended bfloat attachment is the descriptor's alone: the same
pipeline under a write mask of no channel, and with no fragment function at all.

Verified: not yet; the M3 run follows.
(cherry picked from commit ace344e3795446947bc899f2c9270947d0e61799)
2026-11-10 01:35:13 -08:00
Anees Iqbal 7b3ced8eed Probe: move the padded blends' texels in and out by blits
A host copy of a padded 10-bit texture is a silent no-op where Metal keeps it in its compressed
layout, which the probe's 256 x 256 render targets took: the first run's destinations went in as
zeros and its stored texels never came back. Every texel now goes up and back by a blit in the
draw's command buffer, the read-back buffer is filled with a pattern before each draw, and a
round trip of each format's destination is checked before its sweep.

Verified: the first run's outputs were all zero for R10Unorm_X6 and matched no model for the
other forms; the rerun follows.

(cherry picked from commit 6f9b0732813f3aa1e0b7e70653c38d13e9803fc7)
2026-11-10 01:35:13 -08:00
Anees Iqbal bab3e9b1f9 Blend into a padded 10-bit attachment over an ordered read of it
A blended R10Unorm_X6, RG10Unorm_X12, their sRGB twins or RGB10A2Unorm_sRGB attachment was
refused NotImplemented(Format). No device blends the raw words such an attachment holds, so the
function now computes the blend itself over an ordered read of the attachment, as it does for the
extended-range forms: the interlocked storage form takes a padded attachment (its blend, an
unblended write and a write under a mask of some channels), and on a device that orders fetch
through rasterization-order input attachments the blend is computed over the input attachment.
A device that orders fetch in neither way refuses it naming the two orderings.

The blend's destination is the tile value: each code decoded and narrowed to half, code 1023 one
(an extended-range form's tile clamps at 1022, a padded form's does not). The source, the second
source and the blend color are clamped to [0, 1], and the result is stored by the write's encode,
a masked channel's code kept (encode_keeping now packs the padded words). What a fetch reads of a
padded attachment is not measured and stays refused in the storage form too.

Verified: not yet; the Linux build and the touched tests follow, and the M3 probe decides the
model's details.

(cherry picked from commit 0d835f245740d2436f566ec27d5bfccf8e1da0a4)
2026-11-10 01:35:12 -08:00
Anees Iqbal 04b9e87919 Probe: what plain Metal does with a blend into a padded or bfloat attachment
A probe of our own MSL that makes blended pipelines into the padded 10-bit forms, the bfloat forms
and (for a second output) the extended-range forms, sweeps blend states over random raw texels for
half4 and float4 outputs under fast and safe math, and reads what a blend sees as its destination
after a clear and after an earlier draw of the same pass. Its answers decide the model the
translator builds for these blends.

Verified: not yet run; the M3 run follows.
(cherry picked from commit 8b5c01879867e53d4321824a29cec117cd405475)
2026-11-10 01:35:12 -08:00
Anees Iqbal 3257c8886c SEMANTICS_VERSION 2013, RUNTIME_VERSION 2001 and the pin for Metal 4.1 reads through a sampler
What: the fifteen commits before this one (exitcrash, steelbrain/readoffset 3514ac3e7a):
Metal 4.1 read(sampler, coord[, offset][, lod]) builds for every constexpr sampler
state, a runtime [[sampler(n)]] (SamplerWord::READ_STATE) and an argument buffer's
sampler, with the border texel a new spec (SpecKey::BorderTexels, set by the binder
from the bound texture's format and swizzle). The M3's measured rules: the level is
the read's under a mip filter, else 0; a level or layer past the texture reads zero;
border modes read the border texel through the swizzle, edge modes clamp; a texture
buffer's index past its end reads the border texel where t is a border mode, else
texel 0, except a runtime sampler whose s is clamp_to_edge clamps. Still refused
(typed): an argument buffer's texture read through an opaque border or a runtime
sampler (no handle room for its border texels). Known gap recorded: an argument
buffer's swizzled texture through a transparent-black border reads (0,0,0,0) where
Metal reads (0,0,1,0). SEMANTICS 2013 (the branch's 2012 collided with deadrog's),
ARTIFACT_FORMAT 499 (two encoded variants), RUNTIME_VERSION 2000 -> 2001 (the
runtime's sampler words and binder). The pin follows.

Verified (exitcrash): new conformance family read_through, 13 cases recorded on the
M3; M3 MoltenVK replay REPLAY_RC 0 (job 13305), lavapipe replay REPLAY_RC 0 (13302;
96 of its 98 ledger rows are llvmpipe's unorm conversion, one ulp); negative control
at base: all 13 refused (13272); Linux core 5352/5353 (the 38 golden rows, re-blessed
next), conformance 1034/1034; clippy plain/m2v_gpu/m2v_cpu_icd and rustdoc clean
(13303). Generators and api-signatures --check unchanged at landing.
2026-11-10 01:31:09 -08:00
Anees Iqbal 848c072b8f CONFORMANCE-COVERAGE.md with read_through's ledger rows
Regenerated by scripts/conformance-coverage/coverage.py after the 96 llvmpipe
rows and the three read_through gap rows: 3410 ledger rows.

Verified: the conformance suite on msi (job m3-max-13292) failed only
the_conformance_coverage_document_is_what_the_sources_derive before this.

(cherry picked from commit 3514ac3e7a91a8245325939db06bbec5e950a63a)
2026-11-10 01:30:12 -08:00
Anees Iqbal b70ff4e4d1 Test: a texture buffer's border by t through runtime sampler words
Five words the M3 answered in the conformance case read-through-buffer:
s border alone reads texel 0, s and t border the border, t zero under s
repeat the border, s clamp_to_edge clamps whatever t and r are, and t
repeat under s border reads texel 0. With the border taken from s, the
first and fifth read the border instead.

Verified: next, with the suite on msi.
(cherry picked from commit 158acdd959bd9e492e399e974e516e03cdcf01d7)
2026-11-10 01:30:12 -08:00
Anees Iqbal 9721752f1b read_through: lavapipe's ledger rows, and the timings already in
96 llvmpipe rows for the 8-bit unorm cases (rgba8, its swizzled twin, a8):
every one is llvmpipe's own conversion of an 8-bit code, one f32 ulp high of
Metal's (0x3ec2c2c4 for 0x3ec2c2c3), at reads inside the texture; the
addressing and the border texels agree. The swizzled case's argument-buffer
texture holds the swizzle gap and two such ulps.

The previous commit (4d0220258d) also carried the thirteen cases' Metal and
MoltenVK timings, written by conformance times --runs 8 --write on the M3
(job m3-max-13280), which its message does not say.

Verified: the lavapipe replay on msi (job m3-max-13284) named exactly these 96
rows as unlisted and no other gap; the conformance suite passed there (1034
tests).

(cherry picked from commit 9361a740d86d056d1a3799f88c909d18df62b718)
2026-11-10 01:30:12 -08:00
Anees Iqbal a081c07646 through.rs: no indexing in the lowering
The lowering denies clippy::indexing_slicing: the sampler word's s mode is kept
as the loop meets it, the border flags are written through the array's
iterator and read with get, and the one-lane border texel is the slice's one
element.

Verified: clippy -D warnings on msi (job m3-max-13267) named these four sites
and nothing else in plain, m2v_gpu and m2v_cpu_icd; rustdoc -D warnings passed.

(cherry picked from commit 8a43b4e2be910dbfede95b974b7dfe17acb6360f)
2026-11-10 01:30:12 -08:00
Anees Iqbal 5ba7e93356 read_through: the cost bill, and the swizzle row scoped to the M3
The thirteen cases join AFTER_THE_LAST_RUN: a case's counts depend on what ran
before it, so only a whole-set cost --write pays their records. The argument
buffer texture's swizzled-border row names the M3: lavapipe's answer at the
same site also holds its unorm conversion's ulp, so it is a row of its own.

Verified: the conformance suite on msi (job m3-max-13266) failed
every_case_carries_a_cost_recording on these names alone.

(cherry picked from commit 36d078c3e637555a8a36cab8099b726208c19dc8)
2026-11-10 01:30:12 -08:00
Anees Iqbal 0fcb724d2c CONFORMANCE-COVERAGE.md with the read_through family
Regenerated by scripts/conformance-coverage/coverage.py: 13 more recordings,
162 case modules, three ledger rows, and read_through among the families that
compare MTLSamplerState and the texture and buffer items it calls.

Verified: coverage.py --check reported the doc stale before and is the
generator's output now.

(cherry picked from commit b2b166a2d4b03ed957824bc8290b214d4c78c66b)
2026-11-10 01:30:11 -08:00
Anees Iqbal f831d5bd2f Engine inventory: kernel_read_through's rows
The 25 kernels of kernel_read_through under every committed profile, for its
llvm-as and metal-as forms alike, blessed on the M3 (which has both
assemblers): every one translates but rt_heap_ow and rt_heap_arg
(NotImplemented(ArgumentBufferTextures)), rt_heap_zero on the profile without
descriptor indexing, and rt_rw where the storage format is an input.

Verified: bless_engine_inventory on the M3 (job m3-max-13265) added these 50
rows and changed none.

(cherry picked from commit 7ef4c2d54ca5f006678d548fa83ee35ac9bf5e81)
2026-11-10 01:30:11 -08:00
Anees Iqbal 34310d93f7 Reads through a sampler: a texture buffer's border by its t axis, the ledger rows
The read_through conformance family's per-axis states, recorded on the M3 Max,
show a texture buffer's index past its end addressed as the first texel of a
row past its one row: the border texel where t's mode is a border mode, else
texel 0, whatever s and r are; a runtime sampler whose s mode is
clamp_to_edge clamps it first (s-border reads texel 0, st-border the border,
tr-border clamps). The read took s's mode, which read the border for s-border,
sr-border, s-zero and three mixed states. The border now follows t, and never
applies where the sampler clamps.

The retaken buffer recording; known-gaps rows for the argument-buffer
texture's swizzled transparent border (divergent) and its opaque-border and
runtime-sampler reads (refused), with the swizzle gap in FAST-PATHS.md's known
gaps; the module docs say both.

Verified: the replay on the M3 through MoltenVK (job m3-max-13263) named the
six buffer divergences this fixes; the fix's replay is next.

(cherry picked from commit 22c6817d4074c1b18bbc7c6d166370fe9990c1a5)
2026-11-10 01:30:11 -08:00
Anees Iqbal b8e865bf21 read_through: recordings, axis states for texture buffers, the golden printout
The thirteen read_through cases' Metal answers, recorded on the M3 Max
(macOS 27.0.1). The texture-buffer case gains fourteen runtime sampler
states that change one or two axes from clamp_to_edge, because the first
replay showed Metal reading texel 0, not the border, past a texture buffer's
end through s = clamp_to_border, t = repeat, r = clamp_to_edge: the index is
not addressed by s alone. Its recording is retaken next.

The plane cases declare set-past-layout-support: their argument-buffer reads
take the handle heap, which MoltenVK's layout query refuses though it runs it
(the replay on the M3 announced it in all four and nothing else).

kernel_read_through's golden printout, blessed on msi under LLVM 21. The
translator test accepts a profile without descriptor indexing refusing
rt_heap_zero with its feature needs.

Verified: record and MoltenVK replay on the M3 (job m3-max-13250); the golden
printout test passes on msi (job m3-max-13256).

(cherry picked from commit 6bfa6f481eb9253b197146524eed739aecd95f37)
2026-11-10 01:30:11 -08:00
Anees Iqbal c72724ea14 Conformance: read_through, reads through samplers of each address family
Thirteen cases over the owned fixture kernel_read_through: four plane formats
(R32Float, RGBA8Unorm plain and swizzled, A8Unorm) through every constexpr
kernel, eleven runtime sampler states at the slot and through an argument
buffer, and an argument buffer's texture; an array, a volume, a line, a
read-write texture, a texture buffer, an int and a half texture; and the two
argument-buffer-texture reads the translator refuses, as cases of their own.
Each case reads at positions inside, past each edge, at a lower level and at
levels past the texture's.

Verified: nothing yet; the recordings are taken on the M3 next.
(cherry picked from commit 2dc084d1bfd12736c7e38b73cacb43b147423351)
2026-11-10 01:30:11 -08:00
Anees Iqbal ea89941dda BorderTexels in the mechanism test's tables and the interpreter's neutral defaults
The mechanism test enumerates every RuntimeFact without a wildcard, so the new
BorderTexels fact needs its variant index (93), its sample and its expected
mechanism (Specialization). The interpreter's push defaults give BorderTexels
the module's own neutral bits rather than 0.

Verified: the lib-test build on gem10 failed on exactly these two matches.
(cherry picked from commit 2f7fce9e6a19bc4ee197ff565fbd879dcce4c53c)
2026-11-10 01:30:11 -08:00
Anees Iqbal 5b24698068 SEMANTICS 2012, ARTIFACT_FORMAT 499, REFUSALS.md and the API signatures for reads through a sampler
What: SEMANTICS_VERSION 2011 -> 2012: reads through a sampler other than constexpr
clamp_to_edge now translate (they were refused), a clamp-to-edge read past its level or layer
reads zero in every lane, and a texture buffer's index outside a constexpr clamp_to_edge reads
its first texel. ARTIFACT_FORMAT_VERSION 498 -> 499: SpecKey::BorderTexels and
RuntimeFact::BorderTexels are encoded variants. docs/REFUSALS.md regenerated
(refusal_surface.py): select_through's two sites. api_signatures.tsv blessed:
SpecKey::BorderTexels, RuntimeFact::BorderTexels and SamplerWord::READ_STATE are added; nothing
is removed or changed.

Why: the translation's output changed under unchanged keys, and the encoding gained two variants.

Verified: refusal_surface.py wrote the doc with 0 unmarked variants; signatures.py --bless
reported only those three additions; METAL-COVERAGE.md --check is current.

(cherry picked from commit 26c37d74d6d2a4bb395ff64a539eb7fc617619bd)
2026-11-10 01:30:11 -08:00
Anees Iqbal ecda2f87a5 Reads through a sampler: interpreter tests per state family, and the measured edge rows
What: engine_texture_oob/through.rs runs the fixture kernel_read_through's reads on every
profile class, with a four-channel and a one-channel format's border texels: constexpr samplers
of each address mode, border color and mip filter (per axis and mixed), 2D, 2D array, 3D, 1D,
read_write, texture buffer, int and half texels and an alpha read; a runtime [[sampler(0)]] at
six words (2D), four (texture buffer) and one (3D); every entry links and passes spirv-val, and
an argument buffer's texture through an opaque white border or a runtime sampler is refused
typed. The clamp-to-edge rows of EDGE_READS move there with the measured answers: a level or
layer outside reads zero in every lane, and edge_buffer's index outside its first texel. The
refusal test keeps the cube read and the 16-bit coordinates; the runtime, repeating and filtered
reads now translate. border_texels is checked against the M3's per-format answers.

Why: the reads of the previous commit, against the M3's measurements.

Verified: not yet run (the next build runs them).
(cherry picked from commit 35b48c92a5af15851bd73603c195a8a2d5ce0aaa)
2026-11-10 01:30:11 -08:00
Anees Iqbal a7c663dbc0 Fixture kernel_read_through: its companions, compiled with -std=metal4.1
What: scripts/regen-air-fixtures/regen-air-fixtures.sh kernel_read_through on the M3 (Apple
metal 32023.922, macOS SDK 27.2, LLVM 21 tools): kernel_read_through.ll and .air.ll, and its
TOOLCHAIN line.

Why: the owned MSL of reads through each sampler state family, which the translator's tests read.

Verified: the script's own check, that metal-as of the typed text reassembles the module.
(cherry picked from commit 9c18d497e92ae44fb98f49c29383b65dd77c67cb)
2026-11-10 01:30:11 -08:00
Anees Iqbal 5a43682074 Reads through a sampler: every constexpr, runtime and argument-buffer sampler state
What: Metal 4.1's read(sampler s, coord[, offset][, lod]) was built only for a constexpr
clamp_to_edge sampler of default state; every other constexpr state and every runtime or
argument-buffer sampler was refused. The read is now addressed by the sampler's state, decided
from its fields (a constexpr sampler's) or its word (a [[sampler(n)]]'s SamplerState
specialization with SamplerWord::READ_STATE, an argument buffer's sampler table entry):
- the level is the read's under a mip filter, else the base level; a level or array layer
  outside the texture reads zero in every lane;
- per plane axis, an index outside the level reads the border texel under clamp_to_zero and
  clamp_to_border, and clamps under every other mode;
- a texture buffer's index outside reads its first texel, but under a runtime sampler's
  clamp_to_edge, which clamps it;
- the border texel is the sampler's color in the bound format's channels through its swizzle,
  the new BorderTexels specialization (metal::sampler::border_texels, RuntimeFact::BorderTexels).
A heap texture takes only the transparent black border (its handle's alpha flag); another border
color there, a ulong texel's border, and a read_write texture's read at a computed level are
refused, as cubes and sparse reads stay.

Why: the M3 Max measures these reads (three probes, macOS 27.0.1, -std=metal4.1; the module docs
list the formats, kinds and states). The fixture kernel_read_through's MSL is added here; its
compiled companions and the tests follow.

Verified: not yet built; this commit carries the lowering for the first build.
(cherry picked from commit 4c40ba03e693441d0618a8f41f68bebb47a1e1cd)
2026-11-10 01:30:10 -08:00
Anees Iqbal fb1644378e Runtime-sources: list lower/users.rs, the used-parameter walk lower/dispatch.rs reads
What: crates/metal2vulkan-validation/build.rs lists metal2vulkan/src/lower/users.rs as a
runtime input, and the runtime-sources pin follows. c009a039fb's lower/dispatch.rs (a
listed input) calls lower::users::params_used, so the runtime's inputs reached an
unlisted file.

Why: the validation suite's guard failed at 51f0139737 (msi job m3-max-13324):
candidate::engine::artifact::tests::the_runtime_sources_are_the_committed_ones,
'the runtime inputs reach files that are neither inputs nor listed: [(lower/users.rs,
{lower/dispatch.rs})]'. No behaviour changes: no RUNTIME_VERSION bump.

Verified: the guard test at this commit (a scoped potluck job, next).
2026-11-10 01:19:43 -08:00
Anees Iqbal 51f0139737 Re-bless the authored compile census at c009a039fb
SEMANTICS 2012 (c009a039fb): the new owned fixture engine/dfk_dead_rog and the regenerated fragment_rog (209 new golden cells, 4 inventory rows, air_input printouts); the census follows the new product fingerprint.

Its product fingerprint follows development's versions at c009a039fb. Blessed on the
M3 (s37-pl.sh censusbless --bless).

(cherry picked from commit a775d9e5d3ad655c0b0e350f1099640d05224bd7)
2026-11-10 01:03:35 -08:00
Anees Iqbal b48c2b906b Re-bless the engine inventory and golden tables at c009a039fb
SEMANTICS 2012 (c009a039fb): the new owned fixture engine/dfk_dead_rog and the regenerated fragment_rog (209 new golden cells, 4 inventory rows, air_input printouts); the census follows the new product fingerprint.

Blessed on the M3 (s37-pl.sh bless: bless_engine_inventory, the air_input printouts,
bless_golden_hashes, then the check step).

(cherry picked from commit 0d3d442c75252a00777d476b6003c76890dc5240)
2026-11-10 01:03:35 -08:00
Anees Iqbal c009a039fb The runtime-sources pin for deadrog's shared params_used in lower/dispatch.rs
What: the twelve commits before this one (deadfetch, steelbrain/deadrog 93aaa9c668):
a raster order group or an interlock is decided from the parameters the specialized
body uses (rog::declared, color_group::entry), and a declared [[color(n)]] input
with no attachment is refused InvalidDescriptor(ColorAttachment) as Metal refuses it
(pipeline::compile::color_inputs_attached, in stage_inputs and plan_one; the dead
fetch fix of 4d187515d7 had let it through). SEMANTICS_VERSION 2012. The pin moves
because lower/dispatch.rs, a listed file, now calls the shared
lower::users::params_used instead of its own copy of the same walk: no behaviour
changes there, so no RUNTIME_VERSION bump (the new refusal is the translator's,
covered by SEMANTICS).

Verified (deadfetch): Metal on the M3 (probe dead_ordered_and_unattached_reads.m,
job 13241, macOS 27.0.1, with and without the debug layer) makes and draws the three
raster-order shapes dead and live, 64/64 texels, and refuses an unattached color
input dead and live. Negative controls at base (13247): 12 split refusals, 6
interlocks, 4 RasterOrderGroups refusals, 2+4 unattached pipelines made. At the
fix (13276): 123/123 touched tests; lavapipe color_groups/framebuffer_fetch/
raster_orders 64/64 at both widths (profiles layer carried from msi); M3 MoltenVK
63/63 (13277). Rebased tip (13286): core 3414 + the 4 bless rows (209 new golden
cells, no existing row moved). Generators and api-signatures --check unchanged.
2026-11-10 00:56:45 -08:00
Anees Iqbal ac0ffe1c25 Probe measurements and the API guide for reads dead after specialization
dead_ordered_and_unattached_reads.m records what it measured on the M3
Max under macOS 27.0.1 (potluck job m3-max-13241): dfr_color,
dfr_buffer and dfr_output are made and drawn, dead and live, every texel
the closed form's, with the debug layer silent; dfr_lacks has no state,
dead and live ('Shaders reads from a color attachment whose pixel format
is MTLPixelFormatInvalid'). Its header names the tests and the lane that
read it.

docs/API.md's color-group refusal list now names a raster order group on
a color output or on a parameter the function uses; one on a parameter
it never uses orders nothing and is not refused.

(cherry picked from commit 93aaa9c6685770db04032b710ec7b36950b56f89)
2026-11-10 00:55:27 -08:00
Anees Iqbal 4bae61044e Check a fragment's color inputs for attachments on the keyed path too
color_inputs_attached ran in grouped_entry, which a stage's keys
(stage_inputs) reach only for a color group's variant, and the runtime's
creation compiles each stage from those keys under given inputs, where
no check ran. It now runs on the specialized entry, before any group
renumbers it, in stage_inputs and in plan_one, for a render pipeline's
fragment stage (InputsFrom::Fragment).

(cherry picked from commit 277cf7472f972d4812f870cfeec9fb4f7715fba5)
2026-11-10 00:55:26 -08:00
Anees Iqbal 217c03089e Test: an unattached color input is refused on the keyed path too
The runtime's creation asks Device::render_variant_key first and
compiles each stage under the inputs it names; there a dead color 1
input beside a pipeline of color 0 alone was made (the color_groups lane
on the M3, job m3-max-13261), though the compile refused it.
a_color_input_without_an_attachment_is_refused_dead_or_live now checks
both paths. This commit adds the check alone.

(cherry picked from commit bc8e7e6adf8908bd7dc3570ee2ff0624a1d5357c)
2026-11-10 00:55:26 -08:00
Anees Iqbal 1727bef151 Lane color_groups: raster ordered reads dead after specialization, and an unattached input
The dead read scene also draws dfk_dead_rog's dfr_color (a color 0 input
in raster order group 0) and dfr_buffer (a buffer in group 0) with their
reads dead, in a pass of colors 0 to 4, as Metal's closed forms: two
groups on the device restricted to four, one where it draws every color.
On the restricted device each specialized live is the limit refusal.
dfr_lacks (a color 1 input beside a pipeline of color 0 alone) is the
pipeline's InvalidDescriptor(ColorAttachment) dead and live, as the
Metal probe dead_ordered_and_unattached_reads.m shows Metal refusing it.

(cherry picked from commit 537f5b15e5e8ce89e174f37109ec397a6376370c)
2026-11-10 00:55:26 -08:00
Anees Iqbal 354896cd7e Fixture fragment_rog: its compiled companions
scripts/regen-air-fixtures/regen-air-fixtures.sh fragment_rog on the M3
(potluck job m3-max-13255; Metal 32023.922, SDK 27.2); TOOLCHAIN now
records the fixture under that toolchain. rog_discard loads acc[0]
after its discard.

(cherry picked from commit b603645a19547e9f4430b2bc588716797cce6a5a)
2026-11-10 00:55:26 -08:00
Anees Iqbal 02a3084e12 rog::declared: the used-parameter filter copies its set's reference
The closure that lists the used parameters returns an iterator whose
filter borrowed the set through the closure; it now moves a reference
to the set in, so the iterator outlives no borrow of the closure.

(cherry picked from commit d6cfe6dbfe3f5e7bb52c879ba0b6df47e16e12c8)
2026-11-10 00:55:26 -08:00
Anees Iqbal ed53026f0d Inputs the specialized body never uses: no raster order, and Metal's check of their attachments
Three choices read a fragment function's declared parameters where the
specialized body's uses decide, which a Metal probe
(dead_ordered_and_unattached_reads.m, M3 Max, macOS 27.0.1) separates:

- A raster order group on a parameter the body never uses orders no
  access. lower::fragment::rog::declared interlocked such a function
  (and refused it RasterOrderGroups on a device without an interlock,
  and kept it from the coverage loop); it now counts only used
  parameters, the layouts they reach, and a color output whose
  attachment a used color input reads. Metal makes and draws dfr_color,
  dfr_buffer and dfr_output with the read dead as with it live.
- In a pipeline of more than one color group, color_group::entry refused
  a raster order group on any parameter; it now refuses one on a
  parameter the body uses (and on a color output, as before).
- A [[color(n)]] input without an attachment is Metal's pipeline error
  whether or not the body reads it ('Shaders reads from a color
  attachment whose pixel format is MTLPixelFormatInvalid', dead and
  live). Since fetch_inputs counts only used inputs, a dead one beside a
  pipeline without its attachment compiled. pipeline::compile's
  color_inputs_attached refuses it, InvalidDescriptor(ColorAttachment),
  against the pipeline's own attachments (a color group's present
  colors), before the group renumbers it. stage_io's zeroed_output keeps
  refusing a declared color input of a zeroed color, which is no
  pipeline Metal makes.

The reading of a used parameter is one function, lower::users::params_used
(the compile's params_used and the dispatch's used_params were copies).

SEMANTICS_VERSION 2012: such functions compile without an interlock,
pipelines of groups compile where they were refused, and the dead
unattached input is refused where it compiled.

Verified: see the test commit's negative control; this commit's run
follows.

(cherry picked from commit 0acde1e4312f218273c244423f76333dd1704c76)
2026-11-10 00:55:26 -08:00
Anees Iqbal 102288b581 Fixture fragment_rog: rog_discard reads its group's buffer
rog_discard named a raster order group on a buffer it never read, and
stood for an interlocked discard. A group on a parameter the body never
uses orders nothing, so it now reads the buffer after the discard
(in.color * acc[0]), keeping it an interlocked discard. The companions
follow from scripts/regen-air-fixtures on the M3.

(cherry picked from commit 6a2e4a3c955d10ac2fe3c7715e56e743d78a4d13)
2026-11-10 00:55:26 -08:00
Anees Iqbal 9c9fa8506a Tests: raster order groups and unattached color inputs dead after specialization
Over dfk_dead_rog, against the Metal probe dead_ordered_and_unattached_reads.m:

- tests::engine_dead_reads: a raster order group on an input the body
  never reads (dfr_color, dfr_buffer, dfr_output) compiles without an
  interlock on lavapipe, moltenvk-m3, moltenvk-m3 without interlock and
  (dfr_output) vk12-floor, as Metal draws them; live, each interlocks
  where the device has the pixel interlock and is refused where it has
  neither. A color input without an attachment (dfr_lacks beside color 0
  alone) is InvalidDescriptor(ColorAttachment) at index 1 dead and live,
  as Metal refuses both pipelines.
- tests::engine_color_groups: dfr_color and dfr_buffer dead over five
  colors on devices of four compile in both groups without an interlock;
  live, group 0 is the limit refusal.

This commit adds the tests alone, the negative control at the base
(development e51d85e18d).

(cherry picked from commit 10574778f72ae78164052aba2828215a8a8ccd1c)
2026-11-10 00:55:26 -08:00
Anees Iqbal b148544317 Fixture dfk_dead_rog: its compiled companions
scripts/regen-air-fixtures/regen-air-fixtures.sh dfk_dead_rog on the M3
(potluck job m3-max-13240; Metal 32023.922, SDK 27.2); TOOLCHAIN
records the fixture under that toolchain. dfr_color's, dfr_output's and
dfr_lacks' reads compile to a select on the loaded constant, dfr_buffer's
to a branch around the buffer's load.

(cherry picked from commit 64ef2bad2517eea662c9cd985e8edc102afa858e)
2026-11-10 00:55:26 -08:00
Anees Iqbal a6b063d52c Probe: plain Metal's draws of reads dead after specialization
A Metal probe over dfk_dead_rog's functions (source repeated, with
cg_cover): a color input in a raster order group, a const device buffer
in one, a color input of an output in one, and a color input of a color
the pipeline lacks, each made with its function constant false (dead)
and true (live), drawn once over an 8x8 pass. It prints whether the
state is made and, for each color, how many texels are the closed
form's. Measurements follow in a later commit.

(cherry picked from commit 8294732003b73ccf97f6f9d2c62ee3a34ff31e70)
2026-11-10 00:55:25 -08:00
Anees Iqbal 2fd80c96d5 Fixture dfk_dead_rog: inputs whose reads a constant decides, raster ordered or unattached
Owned MSL for cg_cover's interface: a color 0 input in raster order
group 0 (dfr_color) and a const device buffer in group 0 (dfr_buffer),
each over five colors; a color 0 input written back to a color 0 output
in group 0 (dfr_output); and a color 1 input beside a color 0 output
alone (dfr_lacks). Each read sits in the arm of a branch on a bool
function constant. The companions follow from
scripts/regen-air-fixtures on the M3.

(cherry picked from commit 049f1b4176e5b515042f28c13cc86c4ccbafbbe9)
2026-11-10 00:55:25 -08:00
Anees Iqbal 4a6b5a4458 Re-bless the authored compile census at e51d85e18d
SEMANTICS 2011 (e51d85e18d): the new owned fixture engine/dfk_dead_group adds its golden cells, inventory rows and air_input printout; the census follows the new product fingerprint.

Its product fingerprint follows development's versions at e51d85e18d. Blessed on the
M3 (s37-pl.sh censusbless --bless).

(cherry picked from commit a96b41bf2409299f21b72547821a5e78083b5f9c)
2026-11-10 00:18:50 -08:00
Anees Iqbal 141d6fabcc Re-bless the engine inventory and golden tables at e51d85e18d
SEMANTICS 2011 (e51d85e18d): the new owned fixture engine/dfk_dead_group adds its golden cells, inventory rows and air_input printout; the census follows the new product fingerprint.

Blessed on the M3 (s37-pl.sh bless: bless_engine_inventory, the air_input printouts,
bless_golden_hashes, then the check step).

(cherry picked from commit be753120be7560baec839dd8504459647ae7ad6f)
2026-11-10 00:18:50 -08:00
Anees Iqbal e51d85e18d API guide: a color input of another group is refused only where it is read
docs/API.md's color groups paragraph lists what each group's draw would
read from another group as the pipeline's limit refusal; a
[[color(n)]] input of another group is that only where the specialized
function reads it, as pipeline::compile::color_group::entry now decides.

(cherry picked from commit 1df7b9589dc6bda472d3faaa14bf432677647658)
2026-11-10 00:11:07 -08:00
Anees Iqbal 7901d00e79 Lane color_groups: a read of another group dead after specialization draws
The color groups lane gains a dead read scene over dfk_dead_group:
dfg_branch and dfg_gated, specialized with their read of color 4 dead,
draw a pass of colors 0 to 4 as Metal's closed forms (tint and its
swizzles), in two groups on the device restricted to four (one group
pass past the first, no twin) and in one where the device draws every
color at once. On the restricted device dfg_branch specialized live is
the pipeline's limit refusal, as before.

(cherry picked from commit c9d8b0718565dcc2d9b2caf10b5410e50b6ebdb4)
2026-11-10 00:11:07 -08:00
Anees Iqbal 546c63155e A color group's variant refuses only a color input of another group that the body reads
What: pipeline::compile::color_group::entry refused, in a pipeline of
more than one color group, every [[color(n)]] input of another group
the specialized fragment entry declares, used or not. A function whose
read of such a color its constants make dead (a branch on a bool
constant that Metal's compiler turns into a select, folded by SCCP)
was the pipeline's limit refusal on a device of four color attachments,
though it reads nothing there and the variant compiles as a plain
writer of its group's colors. It now refuses only an input an
instruction of the specialized, canonicalized body uses (params_used,
the reading fetch_inputs and the lowering take); an unused one is
renumbered past the group's colors as before. A raster order group on
a color input is still refused in a split, used or not.

SEMANTICS_VERSION 2011: such pipelines compile where they were refused.

Verified: see the test commit's negative control and this commit's
run of tests::engine_color_groups.

(cherry picked from commit d10372c768e96b10e960810b9eec87c891a694d4)
2026-11-10 00:11:07 -08:00
Anees Iqbal ae3c804dce Test: a read of another color group dead after specialization is no refusal
tests::engine_color_groups gains a test over dfk_dead_group: five colors
on a device of four (lavapipe and moltenvk-m3 narrowed to four, and
vk12-floor) draw in two groups, color 4 in the second. Specialized with
the read of color 4 dead, each group's variant of dfg_branch and
dfg_gated must compile as a pipeline of its group's attachments that
reads none, passing L3; specialized live, group 0's variant must be the
pipeline's limit refusal. Misses are counted by kind before failing.

This commit adds the test alone, the negative control at the base
(development 4d187515d7).

(cherry picked from commit f41511c12bc63a3cdb31b2f92f4de585a32da3b9)
2026-11-10 00:11:07 -08:00