Commit Graph
1786 Commits
Author SHA1 Message Date
Anees Iqbal d88af7befe player: a two-copy stream's Managed buffers start their GPU copy from the bytes they were made with
docs/REPLAY-STREAM.md says a Managed buffer that plays with two copies has
a GPU copy that starts from the bytes it was made with: a copied buffer's
contents, or a no-copy one's bytes at its making. Neither backend did so.
The player stripped every newBufferWithDescriptor: descriptor's contents
before the backend's making and wrote them afterwards as a CPU write. So
the new runtime's new_buffer, written to take them, never got them, and the
old backend made every such buffer zeroed. Under two copies neither GPU
copy held the bytes, and a draw reading the buffer before any
didModifyRange: read zeros where the recording's GPU read the bytes.

This changes the new runtime's plays too, not only the old runtime's. The
player now passes the descriptor to the backend with its contents and still
writes them once the buffer is made. The new runtime's backend takes them
as it was written to. The old backend's making takes them, both a
descriptor's contents and newBufferWithBytesNoCopy's pages. Where the buffer
plays as the runtime's Managed buffer, it writes them and announces them
(didModifyRange: over them).

Found by synthetic streams of our own on the RX 550 (m3-max-53813): under
a two-copy identity record, a no-copy and a copied Managed buffer made with
7s read zeros through a blit on both backends. The GPU-free count has the
recordings this touches: glbench-3090-r2, r3 and r4, gb-3090-r3, r4 and r5,
web3d-3090-r2 and r3, nvdec-3090 and nvdec-3090-wd.

Tests: a_two_copy_stream_s_managed_buffers_start_from_the_bytes_they_were_
made_with, in rt_replay (new runtime) and replay_streams (old runtime). Both
play one stream, rt_replay::made_with. They fail without the fix on a
device that keeps two copies.
2026-11-19 12:31:16 -08:00
Anees Iqbal 54d43118a9 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-19 12:25:05 -08:00
Anees Iqbal de3acd5e61 rt import: the several-dma-buf import's tests, docs and tables
A device test reads and writes a block over three dma-bufs of one memfd (one, two and one
granule) across both chunk boundaries: add reads across the first and writes across the second
through the GPU addresses, then a blit reads across the second and writes across the first through
the buffer; every byte of the memfd is checked after. Refusals (no dma-buf, a length off the
granule) import nothing; a device with no granule refuses typed. A second device test times
vkQueueSubmit2 beside 40 live dma-bufs of one block and beside 40 one-dma-buf blocks against none.
A unit test holds the granule rule.

README (imported blocks, the extension table, sparseBinding beside the optional features, the
known gaps with the Iris's dma-buf type), REFUSALS.md, api_signatures, and the player's
sparse_binds counter.
2026-11-19 12:24:12 -08:00
Anees Iqbal 60eff8b12a 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-19 12:22:14 -08:00
Anees Iqbal 1f41d7b75e player: the old backend plays a one-copy stream's Managed buffers as Shared
A stream recorded with one copy (its identity record's hasUnifiedMemory, or
--managed one-copy) keeps every Managed buffer's CPU writes visible to the
GPU with no didModifyRange:. The new runtime's backend plays such buffers
as Shared (docs/REPLAY-STREAM.md, Managed buffers); the old backend took
the trait's no-op and played them as the old runtime's Managed buffers,
which on a device without unified memory keep a GPU copy that m2v.write
never reaches. On the RX 550, syncview f355's quad index buffer (#49287, a
no-copy descriptor-form Managed buffer written once by m2v.write) read
[0, 0, 0, 0] on old's GPU copy against [1, 0, 2, 3] on rt's, so old's
draws were degenerate strips that drew nothing: old timed less work than
the program asks for on every discrete card for such streams.

The old backend now takes recorded_unified_memory and --managed, makes a
Managed buffer or block Shared under one copy, and says so in its report's
managed line. Device test: a one-copy stream's Managed buffer written with
no didModifyRange reaches a blit's read (replay_streams.rs), which fails
without the fix on a device that keeps two copies.
2026-11-19 11:53:33 -08:00
Anees Iqbal 42993be0bc rt surface: Device::import_d3d11_surface's signature, refused typed until the import is built
The Windows surface import's public shape, so a consumer can build against it now:
#[cfg(windows)] Device::import_d3d11_surface(&self, planes: &[D3d11Plane<'_>]) ->
Result<Surface, Error>, with D3d11Plane { handle: BorrowedHandle, image_format, descriptor,
index } per plane: the Direct3D 11 texture's shared handle and own format, and the texture rt
makes over it. Until the import is built every call answers the new Gap::D3d11Surface (basis
ours), whose Metal counterpart is a texture over an IOSurface's plane.

A Windows device test holds the refusal for no plane and for one. REFUSALS.md and
api_signatures regenerated; the rt README's surfaces section names the call.
2026-11-19 11:48:29 -08:00
Anees Iqbal 97b6ce7d8f conformance: the resource getters rt keeps none of are the consumer's own, one row a site
The planner's ruling: one new object of the consumer's own, the eight MTLResource getters
metal2vulkan-rt keeps none of (label, device, cpuCacheMode, hazardTrackingMode, resourceOptions,
heap, heapOffset, isAliasable). Its text says who answers each and from what: an echo of what the
program gave at the make, each default resolved by the consumer, or the consumer's own object
(the device, the heap, its placement and its record of makeAliasable). It says nothing of what
Metal answers. rt's README names it in what the consumer implements. If rt ever answers one of the
eight, that getter is split out as storageMode is in the commit before.

The 17 sites of resource-aliasing, resource-labels and resource-own-getters where the rt side
answered resource_facts Unavailable take one row each, naming which of the getters the case reads
there and that storageMode compares at the storage-mode site beside it. The three cases are
re-recorded on the M3 (53582 at 40ff1a0a10): each recording gains its storage-mode sites and
nothing else changes. The coverage document is regenerated.

Verified: built and tested in the jobs the landing message names.
2026-11-19 11:35:33 -08:00
Anees Iqbal 716d2a6692 conformance: surface_textures recorded on the M3 Max
The six cases recorded by m3-max-53501 at e9205c330c (macOS 27.0.1, three runs each, Metal's API
validation layer on in the validated leg, which ran clean): every texel getBytes: and the blit read
back is the byte replaceRegion: wrote, over each surface's plane. A test holds the recordings to
that. The conformance coverage document regenerated for the new recordings.
2026-11-19 11:35:32 -08:00
Anees Iqbal 3972bd030f conformance: textures of ordinary formats over IOSurface planes, the consumer's surface form
A new family, surface_textures: BGRA8Unorm over a 'BGRA' surface, RGBA16Float over 'RGhA', and
R8Unorm and RG8Unorm over a '420v' surface's two planes, R16Unorm and RG16Unorm over an 'x420'
surface's. Each case makes the texture with newTextureWithDescriptor:iosurface:plane:, writes
every texel with replaceRegion:, and reads them back with getBytes: and with a blit into a Shared
buffer. The suite's existing surface cases are all Apple-private forms (framebuffer-only rotated
targets, and Metal's two-plane YCbCr formats); these are the form a consumer's surfaces take,
textures of ordinary formats over one plane. The x420 planes take the 16-bit formats, whose texel
is the plane's element.

The sides: Side::surface_texture. Metal's side lays the surface as the case states and reads it
back before a texture lies over it (metal_surface's single-plane surface may now state its
OSType). The old runtime's side takes a buffer standing for the surface, as the runtime takes an
IOSurface. The new runtime's side makes an exported surface of the planes
(Device::new_exported_surface), in the first of a dma-buf, an opaque fd and an NT handle the
device exports, at VA-API's 256-byte multiples; the case's texture is its plane's. The rt replay
prints each case's surfaces_in_place and surfaces_copied, the evidence of the form a venue took.

