Commit Graph
1841 Commits
Author SHA1 Message Date
Anees Iqbal 6833eba8e2 identity domains: a 2D bicubic sample reads its slot's format treatment from a pushed word
Under the identity domains (Device::from_queries, the new runtime's translator device) every
kernel that sampled a texture through a bicubic constexpr sampler was refused as
Unsupported{IdentityDomains} ("a bicubic filter"), because the filter's treatment of the bound
format (its inner taps, its clamp and its border texels) was a SpecKey::BicubicTexels
specialization the old binder sets from the bound texture. One compute pipeline of every macOS
guest boot met that refusal; the old runtime builds it.

The treatment is now one u32 field per bicubic slot, PushField::BicubicTexels(SlotRef), placed
and filled as TextureIntegerChannels is. The 2D routine already took the bits as a run-time value
(Bits::Value), so a sample reads the field instead of the constant; no per-format pipeline, no
new descriptor. metal::format::bicubic_texels_word(pf, swizzle) gives the word the binder
specializes the constant to (BICUBIC_TEXELS_UNBOUND for a slot bound to nothing), and None for a
format of no measured family or of 8-bit sRGB codes. rt fills the field from the bound texture
when the slot's texture changes, and refuses a dispatch whose bicubic slot holds a texture with no
word as Gap::BicubicTexels, naming the slot and the pixel format. The static precision note
BicubicFilterArithmetic stays.

Still refused under the identity domains, each the refusal it was: a bicubic sample of a 1D
texture or at pixel coordinates (and the in-place two-plane routine), an argument buffer's
texture, an array of samplers. The default domains (Device::new, the frozen old runtime's path)
are unchanged: they still specialize SpecKey::BicubicTexels and state RuntimeFact::BicubicTexels,
and the binders refuse the new field.

SEMANTICS_VERSION 2199 -> 2200, ARTIFACT_FORMAT_VERSION 554 -> 555 (a new push field tag).
docs/REFUSALS.md regenerated; api_signatures table blessed; docs/API.md and the rt README's known
gaps say what is lowered and what is refused.

Tests:
- engine_identity::a_bicubic_kernel_reads_each_slots_format_treatment_from_its_pushed_field
  (replaces the refusal test; fails without the change): bcu_formats on lavapipe and moltenvk-m3
  profiles under the default domains keeps its 10 facts and 10 spec keys and no push field; under
  the identity domains it compiles, passes L3, pushes the 10 slots' fields, declares no spec key
  and no fact, and keeps the precision note; bcu_forms (1D) and bcu_address (pixel) still compile
  on the default domains and are refused under the identity domains.
- rt tests::bicubic (device cfg): each format bound at every slot of bcu_formats pushes its word,
  its arm asserted per format (R32Float linear; RGBA8Unorm, RGBA16Unorm, R8Unorm the [0, 1] clamp;
  RGBA8Snorm the [-1, 1] clamp; RGBA16Float no clamp), an unbound slot the unbound word, and an
  RGBA8Unorm_sRGB texture at slot 3 is Gap::BicubicTexels naming slot 3 and the format.
2026-11-20 02:55:02 -08:00
Anees Iqbal b506518794 rt: prepare_dispatch's tests, README and surface; the player's read-ahead encoder a struct
Tests: the pre-pass grid against each call's own (a saturated dispatchThreadgroups axis, a
dispatchThreads grid of u32::MAX on a size that does not divide it, indirect), GPU-free; on a
device, prepare-then-dispatch of an observing kernel for each kind, each call making exactly one
pipeline (and the ragged grid its one lowering) and the dispatch then waiting for nothing; a
second call making nothing; what the dispatch records nothing for or refuses making nothing; the
emulated-SIMD-group variant prepared; a square-form grid eight deep prepared; and the same
counts recorded and submitted with the calls and without, on two devices.

README: the hook in the compute pipeline states section, and the translation bound the caller's
width multiplies. api_signatures blessed; REFUSALS.md regenerated (the refusal sites moved into
the shared helpers, no new refusal).

Verified: the check job that follows this commit.
2026-11-20 02:44:56 -08:00
Anees Iqbal e4de7cc44e rt: undo the per-slot refill and the changed-words push; a draw and a dispatch refill every slot again
What. Reverts the refill series (68740984ba, 5b164777bd, 71ef1ba14b and its tests b97d37c104,
c076e8d17b, cd134b0995) on development, keeping everything landed since. A render or compute bind
marks the encoder changed again, and the next draw or dispatch finds and fills every slot's facts
and fields and writes every spilled block into the ring, as at f44fb795ae. A draw or a dispatch
whose push bytes the command buffer already holds pushes nothing; any other pushes the whole
window. Rebound, the per-slot facts, Pushed's span and mark, Metrics::push_bytes and
tests/refill.rs go; the push and push-window tests of f44fb795ae come back. rtover's over check
stays as it landed: the texture setters keep their over count (Tables::set_texture, the compute
encoder's `copied`), and the draw keeps Overs' reached form. docs/REFUSALS.md re-derived: the
refusal sites move back from `refilled` and `find` to `dispatch`.

Why. The planner's bar for the series, as amended: instructions a draw and a bind at or below
f44fb795ae's for the refill's own share. If the bar fails, the bookkeeping is undone, and the
push of changed words stays only if it alone meets the bar. Neither does. Harness, own user
instructions, 780M (um870, one round, m3-max-57484; the exclusive rounds m3-max-57397 on gem10
and m3-max-57398 on the 3090 read the same):

  arm                                      a draw   a bind
  f44fb795ae (the bar)                        842      739
  92b9cbb232 (the series alone on it)         963      874
  7096fa7de3 (development)                    958      887
  3cc134e439 (the series' fix)                943      835
  24dd31af87 (this undo, on 3cc134e439)       836      751
  05cca3d165 (the undo + changed words)       887      770

The series alone adds 14.3% a draw and 18.3% a bind. Its fix still left 11.9% and 13.0%. The
push of changed words on its own adds 5.3% a draw: comparing the window word by word costs more
than the whole-window compare it replaces. The undo is 0.7% under the bar a draw and 1.6% over it
a bind; the commits besides the series account for the +12 a bind (rtover's over count in
set_texture; bind_2000 sets a fragment texture before every draw). At the fix, bind_2000 was
18.7% slower on the 780M and 15.6% slower on the 3090. The gain the form was ordered for did not
come: on the video stream (vaapi-780m, lavapipe, m3-max-57454 and m3-max-57460), fields filled a
bind fell from 1.42 to 1.22, but the bind redo (fill_push, Facts::find and the held block) rose
from 901 to 1,079 instructions a draw.

Verified: the table above (m3-max-57484: each arm one harness process on a fresh cache, release).
24dd31af87 is this commit's rt, translator and validation tree but for dfb00c74c6's import test.
cargo fmt; the refusal surface regenerated with scripts/refusal-surface/refusal_surface.py.
2026-11-20 01:13:26 -08:00
Anees Iqbal a48d634517 conformance: two ushort3 function constants read as half3, on Metal and on both runtimes
A case of our own MSL that reads its constants the way the consumer's two refused records do:
engine/fc_ushort3_half3 (our MSL, compiled by scripts/regen-air-fixtures on the M3) declares two
ushort3 function constants and reads each through as_type<half3>, which the compiler folds into
a <3 x half> load of the constant's <3 x i16> global (the regenerated .ll holds exactly that
load), so the translator holds both in the constant blob. Thread t stores, as floats, lane t % 3
of each, their half sum and t; the values (1.0, 2.5, -0.75 and 0.5, 4.0, 1.25) have exact sums.

The suite gains the call that makes such a pipeline: Side::compute_pipeline_with_constants
(newFunctionWithName:constantValues:error:, then newComputePipelineStateWithFunction:error:), on
the Metal side, the new runtime's side (FunctionDescriptor.constants), the old runtime's side and
the watching wrapper. The Metal side's constant setter pads each value's packed bytes with zeros,
so a setter that reads a vector type's aligned size reads zeros past the packed lanes.

Metal's recording (the M3, macOS 27.0.1 26A434, `conformance record` with three runs and the
validated leg, then `times --runs 8 --write`) stores the program's floats for every thread,
which metal_stores_the_programs_floats holds. The engine fixture inventory gains the fixture's two
rows, ok on every profile (blessed on the M3).

The case is named among those authored after the last whole-set cost --write, whose next
run pays its cost record, and docs/CONFORMANCE-COVERAGE.md is regenerated for it. The golden
table gains the fixture's cells on development, where the tables are blessed.

Verified: see the check job named in the landing.
2026-11-20 00:28:33 -08:00
Anees Iqbal a89e4c0838 identity domains: the constant blob is the module's own words; rt's two constant-data gates go
Under the identity domains a function binds no descriptor, so a function reading the constant
blob was refused ("a resource bound through a descriptor"): the 16-byte blob of two ushort3
function constants read as half3 (as_type, folded by LLVM into a <3 x half> load of the
<3 x i16> constant, which fails the typed-access test) refused a consumer's kernel on both
records.

There the blob is now a Private u32 array whose initializer is the blob's little-endian words,
zero-padded to 16 bytes as a bound blob's range is (memory::blob, BlobHome::Module). The blob's
existing word-composed leaf loads read it, every load checked against the array's length (no
robustness covers Private memory); use_blob counts no descriptor and the artifact carries no
blob, so no stage has a constant_blob. Off the identity domains nothing changes (BlobHome::Bound).
The module's blob counts in the plan's private bytes where an access reaches it at an offset only
the run knows, as a run-time-indexed Private constant does, and its declaration's words count in
the size estimate.

