Commit Graph
3360 Commits
Author SHA1 Message Date
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
Anees Iqbal 970299e8e7 Fixture dfk_dead_group: its compiled companions
scripts/regen-air-fixtures/regen-air-fixtures.sh dfk_dead_group on the
M3 (potluck job m3-max-13159; Metal 32023.922, SDK 27.2, LLVM 21.1.8);
TOOLCHAIN records the fixture under that toolchain. dfg_branch's branch
compiles to a select on the loaded constant.

(cherry picked from commit 032fcf3bc3849aa395f323ac6562636165d42475)
2026-11-10 00:11:07 -08:00
Anees Iqbal 583b444f09 Fixture dfk_dead_group: a read of another color group that a constant decides
Owned MSL: a fragment function of five colors that reads color 4 in the
arm of a branch on a bool function constant (dfg_branch), and one whose
color 4 input the constant gates (dfg_gated), for cg_cover's interface.
A device of four color attachments draws the pipeline in two groups,
color 4 in the second. The companions follow from
scripts/regen-air-fixtures on the M3.

(cherry picked from commit 1ff9b1320844b578b812da5db51715697d8d1fa9)
2026-11-10 00:11:07 -08:00
Anees Iqbal 8b3dc13179 Re-bless the authored compile census at 67db4d8274
SEMANTICS 2010 / ARTIFACT_FORMAT 498 / RT 2000 at 67db4d8274: heap decodes of raw-held textures now carry DevicePackConversion (golden cells of float heap readers move); the mesh point-size note only for point output (SEMANTICS 2009); the census follows the new product fingerprint.

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

(cherry picked from commit f0cb5a64c765a08b41a7ccb518a45e6e4f9a5207)
2026-11-10 00:02:08 -08:00
Anees Iqbal 67db4d8274 RUNTIME_VERSION 2000 and the runtime-sources pin for heap decodes' pack-conversion note
What: the two commits before this one (heapnote, steelbrain/heapnote 1ab403b671):
a heap texture read, sample or gather that decodes a raw-held texture records
PrecisionNote::DevicePackConversion as a note conditional on the new
SpecKey::HeapRawTextures(Stage), set by the binding plan from the textures a
command makes resident or binds; the runtime announces it at such a draw or
dispatch (an announcement: RUNTIME_VERSION 1999 -> 2000). SEMANTICS_VERSION is
2010 (the branch's 2008 bump, resolved above development's 2009) and
ARTIFACT_FORMAT_VERSION 498 (a new SpecKey variant). The pin follows.

Verified (heapnote): negative control at base (gem10 job 13076): the float read
on amd-780m-hawkpoint-radv lacks the note; touched tests 104/104 (13082); plain
clippy, rustdoc and the core suite 5342/5342 (13096); heap_extended_reads lane
9/9 with m2v_cpu_icd clippy on lavapipe (13145) and 9/9 on the Radeon 780M (RADV
PHOENIX, um790 job 13192), its new test announcing the note at a dispatch holding
BGRA10XR and not at the pipeline's making or an RGBA8Unorm-only dispatch;
m2v_gpu clippy (13196). Generators and api-signatures --check unchanged at
landing. Golden tables and the census move for float heap readers: re-blessed on
development next.
2026-11-09 23:55:05 -08:00
Anees Iqbal c42e63e64b Record DevicePackConversion where a heap read decodes a raw-held texture
A float or half read, sample or gather through an argument buffer that
decodes a texture the heap holds by its raw texels alone (BGR10_XR,
BGRA10_XR, R10Unorm_X6, RG10Unorm_X12 and the bfloat formats; the
heap_raw routine) converts by the device's arithmetic, as a slot's decode
of the same texel does, but recorded no PrecisionNote: a reader of the
module alone saw no near-equivalent, against AGENTS.md's "allowed only
when the artifact records it".