The rt side's other surface answers name what it lacks: a rotated target's setRotation: (or
setFramebufferOnly: at rotation 0), and a two-plane YCbCr texture over a surface's plane.

Verified: built and tested in the jobs the landing message names; the cases are recorded on the
M3 in a later commit.
2026-11-19 11:35:32 -08:00
Anees Iqbal 9d7dec8281 docs: the conformance coverage document counts buffer_target_clears' new-runtime tolerance
Check m3-max-53356 at 73b58c77fc (msi):
- clippy 0, and the attachment-note tests 0;
- the conformance crate's tests 1 failure of 1075: the_conformance_coverage_document_is_what_the_sources_derive.
The DontCare rows' texel declarations (73b58c77fc) are a new module that loosens a measured value:
the document's tally reads 16 modules and 18 tolerances where the sources derive 17 and 19. Its
buffer_target_clears row now names the NewRuntimeAccepted tolerance.

Regenerated with python3 -I scripts/conformance-coverage/coverage.py at c2deff73b7. Only those
three lines change.
2026-11-19 11:35:31 -08:00
Anees Iqbal 567b959429 conformance: a DontCare row's texels are unchecked on metal2vulkan-rt, which Apple's page leaves arbitrary
The three buffer-target-clears-*-dont-care cases were divergent on every rt venue at
case/buffer-after-the-pass: 64 elements, the target's 16 texels. Metal (Apple M3 Max, macOS
27.0.1) left the buffer's pattern there. rt stores the clear: its README says a DontCare store
stores, "one of the outcomes Metal allows".

Metal's documents. MTLRenderPass.h says only that DontCare is the default store action. Apple's
page for MTLStoreAction.dontCare: "The GPU has permission to discard the rendered contents of
the attachment at the end of the render pass, replacing them with arbitrary data." and "Some
GPUs may still store the contents back to the texture, but you can't rely on that behavior. You
need to assume that GPU discarded the texture's contents." So Metal documents those texels as
arbitrary, and the fix is the case's, not a ledger row.

The fix:
- A DontCare row declares each of its 64 texel bytes Unchecked, at case/buffer-after-the-pass/
  <offset>, under the new accepted difference "The new runtime's DontCare store writes what the
  pass rendered" (docs/API.md, render passes; it quotes the page and the M3's answer).
- The justification is NewRuntimeAccepted, so the old runtime's run, whose answer is the M3's,
  still compares every texel exactly. The padding and the bytes before and after the target
  compare on both runtimes.

Test: a_dont_care_row_leaves_its_texels_unchecked_on_the_new_runtime_alone. Against the M3's
kept bytes and ours with the clear in every texel, it expects:
- no divergence on rt's run, and no bad allowance (the slug is in docs/API.md);
- one 64-element divergence on the old runtime's;
- a divergence on rt for a moved byte at 0, just before the target, just after a row, or the
  last byte;
- no declaration for a Store row.
2026-11-19 11:35:31 -08:00
Anees Iqbal 4c21a8d38a translator: a render pipeline into an RGB9E5Float attachment records SharedExponentKept on Device::from_queries
metal2vulkan-rt's conformance side read shared-exponent-store divergent on the Radeon 780M at
case/drawn/texels (16 words, Metal 0x6e020080 where the device kept 0xa00c0401; whole-set
m3-max-52928, then 53116): Metal's tile store writes an RGB9E5Float word whose largest mantissa is
below 256 back normalized, and the device's pass keeps the word. The case loosens that site on
the `shared-exponent-kept` notice, but only the old runtime announces it, at the draw, from its
encoder (render.rs); rt has no such encoder step and the translator recorded no note, so the
device's answer went unannounced. A missing static note is a bug (rule 1). Its twin,
SnormMinimumKept, already has the static form; this gives the shared exponent the same one.

- `PrecisionNote::SharedExponentKept` (appended): the note of a render pipeline that draws
  single-sampled into an RGB9E5Float color attachment.
- `pipeline::private_state::note_tile_store` (was `note_snorm_minimum`) records it as it records
  SnormMinimumKept: on the fragment stage (the vertex stage where there is none), whatever the
  pass loads, and only where the profile's existing `SnormMinimumNote::Noted` says so, which is
  `Device::from_queries`. No new fact, switch or device check: `Device::new`'s modules, keys and
  the old runtime's announcement are unchanged.
- The old runtime's `Degradation::from_precision_note` maps the note to its existing
  `shared-exponent-kept` kind: one arm, which its exhaustive match requires to compile, as
  DepthDenormals and CompressedTexelDecode did. It adds no switch, fact row or device check to the
  frozen runtime, and nothing it does changes.
- The codec takes the variant; ARTIFACT_FORMAT_VERSION 548 -> 549. fast_paths lists the note under
  Elsewhere. Validation's comparison allowance is Unbounded, as for the other device-answer notes.
  api_signatures gets the two variant rows and the macro row. docs/API.md's `shared-exponent-kept`
  entry says where the static note is recorded.