The bound is memory::blob::MODULE_BYTES = alloca::MAX_UNSHARED (64 KiB), the most the typed
objects of one function may declare: a typed constant up to that size is already a Private
variable with its initializer, so the module's blob gives the make no larger initializer than
one of those. Past it the identity refusal names the kind, "constant data of N bytes read through
memory", in place of the descriptor catch-all.

rt: nothing reaches its two gates on constant_blob now (rt always compiles under the identity
domains, and the linked stages' constant_blob is None), so interface()'s Gap::KernelInput for
it and RenderPipelineKind::ConstantData are deleted, with the README's two mentions and the
variant's row of the API signature table. docs/REFUSALS.md regenerates unchanged (the variant was
in no section); no crate-root item changed. SEMANTICS_VERSION 2199: identity modules and refusals
change; the encoding does not. The old runtime's render descriptor key, which hashes the version,
is pinned at its 2199 value.

Tests: engine_identity's blob_words kernel reads the records' half3-of-ushort3 load and 2-byte
units at run-time offsets, one past the words: under the identity domains no descriptor, no
artifact blob, private bytes +32, L3, and the CPU interpreter's answers (zero past the words);
the default domains bind the same 24-byte blob. blob_past (a 65,600-byte blob) is refused naming
its size where the default domains bind it.

Verified: see the check job named in the landing.
2026-11-20 00:28:33 -08:00
Anees Iqbal f631d9081d Re-derive the generated documents at the landing tip
They are generated from the whole case set, and the set grew on `development`
while this branch was in flight, so the copy committed here counted a smaller
one.

Verified: regenerating at this tip leaves no change beyond the `Generated at`
stamp.
2026-11-20 00:05:53 -08:00
Anees Iqbal f1c3a2557e translator: spilled fields read 16 bytes at a time, through a NonWritable block
Under the identity domains a function's fields past its push window live
in a parameter block at the pushed ArgumentTableAddress, and each was read
by a load of its own size (a slot's bounds: 8 bytes, aligned 8) through a
writable device place. The block is now read in 16-byte lines: each line a
spilled field touches is one uvec4 load, aligned 16, made once where it
dominates (EmitCx::block_line, so load_push_fields' reads at entry share
them), and each field is taken from its line (a word, a two-word shuffle,
a bitcast for an address, whole lines for a region). The place's member is
NonWritable: nothing writes the block while a command reads it, so a device
may read it as read-only memory; device_place_read_only notes that RADV
reads a uniform address of such memory with a scalar load.

The block's address is a multiple of 16 (rt's ring aligns every write to
16) and its size is (argument_table_size), so every line lies in it.
docs/API.md states that contract for a consumer.

Why: wide_bindings spills 23 of its 24 slots' bounds; it read them as 23
loads of 8 bytes, now 12 of 16. In one stream's kept lowerings
(gb-3090-r2) 2 of 424 modules spill: 14 spilled bounds become 7 lines,
2 become 1. SEMANTICS_VERSION 2197 -> 2198: module words change.

Test: engine_identity_spill's vertex function loads each 16-byte line of
its spilled fields once, in its first block, as a uvec4 aligned 16 through
a NonWritable block; its interpreter tests read the spilled bounds as
before.
2026-11-19 23:35:15 -08:00
Anees Iqbal bda9935e09 rt: VK_NV_linear_color_attachment where listed; a plane renders through its bit only as a LINEAR image, marked, in a pass of such planes alone
The RTX 3090 and the RTX 5080 Laptop GPU (NVIDIA 620.70.06) give every plane format's linear
tiling, and its DRM_FORMAT_MOD_LINEAR modifier where listed,
VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV in place of the colour attachment feature.
Query::plane asked the image format query alone, which offers the colour attachment usage there,
so rt rendered NVIDIA's in-place planes through that bit with the extension off.

- Floor: VK_NV_linear_color_attachment joins OPTIONAL_EXTENSIONS (enabled where listed), and its
  linearColorAttachment feature (LINEAR_ATTACHMENTS) is enabled where the device lists the
  extension and reports it, which Vulkan requires of a device that lists it. Vulkan 1.3 needs no
  other extension for it (its dependency is VK_KHR_get_physical_device_properties2 or 1.1). The
  translator is told of neither. Core::linear_attachments carries the enabled feature.