The decode is planned in one place now, texture::heap_raw::plan, which
both the read (select_read_as) and the emulated sample or gather
(heap_raw_sample) call. It records DevicePackConversion as a specialized
note with one clause on a new bound-value key, SpecKey::HeapRawTextures
(stage): a texture the stage's handles can name is held raw. The binding
plan gives the key from the command's heap members (resident or bound
textures, as for HeapYCbCrTextures), so the note is in the module's
notes, holds under precision_notes_bound exactly where the command can
name such a texture, and the runtime announces it at that draw or
dispatch (degrade_bound_values) and never at the pipeline's making. A
stage that records the note outright for another conversion keeps it
outright. Heap accesses that reach no such texture (queries, integer
reads, storage reads, samples the function does not emulate) record
nothing.

NoteOn::HeapTextures is renamed HeapYCbCr beside the new HeapRaw.
bind::heap::raw_held is pub(crate) for the plan. The heap set's own
announcement naming the texture (heap_sets::RawRead) stays.

SEMANTICS_VERSION 2008 (heap-reading modules gain the note);
ARTIFACT_FORMAT_VERSION 498 (a SpecKey variant). api_signatures blessed;
REFUSALS.md regenerated (unchanged). docs/API.md's catalogue and the
runtime's Degradation docs say where the note is recorded and announced.

Tests: heap_decodes_record_the_device_pack_conversion now also asserts
the one HeapRawTextures clause; the new
a_heap_decode_s_note_holds_where_its_command_can_name_a_raw_texture checks
the plan's key and the bound note on every committed profile; the lane
a_heap_decode_s_stage_note_is_announced_where_its_command_can_name_a_raw_texture
checks the runtime's announcement under announce_each.

(cherry picked from commit 1ab403b671f18773a10c8572ffbe0a73b56f5bbc)
2026-11-09 23:54:15 -08:00
Anees Iqbal 0957fcb752 Test: heap decodes of raw-held textures record DevicePackConversion
A heap read, sample or gather that decodes a texture the heap holds by
its raw texels alone (extended-range, padded and bfloat forms of
ExtendedRange::HEAP_READ) converts by the device's arithmetic, as a slot's
decode does, but records no PrecisionNote::DevicePackConversion. The new
test translates a float and a half read, a nearest sample and a float
gather of such a heap group (each must record the note), and a width
query, a uint read and a mip-filtered sample (no decode, no note), on
every committed profile with a sampled heap.

Expected to fail here (the decodes record no note); the fix follows.

(cherry picked from commit 17921ada610252bd986fb095e84b10d68fe3347c)
2026-11-09 23:54:03 -08:00
Anees Iqbal d6ce69b280 SEMANTICS_VERSION 2009, RUNTIME_VERSION 1999 and the pin for smallfix's items
What: the five commits before this one (smallfix, steelbrain/smallfix f0e090d94d):
- a mesh function records PrecisionNote::DevicePointSize only where its mesh
  topology is points (translation changes: SEMANTICS 2008 -> 2009; the branch's
  own bump collapsed into deadfetch's 2008 on its rebase);
- the CpuBlockDecode notice's cost text says what twin_decode.rs does (an
  announcement's text: RUNTIME_VERSION 1998 -> 1999);
- docs: visibility venues, DeviceSampling's subnormal coordinates (FAST-PATHS,
  API.md, 27 known-gaps rows), SharedEvent::reserve_vk_signal's queue rule;
- conformance tile states state maxTotalThreadsPerThreadgroup (8 recordings
  re-recorded on the M3, answers unchanged); one oracle message's spaces;
- the loader's instance extension list read in one call (room for 64,
  doubled on VK_INCOMPLETE).
The runtime-sources pin follows.