Test: engine_private_render_state's
a_shared_exponent_attachment_notes_the_words_metal_s_pass_normalizes. On lavapipe and moltenvk-m3
the note is on the fragment stage alone through Device::from_queries, on no stage through
Device::new, and on none at four samples or into RG11B10Float, RGBA16Float or RGBA8Snorm. The
conformance case shared-exponent-store on the 780M through the rt side is the end-to-end test.
2026-11-19 11:35:30 -08:00
Anees Iqbal 6de7e37ba5 replay judge: a finished rt play prints its judged totals, held equal to the base
The replay player prints, on the new runtime, the matrix's judged metrics of a play: one
`M2V-MATRIX metric replay-rt/STEM/RANGE/NAME N` record per metric, `N` the play's executed total
(`Report::total`) of submissions, passes, barriers less `texture_clear_barriers`, bytes copied and
pipelines created, and of the new textures zeroed, the clears and the zero-initialized ones as one
count and their bytes as one. The split between a clear and a zero-initialized texture follows
where the pool places it and may differ between two plays of one stream, so the two are judged
summed, and the barrier after an upload's clears is left out of the barriers. A play that did not
finish its range (it stopped, or ended before frame F's present where it plays to F) or whose
backend skipped anything prints none (`judged_records`).

The matrix's rule holds a `replay-` metric equal to the base's, failing a change either way, and
fails a leg that lacks a record its base has: a short play does not pass (`EQUAL_METRICS`). The
counters' docs say the split may differ between two runs of one program; VALIDATION.md and
REPLAY-STREAM.md say what the judge does.

Tests: the judged totals on the fake backend (the net barriers, the summed zeroings, a counter
not reported as 0, no other counter, the range in the key), a short play, a stopped one and a
skipping one printing nothing, and the rule's equality and missing-record cases in
test_results.py. Verified: cargo fmt; `python3 -m unittest discover -s scripts/matrix` (84 tests,
OK). The Rust build, clippy and tests run in the checks dispatched at this commit.
2026-11-19 11:15:33 -08:00
Anees Iqbal ac678d7d1e rt surface: Surface::buffer, a buffer over an exported surface's own memory
What: Surface::buffer() answers a Buffer over the surface's memory, of the export's size, at the
layout the SurfaceExport states. In place it is made at the first call, never at the surface's
make: of an opaque handle, a buffer bound at the first byte of the one allocation the planes are
bound in (memory::surface_view; the allocation now takes device addresses, which the buffer's
binding needs); of a dma-buf, a buffer on one more import of the dma-buf (import::surface_import)
into the memory type the planes' imports took, through a duplicate of an fd the surface keeps,
attempted only where the device's buffers import a dma-buf and the fd's query and the buffer's
requirements list that type. The copy form answers its block's buffer. The first call records
the buffer's acquire from the other API's queue family; external_writes_done acquires it with
the planes and release_surface_to_external releases it with them, writing back the copies of
textures over it first.

The surface, its planes and their views, and its buffer are one unit in the hazard sets: the
planes take a HeapId::unit at the make and the buffer takes the same one, so a kernel's write
through the buffer orders the next kernel's read through a plane as a heap's resources do.

Counted in the new Gauges::surface_buffers (a dma-buf's also in surface_imports); refused with
Limit::ExportType, Limit::NoImport and the new Error::Fd (no duplicate of the fd). The doc comment
quotes Vulkan 12.11 Memory Aliasing and the fd import's multiple-import sentence, and names the
same-instance reading the dma-buf form takes.

Test: every_device_carries_each_form_of_surface gains the buffer round (two pictures the second
device wrote read through the buffer, one at its make and one after external_writes_done, with a
one-byte-off negative control; a picture blitted into the buffer read through the planes and the
handle) and, on 1080p with llvm-as, the compute round (a kernel writes through the buffer, the
next reads plane 0 through a view; texels exact, and in place one barrier more than a control
whose first kernel writes a buffer of its own). Each device prints whether its buffers import a
dma-buf. Not yet run.

docs/REFUSALS.md and api_signatures.tsv regenerated; the rt guide states the contract.
2026-11-19 10:50:42 -08:00
Anees Iqbal 0126e3adbc rt: a texture for views placed in a heap, by the heap texture's rule
Device::new_heap_texture_for_views(descriptor, heap, offset) is MTLHeap's
newTextureWithDescriptor:offset: for a texture reached through its views alone. It is the texture
Device::new_texture_for_views makes, with its image bound at offset in a Private heap range of a
block the consumer holds. Nothing is allocated, and the bytes are the ones the heap's memory holds
there, so nothing is zeroed. Its uses and its views' uses take the heap's id in the hazard sets,
and the texture holds the block. What differs from Metal is what differs for
new_texture_for_views: it has no index of its own.

Why: the consumer's cache shape images are textures for views. Until now they took rt's own
texture block or an allocation of their own, sometimes on the consumer's ring thread; one measured
24.6 ms for 34.5 MiB. With this call they come from the consumer's Private pieces, which it makes
ahead, so the consumer's pool stays the one place memory is made ahead.

How: one rule, not a second path. Device::heap_source is the heap check new_heap_texture made
inline: the block is the consumer's, and it is Private and not exported (Gap::HeapTexture
otherwise). Both new_heap_texture (Reach::Index) and the new call (Reach::Views) take their
Source::Heap from it into Device::texture, which binds it through Bind::Heap and heap_fit as
before. The README's texture-for-views entry, HeapRange's doc, and the docs of Gap::HeapTexture and
Refusal::HeapTexturePlace name the call. The signature table is re-blessed (one method added).
REFUSALS.md regenerates with heap_source as the refusal's site.

Test: tests::heap::every_device_places_a_texture_for_views_in_a_heap (device cfgs). In a heap
range of a Private block, the make moves neither Metrics::texture_allocations nor
texture_block_allocations, adds no block and no texture block, and the texture answers index 0.
A view's replace_region is read back by the texture's get_bytes, and the texture's write is read
back by the view's. A placement off the image's alignment is Refusal::HeapTexturePlace, and a
Shared block's heap is Gap::HeapTexture.

Verified: cargo fmt, signatures.py --check. The clippy, lavapipe and GPU runs follow in potluck
jobs.
2026-11-19 10:08:35 -08:00
Anees Iqbal 5d3d55ef90 rt: a texture the runtime places reads zero until written; the fresh-texture declaration deleted
The guest's own code reads textures it never wrote (two 1x1 ShaderRead
textures, read before any write). The M3 and the old runtime answer zero;
rt answered whatever the range held before, which followed process
history. Metal does not say what a new texture holds, so zero is rt's
choice, stated as such in the README, not as Metal's rule.

What changes:
- A new texture of new_texture, new_texture_for_views and
  new_managed_texture (Source::Plain and Source::Managed) carries a Zero:
  a colour clear, a depth-stencil clear (every aspect), or copies from the
  zero source for a format of texel blocks wider than a texel, which no
  clear writes (VUID-vkCmdClearColorImage-image-00007, -01545).
- The upload records it with the move home: one barrier from undefined
  to the transfer destination layout (with the moves home of every image
  not zeroed), the clears and copies, then one barrier to the home
  layouts. No tracking, and no check on any bind or draw. Textures in a
  heap, over a buffer, of a surface plane, drawables and shadows are not
  cleared.
- The zero source grows from 16 bytes to 64 KiB, a row of 16-byte blocks
  16,384 texels wide; fill::zero_regions copies in bands of whole rows of
  at most that, and in runs along a row where one row is larger.
- Metrics::texture_clears and texture_clear_bytes count the clears; the
  replay player reports them per frame.
- The declaration of 2f4c9fc9dc is deleted: replay::new_texture_contents,
  its slug and docs/API.md entry, and its uses at the fresh sites of the
  fresh-texture, fresh-pattern, texture-round-trip and format-footprints
  rows, which compare exactly on rt again. Its test goes; its unknown-slug
  check moves to the remaining rt-only declaration's test.
- README: "not for a heap's memory or a texture's" now says a texture rt
  places reads zero until written, as rt's choice with its reason; heap
  memory is unchanged.

Old runtime, for comparison: crates/metal2vulkan-runtime/src/texture.rs
4805-4806 decides a clear where clears_to_zero (5191) holds, else copies
of the device's zeros (zero_copies, 5541), recorded at 4936-4942 into the
image's first move (texture/first_move.rs), taken by the next submission.

Tests: the_zero_source_s_copies_write_every_element_once (pure), and
every_device_reads_zero_from_a_new_texture_where_another_was_written
(device): a Shared texture written 0xa5 in every subresource, read back,
released; a new Shared and a Private texture at the same place read zero
in every subresource, one clear counted each, of its image's bytes.

Verified: not yet; the lint, suites and negative-control jobs follow.
2026-11-19 10:02:47 -08:00
Anees Iqbal 6eb83eabff rt README: a command buffer is scheduled once the one submit thread's earlier calls return, whatever their queue; the Iris Xe's figures
The known gaps of queues gain the rule behind the running-signal case's
declaration. Every queue's command buffers go to the device's one VkQueue,
which takes one vkQueueSubmit2 call at a time, since Vulkan requires a queue's
host access to be externally synchronized. The device's one submit thread
makes every call (submit.rs has one call site, reached only from the thread's
pass), and it schedules a command buffer once its earlier calls have
returned, whichever queue they were for. So one long driver call delays every
queue's scheduling by its length. The API.md accepted difference the
declaration cites now states the same ground.

Measured on an Iris Xe (RPL-P, ANV):
- m3-max-52564: the device's first submission, 192 fills of a new 256 MiB
  block, spent 27-30 ms in vkQueueSubmit2. The other queue's waiter was
  scheduled 0.02 ms after that call returned, in 3 of 3 runs.
- m3-max-52745, the separating run with the probe's block size as a scratch
  switch, never committed: the first call took 2.1 and 2.5 ms with 1 MiB,
  9.1 ms with 64 MiB and 28.4 ms with 256 MiB. Its time grows with the new
  block the submission first uses. The probe's later submissions took at most
  0.18 ms.
