Commit Graph
10702 Commits
Author SHA1 Message Date
Anees Iqbal ea428bca8b Pin AC bless: the golden hashes after varyflag, levelrule, yuv422 and the watchdog
The golden table re-blessed at ae78d6c14f (pin AC's stack on pin AB' cb574b06fa), on the Apple M3
Max, job m3-max-87911 (inventory, golden, printouts, linkhalf and chains each exit 0):
- the semantics line moves 2394 -> 2395, yuv422's number;
- no cell moves and no row is added, the metal-as fixtures included: a 4:2:2 texture's decode
  lives only in a content re-lowered for its bindings, so no default module changes.
2026-12-04 21:55:45 -08:00
Anees Iqbal ae78d6c14f Validation: the worker watchdog charges compressed and swapped memory, not resident memory alone
The worker memory watchdog summed each process-group member's resident size: VmRSS on Linux,
proc_pid_rusage's ri_resident_size on macOS. Under memory pressure the system takes a worker's
pages out of its resident set (macOS's compressor; Linux's swap, to a disk or to compressed RAM
such as zram), so a group holding more than the 500-MiB ceiling could pass it unseen. On CI's
macOS job at 9e7034c214, worker_memory_watchdog_enforces_aggregate_limit ran into its 20-s
deadline: its two 256-MiB children (one written byte a page, nearly all zero) never summed to the
limit. That is the product ceiling going soft under pressure, not only a test problem.

What a member is charged (process_charged_bytes) is now:
- macOS: the larger of ri_resident_size and ri_phys_footprint, from the same proc_pid_rusage call.
  The SDK's sys/resource.h declares both in rusage_info_v2 with no comment; footprint(1) defines
  the ledger: "phys_footprint - the current value of the kernel ledger tracking the amount of
  dirty memory owned by a process", Dirty "includes "(Swapped)" memory, ... and memory written to
  implicitly, such as zero-filled", and (Swapped) is "A subset of Dirty memory that has been
  compressed or swapped to storage by the kernel". The footprint leaves out clean file-backed
  pages the resident size counts, so the larger of the two never trips later than before.
- Linux: VmRSS + VmSwap from the same /proc/<pid>/status read (status_charged_bytes). The member
  rules of process/linux.rs are unchanged: a member before its exec that shares its parent's
  memory is charged nothing, a copy-on-write one is counted (an overcount, never an undercount),
  and every other member is charged its own VmRSS and VmSwap, read after its flags.

Names that would lie are renamed: worker_resident_bytes -> worker_charged_bytes,
member_resident_bytes -> member_charged_bytes (both platforms). process_resident_bytes keeps
the resident size alone for own_resident_bytes, whose figure (corpus-triage's parent_rss_bytes,
the supervisor-heap test) stays resident memory; its doc no longer says it is read as workers'
are. The stop's message says "process-group memory budget". Docs that called the sampled figure
RSS (worker.rs, compile.rs, alloc.rs, audit.rs, budgets.rs, translation_audit.rs,
authored_compile.rs, corpus-pipeline.rs, corpus-triage's usage, docs/HOWTO.md's recipe) now say
memory; report keys (peak_*_rss_bytes, peak_resident_bytes) keep their names.

A stop at the ceiling is a recorded `failed oom` row of the engine census and of the
specialization lane's attempts, and its detail is the stop's message, so the measure can change
a recorded row: ENGINE_CENSUS_VERSION 8 -> 9 and SPECIALIZATION_AUDIT_VERSION 6 -> 7, as both
were bumped when the member charging last changed (engine 5, specialization 2). The authored
compile census records no worker stop (failures are never cached), so its version stays.

The fixture is unchanged: it now trips on its zero-filled pages wherever the system compresses or
swaps them.

Verified: a_members_swapped_memory_is_charged failed at the parent commit (lavapipe-free CPU
job m3-max-87876: left 307200000, right 563200000; 19 other worker::process tests passed). The
macOS arm is unchecked before the push (no Mac job); it stands on libc 0.2.189 and 0.2.191's
rusage_info_v2 (pub ri_phys_footprint: u64, beside the ri_resident_size this code already read)
and on CI's macOS job.
2026-12-04 21:24:00 -08:00
Anees Iqbal a0c8c1c88b Validation: a test that the worker watchdog charges a Linux member its swapped memory (red)
The worker memory watchdog sums each process-group member's VmRSS on Linux
(process_resident_bytes) and ri_resident_size on macOS. Under memory pressure
the kernel takes pages out of the resident set (swapped out on Linux, to a disk
or to compressed RAM such as zram; compressed on macOS), so a worker holding
more than the 500-MiB ceiling can pass it unseen: on CI's macOS job,
worker_memory_watchdog_enforces_aggregate_limit ran into its 20-s deadline
with two 256-MiB children that the limit never stopped.

