Commit Graph
2468 Commits
Author SHA1 Message Date
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 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 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 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 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 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 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
Jacob McSwain 8f117956ef Translator: split whole-struct stack loads and stores into members
Vertex functions that build their return value on the stack couldn't be translated. A whole struct
stored to or loaded from an alloca reached lowering, which handles only scalars and vectors there,
and was refused as Lowering(Access) AccessType.

The shape involved, seen in modules Apple's Metal shader converter wrote:
- a store of zeroinitializer to an alloca of the return struct;
- stores to its members;
- one load of the whole struct.

What changes: the split that already turns a whole-aggregate access of device, constant and
threadgroup memory into its members' accesses now covers stack memory too. Still kept whole, and
refused by lowering as before:
- a volatile access;
- an aggregate that holds a pointer;
- an aggregate with more members than the split takes.

No public API changes.

Evidence:
- a_stack_aggregate_is_split checks the member stores and loads, their alignments and byte offsets,
  the two insertvalues, and that no whole-struct access is left.
- what_is_not_split_stays_whole gains the three stack cases above.
- The new fixture compiles, links and validates.
- a_stack_aggregate_is_split and a_return_value_built_in_a_stack_slot_compiles fail without this
  change.
- No release-mode timing was taken; the split adds a bounded walk per whole stack access.

Version: SEMANTICS_VERSION 2389 -> 2390, because inputs refused before can now compile.

Golden table: left for the bless on development; golden_hashes_match_the_table lists the new
fixture's cells. The fixture's expectations row is included.

Not run: the GPU device tests, the Windows clippy legs and the CI matrix.
2026-12-04 21:22:16 -06:00
Anees Iqbal 7a066a4b80 Canon and lowering: a load made where the program did not run it is checked in the address form
The constant-reference hoist makes a kernel's load of a constant T& at a fixed offset in its entry
block, so every thread of every dispatch reads it where the program read it only behind a
branch. Metal requires the reference's binding only where the program reads it, so an app may
leave it unbound, or bound shorter than the object, while that branch is not taken. In the
bound form the pipeline's robust buffer access contains the read (a null descriptor or a short
range reads zero), but where the slot is reached by its device address an access at a constant
offset was never checked: a short binding was read past its end by every thread, and an unbound
one past the nil buffer's 64 KiB under a larger object, a GPU fault where a mapping ends.

The mark: InstKind::Load gains `speculative`, false for every decoded load. const_hoist sets it
on each load it moves; speculate sets it on each load of an arm it flattens (a constant
reference's, at offset 0, run in every lane of the branch's block: the same window, narrower);
aggregates carries it to a split load's members. Lowering reads it: a speculative load's slots
are noted as reached at a variable offset (SlotBounds and, for a device-address read, the zero
range), and emit::prepare checks it against the slot's buffer whatever its offset, reading zero
outside, as an access at a run-time offset is. The bound form is unchanged: a bound slot drops
its bounds and its view is not checked in the shader. Covered: a device without the bound form's
queries, a slot bound below its argument's alignment on one with them, and every render stage.

const_hoist also leaves a reference whose pointer another root may share (the parameter or an
address step from it as a phi, select or insert operand, a stored value or the result): such a
pointer may meet one loaded from memory, and lowering then reaches the reference by a device
address no check bounds.