- In the same job, the 256 MiB run (the case's own shape) read Committed and
  the case's declaration fired at both MTLEvent sites, verdict 'announced'.
2026-11-19 08:21:53 -08:00
Anees Iqbal 3955d3bd01 docs: CONFORMANCE-COVERAGE re-derived for the running-signal case's declaration; the generator names NewRuntimeAccepted
The running-signal case now loosens two sites with Loosening::AnyOf on rt's
run, so the derived counts move: 11 SDK items move from 'no case reaching it
loosens anything' to 'loosens some site', and the tolerances grow from 15 to
17. The generator mapped each Justification constructor to its variant except
new_runtime_accepted, and that is the first one a case module names. It now
maps it to NewRuntimeAccepted.

Verified: the_conformance_coverage_document_is_what_the_sources_derive failed
in m3-max-52651 before this commit. coverage.py --selftest passes.
2026-11-19 08:21:53 -08:00
Anees Iqbal 1e583d5e0c conformance: the running-signal case's MTLEvent reading may be Committed on rt alone, where its submit thread is still busy
On the Iris Xe, event-wait-behind-a-running-signal's MTLEvent row read the
waiting command buffer Committed with no handler run, where the M3 Max had
scheduled it while the signaller ran. This held in 3 of 3 runs (m3-max-52564).
The trace showed why. The waiter's wait was met at once by the signal's
staging. rt's one submit thread was still inside the signaller's
vkQueueSubmit2, the device's first submission, which took 27-30 ms on ANV. The
waiter was scheduled 0.02 ms after that call returned. Apple defines Scheduled
as all dependencies resolved and the command buffer scheduled for execution,
and promises no time between the two. The planner ruled this a timing
difference and not a conformance bug.

The case now declares, on rt's run alone (Justification::NewRuntimeAccepted),
that the MTLEvent row's waiting status while the signaller runs may be
Committed or Scheduled, and its handlers none or the scheduled one. The
declaration cites a new accepted difference in docs/API.md, 'The new runtime
schedules a command buffer once its submit thread is free'. The shared event's
row is not loosened: both runtimes hold its waiter until the value is reached.
The old runtime's run compares both sites exactly.

New test: a_wait_met_by_a_running_signal_may_read_committed_on_the_new_runtime_alone.
It checks that the Iris answers are no divergence on rt and are rows on the old
runtime, that the shared event's sites still diverge, and that a status other
than the two still diverges.
2026-11-19 08:21:39 -08:00
Anees Iqbal 37adfb0756 rt surface docs: the guide's exported surfaces, the dma-buf copy-form gap, the refusals and the API table
The README says in one place what each handle needs for in place, the layout
rule, the copy form's reasons and the one consumer contract. REFUSALS.md and
api_signatures.tsv regenerated by their scripts.
2026-11-19 08:09:12 -08:00
Anees Iqbal 8c3fae2243 replay: the rt arm plays guest-RAM copies in the host's one-copy form
The new runtime's backend played a copy back to the guest's RAM as one
buffer copy per run, word-widened, in the guest's own blit encoder, and a
copy from the guest's RAM as one copy per piece in that encoder. The host
does neither: on the new runtime every staged fill and download is one rt
buffer-to-buffer copy, since rt answers no linear row pitch. In f355 of
the syncview stream the per-run form made 8,029 copies from 28 calls,
with a barrier pair each, which the host never makes.

Now each call is one copy, in a command buffer of the backend's own on
the call's queue, through a Shared scratch of its own (new module
new_runtime/guest_ram.rs):
- copy back: one copy of the whole words the runs span, committed just
  after the call's command buffer; a wait for that command buffer waits
  for the copy too (the guest sees its RAM written when its command
  buffer completes), then the CPU copies each run out of the scratch;