This commit draws the status read's charge out as status_charged_bytes,
unchanged (VmRSS alone), and adds a_members_swapped_memory_is_charged: a
synthetic /proc/<pid>/status with VmRSS 300000 kB and VmSwap 250000 kB must be
charged 550000 kB. It fails here; the next commit charges VmSwap.
2026-12-04 21:24:00 -08:00
Anees Iqbal 4e24418619 Conformance: Metal's timings of the four 4:2:2 sampling cases
conformance times --runs 8 --write over chroma-pair-texel-gathers-gbgr422, -gathers-bgrg422,
-linear-samples-gbgr422 and -linear-samples-bgrg422 on the Apple M3 Max, macOS 27.0.1, job
m3-max-87887. The run adds times to the four recordings and changes no answer: 508 lines added,
none removed. times::every_case_carries_its_timing failed without them (conformance suite job
m3-max-87880, 1062 of 1064 passed with the textures guard); this commit closes it. Coverage
regenerated.
2026-12-04 21:23:52 -08:00
Anees Iqbal 10ef459cd0 Conformance: the textures table's guard leaves the 4:2:2 formats to chroma_pairs
With GBGR422 and BGRG422 held as their bytes in R8G8_UNORM, the translator's byte format of each
is a 2-byte texel, so the guard asked the textures round-trip table for them
(cases::textures::tests::the_table_is_exactly_the_formats_whose_texels_are_metals_bytes failed,
conformance suite job m3-max-87880). Their host round trips are chroma_pairs' copy cases', on and
off the 2-texel pairs, so the guard sets them aside as it sets aside the copies-only formats.
2026-12-04 21:23:52 -08:00
Anees Iqbal ffec1a43ab Runtime README: the 4:2:2 content's cost, measured once
The planner's one timing for the known gap (job m3-max-87867, an RTX 3090 at P0, 620.70.06): a
linear sample at a quarter point of each texel of a 1920 by 1080 frame through fpv_swz_sample,
three alternating rounds of 24 command buffers, the median GPU span of each round's last 20:
GBGR422 over a Private buffer in place 135,424 / 135,232 / 135,360 ns, RGBA8Unorm over a Private
buffer in place 80,544 / 80,576 / 80,512 ns, ratio 1.68. The content's make at the first dispatch,
the translation at encode, took 4,746,194 ns there (Metrics::translation_at_encode_max_nanos),
within the translator's bounded lowering as a state's make is, far inside the 20 s ceiling. The
timing test is a carried patch, not committed.
2026-12-04 21:23:52 -08:00
Anees Iqbal d73a21686c Ledger: the 4:2:2 linear-sample rows are every venue's
KosmicKrisp on an Apple M3 Max (job m3-max-87863, the pre-push replay at 4d09c9ed97) answers both
linear-sample sites with the digest llvmpipe gives (job m3-max-87851): the decode's filter is the
shader's arithmetic, so the rows' venue widens to *. Those two were the replay's only unexpected
lines. Coverage regenerated: no change.
2026-12-04 21:23:51 -08:00
Anees Iqbal 5fc261de14 Conformance: the 4:2:2 fills declare the texture's static note
texture-fills-240 and -241 make a GBGR422 and a BGRG422 texture, whose static note
(bicubic-filter-arithmetic, Texture::precision_note) the rt side announces; the replay at
bff946134f (job m3-max-87842, llvmpipe in the image) read it as undeclared at their notices site.
Every other row that run held was as the ledger lists. Coverage regenerated: no change.
2026-12-04 21:23:51 -08:00
Anees Iqbal 8f90cd52ec Versions: ARTIFACT_FORMAT_VERSION 618, the number the orchestrator assigned
The held push's varyflag takes 617; this branch's artifact codec carries
StageInterface::handle_float_images and the two 4:2:2 lowering inputs.
2026-12-04 21:23:51 -08:00
Anees Iqbal 4b4d8f5e77 Ledger: the 4:2:2 rows follow the lavapipe replay; coverage regenerated
From the replay in the lavapipe image (job m3-max-87827) and the commits since:
- heap-sizes-422's 20 rows go: each site now matches Metal under the accepted difference of the
  device's own heap sizes.
- chroma-pair-texel-reads, -samples and -gathers (both formats) go: reads were announced
  (device-texel-conversion, a native note), and the sampling cases now declare the notices the rt
  side announces.
- chroma-pair-texel-linear-samples-* are divergent rows on llvmpipe: the decode's own filter
  arithmetic, the texture's static note BicubicFilterArithmetic, as ruled.
- chroma-pair-copies-* name Gap::ChromaPairsUse of CloseRows at the 30-byte-row blit (step 37).
- texture-fills-240 and -241 now reach the rt side's fillTexture, Unavailable as every other
  fill row.

The replay at this commit checks the rows.
2026-12-04 21:23:51 -08:00
Anees Iqbal 97f1de6040 Versions: RUNTIME_VERSION 2580 with the runtime sources re-pinned; SEMANTICS_VERSION 2395
The changed behaviour of a run: GBGR422 and BGRG422 map to R8G8_UNORM with
FormatEmulation::ChromaPairs (metal/format/mod.rs, a pinned runtime input) instead of the
Decoded RGBA8 twin, so RUNTIME_VERSION moves with the hash (870c1824..., by pin-compute.py, which
gives development's committed pin at 9e7034c214). The guard failed at 27104ce862 (job
m3-max-87839). SEMANTICS_VERSION takes 2395, after 2392 (pin AB') and varyflag's 2393 and 2394.

Also: the ChromaPairsUse basis names CloseRows without a link, so REFUSALS.md carries no bracket.
2026-12-04 21:23:50 -08:00
Anees Iqbal 4edb790b23 Runtime: a 4:2:2 texture states its static note; a copy of its rows closer than the region's is a gap
The lavapipe conformance replay (job m3-max-87827, in the image) named what changed once 4:2:2
textures are made:

- A linear or bicubic sample of a 4:2:2 texture filters the texels the lowered content decodes,
  in the shader's arithmetic. The texture now states PrecisionNote::BicubicFilterArithmetic as
  its static note (Texture::precision_note, as a block-compressed texture states its own), fixed
  by the format, so the note is announced where the texture is made and not only in the content
  lowered at the first dispatch.
- Metal takes a blit between a buffer and a 4:2:2 texture whose buffer rows are closer together
  than the region's rows are long (chroma-pair-copies, rows 30 bytes apart for a 32-byte row, an
  Apple M3 Max). The runtime refused it as no layout Metal takes. It is now
  Gap::ChromaPairsUse { cause: ChromaPairsGap::CloseRows }: one Vulkan copy region takes no row
  stride below its width (VUID-VkBufferImageCopy-bufferRowLength-09101), and one region a row
  would build it with no extra copy, which the README's known gap says. Planner's ruling: a gap
  in this pin, built when a guest meets it.
- The conformance cases declare the notices the rt side announces for them:
  bicubic-filter-arithmetic for every 4:2:2 case, and pixel-sampler-scaling for the sampling and
  gathering ones, through the fixture's runtime sampler slot.