Verified (smallfix): um790 job 13171: 25 translator tests (mesh test, fast_paths
ledger), 22 runtime degradation/catalogue/keeper tests, 41 conformance tests
pass; negative controls: the mesh test fails at engine_mesh.rs:643 with the fix
reverted; workspace rustdoc -D warnings ok. M3 job 13144: conformance and
validation clippy, qualification_contracts pass. um790 jobs 13183/13186 at
f0e090d94d: m2v_gpu and m2v_cpu_icd clippy over metal2vulkan, runtime,
conformance, validation; listed_extensions and keeper tests 5/5. Loader scans per
device-making process (um790, lavapipe, VK_LOADER_DEBUG): 11 at base, 5 with the
first read change; the one-call read's negative control and caller table are
pending (job 13193). Generators and api-signatures --check unchanged at landing.
Not run: the full suites and the census (development's checks).
2026-11-09 23:50:27 -08:00
Anees Iqbal 0cc325c36e Runtime: read the loader's instance extension list in one call
5c0c2236ad read the list once per instance creation, but through ash's
two-call read: a count call, then the list call. Each
vkEnumerateInstanceExtensionProperties is a loader scan of its driver and
layer manifests, which loads each driver it finds. On a host with NVIDIA's
driver package and no NVIDIA GPU, reims measured 0.25 to 0.7 s per scan
(~/.cache/rvg-m2v-handoff/loader-scans, 11-07), and its ask was one call
into room for the list, again with more room on VK_INCOMPLETE.

ListedExtensions::of now does that: one call into room for 64 extensions
(a loader lists 20 to 26 on our hosts), then twice the room while the loader
answers VK_INCOMPLETE. A process's runtime scans fall from 4 to 3: one list
read, the device's vkCreateInstance and the keeper's.

Verified: tests::listed_extensions counts every call of a fake loader. An
instance's making makes 1 (it made 2 at 5c0c2236ad, as ash's read takes
two), and a 96-extension list past the first room takes 2 calls and is read
whole.

(cherry picked from commit f0e090d94d64040144dae867cad7e3a2a00f943c)
2026-11-09 23:49:33 -08:00
Anees Iqbal 1d8eaa47f4 Conformance and oracle: tile states state their thread limit; one refusal message's spaces
Two test-only fixes.

The conformance suite's tile states left maxTotalThreadsPerThreadgroup at
Metal's 0 unless a case limited them. A tile state of no limit is answered
from Metal's compiler history: Metal keeps a tile pipeline it compiled and
answers a later descriptor of the same function that differs only in
requiredThreadsPerThreadgroup with the first one's limit, in the same process
or a later one (measured on the M3 Max, macOS 27.0.1; the validation oracle's
tile pipelines state their limit for that reason since ORACLE_ABI 49). So a
re-record could take another pipeline's answer. TilePipelineSpec now carries
an explicit u32 limit, as ComputeLimitsSpec does, and both sides set it. Every
state that meant Metal's own maximum states METAL_TILE_THREADS (1024), which
the M3 Max answers for no limit. tile-state-thread-limits' first state is
state-limited-1024 (it was state-unlimited, same answer), and the device-gap
ruling for a limit below Metal's applies where the stated limit is Metal's
maximum.

The eight recordings whose descriptor moved are re-recorded on the M3 Max
(macOS 27.0.1, 26A434; three runs each, plain and validated legs). Only
their input digests and that renamed state change: every answer is the one
recorded before, max_total_threads_per_threadgroup 1024 included. Cost and
time records are kept as they were.

The validation oracle's "permits N" refusal had a run of stray spaces from a
string literal's indentation. The message is one line now, and
qualification_contracts asserts it whole.

Verified on the M3 (macOS): clippy of metal2vulkan-conformance and
metal2vulkan-validation with all targets and features is clean, and
a_threadgroup_wider_than_the_pipeline_permits_is_refused passes with the
exact message. `conformance record` wrote the eight recordings.

(cherry picked from commit 91be83754b4ac765759b679cb872a321eec9dfbe)
2026-11-09 23:49:33 -08:00
Anees Iqbal dbad32bb7b Docs: visibility venues, Metal's subnormal sample coordinates, a shared event's queue rule
Three corrections, each checked against the tree:

- runtime/src/visibility.rs said Metal's visibility-result behaviour was
  measured on an M4, which is not one of our venues. The conformance
  suite's visibility cases record Metal's answers on an Apple M3 Max with
  macOS 27.0.1 (recordings/visibility-*.json); the doc now names that venue.
  The 5300M and UHD 630 answers it cites beside it are unchanged.