Docs: const_hoist's and speculate's module docs, canon's list, ARCHITECTURE.md, API.md sections
1 and 5, the runtime README's bounds paragraphs and push layout, PushField::SlotBounds. The
public signature table is re-blessed for InstKind::Load (no consumer use of InstKind: zero hits
in the consumer's development and its day-old steelbrain/* tips). SEMANTICS_VERSION 2388.

Tests: engine_hoist_contain (red at the base in jobs m3-max-87402 and m3-max-87403: no
SlotBounds for the hoisted load's slot on any identity profile or for a word-bound slot on a
bound-form profile, and the interpreter traps OutOfBounds at EXTRA+98304 and NIL+98304 with the
flag off); constant_hoist's loads are speculative where moved and a shared reference keeps its
loads; speculate's arm load is speculative where speculated and not where kept.
2026-12-04 18:28:29 -08:00
Anees Iqbal 062b71cf63 Canon: a kernel's constant-reference loads are made in its entry block, ahead of its bounds branch
A kernel often reads a constant T& parameter only behind its bounds branch
(if (gid >= n) return; out[gid] = in[gid] * scale;). canon::const_hoist
moves each such load into the entry block, its value reaching its uses by
dominance, where all of these hold, each read from the body's structure and
the entry's ABI:

- a plain load (not volatile, not atomic) of an integer, a float or a vector
  of them; a pointer's or an aggregate's load stays;
- its address is a parameter the ABI binds as a constant-space buffer with a
  stated air.buffer_size and no function-constant predicate (a constant T&),
  or that parameter plus GEPs at constant, non-negative indices and bitcasts,
  which move with it; the bytes read lie inside [0, air.buffer_size). The
  address is then one address for every thread, and each form contains it at
  the entry as where it stood: the same slot, a bound storage view under its
  robust buffer access, or a device address at a constant offset, which no
  check clamps in either place. A constant T* (no size), an offset past the
  object and an offset the run computes stay;
- no instruction on any path from the function's start to the load may write
  device memory or order another thread's writes before it: a store or
  memory intrinsic whose destination is not thread or threadgroup memory, an
  atomic or atomic load of any space, a fence or barrier, a texture write,
  or any call but arithmetic, conversions, group operations, built-in reads
  and texture reads and queries. A forward reach from every writing block
  marks the blocks a write may precede; a load's own block counts up to it.

Where it lives: a new canon pass beside speculate, not inside it.
speculate.rs is a fidelity pass: it gives Metal's measured if-conversion of
group operations, keyed by Metal's budgets, and its moves change what a
program observes. This one changes nothing a program observes and its rule
is soundness alone (no write before, the access contained), so it has no
place in speculate's measured decisions; it shares rewrite::BodyEdit's moves
with it. It runs after aggregates::expand, so an aggregate load of a
reference, split into its members' loads, moves too, and before the
OpenCL hidden buffers and the program-scope bindings add parameters. Kernels
only: the measured kernels are compute kernels.

The planner's measurement (the audit seat's lab pass, which moved every load
at a constant parameter itself) on the compute benchmark's guest kernels FM
copy, FM vertical and Fluid's pressure step, GPU time of 20 dispatches, arms
alternated, output digests equal in every pair: the RTX 3090 -3.6%, -0.1%,
-9.5%; the RX 7900 XTX -7.3%, -0.7%, -12.2%; the Iris Xe +0.4%, 0.0%,
0.0%. On the Iris, ANV sinks the loads back into the branches: FM copy's
compiled code goes from 134 to 132 instructions (1026 to 912 cycles), its 8
SENDs unchanged (read from INTEL_DEBUG=cs, not from Mesa's source).

SEMANTICS_VERSION 2386 -> 2387: a kernel whose constant-reference loads move
translates to other words.

Verified: pending the green job.
2026-12-04 18:12:44 -08:00
Anees Iqbal 7cb4195db7 Validation: the engine's candidate draws object and mesh cases through the runtime
The runtime makes and draws mesh render pipeline states (Device::new_mesh_render_pipeline_state,
the render encoder's set_object_*, set_mesh_* and draw_mesh_* calls), so the engine's candidate
now draws an object or mesh case as the Metal oracle draws it, instead of refusing every one as
mesh_render_pipeline. candidate::platform::runtime_mesh makes one mesh render pipeline state of
the oracle's descriptor (MeshTemplate::descriptor: the case's own function and the partners its
draw names from the row's library, the generated stages of an observation or object launch from
the companion's, its color formats or the 1x1 R8Unorm sink without rasterization), makes and
binds the own stage's buffers, argument-buffer members, textures and samplers through that
stage's setters (runtime_render's Stages, which now binds a stage of either pipeline kind and
selects a stage's output for both), makes each color target a Shared 2D texture of one sample
written from the case's bytes (Targets::of_colors), draws once (draw_mesh_threadgroups or
draw_mesh_threads), and reads the output back. A threadgroup within Metal's maximum and past the
state's on the device (Limit::MeshThreadgroupThreads) records not_enabled, as a sample count the
device makes no texture of does.

One vocabulary: mesh_render_pipeline is retired, and the one shape the runtime refuses keeps a
requirement of its own, mesh_threadgroup_memory (Limit::Runtime): an object or mesh function that
declares a [[threadgroup(n)]] argument (its reflected threadgroup buffer), and a case that authors
an object function's threadgroup_memory. Its doc names the runtime's refusal it mirrors, in the
runtime README's words: "An object or mesh function with a [[threadgroup(n)]] argument is refused
at the creation (Gap::RenderPipeline), as setObjectThreadgroupMemoryLength:atIndex: and its mesh
form are not built". The authored compile census still prepares such a case to compile it
(prepare_compile), so no compile cell changes. Classification, the case checker, the executor,
the triage, census, executor-contract, requirement and compile-census tests, the validation
README, docs/VALIDATION.md and the runtime README's sentence about validation's mesh cases follow.

Versions: the structural-triage analyzer v87 (rows' requirements change). ENGINE_EXECUTOR_ABI is
not bumped: no recorded row observes the change, as the executor refused every object and mesh
case before any device and stored no row of one. SEMANTICS_VERSION is untouched: translation
output does not change. The authored compile census version is untouched: no cell changes.

Venue: lavapipe lists VK_EXT_mesh_shader with taskShader, meshShader and multiDrawIndirect, the
runtime's mesh set, so lavapipe draws mesh pipelines and is the device test's venue.
2026-12-04 18:12:43 -08:00
Anees Iqbal 37ab640c30 Docs and a test: a required constant left without a value is undefined, and the imageblock case is refused
Metal makes a function and its pipeline state from a specialization that leaves a required
function constant without a value, and runs it (the probe undefined_function_constant_values.m,
cases set0 and ib/*, the Apple M3 Max under macOS 27.0.1, job m3-max-86943), though Apple's
MTLFunctionConstant.required page says such a constant needs a value. What a program computes
from it is undefined, and the translation does not emulate Metal's answers, which follow no one
rule (the probe's kib, kib2 and derived reads against its gate kernel kg).

docs/API.md's "Function constants" says so, and names the case seen: a kernel whose explicit
imageblock argument is gated on a bool derived from the constant, and whose body still reaches the
imageblock on the way taken, is refused Unsupported{Imageblocks} with ImageblockCause::Missing.
The runtime README's known gaps of pipeline states records the same refusal of a state
(Error::Translation): the runtime compiles the consumer's specialized FunctionDescriptor as given
and does not consult FunctionDescriptor::needs_specialization, so a guest's specialization that
leaves the constant out reaches it.

engine_undefined_imageblock_gate pins today's answers for the probe's kib shape (its slice write
left out), on every profile that takes threadgroup memory: without a value for the constant,
Unsupported{Imageblocks} with ImageblockCause::Missing; with 0 or 0xffffffff, the kernel compiles.

Behaviour is unchanged, so no SEMANTICS_VERSION bump.
2026-12-04 18:12:42 -08:00
Anees Iqbal a7166b2ded Translator: the open_cl_lines variant goes; the runtime never asks for it
LoweringInputs::open_cl_lines, VariantKey::open_cl_lines and metal2vulkan-air's
SpecRequest::open_cl_lines named the 1D images of a kernel of OpenCL mode that a 1D texture is
bound for, which then kept their 1D type and operations. metal2vulkan-runtime never asks for
that variant: it refuses a 1D texture bound for such a kernel (Gap::OpenClLineTexture, the
encoder's check of interface.open_cl_mode), since no reading of one is documented Metal, and
nothing else in the tree sets the field.

Consumer search: reims-vgpu cc1f47b30b (its development, read only): git grep -n open_cl_lines
-> 0 hits (its only OpenCL hits are its own open_cl_mode fields and the
RGFX_COMPUTE_PIPELINE_OPENCL_MODE flag). Its generated link-order.txt names
VariantKey::lowering_inputs' closures, not the field.

Deleted:
- metal2vulkan-air: SpecRequest::open_cl_lines; canon::opencl::entry's lines argument (every 1D
  image of the kernel now takes its 2D texture's type); canon::opencl_1d's kept parameters
  (site, of_params, kept_params), so expand rewrites every 1D operation it lists; the doc lines
  that named the variant. Entry::open_cl_1d_images stays: its doc drops the variant.
- metal2vulkan: LoweringInputs::open_cl_lines, VariantKey::open_cl_lines (is_empty and
  lowering_inputs), the function key's "open-cl-lines" part (appended only when set, so every
  surviving key hashes the same bytes), and compile.rs's plumbing: InputsFrom::open_cl_lines,
  StageEntry::open_cl_lines, the lines half of the stage entries' (mode, lines) match,
  given_inputs' clearing and the request's lines.
- Tests: the variant's half of the AIR test (renamed
  opencl_1d_images_take_their_2d_textures_types, which keeps its OpenCL-mode type names and
  open_cl_1d_images assertions), the api round-trip values, and the field in every
  SpecRequest and LoweringInputs literal (air canon tests, memory plan tests, air_canon,
  validation's check.rs).
- docs/API.md's OpenCL image paragraph named the variant; it now says each Mac's reading of a
  1D texture there, which the kernel does not take.

Public surface: python3 scripts/api-signatures/signatures.py --bless removes exactly the three
field records (metal2vulkan-air::SpecRequest.open_cl_lines,
metal2vulkan::cache::VariantKey.open_cl_lines, metal2vulkan::pipeline::LoweringInputs.open_cl_lines),
a breaking change of the two published crates. refusal_surface.py reads no such field:
--check passes unchanged, docs/REFUSALS.md does not move.

Output: none moves for any input the runtime makes. A kernel compiled with an empty set, the
only one anything sent, specializes and keys as before; SEMANTICS_VERSION stays (as at
a7dd2e846e for the binder's inputs). The per-parameter meter ticks of kept_params go with it.

Search at 9db78abe7d: git grep -n open_cl_lines -- crates docs: 37 hits across compile.rs,
cache/mod.rs, lower_inputs.rs, key.rs, the AIR canon and the tests; 0 after.
2026-12-04 18:12:42 -08:00
Anees Iqbal 47fec71d2a Validation player: command-replay refuses an option given twice, and section 10 lists every option
options() now refuses an option a command line gives twice, "--NAME is
given twice", before anything runs: exit status 2 and the usage
printed, as for an option the subcommand does not take. Before, the
second value replaced the first in the map with nothing said, so a
script that spliced options after its own (`--until-frame X
${PLAY_ARGS}`) played the splice's value unnoticed. The module doc and
with_options' doc say so.

docs/REPLAY-STREAM.md section 10 named the options each subcommand
takes only in part, though it said each takes "the options its usage
names". Its play synopsis now lists all twenty, adding --state-log,
--state-threads, --state-keys, --state-digests, --prepass-width and
--dump-command-buffers with --dump-dir. A paragraph after the
states-only one now says what the state options and --prepass-width do,
from the module doc. dump and shapes show [--blobs DIR]. The rule now
reads: each option once, none it does not take.

Callers audited at development 039f7a9350 for an option given twice
(the 9db78abe7d audit of unknown options covered the same callers): the
orchestration's round script and its leg scripts, every orchestration
job script that runs the player, the scripts of every carry repository
at its HEAD (104 invocations in all), the consumer's tree (no caller),
CI, CONTRIBUTING.md and the docs (none runs the player), and the
in-tree tests. No invocation names an option twice. Where options are
spliced from the environment, the values on record don't repeat an
option either: PLAY_ARGS (--check-presents), PLAYARGS (empty or
--managed two-copy) and UNTIL (becomes --until-frame, in scripts that
do not pass --until-frame themselves). Three splices have no recorded
value and stay unaudited: FS_PLAY_ARGS, EXTRA and PARGS.

Verified: the red commit's every_subcommand_refuses_an_option_given_twice
fails at its parent (lavapipe-free run, job m3-max-86867: 1 passed, 1
failed). The jobs for this commit are named in the lane's report.
2026-12-04 18:12:41 -08:00
Anees Iqbal 9a5aa02725 docs: the API guide's extended-range paragraph says the decode selects without a branch
What: docs/API.md's BGR10_XR / BGRA10_XR paragraph describes the straight-line decode of 14d30efdfe:
every lane mapped and selected where the word names one of the formats, no branch; the sum alone
decorated NoContraction; a slot's test, flags and constants made once per binding in the function's
first block; a robustness-bounded read testing its operands at every such read. No code changes.

Evidence for 14d30efdfe (generated code identical at 7459e4d8ba and here):

Words, runtime-floor, the largest variant 3f4cca857dfa (m3-max-86685, .json sidecars included):
W 162,351; pin X's per-site branch at dc3e7e5add 211,959; 14d30efdfe 176,844, about 175,630
without sidecars against W's 161,140 (+9.0%, under the 177,254 bar). The decode costs 14,493 words
over W where the branch cost 49,608, about 46 words a site over its 318 sites, the per-binding
decodes included. On the other 14 profiles: 170,128 (the RADV and ANV ones), 170,112 (the two
RTX 50), 170,100 (the three lavapipe), 176,880 (Pascal), 197,547 (moltenvk-m3). Small rows:
54f0489eefb5 1,692 (dc3e7e5add 1,680), 2a423fb525e7 2,394 (2,403).

GPU time of a float texture that is not extended-range, the harness's sampling (sample_down, a
runtime sampler), constexpr_sampling (sample_up) and texture_read (texels_out, a read the device's
robustness bounds, which now pays its in-range test at every read), base dc3e7e5add against
14d30efdfe: four rounds, the arms' order alternated each round, 200 timed runs each, the median of
the four GPU p50s in microseconds, the four's range in brackets:
- RX 7900 XTX, RADV (m3-max-86672): sampling 16.05 (16.00-16.10) -> 16.10 (16.10-16.40), +0.3%;
  constexpr_sampling 29.95 (29.90-30.30) -> 30.75 (30.40-30.90), +2.7%; texture_read
  45.40 (45.40-45.40) -> 45.75 (45.70-45.80), +0.8%.
- Iris Xe, ANV (m3-max-86676): sampling 394.90 (393.70-395.70) -> 396.90 (394.70-398.60), +0.5%;
  constexpr_sampling 820.60 (818.60-821.80) -> 831.45 (827.70-837.40), +1.3%; texture_read
  1564.25 (1561.70-1566.30) -> 1561.10 (1557.20-1566.40), -0.2%.
- RTX 3090, NVIDIA's driver (m3-max-86692): sampling 61.80 (61.70-61.80) -> 61.85 (61.80-61.90),
  +0.1%; constexpr_sampling 65.90 (65.80-66.00) -> 66.45 (66.30-66.60), +0.8%; texture_read
  134.65 (134.60-134.70) -> 134.65 (134.60-134.70), +0.0%.
Every workload is within 3% on each card; the XTX's constexpr_sampling, +2.7%, is the closest.

Check m3-max-86665 at 14d30efdfe: 3907 passed, 1387 skipped. Lint m3-max-86683 at 7459e4d8ba:
fmt, clippy plain, m2v_gpu and m2v_cpu_icd, rustdoc all clean.
2026-12-04 12:11:12 -08:00
Anees Iqbal dc3e7e5add Conformance ledger: NVIDIA's render-then-sample-magnified-linear row returns, the device's own linear filter
What: the NVIDIA venue's render-then-sample-magnified-linear row, as 2a406a848e removed it (pin W's
text): a linear magnified sample of a rendered 8-bit target, 30 elements a code from Metal's, the
device's own answer under device-sampling and device-color-conversion. docs/CONFORMANCE-COVERAGE.md
regenerated.

Why: 2a406a848e dropped the row as stale at pin X, where a runtime pixel sampler's second sample
moved this case's filter. With the pixel sampler back at W's single quotient sample (50b05dbce2), the
device's own linear filter shows again: the RTX 5080's replay at e1dd48a92b (job m3-max-86636)
reports exactly this row, 30 elements differ (U8), the largest difference 1, and nothing else
unexpected.

Verified: the 5080 replay above; the row's fields are the replay's line. The RTX 3090's replay at the
same sha is still running.
2026-12-04 11:35:41 -08:00
Anees Iqbal f3a820799e Translator and runtime: a runtime pixel sampler samples once, at the quotient, as at pin W
The planner's ruling on pin X's fragment growth (12-04). The level-0 arm that 8f69218029 put on
every implicit sample and gather through a runtime sampler slot (a test of the slot's word, a
second, explicit level-0 sample through the state's unnormalized twin, and a branch with a phi)
doubled large fragment shaders: the largest corpus variant went from 161,140 to 318,071
runtime-floor words, and its pipeline creation from 4.0 s to 28.1 s on the Iris Xe and past
300 s on KosmicKrisp. What it bought was last-bit filter weights of a linear downscale, never
another texel.

Translator: a slot sample or gather is the one W form again. The pixel coordinate reaches the
device's normalized sampler as the coordinate over the level-0 size, chosen in ALU by the slot's
word (and its texel centre for a nearest pixel state), under PrecisionNote::PixelSamplerScaling.
Gone: Sampling::level_zero, the level-0 test and value, TextureSlot::level_zero_samplers (and
its codec field), LEVEL_ZERO_ELEMENT, UNNORMALIZED_TWIN_ELEMENT, SamplerWord's
UNNORMALIZED_FILTERS, UNNORMALIZED_LINEAR, UNNORMALIZED_MODES and reads_unnormalized, and
emit's offset_texels, which only the level-0 value read. The follow-ups go with it: c99bf0c6c3's
linear-only test and its red test, 69a3254e1a's DeviceSampling paragraph on the unnormalized
sampler's sub-texel step (no form reaches that sampler now), b58c67e981's count, 77e2a4f187's,
9fe45f0043's and a86f5ed62b's test counts. The translator test
a_runtime_samplers_implicit_sample_is_one_sample holds a fragment's implicit slot sample to one
implicit sample and no explicit one on every committed profile (at X the level-0 arm's explicit
sample made it fail).

Runtime: set 1's sampled array holds the textures and their second elements, 131,072, and the
plain sampler array 8,000 again: no unnormalized twins, no level-0 elements, no level-0 views
(Gauges::level_zero_views and its harness and replay entries go, with tests/level_zero.rs and
83bb95724d's bind check). The floor's descriptor limits are what those arrays need: sampled
images 196,608 (textures, second elements, read texture buffers), samplers 24,000, per-stage
resources 393,216 plus the attachments, all pools 417,216; X asked 262,144, 32,000, 458,752 and
490,752. These still hold the second elements on every device at the floor, so
Capabilities::attachment_reads stays always true and 7a6b0d10bc stays: no guest-visible answer
moves (W's own floor, 131,072 sampled images, would have made it a per-device answer again).
runtime-floor.json and regen_device_profiles.py state the new floor.

Docs: PixelSamplerScaling's doc and its docs/API.md entry keep W's text without the level-0
clauses; the measured line names the cards: a linear downscale by 8 through a slot within
0.88/255 of Metal's on KosmicKrisp and RADV, 0.95/255 on the Iris Xe, 1.19/255 on the RTX 3090
and 1.375/255 on lavapipe (the ledger rows' largest differences). The runtime README, RESOURCE-ID
and the pixel_samplers module doc drop the level-0 elements and twins.

Ledger: the pixel-downscales rows return on the seven venues (RX 7900 XTX, Radeon 780M, RX 550,
NVIDIA, Iris Xe, llvmpipe, Apple M3 Max) and the pixel-samplers slot rows on five cards and
lavapipe, from 24cb048066, ed46bdbfc5, 82b7d9e4a2, bb7661f09a and 0c70839937's removed lines;
the frac/slot rows that said ours read as the device's own answer under note
pixel-sampler-scaling. Coverage regenerated. The replays at this tip are the check.

Versions: SEMANTICS_VERSION 2384 (slot samples lose the level-0 arm), ARTIFACT_FORMAT_VERSION 615
(TextureSlot's codec loses level_zero_samplers), RUNTIME_VERSION 2579 (set 1's sizes, no twins or
level-0 elements, the floor's limits); runtime-sources.sha256 re-pinned. The signature table and
api_surface lose the removed items; docs/REFUSALS.md is unchanged (refusal_surface --check).

Consumer: reims-vgpu at 9889a815bb names none of the removed items (git grep -w: 0 hits each for
LEVEL_ZERO_ELEMENT, UNNORMALIZED_TWIN_ELEMENT, level_zero_samplers, level_zero_views,
reads_unnormalized, UNNORMALIZED_LINEAR, UNNORMALIZED_FILTERS, UNNORMALIZED_MODES).
2026-12-04 11:35:41 -08:00
Anees Iqbal 2a406a848e Conformance ledger: the XR families' extended-swizzles rows on the RX 7900 XTX, Iris Xe and NVIDIA venues; NVIDIA's render-then-sample-magnified-linear row goes
What: 132 rows, 44 for each card venue (RX 7900 XTX, Iris(R) Xe, NVIDIA), of extended-swizzles-bgra10xr
and -bgr10xr: the 44 sites the llvmpipe rows (58988c6b83) and the Apple M3 Max rows (35ca0e4606) hold,
each with its card's own answer and the llvmpipe row's cause: a sample past the edge through a
border address mode reads the device's border in code space, and a BGRA10_XR linear sample filters in
the fields' low 6 bits, the runtime's known gaps, not built (one parked fix row). The NVIDIA venue
covers the RTX 3090 and the RTX 5080 Laptop GPU, whose answers are equal at all 44 sites. The NVIDIA
row of render-then-sample-magnified-linear at case/sampled/texels goes: both NVIDIA cards now answer
Metal's texels there. The commit that made them match is not named (expected: the nearest pixel
sampler's texel centre, c99bf0c6c3; unaudited). docs/CONFORMANCE-COVERAGE.md is regenerated.

Why: pin X's short round read every card replay red on these lines (xtx m3-max-86478, iris 86482,
3090 86483, 5080 86484); at pin W the three card replays were green. main/ad recorded the llvmpipe
rows alone, and no merged check or pre-push set ran a card replay.

Verified: the answers are the four replays' own, at a0db12ed89. The card replays with these rows are
this pin's pre-push proof.
2026-12-03 18:59:00 -08:00
Anees Iqbal 303638b080 Conformance ledger: half-texel-nans' rows on KosmicKrisp; the runtime README's unexplained-rows bullet goes
What: 12 rows of venue Apple M3 Max for what KosmicKrisp (Mesa 26.3.1) answers in half-texel-nans:
- 9 rows of R16Float, RG16Float and RGBA16Float at a nearest sample, a read and a read through a
  sample (515, 1026 and 2045 elements): every differing element is a NaN in both answers, the
  device's NaN bits (rule 1), Metal's texel bits kept where the device answers 0x7e00.
- 3 rows of R32Float, RG32Float and RGBA32Float at a nearest sample (42, 85 and 171 elements):
  0x7bff in Metal's answer, 0x7c00 in the device's, a texel past 65504 that Metal saturates and the
  conversion takes to the infinity of its sign (PrecisionNote::HalfTexelConversion), as the other
  venues' rows at these sites record.
Each row names its notes and marks the cause of the move as expected, not verified: the device
converting in the shader rather than in its texture unit since the extended-range select
(58988c6b83) follows every float sample. docs/CONFORMANCE-COVERAGE.md is regenerated. The runtime
README's bullet listing these rows as seen and not explained goes: no KosmicKrisp replay row is
left unlisted.

Why: the planner ruled these rows, with no code change, on a counted compare of the words the case
reads at 41438f2693 and at 58988c6b83 (a scratch probe, not committed): 0 of 147,456 words differ
on lavapipe (86398), the RTX 3090 (86400) and the RX 7900 XTX (86401); on KosmicKrisp (86403,
86421) 11,056 differ, 10,758 NaN to NaN and 298 the single pair 0x7bff to 0x7c00. llvmpipe's
nearest-sample rows exceed its read rows by the same 42, 85 and 171 elements.

Verified: the rows' answers and first elements are KosmicKrisp's own, from a replay of the eight
cases at 4e7f66642e (m3-max-86425, an Apple M3 Max). The runtime-sources pin is unchanged.
2026-12-03 18:21:27 -08:00
Anees Iqbal 35ca0e4606 Conformance ledger: the XR families' rows on KosmicKrisp
What: 62 rows of venue Apple M3 Max for what KosmicKrisp (Mesa 26.3.1) answers in the XR
families, the same gaps the other venues' rows record:
- 18 rows of the device's blend of the codes (PrecisionNote::ExtendedRangeBlend and
  ExtendedRangeBlendWindow) and its resolve (DeviceRoundedResolve): xr-blend (4), xr-gamut (9),
  xr-gradient (3), xr-masked (2). The two premul blends differ from the other venues past the
  window (the largest difference 53,463 against 24,637), unexamined against Vulkan's clamp of a
  fixed-point source, as their rows say.
- 44 rows of extended-swizzles-bgra10xr and -bgr10xr, with the llvmpipe rows' cause: a sample
  past the edge through a border address mode reads the device's border in code space, and a
  BGRA10_XR linear sample filters in the fields' low 6 bits (the runtime's known gaps, not built).
docs/CONFORMANCE-COVERAGE.md is regenerated.

Why: the replay of KosmicKrisp at development (m3-max-86361) listed them as unlisted; the planner
ruled both families rows, the extended-swizzles fix a bug row of its own.

Verified: the answers are KosmicKrisp's own, from that replay. The replay of the whole ledger on
KosmicKrisp with these rows (m3-max-86387, an Apple M3 Max): 12 unexpected, every one
half-texel-nans (not these families), 0 of the 62.
2026-12-03 18:03:36 -08:00
Anees Iqbal ff6e54b4ae Conformance ledger: the mesh rows on the RX 7900 XTX
The RX 7900 XTX (RADV, Mesa 26.2.6) replayed the 44 cases of mesh
pipelines at 19bf5ff006 (job 86024, carry b11f9ecd63) and answered as the
RTX 5080 Laptop, the RTX 3090 and the Radeon 780M did: 9 exact, 5
announced, 1 divergent, 29 refused. Its 25 lines of drift are exactly the
rows those venues carry, so the same rows are written for the venue
"RX 7900 XTX": the ThreadgroupMemoryLength and IndirectObjectGrid
refusals, the two CommandTypes cases, the eight divergent sites of
mesh-barrier-readers with the reason quoting the header and note 3 of
the feature set tables, and the twelve mesh-limits cases refused at
maxTotalThreadsPerThreadgroup.

docs/CONFORMANCE-COVERAGE.md regenerated (coverage.py).

Verified: job 86024 printed the 25 lines these rows answer, and the same
job's device tests passed 8 of 8 with the validation layer. A replay of
this commit on the card, to show no drift, follows.
2026-12-03 17:05:48 -08:00
Anees Iqbal 1d1a16aaf6 Conformance ledger: the mesh rows on the Radeon 780M
The mesh replay on the Radeon 780M (RADV, Mesa 26.2.6), job m3-max-85955 at 26d0420861 with the
carried binaries, held the same 25 sites as the RTX 5080 Laptop and the RTX 3090 (jobs 85920 and
85935), case for case, site for site and answer for answer, and nothing else: 9 exact, 5
announced, 1 divergent (mesh-barrier-readers, the ruled rows), 29 refused. Those 25 rows come in
for venue 780M. The runtime's 7 mesh device tests passed there under the validation layer.

The RX 550 (RADV, Mesa 26.2.6), which lists no VK_EXT_mesh_shader, replayed the same 44 cases in
job m3-max-85949 with exit 0: 25 lacking the feature, 7 exact (the creations Metal refuses), 12
refused at the `*` rows, so no per-venue row fires on a venue without mesh stages.

docs/CONFORMANCE-COVERAGE.md is regenerated in this commit (coverage.py --check passes locally).
2026-12-03 17:05:47 -08:00
Anees Iqbal e5a9b6d7d0 Conformance ledger: the mesh rows on NVIDIA
The mesh replay on the RTX 5080 Laptop (NVIDIA 615.71.09), job m3-max-85920 at 26d0420861 with
the carried binaries, held exactly the rows lavapipe holds and nothing else: 25 sites "not listed"
on this venue, every one the same case, site and answer as its llvmpipe row (IndirectObjectGrid
at the two indirect object draws, ThreadgroupMemoryLength at the lengths case, CommandTypes at
the two command cases, the tile getter at the 12 made mesh-limits states, and mesh-barrier-
readers' 8 fragment-to-* sites). Those 25 rows come in for venue NVIDIA.

The same run: 9 exact, 5 announced (the draw cases, under the device's native NaN encoding
note), 1 divergent (mesh-barrier-readers, the ruled rows), 29 refused; mesh-partial-barrier-
uniform is exact (its PredicationVote refusal is fixed in 0d7bbee12c). The runtime's 7 mesh
device tests passed there under the validation layer 1.4.363.0.

docs/CONFORMANCE-COVERAGE.md is regenerated in this commit (coverage.py --check passes locally).
2026-12-03 17:05:47 -08:00
Anees Iqbal 6639653a97 Conformance ledger: the mesh rows as the runtime now answers, on lavapipe
The mesh cases were 49 rows of `*` refusing a call the runtime's side lacked (mesh_pipeline,
mesh_pipeline_limits, mesh_pipeline_for_commands, mesh_pipeline_bindings,
mesh_descriptor_facts). The adapter answers all five, and the lavapipe replay of job
m3-max-85712 (c6bd918103) read each of those rows as no longer held. They go, and the rows the
replay holds come in (47):

- `*`, the calls that make no pipeline: the mesh descriptor's label and binaryArchives (3 cases,
  the consumer's own, as the render descriptor's) and the two reflection cases' 8 option sites
  each (the consumer's own reflection).
- llvmpipe, the calls that make one, so a venue without mesh stages reads them as lacking the
  feature and holds no row (a `*` row there fails as no longer held, now lacks the feature):
  - IndirectObjectGrid at the indirect draw of mesh-object-draws and of
    mesh-barrier-indirect-object-reader (the step-4 ruling: refused at the draw);
  - ThreadgroupMemoryLength at indirect-mesh-commands-object-threadgroup-lengths' pipeline (the
    object function's [[threadgroup(n)]] argument, refused at the creation, as ruled);
  - CommandTypes at both mesh-commands cases' command buffer (the ICB ruling; its row's count:
    0 of 22 kept streams, jobs 85614/85615);
  - maxTotalThreadsPerThreadgroup, a tile getter, at 12 mesh-limits cases whose state is made
    (an M3 Max answers 0 there; the runtime makes no tile state);
  - mesh-barrier-readers, divergent at the attachment and drawn count of its four rows whose
    barrier names the fragment stage in afterStages. main's ruling: the documented answer stands.
    MTLRenderCommandEncoder.h says the barrier makes stores at or before afterStages coherent
    with loads at or after beforeStages, which the runtime does; the M3 recorded the reader
    without the fragment's words, and the Metal Feature Set Tables (October 23, 2026, note 3)
    say Apple3 through Apple11 GPUs don't support barriers with the fragment stage in after.

The other mesh rows stay: function facts, the pipeline handler pair, the binary archive adder
and the visible-table stages answer as before. mesh-partial-barrier-uniform holds no row: its
PredicationVote refusal is fixed in 0d7bbee12c. The GPU venues' rows follow their runs.

docs/CONFORMANCE-COVERAGE.md is regenerated in this commit (coverage.py --check passes locally).
2026-12-03 17:05:47 -08:00
Anees Iqbal 132e7a16c6 Conformance: a made mesh state's sites are its own method, so the coverage reads its Field
Job m3-max-85712 (c6bd918103) failed conformance_coverage's
the_conformance_coverage_document_is_what_the_sources_derive: MeshStateLimits'
max_total_threads_per_threadgroup became a Field in the adapter commit, and the coverage
generator finds a Field's leaf only as `Node::leaf("site", field(&self.x, ..))`. The node
recorded it through `state.` inside Creation<MeshStateLimits>::node.

The made state's leaves move to MeshStateLimits::with_sites (&self), in the same order and with
the same values; the creation's node adds them where the state was made. docs/CONFORMANCE-
COVERAGE.md is regenerated: MeshDescriptorFacts (label, binary_archives) and MeshStateLimits
(max_total_threads_per_threadgroup) join the table of refusable fields.

Verified: `python3 -I -B scripts/conformance-coverage/coverage.py --check` passes on this tree
(run locally, no cargo); the conformance suite runs in the next job.
2026-12-03 17:05:47 -08:00
Anees Iqbal 07d9577c20 Translator and runtime: the mesh stages no longer require drawIndirectCount
Since the step-4 ruling no mesh draw reads a GPU-written draw count: an
indirect draw of an object function is the runtime's refusal at the draw
(DrawKind::IndirectObjectGrid), a mesh-only indirect draw is the launcher's one
task workgroup (vkCmdDrawMeshTasksEXT(1, 1, 1)), and an object grid's pieces past
the task limits take a host-written count through multiDrawIndirect. Rule 4
(anything unused is deleted) drops it, as the planner ruled through main:

- lower::mesh::FEATURES and floor::MESH_STAGES hold taskShader, meshShader and
  multiDrawIndirect; device creation enables VK_EXT_mesh_shader with those
  three where the device reports all three.
- The cond-1 tests iterate the three; the floor test also shows a device
  without drawIndirectCount given the mesh stages, and the device test no
  longer reads it.
- The README's Mesh stages section and its extension row, docs/API.md, the
  compile_mesh_pipeline and new_mesh_render_pipeline_state docs, and the
  requirement's own doc say three.
- SEMANTICS_VERSION 2370 (placeholder; main renumbers): the MeshShading
  refusal's needs change on a profile without drawIndirectCount (the M3 Max
  under MoltenVK reports it false).

No lab device changes: every card that lists VK_EXT_mesh_shader reports
drawIndirectCount (vulkaninfo on the RTX 3090, RTX 2080, RTX 5080 Laptop,
RX 7900 XTX, Radeon 780M and lavapipe). REFUSALS.md and the signatures were
regenerated and did not move; the runtime sources pin was rewritten.

Verified: JOBLINE
2026-12-03 17:05:45 -08:00
Anees Iqbal 28c2803429 Runtime: an indirect mesh draw of an object function is refused at the draw
What: a new DrawKind::IndirectObjectGrid. MeshCall::of refuses an indirect draw (MeshGrid::Indirect)
of a state with an object function with Gap::Draw of it, after the threadgroup checks and before
anything is recorded; draw_mesh_threadgroups_indirect's doc says so. Launch::Arguments, the
object grid's indirect command the previous commit drew, is deleted with its recording. An
indirect draw of a state without an object function is drawn through the launcher, as before.
The runtime README's mesh known gap records the refusal, where Metal draws, and that no guest has
met it (no replay stream or live session has used a mesh state).

Why: the planner's step-4 ruling. An object grid the GPU reads may lie past the device's task
limits (maxTaskWorkGroupCount, maxTaskWorkGroupTotalCount), where it runs in pieces whose number
only the counts decide; the runtime reads no GPU word on the host (condition 6) and no command
inside the pass can write the pieces' records (condition 5), and Vulkan leaves a task grid past
the limits undefined (VUID-VkDrawMeshTasksIndirectCommandEXT-TaskEXT-07322).

Tests: the parent's red tests pass here, narrowed to the kind: the no-device
tests::mesh_draw::an_indirect_draw_of_an_object_function_is_refused_at_the_draw and the lavapipe
draw test's indirect draw of mesh_draws' object state. docs/REFUSALS.md, error/basis.rs and
api_signatures.tsv are regenerated.

Verified: JOBLINE
2026-12-03 17:05:44 -08:00
Anees Iqbal a5624a650f Runtime: a mesh render pipeline state draws drawMeshThreadgroupsWithIndirectBuffer
What: RenderCommandEncoder::draw_mesh_threadgroups_indirect, Metal's
drawMeshThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerObjectThreadgroup:
threadsPerMeshThreadgroup:. The arguments (Metal's MTLDispatchThreadgroupsIndirectArguments,
three u32s) are checked as a vertex draw's are (OtherDevice, IndirectOffset,
IndirectArgumentsPastEnd at 12 bytes, ArgumentPlace; the checks are now one helper,
arguments_checked, for both). The draw pushes the arguments' address as the group counts'
address, so nothing is written to the ring and nothing read back:

- without an object function the state's launcher reads the GPU's counts there and emits the mesh
  grid where Metal draws it, one task workgroup, vkCmdDrawMeshTasksEXT(1, 1, 1);
- with one, the arguments are the object grid's own indirect command, one
  vkCmdDrawMeshTasksIndirectEXT record (Vulkan's command is Metal's layout).

The buffer counts as the draw's read (its hazards, a Managed buffer's copy, kept until the command
buffer retires), as a vertex draw's arguments. Call::Mesh carries the arguments; mesh_draw gains
MeshGrid::Indirect and Launch::Arguments. README and docs/API.md say the indirect form is drawn.

Why: R3 of the mesh build. The object pipeline's indirect form is drawn here as the task grid's
indirect command, which is right only within the device's task limits; the planner's step-4
ruling refuses it at the draw, which the next two commits do red-first.

Tests: tests::mesh_draw adds the indirect calls' counts, regions and launches; the lavapipe draw
test adds three indirect draws through the launcher: 3 groups by 8 at offset 8 (the M3's
grid-indirect-3x1-by-8 pixels and words), and an axis of 65,536 and 1024 by 1024, which draw
nothing, as on the M3. api_signatures.tsv and docs/REFUSALS.md are regenerated.

Verified: JOBLINE
2026-12-03 17:05:44 -08:00
Anees Iqbal 14a935e73d Docs: a mesh stage's default thread maximum of 1024 is as an M3 recorded it
What: GraphicsState::max_total_threads_per_object_threadgroup's doc, docs/API.md's mesh
pipelines section and RenderPipelineState::max_total_threads_per_object_threadgroup's doc now
say the rule's last step, 1024 where neither the descriptor nor the function states a maximum,
is as an M3 recorded it (an M3 Max, macOS 27.0.1, a first compile, the conformance probe
mesh_pipeline_limits.m), and that Metal's headers state no default.

Why: the planner's wording ruling on T9: the value is measured, and the doc says where from.

Verified: comment and doc text only; cargo fmt; runtime-sources.sha256 unchanged (the pinned
set holds none of these files).
2026-12-03 17:05:44 -08:00
Anees Iqbal a08a4fd1da Runtime: mesh render pipeline states draw drawMeshThreadgroups and drawMeshThreads
What: the render encoder binds the object and mesh functions' tables (set_object_* and
set_mesh_*: buffer, buffer offset, bytes, texture, sampler state with and without LOD clamps) and
draws a mesh state directly: draw_mesh_threadgroups and draw_mesh_threads. The device loads
VK_EXT_mesh_shader's commands where it enabled the extension (Core::mesh). A new module,
mesh_draw, holds the draw's grid:

- each threadgroup is checked against Metal's maximum for its stage (Refusal::ThreadgroupSize for
  no threads or past it) and then against the state's capped maximum, a new
  Limit::MeshThreadgroupThreads naming the stage, the size, the state's maximum, the Vulkan limit
  that holds it (a new public WorkGroupLimit, maxTaskWorkGroupInvocations, maxTaskWorkGroupSize[0]
  or their mesh siblings) and that limit's value, counted in a new
  Metrics::mesh_threadgroups_past_device. The object size is read only where the state has an
  object function.
- the draw writes three group counts into the ring and pushes their address
  (GroupCountsAddress), and writes each stage's DispatchRegion: the mesh stage's L, and the object
  stage's L with Metal's threads per grid and the partial flag for a draw of threads (no grid for
  a draw of threadgroups, so the object function's is counts times L).
- without an object function the counts are the mesh grid (a draw of threads rounds it down, as
  the M3 recorded in mesh-grid-draws), and the draw is the launcher's one task workgroup,
  vkCmdDrawMeshTasksEXT(1, 1, 1).
- with one, an object grid within the task limits is one vkCmdDrawMeshTasksEXT of its counts;
  past them it runs in pieces of the most workgroups the limits allow, one piece directly and more
  as one vkCmdDrawMeshTasksIndirectEXT whose records lie in the ring (stride 12), the folded object
  function numbering them by DrawIndex. More pieces than one ring chunk holds (5,461) is a new
  Limit::ObjectThreadgroups.
- an empty grid records nothing; a mesh draw with a vertex function's state is Refusal::MeshDraw,
  whose doc now covers both directions.

Each mesh draw fills its push bytes and blocks (its counts and regions are its own); it records
no topology (a mesh pipeline holds no input assembly, which leaves the recorded topology as it
was) and biases as triangles. No draw ends the pass and nothing reads a GPU word back
(conditions 5 and 6 for direct draws). The indirect mesh draw is not built yet: the README's known
gap says so, and the consumer refuses it itself.

Why: R2 of the mesh build, direct draws, in the ruled order after the state (R1b).

Tests: tests::mesh_draw (no device) checks the size refusals and the limit with its Vulkan names,
each call's counts, regions and launch against the region helpers, and the pieces on the 780M's
and the RTX 50's task grids (cover, minimality, the chunk limit). tests::mesh_state's new device
test draws mesh_draws' states into two RGBA32Uint targets and compares every pixel with the
fixture's words, which match the M3's recordings (mesh-grid-draws, mesh-object-draws): through the
launcher (3x2 groups by 4, 7x5 threads by 2x2), through the object function (2 groups of 2, 3
threads of 2 with a partial threadgroup), empty grids, and the refusals. It also prints each
device's task and mesh limits for the known gaps' per-card table. docs/REFUSALS.md, error/basis.rs
and api_signatures.tsv are regenerated; README and docs/API.md state the direct draws.

Verified: JOBLINE
2026-12-03 17:05:44 -08:00
Anees Iqbal 36a93dc7ec Runtime: a mesh render pipeline state is made, with its VkPipeline and Metal's thread and grid answers
What: Device::new_mesh_render_pipeline_state(&MeshPipelineDescriptor, sampler_ids) makes a
RenderPipelineState of a mesh descriptor.
- The content is compiled with compile_mesh_pipeline at each creation. The translator gives no
  key of a mesh descriptor before its compile, so neither the map of contents nor the cache
  directory holds one.
- The draw tables become four: VERTEX, FRAGMENT, OBJECT and MESH, in Draws, OffsetLayout and the
  render encoder's tables, blocks and dirty offsets.
- draws() maps the object stage (or the launcher) and the mesh stage to their tables, takes their
  threadgroup facts, and maps DispatchRegion, GroupCountsAddress (new FieldValue::GroupCounts) and
  the mesh stage's layer and viewport counts.
- MeshThreads holds each stage's answer: the translator's stated maximum capped by
  maxTask/MeshWorkGroupInvocations and maxTask/MeshWorkGroupSize[0]. Its workgroup is that answer
  in one row, rounded up to the stages' LocalSizeConstraint multiple.
- stage_module specializes ObjectLocalSize/ObjectFlatLocalSize, with ObjectMultiRegion 1, and
  LocalSize/FlatLocalSize, with MultiRegion 0, to the two workgroups. A threadgroup memory length
  stays refused.
- make() gives a mesh pipeline no vertex input or input assembly, and drops PRIMITIVE_TOPOLOGY and
  PRIMITIVE_RESTART_ENABLE from its dynamic states (VUID-VkGraphicsPipelineCreateInfo-
  pDynamicStates-07065 and -07066).
- The state answers maxTotalThreadsPerObjectThreadgroup, maxTotalThreadsPerMeshThreadgroup,
  objectThreadExecutionWidth and meshThreadExecutionWidth (32), maxTotalThreadgroupsPerMeshGrid
  (the descriptor's, else 1,048,576) and both required sizes. A state without an object function
  answers 0 for its object stage, as docs/API.md's accepted differences say.
- New Refusal::MeshDraw (basis: ours) refuses a draw of primitives or patches, or an execution of
  an indirect command buffer, with a mesh state (VUID-vkCmdDraw-stage-06481). The encoder records
  no mesh draw yet; that is the next step.
- The runtime re-exports MeshPipelineDescriptor.

Why: step 2 of the ruled order (floor, state, direct, indirect, ICB, adapter), under the planner's
cap ruling: a made state answers the capped maxima.

Docs: the README's known gap now says mesh states are made and not drawn, each creation compiles,
threadgroup memory arguments are refused, and the maxima are capped. The stale identity-domains
bullet for object and mesh functions is deleted: 2761e27594 removed that refusal. docs/API.md is
updated. docs/REFUSALS.md and error/basis.rs are regenerated. api_signatures.tsv is blessed: new
runtime methods, the refusal and the re-export, with nothing removed.

Tests: tests::mesh_state, under a device cfg, on every device of the cfg's kind. Where the device
has the mesh set:
- mesh_pipeline_limits' four states (nothing stated; 64, 32 and grid 8; without an object
  function, with and without grid 8) are made with their VkPipeline and answer the capped maxima;
- a draw of primitives with one is Refusal::MeshDraw;
- mesh_draws' rasterizing states into two RGBA32Uint colours, with and without the object
  function, make their VkPipeline.
Elsewhere each state is refused naming MeshShading.
2026-12-03 17:05:43 -08:00
Anees Iqbal 7fa5ab461e Translator: a mesh stage's stated maximum is its required size's threads first, as Metal answers it
What: stated_threads takes the descriptor's required threadgroup size for the stage first: its
threads, then the descriptor's maximum, then the function's attribute, then 1024. mesh_fields
keys both required sizes, since the stated maxima now depend on them. The doc comments say where
each part of the rule was measured.

Why: the conformance probe mesh_pipeline_limits.m, measured on an M3 Max under macOS 27.0.1 with
each case a first compile, records the rule:
- `plain`, with nothing stated, answers 1024 for both stages. That is the source of "else 1024".
- A required size answers its threads, even below a function's own maximum:
  required-object-32x2 answers 64, required-mesh-16x2 answers 32, and
  required-object-32-attribute-64 answers 32.
- A maximum or an attribute answers itself.
The parent commit left the required size out. The descriptor's doc said no limit depended on it,
which those rows contradict.

Tests: a_mesh_pipeline_states_its_thread_maxima_by_metal_s_rule adds three rows:
- (32,2,1) required for the object stage gives (64, 1024);
- (16,2,1) required for the mesh stage gives (1024, 32);
- mesh_outputs with (32,1,1) required for the object stage, whose function states 64, gives
  (32, 32).
The ARTIFACT_FORMAT_VERSION bump of the parent covers this, and every mesh pipeline's key moves.
api_signatures.tsv is re-blessed and unchanged.
2026-12-03 17:05:43 -08:00
Anees Iqbal 2ffddf5a56 Translator: a mesh render pipeline states each stage's thread maximum by Metal's rule
What: GraphicsState gains max_total_threads_per_object_threadgroup and
max_total_threads_per_mesh_threadgroup, both Option<u32>. compile_mesh_pipeline sets them by
Metal's rule, before any device limit: the descriptor's maximum where it states one, else the
function's [[max_total_threads_per_threadgroup(n)]], else 1024. The object one is None without an
object function; every vertex pipeline states neither. The cache codec encodes both.

Why: a mesh render pipeline state answers maxTotalThreadsPerObjectThreadgroup and
maxTotalThreadsPerMeshThreadgroup, and the runtime specializes each stage's workgroup to that
many threads (capped by the stage's device limits, per the planner's cap ruling). The function's
attribute lives only in its compile, so the runtime cannot read it from the descriptor; the
pipeline now states it, as a compute pipeline's metal_info states its kernel's.

ARTIFACT_FORMAT_VERSION 609 (a placeholder; the number is set at landing): GraphicsState's
encoding has two more fields. A digest omits a field at its default, so no vertex pipeline's
content digest moves; a mesh pipeline's does.

Tests: engine_mesh's a_mesh_pipeline_states_its_thread_maxima_by_metal_s_rule, on the first
committed profile with the mesh stages: mesh_pipeline_limits with nothing stated (1024, 1024),
with 64 and 32 stated (64, 32), its mesh function alone (none, 1024), and mesh_outputs, whose
object and mesh functions state 64 and 32 (64, 32). The codec round trip carries both fields.
docs/API.md's mesh pipelines section states the rule and what a consumer does with it.
api_signatures.tsv is blessed: two public fields added, nothing removed.
2026-12-03 17:05:43 -08:00
Anees Iqbal ecdce9a3b5 Translator: a mesh pipeline without an object function draws through a launcher task stage
What: link::mesh::Launcher. Link plans it for a mesh render pipeline without an object function.
Its push range is 8 bytes at the first offset no stage's range covers (tessellation's
push_offset; Unsupported{MeshShading} needing maxPushConstantsSize where none is free), and it
places its one field, PushField::GroupCountsAddress, as an object-stage placement, first in the
interface. compile_mesh_pipeline builds its module and puts it first among the stages, joining
its requirements:
- a TaskEXT entry of LocalSize 1 1 1 loads the three counts at the pushed address (4-aligned,
  Metal's MTLDispatchThreadgroupsIndirectArguments layout);
- it emits that grid where each axis is within Metal's measured 65,535 and the device's
  maxMeshWorkGroupCount, and the product within Metal's 1,048,575 and the device's
  maxMeshWorkGroupTotalCount, tested as an object function's wrapper tests its grid; past them
  it emits 0, 0, 0, so nothing is drawn, as Metal draws nothing;
- where the mesh function reads a payload, it declares an arena of that size
  (memory::arena::declare_payload) and emits it unwritten, as VUID-RuntimeSpirv-MeshEXT-12380
  requires.

Why: the planner's ruling on the mesh build, step 4, mesh-only pipelines. Every draw of such a
pipeline, direct or indirect, is then vkCmdDrawMeshTasksEXT(1, 1, 1) in its pass and in order:
for an indirect draw the address is the guest's buffer, so nothing is written before the pass,
and Metal's limits are held on the GPU. Direct draws take the same stage, with their counts
written to the ring, so the state has one form.

SEMANTICS_VERSION 2369 (a placeholder; the number is set at landing): a mesh-only pipeline gains a
stage. No function's own module moves.

Tests: the parent's red test passes. The identity-domains test checks each stage, the launcher
included, with spirv-val and the profile's requirements. docs/API.md's mesh pipelines section,
compile_mesh_pipeline's doc and the pipeline module docs describe the launcher.
runtime-sources.sha256 is unchanged.

Verified: see the job named below.
2026-12-03 17:05:43 -08:00
Anees Iqbal 8a80dd27df Translator: an object function reads its draw's group counts at an address, the rest of its region pushed
What: a new push field, PushField::GroupCountsAddress: the device address of a draw's three
threadgroup counts in Metal's MTLDispatchThreadgroupsIndirectArguments layout (three u32s at a
multiple of 4). A folded object function, its one grid form, places it with its own
DispatchRegion, in place of the 32-byte record at ReplayRegionAddress:
- access::object_region builds the region the folded walk reads: the pushed DispatchRegion, its
  first xyz replaced by the counts read at the address (three 4-aligned loads);
  EmitCx::push_field routes a folded object function's DispatchRegion there
  (held_push_field loads a field as its block holds it);
- its threadgroups per grid are the counts, and its threads per grid the counts times L,
  wrapping as Metal's builtins do, or the region's grid where the draw states one (a draw of
  threads, whose partial flag the region carries as before);
- plan_replay places the two fields for a folded object function; a folded kernel, a flat
  variant and a replay variant keep their record;
- under the identity domains GroupCountsAddress is an admitted field, and ReplayRegionAddress
  is refused for every stage (its object exception is gone).

Why: the planner's ruling on the mesh build, point 5: the counts need nothing beside them, so a
draw can point the field at counts as an indirect buffer holds them, and the threads per grid
come from the pushed L.

SEMANTICS_VERSION 2368 (a placeholder; the number is set at landing): every object function's
module moves. The engine golden table's object cells on the profiles with the mesh stages move
with it; they wait for the bless at the next named pin.

Tests: the parent's red test passes. The push field ordering test places GroupCountsAddress
after DispatchRegion. The field's encoding (cache codec) and its shape (u64) are added;
tests/api_signatures.tsv gains the variant; docs/API.md's mesh pipelines section, the dispatch
module docs, LoweringInputs::folded_groups and RuntimeFact::FoldedGroups say what the object
function reads. runtime-sources.sha256 is re-pinned.

Verified: see the job named below.
2026-12-03 17:05:42 -08:00
Anees Iqbal 763caf0270 Translator: object and mesh functions take their SIMD groups from the task and mesh stages' own subgroup facts
What: the profile's subgroup model now records the task and mesh stages (SubgroupModel::object
and ::mesh), read like the other stages from subgroupSupportedStages, the device's operation
classes, requiredSubgroupSizeStages under subgroupSizeControl, and the size range.
computeFullSubgroups gives full subgroups to the compute, task and mesh stages, as Vulkan says
("requiring full subgroups in compute, mesh, or task shaders"). STAGE_BITS names the two stages,
so a module's SubgroupStage and RequiredSubgroupSizeStage properties for them are in the enabled
capabilities. The stand-in that answered "no subgroups" for both stages (UNMODELED_STAGE) is
deleted.

subgroup::tier, width_needs, requirement and quad_free treat object and mesh functions as they
treat kernels (Stage::has_workgroup):
- full subgroups and a pinned 32 (Direct), or 64 or 128 split into 32-lane clusters;
- a local size multiple of that size, which dispatch::plan_kernel already states as
  RuntimeFact::LocalSizeConstraint for the flattened form;
- quads tiered as cross-lane quad operations;
- a quad-only function at the size the stage gives.
The emulated tier stays the kernels' alone. An object or mesh stage that pins no size and runs
below 32 lanes (lavapipe) refuses a SIMD-group function as Unsupported{SimdWidth}, naming
subgroupSizeControl, the stage's RequiredSubgroupSizeStage and its maxSubgroupSize. Quad
instructions stay kernel-only (lower::simd), so an object or mesh quad is a shuffle, and the
requirement derivation still asks subgroupQuadOperationsInAllStages of a quad instruction in the
task and mesh stages.

Why: conditions 2 and 3 of the planner's ruling on the mesh build. An object or mesh function's
SIMD groups run on the native subgroup. Its workgroup is its pipeline's stated maximum (the
condition 4 commit), made a multiple of the subgroup size, and the invocations past a draw's
threadgroup are not live, so a partial SIMD group has Metal's inactive lanes; no threadgroup
size is refused for not being whole SIMD groups. The planner ruled (a) for lavapipe: the typed
device-lack refusal, decided by those queries alone, with no emulated tier. Main fires that
ruling's trigger: a real card's profile that lists the mesh extension but lacks size control
for the task or mesh stage.

The stage facts extend the existing subgroup queries to two more stages; no form is added.
Every profile's fingerprint changes with its subgroup model. SEMANTICS_VERSION 2367 (a
placeholder for the number at landing): object and mesh functions of SIMD-group operations
compile where they were refused.

Tests: the parent's red test passes. The tier golden table gains the object and mesh columns:
- Direct on the AMD, Arc and RTX 50 profiles;
- a width refusal on lavapipe;
- missing operations where the device lists neither stage (Iris Xe, UHD 770, Pascal, MoltenVK,
  the runtime floor).
The invariants hold for object and mesh as for kernels.
object_and_mesh_stages_read_their_own_subgroup_facts checks the three queries apart on the
780M's description:
- a mesh stage outside requiredSubgroupSizeStages takes two 32-lane clusters of its 64 lanes
  while the task stage pins 32;
- without computeFullSubgroups both are refused naming it;
- without the task stage listed, an object function is refused naming it while a mesh function
  keeps Direct.
The narrow-subgroup and quad-only tests cover the two stages.
docs/API.md's mesh pipelines section states the stages' SIMD groups, the refusal and the quads.
runtime-sources.sha256 is re-pinned.

Reuse: the shape of this change was read in PR 25's device/subgroup.rs and device/derive.rs
(the model's two stages, STAGE_BITS, has_workgroup in tier, width_needs, requirement and
quad_free). Not taken: its change to the quad-instruction requirement, which would have dropped
subgroupQuadOperationsInAllStages for the task and mesh stages against Vulkan's "restricted to
fragment and compute stages", and its fixture and refusal.

Verified: see the job named below.
2026-12-03 17:05:41 -08:00
Anees Iqbal e649629fde Translator: the identity domains lower object and mesh functions; IdentityCause::ObjectOrMeshStage deleted
What: identity_refusal no longer refuses a function for being an object or mesh function, and it
takes an object function's PushField::ReplayRegionAddress, the address of the region record its
folded grid's draw pieces read (bind::mesh_arguments); that field stays refused for every other
stage. IdentityCause::ObjectOrMeshStage, which nothing produces now, is deleted.

Why: the mesh build. Every profile refused object and mesh functions under the identity
domains, the one form, so no mesh render pipeline compiled anywhere.

Public item removed (api_signatures.tsv): metal2vulkan::error::IdentityCause::ObjectOrMeshStage.
Consumer search: reims-vgpu development 35cea45c0e plus its 210 steelbrain refs younger than a
day: 0 hits for ObjectOrMeshStage.

SEMANTICS_VERSION 2366 (a placeholder; the number is set at landing): object and mesh functions
compile where they were refused.

Tests: the parent's red test passes; the validation companion's mesh pipelines compile where they
were refused; the linked reflection test's mesh pipeline compiles with its unwritten fragment
input dropped, as the tessellated one does. docs/API.md's cause list no longer names the
deleted cause; runtime-sources.sha256 is re-pinned.

Verified: see the job named below.
2026-12-03 17:05:41 -08:00
Anees Iqbal 3e2e65ee1a Translator: an object function has one grid form, folded; the unfolded object grid is deleted
What: given_inputs compiles every object function folded (LoweringInputs::folded_groups), alone or
in a mesh render pipeline, so its draws run any object grid in pieces within the task stage's
limits (bind::mesh_arguments). The unfolded form is deleted: DispatchPlan::object_grid and the
decl's object_grid (an unfolded object function's threadgroups per grid, wrapped at 2^32),
lower::mesh::folds_object_grids with lower::mesh::mesh_stages, which only it called, and
compile_mesh_pipeline's choice between the two. The single-region builtins test keeps its kernel cases and drops the object grid's.

Why: condition 1 of the planner's ruling on the mesh build: one grid form, no device-chosen
second one. folds_object_grids chose the folded form on a device that runs mesh stages and has
device addresses, 64-bit integers, multiDrawIndirect and drawIndirectCount. Device::from_queries
refuses a device without the first two, and object and mesh functions now need the last two
with the extension, so every device that compiles an object function took the folded form and
the unfolded one was reached only by an object function compiled alone.

No SEMANTICS_VERSION bump: an object function's key holds folded_groups, so its key changes with
its module, and every profile refuses object functions under the identity domains today.
docs/API.md's mesh pipelines section and LoweringInputs::folded_groups say an object function
is always folded.

Verified: see the job named below.
2026-12-03 17:05:40 -08:00
Anees Iqbal 7948443887 Translator: object and mesh functions need the mesh extension's two stages and the two indirect draw features together
What: lower::mesh::FEATURES lists taskShader, meshShader, multiDrawIndirect and
drawIndirectCount. An object or a mesh function, and so every mesh render pipeline with or
without an object function, now needs VK_EXT_mesh_shader and all four enabled; a device without
any of them refuses it as Unsupported{MeshShading} naming each one it lacks (plan_entry's
missing_caps). mesh_stages is that same test, and folds_object_grids no longer repeats the two
draw features.

Why: one query decides whether a device runs mesh pipelines. Before this, an object function
asked only for taskShader and a mesh function only for meshShader, and neither for the two draw
features a mesh draw's pieces take (a direct draw's pieces through multiDrawIndirect, an
indirect draw's through drawIndirectCount), so a device with only part of the set compiled stages
the draws could not run.

SEMANTICS_VERSION 2365 (a placeholder; the number is set at landing): a refusal names more
missing features on a device without the extension (both stages' features for either stage),
and a device with part of the set now refuses where it compiled. No committed profile with the
extension lacks any of the four, so no such profile's cell moves. The six committed profiles
without the extension do move: each refusal of an object or mesh function now names every one of
the four features the profile lacks. That is 246 golden cells and the same 246 engine inventory
cells, 41 on each of intel-irisxe-anv, intel-irisxe-rplp-anv, intel-uhd770-rpls-anv,
moltenvk-m3, nvidia-pascal-linux and runtime-floor, over the 14 engine fixtures that hold object
or mesh functions. They wait for the bless at the next named pin.

Tests: the red test of the parent passes, and the refusal test of profiles without the
extension expects the extension and each of the four the profile lacks. docs/API.md's mesh
pipelines section and compile_mesh_pipeline's doc state the set; runtime-sources.sha256 is
re-pinned.

Verified: m3-max-85179 at this commit's first build (tree equal to this one but for the base):
the parent's red test failed and passes here; clippy (plain) 0; the golden and inventory lists
against the base moved exactly the 246 cells above, each to the new refusal.
2026-12-03 17:05:37 -08:00
Anees Iqbal f514d6f283 Validation: a bicubic sample of a format with no bicubic treatment is the runtime's limit
Two public cases of engine/bcx_rules failed on lavapipe:
bicubic-8-bit-normalized-and-srgb-sums-near-the-rounding-tie (63d0f152) and
bicubic-rounding-of-random-float-and-srgb-texels (cbf5dd18). Each binds
RGBA8Unorm_sRGB textures at slots 4-6 and 13, which the kernel samples
through its bicubic constexpr sampler. Until 94adea1c61 (with 0a3a4fe911,
SEMANTICS 2365) the translator refused the whole kernel for its 1D bicubic
samples (slots 12-15), so the cases read as the product's refusal. That
commit built the 1D sample, as meant; the kernel now compiles, and the
runtime refuses its dispatch at slot 4 as Gap::BicubicTexels, an old known
gap its README states (bicubic_texels_word is None for 8-bit sRGB codes).
The executor counted that Gap as a failure, since the case's structure
did not classify it as refused. The refusal moved from the translator to
the runtime; this makes the classification say so.

ToolingRequirement::BicubicTexels ("bicubic_texels"): Limit::Runtime, it
stops the engine's candidate and keeps its cases Metal-qualified. The
checker raises it in checked_requirements
(executor_contract::bicubic_texels) when the case binds, at a texture
slot its function samples through a bicubic constexpr sampler, a texture
whose format gets None from the public
metal2vulkan::metal::format::bicubic_texels_word, so the rule is the
runtime's own. "Samples through a bicubic sampler" is read from the AIR:
an air.sample_* call (with gradients or not, no comparison) of a 1D or
2D colour texture, as the product decodes it, whose sampler operand is a
constexpr sampler (!air.sampler_states) with a bicubic min or mag filter,
as the translator decides it, and whose texture operand is an entry
texture argument, followed through the arguments of direct calls. A
runtime sampler is never bicubic and the translator refuses an argument
buffer's texture, so neither is claimed; a texture reached another way
(a texture array's element, a loaded pointer) is no claim. No census row
carries it: it needs the bound format, a case literal.

The device test that holds the refusal both ways on lavapipe already
exists: metal2vulkan-runtime's
tests::bicubic::every_device_pushes_each_bicubic_slots_format_treatment
(six formats' words pushed, the RGBA8Unorm_sRGB texture refused), with
the conformance ledger's bicubic-texel-classes rgba8unorm-srgb/dispatch
refusal. The requirement's doc names both.

samplers.rs gives each constexpr sampler's state by its global's name
(constexpr_sampler_states); min_lod_clamp.rs's call parsing is shared
(direct_call, operand_list); neither changes what classification
computes. The new module is listed beside depth_range.rs as the
checker's rule over case literals, not classification.

AUTHORED_COMPILE_CENSUS_VERSION 11: the two cases' cells move from
compiled to not_supported{tooling_requirement:bicubic_texels}, which a
cached cell would hide; the census is due a bless on development.
ENGINE_EXECUTOR_ABI is not bumped: no recorded candidate row holds
these cases (corpus/observations holds only their Metal rows).
SEMANTICS_VERSION is untouched: no translation changes.

Tests: requirement.rs's
a_bicubic_sample_of_a_format_with_no_treatment_stops_only_the_candidate
and the Runtime list; bicubic_texels.rs's own: every bcx_rules slot is
found; an RGBA8Unorm_sRGB texture at a 2D or 1D slot (or a texture
array's element there) raises it and RGBA8Unorm does not; a linear
sampler or a gather raises nothing; operands followed through direct
calls; and checked_requirements keeps the case for Metal and stops the
candidate.

Verified at this tree (f8eb488b95's), on lavapipe:
- job m3-max-86229: both cases read not_supported{tooling_requirement:
  bicubic_texels} (refusal=1 failure=0 each), and the public batch
  (ci-lavapipe, device type cpu, validation layer 1.4.363.0) reads
  cases=1189 match=815 mismatch=15 noted_difference=164 refusal=195
  failure=0 held_open=15 new_mismatch=0;
- job m3-max-86238, the same batch at db7bedc60d (the base): match=815
  mismatch=15 noted_difference=164 refusal=193 failure=2, the two
  failures these cases (exit=1, the runtime's BicubicTexels). The change
  moves exactly them from failure to refusal;
- job m3-max-86228: fmt, clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd),
  Rustdoc -D warnings, and the validation suite, 1349 passed, 2 skipped.
2026-12-03 17:02:29 -08:00
Anees Iqbal f838b75e6c Docs: HOWTO and ARCHITECTURE name no device policy
The device policy went with the resident core's deletion (device/policy.rs):
Device::from_queries takes the description alone and derives the profile from its queries
(docs/API.md, section 1). Three sentences still named a policy: HOWTO's first step ("describe
the Vulkan device as created and choose a policy"), its isolation recipe ("the device
description and policy ... equal description and policy give the same profile fingerprint and
keys") and ARCHITECTURE's device profile ("from the description's Vulkan queries and the
policy"). Each now names the description alone.

Docs only. Neither file is an input of runtime-sources.sha256, and no test or script reads
either file's prose.

Verified: on the CPU with no device, at this commit, git grep -i -w policy over docs/HOWTO.md
and docs/ARCHITECTURE.md finds nothing; DeviceDescription derives serde's Serialize and
Deserialize under feature serde (device/description.rs), as the recipe says.
2026-12-03 16:58:33 -08:00
Anees Iqbal 8fb26059c7 Translator: the lowering's unnormalized-sampler and heap-flag paths nothing reaches are deleted
The second half of the cleanup after the resident core's deletion (0ce2f39b71): crate-private
lowering paths whose inputs nothing sets, and the docs that still describe deleted machinery.

Unnormalized constexpr samplers. No selection picks PixelPosition::Unnormalized or
UnnormalizedTexel (pixel_position answers Scaled, Texel, TexelBySpec or TexelByWord), so they go
with BindingKey::unnormalized, PixelPosition::unnormalized(), emit's two coordinate arms and two
offset matches, the sampler.pixel_unnormalized and sampler.pixel_unnormalized_gather census arms,
pixel_note's and centre_denormals' arms, finish()'s invariant for an unnormalized identity
sampling, and constexpr_desc's zero bias for a SamplerUse of unnormalized coordinates, which no
constexpr sampler's use is. The runtime's unnormalized twins of linear pixel samplers
(SamplerUse::unnormalized, vk_sampler's form, offset_texels) stay.

Heap handle flags. AccessPlan's heap_class_index, heap_red_blue and heap_unreadable had no setter;
only heap_alpha is set. They go with carries_class(), Lookup::Flagged's class, red_blue and
unreadable fields (Flagged is now the alpha-carrying form alone), the handle constants
FLAG_TEXEL_CLASS, FLAG_RED_BLUE, FLAG_STORAGE_UNREADABLE, HANDLE_TEXEL_CLASS, HANDLE_RED_BLUE and
HANDLE_STORAGE_UNREADABLE, the sampler.heap.texel_class census arm, heap_element_of's unreadable
branch (its one caller passed false), and identity_refusal's HeapResource refusal of a flagged
form other than the alpha's, which could not fire. The handle-table search, which only the
function-table directory calls, in its element and entry forms, keeps its generic carry of the
alpha flag: Lookup is shared with the identity handle's form, whose element mask the heap accesses
read.

Docs that named deleted items now say what the code does: the PixelSamplerScaling entry (a
constexpr pixel sampler's linear sample or gather records it on every device; the runtime slot's
nearest test is its word, SamplerWord::nearest_pixel, not a specialization), ViewBaseTexelOffset
(no heap_raw; a slot's footprint placed so is refused, IdentityCause::TextureState),
SimdgroupAccessOrder (no resident-table profile), constexpr.rs, memory::handles (heap handles are
the identity arrays' elements; the handle table is the function-table directory's search),
bind::heap, lower::texture (is_null, border texels, level views and the out-of-bounds alpha come
from the resource ID's word), heap_raw's mentions in the sampler modules, the resident-table
mentions in access::object, provenance::objects and validation's tier table, the OpenCL line
variant's docs (the runtime refuses such a binding, Gap::OpenClLineTexture), and PushField's
TextureLevels. SlotPlan::border_texels, never set, goes. Tests: engine_identity's expected lookup
is Lookup::Flagged; the search's host-model test runs the element, flagged and entry forms; the
census assertions of sampler.pixel_unnormalized, which no arm names now, go.

Consumer: in reims at 7d016acc9c, and at 8f3ca9df99, nothing names a crate-private item here
(lower and memory are pub(crate)), and the public-item search is the previous commit's.

Nothing compiled changes: no selection reached the deleted arms, no flag was set, and the census
words of every plan are the same, so SEMANTICS_VERSION and ARTIFACT_FORMAT_VERSION stay.
runtime-sources.sha256 moves without a RUNTIME_VERSION bump: memory/handles.rs loses constants
and fields nothing set, and metal/sampler.rs, metal/texel_format.rs, metal/format/mod.rs and
bind/heap.rs change in comments and a test. docs/REFUSALS.md regenerates unchanged; the
signature table is unchanged.

Verified, on the CPU with no device:
- m3-max-86179, at the series' tip (the two cleanup commits and the README line): fmt, the
  refusal surface's, the signatures', both coverage docs' and scripts/api-docs' checks, clippy
  (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd), Rustdoc, private docs (metal2vulkan and
  metal2vulkan-runtime) and doctests pass. The metal2vulkan suites ran 3,492 tests: 3,491 passed,
  24 skipped, and the failure is golden_hashes_match_the_table, which fails at the base too (a
  bless due at the next pin). Validation ran 1,343 tests, all passed, 2 skipped; conformance ran
  1,061, all passed.
- m3-max-86194 and m3-max-86213, at the tip and at its base db7bedc60d: the golden table's changed
  lines are the same 5,114 at both, line for line, so no cell moves.
2026-12-03 16:57:32 -08:00
Anees Iqbal 27a6c1ebd3 Translator and runtime: the interface items no path makes since the resident core went are deleted
0ce2f39b71 deleted the resident core: every device compiles the identity domains, which read a
texture's presence, out-of-bounds alpha, swizzle, border texels and level count, and a sampler's
state, from the resource ID's words. The interface items the resident core stated for them stayed,
with nothing left that makes them:

- SpecKey's Presence, OutOfBoundsAlpha, TextureSwizzle, OffsetBaseAxes, NearestPixelSampler and
  BorderTexels: no lowering declares them.
- RuntimeFact's ResourcePresence, OutOfBoundsAlpha, StorageTextureLevels, StorageTextureLevelViews,
  OpenClLineTexture and BorderTexels: no plan states them.
- PushField::ControlPointIndexOffset: no plan places it. identity_pushes (lower/select.rs) named
  it on its false side; that arm goes, and lower/push.rs's shape arm with it.
- PrecisionNote::F16IntConvDoubleRounding (metal2vulkan-degrade-f16-int-conv-double-rounding): no
  lowering records it. Its catalogue entry in docs/API.md goes, with the conformance crate's
  Degradation and the validation comparison's allowance and reach arms.
- Feature's LocalSize, TexelBuffer and GroupCount: no site constructs them (docs/REFUSALS.md listed
  each with no site). Their reach.tsv rows go.
- CombinedSampler's unnormalized field, with_unnormalized, heap_index and from_heap_index: the field
  was set only from lower::sampler's BindingKey::unnormalized, which no selection sets (none picks
  PixelPosition::Unnormalized or UnnormalizedTexel) and finish() refuses as an invariant, and the
  two index methods had no caller. sampler_use() now makes the use from the comparison and the
  texel class alone. The runtime's DrawInputCause::UnnormalizedSampler and its two checks (a
  constexpr sampler of a draw or dispatch with the field set) go with it.

The device sampler of unnormalized coordinates stays: SamplerUse::unnormalized, vk_sampler's
unnormalized form and SamplerDesc::unnormalized are what the runtime's linear pixel samplers'
twins are made with.

Tests: device/tests/mechanism.rs covers the 56 facts left; the assertions that a plan states none
of the deleted facts, and the spec values set for deleted keys, go; engine_spec_bits labels its
constant SamplerMinLevel; cache/tests.rs's round trip of OffsetBaseAxes goes; api_tests.rs's
SpecializationLayout round trip names SamplerMinLevel.

The consumer names none of them: in reims at 7d016acc9c, and at 8f3ca9df99, git grep finds 0 hits
each for unnormalized, Unnormalized, heap_index, F16IntConvDoubleRounding,
f16-int-conv-double-rounding, LocalSize, GroupCount, SpecKey::, RuntimeFact::, PushField::,
ControlPointIndexOffset, NearestPixelSampler, OffsetBaseAxes, ResourcePresence,
StorageTextureLevel, OpenClLineTexture, BorderTexels and OutOfBoundsAlpha. TexelBuffer's 2 hits
are maxTexelBufferElements and the runtime's TexelBufferTooLarge, DrawInputCause's 1 is
DrawInputCause::Slot, Feature::'s 10 are other variants and another crate's Feature, and
TextureSwizzle's 66 are Metal's MTLTextureSwizzle.

ARTIFACT_FORMAT_VERSION 612 -> 613 (renumbered at landing): the codec's lists are positional, and
SpecKey, PushField, RuntimeFact, PrecisionNote and CombinedSampler lose members. SEMANTICS_VERSION
stays: nothing that compiles changes. runtime-sources.sha256 moves without a RUNTIME_VERSION bump:
device/mechanism.rs loses the arms of the deleted facts, which no run reached. docs/REFUSALS.md and
the signature table are regenerated; the metal and conformance coverage docs regenerate unchanged.

Verified, on the CPU with no device:
- m3-max-86143, at this commit: clippy (plain, all targets and features) passes; the mechanism,
  spec-bits, round-trip and texture-level tests ran 64 tests, all passed, 2,571 skipped.
- m3-max-86179, at the series' tip (the two cleanup commits and the README line): fmt, the
  refusal surface's, the signatures', both coverage docs' and scripts/api-docs' checks, clippy
  (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd), Rustdoc, private docs (metal2vulkan and
  metal2vulkan-runtime) and doctests pass. The metal2vulkan suites ran 3,492 tests: 3,491 passed,
  24 skipped, and the failure is golden_hashes_match_the_table, which fails at the base too (a
  bless due at the next pin). Validation ran 1,343 tests, all passed, 2 skipped; conformance ran
  1,061, all passed.
- m3-max-86194 and m3-max-86213, at the tip and at its base db7bedc60d: the golden table's changed
  lines are the same 5,114 at both, line for line, so no cell moves.
2026-12-03 16:57:32 -08:00
Anees Iqbal 3e3deb25b9 Translator and runtime: BGR10_XR and BGRA10_XR render targets take Metal's writes, clears, masks and covered blends
The red commit's test, and the conformance cases that render into either format, which the runtime
refused (Gap::TextureFormat on a RenderTarget texture).

Attachments. A BGR10_XR or BGRA10_XR color attachment is its texture's UNORM image
(FormatEmulation::ExtendedRangeUnorm, now admitted as a color attachment and, blended, as a blended
one): A2R10G10B10_UNORM_PACK32, and R16G16B16A16_UNORM with red and blue exchanged. The formats'
second, raw candidate and ExtendedRange::of_attachment are gone; the runtime makes a RenderTarget
texture of either, and a device whose format query lacks the usages is refused the pipeline,
naming them (the runtime's floor does not require R16G16B16A16_UNORM as a color attachment).

Writes (lower::stage_io::extended_unorm_color). A fragment function writes Metal's code of its
output (rounded to half, nearest even, then encoded as a kernel write encodes it) as the field's
value over its maximum, a little above the code (metal::format::extended_unorm_field: 10-bit
(c + 0.0005) / 1023, 16-bit (64 c + 0.25) / 65535), which a device's conversion stores as that code
whether it rounds to nearest, toward zero, by floor(x 1024) or, as lavapipe does for a 10-bit
target, through 16 bits (round(x 65535) >> 6; an offset of 0.25 stored code + 1 for the 251 codes
from 772). BGR10_XR's two alpha bits are written as ones, as Metal writes them. Clears store
Metal's clear codes (metal::format::extended_unorm_clear, the runtime's clear values). Masks are
Metal's on the image's channels (BGRA10_XR's red and blue exchanged; BGR10_XR's alpha bits written
with any color channel). A resolve is the device's AVERAGE of the codes, which average as the
values do; PrecisionNote::DeviceRoundedResolve now names a BGRA10_XR field's low bits. A fetch of
either attachment is refused NotImplemented(Format) at compile, and at link where the function
does not write it.

Blends (pipeline::extended_blend). Metal's blend into these formats, measured on an Apple M3 Max
(macOS 27.0.1) over the xr-blend recordings: the source clamped to the values of codes 0 and 1022
(a NaN to code 0) and alpha to [0, 1], a destination color code to 1022, half arithmetic, the
result rounded to a code. That model is every recorded channel's but 9 of 172,032 (premultiplied
source-over, one code each, listed in the ledger rows). The function clamps its output as Metal's
blend does; a blend that stores its source (one and zero, added) stores the clamped codes exactly.
Any other blends the codes in Vulkan with a source factor of one, the function writing the term
X that makes Vulkan's blend of the codes Metal's blend of the values; destination factors that read
the source read it from a second output (dualSrcBlend, in the floor), BGR10_XR's alpha too, so its
alpha bits stay ones. A factor pair the module does not cover (a BGRA10_XR destination alpha among
them) is refused NotImplemented(Format).

Notes, static per pipeline: PrecisionNote::ExtendedRangeBlend on every blend that does not store its
source (the device rounds each draw's result to the field, a BGRA10_XR field keeping the fraction of
a code in its six low bits); PrecisionNote::ExtendedRangeBlendWindow where the corrected term or a
second-output factor can leave [0, 1], which Vulkan clamps (pipeline::extended_blend::window_holds,
from the factors and operations at the corners of the source's range; a unit test classifies every
factor pair and operation at both formats). Both are in docs/API.md's catalogue with counts, and the
runtime's README records the window as a known gap with its trigger.

Ledger: 18 llvmpipe rows of the B cases that differ (the xr-blend addition and premultiplied
source-over, xr-gamut, the blended xr-gradient and xr-masked over draws, and xr-gradient's
unblended resolve), each citing its note, with counts from a model of our blend whose count of
differing elements is lavapipe's replay's to within 11; and the same cases' rows on the RTX 3090
(NVIDIA 620.70.06, m3-max-85796; there xr-gradient-bgra10xr-unblended-x1 too, 39 fields a code
off by the device's arithmetic of the gradient), the RX 7900 XTX (m3-max-85797) and the Iris Xe
(m3-max-85798), each pointing at the case's llvmpipe row, with that device's counts.

Cache key: LoweringInputs::extended_unorm_colors is hashed into the function key where it is set
(pipeline::compile::key), so a fragment function compiled for a BGR10_XR or BGRA10_XR attachment
never takes another's translation; the key test asserts that the attachment and the format each
change the key.

SEMANTICS_VERSION 2378 and ARTIFACT_FORMAT_VERSION 612. RUNTIME_VERSION 2577 (XR render targets
are made); runtime-sources.sha256 re-pinned. api_signatures blessed and
api_surface extended (ExtendedUnormBlend, ExtendedUnormColor, extended_unorm_clear);
docs/REFUSALS.md regenerated (the fetch's refusal site).
2026-12-03 16:18:20 -08:00
Anees Iqbal e9290d8138 Runtime tests: BGR10_XR and BGRA10_XR render targets store Metal's codes (red)
An arm64 guest walk met render pipelines and passes into MTLPixelFormatBGR10_XR (554) and
MTLPixelFormatBGRA10_XR (552); the runtime refuses a texture of either with RenderTarget usage
(Gap::TextureFormat), so no pass draws into one.

every_device_renders_extended_range_targets_as_metal_stores_them, on every device of the cfg's
kind, for both formats in Shared and Private storage (a Private target read back by a blit into a
buffer): a pass clears an 8 by 8 target to Metal's specials and code boundaries and the words come
back as Metal's clear stores them; rt6_samples' half4 fill over 64 values across and past the
codes' range (a NaN, the infinities, the ends) draws unblended, then blended with Metal's default
factors, one and zero, and each texel holds Metal's store (unblended: the half's code; blended: the
source clamped to codes 0 to 1022, a NaN to code 0, alpha to [0, 1]); over a Shared BGR10_XR target
whose words' two top bits are zero, a draw under straight alpha-over leaves those bits ones, as
Metal's store writes them.

The ledger's refused rows of the conformance cases that render into either format, which this
change's fix makes run, go: xr-draw, xr-clears, xr-clear-routes, xr-masked, xr-blend, xr-gamut,
xr-gradient and xr-unwritten, BGR10_XR and BGRA10_XR without sRGB (168 rows); the sRGB twins' and
the two-plane forms' stay. Coverage regenerated.
2026-12-03 16:18:20 -08:00
Anees Iqbal 549ab0ac23 Runtime: a draw that reads the depth through a range past [0, 1] goes through a depth range twin
The partial fix draws through a viewport depth range past [0, 1] where
nothing reads the depth, and refuses every other draw (DrawKind::Viewport).
Metal draws those too (M3 Max, macOS 27.0.1, job m3-max-85617). It reads
[[position]].z = znear + z * (zfar - znear) unclamped. It stores that, and a
[[depth]] output, clamped to [0, 1], and tests the clamped value. Clip
space's 0 <= z <= w clips whatever the range. Vulkan takes no such range
without VK_EXT_depth_range_unrestricted, which the floor does not have.

The translator commits before this one build the fold:
LoweringInputs::depth_range_fold. Under it, the vertex function stores
znear * w + (zfar - znear) * z as its z, from PushField::DepthRangeFold. It
stores z and w - z as two clip distances after its own. Under
depthClampEnable with the viewport at [0, 1], that clips, reads, stores and
tests what Metal does. This commit draws through it.

- RenderCompiled keeps what its content was made for (arrays, words, srgb)
  and a OnceLock'd twin. depth_range_twin lowers the content's descriptor
  again for the same inputs under VariantKey::depth_range_fold
  (lowered_content, factored out of render_pipeline_state). It is made at
  the first draw that needs it, counted (Metrics::depth_range_twins), and
  timed as a make at encode. It is held as long as its content, and no map
  keeps it. The translator's refusal of it is kept, so a later draw answers
  it without lowering again. That refusal is the clip-distance limits.
- RenderPipelineState::folded gives the twin's state, its samplers numbered
  at the state's indices, cached in RenderInner. It refuses (Viewport) a
  vertex function the consumer compiled, and a twin that stores no fold.
- Fixed::fold (RuntimeFact::DepthRangeFold) makes every VkPipeline of the
  twin take depthClampEnable. draws() takes the fact, and the vertex push
  field as FieldValue::DepthRangeFold. fill_push writes the first
  viewport's [znear, zfar - znear] as f32 bits.
- The encoder's route (in place of draws_refused) is found when the
  pipeline state, the viewports or the depth clip mode are set. A draw
  reads one field, as before.
  - Under a past range that the pass's depth attachment or the fragment's
    [[position]] z or w reads, draws go through the twin.
  - The route refuses under the Clamp mode, and for a function that writes
    [[viewport_array_index]] while the viewports set have different ranges.
  - Only the viewports a draw reaches count: the first, or every one set
    for a function that selects.
  - bind_content composes the twin with the content for the draws' bindings
    (for_draws). The viewports are recorded at [0, 1] while folded.
- RenderCommandEncoder::DEPTH_RANGE_NOTE (DeviceArithmetic) is the static
  note of every draw through a twin. The docs/API.md catalogue says so.

Bounds: a twin holds at most 8 VkPipelines (Clip mode only), and 8 more for
its words twin, so a content holds at most 48 where it held 32, for its
life.

Docs: set_viewport, DrawKind::Viewport, Metrics::translations_at_encode,
and the runtime README's paragraph, Gap::Draw list and a known gap. The
known gap gives the first draw's stall, the twin's pipelines, the limit
refusal and the two refusals. REFUSALS.md and api_signatures.tsv are
regenerated. api_signatures also takes the translator rows of the commits
before (VariantKey and LoweringInputs depth_range_fold, PushField and
RuntimeFact DepthRangeFold). RUNTIME_VERSION 2576. The
runtime-sources pin does not move (pin-compute).

Verified: the READY gives the job lines (red at the commit before, green
here, on lavapipe and an RTX 3090; clippy in three configurations;
rustdoc).
2026-12-03 16:18:19 -08:00
Anees Iqbal f7c56cd4d2 Translator: a vertex function under the depth range fold folds the range into its position
Under LoweringInputs::depth_range_fold, a vertex (or post-tessellation
vertex) function that stores its position does three things at each
return:
- it stores the position's z as znear * w + (zfar - znear) * z, reading
  [znear, zfar - znear] from PushField::DepthRangeFold;
- it stores z and w - z, of the z it returned, as two clip distances
  after its own;
- it records PrecisionNote::DeviceArithmetic.

Drawn with the viewport's depths [0, 1] and depth clamping enabled, this
maps a viewport depth range past [0, 1] as Metal maps it (the M3 Max, jobs
m3-max-85541 and m3-max-85617): [[position]].z reads znear + z / w *
(zfar - znear) unclamped; the depth stored and tested is that, clamped to
[0, 1] by the clamp; and the clip distances keep Metal's 0 <= z <= w where
the clamp leaves z unclipped.

Planning:
- The function's own ClipDistance array is declared two longer, with its
  own elements stored as before.
- A function with none declares ClipDistance of 2 (shaderClipDistance).
- Under the fold the declared count must fit maxClipDistances and
  maxCombinedClipAndCullDistances, else Unsupported names
  Feature::ClipDistance and the limit.
- The usual path's check (maxClipDistances alone) is unchanged.
- A function that stores no position, and any other stage, compiles as
  without it.

docs/API.md's DeviceArithmetic entry says the fold records it on every
such compile and why. SEMANTICS_VERSION 2377 and ARTIFACT_FORMAT_VERSION
611 (a new push field and fact). runtime-sources.sha256
takes the translator's new sources, including the commit before's.

Verified: see the twin's READY job lines (the red tests at the commit
before fail, pass here).
2026-12-03 16:18:19 -08:00