REFUSALS.md and the API signatures regenerated.
2026-12-04 21:23:50 -08:00
Anees Iqbal e5d5698dc3 Conformance: the 4:2:2 case's docs name its private helpers without links
Rustdoc with -D warnings refused the public module doc's links to the private hashed and
linear_positions (job m3-max-87829).
2026-12-04 21:23:50 -08:00
Anees Iqbal bbacaa9a7f Runtime tests: the 4:2:2 device test prints its bound and address dispatches
Which buffer form the device took for the decoding kernels (rule 2's bound buffers or their
addresses) goes beside the chroma counters in each card's lines.
2026-12-04 21:23:50 -08:00
Anees Iqbal cfa1a825c7 Runtime tests: the 4:2:2 refusal test grants its read texture's index
Index 2 was not granted (job m3-max-87820, llvmpipe); the test now grants it per device, as the
read, sample and gather test grants its own.
2026-12-04 21:23:50 -08:00
Anees Iqbal c23c3ca34e Runtime tests: the 4:2:2 refusal test gives its read texture an index
A texture shaders read takes an index; the test made its plain 4:2:2 texture without one and met
Refusal::TextureIndex before the view it asks (job m3-max-87817, llvmpipe).
2026-12-04 21:23:49 -08:00
Anees Iqbal c4a205f9e5 Runtime: a 4:2:2 texture's unbuilt use is its own gap before the format query
A texture of GBGR422 or BGRG422 asked with render-target usage met the format query first, which
offers the bytes' R8G8 image no render-target use on any device, and answered Gap::TextureFormat
instead of Gap::ChromaPairsUse { cause: RenderTarget }. The use is now asked first, keyed by the
format as Metal's 4:2:2 rules are.

Found by the device test every_device_refuses_what_metal_refuses_of_four_two_two_textures on
llvmpipe (job m3-max-87813), whose read, sample and gather test passed there (chroma_contents +6,
chroma_launches +80).
2026-12-04 21:23:49 -08:00
Anees Iqbal 0558bb7979 Runtime: the test literals take handle_float_images; the 4:2:2 known gap and note docs say what is true now
The Draws and Interface literals of tests/indirect.rs and tests/compute.rs
missed the new field (job m3-max-87802, E0063). The README's 4:2:2 known gap
now states the content lowered for the texture, its counters and costs, and
the refusals and gaps; PrecisionNote::BicubicFilterArithmetic's doc and its
docs/API.md entry name a 4:2:2 texture's linear sample.
2026-12-04 21:23:49 -08:00
Anees Iqbal 6fe743aa73 Runtime: 4:2:2 textures are made, decoded by contents lowered for them, and refused as Metal refuses
A GBGR422 or BGRG422 texture is made (FormatEmulation::ChromaPairs, its image
R8G8_UNORM of the bytes), over a buffer as any 2D texture. Only a content
lowered for it reads its texels as Metal's:

- KernelKey carries a Chroma: the texture slots bound to a 4:2:2 texture per
  stage, and whether a stage may reach one through a handle while one lives
  (PipelineInterface::handle_float_images and Gauges::chroma_textures).
- A dispatch picks the kernel state's content for it beside the sRGB and word
  variants (ComputePipelineState::variant), a draw the state's content for its
  draws (RenderPipelineState::for_draws); both are made at the first need,
  counted in Metrics::translations_at_encode and Metrics::chroma_contents, and
  kept in the device's map of contents (LRU, KERNEL_ENTRIES), whose
  fill-past-capacity test is tests/kernel_map.rs's
  the_map_holds_its_cap_and_forgets_the_least_recently_used. A draw or
  dispatch on one counts in Metrics::chroma_launches. A state without either
  runs its own module as before.