- The plane test (surface::held_usage): a usage is offered where the image format query offers it
  AND the plane's own tiling's format features (LINEAR's for an opaque handle, the
  DRM_FORMAT_MOD_LINEAR modifier's for a dma-buf, read through VkDrmFormatModifierPropertiesList2EXT)
  hold what the optimal image has for that usage (texture::kept_features, the test a texture over a
  buffer takes), and for rendering the colour attachment feature itself
  (VUID-VkImageViewCreateInfo-usage-08931). The NV bit stands for the colour attachment feature only
  where linearColorAttachment is enabled AND the image is VK_IMAGE_TILING_LINEAR: Vulkan sets it
  "for renderable color formats in the linearTilingFeatures" alone. So NVIDIA's opaque fd planes stay
  in place on the enabled path and its dma-buf planes take the copy form (SurfaceCopy::Tiling).
- The condition, held by rt: a plane accepted through the NV bit is marked at its make
  (surface::linear_alone, SurfaceImage and Image linear_attachment, Attachment::linear). A pass's
  begin (Pass::check, pass::linear_shape, one mark read an attachment) refuses with the new
  Gap::LinearPlanePass { kind: LinearPlanePassKind }: OtherColor, a colour attachment that is not a
  marked plane (the extension's rule: "as long as all the color attachments in the render pass
  instance have VK_IMAGE_TILING_LINEAR tiling"); DepthStencil, a depth or stencil attachment (not
  Vulkan's rule: an RTX 3090 lost the device on that shape, and rt recovers from no loss, so by the
  ladder's third rung it is not used; the words name the driver); Resolve, a multisample
  attachment resolving into a marked plane. Every colour attachment marked (both planes of a
  picture in one pass among them) with nothing else set renders.
- Unchanged: a texture over a Shared buffer keeps its plain-bit test and its counted copy; the old
  runtime is not touched.

The rt README: the surface test and the marking (Exported surfaces), NVIDIA's dma-buf planes as a
copy-form known gap, the refusal among the render encoders' known gaps, the extension row and a
Linear attachments feature table (Floor); the clear-reach slip "inside the Metal's render area"
fixed. docs/REFUSALS.md regenerated; api_signatures.tsv blessed: the new variant and enum,
floor::Features::linear_attachment, OPTIONAL_EXTENSIONS' value.

Tests: tests::floor (the extension and feature enabled where listed and reported, the README
table); tests::surface::verdicts (NVIDIA's linear word: held and marked only as LINEAR with the
feature, the copy form without it and under the modifier either way, the plain bit unmarked,
blend and filter held to the optimal image); tests::pass (linear_shape: one and two marked planes
render, the three shapes refused); tests::linear_planes on device (a draw into one plane and both
planes in one pass rendered and compared on every device; the three shapes refused where the
plane is marked and rendered, compared, where it is not).
2026-11-19 22:13:45 -08:00
Anees Iqbal 4c39fc5bcb docs: the compressed-texel-decode entry's ASTC bound follows the cost the old runtime announces
What: in docs/API.md's compressed-texel-decode catalogue entry, the sentence on the ASTC LDR bound
(up to 1/2048 off Metal's on ANV, Mesa 26.2.6, the Iris Xe of Raptor Lake-P, over the fourteen
footprints) moves from inside the Cost: words to its own sentence after them.

Why: c77d059c68 put it in the middle of the Cost: words. The old runtime announces
Degradation::CompressedTexelDecode with a fixed cost string, and its catalogue test
(tests::degradation_catalogue::a_runtime_kind_s_entry_states_the_cost_it_announces) holds that an
entry's Cost: text begins with those words. It failed at development b676eda182 (tip check
m3-max-56610, the product suite's one failure of 6200). The old runtime is frozen, so the doc
moves, not its string. The bound and the conformance constant that cites it are unchanged.

Verified: the doc diff alone; the test runs in the check job on development after landing.
2026-11-19 22:00:46 -08:00
Anees Iqbal b676eda182 rt: a colour render target takes an index, and a draw reads it as an attachment as it reads a shader-read one
Metal fetches any render target, and its header gives every texture a handle with no tie to
usage (MTLTexture.h: gpuResourceID, "Handle of the GPU resource suitable for storing in an
Argument Buffer"). rt took an index only for shader-read or shader-write usage, so a colour
target made for rendering alone had no second element and every fetch from it was
Gap::Draw(FetchedAttachment): guest 26's 4,792 refusals, all of that shape.

- The index rule: shaders reach a texture made for shader reads or writes, or a colour render
  target (render-target usage of a pixel format with no depth or stencil), which takes an index
  exactly where it does (Refusal::TextureIndex), at every maker: new_texture and the heap, buffer
  and Managed makers, views, drawables and surface planes. A depth or stencil target made for
  neither is unchanged.
- A colour render target not read takes what a shader-read one takes for attachment reads: the
  sampled usage, and the feedback usage where the image format query offers both beside its
  usage; the shadow on a device without the loop; neither where the query refuses them, and its
  draws that read it stay Gap::Draw. Its home stays the attachment layout, so a pass that does
  not read it records no move of it, and a fetching pass moves it home, feedback, home with the
  existing move code.
- Only its second element is written: its sampled-texture element stays the null one, so a slot
  that binds it reads nil as before. place_texture takes the view its second element names in
  place of a flag.
- A linear image in place over a buffer takes no sampled usage for a target shaders do not read.
- The in-tree consumers take the rule: the replay player's texture class, the harness's and the
  conformance suite's rt side. rt's own tests make their unindexed colour targets with
  new_texture_for_views, and give indices where a test needs new_texture's path.
- docs/RESOURCE-ID.md, the runtime README and Refusal::TextureIndex's doc say the rule; docs/REFUSALS.md is regenerated.

Also rides along, from the planner, in the README's known gaps of memory blocks: a block freed
before a submission used it waits on the block-maker thread for its bind, and a ring take that
needs a new ring block can wait behind it.

Verified: see the check job named in the landing.
2026-11-19 21:40:56 -08:00
Anees Iqbal 6e010b843f rt lock budget: a test that counts nothing says so, and the matrix shows its leg as not counted
A lock-budget test on a node that names no M2V_LOCK_EVENT returned early and passed, printing a
LOCKS-UNMEASURED line the matrix's filter dropped with the rest of a passing test's output. The
gem10 and um870 legs passed that way at 1ae9003019 while every leg that counted failed, and the
report could not tell them apart.

Each budget test now names its record (Locks::open takes its key) and prints, where it counts
nothing, 'LOCKS <test>: not counted, the node names no M2V_LOCK_EVENT' and
'M2V-MATRIX uncounted lock_budget/<key>'. The matrix keeps that line as it keeps a record
(KEEP matches 'M2V-MATRIX '), results.parse_suite collects it, leg_entry stores the leg's keys
(results.leg_uncounted), and the leg's verdict line ends in 'not counted: <keys>'. No node
setting changes.

Verified: scripts/matrix's unittest suite, 87 tests, OK locally, with the new
UncountedTests case (a passing test's line through matrix.KEEP, parse_job and verdict_line).
2026-11-19 21:12:49 -08:00
Anees Iqbal ff507ed9b5 rt: the border swizzle from the image where reported, and an opaque-black border's static note
Where a device lists VK_EXT_border_color_swizzle and reports borderColorSwizzleFromImage, device
creation enables the extension with both its features: borderColorSwizzle, which Vulkan requires
of every device that lists the extension, and borderColorSwizzleFromImage. Elsewhere neither is
enabled. Sampler creation is the same form on every device. No sampler chains
VkSamplerBorderColorComponentMappingCreateInfoEXT on any device: a sampler in the arrays meets
every view, and that structure names one mapping. So the struct is left off everywhere, and
VUID-VkSamplerBorderColorComponentMappingCreateInfoEXT-borderColorSwizzle-06437 cannot fire. With
the feature, an opaque-black border sampled through a view whose component mapping is not the
identity reads through that mapping, as Metal's border reads through the swizzle. Without it,
Vulkan leaves that texel undefined; the NVIDIA driver reads (0, 0, 0, 1).

A new static note, PrecisionNote::SwizzledOpaqueBlackBorder, records that difference, decided on
every device by the sampler alone:
- SamplerState::precision_note is Some for a descriptor whose address mode reads the border
  (ClampToZero or ClampToBorderColor) with an opaque-black colour (SamplerDescriptor::shape's
  opaque_black_border).
- A compute or render pipeline carries it among its precision_notes where a function samples
  through a constexpr sampler of such a border. That is decided by the constexpr sampler's own
  constants, through the device sampler the translator states for it
  (CombinedSampler::constexpr_sampler).
- The conformance rt side collects the sampler state's note with the others.

The rt README records the known gap and the feature table. docs/API.md has the catalogue entry.
The translator's cache appends the variant (ARTIFACT_FORMAT_VERSION 553 -> 554). Validation
derives no tolerance from the note (Allowance::Unbounded).

The old runtime's degradation.rs gains a notes entry, because Degradation::from_precision_note
matches every PrecisionNote. DeviceDepthBias did the same. The old runtime announces nothing new.

Census, GPU-free, over the 31 kept replay streams:
- 0 sampler states read an opaque-black border.
- 0 of 4609 constexpr samplers do, over the 12213 functions of their 322 distinct libraries.
  12 functions did not decode under the standard budget and are not counted.
2026-11-19 20:59:59 -08:00
Anees Iqbal 653014c278 conformance: the heap cases name their size allowance where the coverage document reads it
docs/CONFORMANCE-COVERAGE.md derives each case module's tolerances from the Allowance::new calls
in its own text, so the helper in texture_query.rs left the four heap modules reading 'every
field' while they loosen both numbers of every answer on the new runtime. Each module now names
the allowance itself (the same path, loosening and justification); texture_query keeps the entry's
slug, DEVICE_OWN_SIZES, with the rule in its doc. The document is regenerated: the four heap
modules, pass_sequence_actions and astc_textures each read one more tolerance, 26 in all.
2026-11-19 20:41:18 -08:00
Anees Iqbal 1f4cb5b986 conformance: the new runtime's heap texture sizes are held by their property, not by Metal's numbers
metal2vulkan-rt answers heapTextureSizeAndAlignWithDescriptor: with the device's own image
requirements, raised to bufferImageGranularity (its README's heaps), so on the Iris Xe 588 sites
of the heap families read divergent against Metal's numbers. They are not a bug and not ranked
against the old runtime: a consumer places by this device's answers.

So on the new runtime's run the cases stop comparing the two numbers with Metal's and the side
holds each answer to what a consumer places by, before answering it (rt_side/heap_sizes.rs):
1. the alignment is a power of two, for every query;
2. for a Private query, a heap of align + size bytes takes the texture at offset align;
3. there, level 0's first slice written from a buffer at Metal's layout of the level reads back
   unchanged.
A Shared, Managed or Memoryless query is held to step 1 alone: rt places heap textures in Private
blocks only, and placing the descriptor in a Private heap would answer another query. A
descriptor whose bytes rt does not move, which its copy answers Gap::TextureBytes (depth and
stencil both, multisample) or Gap::FloatDepthUpload (Depth32Float) for, is held to steps 1 and 2.
A failed step answers its failure, so the site still diverges (Err where Metal answered).

The cases (texture-pairs, heap-sizes, format-footprints, ycbcr-two-plane-format-descriptors)
name an rt-only allowance per query at case/<query>/size-and-align/Ok/*, Unchecked, justified by
a new docs/API.md section 10 entry, "The new runtime's heap texture size and alignment are the
device's own", worded as rt's README words it and naming the three steps. The old runtime's run
compares exactly, as before. A refusal still diverges: the allowance is under Ok.

Tests: every recorded heap answer (18 recordings, 2425 answers) has both numbers under that
allowance and its refusal site under none; every NewRuntimeAccepted slug a case names is a
section 10 entry (the existing check now covers rt-only slugs too).
2026-11-19 20:41:18 -08:00
Anees Iqbal c77d059c68 conformance: the ASTC cases hold the device's decode under compressed-texel-decode
On the new runtime a linear (_LDR) ASTC texture whose block the device holds is read through the
device's decode, the static note compressed-texel-decode (Texture::precision_note). The case
named only decoded-texel-precision for its linear forms' texels, the old runtime's emulated
decode, so on the Iris Xe its fourteen linear footprints' texels were unlisted rows, up to 0.00049
off Metal's value. The case now loosens each round's texels on the new runtime's run by the
catalogue's bound for that note, 1/2048 plus the float rounding of both values, justified by the
note alone (rt-only; the old runtime's run is unchanged). The catalogue entry states the ASTC
bound and where it was measured (ANV, Mesa 26.2.6, Iris Xe of Raptor Lake-P, fourteen
footprints): 0.00049 is under 1/2048 (0.000488...) only with the rounding allowance, so the
figure is stated with it. sRGB and HDR forms still compare exactly.
2026-11-19 20:41:18 -08:00
Anees Iqbal 0c451c569e conformance: the two new fetch-ordered cases take fetch-ordered-bgra8unorm's ledger rows
A fetch from a target made for shader writes and from one of unknown usage answers as the fetch
from a target made for shader reads, on both runtimes: the same three texel sites a code apart,
with the same counts on each card. Each ledger takes the read case's rows for its venues, reason
text unchanged (the device's conversion into an 8-bit unorm attachment it also fetches). The
coverage document counts the twelve rows the old runtime's ledger gains.

Verified: see the check job named in the landing.
2026-11-19 20:36:18 -08:00
Anees Iqbal 7839fa0876 conformance: the coverage document counts the two new fetch-ordered cases
Regenerated by the coverage tool at the cases' commit with their recordings: two more committed
recordings, fetch_ordered's six cases, and the case lists of the items they drive.

Verified: m3-max-56114 (msi) regenerated it, then conformance-host 1090 of 1090 passed, the
coverage document test among them; clippy of the conformance crate 0.
2026-11-19 20:36:18 -08:00
Anees Iqbal 5458ac7954 validation: a check or dump of a buffer with two copies names the copy it read
A two-copy stream's Managed buffer has a CPU copy, which Metal's contents answers, and a device
copy, which commands read. The player's check and dump read the CPU copy (Backend::read on the new
runtime), and nothing said so: on a discrete card, two plays' dumps of #106455 agreed as CPU copies
while the device copies the kernel read differed (count word 1848 against 12), and the verdict
'inputs equal' rested on them.

Now a check line of such a buffer ends '(CPU copy)' or '(device copy, read back)', a dump holds
cbC-objO.copy with those words, and compare-dumps compares only the same copy of both plays,
reporting 'copies differ' otherwise and counting the buffers compared as CPU copies and as device
copies in its summary. The new runtime's play reads the device copy with --read-device-copies yes:
through a blit into a Shared buffer of the play's own where the runtime keeps one, through the
buffer's mapping where the device's one copy is the GPU's and the player keeps the CPU's. On a
device that keeps a device copy, the report's 'managed digests' line after its device line says
which copy the play reads. Backend::read_copy names it; the old runtime's backend names none.

Tests: a_read_of_a_buffer_with_two_copies_says_which_copy_it_took (no device: both labels in the
check lines and dumps, the compare of like and unlike copies) and, on a device,
a_check_of_a_managed_buffer_names_the_copy_it_read (a blit's fill reaches the device copy: the CPU
copy reads zeros, the device copy read back reads 7s; the header line where the device keeps a
device copy). docs/REPLAY-STREAM.md section 10 says it.
2026-11-19 20:00:32 -08:00
Anees Iqbal 2c1ecbdd16 conformance: resolve-store-then-load, a resolving store's samples loaded by the next pass
pass_sequence_actions crosses a store with the next pass's load over a single-sampled attachment;
this case asks the crossing it leaves open: whether the samples
MTLStoreActionStoreAndMultisampleResolve keeps are the samples the next pass loads. Each cell
runs two passes over an 8 by 8 RGBA16Float attachment of four samples: pass A clears it and draws
into each 2 by 2 cell under a sample mask of the cell's index, then stores and resolves into
resolve A (or, in the control cell, only stores); pass B loads it, draws into cell 0 under a
mask of its own and stores and resolves into resolve B. A kernel reads every sample after pass
B, and blits read resolve A and resolve B. The sample mask, not the device's sample positions,
decides which samples a draw writes, and every value is exact in half. A side that resolved in
the pass and dropped the samples answers every resolve right and every later load wrong.

Recorded on the M3 Max, macOS 27.0.1 (26A434), by `conformance record` in job m3-max-55692,
eight runs alike, and timed there by `conformance times --runs 8 --write`. Named among the cases
after the last cost run. CONFORMANCE-COVERAGE.md regenerated (job m3-max-55697: the conformance
crate's clippy clean and its host suite 1090 of 1090).
2026-11-19 18:53:05 -08:00
Anees Iqbal f61fee8aac replay: the new runtime's play reports its commits' waits for the work lock
The executed counters take the runtime's commit_lock_wait_nanos, so a frame's line gives its
commits' waits for the work lock, summed; the backend's lines give commit_lock_wait_max_nanos,
the longest wait in the play, which is a maximum and no frame's counter. The runtime has no
product metric of the other calls' waits for the lock (the surface make's included): only the
device tests' per-thread total times those (crate::submit::waits).

Read with it (player built at this change's first form, 307b1998f9, job m3-max-55631; no
validation layer; the player commits from one thread, so these say only that the runtime's own
threads, submit, completion and block maker, hold no caller long):
- syncview-4k-780m, whole (1501 frames), Radeon 780M (RADV), job m3-max-55670: 0.609 ms of waits
  over 8066.2 ms of frames (0.008%), the mean frame's share 0.007%, the worst frame's 0.301%
  (0.022 of 7.436 ms), the longest wait 23.3 us, no frame's waits past 1 ms;
- glbench-3090-r2 to frame 300 (301 frames), lavapipe, job m3-max-55669: 3.680 ms over
  39383.2 ms (0.009%), the mean frame's share 0.007%, the worst frame's 0.431% (0.015 of
  3.370 ms), the longest wait 1.367 ms, in the one frame whose waits passed 1 ms (1786.6 ms long).

Verified: see the check job named in the landing.
2026-11-19 18:46:06 -08:00
Anees Iqbal 4f5289012a identity domains: a checked slot's limit once per access size, in the function's first block
A checked access (an access of a slot the identity domains check, at an offset the module does
not hold as a constant) emitted the normative check whole: m + before, len >= n, len - n, a
compare and an and, five instructions (25 words) per access. Two of them depend only on the
slot and the access size. The check is now at = m + before; at < limit, two instructions (10
words), under the slot's limit for n-byte accesses, psb::limit: len - min(len, n - 1), an
OpExtInst UMin and an OpISub (12 words; the length itself for 1-byte accesses), made once per
slot and size. EmitCx::slot_limit makes it in the function's first block where the bounds are
split there (load_push_fields), through FunctionBuilder::in_entry_block, which appends to the
entry block before its terminator, so every checked access of that size in the function
recalls it; elsewhere it is made in the open block. Both check sites (emit::prepare and the
pulled fetch's address_read) take it.

Exact: where len >= n the limit is len - n + 1, and at < len - n + 1 is at <= len - n; below
that the limit is 0, which no offset is under. len is at most 2^31, so nothing wraps.

Tests: psb::tests::an_offset_under_the_limit_is_one_the_normative_check_admits runs the form on
the interpreter harness (offsets around the buffer's ends and near 2^32, n 1, 2, 4, 16, both
widths, buffers of 0 to 64 bytes) against contain::in_bounds;
engine_identity_contain::a_checked_slots_limit_is_made_once_per_size_in_the_first_block reads
the contain kernel's module on every identity profile: two limits in the first block, three
compares under them.

Docs: docs/API.md section 5 and PushField::SlotBounds say how the check is computed.
SEMANTICS_VERSION 2197 (every checked module changes); ARTIFACT_FORMAT_VERSION 553 with it.
2026-11-19 18:18:25 -08:00
Anees Iqbal bd2f82ee48 docs: CONFORMANCE-COVERAGE.md regenerated for nan-to-integer-conversions
python3 scripts/conformance-coverage/coverage.py at ddf7a8ccd2 (job
m3-max-55493 on msi, which then ran the conformance crate's suite on
lavapipe against this document: 1087 tests run, 1087 passed; clippy
-D warnings and rustdoc -D warnings of the crate clean). One more case
module and recording, one more module that loosens a measured value (the
long-of-infinity elements).
2026-11-19 18:14:15 -08:00
Anees Iqbal 9203b13fe1 conformance: a long of an infinity holds Metal's 0 or the bound, under API.md's row
The planner's ruling: MSL 8.6 promises round toward zero and NaN to 0 and
nothing past the range, so the translator keeps saturating, the case keeps
every past-range row compared, and declares the long-of-infinity pair under
docs/API.md's row.

The row (the plain-fptosi line this lane added) now says what it covers: a
float past an integer's range converts to the nearest bound, Metal on the
M3 Max answering the same at every width but long, whose two infinities it
converts to 0 (job m3-max-55436), and the plain LLVM cast is the device's
own. Its lead-in moved, so its slug is new; nothing else names it.

The case loosens exactly those elements: at each of the four long-of-float
and four long-of-half sites, the bytes of input 14 (+inf) and 15 (-inf),
each to any of 0 and its bound (AnyOf), justified by that entry. A test
holds the two inputs to be the infinities and the entry to be in the
document.
2026-11-19 18:14:15 -08:00
Anees Iqbal eb16ce79c9 docs: a plain fptosi or fptoui of a NaN answers the device's conversion
The translator lowers LLVM's plain fptosi/fptoui to a bare OpConvertFToS or
OpConvertFToU, whose answer for a NaN or an out-of-range value SPIR-V
leaves undefined, while MSL 8.6 sends a NaN to 0. No accepted difference
said so.

Metal's compiler never emits the plain cast: probe job m3-max-55309 compiled
int(), uint(), static_cast and two-lane vector casts of float and half in a
kernel and in fragment functions, with fast math on and off, and every one
is an air.convert call (which the translator saturates). Over the indexed
corpus (29446 modules, job m3-max-55344) and the replay streams on every
node that holds them (jobs m3-max-55344, 55346, 55348, 55349, 55350, 55351)
no function holds a plain fptosi or fptoui; the same walk counting
air.convert float-to-integer calls finds 35606 in the corpus and 19840 in
the M3's streams (job m3-max-55356), so the scan reads real IR.

So the plain cast stays the device's conversion, stated in docs/API.md's
accepted differences under Conversions.
2026-11-19 18:14:14 -08:00
Anees Iqbal 90a02e250d identity domains: a checked access's domain is its buffer, not its bind window
Metal's domain for a buffer argument is the buffer: an access before the bind offset reads the
buffer's bytes there. The containment check measured the offset from the bind offset against
the bytes from there to the buffer's end, so a checked access before the bind offset read zero
and a store there did nothing, where Metal reads and writes the buffer.

- PushField::SlotRemaining (u32) becomes PushField::SlotBounds (uvec2): the buffer's bytes
  before the bind offset (the bind offset), then its length; a set*Bytes copy 0 and its length;
  nil 0 and 0. The check is psb::in_buffer: (len >= n) && (m + before <= len - n) in u32, m the
  offset from the bind offset read as signed. Before the buffer's start the sum wraps to at least
  2^31, past every length (no buffer is longer than 2 GiB). One add more per checked access and
  one more pushed u32 per checked slot.
- Offsets are signed on every identity form: the word-below form (psb::prepare_at, also the
  pulled fetch's) now sign-extends the offset instead of reading it from the slot's window start,
  as the direct form already did through its 2^31 bias.
- The new runtime's encoders push the bounds (encoder::bounds, Tables::bounds); the old runtime's
  binder writes them from the bound buffer and still refuses ZeroAddress.
- The old runtime's lowering is unchanged; SEMANTICS_VERSION 2195.

Tests: engine_identity_domain (new, interpreter): on both identity forms a run-time -4 at bind
offset 16 reads the word at 12 and at bind offset 0 reads zero, a constant -4 at bind offset 16
reads the word at 12, and the default domains read the word at 12 as docs/API.md says.
engine_identity_contain adds an access before the bind offset (inside the buffer: read and
written) and one before the buffer's start (outside). The identity tests push the bounds.

Docs: API.md sections 1 and 5 and the new runtime's README state the domain and the cost.
2026-11-19 17:24:00 -08:00
Anees Iqbal a010d17c6b translator: a fetch's element index first among the floor's fragment fields, from the vertex function's end
On the floor a fragment function's push fields started at the vertex function's push end rounded
up to 8. Where that end is a multiple of 4 and not of 8, the four bytes below the base went
unused, and a fetching fragment function placed its four-byte element index
(PushField::FetchedColor) after its eight-byte fields: a pair that fits the floor's 256 bytes
with those four bytes used was pushed past them. The fragment base is now the vertex function's
push end, and FetchedColor sorts after SlotBindOffset and before the slot addresses
(SlotGuestBase): a fragment function that pushes no parameter block's address places it in those
four bytes. Each field is still placed at the next offset aligned to it, so a fragment function
whose first field is eight bytes, the spilled block's address included, starts where it did, and
the vertex function's window still ends at 248. The fixed windows read no base: the old runtime's
modules are unchanged.

The docs that stated the rounding say the base is the vertex function's end: the push module,
VERTEX_FLOOR_END, LoweringInputs::push_base, docs/API.md section 5, rt's README, and the render
identity test's notes; the spill test reads the base unrounded (its vertex function ends at 248).
2026-11-19 17:22:28 -08:00
Anees Iqbal 7934b405d8 fetch (draft): surfaces read through the loop where their query offers it; loop reads counted; tests and docs
A surface plane whose texture is a shader-read render target takes the feedback
usage where the handle's image format query offers it with the export features
alike (Query::plane; a D3D11 import's query the same), and the in-place make
retries without it where the images with it do not hold the layout; a plane
without it reads through its shadow, the counted copy. The fetch and the texture
read choose the loop or the shadow by the image, not the device.
Metrics::attachment_loop_reads counts every draw that reads an attachment of its
own pass through the loop. Device tests (tests/fetch.rs): N fetching draws exact,
N-1 barriers or copies more than one; a surface plane of each fetched format.
RenderPipelineKind::FramebufferFetch removed. SEMANTICS_VERSION 2193,
ARTIFACT_FORMAT_VERSION 550 (PushField::FetchedColor). REFUSALS.md and
api_signatures regenerated; README and API.md.

Draft: the old render key re-pin follows the compile check.
2026-11-19 17:22:28 -08:00
Anees Iqbal 6eac85e79c rt: the resolve tables after the resolves metric and the resolve-format basis
m3-max-55101's REGEN and BLESS at 4153392249.

Verified: see the check job named in the landing.
2026-11-19 16:56:17 -08:00
Anees Iqbal 4dd8d707d1 rt: the resolve tables, the resolve-format basis the old runtime's records, and the resolve test's target usage
docs/REFUSALS.md and the API signature table regenerated for the resolve
items (m3-max-54897's REGEN and BLESS). Refusal::ResolveFormat's basis named a
device the cluster has no record of; it now cites what metal2vulkan-runtime's
RenderPassProblem::ResolveFormat records: Metal's validation assert for an
integer resolve target. The color resolve test's target took SHADER_READ,
which a texture made without an index refuses (lavapipe, m3-max-54897); a
resolve target needs RENDER_TARGET alone.

Verified: see the check job named in the landing.
2026-11-19 16:56:16 -08:00
Anees Iqbal adf59be4a7 rt: multisample resolves in the pass, by Vulkan's own resolve
A store action that resolves (MultisampleResolve, StoreAndMultisampleResolve, and
Unknown where the attachment names a resolve texture) resolves in the same rendering:
the attachment's VkRenderingAttachmentInfo names a view of the resolve texture's
resolveLevel and resolveSlice and a resolve mode, so the pass adds no pass, copy or
barrier of its own. Color resolves by AVERAGE, the mode Vulkan requires of a float,
normalized or sRGB format, under the new static note PrecisionNote::DeviceRoundedResolve
(RenderPassDescriptor::precision_note) on every device. Depth resolves by its
MultisampleDepthResolveFilter: Sample0 always, Min and Max where the device's
supportedDepthResolveModes has them; stencil by Sample0. Refused as Metal refuses them:
a resolving action with no resolve texture (Refusal::ResolveTexture) and an integer
format's resolve (Refusal::ResolveFormat). Gaps: RenderPassKind::Resolve (another
format, one sample, an emulated encoding, two depth-stencil views), ResolveFilter
(a mode the device lacks, DepthResolvedSample, an unpaired aspect) and LateStore (a
later store that does not resolve an attachment that began resolving).

The old runtime maps the new note to its device-rounded-resolve degradation; the
validation allowance, the conformance suite's rt side and the replay player carry the
resolve fields and filters.

Evidence, draw_full_4x: 64 full-screen draws in one pass into a 4-sample RGBA16Float
target, resolved as the pass ends (MultisampleResolve) into the 1-sample texture the row
checks texel by texel against the draw colour before its timed runs. Each arm records, a
run, 64 draws, 1 pass, 1 barrier and no copy: new's Metrics::resolves 1; old's 1 render
pass instance, 1 vkCmdBeginRenderPass, 64 draws, 1 barrier, no image copy or blit
(m3-max-55061). GPU p50 in us, old,new then new,old, one harness build each:
780M new 259.0/258.7 against old 1933.6/1827.4, new is 86% faster; RX 550 new
1643.5/1643.8 against old 7207.8/7209.3, new is 77% faster (harness at 1ff6574894,
m3-max-55050, 55061); RTX 3090 new 170.0/171.0 against old 188.7/190.0, new is 10%
faster; Iris Xe new 1006.4/1007.7 against old 1022.1/1019.8, new is 1.4% faster
(harness at 5af66e2c4e, m3-max-54928, 54938, 54939). Why old is slower on AMD is not
traced.

Verified: see the check job named in the landing.
2026-11-19 16:56:15 -08:00
Anees Iqbal bc45258bdf replay: a tiled texture of more than one level plays on the new runtime as the old runtime plays the call
The new runtime takes no form of the SPI newTiledTextureWithDescriptor:offset:bytesPerRow:, and the
player made an ordinary texture in its place whose texels were not the program's: on lavapipe the
two runtimes' plays of one stream first parted at the frame whose draws first read such a
texture. Those texels now come from the buffer, as the old runtime gives them.

What the old runtime does, read from its code:
- crates/metal2vulkan-runtime/src/buffer_texture.rs:534-591 (Buffer::new_tiled_texture) and
  shadow.rs:228-250 (the module's "Copies taken at use"): a texture of more than one level is one
  image of its own. The first command of an encoder that uses any of its levels after the making
  (or after did_modify_data, or a replace_region of the first level) takes the copy, before that
  command and inside its command buffer. The take copies every texel of the first level from the
  buffer at the offset, rows bytesPerRow apart, then makes each later level from the first as
  generate_mipmaps makes it. It reads no level past the first from the buffer.
- shadow.rs:386 (LevelsCopy) and :404 (LaterLevels): the later levels come from generate_mipmaps'
  plan for the format (the device's blit chain, the compute filter, or the integer picks). For a
  format that generate_mipmaps leaves as it is or refuses, they are kept.
- buffer_texture.rs:537-538: a texture of one level is the texture over the buffer that
  new_texture makes.

The stand-in, through the runtime's public API only:
- An ordinary texture of the descriptor.
- At the first use since its making, the take is owed to that use's command buffer. A use is an
  encoder's command or a render pass's attachment naming the texture or a view of it, skipped
  encoders included.
- The take runs as one blit encoder (copy_from_buffer into level 0, then generate_mipmaps) in a
  command buffer of the play's own. It is committed on that command buffer's queue, after its
  copies from the guest's RAM and just before it, so it reads the bytes as they are when that
  command buffer runs. A format the runtime refuses mipmaps of (MipmapFormat, MipmapFilter)
  keeps its later levels.
- Counted apart from the stream's work: tiled_textures, tiled_takes, tiled_take_bytes,
  tiled_mipmap_generations, tiled_levels_kept, and tiled_gpu_nanos (its GPU time, in no frame's
  gpu_busy, as the guest RAM's copies are). The report has a "tiled textures over a buffer" line.
- A tiled texture of one level plays as the public texture over the buffer.
- A replaceRegion of a tiled texture's first level is refused. On the old runtime it writes the
  bytes and owes another take; no stream played here has one.

Where it differs from the old runtime: the take runs ahead of the whole command buffer, not just
ahead of the using encoder, so what an earlier encoder of that command buffer writes into the
bytes or the texture lands after it.

The tiled kind leaves the substitutes: substituted_tiled_textures is gone. The "substitutes read"
line now counts gap substitutes alone.

Tested by:
- rt_replay::a_tiled_texture_takes_its_buffer_s_bytes_and_levels_at_first_use (lavapipe, both
  runtimes): a 128x2 two-level tiled texture whose 2x2 squares hold one colour each. Blits of both
  levels read the buffer's texels and the squares' colours, with equal digests on both runtimes
  and one take counted.
- The unit test of the substitute lines, now gaps alone.
2026-11-19 16:55:04 -08:00
Anees Iqbal c601423452 docs: a picture difference traced to a counted player substitute is the second accepted class
The planner's ruling on the replay matrix's rule (c): besides a first parting draw traced to a
function that carries a static precision note, one traced to a counted player substitute (an
ordinary texture the play makes in place of one the runtime cannot make, whose texels are not the
program's) is accepted with its size printed, and its row says where the replay substitutes what.

Docs only.
2026-11-19 16:55:04 -08:00
Anees Iqbal 5f6cdc6b56 replay: a picture difference is sized, and each frame's end carries the system's clock
A digest play that checks a present (--check-presents) now also keeps the shown texture's bytes
as presents/frame-F.bytes in its --out directory, with a `shown ID frame F format P width W
height H` line from the backend's shape of the texture (Backend::texture_shape, old and new
runtime). compare-plays, with no --frame, prints for each frame whose digests differ and whose
bytes both plays kept the texels that differ and their share, the largest difference of each
channel in the format's units (8-bit unorm, 10:10:10:2 and half-float layouts; bytes for
another), and the box the differing texels lie in. The bytes stay on the host that played them.

Each frame's end line gains unix_nanos, the system's clock at the frame's end, so a job wrapper's
own timestamped device samples can be set beside the presents.

REPLAY-STREAM.md gains both, and the planner's two rules: a picture difference at the judged
frame is accepted only when sized and its first parting draw is traced to a function with a
static precision note and no state difference; an NVIDIA time row bins presents by the covering
clock sample's state, at least 30 an arm, else "not comparable by time" with the counts.

Tests: replay::tests::a_kept_present_writes_the_shown_texture_s_bytes_and_each_end_its_time,
a_picture_difference_is_sized_by_texels_channels_and_box,
two_plays_kept_pictures_that_differ_are_sized.
2026-11-19 16:55:04 -08:00
Anees Iqbal 3fc316d576 identity domains: a render pipeline's functions spill past their shares of the floor's push range
Under the identity domains a vertex or fragment function whose push fields passed its share of
the floor's one 256-byte range was refused (Unsupported{IdentityDomains} needing
maxPushConstantsSize). Once containment added each checked slot's length (SlotRemaining) and the
zero range's address (ZeroAddress), pairs reached 272 bytes and were refused: 3 render states of
windrag-780m-b2 (223 draws) and 4 of syncview (259 draws), and the guest's GL-layer pipelines on
reims's walks. A render function now spills as a kernel does: it pushes its parameter block's
address first (PushField::ArgumentTableAddress) and reads every field past its window from the
block, each loaded once, in the function's first block (EmitCx::load_push_fields). The refusal and
its REFUSALS.md row are gone.

- Order: the check's fields are last in the derived Ord of PushField, after
  TessellationFactorAddress (ZeroAddress, then each SlotRemaining), so what every access reads is
  placed ahead of what only a checked access reads, and the check's fields are the first to move
  to the block. The codec's list is unchanged.
- The vertex function's floor window is [0, 248) (push::VERTEX_FLOOR_END). A vertex function is
  lowered without knowing its fragment function, and a fragment function that spills pushes its
  block's address (8 bytes, 8-aligned) from the vertex function's end, so the vertex function
  leaves that room. Cost: only a vertex function whose own fields pass 248 bytes spills where it
  used to fill the last 8.
- metal2vulkan-rt: Draws holds each field's place (the push range or its function's block) and
  each function's block (length, the push offset of its address). A draw that fills its pushed
  values anew writes each block into the parameter ring and its address into the range;
  ring_writes counts it. A block longer than a ring chunk stays Gap::RenderPipeline(DrawInput).
- SEMANTICS_VERSION 2194 (placement changed).

Tests: push.rs's edges (a vertex function ending at 248 with a spilling fragment function, whose
address goes at 248; a fragment base of 244, whose address is still at 248; a vertex function
whose fields would reach 252, which spills); engine_identity_spill: a vertex function of 25 slots
pushes its block's address first and every slot's address, spills only the check's fields, passes
L3, and loads each spilled field once in its first block; the pair with a fragment function from
248 compiles and validates on every identity profile; on the interpreter its sums are Metal's, and
lengths pushed one word short, in the window and in the block alike, read zero.

Docs: push.rs's module text, docs/API.md (section 1) and the rt README state the shares, the 248
and its reason, and the spill.
2026-11-19 15:59:29 -08:00
Anees Iqbal 5573e16f00 docs: the identity domains check run-time-offset slot accesses against the pushed length
docs/API.md: the policy's identity-domain text and section 5 state SlotRemaining and
ZeroAddress, the normative check in u32, what an outside load, store and atomic do, that an
offset before the bind offset is outside, and what stays unchecked (constant offsets, pointers
loaded from memory or made from integers). The rt README's known gaps say the same for buffer
arguments, the nil buffer's length 0, and the pulled fetches.
2026-11-19 15:38:33 -08:00
Anees Iqbal c46b159238 replay: the new runtime's play reads a Private texture through a copy
A check of a Private texture (a stream's m2v.check, or the shown texture of a present that
--check-presents lists) read it with getBytes, which the runtime refuses for a Private texture as
Metal does, so a digest play on the new runtime stopped at the first listed present whose texture
is Private ("the CPU reaches no Private or Memoryless texture"; syncview plays on Iris and the
3090 stopped at frame 296). The old runtime's play reads every texture through a blit. The new
runtime's now copies a Private texture's first level into a Shared block on its read queue, as it
reads a Private buffer, and waits for it; a texture the CPU reaches keeps getBytes.

Test: rt_replay::a_private_shown_texture_is_checked_through_a_copy clears a Private 4x4 RGBA8
texture to red, shows it at present 0 and lists that present; the check's sha256 is the 16 red
texels'.
2026-11-19 15:37:23 -08:00
Anees Iqbal 6812e2991c rt: no device enables VK_EXT_zero_initialize_device_memory; the runtime writes every zero
Under RADV (Mesa 26.2.6) an RX 7900 XTX's memory allocated with
VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT read earlier processes' bytes, so the
form's zeros are not the zeros Metal's newBufferWithLength:options: and a new texture
owe. Metal says a new buffer is zeroed; the runtime now writes those zeros itself on
every device, with no per-device exception and no start check.

The extension leaves the optional list; its feature, the allocation flag and the
zero-initialized image layout go, with Capabilities::zero_initialize_memory,
Features::zero_initialize and ZeroInitializeDeviceMemoryFeatures. BlockInfo::zeroed
and the zeroed-take and zeroed-texture metrics lose their source and go. A placed
texture is cleared in its upload on every device (texture_clears); the harness zeroes
every buffer through new_buffer's zero_from; the player's judged zeroed-texture
metrics are the clears alone. The rt README records why the extension is unused.

Verified: see the check job named in the landing.
2026-11-19 15:29:30 -08:00
Anees Iqbal 4b7ff7e9bf conformance: Metal's recordings of the four NVIDIA-route surface cases
Recorded on the M3 Max, macOS 27.0.1 (26A434), by `conformance record` in job m3-max-54229, three
runs each. Metal's side makes the same surface for these cases as for the VA-API ones, and each
recording's outcomes equal its VA-API twin's. CONFORMANCE-COVERAGE.md regenerated.
2026-11-19 15:27:03 -08:00
Anees Iqbal 42fd38d03a replay: the player's video surface waits for its ready point once it is made
The surface make now submits and waits for nothing (9c4eca8313): each in-place plane image leaves
the undefined layout in the runtime's next submission, a move that may discard the memory's bytes,
and the consumer calls Surface::wait_until_ready before the other API's first write. The player's
rt arm made video surfaces without that wait, so its plays of a video recording did not do what the
product does between a surface's make and its first picture. It now waits once at the make (the
earliest the player knows the surface's format and size), before any m2v.externalWriteDone
acquires it, and the report's executed counters carry the runtime's surface_waits.
docs/REPLAY-STREAM.md section 10 says so.

Test: runtime_lane::rt_replay::a_video_surface_is_waited_for_at_its_ready_point_once (Unix: one
surface for two plane textures, two acquires, surface_waits equal to the surfaces made in place).
2026-11-19 14:30:47 -08:00
Anees Iqbal c9b5997ef9 conformance: texture-view-casts-2d-array-as-cube recorded and timed on the M3
Recorded and timed on the M3 in job m3-max-54332 at 0cd13ee9f9 (record, then times --runs 8
--write, both legs, 8 rounds; Metal's validation ran the case). The coverage document is
regenerated.
2026-11-19 14:21:21 -08:00
Anees Iqbal c6d78ec93f replay: --check-presents checks the texture a listed frame's present shows
A timing verdict between two plays (compare-plays) needs equal digests at the judged frame, and a
stream without m2v.check records (the desktop-and-video recording has none) gave no frame a
verdict. command-replay play --check-presents F,... now checks, at the m2v.present of each listed
frame, the texture the present shows, as an m2v.check of it with no recorded checksum would: a
check line of that frame, which compare-plays reads as the frame's digest. A present of nil
checks nothing. The readback is the player's own work (uncounted) and its time is the frame's
read, so the digests come from a play apart from the timed ones; docs/REPLAY-STREAM.md says so
in the player's section and in the verdict rule.

Test: replay::tests::a_listed_present_checks_the_shown_texture (no checks unlisted; checks at
frames 1 and 3 of the listed 1, 2, 3, frame 2's present being nil; the line's digest is the
backend's bytes; every present still ends its frame).
2026-11-19 14:20:06 -08:00
Anees Iqbal 798dfcda6a replay docs: the video surfaces' form and --video-handle
docs/REPLAY-STREAM.md section 10 now says how the new runtime's backend plays a buffer made as a
video surface's pages (one surface through Device::new_exported_surface, its plane textures' views,
the acquire at m2v.externalWriteDone, no shapes or refills), what --video-handle picks (dma-buf with
the VA-API layout, opaque-fd with NVIDIA's), what the video-surfaces report line and the video_*
counters count, and how the old runtime's backend plays the same buffer; section 4's table says the
same for the two records. Docs only.
2026-11-19 14:20:06 -08:00
Anees Iqbal 2b8b894101 docs/API.md: the translator's own Workgroup words, the binder's index-rewrite kernels among them
The list named the binder's scan and merge kernels; its index-rewrite
kernels hold Workgroup words too, each written before it is read.
2026-11-19 13:52:36 -08:00
Anees Iqbal d4241114cc conformance: compute-threadgroup-memory-reads-zero recorded on the M3
Metal on the M3 Max (macOS 27.0.1, job m3-max-53825, three runs, one
outcome) answers metal2vulkan_devtools::threadgroup_start::answer in each
of the six dispatches: no word of the declared array or of the
[[threadgroup(0)]] region read nonzero before the program wrote it, in
the later threadgroups of 2048 of 16 KiB and in the second dispatch;
every pattern read back (0xffa00000); its SIMD groups of 32 in thread
order. docs/API.md states that answer, the engine fixtures' README lists
tgz_reads, and CONFORMANCE-COVERAGE.md is regenerated.
2026-11-19 13:52:36 -08:00
Anees Iqbal a69cb43486 translator: threadgroup memory reads zero until the program writes it, on Device::from_queries
On the new runtime's profile every Workgroup variable that holds a
function's threadgroup memory has a null initializer: the threadgroup
arena (declared threadgroup variables, [[threadgroup(n)]] regions and the
imageblock, memory::arena) and the typed threadgroup objects
(lower::access::local). One form on every device: the Vulkan 1.3 floor
requires shaderZeroInitializeWorkgroupMemory; a profile without it
refuses such a function, Unsupported{ZeroedThreadgroupMemory}.
Device::new's profile is unchanged (ProfileFacts::ROWS keeps
ThreadgroupStart::Unwritten), so the old runtime's SPIR-V is too.

The translator's own Workgroup words get none, as it writes each before
any read: the emulated SIMD-group scratch and vote word, the object
stage's mesh grid, the mesh wrapper's count and staged indices, the
emulated payload and the binder's scan and merge kernels.

The builder refused a null of an array whose length is a specialization
operation (spirv/ir/constant.rs, ConstRule::NullType); an arena with
regions, and the emulated scratch, have such lengths. spirv-val's
IsTypeNullable reads an array's element type alone, so the builder now
takes it. That refusal is what made rt report a probe's emulated variant
as missing (Gap::PartialSimdgroups after Later::lower's Refused).

The profile verifier also refuses a Workgroup initializer other than a
null (VUID-StandaloneSpirv-OpVariable-04734).

docs/API.md states the form with Metal's words on threadgroup memory;
SEMANTICS_VERSION 2192; REFUSALS.md and api_signatures regenerated.

Tests: engine_zeroed_threadgroup (null initializers through from_queries
on four profiles, zeros on the interpreter in both orders and two
threadgroups, the emulated variant's arena zeroed and scratch not,
Device::new uninitialized, the vk12 floor refused),
a_specialization_sized_array_has_a_null, a_workgroup_initializer_is_only_a_null,
the profile facts' fingerprint.
2026-11-19 13:52:35 -08:00
Anees Iqbal d65374348e rt: a Managed buffer's copy-in is a GPU copy from the consumer's block, and the capture ring goes
Metal's contract for a Managed buffer (MTLBuffer.h, didModifyRange:): a CPU write makes the range
undefined for the GPU until a didModifyRange: and a commit of the command buffer that reads it,
and it does not reach a command buffer committed before. The capture ring met that by copying
the bytes on the committing thread into 64 MiB of Shared staging, and the commit then waited for
the GPU whenever the ring was full. One recording on an RTX 3090 waited 258 times for 6.7 s
(m3-max-53409). The ring also kept a Managed buffer over an imported dma-buf, a block the runtime
does not map, refused (Refusal::ManagedBlockNotShared). On the XTX that refusal bound nil 2,804
times, and 28.8 million draws were then refused.

The planner ruled one form. The commit records the copy-in into a command buffer of its own:
vkCmdCopyBuffer of each named range from the consumer's block into the device copy, ahead of the
command buffer's commands in its submission, after the copies back owed to textures over the
ranges and before the copies into them. Vulkan's host write ordering guarantee makes the
consumer's writes made before the submission visible to the copies. The copy reads the bytes as
it runs, so a write after the commit may reach it, which Metal leaves undefined. The copy-in
holds each consumer's block and device copy until the command buffer retires.

What goes with the ring:
- capture.rs keeps the named ranges and the copy-in, and loses the ring, Chunk, Overflowed and
  the staging blocks of its own;
- submit.rs loses the commits' turn (capture now records under the work lock), the streams of
  ring-fulls, the waits and the ring's spans;
- the counters lose capture_waits, capture_streams, capture_overflows, capture_overflow_bytes,
  capture_copy_nanos, capture_wait_nanos, Gauges::capture_bytes and the capture ring's site, and
  managed_bytes_captured counts the bytes the copies take;
- the player's report and the API table lose the same fields.

A Managed buffer's bytes may be in any Shared block, mapped or not: contents is None over an
import. A Private block is refused as Refusal::ManagedBlockPrivate, since a Managed buffer has a
CPU-side copy ("the data pointer of this buffer's shared copy", MTLBuffer.h) and a Private block
has no pages the consumer can write. docs/REFUSALS.md is regenerated. The rt README's memory
contract says when the copy runs, and its known gap of the ring's waits goes.

Tests:
- the snapshot tests now hold the header's contract: write, didModifyRange:, commit, and that
  command buffer reads the bytes, here also behind an event wait with the consumer's handles
  gone before it runs. Nothing is asserted of a write under a pending command buffer;
- the ring's tests go;
- a range of three 16 MiB units arrives whole at one commit, with no staging and no allocation;
- a Managed buffer over an imported, unmapped dma-buf (Shared, contents None) reads what the
  consumer wrote through its own mapping, on a two-copy card and on a unified one;
- a Managed buffer over a Private block is refused;
- the first named range allocates nothing at any site;
- the commit's lock-wait test marks the start of its count with a test-only flag, where it read
  the turn.

Verified: see the check job named in the landing.
2026-11-19 13:47:06 -08:00
Anees Iqbal 347a33736a replay rt: the report counts patch draws through a pipeline record without tessellation
A render pipeline record without the tessellation key comes from a recorder
that did not carry it (glbench-3090-r2, glbench-3090-r3 and glbench-780m-r1
hold 19 post-tessellation records, none with the key; the newer recorders
write the key on every record, the defaults included), so the program's
tessellation state there is unknown and the player draws with Metal's
defaults in its place. The new runtime's backend marks each such state at its
making, carries the mark to the encoder at setRenderPipelineState:, and counts
the patch draws it plays through one: patch_draws_unrecorded_tessellation in
each frame line and the total, and a report line saying the state is unknown.
A released state drops its mark. REPLAY-STREAM.md says a record without the
key does not hold the program's state.

Test: a_record_without_the_tessellation_key_is_unrecorded (the key check and
the line). Checked by a potluck check job on msi (clippy in three
configurations and the touched tests).
2026-11-19 13:37:53 -08:00
Anees Iqbal a1508fdd14 replay: each frame's end line names its longest command buffer and its GPU time
A frame's `end` line gave only `gpu_busy`, the union of the GPU intervals of the command buffers
the frame waited for, so no report could say how long one submission ran: a frame of 1871 commits
with 12.7 s of GPU time could be one long command buffer or many short ones.

The player now keeps, beside the union, the longest single interval among those it already reads
(`Backend::gpu_interval`, the runtime's completion record) and that command buffer's stream id,
and the line prints them as `gpu_longest=N gpu_longest_cb=ID` after `gpu_busy`: the first of equal
ones, 0 and 0 where the runtime gives none. No query, wait or submission is added.

docs/REPLAY-STREAM.md section 10 states the two fields.

Tests: a new fake-backend test, replay::tests::a_frame_end_names_its_longest_command_buffer, and
the end-line assertion of a_frame_end_counts_overlapping_gpu_intervals_once, which takes the new
fields.
2026-11-19 13:37:53 -08:00
Anees Iqbal 56958391f8 replay rt: the report counts translator refusals and substitutes by kind
The rt backend's report lumped every translator refusal of a pipeline state under one
`Translation` key, so a play's `skipped render states` and `skipped compute states` lines named
only the first refusal's WHY, and counted gap substitutes with no kind at all. A census that joins
a play's refusals against open refusal sites needs each one's kind.

- `skipped render states` and `skipped compute states` key a translator refusal as
  `Translation(KIND)`: `Unsupported(FEATURE)` with the refused feature as Rust prints it for
  debugging, `LimitExceeded(LIMIT)`, `Internal(KIND)`, or the error's variant alone. Never a symbol
  or a location, which name the program's functions.
- A new `substituted textures KIND N, the first #ID` line per kind of substitute: `Tiled`, or the
  runtime's gap as Rust prints it (`TextureView { kind: TextureType }`). The counters
  `substituted_tiled_textures` and `substituted_gap_textures` stay as they were.
- docs/REPLAY-STREAM.md section 10 states both.

Tests: two device-free tests in replay::new_runtime::tests. The refusal test fails on the old
single `Translation` key; the substitute test does not build without the per-kind count.
2026-11-19 13:37:53 -08:00
Anees Iqbal 7834c2afe6 rt: import a picture's Direct3D 11 textures as a surface, in place, with no make-time submission
Device::import_d3d11_surface was a typed refusal (Gap::D3d11Surface). It now imports each plane's
NT handle (VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT) into a dedicated allocation bound to
an optimal image of the Direct3D 11 texture's own format, mutable and listing the descriptor's
format where the two differ (two formats a plane: R16Uint under RG8Unorm), into the first
device-local type the handle's properties and the image's requirements share. Usage is each of
sampled, rendered, copied and storage the import query offers and the view format's features
hold. Each import counts in Gauges::surface_imports, now on every host.

No submission and no wait at the make: Vulkan 1.4 section 12.5.2 says such images "can be
assumed to be in that layout when they are accessed in Vulkan after external access", and its
table gives the D3D11 texture handle VK_IMAGE_LAYOUT_GENERAL. The plane textures start homed in
the general layout; external_writes_done acquires from VK_QUEUE_FAMILY_EXTERNAL in GENERAL
(VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-12332) and release_surface_to_external releases to
it in GENERAL (dstQueueFamilyIndex-12331). No keyed mutex. The consumer's precondition (Direct3D
11 wrote the plane before rt's first use, and external_writes_done follows that work) is stated
in the call's doc and the rt README.

Surface gains an imported kind: Surface::handle is Option<ExportHandle> (None for the import),
and Surface::buffer is Gap::D3d11SurfaceBuffer, its planes lying in memories of their own.
ImportHandle::D3d11Texture names the handle in Limit::NoImport and Limit::ImportType.
Refusal::SurfacePlanes covers no plane or more than four. REFUSALS.md and the signature table
are regenerated.

The tests: on every device, the import's typed refusals (no plane, five planes, a one-byte image
format under a two-byte view). Under m2v_gpu on Windows, two shared Direct3D 11 textures (R8_UNORM
64x32, R16_UINT 32x16 viewed as RG8Unorm) on the DXGI adapter of the device's LUID, bound by hand
from the SDK headers' vtables: the import submits nothing; Direct3D 11 writes picture 1 and rt
reads it exactly; Direct3D 11 writes picture 2, unlike picture 1 at every byte, and rt reads it
exactly and unlike picture 1 at every byte (the negative control); rt writes picture 3 and
releases it, and Direct3D 11 reads it exactly through staging copies.
2026-11-19 13:36:21 -08:00