- docs/FAST-PATHS.md's DeviceSampling row (and docs/API.md's device-sampling
  entry) said Metal reads any subnormal coordinate as the zero of its sign
  before addressing. That holds for a normalized coordinate (measured on the
  M3 Max on R32Float, PrecisionNote::DeviceSampling's documentation); a
  negative subnormal pixel coordinate addresses texel -1, as the M3 Max's
  recording of pixel-samplers-subnormal-border answers (the border at
  -2^-149, -2^-140 and -2^-127, known-gaps.tsv). Both now say so, and the 27
  known-gaps.tsv rows that quoted the old reading quote the new one.

- SharedEvent::reserve_vk_signal's Safety text lacked the same-VkQueue rule
  that Event::reserve_vk_signal states. A shared event's command-buffer waits
  are held on the host (event_timeline.rs: a settable timeline never hands
  a wait to Vulkan), but a command buffer that signals the event after the
  reservation waits on its VkQueue for the reserved index before its own
  signal (EventTimeline::signal's `after`, the order wait in
  command_buffer/submit.rs), so the caller's signalling submission must not
  go behind it on one VkQueue, and a texture copy on the first VkQueue behind
  it waits for the signal too. The rule is now stated, scoped to those
  signalling command buffers.

Verified: rustdoc and the runtime's degradation_catalogue test over the
edited text; no behaviour changes.

(cherry picked from commit 12bac3fafd3d3e66dc0b88d01231dd30e2694ffb)
2026-11-09 23:49:33 -08:00
Anees Iqbal ab10b3cbcf Runtime: say what a decoded twin's CPU decode makes replace_region wait for
The cpu-block-decode notice said the call waits for the decode where a
command buffer that may read the texture is submitted and not yet complete,
or the texture is untracked. The call has waited for no GPU work since the
decode moved to the device's decode thread (texture/twin_decode.rs): it waits
only for room, while 256 MiB of written blocks wait for the thread (a 4:2:2
carrier's partial-row write also reads its rows back first), and the
scheduler holds the first command buffer that may read the texture, every
command buffer where the texture is untracked.

The declaration's rustdoc, its announced cost and docs/API.md's catalogue
entry now say that. A test ties the stated bound to the queue's QUEUED_BYTES
(made pub(crate) for it), so the text follows the constant.

Verified: tests::degradation::the_cpu_block_decode_cost_states_the_calls_
only_wait and tests::degradation_catalogue (the catalogue states the cost).

(cherry picked from commit f128722f1b2197f52833080eca738fd498cf6ce5)
2026-11-09 23:49:33 -08:00
Anees Iqbal b1625c535c Translator: note a mesh function's point size only where it outputs points
A mesh function that writes a vertex's point size recorded
PrecisionNote::DevicePointSize whatever primitive its mesh outputs. The
rasterizer reads a vertex's size for points alone, so a line or triangle
mesh's size draws nothing on any device, and the runtime already announces
the note only at draws that rasterize points (7715a47be3). The note is now
recorded only where the mesh type's topology (air.mesh_type_info) is points,
a structural test, so the artifact carries no note its draws can never meet.

Apple's compiler refuses [[point_size]] in a triangle mesh's vertex, so the
case arises only for AIR not compiled from MSL. The test derives the
triangle mesh from the owned fixture's point mesh (mesh_outputs_points) by
its topology word alone.

SEMANTICS_VERSION 2008: an artifact's precision notes change. docs/API.md's
catalogue entry and the note's rustdoc say which mesh functions record it.

Verified: engine_mesh::a_mesh_point_size_is_noted_only_where_the_mesh_
outputs_points on every committed mesh profile with the largest point set
below Metal's: the point mesh is noted, the triangle mesh is not, both store
the size; the test fails with the topology check reverted.

(cherry picked from commit adc0435c64495e2f3a3355becf055941fc529fc3)
2026-11-09 23:49:33 -08:00
Anees Iqbal 661e063d4d Re-bless the engine inventory and golden tables at 4d187515d7
SEMANTICS 2008 (4d187515d7): the new owned fixture engine/dfk_dead_fetch adds 76 golden-hash cells (0 moved), 4 inventory rows and its 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 9f5e7e55221cfb111408a5e0784cf282cc2c0f7b)
2026-11-09 23:36:03 -08:00
Anees Iqbal 342246e7a4 The runtime-sources pin for one loader extension read per instance
What: device/create.rs and device/keeper.rs changed (the cherry-picked commit
before this one): an instance's making reads the loader's instance extension
list once and the keeper asks the loader nothing. The pin follows; no
RUNTIME_VERSION bump: the extensions enabled, every answer, announcement,
record and submission are the same; only the number of loader calls drops
(4 per process's first device -> 1, 3 per later instance -> 1).

Verified (smallfix, um870 job m3-max-13113): clippy of metal2vulkan-runtime
(all targets, all features) clean; tests::listed_extensions (a counting fake
loader: 1 read, the three extensions still enabled) and tests::keeper pass.
Pending on the branch: its negative control, rustdoc, m2v_gpu/m2v_cpu_icd
clippy and the release timings on lavapipe and um790. Generators and
api-signatures --check unchanged at landing.
2026-11-09 23:31:05 -08:00
Anees Iqbal 5c0c2236ad Runtime: read the loader's instance extensions once per instance
The making of an instance asked the loader for its instance extension list
once per question: portability enumeration, debug utils and layer settings,
three vkEnumerateInstanceExtensionProperties calls, and the drivers' keeper
asked a fourth time for portability on the process's first device. Each such
call makes the loader scan its driver and layer manifests again and ask each
driver it finds; reims measured about 7 s per process on a host with several
manifests.

Now the making reads the list once (ListedExtensions) and answers every
question from it, and the keeper takes portability from the extensions the
device's instance enabled (the runtime enables it exactly where the loader
listed it), asking the loader nothing: four reads per process's first device
become one, and three per later instance become one.

Verified: tests::listed_extensions builds a fake loader that counts the reads
and refuses the instance; it reads 1 at this commit (3 before it, the
negative control).

(cherry picked from commit a58d2cd51a2fbe17326ce09c8a718ffec5d43776)
2026-11-09 23:30:14 -08:00
Anees Iqbal 4d187515d7 fetch_inputs' doc: one paragraph, wrapped
Comment only: the paragraph the dead-read change edited, rewrapped.

(cherry picked from commit 381d3deac5a1078feae3e3b244d6744f052aff4e)
2026-11-09 23:27:55 -08:00
Anees Iqbal 97b147d2e9 Lane dead_reads: read the texels as 4-byte chunks (clippy's manual_chunks)
clippy -D warnings under --cfg m2v_gpu and --cfg m2v_cpu_icd flagged
chunks_exact(4) with a constant size (gem10 job m3-max-13089); as_chunks
gives the same texels.

(cherry picked from commit 94dd2382170212f76e685add4fa427c211a9c5b8)
2026-11-09 23:27:54 -08:00
Anees Iqbal 04cb985772 Lane: a framebuffer read dead after specialization draws as a plain pipeline
runtime_lane::framebuffer_fetch::dead_reads draws dfk_dead_fetch's
dfk_branch and dfk_scaled, specialized with the read dead, over a 16²
BGRA8Unorm target blended one over one minus the source alpha, on the
device the cfg selects under the validation layer. On every device the
translator's pipeline for the descriptor has no storage and no input
attachment and color 0 keeps the blend; a pass of two draws stores
Metal's texels (each channel within one code asserted, the exact ones
counted), takes no storage form for the target
(WorkCounts::storage_forms_taken), splits no instance for interlocked
writes and announces none of the fetch's notices. On a device with a
fetch form the live specialization's pipeline takes that form
(asserted), and its pass's notices and counts are printed as the
contrast, one DEAD-FETCH line per function.

(cherry picked from commit fb39956c6942324fdb34330a9e725098d7058359)
2026-11-09 23:27:54 -08:00
Anees Iqbal 265878e2e1 A framebuffer read dead after specialization takes no fetch form
What: the render pipeline's framebuffer-fetch state (pipeline::compile's
fetch_inputs) named every attachment the specialized fragment entry
declares a [[color(n)]] input for, used or not. The lowering then put
each such attachment the function writes through its first output in
the interlocked storage form (fetch::plan reads the state's attachments
as colors the pipeline moved there), so a function whose read the
function constants make dead (a branch on a bool constant, a fast-math
product a zero constant makes +0) still took the pixel interlock and,
for a blended attachment, computed the blend in the shader, its color
left out of the subpass. It now names a color input only where an
instruction of the specialized, canonicalized body uses it, the reading
the lowering itself plans parameters by: a dead read is a plain color
write that the device blends.