- copy in: the pieces gathered on the CPU into the scratch laid out as
  the bytes they span (gaps and edges from the target's mapping), one
  copy committed just before the call's command buffer; into a buffer
  with no mapping, one copy per run of touching words, so no gap is
  written.
Surface texel copies stay in the guest's blit encoder. The work is
counted apart as the stand-in (guest_ram_* counters, guest_ram_gpu_nanos
for its command buffers' GPU time, outside gpu_busy) and the report's
"guest RAM: copy-back played in the one-copy form" line. The old arm is
unchanged. staged_guest_ram_bytes and copied_back_guest_ram_bytes give
way to guest_ram_fill_bytes and guest_ram_download_bytes.

Tests: the copy-back device test now expects one copy of 100 bytes and
two runs copied out; a new device test plays copies in to a Shared and a
Private buffer and reads both back. docs/REPLAY-STREAM.md section 10
describes the form.
2026-11-19 08:01:21 -08:00
Anees Iqbal ea04fc8925 conformance: CONFORMANCE-COVERAGE re-derived for case 6's declaration
fence_orders now loosens one site (case/order/y/words-written on the
new runtime's run, NewRuntimeAccepted), which the coverage document
counts: the_conformance_coverage_document_is_what_the_sources_derive
failed without it (job m3-max-52556). The case names the variant, as
the table lists justifications by variant.

Verified: in the jobs named in the landing's report.
2026-11-19 07:53:00 -08:00
Anees Iqbal 0fa1b8f14c conformance: case 6's declaration says why rt reads 1024 and that Metal's 0 was measured
A reader of "0 or 1024" could take it for a race in rt. The docs/API.md
entry and the case's comment now say why 1024 is rt's answer (a writer
whose queue has fewer than three submissions in flight is submitted at
once, so the later reader reads it on every device and run), and that
Metal's 0 there was measured on the M3 Max (jobs m3-max-52432 and, behind
three, m3-max-52415), not documented. The entry's lead-in, and so its
slug, is unchanged.

Verified: in the jobs named in the landing's report.
2026-11-19 07:52:59 -08:00
Anees Iqbal 57a33a11e9 conformance: fence-none-tracked-behind-one declares the new runtime's word count, an accepted difference
On metal2vulkan-rt the case read divergent at case/order/y/words-written:
Metal 0, ours 1024 (job m3-max-52528, lavapipe). The writer's queue has
one busy command buffer, below the three at which rt holds a group, so
rt submits the fill at once and the later copy on another queue reads
all of it. Metal's tracking orders only against work it has already
submitted, and on the M3 Max it ran the copy first (5 of 5, job
m3-max-52432). rt's answer is the order Apple describes for a tracked
write (later commands wait for it); Metal's there is timing.

docs/API.md section 10 lists it under a new "Command queues" heading,
citing the rt README's measured line, and the case declares the count
on the new runtime's run alone (AnyOf 0 or 1024, NewRuntimeAccepted):
the old runtime's answers still compare exactly, and every status
still compares on both.

Verified: in the jobs named in the landing's report.
2026-11-19 07:52:59 -08:00
Anees Iqbal 1241509a65 docs: CONFORMANCE-COVERAGE re-derived for the six fence cases
scripts/conformance-coverage/coverage.py, run locally; the_conformance_coverage_document_is_what_the_sources_derive failed in m3-max-52426 without it.
2026-11-19 07:18:22 -08:00
Anees Iqbal 407b5a1078 rt: a fence orders encoders across queues; Gap::FenceOtherQueue goes
A fence used on a second queue was refused (Gap::FenceOtherQueue): 18 refusals in a
live boot on a 780M, every one a fence update on a second queue. The rule was ours,
from a replay census in which no fence crossed queues, not Metal's contract: the headers
say a fence update and wait are each "evaluated at kernel submission to maintain global
order and prevent deadlock", and MTLFence.h says nothing about queues.

What Metal does, measured (probe cross_queue_fence_held_update.m, M3 Max, macOS 27.0.1,
jobs m3-max-52186, m3-max-52188, m3-max-52194, plain and under the validation layer):
a wait on queue B waits for an update on queue A submitted before it (untracked
buffers: B starts 0.3-1 us after A ends and reads all its words; with no fence B runs
beside A and reads none); a wait with no work after it waits too (its handler 0.11-0.16
ms after A's GPU end); an update in a command buffer Metal holds, at an MTLSharedEvent
or MTLEvent wait, behind one held so, or behind an uncommitted enqueue, is not waited
for (B completes in 0.2-3.5 ms without A's writes, A still Committed).

Every rt queue submits to the device's one VkQueue and each segment ends with a
barrier, so a wait sees every update submitted before it. B passes A in four places:
(i) A's head held at an event wait, (iii) behind an uncommitted enqueue, both Metal's
own behaviour per the probe, so no hold and no gap; (ii) A's command buffer in a group
the submit thread holds while A's submissions run, and (iv) held groups released in
FIFO order rather than commit order, both rt's own. For those: each command buffer
keeps the fences its encoders wait on and update (empty, nothing allocated, when it
uses none); before a segment of a command buffer that waits on a fence is staged, the
submit thread sends first any other queue's held group (member or partial head) that
updates one, by send_through as a host wait does. A command buffer with nothing for the
GPU that waits on a fence retires no earlier than the last submission carrying an
update of it (the fence keeps that progress value, set in close). Same-queue fence use
is unchanged in submissions; no fence: one empty-Vec test per staged segment.

Tests: the two other-queue cases turned to accept; a new device test with A held in a
group behind the busy gate: (1) B's wait committed after reads A's fill, (2) B's wait
held at a shared event, released after A's later update joined the group, reads it,
(3) B's fence-only wait does not complete before A's update; and a corner test: a wait
on B runs while A's update is held at an event wait or behind an enqueue, without its
write, then A runs once let go. Docs: fence.rs, the three encoder sites, the rt README,
REFUSALS regenerated, api_signatures.tsv loses the variant.
2026-11-19 07:04:20 -08:00
Anees Iqbal 0e9889dfaa replay: the rt backend reads a Private buffer back through a blit into a Shared buffer of the play's own
The new runtime's player backend refused every read of a Private buffer
("a Private buffer": it has no contents). The gate's per-command-buffer
compare (`--dump-command-buffers`, `compare-dumps`) therefore read none of
them on rt: its play pair over glbench-780m-r2's command buffers
58254..58416 on the 3090 (m3-max-52237, development b8ea291aa5) left 41
dumps unread on rt, among them every buffer the probe gate had found
differing, and the compare said DIFFER for that alone. The probe had read
them through a blit of its own that never landed.

NewRuntime::read now copies a Private buffer's bytes with one blit into a
Shared block the play takes for the read and gives back, on a queue of the
play's own made at the first such read, and waits for the copy. The
player reads only after the work that writes the buffer completed. A
length that is not a multiple of 4 stays the copy's own refusal. The
stream's checks never named a Private buffer (a refused read ends a play),
so only the dumps change.

Test: rt_replay::a_private_buffer_reads_back_through_a_copy: a blit fills
a 16-byte Private buffer with 0x5a; the backend's read answers those
bytes. Before this change the read was refused.

Verified by the check named when this lands.
2026-11-19 07:02:13 -08:00
Anees Iqbal 2f4c9fc9dc conformance: a new texture's fresh read is unchecked on metal2vulkan-rt, where Metal is silent
rt answers a new texture with whatever its memory last held. Metal's two texture-making sentences
say nothing of a new texture's contents: MTLDevice.h gives newTextureWithDescriptor: only
"Allocate a new texture with privately owned storage.", and Apple's page only "Creates a new
texture instance.". The page for newBufferWithLength:options: promises zeros ("Creates a buffer
the method clears with zero values."). An Apple M3 Max on macOS 27.0.1 read zero from new Shared
and Managed textures.

What changes:
- A new justification, Justification::NewRuntimeAccepted(slug): an accepted difference of
  docs/API.md that holds on the rt run alone. On the old runtime's run it is
  Unjustified::OldRuntime, which faults nothing, so the old runtime's answers still compare.
- The declaration replay::new_texture_contents(site) leaves the site unchecked under the new
  docs/API.md entry "The new runtime's new textures read what their memory last held". It carries
  the four facts above and the words "silent", never "undefined".
- It is named at the fresh site of every texture row:
  - fresh-texture-* and fresh-chain-*, every storage mode;
  - fresh-pattern-*;
  - texture-round-trip-*;
  - each format-footprints round trip.
- It is not named by any buffer row or texture-over-buffer row: Metal promises those zeros, and
  they stay exact on rt. The written sites and the statuses stay exact on both runtimes. rt writes
  nothing to pass a row.

Why: these rows' fresh sites follow process history on rt. m3-max-52251 (lavapipe, rt) ran plain
development at ed2d2295ce and 391db1e57a and the set at be7ff19f8a:
- 73, 74 and 74 rows divergent, all at fresh sites.
- texture-round-trip-1/12/13/14 are exact each alone in a process and divergent after other cases.
- Which Shared/Managed fresh-texture rows read the released texture's 0xa5 changes from run to
  run, even alone.

Tests:
- a_new_texture_s_fresh_read_is_unchecked_on_the_new_runtime_alone: the bytes are unchecked on rt
  and are the site's one row on the old runtime. A written-site difference stays a row. An
  unknown slug fails the case.
- The fresh rows' allowance test now holds the declaration on every texture and pattern row and
  on no buffer row.
2026-11-19 06:55:22 -08:00
Anees Iqbal 905b16b79a command-replay: --gpu-wait-timeout bounds the play's device waits
The replay command took only the 10 s default for every device wait, so a play on a CPU
device (lavapipe) whose command buffer takes longer than 10 s ends with status 86 though
nothing hangs. It now takes --gpu-wait-timeout SECONDS (1..=600) as the other device-executing
commands do, applied before any device opens; a value outside the range is an error line and
status 2. Needed for the CPU-ICD repro of a GPU hang (docs/VALIDATION.md, the suspected-hang
protocol). Verified: clippy and the player build; the lavapipe play that uses it is the check.
2026-11-19 06:46:48 -08:00
Anees Iqbal a36ac51121 translator: the identity domains' refusal names the first form the function holds that they do not lower
The identity gate (lower::select's identity_admits) answered Unsupported{IdentityDomains, NotImplemented}
for every plan it does not admit, with nothing saying which of its conditions failed. It now
names the first form the plan holds, in the refusal's symbol (diagnostics only), by what a
program does that takes it: a stage off the floor's push window, an encoder value it reads as a
push field outside the identity set, a buffer argument not reached by its device address, an
argument buffer's texture of a type, depth comparison, raw or cross-type read the identity arrays
do not take, a handle that reads its table entry beyond its element, a texture argument with
state beyond its resource ID, a sampler form (a texture argument sampled through a sampler the
identity sampling does not take, a sample of an argument buffer's texture, an argument buffer's
sampler, an array of samplers, a bicubic filter, a specialized sampler argument), a runtime fact
of bound state, or a descriptor. The checks and their conjunction are unchanged
(identity_refusal is None exactly where every condition held), so an admitted plan is lowered as
before; only the refusal's symbol is new, and only under the identity domains, which the new
runtime alone takes.

A test confirms which form argument buffers tier 2's pointer indexing takes (engine/ab_tier2's
ab_indexed: thread g reads the texture of element g of the argument buffers a pointer member of
the bound one reaches): on lavapipe and the M3 profile its plan reads the root table
(PushField::RootTableAddress), whose address the identity domains do not push, so it is refused
naming that, while the default domains compile it and the identity domains lower ab_copy and
ab_read. docs/API.md's identity paragraph names the form and says the symbol names the first one.

Verified: probe job m3-max-52000 (gem10, the gate change with the form unpinned) read
"an encoder value the function reads as RootTableAddress" for ab_indexed on lavapipe, and
a_bicubic_kernel_is_refused_under_the_identity_domains passed beside it; refusal_surface --check
is clean. The pinned test's run is the next check job.
2026-11-19 06:37:13 -08:00
Anees Iqbal 758d485660 conformance: the multisampled twin recorded on the M3 Max
Metal's answers (an Apple M3 Max, macOS 27.0.1 build 26A434, three runs, job m3-max-51921, record
and times in one job): pipeline-facts-render-multisampled-direct answers imageblockSampleLength
12 and imageblockMemoryLengthForDimensions: 1536 at [8, 4, 3], as the multisampled case with
indirect-command support does, and supportIndirectCommandBuffers false. The old runtime replayed
both on the M3 (MoltenVK) exact in the same job. rt's README line on the rule's measurements names
the twin. docs/CONFORMANCE-COVERAGE.md regenerated.

Verified: job m3-max-51921 (BUILD_CONFORMANCE=0, RECORD=0, TIMES=0, REPLAY_OLD=0, both cases exact on
the M3). The new runtime's comparison is the next check job.
2026-11-19 06:34:27 -08:00
Anees Iqbal f3e9f517bd conformance: the narrow-attachments and depth-stencil facts recorded on the M3 Max
Metal's answers (an Apple M3 Max, macOS 27.0.1 build 26A434, three runs each, job m3-max-51875,
record and times in one job):
- pipeline-facts-render-narrow-attachments, R8Unorm then RG16Float: imageblockSampleLength 6
  and imageblockMemoryLengthForDimensions: 192 at [8, 4, 3]. RG16Float sits at byte 2, its
  component's alignment, which is the rule metal::format::color_record holds ([(0, 1), (2, 4)]);
  packing tight would answer 5, aligning every texel wider than a byte to 4 would answer 8.
- pipeline-facts-render-depth-stencil, RGBA8Unorm then RGBA16Float with Depth32Float_Stencil8 as
  depth and stencil: 12 and 384, the same as the two colors without it, so depth and stencil take
  no room.
The old runtime replayed both on the M3 (MoltenVK) exact in the same job.

The case comments and rt's README line on the rule's measurements state the two values.
known-gaps-rt.tsv gains each case's five rows on every venue that pipeline-facts-render-plain
already holds: device and label (the consumer's own) and the three tile getters (the libs census).
docs/CONFORMANCE-COVERAGE.md regenerated.

Verified: job m3-max-51875 (BUILD_CONFORMANCE=0, RECORD=0, TIMES=0, REPLAY_OLD=0, both cases exact on
the M3). The new runtime's comparison is the next check job.
2026-11-19 06:34:27 -08:00
Anees Iqbal 30156e1aaf conformance: the new runtime's side answers pipeline state facts, label, device and the tile getters refused fields
compute_pipeline_facts and render_pipeline_facts were left at the Side default on the rt side,
so the two pipeline-facts cases whose state rt makes (pipeline-facts-compute-plain and
pipeline-facts-render-plain) refused the whole facts call. Both now answer through the state:

- compute: staticThreadgroupMemoryLength, supportIndirectCommandBuffers (false on every state rt
  makes), imageblockMemoryLengthForDimensions: and requiredThreadsPerThreadgroup, the last two
  getters present landed in 90792a2bfa;
- render: imageblockSampleLength, imageblockMemoryLengthForDimensions: and
  supportIndirectCommandBuffers.

label and device are the consumer's own (rt keeps neither on a state), and a drawing state's
three tile getters (maxTotalThreadsPerThreadgroup, a tile threadgroup's, per Metal's
documentation of the render state's getter, threadgroupSizeMatchesTileSize and
requiredThreadsPerTileThreadgroup) are not rt's, as rt makes no tile render state (the
planner's ruling). Each is a refused Field, so the state's other getters compare.
imageblockMemoryLengthForDimensions: of a compute state is a Field too, as rt answers it with a
typed error for a kernel whose imageblock it does not measure.

Rows: 7, every venue: label and device of both cases (the consumer's own), and the three tile
fields of the render case, in words (rt's README names the tile getters it lacks). The rt
README's tile getter list gains maxTotalThreadsPerThreadgroup. The coverage document gains the
two facts types' field rows.

The other four cases are refused at the making as before (indirect command buffers, and the
kernel that reaches an imageblock).

Verified: coverage.py writes the document; build, tests and the lavapipe replay of both sides
follow in the check job.
2026-11-19 06:34:26 -08:00
Anees Iqbal ee1a8aee7c REPLAY-STREAM: the new runtime's player binds a range as the single-slot bind of each 2026-11-19 06:17:51 -08:00
Anees Iqbal d75eab9c2b validation: the per-command-buffer compare of two plays applies the cover rule, word by word
The 3090 chain gate compared rt's and the old runtime's plays command buffer by command buffer
through a probe that never lands: whole-object checksums of each buffer a command buffer named,
then a script that asked the probe's dumps of Covers. A whole-object checksum is no compare under
the cover rule: a buffer partly under a texture's write differs under the cover, and a word that
differs outside it shows only as the same mismatch. This lands the compare in the player's own
tooling, on the player's own Covers (94d7c1620c's rule, unchanged).

- Player::dumping(command buffers, dir): once each listed command buffer completed (its wait
  seen, before the next call plays), every buffer its encoders named is written into dir as
  cbC-objO.bin, with cbC-objO.cover holding the ranges of it the cover rule held covered then, or
  cbC-objO.unread where the backend could not read it. A write failure ends the play
  (PlayError::Dump). Off unless asked.
- compare_dumps(a, b) (replay/dumps.rs) compares two plays' dumps word by word, leaves out a word
  wholly inside a range either play held covered (the old runtime answers no slot access, so its
  plays cover less), and reports every other differing word per command buffer and buffer, a dump
  one play lacks, and a dump either could not read.
- command-replay: --dump-command-buffers FIRST..LAST --dump-dir DIR on play; compare-dumps --a DIR
  --b DIR prints a line per buffer that differs outside every cover and a summary ending agree or
  DIFFER, exit 0 / 1 / 2.
- Covers::ranges(object), read-only, for the dump.
- docs/REPLAY-STREAM.md, section 10: the options, the files and the compare's lines.

Tests (no GPU, the player on the test backend, two plays each that differ only in the words at
bytes 0x10 and 0x1800 of a 0x2000-byte heap buffer whose first 0x1000 bytes a texture's write
covers after the command buffer bound it):
- replay::tests::the_dump_compare_reports_a_differing_word_outside_every_cover: the dump's cover
  is 0..4096; the word at 0x10 is covered, the one at 0x1800 (word 1536) is reported; DIFFER.
- replay::tests::the_dump_compare_reports_a_word_whose_cover_the_buffer_s_last_write_voided: the
  encoder binds the buffer again after the dispatch (a binding counts as a write), the dump holds
  no cover, and both words are reported.
- replay::tests::the_dump_compare_agrees_on_alike_plays_and_reports_a_dump_one_play_lacks.
The test backend now keeps a heap buffer's bytes as it keeps a device buffer's, so a write into
one reads back.

Verified: the check job named at hand-over compiles it and runs the replay tests.
2026-11-19 06:06:56 -08:00
Anees Iqbal 0c36de79d9 replay: a surface's pictures fill its shapes at their first use, as the product's lazy fill does
m2v.externalWriteDone (a decoded picture landed in a receiver buffer) no longer refills the
buffer's shapes at once. As the product's per-shape form does after a video command buffer, every
shape of the buffer owes a fill from it, its own write lost; the first command buffer whose
encoders use a texture of the buffer (a binding, a pass's attachment, a blit, a useResource)
fills every owing shape of the buffers it uses before its commit, by blits in a command buffer of
the player's own committed then. A picture another lands over before any use is never copied.
The eager form copied every picture at its landing, so a burst of pictures landing at one present
was copied there whether used or not.

New counters: surface_pictures_filled (pictures a fill took) and surface_pictures_unfilled (those
another landed over before any use, or whose buffer went first); the surfaces line also gives the
pictures not used yet. The copy-from-guest-RAM comment now names the product's fill from the
pages, not a refill. docs/REPLAY-STREAM.md sections 4 and 10 say so.

Verified: the new device test a_surface_picture_fills_its_shapes_at_their_first_use (two pictures
land before a kernel reads the texture: one fill of one shape, the second picture read, the first
never copied) runs in the check that follows this commit; not yet run. The eager form fails it
(two refills).
2026-11-19 05:26:09 -08:00
Anees Iqbal 71d767c904 translator: the storage-texture fact names the texture access type the air crate now exports
What: metal2vulkan-air exported intrinsics::Access only under cfg(test), so the unbound analysis
of 0a810a7ab5 did not compile (E0432). The air crate now exports Access (Form stays test-only),
the type of Texture's public access field. The analysis counts a read or block read through a
loaded texture as a storage access unless the operation declares access::sample or access::read,
so a read that declares no access (an emitter before AIR 2.0) counts, as the fact's 'false is
proven' needs. The interface and API.md docs say so.

Verified: cargo fmt; signatures.py --check gives no diff. The check job compiles it.
2026-11-19 05:09:37 -08:00
Anees Iqbal 4231c5ba25 rt, translator: a declared write of a texture with no storage element refuses the argument-buffer dispatch
What: bug 4's held path. A compute encoder's use_resource with a usage that writes a texture (or a
view of one) made for shader writes with no storage element (Texture::unstored) now makes every
later dispatch of that encoder whose kernel may reach a texture through its storage image beyond
its bound slots Gap::StorageElement, with no slot and the texture's format. A kernel without such
an access dispatches whatever is resident, and use_heap declares nothing (Apple's header: useHeap
declares the heap's resources read only through an argument buffer), so a write through a
resource ID with no write-usage use_resource stays dropped, outside documented Metal.

How: the translator had no fact for that access (writes_unbound_resources with
texture_writing_stages would also refuse a kernel that writes a bound texture and a buffer through
an argument buffer), so StageInterface and PipelineInterface gain unbound_storage_textures,
decided in compile/unbound.rs beside the read and write facts: a texture write or atomic, or a
read of a texture the operation declares access::write or access::read_write, on a handle that
may come from memory, an integer or a call; an intersection or a call the entry cannot see into
counts; indirect-command and acceleration-structure operations touch no texture.
Gap::StorageElement's slot becomes Option<u32>. The render encoder builds no useResource:, so the
draw half has no trigger; the README says it waits for it.

SEMANTICS_VERSION 2190 -> 2191 and ARTIFACT_FORMAT_VERSION 547 -> 548 (one field in
StageInterface and PipelineInterface). docs/REFUSALS.md regenerated; api_signatures gains the
field and the variant's new shape; docs/API.md states the fact; the rt README's known gap says
what is refused and what stays dropped.

Tests: the translator's unbound-facts test states the new fact (an argument buffer's texture
write and a read_write read count, a sample and a read do not); storage_element gains
every_device_refuses_a_declared_write_of_a_texture_with_no_storage_element over RGBA8Unorm_sRGB,
BGRA8Unorm_sRGB, A8Unorm and an sRGB view of an RGBA8Unorm texture, and the same formats in a heap
under use_heap alone.

Verified so far: cargo fmt; refusal_surface.py, signatures.py --check and metal-coverage --check
give no further diff. The build, the suites and the device legs follow in potluck jobs.
2026-11-19 05:09:37 -08:00
Anees Iqbal a2576535bd replay: a plain surface shape takes shader read and render-target usage alone
The surface form's usage word, as ruled final. A shape no texture over it declares shader
write, shader atomic or Metal's unknown usage for (a plain shape) is made with shader read
and render-target usage alone: rt gives such a texture its format and that format's sRGB
sibling as views, and no storage view, so a plain shape's attachment reads are not refused
and its image carries the short view list. A shape shaders may write keeps the usage Metal
gives a texture whose use it does not know (shader atomic where declared), with the long
view list, so a storage plane's textures of other formats of the same bytes a texel stay
views of it with no copy.

A texture or view of a format other than a plain shape's own or that format's sRGB sibling
is refused (surface_format_refusals), and textures over a plain shape that declare
pixel-format-view usage are counted (surface_plain_format_views). docs/REPLAY-STREAM.md
section 10 says so.

Verified: the new test a_plain_surface_shape_views_as_its_format_and_its_srgb_sibling_alone
(a sibling view found, another format refused as a texture and as a view, counted) runs in
the device suite of the check that follows this commit; not yet run.
2026-11-19 04:51:43 -08:00
Anees Iqbal 0b8fe27977 replay: the surface form counts order-case shapes
surface_order_shapes counts the shapes shaders may write made over a plane that holds a shape
of their extent shaders may not write: the order case, which the storage bit makes another
shape. The doc's counter list reflows. Not yet compiled.
2026-11-19 04:51:43 -08:00
Anees Iqbal a5f4f03a32 replay: the surface form counts the slot writes a pipeline state's interface declares
surface_declared_writes counts the draws' and dispatches' surface texture slots whose bound
state's interface writes them, beside surface_usage_writes, those taken as writes by usage
with no interface at hand: together they say which binds write a shape. Not yet compiled.
2026-11-19 04:51:43 -08:00
Anees Iqbal 079fe12625 replay: a surface shape takes storage for shader atomic usage too; the shapes' sort and drop count as clippy and the type checker want
The planner's storage test is shader write, shader atomic or unknown usage (an image atomic is
a storage image's operation); a shape made for a texture that declares shader atomic carries it.
The idle shapes sort by recency with sort_unstable_by_key, and the overlap drop's count filters
by reference. Not yet compiled.
2026-11-19 04:51:43 -08:00
Anees Iqbal aa8dd9f131 replay: surface textures play as the product's per-shape form, with the usage word
The rt player's surface form now mirrors the product's per-shape form (reims's
surface cache, shapes.rs): a shape is a plane's (receiver, plane, offset, pitch)
texture of one extent and texel size, and every shape is current over its whole
extent by the product's three rules. A new shape is filled from the buffer once
the dirty shapes are written back; a copy back to the guest's RAM first writes
every dirty shape back; at the end of an encoder that may have written a shape,
the write goes through the buffer into each other shape of its plane that a live
texture views or that is dirty, and the plane's other shapes go. Writes are noted
from pass attachments, blit destinations, the slots the bound pipeline state's
interface writes (texture_accesses), and by usage where no interface is at hand.
The newest-entry rule, its download at a new shape and the older-shape use
counter are gone.

The usage word: a shape is made with shader read, render-target and
pixel-format-view usage, and shader write (a storage view) only for a texture
that declares it or Metal's unknown usage; the shape key carries that bit. A
storage shape serves a later texture of its extent that does not declare it; a
declaring texture over a plane whose shape has no storage is another shape.

The report and counters give overlap copies and bytes, straddled texels,
unordered writes, usage writes and write-backs. The device test now checks a
copy from the guest's RAM reaching both shapes of a plane and a blit through one
shape reaching the other at its encoder's end. Not yet compiled.
2026-11-19 04:51:43 -08:00
Anees Iqbal cce95596b4 rt: a threadgroup within Metal's limit for the kernel and past this device's is the device's Limit, not Metal's refusal
A compute state answers the least of Metal's maxTotalThreadsPerThreadgroup for the kernel and
this device's limits for it (maxComputeWorkGroupSize, its subgroups' count, and for emulated SIMD
groups their scratch beside maxComputeSharedMemorySize). A dispatch past that answer was
Refusal::ThreadgroupSize, which states that Metal itself refuses the threadgroup: on lavapipe
compute-threadgroup-simd-scratch's 1024 threads, which Metal runs, were refused as "past the
state's 256" and the suite counted our refusal where the old runtime reports the device's lack
(MaxComputeSharedMemorySize 32768 against 57344).

The interface keeps Metal's own answer beside the state's
(ComputePipelineMetalInfo::metal_max_total_threads_per_threadgroup, or a required size's
threads). A threadgroup past Metal's answer stays Refusal::ThreadgroupSize; one within it and past
the state's is the new Limit::ThreadgroupThreads { size, max }, basis device. The conformance
crate's rt side reads that limit as the venue's lack, as it reads the translator's device gaps.
REFUSALS.md and api_signatures.tsv regenerated.

Verified at this commit: cargo fmt, refusal_surface.py, signatures.py --bless and coverage.py
--check; the build, the suites and the lavapipe replay (where the case should read lacks-feature)
run in the lane's check job.
2026-11-19 04:44:17 -08:00
Anees Iqbal 451f6e9900 conformance: the function and library facts' device and options rows on every venue
The new runtime's side refuses two fields of these facts: the device relation of a library and
a function (the consumer's own, device), at 24 cases' case/facts/device, and a function's options
(memory2's libs census 11-19, m3-max-51379..51431: every function descriptor of the 17 streams
has options 0), at 22 cases' case/facts/options. Each row is one m3-max-51389 replay on lavapipe
listed as unlisted, every other field of these cases comparing exactly there; the facts reach no
device, so the rows hold on every venue. The coverage document counts them by field.

Verified at this commit: the rows are those m3-max-51389's rt lavapipe replay lists (46, site and
answer as listed); coverage.py --check.
2026-11-19 04:44:17 -08:00
Anees Iqbal ad7c6b4fa8 conformance: binary archives are the consumer's own, the descriptors' binaryArchives field and the archive programs
reims keeps binary archives in its guest bundle: the device's MTLBinaryArchive holds only each
added function's lookup key, serializing and loading use the bundle's own file format, and no
message reaches the host, so neither runtime is ever asked. The planner ruled them the consumer's
own (ConsumerObject::BinaryArchive, "MTLBinaryArchive, binaryArchives", named in rt's README).

Rows on every venue: the six pipeline descriptor cases' binaryArchives field, which the new
runtime's side refuses, and the six binary-archive cases' archive programs (case/program), which
it leaves at the trait's default. The dynamic-library cases and library-from-data share the
archive program and are not archives, so they keep no row.

Verified at this commit: cargo fmt and coverage.py --check; the ledger and the replay run in the
lane's check job.
2026-11-19 04:44:16 -08:00
Anees Iqbal df4903b21a conformance: the new runtime's side answers function and library facts, the device and options refused fields
RtSide left function_facts, function_facts_from_descriptor and library_facts at the trait's
default, so 24 cases ended refused on rt (15, 7 and 2 on the earlier whole-set run). The
runtime's library is the translator's and a function is the translator's function of it, so the
side reads each getter as a consumer holding them does: the library's functions a program makes by
name (a Core Image kernel library's extern functions left out, by the translator's own stage), its
type and install name; a function's reflected properties and constants dictionary, through
Function::properties, or Function::specialized_properties for a function made with constant
values, whose dictionary the translator states is empty, as Metal answers it. The old runtime's
side shares the attribute and constant-value helpers, which move into function_facts.

FunctionFacts takes options and the device relation as Fields, and LibraryFacts the device
relation. The runtime keeps no device on a library or a function, so device is the consumer's
own, as the planner ruled (ConsumerObject::Device, named in rt's README); a function keeps no
MTLFunctionOptions, so options is refused, its rows waiting on memory2's every-stream count of
function options. Failure derives Eq, so every facts type keeps its Eq.

Verified at this commit: cargo fmt only and coverage.py --check; the build, the suites and the
lavapipe replays run in the lane's check job, whose replay names the device rows' sites.
2026-11-19 04:44:16 -08:00
Anees Iqbal f297ec44b6 conformance: the new runtime's side answers the rising-value probe, its label a refused field
RtSide left Side::shared_event_rises at the trait's default, so shared-event-rising-value ended
refused on rt. The probe's host sets, GPU signals and bounded host waits are the runtime's shared
event's, made as the old runtime's side makes them; the runtime keeps no label, so EventRise's
label becomes a Field the side refuses (the consumer's own, label), with its every-venue row, and
the coverage document counts EventRise by field.

Verified at this commit: cargo fmt only and coverage.py --check; the build, the suites and the
lavapipe replays run in the lane's check job.
2026-11-19 04:44:16 -08:00
Anees Iqbal 4913a812df conformance: the coverage document counts a field-by-field facts type by field, and rt's label rows
A facts call running said nothing of which of its fields were compared, so a field the new
runtime's side refuses read as covered beside its call. The coverage document gains a section
that counts each facts type answering field by field (a struct with a crate::case::Field field)
by field: its fields, the ones a side may refuse, the leaf each records at (read from the type's
node), and the new runtime's ledger rows that refuse each at that leaf, of the cases whose module
calls a Side method answering the type. A Field whose node records it at no leaf this can read
stops the generator.

The six pipeline descriptor cases' label rows (pipeline-descriptor-* and compute-descriptor-*,
every venue: the consumer's own, label) go into known-gaps-rt.tsv. Their binaryArchives rows wait
for memory2's every-stream count of binary archives, which their head will cite.

Verified at this commit: coverage.py --check passes on the regenerated document; the build, the
suites and the lavapipe replays run in the lane's check job.
2026-11-19 04:44:16 -08:00
Anees Iqbal b683148a41 rt, translator: the identity domains give a SIMD-group's threads no lockstep order
What: under the identity domains (the new runtime's profile) the translator no longer inserts the
barriers that make Apple's SIMD-group lockstep explicit (`lockstep::order`): `OrderKey::of` is
`None` there and `ordered_entry` takes the specialized entry as it is. The resident-table domains
(the old runtime's) keep the order until the cutover. With no lockstep barrier on the new
runtime's path, its one-row machinery is dead and deleted: `Compiled::rows`, `pipeline::one_row`,
`encoder::Module::Rows`, `keeps_rows` and `choose`'s `rows`, the `OneRow` and `RowLockstep` arms,
and the translator's `CompiledFunction::runs_lockstep_barriers_in_rows` with
`KernelFacts::lockstep_in_rows` (the API signature table; the version numbers rise in the
branch's last commit).

Why: documented Metal orders the threads of a SIMD-group only through barriers and atomics; the
Metal Shading Language calls two of them that conflict between barriers a data race. The order was
an emulation of undocumented Apple-GPU behaviour (owner's rule 1). Its barriers made 1,443 of 5,368
distinct kernels of the recorded streams observe their threadgroup partition, every pair of them
unproven, and they stopped partial-threadgroup dispatches the variant cannot run (rt's frame-320 and
frame-335 refusals of the 30-wide kernels). docs/API.md's accepted differences gain one entry, the
conformance case `simdgroup_lockstep` leaves its output words unchecked against it, and
CONFORMANCE-COVERAGE.md and REFUSALS.md are regenerated.

Tests: the identity-profile one-row test becomes `the_identity_domains_order_no_lockstep_pair`
(barriers under the default domains, none under the identity domains, the partial variant in
tiles); the harness's cells test keeps the old domains' one-row facts and adds the identity
domains' none; rt's one-row tests and the row-lockstep tree test go, and `row_cells` runs every grid
on its tiles' pipeline made with the state.

Verified: cargo fmt; coverage.py and refusal_surface.py regenerated. Clippy and the suites run on
the check job named when the branch is handed over.
2026-11-19 04:21:14 -08:00