Commit Graph
1711 Commits
Author SHA1 Message Date
Anees Iqbal 2fe8ac55c1 matrix: a host-time row past its limit by less than old's own move is VOID for the round
The frozen arm's second rule, beside FROZEN_DRIFT (the planner's ruling of 2026-11-19, reading
(a)): a row judged by its host time, and not by re-timed pairs, whose excess over its limit
(ratio over limit, less 1) is smaller than its own old time's move from the base in the round
is VOID, since the old runtime's drift alone could carry it there. GPU-time rows and rows judged
by their re-timed pairs are never voided by it. Neither rule makes a row red; the paired re-time
judges a red row.

harness_budget parks such a row as VOID with its excess and the move; the report's table reads
VOID for it (over_lines, through excess_voids); each leg's lines name the rows each rule voided
(print_leg). docs/VALIDATION.md states the rule.

The venue-wide reading was withdrawn: the frozen arm's largest moves sit on cold creation rows
(create_4KiB/device_first +88% on one leg of 7cda47f536) and would void nearly every host-time
row.

Verified: test_a_host_time_row_past_its_limit_by_less_than_old_s_own_move_is_void, in the
matrix unit job named in the next commit or the landing message.
2026-11-19 00:58:05 -08:00
Anees Iqbal c8e65bd9cb REPLAY-STREAM.md: the report's textures over buffers line 2026-11-19 00:49:43 -08:00
Anees Iqbal 01d40ad5fc replay: a descriptor-form no-copy buffer inside a recorded block is a buffer of it; others import
The product's no-copy buffers are not all imports. A newBufferWithDescriptor: with noCopy whose
recorded address and length lie inside a live block's recorded range (m2v.newBlockWithLength:
storageMode:) is the program's buffer in that block's storage, a pool buffer on rt; it now plays
as a buffer of that block at that offset, as m2v.newBufferInBlock:offset:length:options: does
(the in-block buffer path is one method both use), its bytes at its making put there first. Only
a descriptor-form one outside every block (the program's own no-copy memory) and the bytes form
(the host's own buffers in the recordings, never the program's) go through the import.

The backend keeps each live block's recorded range (imports::NoCopies) and counts the three
kinds; the report's no-copy buffers line replaces the no-copy imports line. REPLAY-STREAM.md says
which plays how. The no-copy device test adds a block recorded at an address and a
descriptor-form buffer recorded inside it: it reads the bytes written into the block there, and
the line counts it in the block, beside one descriptor-form and one bytes-form import. Verified
so far: nothing; the build and tests run in the check job.
2026-11-19 00:49:42 -08:00
Anees Iqbal 4521865fe5 rt: a stored slot bound to a texture with no storage element is Gap::StorageElement
A draw or dispatch whose function writes a texture slot, or reads one through
its storage image (access::read_write), bound to a texture made for shader
writes that has no storage element, dropped the writes and read zeros. Such a
texture is one whose format the device does not store through a storage image
without a format (the 8-bit sRGB formats, RGB9E5Float or BGR10A2Unorm where the
device lacks their storage), or holds through a view of another (A8Unorm in
red, the extended-range formats).

That draw or dispatch is now refused with Gap::StorageElement { slot,
pixel_format }, found where the swizzled read_write gap is found: at the
dispatch's bind check and at the draw's Facts::find. Which slots count is the
bound function's own access (a write, or a storage read), not the texture's
ShaderWrite usage bit. A texture made without ShaderWrite (and not of Metal's
unknown usage) is outside documented Metal when written, and is not refused.
A texture an argument buffer reaches by its resource ID is not seen at the
bind; its writes stay dropped, recorded in the runtime README's known gaps.

The refusal stands until the alias storage element lands: a view of the
nearest format whose storage Vulkan requires of every device, with the
translator's conversion.

docs/REFUSALS.md regenerated; api_signatures gains the variant.

Test: storage_element::every_device_refuses_a_stored_slot_bound_to_a_texture_
with_no_storage_element binds a 2x2 RGBA8Unorm_sRGB texture to a write slot
and a read_write slot, and expects the gap exactly where the device's optimal
tiling lacks STORAGE_IMAGE with STORAGE_WRITE_WITHOUT_FORMAT, a dispatch
elsewhere, and a read slot dispatching everywhere.
2026-11-19 00:48:41 -08:00
Anees Iqbal 5250b8dd7b rt: the over-copies over imported blocks are counted on their own side
Metrics::over_copies_imported and Metrics::over_copy_bytes_imported count the copies between a
texture over a buffer and its image of its own where the bytes shaders reach are in an imported
block (host memory or a dma-buf), beside over_copies and over_copy_bytes, which still count every
such copy; the rest are over the runtime's own blocks, where the device's linear image does not
take the texture. One mechanism: OverCopy carries whether its buffer's bytes are imported, and
Counters::over_copied adds the imported side where it is. A first-boot report can then read the
imports' copies alone, and a play the pool buffers' copies (total less imported).

The api_signatures rows, the doc lines (Metrics, over.rs, the README) and the player's per-frame
counters carry the two. Tests: copy_over's device test asserts its texture over a buffer in a
taken block moves neither imported counter; the import test asserts every copy of its texture
over an imported block counts on the imported side, its texels' bytes each; the player's no-copy
device test asserts its one copy is imported. Verified so far: signatures.py --check; the build
and tests run in the check job.
2026-11-19 00:45:36 -08:00
Anees Iqbal 324cfb72cf replay: the new runtime's player imports no-copy buffers' memory; rt counts over-copy bytes
Both no-copy creators (newBufferWithBytesNoCopy:length:options:deallocator:, and
newBufferWithDescriptor: with noCopy) now make their buffers over zeroed host pages of the
player's own, each imported as a block of its own through rt's import_host_memory, as the
product imports the program's pages; the import's release frees the pages once the runtime has
freed the import. A texture over such a buffer is then the runtime's counted copy, so a play's
frames count those copies. A device without host-memory import refuses a no-copy buffer by name.
Two-copy forms keep their second copy: the import holds the CPU's copy where the runtime keeps a
GPU copy, and the copy shaders reach where the player keeps the second copy itself. Release and
command-buffer use tracking now cover a buffer with no place of its own but a device copy or an
aside.

rt gains one deterministic metric, Metrics::over_copy_bytes: the bytes of the copies between a
texture over a buffer and its image of its own, still counted in bytes_copied
(Counters::over_copied adds all three; the now unused Metric::OverCopies is gone). The player's
per-frame counters carry it, its drop gauges and live gauges carry rt's imports gauge, and its
report gains a no-copy imports line.

Tests: rt's copy_over device test checks each copy adds the texture's bytes to both byte
metrics; a new rt_replay device test plays both creators, a texture over the first, a blit of
the texture checked against the stream's bytes, one over-copy of 64 bytes, the imports line and
the imports gauge at zero at device drop. Verified so far: signatures.py --check passes; the
build and tests run in the check job.
2026-11-19 00:14:01 -08:00
Anees Iqbal 4a393990fa rt: a presenting command buffer is scheduled once its submission passed vkQueueSubmit2
What: the planner's change to the presenting design, and its additions.
- Scheduled means, for a command buffer that presents a drawable, that its submission has passed
  vkQueueSubmit2: the submit thread no longer schedules it as its last segment joins the group
  (the group goes at once anyway), but in submit(), between queue_submit2 and
  core.done.submitted, which is where the completion thread first learns of the batch
  (complete.rs, Done::submitted). Its status, kernel times, scheduled handlers and
  wait_until_scheduled all follow the call, with no window and no wait across threads, and its
  scheduled handlers still run before its completed handlers. A failed submission schedules
  nothing: its handlers run as it retires, as an ended command buffer's do. The split wait
  (CbState::signal_unsubmitted) is gone.
- A present from the command buffer's own scheduled handler is valid now; the docs still say to
  present from the consumer's thread, as the handler runs on the submit thread.
- Several drawables in one command buffer each signal their own semaphore; the same semaphore
  twice is Refusal::DrawableSemaphoreRepeated (new), the same drawable twice
  Refusal::DrawableNotAcquired.
- The Safety texts of the three unsafe calls name the Vulkan rules the runtime cannot check (the
  image is that swapchain's; `ready` unsignalled with no signal or wait pending; the swapchain not
  destroyed while in use).
- The README's "Destroying a swapchain": which completions and drops come first
  (VUID-vkDestroySwapchainKHR-swapchain-01282); views may outlive the image, as Vulkan's object
  lifetime rules let a child of the device outlive the image it views.

Tests: the render test's second frame presents from the scheduled handler, the first and third
from the test's thread beside a handler that sleeps 100 ms; both drawables' teardowns follow the
guide, destroying the stand-in image before the views go; a new test presents two drawables from
one command buffer and checks the two refusals. Not yet run: potluck jobs next.
2026-11-19 00:08:46 -08:00
Anees Iqbal e5157492d7 rt: drawables' textures over a swapchain's images, their acquire, and a present that signals the consumer's semaphore
What: the two presenting pieces the new runtime lacked, so a consumer can present on the
runtime's own device.
- Device::new_drawable_texture (unsafe): a texture over an image of the consumer's swapchain,
  checked against the swapchain's create info (2D, one level, its extent and one layer; the format
  the runtime holds the pixel format in; usage holding the texture's, transfer included). Its home
  layout, views, set 1 elements and hazards come from the existing plan (form()). The image is
  never destroyed by the runtime: Backing::Drawable, and the reaper frees only the views.
- Texture::drawable_acquired (unsafe): re-arms the existing homing, so the upload of the next
  submission moves the image home ahead of every later commit; from UNDEFINED the first time and
  from PRESENT_SRC_KHR after a present (texels kept).
- CommandBuffer::present_drawable (unsafe): at commit the last segment's end barrier also moves the
  image home -> PRESENT_SRC_KHR, and that segment's submit info signals the consumer's binary
  semaphore beside the progress semaphore; the group goes at once, as an event signal's does.
- wait_until_scheduled of a presenting command buffer returns once its submission passed
  vkQueueSubmit2: rt marks a command buffer Scheduled, and runs its scheduled handlers, before the
  submit, so a present made after the wait could otherwise wait on an unsubmitted binary signal
  (VUID-vkQueuePresentKHR-pWaitSemaphores-03268), on the shared and on the reserved present queue.
- Refusals with their basis: DrawableDescriptor, DrawableFormat, DrawableUsage, NotDrawable,
  DrawableAcquired, DrawableNotAcquired. docs/REFUSALS.md regenerated, api_signatures blessed
  (9 records added, none removed or changed). The README's presenting section replaces the
  "not built yet" lines, with its known gaps (no acquire semaphore; no present from the presenting
  command buffer's own scheduled handler; a presenting command buffer that never runs leaves the
  image acquired).

Tests (src/tests/present.rs, device cfgs, validation layer): an image made as a swapchain's
stands in for one; three frames of acquire, pass, present and a stand-in present that waits on
the semaphore on the presenting queue and copies the image out of PRESENT_SRC_KHR, for a
render-target and a shader-read drawable; the presenting command buffer's sleeping scheduled
handler must have returned before wait_until_scheduled does; each refusal. Not yet run: built
and run in potluck jobs next.
2026-11-19 00:08:18 -08:00
Anees Iqbal 7cda47f536 matrix: an owned row fails only 3% past its owned ratio; a one-pass outlier is timed again
An open record in status.tsv now names the ratio its row was owned at (the new `owned` column,
filled for the existing entries from the matrix note of b0c08e51b5). The harness budget names a
row past its limit that an open record holds and fails nothing while the ratio it is judged by,
after its re-time, is within 3% of the owned ratio (results.OWNED_WORSE); more than 3% worse, the
row fails its leg again. A known gap's row fails only past a ceiling a ruling gave it
(HARNESS_CEILINGS), as before; one without a ruled ceiling is listed and fails nothing. The
report's table shows the owned ratio and whether the row is within it, and after the table names
every open record and gap whose rows are within their limits on every leg of their card that
timed them, for removal (results.entries_within).

A cross-GPU outlier of a harness row's time on the new runtime no longer fails a leg from one
pass: once every leg is in, the legs with one have their harness timed once more (Run.retime: a
node's legs in turn, the nodes at once, each job holding its node alone), and an outlier fails
only where both passes agree (results.time_outliers with the first pass); one that only one pass
has is parked and named. Outliers of other records fail at once, as before.

Verified: the matrix's unit tests (test_results.py, test_matrix.py), run from scripts/matrix in
a potluck job; new tests cover the owned verdicts (within, worse, re-timed, a first take), the
gaps with and without a ruled ceiling, the removal list, the two-pass outlier rule and the
re-time's jobs.
2026-11-18 23:45:49 -08:00
Anees Iqbal 2db8331d56 command-replay: the new runtime's gauges at device drop go out as the matrix's lines
After the play, the new runtime's backend ends its device (NewRuntime::end) and now hands back
what it read once the device dropped (Ended: every rt::Gauges field by name, threads as the
slots still held, whether all read zero, whether it quiesced). command-replay writes one line per
gauge into the report, "M2V-MATRIX gauge replay-rt/device/GAUGE@drop N", the matrix's own record
form (scripts/matrix/results.py's RECORD pattern; its rule fails a gauge not 0 at @drop), so any
play job's output can be checked by that rule. The teardown error now names only the gauges not
at zero. The old runtime's counts end with its device, so its plays print none.

Tests: a unit test of the lines' form and the error's naming; the rt device test of a play that
ends with a command buffer held asserts every line is "M2V-MATRIX gauge KEY@drop 0". The stream
guide's report section says so. Checked by the lane's check job (named in the report to main).
2026-11-18 23:41:05 -08:00
Anees Iqbal feec58e2f5 rt: a texture over a buffer in an imported block is the counted copy, on every device
replay's census C: the window server (b3) makes 425 textures over its no-copy buffers, and every
no-copy buffer is now an import, so refusing them (Gap::TextureOverBuffer in d335594515) would
refuse the window server's textures. They take rt's existing copy form instead: an image of its
own, which the device copies the buffer's bytes into before the submissions that use it and back
after a command writes it, counted in Metrics::over_copies. The buffer stays the import itself.

The runtime makes no image in imported memory. Such an image would be made for the import's
handle (VUID-vkBindImageMemory-memory-02728), so in the undefined layout
(VUID-VkImageCreateInfo-pNext-01443). An acquire from VK_QUEUE_FAMILY_FOREIGN_EXT is not used: it
needs a matching release (7.7.6), which host writes do not make (host memory imported by its
address is shared with the host as host access), and it leaves an aliasing resource's contents
undefined (7.7.6). Whether an in-place form exists stays open with the planner until the copy's
cost is measured.

- check_over answers the copy for a buffer in an imported block; Gap::TextureOverBuffer's doc
  goes back to its old cases; new_texture's doc and the README say how such a texture is made,
  and the README records it as a known gap.
- Tests: the import device tests run on every platform (host memory from std::alloc; the
  shared-file mapping test unix-only), so the Windows UHD leg runs them. A texture over imported
  host memory is copied on every device, reads the host's own bytes, its writes reach the host,
  and both copies count in over_copies.
- REFUSALS regenerated for the import limits (the rebase took development's at d335594515).

Verified: nothing yet; the check job and the device legs follow.
2026-11-18 23:38:06 -08:00
Anees Iqbal bc6dc40a14 player: the old runtime plays a recorded heap as its buffers and its textures apart
On the old runtime's player, a heap with a recorded range is now made by what the stream places
in it (read ahead), whatever its type:
- its buffers go in a heap at the recorded address and of the recorded size, each at its
  recorded offset, never laid out again (a pinned span never grows);
- its textures go in a heap outside the pinned space, laid out for the runtime's sizes as the
  texture-only rule did. It is one heap, so textures placed at one offset still share.
Buffer-only = the pinned heap alone, texture-only (or nothing placed) = the outside heap alone,
mixed = both. Backend::holds_no_buffer becomes Backend::split_heap(heap, HeapSplit); the old
backend holds a split heap as Object::Heap(buffers' heap, textures' heap), and useHeap: uses
both. A buffer the runtime refuses at its recorded offset in its heap now stops the play typed
(PlayError::Unpinned with the runtime's reason) instead of as a Runtime error.

Why: u4's old arm stopped at f1033 on mixed heap #188906 (4 MiB placement, 2600 buffers and 1000
textures over its life): the relayout grew it for the runtime's texture sizes, and the pinned
heap's grown span met #188909, recorded 0x8968 bytes past the heap's Metal span. u2 and u3 carry
the same heap twice each, u4 again at f1059.

The report line becomes "pinned N of N; K heaps' textures outside; S textures whose recorded
range (by the runtime's texture sizes) met a live buffer's". S comes from the read-ahead: a
texture's range is the heap's recorded address plus its offset for the runtime's size answer
(the stream holds no texture size), a buffer's its recorded range; reported, not a stop. The
heap code moves to replay/heaps.rs (relay, placement helpers, HeapSplit, Overlaps).

Safe by census (jobs 50282-50286, every stream on five nodes, 29 names): every heap is a
placement heap; no call takes a heap as receiver except the placements, none names a heap as an
argument, and no heap or size getter is recorded; the only calls on heap resources are
m2v.privateBytes on heap buffers and texture views of heap textures, neither compared. The
automatic-heap half rests on its unit test, as REPLAY-STREAM.md now says.

Tests: unit tests for the three shapes (textures alone, buffers alone with an alignment that
would move them, mixed with a larger texture and a met buffer) and for automatic heaps; a
lavapipe device test of a mixed heap whose texture the runtime makes larger, with a buffer
pinned right past the heap's recorded span that keeps its address. The negative control (no
split told, the whole heap relaid) must fail them; the check job and its inner codes are named
in the report to main.
2026-11-18 23:34:38 -08:00
Anees Iqbal b28b4975b5 matrix: the GPU legs run the replay player's stream device tests; status rows lose closed owners
The GPU legs' archive held metal2vulkan-rt alone, so the replay player's
stream device tests (metal2vulkan-validation's runtime_lane::replay_streams,
17 on the old runtime, and runtime_lane::rt_replay, 24 on the new) ran on
lavapipe only. A break in the player or a runtime's stream path that only a
GPU shows waited for a lane's play of a recorded stream to find it, as the
old arm's pin stop did. The archive now holds the validation crate too, and a
leg runs the runtime's tests and those two modules (DEVICE_TEST_FILTER). The
Windows leg is unchanged until the validation crate is shown to build there.

status.tsv, by the planner's ruling of 2026-11-18:
- 10de:1e87 frame_5cb is a gap row: the runtime guide's known gaps carry it
  (crates/metal2vulkan-rt/README.md, NVIDIA's latency per submission).
- 8086:a7a0 frame_5cb and 10de:2204 create_state/first are within their
  limits; their closed lanes' names are cleared (a row gets an owner when it
  goes over).
- identity's rows wait for their card's native table, the guest-visible test;
  "Iris swing unresolved" was stale.

Verified: see the check job named in the landing message (unit tests of the
matrix script, the archive built with both packages under --cfg m2v_gpu, the
filter's selection listed, and the selected tests run on a GPU).
2026-11-18 23:14:02 -08:00
Anees Iqbal 1ee16e6a0f command-replay: every report line, the frame lines among them, goes to the standard error too
identity's scripts lost 50152's record when they deleted the job's temporary directory, where
report.txt lay. The planner ruled that the player prints each report line and each frame-end line
to stderr as well as to report.txt, so no script can lose them.

ReportFile, the one writer of report.txt, now implements Write. Each write goes to the file and
then to stderr, and the player's frame lines go through it (with_frame_lines takes the report
rather than its file). A failed stderr write never fails the file's. REPLAY-STREAM.md section 10
and the binary's docs say where the lines go.

Test: the range test's helper runs command-replay and asserts that its stderr carries every
report.txt line, in order. All its plays stop before a device opens, so no device is needed.
2026-11-18 22:53:43 -08:00
Anees Iqbal 331ff7bcba player: the old runtime makes a heap the stream places no buffer in outside the pinned space
glbench-3090-r4's old arm stopped at f198: buffer #22759, pinned at 0x4020086d8000 (32 KiB past
heap #22754's recorded end), met the span the old runtime held for #22754. #22754 is a placement
heap that holds six RGBA16Float textures and no buffer. The player lays placement heaps out again
for the runtime's texture sizes, and grew it from 2 MiB to about 2.5 MiB; pinned at its recorded
address, the grown heap held #22759's pages. In Metal the two never meet.

The rule (the planner's): on the old arm a heap is pinned only where the stream places a buffer
in it. A texture has no address and a heap answers none, so no address the program holds lies in
a heap without buffers, and pinning it buys nothing. The read-ahead finds those heaps from the
stream alone, never from the runtime's size answers or what the space holds, so the old arm's
address layout is the same on every card. The player tells the backend before the making
(Backend::holds_no_buffer). The old backend makes the heap outside the space, and the address map
keeps its recorded range at its recorded address, so the address census is unchanged. A heap that
holds a buffer keeps its recorded address and the typed stop where its grown span meets another
pin.

The report's pinned line now says "pinned N of N; K heaps without buffers outside: ...".
REPLAY-STREAM.md sections 5, 9 and 10 say so.

Tests:
- a_heap_without_buffers_is_made_outside_the_recorded_addresses (player, no device). The test
  backend pins. A texture-only heap is told and made outside; a heap with a buffer, and its
  buffer, are made at their recorded addresses. A word into the outside heap's range is still
  counted, and no word moves.
- a_heap_without_buffers_leaves_the_next_pin_its_address (old runtime, device). A 64-KiB pinned
  heap holds only a 256-KiB texture, and a buffer is pinned at the first granule past the heap's
  recorded span. Without the fix the grown heap's span holds the buffer's and the play stops.
2026-11-18 22:52:47 -08:00
Anees Iqbal a3ff94f510 replay: the escape note (m2v.bufferEscaped) and a stop on a written word into a noted buffer
The recorder will note a buffer whose address may escape into the program's memory: once in the
buffer's life, at the first gpuAddress read (kind 0), argument-encoder write (1), gpuResourceID
read of a texture over it (2) or residency-set add (3); the whole buffer escapes. No stream
carries the note yet.

The player now reads m2v.bufferEscaped: the receiver must be a made object and the one argument
a kind from 0 to 3, else the stream is invalid. Once a buffer's note is read, a written word that
looks like an address (the census's aligned words) whose value lies in that buffer's recorded
range stops the play with PlayError::NotedWord {target, offset, value, buffer, kind}. Moving such
a word is not built: no stream exercises it, and the move gets built with the first stream that
does. AddressMap::noted_word finds the word at any nesting level. The lookup runs only once a
note was read, so a stream without notes pays nothing for it.

The report counts the notes (Report::escape_notes); the addresses line ends "the stream predates
the escape note" where there are none, "escape notes N" otherwise.

Test (unit, a synthetic stream): a note, then a write of a word into the noted buffer stops,
naming the word; the same kind of word into a buffer with no note played as written before it;
a kind past 3 and a note of an unmade object are invalid streams. docs/REPLAY-STREAM.md section 5
holds the record and the stop, section 10 the line.

Verification: the replay checks run as a potluck job on this commit.
2026-11-18 22:02:15 -08:00
Anees Iqbal d2834389c7 replay: written words play as recorded on both runtimes; a census counts the address-looking ones
The player rewrote every 8-byte word of written bytes whose value lay in a live recorded range.
On a stream recorded before the escape note a word's value cannot tell an address from data,
and on u4 that rewrote two 32-bit indices of an index array into an address of the play, which a
kernel later read through out of bounds (the rewrite-off control played u4 whole with no fault).

Now no written word moves on its value, on either runtime:
- The address map's word pass is a census that writes nothing (AddressMap::census). It counts
  address_looking_words (aligned 8-byte words in a live range) and misaligned_address_words in
  the same bytes as before: writes, copied contents, guest-RAM copies and Private bytes before a
  dispatch into objects that answered a gpuAddress, and set*Bytes data. Both are stream-fixed,
  equal on both runtimes.
- What moves are typed address arguments (tag 8), through the map: relocated_words now counts
  only those that moved, so it is zero on the old runtime, whose ranges are at their recorded
  addresses.
- unrelocated_writes is deleted: no written word is relocated anywhere, so it meant nothing.
- A Private range's bytes after a dispatch are compared as recorded.
- The report's relocation line becomes "addresses address_looking_words=N
  misaligned_address_words=N address_arguments=N relocated_words=N differing_ids=N: written
  words play as recorded; the stream predates the escape note".

Tests:
- unit: written words play as recorded and are counted; a typed address argument moves with its
  object (and one in no range stays); guest-RAM copies and copied contents play as recorded;
  the census counts by alignment.
- device, rt: a data word in a live range plays as written (sha check); the census is the same
  on the old and new runtimes (and the old pinned both objects).
- The rt granule test read the runtime's addresses through relocated words; it now checks the
  places line's slack (each place spans its length rounded up to its recorded granule).
docs/REPLAY-STREAM.md sections 5 and 10 and docs/VALIDATION.md say the new form.

The escape note (m2v.bufferEscaped) and the stop on a word into a noted buffer follow in their
own commit.

Verification: the replay checks (clippy in three configurations, replay unit tests, the replay
device tests on lavapipe, rustdoc) run as a potluck job on this commit.
2026-11-18 22:02:15 -08:00
Anees Iqbal 43ef0ce7de conformance: tessellation-rendered-patches, triangle patches drawn into a target
The suite's tessellation cases read the tessellator's domain points with
rasterization off; none renders a patch. This case draws the owned fixture
tess_rendered_patches (a triangle patch of three control points fetched per
patch control point, a colour fetched per patch and passed flat) into an
8 by 8 RGBA8Unorm target under a recorded stream's patch-draw state
(fractionalOdd up to 64, factors per patch, counter-clockwise), with the
factors 8 bytes into their buffer. Two passes: `drawn` draws patches 0 and 1
(patch 1's zero edge factor culls it), then patch 3 alone from patch start 3;
`back-culled` culls back faces and draws all four, where patch 3 is patch 2
mirrored. Every texel is 0 or 255 per channel and no slanted edge meets a
texel centre, so the answer is exact whatever the tessellator's inner
points.

Recorded on the M3 Max (macOS 27.0.1) in job m3-max-49694, with its times;
a test holds the recorded texels to the module's description of Metal's
answer. The case lands without a cost record: a cost record is a whole-set
measurement, and `cost --alone` folds into one that does not exist yet.
docs/CONFORMANCE-COVERAGE.md regenerated.
2026-11-18 22:00:55 -08:00
Anees Iqbal 16f750a424 replay: the old runtime's player makes every recorded range at its recorded address
The player's old backend made each object where the runtime had room and relocated every
8-byte word that lay in a live recorded range. A data word whose value happened to lie in one
(two 32-bit indices in a pixel-sized index array) was rewritten into an address of the play,
and a later kernel read through it out of bounds.

Now the old backend makes every object that answered a gpuAddress at that address
(AddressPlacement::At): device buffers of every making form, blocks and heaps, the
descriptor's pinnedGpuAddress aside, so heaps take their answer too. Every other object, and
the player's own staging, readback and host buffers, go Outside ([2^47, 2^48), past every span
a pin can take). A refused pin, or an object made at another address than it recorded, stops
the play with PlayError::Unpinned naming the object; no other placement is tried. The address
map still runs, with each range's base its recorded address, so it moves no word, every
address argument plays as recorded, and relocated_words and the other stream-fixed counts stay
equal across runtimes. The report adds "pinned N of N".

The new runtime's backend is unchanged (Backend::places_at_recorded defaults to false).

Tests (device, old runtime): the pointer-chain test now also asserts its four objects pinned;
a data word in a live range plays as written; a pin inside another's span stops typed.
docs/REPLAY-STREAM.md sections 5 and 10 describe the form and the report line.

Verification: the replay checks (clippy in both cfgs, the replay unit tests, the replay
device tests on lavapipe, rustdoc) run as a potluck job on this commit.
2026-11-18 21:52:44 -08:00
Anees Iqbal 2e1b543f1b rt: patch draw device tests; the address form reads no word past the factors; the player gives the recorded tessellation state (work in progress)
The address form read one word past a patch's factors where they start at a
multiple of 4; it now reads the first word again there, so every word it
reads holds a factor's byte (the interpreter test trapped on the over-read).

The players gave the recorded tessellation state only where the vertex
function's patchType was not None. The glbench streams' patch functions
answer None (their container has no TESS tag) while their AIR is
post-tessellation, so the state was dropped and the translator drew their
patches under Metal's defaults. The state now goes to every pipeline where it
differs from the defaults; the translator decides from the AIR and ignores it
for a plain vertex function, as Metal does.
2026-11-18 21:04:27 -08:00
Anees Iqbal 4454b23eb4 rt: patch draws in the player, README and refusals (work in progress) 2026-11-18 21:04:27 -08:00
Anees Iqbal 4196a258ec 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-18 20:11:45 -08:00
Anees Iqbal f6d308a628 rt tests: the indirect-place and given-back tests read the pool's one VkBuffer per allocation
What:
- compute::every_device_reads_indirect_arguments_only_at_a_multiple_of_4_of_their_block expects
  Refusal::ArgumentPlace's place as the arguments' byte of the block's allocation (the block's
  offset there plus their place in the block). Vulkan reads indirect arguments at a multiple of
  4 of the VkBuffer, which now spans the allocation, so that is the byte the check reads. The
  refusal's docs, dispatch_threadgroups_with_indirect_buffer's and draw_indexed_primitives' say
  so; docs/REFUSALS.md regenerated.
- large::every_device_takes_no_block_an_encoded_uncommitted_command_buffer_holds asserted that
  the next take of a given-back length gets that range again. The pool takes a zeroed range
  first, so it need not. The test now asserts what it is for: the pool does not hold the block
  while the encoded command buffer holds it, and holds it once the command buffer is dropped.

Why: both expected the per-block VkBuffer that 96340f0f9d deleted. The legs on 96340f0f9d's
archives failed exactly these two on lavapipe (49447), the Iris (49459), the 2080 (49460), the
3090 (49462) and the M3 (49463); nothing else of the pool failed there.

Verified: nothing yet for this commit; its check and legs follow.
2026-11-18 19:17:44 -08:00
Anees Iqbal 2efe8b1582 translator: the fractional-spacing note's measured drivers include ANV
PrecisionNote::TessellationFractionalSpacing's doc and its API.md entry
listed ANV among the drivers not measured. A consumer's tessellation pixel
test (its render_tess_bump device test) passed on its Iris Xe (ANV) leg,
so ANV's fractional partitions matched Metal's answers in that test's
cases. The note now lists RADV (780M, RX 7900 XTX), NVIDIA Turing, ANV
and MoltenVK, and says factors past the device's range are not measured:
no test sets one.

Docs only; no behaviour changes. Verified: cargo fmt --all.
2026-11-18 19:10:23 -08:00
Anees Iqbal f940151891 translator: a fractional partition on the device's tessellator carries a static note
Vulkan leaves where a fractional spacing places its vertices to the implementation ("Tessellator
Spacing": the two shorter segments' length need only fall monotonically with n - f, and their
place on the edge is the implementation's), where Metal's tessellator places them by its own rule.
No note said so: rule 1 wants a static note on an operation whose answer can differ from Metal's.

PrecisionNote::TessellationFractionalSpacing is now recorded on the evaluation stage of every
pipeline of a fractionalOdd or fractionalEven partition drawn through the device's tessellation
stages (Control::notes); the emulation, Metal's tessellator, records none. Its documentation
states the measurement: equal to Metal's by a consumer's device tests on RADV (Radeon 780M, RX 7900
XTX), NVIDIA Turing and MoltenVK; other drivers, ANV and lavapipe among them, are not measured.

The old runtime takes it as a note kind (tessellation-fractional-spacing), validation allows it
unbounded, codec and ARTIFACT_FORMAT_VERSION 542, SEMANTICS_VERSION 2184 (the evaluation stage's
notes change), fast_paths' list, API.md's catalogue; the tessellation engine test expects it on
the fractional cases and on no emulated stage. api_signatures regenerated.
2026-11-18 19:10:23 -08:00
Anees Iqbal 28f2735f52 translator: the tessellation winding's vertex order is measured, on four drivers
Metal's clockwise output winding maps to VertexOrderCcw and its counter-clockwise one to
VertexOrderCw. The control stage's docs, PrecisionNote::TessellationWinding and API.md called
that an unobserved reading of MoltenVK's mapping. A consumer's device test,
tessellation_states_tessellate_as_metals, now matches Metal's bytes (recorded on the M3 Max) for
both windings on RADV (Radeon 780M, RX 7900 XTX), NVIDIA Turing and MoltenVK; the docs say so,
and that other drivers are not measured. The note stays: it is still recorded on every
tessellation pipeline. Docs only.
2026-11-18 19:10:23 -08:00
Anees Iqbal 4df69ca062 rt: generateMipmapsForTexture:, the device's linear blit of each level, under a static note
web3d calls generateMipmapsForTexture: once in each stream, which the player skipped and counted
(mipmaps 1). It is built as Apple defines the call: each level below the texture's first made
from the level above it, over each slice, a view's levels and slices its own.

- BlitCommandEncoder::generate_mipmaps: one vkCmdBlitImage a level with VK_FILTER_LINEAR, the
  first level read and the rest written whole (their old contents discarded) behind the copy's
  first barrier, one barrier between each level and the next, and the last bringing every level
  home, the last level's writes visible to every later command. A texture of one level records
  nothing.
- Refusal::MipmapFormat for a format Apple defines no mipmaps of (a depth or stencil, compressed,
  YCbCr or integer one: not colour-renderable and filterable); Gap::MipmapFilter where the
  device's format query lacks blits from and to the image's format or its linear filtering,
  where the image holds the pixel format through a conversion, and for a view in another format
  than its image's, whose blit would filter the image's.
- PrecisionNote::DeviceFilteredMipmaps, the static note BlitCommandEncoder::GENERATE_MIPMAPS_NOTE
  carries: the filter is the device's, where Apple states none. The old runtime announces it as
  its existing device-filtered-mipmaps kind; validation allows it unbounded; codec and
  ARTIFACT_FORMAT_VERSION 541, fast_paths' list, API.md's catalogue entry.
- The conformance rt side plays Step::GenerateMipmaps and announces the note; the replay player
  plays the call and its skipped_mipmaps counter is gone (REPLAY-STREAM.md).
- Test: an 8x8 RGBA8Unorm texture of four levels, each level below the first within one code of
  the box of the four texels it halves in the level above as the device left them, its first
  level kept, one submission and the chain's four barriers besides the segment's end; one level
  records nothing; RGBA8Uint is Refusal::MipmapFormat. REFUSALS and api_signatures regenerated.
2026-11-18 19:10:22 -08:00
Anees Iqbal 899270a674 rt: the pool is free ranges with a zero mark; hooks per allocation; one VkBuffer per allocation
What:
- One mechanism. A block given back is a free range of its allocation at once. The kept list, the
  returned fast path, unkeep and the take's wait for the block-maker thread are deleted.
- A take is the first free range that fits whose bytes are all zeroed, else the first that fits,
  in the order the allocations were made. It runs under the pool's lock, with no Vulkan call and
  no hook (Metrics::takes_from_free_ranges).
- A long allocation, which a take longer than 16 MiB made for itself, serves only takes of exactly
  its length. Metrics::shared_long_reuses and private_long_reuses count such takes after the
  first. Gauges::shared_long_reused_bytes and private_long_reused_bytes count the bytes of long
  allocations that hold one.
- The block-maker thread zeroes free Shared bytes that are not clean in 256 KiB steps, the
  allocations in the order they were made (Metrics::free_bytes_zeroed, free_zeroing_nanos). It
  starts no step while a consumer memset runs (Pool::fill, Metrics::zero_steps_held), the rule of
  76c6f5d071.
- Metrics::zeroed_bytes_used counts the bytes of zeroed Shared buffers that a zero mark covered,
  so the buffer's memset skipped them: the block-maker thread's zeroing that a buffer used,
  against Metrics::bytes_zeroed, the consumer's thread's. Per stream, the two decide whether the
  thread's zero steps are worth keeping.
- The hooks are per allocation:
  - BlockMappings::map(&AllocationInfo) runs before any block of an allocation goes out, outside
    the pool's lock: in Device::new for each class's first, on the block-maker thread ahead of
    need (Metrics::allocations_mapped), and inside a take that made its own
    (Metrics::allocations_mapped_on_takes).
  - A refusal frees the allocation, hands out none of its blocks and fails the take with
    Limit::AllocationNotMapped (Metrics::allocation_map_refusals).
  - BlockMappings::unmap(AllocationId) runs before vkFreeMemory, outside the lock. Quiesce and
    teardown go through it.
  - The per-block hook, BlockMappings::unmap(BlockId), is deleted. Its consumer, reims-vgpu,
    promises (its merge batch 232):
      "reims-vgpu's pool calls release_block only after the block's piece is out of the guest's
      address space (the host answered pool_removed; at the device's release the host has
      removed every piece first, as the API requires) and no thread of the device holds it, and
      it never touches the block afterwards, so the runtime may free any block it gets back at
      once, with no call into the consumer."
- BlockInfo carries its allocation's number and its offset there.
- One VkBuffer per allocation:
  - a block's commands reach it through Memory::range(offset), which gives (allocation buffer,
    base + offset);
  - the block's address is set at carve, with no Vulkan call;
  - the per-block VkBuffer, texture blocks' included, is deleted.
- The reserve: the newest idle 16 MiB allocations with free bytes that keep 8 MiB free. With no
  kept blocks, an idle allocation's bytes are all free, so the reserve is one 16 MiB allocation of
  each class at most.
- The README states the contract: the pool's allocations are in the guest's range whole, free
  ranges included; the consumer hands the guest blocks only; a guest kernel that writes a free
  range damages only its own later buffers.

Why: the planner's pool ruling. Each allocation costs a VMM ask once:
- WHPX: about 0.55 ms to map and 0.8 ms to unmap per 16 MiB;
- HVF: 3 us to map and 71 us to unmap;
- KVM: 116-124 us of BQL per ask.
A take from an allocation already made costs no Vulkan call and no VMM ask. The kept list held
blocks by exact length for the device's life and gave their bytes back only through an unkeep.

Tests (memory::on_device):
- each allocation mapped before its blocks go out, on the thread that made it, and a take not
  mapped refused, its allocation freed;
- zeroed bytes taken first, given-back bytes taken as written;
- a long allocation taken again at once, counted;
- idle frees, oldest first, the first fit taken again;
- the long allocation never the reserve;
- the zero mark on a long allocation's free bytes, in steps, and a zeroed buffer over it counting
  the mark's bytes as used;
- the zero hold beside a consumer memset;
- seeded takes with every block's allocation mapped.
The command tests' quiesce and teardown check each allocation mapped is unmapped once, on the
right thread.

Verified: nothing yet; the check job, the device legs and the measures follow.
2026-11-18 19:07:15 -08:00
Anees Iqbal 4cb685e075 matrix: frame rows on a node whose CPU clock follows the load are judged by instructions per frame
On the Ryzen 7 7840HS nodes the cores' mean clock tracked the frame rows' pass time (r = -0.88
over twelve passes of one build on the Radeon 780M, job m3-max-49287), so the host time of a
frame row measures the clock its passes found, and the legs there read VOID or venue unstable on
it. The planner's ruling: on such a node the frame rows of every card it hosts are judged by the
new runtime's instructions per frame, their time kept as a cross-GPU outlier check.

results.CLOCK_FOLLOWS_LOAD lists the CPU by potluck's cpu_model fact, which the leg's note now
keeps (`cpu`). There, harness_budget names a frame row's time and judges nothing on it (the
instructions gate judges it; a latency from idle row by its workload's count), the leg re-times
none of them (RETIME_SELECT's skipre, results.retime_skip), base_spread leaves them out, and
over_rows lists only their counts. time_outliers is unchanged and still judges their time
across GPUs. The verdict line names the rule that judged each row. docs/VALIDATION.md states it.

Verified: PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts/matrix, 70 tests OK
(new: the budget, re-time, spread and over-table reading on and off the listed CPU; the verdict
line's rules; the harness job's skip pattern).
2026-11-18 19:03:54 -08:00
Anees Iqbal a75366dccb rt: the compute encoder pushes the stage-in region a kernel reads
set_stage_in_region (setStageInRegion:) accepted the region and changed nothing, on the reading that no kernel rt dispatches reads it. That reading missed [[grid_origin]] and [[grid_size]]: they read the region without a [[stage_in]] argument. A recorded stream makes a compute state whose kernel reads both, and the old runtime plays it; rt refused the state (Unsupported{IdentityDomains}) until the translator admitted the field. The encoder now keeps the region as its push field's 32 bytes, the origin and the size each a uvec4 with a zero w, as the binder writes them. Every later dispatch writes those bytes where the kernel's StageInRegion field sits (FieldValue::StageInRegion). The interface takes RuntimeFact::StageInRegion. A dispatch of a kernel that reads the region on an encoder that set none is the new Gap::NoStageInRegion: what Metal's kernel reads then is not established, as the binder's MissingStageInRegion says. A [[stage_in]] fetch stays Gap::KernelInput.

The player plays setStageInRegion: on rt. The conformance rt side sets each direct region before its dispatch; the indirect form stays unavailable.

README, the gap's docs, api_signatures and docs/REFUSALS.md updated.

Only a kernel that reads the region copies it into its parameters; any other dispatch passes the encoder's region by reference and copies nothing.

Test: translate's every_device_pushes_the_stage_in_region_a_kernel_reads runs engine/kernel_stage_in's stage_in_region_short. A dispatch before any region is set is Gap::NoStageInRegion. Two dispatches under two regions each store their own origin and size at every thread, and nothing past the grid. The sampling device test still sets a region its kernel ignores. compute's every_device_counts_no_instructions_for_a_stage_in_region_a_kernel_does_not_read counts the user-space instructions of a dispatch of a kernel that does not read the region, with no region set and with the setter called before each, less the setter's own: they agree within 2% and 16 instructions.

Verified: check 49270 (msi): the clippy, rustdoc and host suites above clean; rt's device suite on lavapipe 294/294 (3 skipped), each dispatch reading the region set before it. From its archive, the two stage-in device tests on the RTX 3090 (49414) and the Iris Xe (49415) pass with no validation error; user-space instructions a dispatch of a kernel that does not read the region (a debug build): 3090 40190 with no region, 44013 with the setter before each, of which the setter alone 3942 (so 40071); Iris Xe 36082, 40057 and 4058 (35999).
2026-11-18 18:57:24 -08:00
Anees Iqbal 8f720744ce replay: render encoders' sampler binds with LOD clamps play through the runtime
The runtime binds a sampler state with LOD clamps whose samples read as its own (b7ef04ae97:
each clamp held to [0, 15] equals the state's own held the same way) and answers any other with
Gap::LodClamps, binding nothing. The player now plays the four render clamp selectors (vertex
and fragment, one sampler or a range) through set_vertex_sampler_state_with_lod_clamps and
set_fragment_sampler_state_with_lod_clamps. A bind the runtime answers with the gap is skipped
and counted (skipped_clamped_samplers), and draws are skipped while the slot holds it.

Every clamp bind the census found (both web3d streams: the sampler's own (0, FLT_MAX) and
(0, 1000) over (0, FLT_MAX)) reads as its own, so they all bind. Before this, the player refused
setFragmentSamplerStates:lodMinClamps:lodMaxClamps:withRange: (web3d-780m-r1 stopped at frame
391, web3d-3090-r2 at frame 0); the probe players carried a stopgap that skipped any clamp other
than the sampler's own, which this replaces. The compute encoder's clamp selectors stay refused:
no stream calls them.

Test a_sampler_bound_with_lod_clamps_plays_where_the_runtime_takes_them: (0, FLT_MAX) and
(0, 1000) bind and the draw is checked green; (0, 2) is the gap, counted, its draw skipped.
2026-11-18 18:52:40 -08:00
Anees Iqbal 8cb034077c replay: a compute encoder's setStageInRegion: plays on the new runtime
The runtime's compute encoder takes setStageInRegion: (59bb3634d1): it changes nothing a dispatch
of a kernel without a stage-in argument does, the only kernel it builds. glbench-780m-r1's all8
play (m3-max-49209) stopped at frame 438, call 593644, on the player's refusal of the selector;
the census found 158,349 such calls there and 300,832 in glbench-3090-r2, every one on a kernel
with no stage-in argument. The new runtime's backend now plays it through
ComputeCommandEncoder::set_stage_in_region; the old runtime still refuses it.

Test a_stage_in_region_plays_on_a_compute_encoder: an encoder's region plays, nothing skipped.
2026-11-18 18:52:40 -08:00
Anees Iqbal 39e9e52726 replay: an index is owed only to command buffers that named its object while it held the index
Reims's read of glbench-780m-r1 (frame 381): the guest gives index 1459 to one swizzled view
after another, and the host releases each about 700 records after the next took the index, so
two views are live at 1459 for that span. The player took an object's index from the placement
alone and kept it until the object's release, so a command buffer that named a displaced view
owed 1459, and the placement of view #71001 waited for (then counted) command buffer #70944,
which names no object holding 1459.

Indices now records, per command buffer not yet committed, the index each named object holds at
the naming (it is the object placed there last), and owes those indices at the commit; a command
buffer released uncommitted owes nothing. The released-object bookkeeping (pending users) goes:
a naming already holds its index. The backend's users map keeps buffers only, the one thing
still read from it (Places).

Tests: the Indices unit test gains two live objects at one index (a naming of the earlier one
owes nothing, of the later one owes); device test
a_command_buffer_naming_an_object_after_a_later_one_took_its_index_owes_it_nothing plays the
shape (two live holders, release after reassignment) and expects no wait and no count.
2026-11-18 18:52:40 -08:00
Anees Iqbal 1fe1d69fc0 replay: an ID's low word is compared with the recording's, its high word with the documented word
The planner's ruling on resource IDs: the new runtime's layout stands (index | word << 32,
docs/RESOURCE-ID.md). A recording made on the old runtime holds that runtime's high word, so a
whole-ID comparison reported every texture whose word is not 0 as differing.

Backend::resource_word gives the high word RESOURCE-ID.md's own functions give the descriptor the
backend made the object of: TextureWord::of(pixel format, swizzle) for a texture, SamplerWord::of
for a sampler state. Where a backend gives one (the new runtime's), the player compares the ID's
low word with the recording's and its high word with that word, never with the recording's high
word. Where it gives none (the old runtime's), the whole ID is compared as before. A differing
ID's line carries the word: 'id #N RECORDED PLAYED word WORD'.

Test a_resource_id_s_high_word_is_checked_against_the_documented_word: an ID with the recorded
index and the word passes over a recorded high word of 0 or 1; another index or another high
word is reported with the word.
2026-11-18 18:52:39 -08:00
Anees Iqbal 72152b3d29 rt: pixel-format views over mutable images that list Metal's formats
newTextureViewWithPixelFormat: and its forms of another pixel format were a
gap. glbench makes 1,524 (780M stream) and 2,970 (3090 stream)
BGRA8Unorm_sRGB textures' BGRA8Unorm views; Metal views a texture as its sRGB
sibling with no usage asked (MTLTextureUsage.pixelFormatView: "Don't set this
option if your texture view only converts between linear space and sRGB"), and
with PixelFormatView usage as any colour format of the same bit length
(makeTextureView(pixelFormat:)).

The translator states Metal's rules: metal::format::srgb_sibling (srgb_raw_twin
both ways, ASTC's LDR and sRGB forms, the extended-range pairs),
views_without_usage (itself, the sibling, a combined format's stencil) and
views_with_usage (those, and uncompressed colour formats of the same bytes a
texel by byte_format).

An image lists, its own format first, the formats Metal views its texture as
that the device holds for the usage in a viewed form of the image format's
compatibility class: the sibling always, and with PixelFormatView every such
format. Such an image is MUTABLE_FORMAT with a VkImageFormatListCreateInfo, in
its creation, its format queries (optimal and linear) and its heap size query;
any other image is unchanged. plan() splits into form() (what a texture holds
in its views) and the image's own part, so a view takes form() alone, with no
image query.

A view of another format is built where the image lists it, else
Gap::TextureView{PixelFormat}; a format Metal does not view the texture as is
Refusal::TextureViewFormat, which no longer refuses the sRGB sibling of a texture
without PixelFormatView usage. Its image views take the image's usage that the
view format's features hold (VkImageViewUsageCreateInfo,
VUID-VkImageViewCreateInfo-usage-02274/02275/08931): it has a storage element
only where the image has storage usage, and renders where its format holds an
attachment, else Gap::TextureFormat at the pass.

Tests: the translator's sibling is mutual over every format and its view rules
take and refuse as Apple's pages say; on devices, an sRGB view of a texture
without PixelFormatView usage and an R32Uint view of one with it each read
their parent's bytes, and R16Float and BC1 views are refused.
2026-11-18 18:36:50 -08:00
Anees Iqbal 37fffd39fc replay: the display library line names the sidecar by SHA-256 and git blob id
The planner's condition on the display sidecar: every play states which
display library it ran. The report's display library line now gives the
sidecar's length, its SHA-256, and its git blob id (the SHA-1 of
"blob LENGTH\0" and the bytes). The blob id names the file in the host's tree:
every stream so far holds blob b1aea1f0, 47,426 bytes. The doc also says the
sidecar holds the host's display shaders alone, and that a player makes only
the device's library from source of no arguments from it.

The validation crate takes sha1 0.11 (RustCrypto, MIT OR Apache-2.0; the same
digest family as sha2 0.11) for the blob id.

Test: the integration test expects the 5-byte sidecar's SHA-256 and the blob
id `git hash-object` gives for the same bytes (8d7ffd7e). Verified by the lane
check named in the hand-over.
2026-11-18 18:07:35 -08:00
Anees Iqbal 0ee01c4eda replay: the host's library from source is made of the stream's display library sidecar
webdiv-780m-3's record 11498, newLibraryWithSource:options:error: on the
device with no arguments, is reims's host loading its own display shaders.
The players skipped every library from source, and with it the host's 773
present draws, so both plays of webdiv-780m-3 ended as no verdict. A
program's own libraries reach the stream as data, never as source.

The decided form is a sidecar beside the stream, NAME.display.metallib, like
NAME.range:
- command-replay reads the sidecar (replay::display_library) and gives it to
  either backend (with_display_library).
- The report says so in the line after `range`: `display library the
  stream's sidecar, N bytes`, or `display library none: the host's library
  from source is skipped`.
- Both players make a library from source of no arguments from the sidecar,
  as from data. Any other library from source, or one without a sidecar,
  stays skipped and counted.
docs/REPLAY-STREAM.md sections 1 and 10 state the sidecar and the line.

Tests:
- An integration test reads the line without the sidecar and with a 5-byte
  one; the range test's line positions follow the new line.
- A device test makes a function of the host's library with the display
  library and skips both without it.
Verified by the lane check named in the hand-over.
2026-11-18 18:07:35 -08:00
Anees Iqbal d7156b3ca7 replay: a placement owed to a held commit takes the index without waiting, counted
A placement whose index is owed to a command buffer that no record played so far lets
complete (its event wait is signalled only by a later record) stopped the play with
PlayError::Held. In the recording that order proves the recording device gave the index to the
new object before that command buffer completed: that is its index policy. The player now plays
what the device did: it takes the index without waiting and counts the placement on its own
report line ('indices given while a commit they owe is held N: ...'). The index stays owed to
the held commit. Where the owed commit is not held, the player still waits for it.

PlayError::Held, held_error and HeldBuffer's queue and unmet waits are deleted: nothing reads
them now. Backend::held takes the held command buffers' stream ids.

The rt_replay test that pinned the stop now expects the index taken (16) and the count of 1.
Verified by the check job named in the hand-over.
2026-11-18 18:07:35 -08:00
Anees Iqbal f3f13c87ab 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-18 18:06:33 -08:00
Anees Iqbal b7ef04ae97 rt: a sampler state binds with LOD clamps that read as its own; others are Gap::LodClamps
The replay streams bind sampler states with Metal's bind-time LOD clamps
(`setFragmentSamplerStates:lodMinClamps:lodMaxClamps:withRange:`): web3d on the 780M makes 2,635
such calls and on the 3090 2,627, every one over a state made with clamps (0, FLT_MAX), half of
them binding (0, FLT_MAX) and half (0, 1000); glbench makes none (replay's census). rt had no
such form, so the player skipped and counted the second kind.

A sample's level is clamped into the clamps and then to the texture's levels, at most 14 (Metal's
largest textures have 15 levels), and a level below 0 is level 0. So two clamps read alike where
each bound held to [0, 15] (the translator's LAST_WORD_LEVEL) is equal: in Metal's sampler, in
the device sampler `vk_sampler` makes (Vulkan clamps into [minLod, maxLod] and then to the view's
levels) and in the sampler word. The translator states the rule
(`metal::sampler::lod_clamps_read_alike`); rt's compute encoder (`set_sampler_state_with_lod_clamps`)
and render encoder (`set_vertex_sampler_state_with_lod_clamps`,
`set_fragment_sampler_state_with_lod_clamps`) bind the state as it is where the clamps read as
its own, which covers every call the streams make at no cost, and refuse others as the new
`Gap::LodClamps`, binding nothing (no stream makes one; a variant or a shader clamp is built when
one does). Each range form is a loop of its single form.

Tests: the translator's unit test pins the rule (1000 and infinity over FLT_MAX, -1 over 0 alike;
14, a raised lower bound and NaN not) and that every alike pair gives the descriptor's word, query
level and device lods; a device test binds on the three forms and gets the gap on each; the
sampling test binds its state with (0, 1000) and checks its samples as before. REFUSALS.md
regenerated; the signature and surface tables take the new items. Verified in the job named in the
landing message.
2026-11-18 18:05:44 -08:00
Anees Iqbal aab68d6253 rt: a read_write slot a function only reads is the swizzled-texture gap too
The gap was found from the slot's hazard access, which the translator gives by use: a
read_write slot the function only reads is a read there, so a swizzled view bound to it
passed the check and its read answered the texel unswizzled. The device test caught it on
lavapipe (49090: the read_write read of the view returned no gap).

The translator now states the declared side: TextureSlot::storage, true where the function
declares the slot write or read_write and so reaches a storage image, whose view maps each
channel to itself. rt keeps the slots read through one (storage with a read) for kernels
and for draws, and the gap is found from that list. The cache encoding carries the field
(ARTIFACT_FORMAT_VERSION 540); api_signatures gains the field; REFUSALS regenerated.

Verified: to follow in the build, tests and touched stages.
2026-11-18 18:02:34 -08:00
Anees Iqbal 2012b832c0 rt: a read_write slot bound to a swizzled texture is a typed gap at the bind
Apple defines the swizzle for reads and samples. A write through a swizzled
view, and a render pass into one, store the texels unswizzled: Metal's
documented answer, so that half leaves the README's known gap. A read() of an
access::read_write slot reads through the texture's storage element, which
maps each channel to itself as Vulkan requires of a storage image
(VUID-VkWriteDescriptorSet-descriptorType-00336), and would answer the texel
unswizzled where Metal reads it through the swizzle: a wrong answer, which no
static note covers.

Such a draw or dispatch is now Gap::SwizzledReadWrite { slot }, found with the
bind-time facts (the draw's Facts::find, the dispatch's alignment check), so
the test runs once per pipeline-state or binding change and only for the
translated interface's read-write texture slots. The players count it as they
count every gap.

Test (tests/swizzle.rs, on devices, the owned fixture rrp_swizzled_storage):
an access::read read through a [B,G,R,1] view of (10,20,30,40) answers
(30,20,10,255); an access::write write through it stores (0.2,0.4,0.6,0.8)
unswizzled at each texel; the read_write kernel bound to the view is
Gap::SwizzledReadWrite { slot: 0 } and over the texture itself reads its
texel.
2026-11-18 18:02:34 -08:00
Anees Iqbal 1440a93e6c rt: swizzled texture views, the view's swizzle over its parent's
newTextureViewWithPixelFormat:textureType:levels:slices:swizzle: is
Texture::new_texture_view_with_swizzle. The view's swizzle combines with the
parent's as Apple states it (each channel the view takes from red, green, blue
or alpha is the parent's as the parent's swizzle reads it; Apple's example
[R,G,A,B] over [R,1,1,G] is [R,1,G,1]), so a view of a swizzled texture is
built too and TextureViewKind::Swizzle goes. The view's descriptor holds the
combined swizzle and its resource ID that swizzle's TextureWord.

Metal takes the call whatever the parent's usage: glbench-780m-r1's 128
non-identity views are of textures of shader-write, and most of render-target,
usage. A view takes its descriptor's checks but the swizzle-with-writes
refusal, which Metal makes of a texture's own descriptor alone (prepare's
checks split into checked()). The sampled element takes the combined swizzle;
the storage element and attachment views map each channel to itself, as
Vulkan requires (VUID-VkWriteDescriptorSet-descriptorType-00336, the rendering
attachments' identity VUIDs). A read of an access::read_write texture and a
write through such a view therefore reach the texels unswizzled where Metal
swizzles them (and, recorded by swizzled-storage-*, undoes the swizzle on
writes): a known gap in the README.

The rt player maps the selector and its resourceIndex form; the conformance
rt side makes the requested swizzled views instead of answering unavailable.

Tests: the combination (Apple's example, identity on either side, constants,
a rotation twice); on devices, a view's descriptor and word for Apple's
example, a view without a swizzle keeping the parent's, and a swizzled view of
a shader-write, render-target texture made.
2026-11-18 18:02:34 -08:00
Anees Iqbal 9c40b3cd83 rt: depth tests, writes and bias as dynamic state, under static notes; an unknown store action stores
The render-state lane's depth step (the planner's step 1).

- A depth-stencil state's depth test, write and compare operation are dynamic state, recorded
  where they changed; DrawKind::DepthTest is gone. A pipeline bakes the depth format alone, so a
  change of depth-stencil state or bias makes no pipeline. In a pass without a depth attachment
  Vulkan skips the test, where Metal's documentation states no answer.
- set_depth_bias (setDepthBias:slopeScale:clamp:): the bias and slope scale as given, enabled for a
  draw of triangles where either is not zero and never for lines (Metal biases triangles alone).
  A clamp other than 0 is Gap::Draw of DepthBiasClamp (no stream sets one).
- Static notes, carried by the operation: PrecisionNote::DeviceDepthBias
  (RenderCommandEncoder::DEPTH_BIAS_NOTE: the slope measure, and a fixed-point attachment's unit,
  are the device's; Apple states neither; read from Vulkan's Depth Bias section and Apple's
  setDepthBias page), and PrecisionNote::DepthDenormals (DepthStencilState::precision_note, a state
  that tests or writes depth: every driver measured but MoltenVK on an M4 compares a denormal
  depth otherwise than Metal; RADV and ANV store one as zero). The old runtime maps DepthDenormals
  to its own depth-denormals kind and takes device-depth-bias as a note kind; codec, fast_paths,
  validation's allowance (Unbounded), API.md and ARTIFACT_FORMAT_VERSION 539 follow. No signed-depth
  note: no clear, viewport or upload gives rt a negative or NaN depth, and Vulkan leaves a depth
  past the viewport's range undefined.
- MTLStoreActionUnknown stores (Vulkan fixes the store as the rendering begins); the encoder's
  set_color_store_action, set_depth_store_action and set_stencil_store_action change nothing the
  device does and refuse a resolving action (Resolve). On a tile-based device this stores a
  target Metal would have discarded (README).
- set_triangle_fill_mode, set_depth_clip_mode, set_viewports and set_scissor_rects take Metal's
  defaults (Fill, Clip, one viewport or rectangle) as nothing and refuse the rest, typed
  (FillMode, DepthClamp, Viewports): replay found every stream at the defaults.
- The conformance rt side plays the depth bias, fill, clip and viewport-count steps and announces
  the encoder's notes; the replay player maps setDepthBias:slopeScale:clamp:, the three store
  action setters, setTriangleFillMode: and setDepthClipMode:.
- Tests: a depth attachment cleared to 0.5 with its store action unknown, tested under Less with
  writes, failing at 0.375, passing Greater by its bias alone, every mode setter's refusal, and no
  pipeline made by the state changes; the instructions a depth-tested draw retires beside a plain
  one, printed. REFUSALS.md regenerated, the API table blessed.
2026-11-18 18:02:33 -08:00
Anees Iqbal e3b8d67b5b runtime: a command buffer whose timestamps read unavailable completes, counted, and is no victim
A regression fix in the frozen old runtime. Matrix 749c939440's UHD 630 leg (Windows, Intel driver
101.2145, job 48872) failed the old runtime's burst_2000 and burst_2000x5 with "the command buffer
ended Error: Some(GpuRecoveryVictim)", with no device loss and no recovery notice: at least one of
the old runtime's 2,010 submissions a run read a timestamp unavailable once its queue's timeline
had passed it, and the old runtime took that as work the driver dropped and failed it as a victim
of a GPU recovery. The old runtime's poll already orders the read after a host wait on the fence
or the timeline, so this driver showed the signal before the timestamps' availability. A
signalled submission with its timestamps unavailable is no lost GPU: the command buffer now
completes, its GPU times 0, counted as before (`WorkCounts::unrun_command_buffers`), as the new
runtime counts the same case and fails nothing.

The cost is the case the branch was made for: work Linux's amdgpu drops with no error (a job its
timeout ended, and those queued behind it) completes with no error too. The FAST-PATHS known gaps,
the module docs, the error's and the count's docs and the README say so.

Test: the device test `dropped_work` now asserts the injected unavailable read completes with no
error, its fill ran, its GPU times 0, counted once, and the queue runs on (the old form asserted
the victim). Verified in the jobs named in the landing message.
2026-11-18 17:45:51 -08:00
Anees Iqbal 1ba761329c replay: a render pipeline record's tessellation state and call-stack depths are read
reims's recorder (descwire) now writes three keys at the end of each
newRenderPipelineStateWithDescriptor:error: map, always:
- `tessellation`, a map of the seven tessellation properties as Metal's raw
  values;
- `maxVertexCallStackDepth`;
- `maxFragmentCallStackDepth`.
The players refused any key they did not know, so every pipeline of such a
stream would have been refused. A stream without the keys means Metal's
defaults (0, 16, false, 0, 0, 0, 0; depths 1 and 1): the device built those
before the recorder carried them. There is no header bit, and the host's
short display map is unchanged.

Both players (translator::render_pipeline) now accept the keys:
- The depths always go to the descriptor.
- The tessellation state goes to it only where it differs from Metal's
  defaults and the vertex function is a post-tessellation one (patchType not
  None). Any other vertex function ignores the state, as Metal does, so a
  plain pipeline is never handed tessellation state the new runtime would
  refuse.
docs/REPLAY-STREAM.md section 9 states the keys, their defaults and the
names that differ from Metal's.

Test: a unit test parses the recorder's pinned record (partition 3, factor
32, scale on, half, uint32 indices, per-patch, counter-clockwise; depths 2 and
3) to those values, a record without the keys to the defaults, and refuses an
unknown key at the top and inside the tessellation map. Verified by the lane
check named in the hand-over.
2026-11-18 17:40:11 -08:00
Anees Iqbal 57272b7db9 replay: a compute pipeline state the runtime does not build is skipped and counted
A per-gap play counts the gaps, but a compute pipeline state that the runtime
answered with a typed gap, or that the translator refused, stopped the new
runtime's play at once. glbench-3090-r2 stopped at frame 0 on an
IdentityDomains refusal, and nothing after it was counted.

Compute pipeline states are now skipped and counted the way render pipeline
states are (c027cc2cfa): by the runtime's gap, or `Translation` for the
translator's refusal, together with the first state's object and the runtime's
answer. They appear as `skipped_compute_states` and the report line
`skipped compute states GAP N, the first #ID: WHY`. A dispatch of a skipped
state is skipped and counted (`skipped_dispatches`), and the play goes on. Any
other error still stops it. Render and compute share the counting
(Skips::skipped_state). docs/REPLAY-STREAM.md section 10 says so.

Test: a device test plays a state made for indirect command buffers. The
runtime refuses it as IndirectCommandBuffers; the test expects it counted,
its dispatch skipped and the play ended normally. The rt_replay library
helper takes any of the runtime examples' functions, a kernel among them.
Verified by the lane check named in the hand-over.
2026-11-18 17:39:03 -08:00
Anees Iqbal 3070737d28 translator: a kernel that encodes indirect commands is refused for that feature under the identity domains
Under the identity domains an encoder operation was refused only at the domains' admission check, as Unsupported{IdentityDomains, NotImplemented}: its plan pushes the resident set's root table and the execution status, which the identity domains do not take. The refusal now names the feature the kernel uses: the encoder operation's own check (encode.rs, needs) refuses it as Unsupported{GpuEncodedIndirectCommands, NotImplemented} under those domains. The new runtime already answers a state for indirect command buffers with Gap::IndirectCommandBuffers; its README says the translator refuses a kernel that encodes into one. docs/REFUSALS.md regenerated.

Verified: the new engine_identity test fails before the change (IdentityDomains) and passes after; job named with the sha.
2026-11-18 17:37:57 -08:00
Anees Iqbal 96ef4a692e replay: a buffer's linear texture plays as the texture over it where 2D
The SPI newLinearTextureWithDescriptor:offset:bytesPerRow:bytesPerImage:
stopped the new runtime's play of webdiv-780m-2 at frame 0 ("not played on a
buffer"): the stream makes one such texture, a 2D one over a no-copy buffer.
Neither player knew the selector.

The old runtime measured the SPI as newTextureWithDescriptor:offset:bytesPerRow:
for a 2D descriptor, plus 2D arrays whose slices Metal lays out itself
(bytesPerImage ignored; Buffer::new_linear_texture). The old player now calls
that. The new runtime has no form of the array layout, so its player plays a
2D descriptor as the public texture over the buffer (its resource index
included) and refuses any other type, "a linear texture of a type other than
2D". docs/REPLAY-STREAM.md section 5 names the selector.

Test: a device test plays a 2D linear texture with nothing skipped and gets
the refusal for a 2D array. Verified by the lane check named in the hand-over.
2026-11-18 17:29:04 -08:00
Anees Iqbal e04254de14 matrix: a timing leg names its old runtime's own spread, and is timed again past 10%
The planner's rule for timing legs: each prints the BASE arm's own spread across its passes;
past 10% the leg is VOID and is timed once more at another time, and a leg VOID twice is
reported as "venue unstable", never as a red row. In a matrix harness leg the base arm is the
old runtime, and the rows it times more than once in a leg are the re-timed ones: its main run
and each re-timed pair's (RETIME_PAIRS). results.base_spread takes, of each such row, the old
runtime's largest time over its smallest, less 1, on the time the row is judged on (its GPU time
where gpu_judged), and the largest of the rows; a creation row's first samples are cold, spread
by nature and judged cold against cold, so none counts; with no row re-timed it is n/a and voids
nothing.

Past BASE_SPREAD (10%), harness_budget names every problem the leg's times would raise VOID and
parks it, and the problems of its records and counts stand; the over table reads VOID on each of
the leg's times. The matrix (Run.timed_again) times such a leg's harness once more, after the
node's other jobs (the Windows host's right after its own), and judges that timing. The leg's
line names its base spread and what came of a first timing; a leg VOID in both reads `venue
unstable`, verdict UNSTABLE, which the run counts apart and which does not fail it. A node's last
job is now the last one it actually runs, the re-timing included, so the tree and the carry's
mirror are tidied after it.

Verified: the matrix's Python tests, new ones: the spread on time and on GPU time, n/a with no
re-timed row, a cold first sample never counting; a leg past it failing on its records alone and
the same row failing within it; the verdict line's spread, n/a and UNSTABLE; the over table's
VOID; and a node's harness timed once more after its other jobs, once only, its last job the
tidying one. In the job named in the landing message.
2026-11-18 17:27:11 -08:00