The used-parameter walk is one helper (params_used), which the vertex
attributes and the kernel stage-in attributes already did inline.

tests::engine_moved_writers' unread-color-input test pinned the old
form (smw_unread, a declared input it never reads, took the storage
form as compiled); it now checks that such a writer takes no storage
form under either write mask, color 0 stays a color attachment, it
states no store before the tests, and every draw that moves no color
runs it as compiled. The fixture's comment says so.

SEMANTICS_VERSION 2008: such pipelines' modules, graphics state,
facts and precision notes change.

Verified (debug, homelab-gem10-1): tests::engine_dead_fetch at the base
(6962601ac4, job m3-max-13077) failed: 48 of 114 dead pipelines took the
storage form with color 0 out of the subpass (dfk_branch and
dfk_scaled, blended and unblended, on all 12 interlock profiles;
dfk_gated, whose input the constant removes, never did).

(cherry picked from commit d9160036035a456a5371d5e80fe1f070a28a1e85)
2026-11-09 23:27:54 -08:00
Anees Iqbal ad78517360 Test engine_dead_fetch: count the dead specializations' misses by kind
Each dead pipeline's difference from a pipeline without a color input
(a storage form, an input attachment, color 0 missing or without the
pipeline's blend) is collected by kind and printed before the test
fails, so a run states how many dead reads took a fetch form, not only
the first.

(cherry picked from commit 6962601ac4a4e86f6316e2defed401728aea797d)
2026-11-09 23:27:54 -08:00
Anees Iqbal 4652bbe020 Test: a framebuffer read dead after specialization takes no fetch form
tests::engine_dead_fetch compiles the owned fixture dfk_dead_fetch's
three fragment functions (the read behind a branch on a bool constant,
scaled by a half constant under fast math, gated with its input) behind
dfk_vertex, color 0 BGRA8Unorm blended one over one minus the source
alpha or unblended, on every committed profile. Specialized with the
read dead, each pipeline must have no storage and no input attachment,
color 0 an ordinary attachment carrying the pipeline's blend, and pass
L3; specialized live, each reads color 0 in the device's fetch form
(storage under the interlock, an input attachment under
rasterization-order access) or is refused where there is neither.

This commit adds the test alone, the negative control at the base.

(cherry picked from commit 5f6a494dd747029b6e8f910b6a135b1692dd73a1)
2026-11-09 23:27:54 -08:00
Anees Iqbal c4255866c4 Fixture dfk_dead_fetch: its compiled companions
scripts/regen-air-fixtures/regen-air-fixtures.sh dfk_dead_fetch on the
M3 (potluck job m3-max-13074; Metal 32023.922, SDK 27.2, LLVM 21.1.8);
TOOLCHAIN records the fixture under that toolchain. The branch on
dfk_reads compiles to a select on the loaded constant, and dfk_scaled's
product to an fmul fast of the loaded half constant.

(cherry picked from commit ac3447ff8745c1aad462d99472b16ec3109ab7bb)
2026-11-09 23:27:54 -08:00
Anees Iqbal 4ae1db0238 Fixture dfk_dead_fetch: a framebuffer read that function constants decide
Owned MSL: three fragment functions that read color 0, the read behind
a branch on a bool constant, scaled by a half constant (a fast-math
product a zero constant makes +0), and gated with its input by the bool
constant, beside a fullscreen vertex function. The companions follow
from scripts/regen-air-fixtures on the M3.

(cherry picked from commit c77c87b4ff1eb43eeb8a2f3a9b3c9e56fc1911ca)
2026-11-09 23:27:53 -08:00
Anees Iqbal 2deffb9e1d RUNTIME_VERSION 1998 and the runtime-sources pin for at most 4096 spare command buffers
What: the spare command pools now hold at most 4,096 command buffers across all pools,
counting pools that are out (taken, being freed, beginning a primary ahead). Over the
bound, the oldest spares free their command buffers on the free thread; if that is not
enough, the pool given back frees its newest past the bound. RUNTIME_VERSION 1997 -> 1998
and the runtime-sources pin follow.

Why: on the Iris Xe (ANV below Xe-HP, Mesa 26.2.4) each command buffer that records a
binding table takes a 64 KiB block of a 1 GiB pool: 16,384 per device, and the next
recording fails with VK_ERROR_OUT_OF_DEVICE_MEMORY. The spares held 9,716-9,771 before the
failing frame in all 6 failed loaded runs of checked_frames_merge_once.

Verified (exitcrash, at 9ddb267dbd on 8636a26f43):
- loaded Iris, the iris-flakes shape: checked_frames_merge_once 0 of 76 vs 6 of 79 at
  base; runtime suite 16/16 loops; teardown threads 0 of 6,528.
- new device test, spares held after three big command buffers alive at once: 4,096 on
  lavapipe, M3 MoltenVK and Iris; with the bound disabled 12,417 / 12,675 / 12,417 (fails).
- Iris cost, the test alone, 5 runs each: spares max 4,096 vs 7,787-7,793; frees on the
  free thread 220 vs 14-17; test time 13.6-14.0 vs 13.6-13.9 s.
- tests::spares 14/14 on the three venues; lavapipe runtime suite 2025/2025; clippy and
  rustdoc clean. Generators and api-signatures --check unchanged at landing.
Not run: the full gate and the other venues (development's checks).
2026-11-09 23:20:16 -08:00
Anees Iqbal 025617cb6f Spares: the held bound's measured cost and its evidence
The module docs now state what the bound of 4,096 costs where it was measured. The numbers
come from tests::linear_runs::checked_frames_merge_once run alone on ms01's Iris Xe (Mesa
26.2.6), five runs each way, alternating, in a debug build. The base runs used development's
spares.rs; the fix runs used 8ab6915d69. Probe branch, not for landing: steelbrain/iris-held-
probe, job m3-max-13123.
- Spares held at most 4,096 against 7,787 to 7,793.
- Pool frees ran on the free thread 220 times against 14 to 17.
- Command buffers allocated: 12,559 in four runs and 9,864 in the fifth, against 10,193 in each.
- The test took 13.6 to 14.0 s against 13.6 to 13.9 s.

Verified for the bound (8ab6915d69), each with a negative control (past_held answering nothing,
so no bound):
- tests::spares::device::command_buffers_alive_at_once_leave_the_spares_holding_at_most_held:
  the spares held 4,096 at the fix and 12,417 at the negative control on lavapipe (job
  m3-max-13065), 4,096 and 12,675 on the M3 Max through MoltenVK (m3-max-13070), and 4,096 and
  12,417 on the Iris Xe (m3-max-13071).
- The unit test the_spares_and_a_pool_given_back_hold_at_most_held_command_buffers passes at
  the fix and fails at the negative control on all three.
- All 14 tests::spares tests pass at the fix on all three.
- The runtime suite on lavapipe (--cfg m2v_cpu_icd): 2,025 of 2,025 passed (m3-max-13073).
- Clippy -D warnings (plain and --cfg m2v_gpu) and rustdoc -D warnings for the runtime are
  clean (m3-max-13068).

The loaded Iris run (m3-max-13072, iris-flakes-run shape, 30 min) put two loops of
checked_frames_merge_once and one of the teardown-threads test beside the runtime suite looped
under --cfg m2v_gpu:
- Checked frames: 0 of 76 runs failed (38 and 38), against 6 of 79 (39 and 40) at the base in
  the same shape (m3-max-13027).
- Runtime suite: 16 of 16 green, 2,019 tests each, 110 to 116 s against 111 to 116 s at the
  base.
- Teardown-threads test: 0 of 6,528 failed.

(cherry picked from commit 9ddb267dbd2ccf8942ac1a78ee3fee44fdc4f01d)
2026-11-09 23:18:09 -08:00