- Refusal::ChromaPairs (metal-measured, Metal's own asserts): a type other
  than 2D (texture buffers included), an odd width, more than one level, a
  view.
- Gap::ChromaPairsUse: ShaderWrite (and unknown) usage, RenderTarget usage, a
  swizzle at the make, and a function compiled outside the runtime bound to
  one or reaching one through a handle (the consumer never hands the runtime
  such a kernel).
- Buffer::new_texture's doc states that Metal refuses a linear 4:2:2 texture
  and why the runtime takes one.

The device test now asserts the six kernel states' contents, the 80
dispatches on them and the live gauge, and a second device test the
refusals and gaps. docs/REFUSALS.md and basis.rs regenerated (the
TextureSwizzle row's site list was stale at the base and is current now);
the API signature table blessed. Not yet built.
2026-12-04 21:23:49 -08:00
Anees Iqbal af7d2e1632 Translator: the plan carries which slots and handles decode 4:2:2 bytes
The emission context has no lowering inputs: selection records
LoweringInputs::chroma_pairs in each texture slot's plan (SlotPlan::chroma) and
chroma_handles beside heap_extended (AccessPlan::heap_chroma), which the
decode reads. Fixes the E0609 errors of job m3-max-87777.
2026-12-04 21:23:49 -08:00
Anees Iqbal afec47efc2 Translator: a 4:2:2 texture is decoded only by a function lowered for its bindings
The specialization-constant gate weighed every float 2D sampling stage with the
dead decode arms (spirv::roll::weights counts every block), which moves the
roll, the kernels' helper path and the render stages' bound for pipelines that
never see a 4:2:2 texture. The decode is now a lowering input, as srgb_storage
and word_bound_buffers are:

- LoweringInputs::chroma_pairs names the texture slots bound to a GBGR422 or
  BGRG422 texture: each read, sample and gather of a float 2D sampled image
  there takes Metal's decoded texels alone, the order read from the slot's word.
- LoweringInputs::chroma_handles: each heap handle carries the 4:2:2 marks and
  each access through a handle branches on them.
- Without either nothing of the decode is emitted, so a function's module is
  the one it was. SpecKey::ChromaPairs is gone.
- StageInterface and PipelineInterface::handle_float_images state whether a
  function reaches a float colour image through a handle (the plan's
  heap_extended), which the runtime reads to choose the handles content.
- BicubicFilterArithmetic is recorded only where the input names the site's
  texture and the sampler may magnify linearly.
- The clippy errors of job m3-max-87748 are gone (the unused READ_WORDS, the
  indexed lanes).

ARTIFACT_FORMAT_VERSION 617 for the interface field. The API signature table
is blessed. New tests in src/tests/engine_chroma_pairs.rs: a slot named in
chroma_pairs decodes and validates on every committed profile and records the
note only for the linear-capable sample; a slot the kernel does not declare
and chroma_handles on a function without handles leave the module word for
word; a4_heap_sample under chroma_handles validates and differs. Not yet run.
2026-12-04 21:23:48 -08:00
Anees Iqbal 496be31c3b Translator: the 4:2:2 sample arm borrows its builder once at a time
Build fixes for 920324aeba (job m3-max-87745 failed its clippy on two borrows): border_bits takes the
context mutably, and the nearest arm makes its footprint before the decode.
2026-12-04 21:23:48 -08:00
Anees Iqbal 95f1391bb4 Translator: 4:2:2 textures held as their bytes, decoded under SpecKey::ChromaPairs (first build)
GBGR422 and BGRG422 are held as R8G8_UNORM at full width (FormatEmulation::ChromaPairs), two bytes
a texel, which copies move unchanged. Every float 2D sampled image's read, sample, gather, pixel
fetch and bicubic sample keeps the device's access and, where the stage's new
SpecKey::ChromaPairs holds and the texture's word names a 4:2:2 format, a branch computes Metal's
answer from the decoded texels (lower::texture::chroma, lower::sampler::chroma). A heap handle
carries the format's marks in place of its word bits under the same constant. SEMANTICS_VERSION
2395 (its final number in pin AC).

Not yet built: this commit is the first build's input; fixes follow forward.
2026-12-04 21:23:48 -08:00
Anees Iqbal c9f973f88e Conformance: the Apple M3 Max's recordings of the 4:2:2 linear samples and gathers
The four cases 0a26c673d9 added, recorded on the Apple M3 Max under macOS 27.0.1 (26A434), three
runs each with one outcome (job m3-max-87684 at 0a26c673d9):

- chroma-pair-texel-linear-samples-{gbgr422,bgrg422};
- chroma-pair-texel-gathers-{gbgr422,bgrg422}.

The job's tree showed only these four files new, so the four texel recordings taken before stay
current.
2026-12-04 21:23:48 -08:00
Anees Iqbal fe29e9f4a6 Runtime tests: 4:2:2 textures over a surface buffer, refused today
A device test of what the consumer's camera frames need: GBGR422 and BGRG422 textures made with
Buffer::new_texture over buffers laid out as 'yuvs' and '2vuy' surfaces (64x8 over Shared and
Private buffers at rows 128 and 192 bytes apart, and 640x480 at 1280 over a Private buffer, the
consumer's frame), each made in the form texture_copy_cause answers and the 640x480 one in place;
every texel read and nearest-sampled at its centre as Metal's decode (jobs m3-max-87650 and
m3-max-87653: own luma, chroma (3c + n + 2) >> 2 of its pair and the pair on its side, each code
c / 255 correctly rounded), each component gathered at every footprint corner, and linear samples
at the corners and a quarter between texels within f32 rounding of the decoded texels' mean.

It fails today at the texture's make, Gap::TextureFormat, on every device: the red half of the
4:2:2 form that follows.
2026-12-04 21:23:47 -08:00
Anees Iqbal 0d406e1fd8 Conformance: 4:2:2 linear samples and gathers, refused on rt today
chroma_pairs gains two accesses of each 4:2:2 format, so the form that makes these textures is held
to Metal's filtered and gathered answers as well as its reads and nearest samples:

- chroma-pair-texel-linear-samples-{gbgr422,bgrg422}: sample() through a linear clamp-to-edge
  sampler at 552 positions (a quarter past each texel toward its right neighbour, the corner of
  each 2 by 2 footprint, the centres of rows 0 and 7, and u at 0, 1, -0.25 and 1.25 in rows 0 and
  15);
- chroma-pair-texel-gathers-{gbgr422,bgrg422}: gather() of each component through the nearest
  clamp-to-edge sampler at the corner of each 2 by 2 footprint, 256 positions, one dispatch and
  site a component.

Both read a texture of hashed bytes, whose neighbouring pairs' chroma do not all differ by
multiples of 4, so Metal's (3c + n + 2) >> 2 rounding shows; the step pattern the read and the
nearest sample recordings were taken over gives 3c + n a multiple of 4 at every texel
(the_hashed_texture_shows_the_decode_rounding). The accesses of one entry keep their recorded call
order and inputs, so the four existing texel recordings stay current.

The four cases are refused on rt at every venue today (Gap::TextureFormat at the texture's make),
the ledger's rows say so; their Metal recordings follow from the M3.
2026-12-04 21:23:47 -08:00
Anees Iqbal 8e895593e1 Docs: NVIDIA's free holds say only what was measured; the unsourced per-MiB figure goes
The runtime's README (Known gaps of memory blocks), memory.rs's IDLE_AGE_NANOS doc and
counters.rs's Metrics::submissions_during_frees doc each said that freeing host-visible memory
takes about 1.1 ms per MiB on the NVIDIA cards measured in Thunderbolt enclosures (the README also:
about 0.5 ms per 16 MiB on an internal card, and that the free holds any submit for its length).
The only record of those figures is 0280c19285's message, with no job on file. They go. The README
line now says a driver may hold a submit for a free's length and points to the measured NVIDIA rows
below it; the two doc comments keep only "a driver may hold".

The hold paragraph opened with "NVIDIA's Linux driver holds a submit ...", stated for every NVIDIA
driver. Its evidence is an RTX 3090 under 620.70.06 (rtsweep's standalone program, 9e250379d3 and
ef875741cc, and the consumer's walk m3-max-57463, 028a764c68) and an RTX 2080. It now names the
cards measured.

The paragraph's walk sentence keeps its figures (frees of imported blocks, 0.4 to 2.9 ms each and
52 in one second, held four submits for 5.2 to 6.9 ms). The walk's raw log is gone, but its derived
table is on file: the consumer's take-site table for m3-max-57463 (rt 2233c8962d, an RTX 3090,
336 s, allocate, free and submit timers on rt's own clock), sent to us on 11-20 and kept in the
consumer's session record. Its line reads: "73.5 s, four submits of 5.2-6.9 ms: 3-5 block-own
vkFreeMemory each, 0.4-2.9 ms apiece, on m2v-blocks. 97-100%. By stamp these are guest-memory
import frees, 52 in that second."

The per-claim source audit was lane uniarm's (its commit e2e4ae1bb7 on the parked
steelbrain/uniarm-landing, whose doc-comment hunks this takes unchanged). No code changes; the
README text names no job.
2026-12-04 21:23:47 -08:00
Anees Iqbal 51d2a509b5 Conformance: Metal's timings of the one-level filter cases
`conformance times --runs 8 --write` over sampler-one-level-filters-level and -bias on the Apple
M3 Max, macOS 27.0.1, job m3-max-87764. The run adds times to the two recordings and changes no
answer: 254 lines added, none removed. times::every_case_carries_its_timing failed without them
(conformance suite job m3-max-87753, 1061 of 1062 passed); this commit closes it.
coverage.py --check still reads "as derived".
2026-12-04 21:23:47 -08:00
Anees Iqbal 4568d32fc6 Conformance: the Apple M3 Max's recordings of the one-level filter cases
sampler-one-level-filters-level and -bias, recorded on the Apple M3 Max, macOS 27.0.1, job
m3-max-87749 (3 runs, one outcome each). Every lane of every cell reads one filter. Under the
clamp [0, FLT_MAX] the magnifying filter takes -2, -0.5 and 0 and the minifying filter takes
1/64 and up. lodMinClamp 1 gives the minifying filter at every level, and lodMaxClamp 0 the
magnifying filter at every level. This holds for all three mip filters, both (min, mag) pairs,
level() and a kernel's bias(). So Metal reads the choice after the sampler's clamp and before
the clamp into the texture's one level, as 87718 showed for samplers without a mip filter. The
case's doc holds the table. level.rs's one-level paragraph now names the cases' facts, which
settle the sampler-clamp side.

docs/CONFORMANCE-COVERAGE.md regenerated by scripts/conformance-coverage/coverage.py; --check
reads "as derived". level.rs stays comment-only; pin-compute.py still prints the committed
runtime-sources hash.
2026-12-04 21:23:46 -08:00
Anees Iqbal 6aa64832f5 Conformance: which filter a sampler of two filters reads on a texture of one level
Two cases, sampler-one-level-filters-level (unv_runtime_levels' unv_rpos2d, level()) and
sampler-one-level-filters-bias (mip_level_sampling's mip_bias_kernel, a kernel's bias()), over
a 16 x 4 R32Float texture of one level whose texels are distinct. Each samples a quarter of a
texel past every texel's centre (60 positions) at the nine levels of the Metal probe job
m3-max-87718 (-2, -0.5, 0, 1/64, 1/4, 1/2, 1, 2, 5), through the runtime sampler in 18 rows:
every mip filter x the two (min, mag) pairs whose filters differ x three clamps (Metal's
defaults, lodMinClamp 1, lodMaxClamp 0). A nearest sample there is the texel and a linear one
the texel plus 1/4, exact in float, so every lane names the filter that read it.

This is the evidence that the device's own sampler path, which takes Vulkan's choice (λ after
[minLod, maxLod], before the view's levels), matches Metal on a one-level texture. The test
the_recorded_filters_are_chosen_before_the_texture_levels_clamp holds every recorded lane to the
rule level.rs now states, and counts the lanes where the old reading (the choice after the
texture's levels clamp) names the other filter. Recordings follow from the M3.
2026-12-04 21:23:46 -08:00
Anees Iqbal e52085541e Docs: Metal chooses between a sampler's two filters before the clamp into the texture's levels
level.rs stated Metal's rule as "every sampler magnifies where L + q is 0", with L + q taken after
the clamp into the texture's levels, and left a texture of one level unmeasured. A Metal probe of
the Apple M3 Max on macOS 27.0.1 (job m3-max-87718) measured it: a 16 x 4 rgba8Unorm texture of
one level, through runtime samplers without a mip filter whose filters differ (min nearest / mag
linear and the reverse), at level() and a kernel's bias() of -2, -0.5, 0, 1/64, 1/4, 1/2, 1, 2 and
5, 60 positions each, takes the magnification filter at -2, -0.5 and 0 and the minification
filter at every level from 1/64 up. The stated rule would have magnified at every level. So the
choice reads the level after the half rounding and the sampler's clamp, before the clamp into
the texture's levels. On a texture of more than one level the two readings agree, so the 2,230-
level probes the module cites still hold.

Comment-only. No code takes this choice where the module reads texels itself: an extended-range
sample's constexpr sampler with differing filters is refused, and a runtime word with mixed
filters reads nearest (extended's open gap). The device path follows Vulkan's rule (λ after the
sampler's [minLod, maxLod], before the view's levels), which the device paragraph now says matches
Metal's choice. No translation changes, so SEMANTICS_VERSION stays. level.rs is not a
runtime-sources input: pin-compute.py on this tree prints the committed e8f7cd09...6798, so
the pin does not move.
2026-12-04 21:23:46 -08:00
Anees Iqbal e7f9a98fbf Varyflag step 2 bless: the golden hashes at semantics 2394
The golden table re-blessed at 6495aabffd (varyflag step 2 rebased on step 1's 47c09be7ae), on
the Apple M3 Max, job m3-max-87793 (inventory, golden, printouts, linkhalf and chains each exit 0):
- the semantics line moves 2393 -> 2394, step 2's own number (2392 at that bless, renumbered
  when the stack moved onto pin AB');
- no cell moves and no row is added.
2026-12-04 21:23:46 -08:00
Anees Iqbal a8cec25600 Docs: the widened-varying accepted difference states the Mac and OS, not the job
scripts/api-docs (ci-gaps leg m3-max-87688 at ae5f9bcd2f) refuses a lab job id in docs/API.md's
prose: the measurement is stated by its card and OS (Apple M3 Max, macOS 27.0.1 26A434); the
job, m3-max-87586, stays in the commit messages.
2026-12-04 21:23:46 -08:00
Anees Iqbal c0b1616a36 Tests: the agx draw test reads its texels through as_chunks
clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd (job m3-max-87679 at ae5f9bcd2f) refused
chunks_exact with a constant size in mismatched_varyings (clippy::chunks_exact_with_const_size,
-D warnings). The texels are read as words, then as four-word arrays, both by as_chunks.

Verified by the rerun of both clippy configurations and the lavapipe run of the test in
the job named in the READY message.
2026-12-04 21:23:45 -08:00
Anees Iqbal 87484e206a Pipeline: LoweringInputs::widened_varyings serializes as pairs
serde_round_trips::lower_inputs failed at 5ab16afb13 (job m3-max-87672, on the
translator suite's focused run): JSON refuses a map whose keys are VaryingKey ("key
must be a string"). The field takes serde_pairs, with its default, as extended_range
and storage_images do.

Verified by the same job's rerun in the suites job named in the READY message.
2026-12-04 21:23:45 -08:00
Anees Iqbal 255f758265 Pipeline: behind the agx flag a wider fragment input reads its vertex output's lanes, then zeros
The planner's ruling for the wide case of agx.allow_mismatched_component_counts: Metal
makes a render pipeline whose fragment function reads a varying at more components
than its flagged vertex function writes, and leaves the lanes past the output's
undefined (M3 Max, macOS 27.0.1, job m3-max-87586: 150 such lanes read 147 distinct
values, none written). One form on every device, decided at pipeline make by structure:

- LoweringInputs::widened_varyings (new public field, serde default): the user varyings
  a flagged vertex function writes at fewer lanes than the pipeline's fragment function
  reads, with the count it reads, of the same AIR scalar type. compile_render_pipeline
  and render_variant_key derive it from the two Function stages' specialized entries
  (compile.rs widened_varyings: return-struct field types against fragment-input
  parameter types), only where the vertex entry carries the flag; a Compiled stage on
  either side gives none. render_pipeline compiles the vertex stage, and only where its
  StageIo carries the flag and the set is not empty compiles it again under the set;
  render_variant_key hands it to the vertex inputs, so a runtime's stage-by-stage
  compile under the keys widens too, and the pipeline key matches.
- Planning declares such an output at the read count (StageIo outputs list it so, so
  link matches equal types) and marks its object in StageIoPlan::widened; store writes
  the value's lanes then a constant 0 per extra lane (OpCompositeConstruct). Colour
  outputs, whose declared components may differ from their form for other reasons, are
  never marked.
- The key appends the set only when set: every other function keeps its key.
- Link is unchanged: a wider input behind a vertex function compiled alone stays
  Unsupported{UnmatchedVarying, NotImplemented}, as does a mesh producer; flag 0 or
  absent stays Metal's link error.

Docs: docs/API.md accepted differences gains the line (Metal undefined, we give zeros;
no precision note, per the ruling); the UnmatchedVarying, StageIo and link docs say
where the gap now remains; reach.tsv's line likewise; REFUSALS.md regenerated; the API
signature table blessed (LoweringInputs.widened_varyings); the inputs-encoding and serde
round-trip tests cover the field. SEMANTICS_VERSION stays at 2394 (the narrow
form's bump).

Tests: the red tests of 3f0fa825f4 (jobs m3-max-87655 lavapipe + translator, m3-max-87661
RTX 5080) go green in the jobs named in the READY message.
2026-12-04 21:23:45 -08:00
Anees Iqbal 3b921fc5eb Tests: behind the agx flag a wider fragment input reads zeros past its vertex output (red)
The planner's ruling for the wide case of agx.allow_mismatched_component_counts: Metal
makes the pipeline and leaves the lanes past the vertex output's undefined (M3 Max,
macOS 27.0.1, job m3-max-87586: 150 such lanes read 147 distinct values), so the vertex
function declares the output at the count the fragment function reads, decided at
pipeline make from the two entries, and writes 0 in every lane past its own.

Two tests, red until that form lands:

- engine_converter_module_flags: on lavapipe's profile, compile_render_pipeline of a
  flagged vertex function writing 1 to 3 lanes behind a fragment function reading 2 to
  4 (float perspective, no-perspective, flat; uint and int flat) compiles; every stage
  passes L3; the vertex Output and fragment Input at the varying's Location have the
  input's count; the stored composite carries a constant 0 for each lane past the
  output's; the pipeline's key is render_pipeline_key's. Flag 0 stays Metal's link
  error.
- metal2vulkan-runtime mismatched_varyings (device cfg): the same classes drawn into a
  32-bit target of the class on every device: the output's lanes exact, 0 past them,
  the fragment's sentinel past the input's; the narrow rows (4 to 2, 3 to 1) read the
  output's first lanes.

Red expected: the wide rows fail with Unsupported{UnmatchedVarying, NotImplemented}.
2026-12-04 21:23:45 -08:00
Anees Iqbal cb3cc03b6d Link: behind the agx flag a narrower fragment input reads its vertex output's first lanes
Metal makes a render pipeline whose fragment function reads a user varying at
fewer components than the vertex function writes when the vertex module states
agx.allow_mismatched_component_counts as 1, and the input reads the output's
first lanes (Apple M3 Max, macOS 27.0.1, job m3-max-87586: 90 rows of float
under perspective, center_no_perspective and flat, uint and int flat). Link
answered it Unsupported{UnmatchedVarying, NotImplemented}.

Link now matches such an input to its output (reads_first_lanes: the same
class, fewer components, a vertex function of
StageIo::mismatched_component_counts, a description stating maintenance4), so
the input takes the output's location and component. Vulkan matches an input
of fewer components there under maintenance4 (spec 19.1.3; without it
VUID-RuntimeSpirv-maintenance4-06817 forbids it), which the runtime's floor
requires and enables: one form on every device, no query. A description without
maintenance4 keeps the gap, as do a wider input and any mismatch behind a mesh
function. No module changes: the fragment's input keeps its own width.

Docs: the varyings module docs, StageIo::mismatched_component_counts and
Feature::UnmatchedVarying say so. SEMANTICS_VERSION 2394 (a refusal becomes a
link).
2026-12-04 21:23:44 -08:00
Anees Iqbal ca796ca5ff Tests: behind the agx flag a narrower fragment input links at its output (red)
The draw probe (Apple M3 Max, macOS 27.0.1, job m3-max-87586) measured that a
fragment input narrower than its vertex output reads the output's first lanes
when the vertex module states agx.allow_mismatched_component_counts as 1, for
float under perspective, center_no_perspective and flat interpolation and for
uint and int flat. Vulkan matches exactly that under maintenance4 (spec 19.1.3,
Interface Matching: "if the maintenance4 feature is enabled, they are declared
as OpTypeVector variables, and the output has a Component Count value higher
than that of the input but the same Component Type"; without it
VUID-RuntimeSpirv-maintenance4-06817 forbids it). The runtime's floor requires
and enables maintenance4 (Vulkan 1.3), so this is one form on every device.

The tests:
- link: a narrower vector or scalar input, float or uint, smooth or flat,
  beside matched varyings, takes its output's location and component; a
  description without maintenance4 answers the gap; a wider input stays the
  gap, a mesh producer's either way, and no flag stays Metal's link error;
- engine, over text modules on lavapipe's profile: for each class and
  interpolation, 4 to 2, 4 to 1 and 3 to 2 lanes link, both relocated modules
  pass L3 (spirv-val under the profile's settings, maintenance4 among them),
  and the input's Location is the output's, past a second varying.

Red: link still answers the narrower input with the gap.
2026-12-04 21:23:44 -08:00
Anees Iqbal 2753ea3fbf Varyflag step 1 bless: the golden hashes at semantics 2393
The golden table re-blessed at 39e5964c2a (varyflag step 1 rebased on 9e7034c214), on the Apple
M3 Max, job m3-max-87716 (inventory, golden, printouts, linkhalf and chains each exit 0):
- the semantics line moves 2392 -> 2393, step 1's own number (2391 at that bless, renumbered
  when the stack moved onto pin AB', whose PR 30 and fix-forwards took 2391 and 2392);
- no cell moves and no row is added.
2026-12-04 21:23:44 -08:00
Anees Iqbal 6770dcf8f0 AIR docs: the agx flag's draw probe, flag 0 included
The draw probe (Apple M3 Max, macOS 27.0.1, job m3-max-87586; 720 render
pipelines, one draw each, a pixel read back) measured what 87508 left open:
- flag 0 refuses every count mismatch, as no flag does (180 each); 1 makes all
  180;
- under 1, a narrower fragment input reads the vertex output's first lanes
  (90 rows: float under perspective, center_no_perspective and flat, uint and
  int flat, a second varying absent, after or before);
- a wider input reads the output's lanes, and past them no constant: 150 lanes
  read 147 distinct values, none of them 0, 1 or a value either varying wrote.
EntryPoint::mismatched_component_counts's doc now states these facts. Docs only.
2026-12-04 21:23:44 -08:00
Anees Iqbal be3823ca5f AIR docs: the agx flag's measured refusals name what the probe ran
Job m3-max-87508 ran each vertex and fragment module with the agx flag at 1
(alone or beside irc.version_*) and with no flag at all; it never ran a module
stating 0. The field's doc, and the commit messages of 7285b878a1 and
02b5d3d1a4, said the pipeline is refused at 0: unmeasured. The doc now says
the refusals measured (no flag on the vertex module, whatever the fragment's)
and that 0 is read as no flag, which is not measured. The decoder is unchanged.
2026-12-04 21:23:44 -08:00
Anees Iqbal 7d47114ace Link: a component-count mismatch behind the agx flag is our gap, not Metal's link error
Metal makes a render pipeline whose fragment function reads a user varying at
another component count than the vertex function writes when the vertex
function's module states agx.allow_mismatched_component_counts as 1 (Apple M3
Max, macOS 27.0.1, job m3-max-87508; float4 written and float2 read, and float2
written and float4 read; refused at 0, with no flag, and with the flag on the
fragment module alone; irc.version_* changed nothing). Link answered every such
pipeline Unsupported{UnmatchedVarying, NotRepresentable}, Metal's link error,
for a pipeline Metal makes.

- AIR: module_flags returns whether the agx flag is 1, and the decoder sets
  EntryPoint::mismatched_component_counts on each vertex (post-tessellation
  included) and mesh function the module defines; fragment, kernel and object
  functions never carry it. The flag's docs state the probe's facts.
- Lowering copies it to StageIo::mismatched_component_counts.
- Link (varyings, mesh_fragment): a fragment input whose type differs from
  its producer's output in component count alone (same numeric class and source
  width), behind a producer carrying the flag, is
  Unsupported{UnmatchedVarying, NotImplemented}; everything else stays
  NotRepresentable. A mesh producer is not probed yet, so it stays the typed gap.
- Feature::UnmatchedVarying's doc says both; reach.tsv marks it rare;
  docs/REFUSALS.md regenerated (it also drops TextureSwizzle's four translator
  sites, which a49e4a61c4 and its neighbours removed without a regeneration).
- SEMANTICS_VERSION 2393 (a refusal's class and an interface fact change;
  2392 is PR 30's and its fix-forwards', pin AB').

Verified: the red tests of 7285b878a1 (red in job m3-max-87576) pass here;
the green job is named in the lane's report.
2026-12-04 21:23:43 -08:00
Anees Iqbal 50f744c6c5 Tests: the two translator test entries name the agx field
The red commit's EntryPoint field left two test literals in the translator
crate without it (memory plan and simd uniformity tests); the red job
m3-max-87574 stopped at the build on them.
2026-12-04 21:23:43 -08:00
Anees Iqbal 2ed6b9387b Tests: a component-count mismatch behind the agx flag is our gap (red)
Metal makes a render pipeline whose fragment function reads a user varying at
another component count than the vertex function writes when the vertex
function's module states agx.allow_mismatched_component_counts as 1 (Apple M3
Max, macOS 27.0.1, job m3-max-87508: float4 written and float2 read, and float2
written and float4 read; refused at 0, with no flag, and with the flag on the
fragment module alone). Link refuses it as Metal's link error
(Unsupported{UnmatchedVarying, NotRepresentable}).

This adds the fact's two fields, set nowhere yet, and the tests that hold the
label:
- EntryPoint::mismatched_component_counts (AIR): the decoder test expects it on
  the module's vertex and mesh functions under 1, nowhere else, and nowhere
  under 0 or no flag.
- StageIo::mismatched_component_counts, encoded (ARTIFACT_FORMAT_VERSION 617).
- A link test: a flagged vertex or mesh producer writing wider or narrower than
  the fragment input expects NotImplemented; an unflagged one, the flag on the
  fragment alone, another numeric class or an unwritten key stay the link error.
- An engine test over text modules compiled on lavapipe's profile: the vertex
  module's flag reaches the stage interface and the link answers as above; the
  same count links.

Red: these three fail at this commit (the field is never set, link answers
NotRepresentable).
2026-12-04 21:23:43 -08:00
Anees Iqbal cb574b06fa Pin AB' bless: the golden hashes after PR 30 and its fix-forwards
The golden table re-blessed at b991ca5474 (PR 30's head 6d9f774d63, its fix-forwards and SEMANTICS
2392), on the Apple M3 Max, job m3-max-87900 (inventory, golden, printouts, linkhalf and chains each
exit 0):
- the semantics line moves 2390 -> 2392 (PR 30's 2391 and the fix-forwards' 2392);
- no cell moves and no row is added: no committed fixture declares a memory intrinsic in the older
  form.
2026-12-04 21:23:04 -08:00
Anees Iqbal b991ca5474 Cache: SEMANTICS_VERSION 2392, PR 30's fix-forwards
A legacy memory intrinsic's alignment that is not a power of two (or above 2^32) is now refused
as a malformed record, not ImmediateNotConstant (f32b143935), and a legacy call whose volatile flag
is not a constant now meets the verifier the current form meets instead of failing decode's verify
(3e311ec8ac). Both change what decode answers for a module, so cached answers keyed by the old
version must not be reused.
2026-12-04 21:18:05 -08:00
Anees Iqbal 3e311ec8ac Verifier: an unbound legacy memory intrinsic call is one operand short of its declaration
Decode upgrades a call of the older LLVM's llvm.memcpy, llvm.memmove or llvm.memset (an i32
alignment before the volatile flag) by removing the alignment operand. Where the volatile flag is
not a constant in the function that makes the call, decode keeps the upgraded call
Callee::Unbound with its template, as it keeps a current-form call (bitcode/function.rs). The
verifier's legacy arm took only Callee::Llvm, so such a call failed Verify(OperandType) in the
Module::new that decode runs (bitcode/decoded.rs), refusing the whole module. The arm now also
takes Callee::Unbound { template: Template::Llvm(Memset | Memcpy | Memmove) }, under the same
conditions: not variadic, one operand short, and a five-parameter declaration whose fourth
parameter is i32 and fifth i1.

What such a call then meets, read on the current form's path (not run): canonicalization's SCCP
binds an Unbound call with Template::bind over its four operands and the current signature
(canon/sccp.rs), so where inlining makes the flag a constant the call becomes Callee::Llvm, the
form the PR already verifies and translates; where the flag stays a kernel parameter or a value
the run computes, the post-check refuses it at the call in the inlined entry as
InvalidInput(Intrinsic(ImmediateNotConstant)) (canon/mod.rs), the refusal a current-form call
with that flag meets (docs/API.md, OpenCL C kernels).

Makes a_legacy_memory_intrinsic_with_an_unbound_volatile_flag_verifies pass (expected; not run:
the brief holds every build and test until PR 30 merges). No SEMANTICS_VERSION bump here: PR 30's
2391 covers its decode change, of which this is part. Checked: cargo fmt clean.
2026-12-04 21:17:50 -08:00
Anees Iqbal a5a4c0f839 Tests: a legacy memory intrinsic whose volatile flag is not a constant verifies unbound
New test a_legacy_memory_intrinsic_with_an_unbound_volatile_flag_verifies: a kernel
@k(ptr addrspace(1) %p, i1 %v) calls the older LLVM's llvm.memcpy.p1i8.p1i8.i64, declared
void (ptr, ptr, i64, i32, i1), as memcpy(%p, %p, 400, i32 16, %v). It expects decode to upgrade
the call (four operands, align 16 on both pointers), keep it Callee::Unbound with the template
Llvm(Memcpy), as a current-form call whose flag is not a constant is kept, and the module to
verify (verify_module_level, the Module::new that decode runs).

At ace196acec the verifier takes a call one operand short of the legacy declaration only when its
callee is Callee::Llvm, so this one, whose flag is a parameter, fails Verify(OperandType), and
the whole module is refused at decode. Expected to fail here; the next commit makes it pass.

legacy_copy_module gains LegacyAlign::VolatileParameter(bytes): a constant alignment, and the
volatile flag the kernel's second parameter, an i1. The other variants build the same module as
before.

Not run: the brief holds every build and test until PR 30 merges. Checked: cargo fmt clean.
2026-12-04 21:17:49 -08:00
Anees Iqbal f32b143935 Translator: a legacy memory intrinsic's alignment that is not a power of two is a malformed record
Decode upgrades a call of the older LLVM's llvm.memcpy, llvm.memmove or llvm.memset (an i32
alignment before the volatile flag) by moving the alignment to the pointers' align. A constant
alignment that is not a power of two (or is above 2^32) was refused as
Intrinsic(ImmediateNotConstant), whose own doc says the operand is not a constant. It is now
Bitcode(MalformedRecord { block: FUNCTION_BLOCK, code: FUNC_CALL }), the decoder's answer to an
align attribute of such a value (attrs.rs). An alignment that is not a constant stays
Intrinsic(ImmediateNotConstant) at the call.

How: upgrade_legacy_memory returns a crate-private LegacyAlignmentError, Intrinsic(e) for the
immediate read's error and Malformed for a value Align::from_bytes refuses; the call's decode maps
Malformed to the CALL record's malformed-record error and Intrinsic(e) to the input error at the
record, as before. No public type changes; the outcome class is InvalidInput either way.

Makes a_legacy_memory_intrinsic_s_alignment_must_be_a_constant_power_of_two pass (expected; not
run: the brief holds every build and test until PR 30 merges). No SEMANTICS_VERSION bump here:
PR 30's 2391 covers the decode change, and only the error kind of an input refused either way
changes. Checked: cargo fmt clean.
2026-12-04 21:17:49 -08:00