Commit Graph
1684 Commits
Author SHA1 Message Date
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
Anees Iqbal 7e33975f58 matrix: NVIDIA's first take of 64 MiB is judged on the new runtime's own part
The planner's ruling on create_64MiB/first_take on NVIDIA's legs: the gate changes, not the
ceilings. From the next round on the row is judged on the new runtime's own part, its first take
less the time inside the driver's calls the same process recorded, against the old runtime's whole
first take, each the median of the five creation processes; the driver's part and the whole ratio
are shown beside it, with the gap's name. An own part past the row's limit (1.03 times its floor,
the parity every row gets) fails the leg as a regression of its own.

The driver's part is `first_allocation_total`, the new runtime's `vkAllocateMemory` time on the
harness's thread in the same take, kept from every process already (FIRST_KEEP). rt counts no
`vkMapMemory` time, so the map stays in the own part, the stricter reading. On 5f2494bfc5 the
allocation took 9902 of the 2080's 12521 us first take (old's whole 5668 us), and 14164 of 17013
us and 10013 of 15066 us on the 3090's legs (old 4865 and 6166 us), against 954-1061 us on RADV.

The table OWN_PART_GATES names the row and its driver's part for the two NVIDIA cards the matrix
runs, which takes the place of their ceilings (1.88 and 2.26), deleted with their status.tsv gap
entries: the row is now over only when its own part is, which is a regression, not the gap. The
over table names such a row's kind `own part`. docs/VALIDATION.md says how the gate judges.

Verified: the matrix's Python tests, two new: the gated row within on its own part though 2.4
times old whole, past it as a regression, a process without its driver's part failing, an extra
leg held to its card's gate and another card's row judged whole; and the over table listing the
row by its own part alone. In the job named in the landing message.
2026-11-18 17:14:56 -08:00
Anees Iqbal c027cc2cfa replay: skipped render pipeline states are counted by the runtime's gap
The report gave one line for every skipped render pipeline state, its
total and the first one's answer, so a stream's states refused for a
depth attachment, for framebuffer fetch or by the translator read as one
number. The planner's census of what the new runtime refuses needs the
count of each kind per stream.

The backend now keeps the skipped states by the gap as Rust prints it
for debugging (Translation where the translator refused), with the
first one's object and answer, and the report gives a
"skipped render states GAP N, the first #ID: WHY" line for each, as it
does for render commands; skipped_render_states is their sum.
docs/REPLAY-STREAM.md describes the line.

Verified: see the check job (a new rt_replay device test: a state with
a Depth32Float depth attachment is counted under
RenderPipeline { kind: DepthAttachment }).
2026-11-18 16:57:09 -08:00
Anees Iqbal f9633bf18d rt: a pass's depth attachment is loaded, cleared and stored, untested; a pipeline state takes its depth format
The render-state lane's first feature. A replay stream's 478 depth passes (depth census
m3-max-48544, the one stream with any) are a shader-read Depth32Float texture with no stencil
attachment beside it, a Clear of 1 (476) or a Load (2) and a Store, drawn under Metal's default
depth-stencil state (compare Always, no write) by four pipeline states of depthAttachmentPixelFormat
Depth32Float. rt refused all of them: the pass by RenderPassKind::DepthAttachment, the states by
RenderPipelineKind::DepthAttachment.

- pass.rs: Pass holds the depth attachment as it holds the stencil one: a format with depth
  (else Refusal::AttachmentFormat, as Metal's validation stops it), the texture's view of the
  level and layer, Metal's load and store actions as for a colour, its clear depth a float.
  `vkCmdBeginRendering` takes it as pDepthAttachment. With a stencil attachment beside it the two
  are one view (VUID-VkRenderingInfo-pDepthAttachment-06085): two others are
  RenderPassKind::DepthStencilViews. A Clear outside [0, 1] or NaN is RenderPassKind::ClearDepth
  (VUID-VkClearDepthStencilValue-depth-00022; the floor has no VK_EXT_depth_range_unrestricted).
  Pass::targets yields each image once, so a combined texture's one view is moved, kept and
  barriered once.
- render.rs: the descriptor's depth format is no refusal. Fixed holds the translator's depth
  format (vk_format over the device's format query: a format the device does not render depth
  in is the translator's typed refusal), the VkPipeline renders into it, and renders_into holds
  it to the pass's depth attachment, as the colour and stencil formats are.
- The draw keeps DrawKind::DepthTest for a state that tests or writes depth; the encoder's
  dynamic depth state stays off, which is what the default state means.
- error.rs: RenderPassKind::DepthAttachment and RenderPipelineKind::DepthAttachment go;
  DepthStencilViews and ClearDepth come. Their docs, the bases and Refusal::AttachmentFormat's
  doc say what is built.
- README: the render pass and encoder sections and their known gaps.
- docs/REFUSALS.md regenerated; the API signature table blessed (two variants out, two in).
- tests:
  - draw.rs every_device_clears_loads_and_stores_a_depth_attachment_its_draws_do_not_test: a
    shader-read Depth32Float attachment cleared to 0.25, then loaded, each pass one submission,
    three barriers, one pass, no byte copied; the colour drawn; the depth read back 0.25; a state
    without the pass's depth format, one with it in a pass without depth, and a Less test are
    each their gap.
  - pass.rs: the depth refusal is replaced by a depth attachment of a colour format, a depth and
    a stencil of two textures, and a clear depth of 2 and of NaN.
  - render.rs: the depth attachment leaves the pipeline refusal list.

Verified: nothing yet; the next check job compiles and runs it.
2026-11-18 16:52:29 -08:00
Anees Iqbal a314b75ee6 replay: a play ends at the stream's recording range unless --past-range yes takes it past
A known-bad tail cost a ring timeout on a shared card and a wrongly
bounded play. The player now ends every play at the recording range by
default:
- the stream's sidecar, NAME.range beside NAME.0000.m2vr, one line:
  "last-frame F" or "whole";
- else the player's table RECORDED_RANGES for the streams recorded
  before sidecars, found by the first segment's file name and byte
  length: u2 1128, u3 1178, r3 1137, r4 1099, b3 whole;
- else the whole stream (the 3D streams until their ranges are stated).

--past-range yes plays past it; without it --until-frame F stops at the
earlier of F and the range. Every report says which range the play
used, where it came from and whether the play ends there, on a range
line after the completion mark; a sidecar of neither form is a harness
error (exit 2). docs/REPLAY-STREAM.md: section 1 names the sidecar,
section 10 the default, the flag and the report line.

Tests: replay::tests a_recording_range_comes_from_the_sidecar_then_the_table
(sidecar over table, table row by name and length, no row, bad sidecar);
integration replay_range runs the binary over a synthetic stream with no
sidecar, a last-frame sidecar, the flag and a bad sidecar (no device
opens); replay_completion_mark now expects the range line second.
2026-11-18 16:47:13 -08:00
Anees Iqbal 0a0ce8e29b rt: a cube array texture is a typed gap, so no view needs imageCubeArray
rt made VK_IMAGE_VIEW_TYPE_CUBE_ARRAY views without the imageCubeArray feature, which its floor
(Vulkan 1.3) does not require: the conformance whole set's layer leg on lavapipe (job
m3-max-48531) logged VUID-VkImageViewCreateInfo-viewType-01004 ten times once the rt side made the
cases' cube array textures. No replay stream makes a cube array texture or view (cube census over
every stream, jobs listed in the landing message), so by the planner's scope rule a cube array is
a typed gap until one does, and the floor is unchanged.

- error.rs: Gap::CubeArrayTexture, basis ours.
- texture.rs: prepare refuses a CubeArray descriptor, which every texture and every view of one
  passes through, so no cube array view is made; the descriptor's and new_texture's docs name it.
- README: the texture section's gaps.
- docs/REFUSALS.md regenerated; the API signature table blessed (one variant added).
- tests/texture.rs: a cube array texture is the gap on every device of the cfg.

Verified: nothing yet; the next check job compiles and runs it.
2026-11-18 16:39:42 -08:00
Anees Iqbal 5849a7f029 matrix: each runtime's creation rows run in a process of their own, cold against cold
The planner's rule: a cold first sample is compared cold against cold. The creation rows ran in
five processes that each timed both runtimes, the new runtime first, so the driver's
process-wide setup fell on the new runtime's first pipeline and the old runtime's first samples
came after it, warm. Measured on the Iris Xe (job 48650, ms01 alone, both runtimes from the
harness at cb25e3a83e, five processes each): the old runtime's create_state/first was 5265.8 us
behind the new runtime in one process and 16732.8 us in a process of its own (0.315x);
device_first 0.167x, first_call 0.099x. The one-process ratio new/old 1.302 at first was a
cold-against-warm ratio; cold against cold it is 0.410.

Of the two forms the planner allowed, each runtime's own fresh process is the cheaper: the
harness does not change, and the extra five processes a leg runs take about a second each
(create_state's processes on the Iris ran in under one second). The other form, one unrelated
pipeline before either runtime in a shared process, would need harness code and leaves the
first samples process-warm, not cold. So each of the five rounds now runs `--runtime new` and
`--runtime old` in processes of their own, each on a fresh driver cache and store, the order
alternating from round to round (new first in rounds 1, 3 and 5); the first round's two outputs
are kept whole, the later rounds' first samples as before. The records, their names and the
budget's medians do not change.

Verified: the matrix's Python tests in the job named in the landing message (the harness-runs
test now pins the processes and their order).
2026-11-18 16:35:27 -08:00
Anees Iqbal 6605f18ddf harness, matrix: the frames' commit-to-complete row is gone after its one round
The planner's frame ruling showed the frames' old figure, their last command buffer's
commit-to-complete time (`<row>/commit_to_complete`), beside the new throughput row for one round,
unjudged, then deleted. The round at 5f2494bfc5 is that round. The harness no longer prints the
record, the matrix no longer has a shown-rows table (its one row was this), and the docs and
the frames test lose it. The frames' latency from idle stays a row of its own.

Verified: the harness gate in the job named in the landing message (clippy plain, m2v_gpu and
m2v_cpu_icd, rustdoc, unit tests, the matrix's Python tests).
2026-11-18 16:28:03 -08:00
Anees Iqbal ca92b2aa9e harness: a compute state row's first dispatches 64x1x1, the streams' commonest size; one thread beside it
The create_state row's first dispatched one thread (1x1x1), a size of few dispatches: 3.9% of the
compute dispatches in the discrete replay recordings (from 3 to 5 kernels) and at most 0.5% in the
unified ones, by identity's census of every stream's threadsPerThreadgroup. A runtime that
compiles its pipeline for the dispatch's size (the old runtime) compiled the first at 1x1x1, where
a program's first dispatch runs at its own size. The first now dispatches one threadgroup of
FIRST_THREADGROUP, 64x1x1: the commonest size over the five streams of record, 24.1% of their
compute dispatches (41.7% of the unified recordings', 7.1% of the discrete ones', where 128x1x1
leads with 39.3%; 128x1x1 is 23.3% overall). Each thread's 16 bytes are checked.

Today's form stays beside it, shown and never judged: another content's first (the kernel with
other constants) dispatched as one thread, create_state/first_one_thread
(CreateReport::one_thread_first_us; results.SHOWN_FIRST). The name has no digits so the matrix's
FIRST_KEEP keeps it from every creation process, which a results test holds. The warm-up stays at
one thread. docs/VALIDATION.md and the crate doc say it; the authored device test asserts the
compute row has the one-thread first.
2026-11-18 16:27:00 -08:00
Anees Iqbal c1bd2d46d6 replay: a report of a stream recorded before the completion fix says so on its first line
The recorder's completion fix marks a stream with header flag bit 1,
FLAG_COMPLETION_BYTES_RECORDED (value 2): at each command buffer's
completion the stream holds every chunk the buffer's work could store to
as the GPU left it, before any later CPU write, on all four late routes
(signalled event, final status read, refused hook, released command
buffer). Fixed streams read flags 3; every stream recorded so far reads 1.

- The reader takes bit 1 (it refused any bit but 0 before), so a fixed
  stream plays.
- command-replay play writes "recorded before the recorder's completion
  fix: the stream may differ from what the program did" by itself as the
  first line of report.txt for every stream without bit 1, so no table
  relayed from a report loses it. The stream is now read before the
  device type is parsed, so even a report that stops there carries it.
- docs/REPLAY-STREAM.md: section 1 names the bit, section 6 replaces the
  rule that described a stream without completion writes as allowed with
  the completion invariant and what a stream without the bit may miss,
  and section 10 names the line and its place in report.txt.

Tests: replay_completion_mark (integration) runs the player binary on a
one-call stream with flags 1 (the report begins with the line) and flags
3 (it does not), with a device type no device has so no device opens;
the header flags test now reads flags 3 and refuses bit 2.
2026-11-18 16:24:06 -08:00
Anees Iqbal f1f846e636 rt docs: the consumer's own drivers in the guide, the validation ladder and the surface table
`Instance::with_drivers` and `Error::NoDirectDriverLoading` are public: the runtime's guide
says what the call does, what it refuses and what it leaves to the consumer (loading the
library and keeping it loaded); docs/VALIDATION.md says how a job runs the device tests through
it (`M2V_DIRECT_DRIVER`) and what shows the path ran; the signature table takes the two records
(scripts/api-signatures/signatures.py --bless). docs/REFUSALS.md regenerated unchanged: the
variant refuses nothing Metal accepts, it says the host's loader lacks an extension.

Verified: the generators' output; the build and the tests in the jobs named in the landing
message.
2026-11-18 16:16:23 -08:00
Anees Iqbal d3bfe3815d harness, matrix: a frame row is its throughput, and its latency from idle a row of its own
The planner's metric for the frame rows. A frame row's time was its runs' last command buffer's
commit-to-complete time with two runs in flight, which mixes the time a frame adds with how long
it waits behind the one before. Now `frame` and `frame_5cb` (Plan::frames) carry two figures,
each the steady time (best window of ten) of the harness's own completed-handler times:

- THROUGHPUT, the row of record (matrix_time): two runs in flight, from one run's last completed
  handler to the next's. The pairs around the waits that read the gauges after runs 100 and 200
  (GAUGE_RUNS) are left out, as an untimed run sits between them.
- LATENCY FROM IDLE, the row `<row>_from_idle` (FROM_IDLE): as many runs again after the timed
  ones, one in flight, each committed once the one before it completed, from just before its first
  commit to its last completed handler.

The completed handlers now report the time of their commit and of their own run against one
origin (Completions, Handled), so the commit-to-complete times, the throughput and the latency
come from one record. The frames' commit-to-complete time is still printed, as
`<row>/commit_to_complete`, which the matrix shows and does not judge (SHOWN_ROWS) for one round.
Each latency row takes the ceiling and floor its workload's row has (listed_row), in the budget,
the over table and the re-time selection, and is re-timed through its workload's runs. Other
workloads are unchanged, long_4cb's commit-to-complete time included. The shape follows core's
one-run-in-flight probe (3eaec97076), without its environment gate.

Verified: test_results (a new test: a latency row past its workload's ceiling and the budget,
the commit-to-complete row shown and never judged, the over table and the re-time selection
choosing the latency rows); the harness's unit tests gain the throughput and latency arithmetic
(the gauge pairs left out) and matrix_time's frames case; the harness gate job named in the
landing message runs clippy, rustdoc, the unit tests and the authored workloads on lavapipe.
2026-11-18 15:51:27 -08:00
Anees Iqbal 6d4ca09039 translator: a render pipeline into a snorm attachment records SnormMinimumKept on Device::from_queries
metal2vulkan-rt's conformance side ran the six snorm-store cases on lavapipe (job 48051). Each
diverged where Metal's tile store writes a loaded minimum code (-128, or -32768) back as the code
above it, and the device's pass keeps the bytes. The old runtime announces that as
`snorm-minimum-kept` at the draw, from its encoder (render/tile_store.rs). The new runtime has no
such encoder step, and the translator recorded no note, so the answer went unannounced. A missing
static note is a bug (rule 1: a static note fixed per operation).

- `PrecisionNote::SnormMinimumKept` (appended): the note of a render pipeline that draws
  single-sampled into a color attachment of R8Snorm, RG8Snorm, RGBA8Snorm, R16Snorm, RG16Snorm
  or RGBA16Snorm.
- `pipeline::private_state::note_snorm_minimum` records it on the fragment stage (the vertex
  stage where there is none), whatever the pass loads. That is static, so it may over-announce
  a cleared pass.
- It is recorded only where the profile's new fact says `SnormMinimumNote::Noted`. That is
  `Device::from_queries` (ProfileFacts::EVERY); `Device::new` (ROWS) stays `Announced`.
  `Device::new`'s modules, keys and the old runtime's announcement are unchanged.
- The old runtime maps the note to its existing `Degradation::SnormMinimumKept` (an explicit
  `from_precision_note` arm). Validation's comparison allowance is Unbounded, as for the other
  device-answer notes. The codec takes the variant, and ARTIFACT_FORMAT_VERSION goes from 536 to
  537. fast_paths lists the note under Elsewhere. api_signatures gets the two variant rows and the
  macro row. docs/API.md's `snorm-minimum-kept` entry says where the static note is recorded.

Test: engine_private_render_state's
a_snorm_attachment_notes_the_minimum_code_metal_s_pass_rewrites. On lavapipe and moltenvk-m3, for
each of the six formats, the note is on the fragment stage alone through Device::from_queries and
on no stage through Device::new. No stage records it at four samples, or into RGBA8Unorm or
RGBA16Float. The six conformance cases on the rt side are the end-to-end test (the check job's
replay, named in the report).
2026-11-18 15:50:11 -08:00
Anees Iqbal 58229ccd71 replay: a copy back to the guest's RAM plays as buffer copies into a sink
The new runtime's backend skipped m2v.copyToGuestRam and counted it, so
every play's verdict ended at the first one (u2 frame 97, u3 frame 99),
though nothing in a play reads that RAM. The planner ruled it does not
end the played range, and that work the recording host did live plays
as the runtime's, cost included.

It now plays as the old backend's does: each run copied by the blit
encoder, in its order, into a Shared place of the play's own that
nothing reads, each run widened to the whole words it touches within
the buffer (a buffer copy takes whole 4-byte words). The place is given
back at the command buffer's commit, as a copy from the guest's RAM
gives back its staging. The report counts the bytes
(copied_back_guest_ram_bytes); skipped_guest_ram_reads is gone.

Verified: see the check job (a new rt_replay device test: nothing
skipped, the widened bytes counted, the buffer's bytes kept).
2026-11-18 15:47:00 -08:00
Anees Iqbal 02eaf89136 matrix: the report ends with one table of every row over its limit, with its status
Two legs of eleven passed and every red was known, so the reds were no longer read. The report
(`matrix run` and `matrix show`) now ends with one table: every harness row over its limit on every
leg (results.over_rows, the rows harness_budget fails or names as its card's variance), with its
kind (GPU time, host time, or count for the instructions gate), its ratio and limit, the frozen
arm's verdict (VOID, stands, rebased, no base) and its status. The status comes from
scripts/matrix/status.tsv, one typed entry per card and row (a `*` in the row matches any run):
an open record with its owner and first round, whose age the table counts in rounds; a known gap
with the place it was ruled; or a note alone. A row with neither reads NEW in the first round it
is over (not over in its leg's base) and UNOWNED after; a CARD_VARIANCE row reads as its card's
known gap. The table changes no verdict: the red rule waits for the planner's ruling.

Seeded from the rulings so far: NVIDIA create_64MiB/first_take, a known gap (the 2080 and the
3090); create_64MiB on AMD, a note that it is no known gap and is unjudged until the first
interleaved round; the Iris Xe's GPU-time rows, a note of one time-boxed investigation after that
round; the Iris row_cells, identity's open record (first over at 795c834ded); the 2080 and Iris
frame_5cb, core's open records (from 140714ceae), and both cards' frame and frame_5cb, the
planner's state of throughput and latency from idle.

Verified: test_results (three new tests: the stored table reads and a malformed entry is refused;
every row past its limit is listed with its kind and judged ratio, re-timed and shown rows
included; statuses NEW, UNOWNED, open with its age, gap, notes, an extra leg and the card's
variance). Against the stored notes of 795c834ded and 140714ceae, over_rows lists exactly the rows
the budget named past their limits on every leg (15 and 14 on the Iris Xe).
2026-11-18 15:20:12 -08:00
Anees Iqbal 65aac391c2 matrix: the frozen arm compares only rounds of one harness, one old runtime and one shape
The noise meter read the old runtime's move between two rounds as noise even where the harness or
the old runtime changed between them (ff4ce943c2 gave every workload command buffer a scheduled
and a completed handler, on both arms). Now the matrix compares the trees of
crates/metal2vulkan-harness and crates/metal2vulkan-runtime at the leg's commit and its base's,
a mechanical check: where either differs, every row but the creation rows reads `rebased` and
voids nothing, the creation rows timing creation calls and no command buffer of the harness's.
Each leg's note now keeps its timing shape (HARNESS_SHAPE, "one process, new then old"): against a
base timed in another shape, no row is compared, so the first round of the interleaved shape is
the base the meter starts from.

Verified: test_results (the void rule's test covers both rebases, the column and the void list);
`matrix show 140714ceae` against 99ec109264, whose harness and old runtime trees differ, reads
every command-buffer row rebased and voids only creation rows (Iris: create_private_16MiB's three
and create_render_state/device_first).
2026-11-18 15:13:16 -08:00
Anees Iqbal 3027cf9b68 matrix: each creation process times both runtimes, the new runtime first
The creation rows ran in five processes per runtime, all of the old runtime's before the new
runtime's, so a node or clock that moved between them moved one runtime's samples alone, an order
effect. Each of the five processes now times both runtimes, `--runtime new,old --only
'create_*'`, on its own fresh driver cache and store: a creation's first sample on the new runtime
is cold, and the old runtime's follows it on the same cache. FIRST_KEEP takes each sample's
runtime from its line. The median of five per runtime and every row, ceiling and floor stay.

Verified: test_matrix's harness-run test (five `new,old` creation processes, both runtimes'
samples kept once each) and test_results' creation test (FIRST_KEEP keeps the old runtime's
sample beside the new's and drops a GPU line); the Linux and Windows job scripts pass `bash -n`.
2026-11-18 15:13:16 -08:00
Anees Iqbal abf3d4133d matrix: both runtimes' rows are timed in one process, their passes alternating
Two cards showed the noise the old runtime's frozen arm measures: the Iris Xe's frame moved 2.8x
between rounds, the UHD 630's about 2x between passes of one process. The leg timed each
runtime in a process of its own, one after the other, so a clock or a co-runner that moved
between them moved one runtime's times and not the other's. Now one process times both,
`harness --runtime new,old`: each workload runs on the new runtime, then on the old, so their
passes alternate on the GPU and the node as they are at that moment. The new runtime runs first
in each workload, so its first uses, the judged cold ones, compile before the old runtime's of the
same workload, as cold as in a process of its own. The process is the leg's one suite, `harness`;
a failure still names its runtime (`M2V-FAILED harness-<runtime>/<row>`). The creation rows keep
their five fresh processes per runtime, now alternating old and new; rows over their limits are
re-timed alone as before. No row, ceiling or floor changes, and the deterministic records are
untouched. The frozen arm's column (FROZEN_DRIFT) stays the check on it.

Verified: test_matrix's new test runs the leg's timing script against a stand-in harness: one
`new,old` process, the new runtime's warm run, the creation processes alternating, one suite whose
records hold both runtimes' rows once each. The Linux and Windows job scripts render and pass
`bash -n`.
2026-11-18 15:13:16 -08:00
Anees Iqbal 06b940f810 matrix: the frozen arm is the noise meter: a row whose old time moved past 10% on the base is VOID
The old runtime takes regression fixes only, so its time of a harness row moves between rounds
with the node, the driver and the harness, not with the change under test. Each leg now compares,
per row, the old runtime's time the row is judged on (its GPU p50 where gpu_judged, the median of
the five processes for a creation row's first sample, else its time) with the same time in the
leg's base, the previous round. Past FROZEN_DRIFT (10%) either way, harness_budget names the row
VOID and judges nothing from it: its comparison comes from a re-time in one process with both
runtimes interleaved. The report (run and show) shows the move on every row the base has, and a
line per leg naming the void rows; show computes it from the notes, so a round already noted is
read with it.

Verified: test_results (47 tests, a new one for the void rule, the GPU and median-of-five forms,
no base, and the column). `matrix show 140714ceae` against its base 99ec109264 voids Iris frame
(-64.7%) and frame_5cb (-28.9%), and keeps UHD frame_5cb (+8.8%) and 2080 frame_5cb (+1.2%).
2026-11-18 15:06:36 -08:00
Anees Iqbal 40e135c308 replay: the new runtime's backend rounds each buffer's place to its recorded granule
The backend packed buffers first fit at Metal's 256-byte alignment, so a program's write past
a buffer's end landed in the next buffer. A recorded stream's program did that: an append
list of 4000 records took about 870 more on one play, and the overrun went 17340 bytes into
twelve 4-byte counters and the start of a 48000-byte buffer that the player had packed behind
it. The recording had given each of those buffers its own 32 KiB-granular range, so the same
overrun landed in the list's own slack there. The clobbered counters then feed the next
rounds; a 780M page fault past a 64 MB buffer and a hang on a 3090 follow them (expected, the proof plays pending).

Each buffer's place now spans its length rounded up to its recorded granule: the largest
power of two that divides its recorded gpuAddress, from 256 bytes to 64 KiB, and 256 bytes
where the stream records no address (the player's own staging included). Both copies of a
two-copy Managed buffer take it. A buffer past the class's block length takes a block of its
own of the rounded span. The backend's new "places by recorded granule" line counts the
places by granule and gives the most bytes of slack held at once.

Test: rt_replay's buffers_keep_the_slack_of_their_recorded_granule plays two 4-byte buffers
recorded at addresses of 32 KiB and 64 KiB granules and reads back their relocated addresses
from a third: they lie apart by at least the lower one's granule (256 bytes apart before).
docs/REPLAY-STREAM.md says how the backend places buffers.
2026-11-18 14:53:10 -08:00
Anees Iqbal 795c834ded 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 14:34:49 -08:00
Anees Iqbal d6a1a86d98 translator: the one-row variant leaves out the barriers of pairs apart in rows on every device; CompiledFunction says whether a kernel's lockstep barriers run in rows
LoweringInputs::one_row's lockstep order cleared the pairs that meet only where a SIMD group
spans two rows only where Lockstep::rows held, which needs maximal reconvergence on 32-lane
subgroups without the device's own lockstep: the old binder's condition for asking the variant.
On a device without that tier (lavapipe's 8-lane subgroups, the UHD 630 without the extension,
GCN's 64-lane waves) a one-row compile kept every barrier, though the clearing is exact there
too: in a threadgroup whose SIMD groups each lie within one row, those pairs never meet,
whatever runs the SIMD groups. The order now searches the pairs under the rows facts for every
one-row compile and clears them wherever every pair left wants a threadgroup barrier at most.
Lockstep::rows and RowLockstep keep their meaning, so Device::new's plans, and the old binder's
one-row compiles, which it asks only where rows holds, are unchanged.

CompiledFunction::runs_lockstep_barriers_in_rows (KernelFacts::lockstep_in_rows) says whether a
kernel's lockstep order inserted a barrier that runs where each SIMD group lies within one row:
any but the threadgroup barriers that order only pairs meeting across rows
(Lockstep::across_rows), which the module runs only where its local size lets a SIMD group span
two rows, a test the driver folds. Only where it holds can the one-row variant run fewer
barriers than the kernel's own module at a one-row size, so a runtime asks the variant only
there. It is decided from the plain compile's order and changes no module. docs/API.md states it;
the api_signatures table gains its row.

SEMANTICS_VERSION 2181 -> 2182: a one-row compile on a device without that tier changes. The old
runtime's render descriptor key is re-pinned under it (b3d05d42). ARTIFACT_FORMAT_VERSION 536 ->
537: KernelFacts gains lockstep_in_rows.

Test: a_one_row_variant_clears_the_pairs_apart_in_rows_without_a_32_lane_tier, on lavapipe's
from_queries profile under the identity domains. Three kernels, each with its stores in its entry
block and past a bounds test (six in all), keep lockstep barriers in their plain module and state
no RowLockstep:
- one storing the three words 3 cell + k of its cell y * stride + x in int arithmetic, as Apple
  compiles it (nsw on every step, the index sign-extended);
- the same in uint arithmetic, whose steps carry no flags;
- one whose threads store at x and x + 1.
In the one-row variant the first has none. It states OneRow, takes no simd class, does not
observe its partition with partial threadgroups (the variant without one_row does), and runs its
grid in tiles. The other two keep their barriers: the wrapping index is not proved apart in
rows, and the neighbours meet within one row. Every plain module runs its lockstep barriers in
rows but the unguarded int cells kernel's, whose barriers all order pairs across rows.

Verified:
- Check 48214 (msi) at this series' tip on development 50719da96b: clippy with -D warnings of
  metal2vulkan, metal2vulkan-rt and metal2vulkan-harness (default, --cfg m2v_gpu and, for the
  runtime, --cfg m2v_cpu_icd) and their Rustdoc are clean; their host suites pass 3,863 of
  3,867, and the 4 that fail all name engine/oor_texture_reads, a fixture development added
  (603634f9f9) without its golden-table and inventory rows, whose re-bless development owns; the
  runtime's device suite passes on lavapipe (275 run, 3 skipped).
- The translate probe (jobs 47932, 47952; lavapipe's from_queries profile and three device
  profiles): lcg_step's plain and partial-threadgroups modules are byte-identical before and after
  this change (SPIR-V 3226775232d06722, 649 words, and 991ee4501d037271, 1202 words), and
  runs_lockstep_barriers_in_rows is false for it. The harness fixture's row_cells holds two
  barrier.lockstep.simdgroup (barrier.lockstep.emulated.simdgroup on lavapipe), the kind the
  streams' four row-indexed kernels hold; it runs them in rows, and its one-row variant holds none.
2026-11-18 14:34:01 -08:00
Anees Iqbal 051236c0c2 replay: a placement over an equal sampler state's index does not wait, and one a held commit owes stops the play
u3 stopped at player frame 259: the placement of a sampler state at index 16 waited for commit
1614 (#20713), which rt held at Committed because it waits for event #35 to reach 309, which only
command buffer #20439 signals, encoded 20 records later. The program had released #10401 (index 16,
bound directly by #20713) and made #20822 with the same descriptor the next call; Metal gave it ID
16 again. Nothing changed for the work in flight, and the original run did not wait (it could not:
#20713's signal was not yet encoded).

- A sampler state whose recorded descriptor is the one placed last at its index takes the index
  without waiting, counted on the indices line; the index stays owed for another sampler state.
- The player tells the backend, at each look for command buffers to wait for, the committed ones
  no record played so far lets complete (Backend::held: their unmet event waits, or a held one
  ahead on their queue). A placement owing its index to one of those stops with PlayError::Held
  naming the chain, instead of waiting for ever.
- docs/REPLAY-STREAM.md says what record order does not promise (a committed buffer may wait on a
  later record's signal) and what the indices line and the stop say.

Tests: a unit test of the equal rule in Indices; rt_replay device tests of our own sequence: an
equal sampler state at an index a held commit owes plays through without a wait; another
descriptor there stops with Held naming #6 and its unmet wait. Check follows.
2026-11-18 14:25:12 -08:00
Anees Iqbal 4fbe03c3a0 rt: maxColorAttachments of 8 joins the floor, and the pass's colour-attachment limit goes
The floor now requires maxColorAttachments of at least 8, Metal's eight colour attachments
(MAX_COLOR_ATTACHMENTS, the render pass descriptor's slots). Vulkan 1.3 requires only 4: the
spec's Required Limits table (Table 76, vkspec 1.4.366) lists maxColorAttachments as "4 (Vulkan
Core) 7 (Vulkan Roadmap 2022) 8 (Vulkan Roadmap 2024, Vulkan 1.4)", min. A device below 8 is now
named below the floor at creation ("maxColorAttachments 7, below 8"), so a pass's colour
attachments, at most the descriptor's eight slots, never reach past the device's. The check in
pass.rs and its refusal, Limit::ColorAttachments, could no longer fire and are deleted.

Breaking, intended: the public variant metal2vulkan-rt::Limit::ColorAttachments { count, max } is
removed (api_signatures.tsv loses that one line, blessed). docs/REFUSALS.md is regenerated (the
new runtime's Limit goes from 10 to 9 variants). The README's limits table gains the row and the
Limits paragraph the spec's minimums; the render pass passage says a pass may use all eight.
The floor test's low-limit cases go from 16 to 17 with the maxColorAttachments case.
2026-11-18 14:06:15 -08:00
Anees Iqbal 518800af99 rt: a wait in a handler or a listener for what its own thread does next is a typed refusal
The completion thread runs a device's completed handlers and listeners, and it is the thread
that marks a command buffer completed, an event's GPU value observed, and a queue's place free.
A wait there for any of those not yet done could only end by that thread's next step, so it hung
by construction. Each is now Refusal::WaitOnOwnThread, and a wait already met answers at once:

- wait_until_completed: Ok for a command buffer completed or ended, the handler's own among
  them, else the refusal; nothing is sent.
- wait_until_scheduled: the refusal for one not yet scheduled.
- SharedEvent::wait_until_signaled_value: Ok(true) for a value reached, else the refusal.
- CommandQueue::command_buffer on a queue whose maximum count are made and not yet completed:
  the refusal on the completion thread and on the submit thread (a scheduled handler), whose
  next steps free the place.

The condition is the program's own state (what it committed, what has completed), never a
ring's fill. Outside a handler every wait answers as before.

Test: every_device_refuses_in_a_handler_each_wait_its_own_thread_would_have_to_end checks 15
answers in a scheduled handler, a completed handler and a listener. REFUSALS.md regenerated and
the signatures table blessed: Refusal gains WaitOnOwnThread (a new variant of a non-exhaustive
enum; no consumer breaks).
2026-11-18 14:04:45 -08:00
Anees Iqbal ea8e7843b7 rt: scheduled handlers run on the submit thread, before their submission, and wake no thread
The consumer adds a scheduled handler to every command buffer. The submit thread handed each
command buffer's scheduled handlers to the completion thread (Done::scheduled), and where that
thread waited on the GPU the hand-over was a host vkSignalSemaphore of its wake timeline, on
every submission. On NVIDIA a host signal per submission measured 103-117 us of CPU a command
buffer on an RTX 3090 (the waits probe's rt arm, job 47928), against 2.9-3.5 us for every single
wait form, rt's own steady-state WAIT_ANY included.

Now the submit thread, which already marks a command buffer scheduled as it joins a submission,
runs its scheduled handlers itself once it has dropped its lock, in queue order, before that
submission goes to the driver and before any of those command buffers is handed on as ended.
So the status reads Scheduled and the kernel times are set in the handler, a command buffer that
ends before it joins a submission runs none, as before, and the scheduled handlers run before the
completed ones by construction. Done::scheduled, its list and the completion thread's branch for
it are deleted.

A handler on the submit thread may not call what waits for that thread to submit. The four
internal sites that do (Work::room, Work::capture, Work::stage and the readback's flush and
Done::wait) give the public entries that reach them; each is now Refusal::InScheduledHandler in a
scheduled handler, on every device and whatever the runtime holds: commit; wait_until_scheduled,
wait_until_completed and SharedEvent::wait_until_signaled_value; replace_region, upload_region,
get_bytes and zero_block_range; new_managed_buffer, and new_buffer zeroing a buffer in a Private
block. The one consumer's scheduled handler makes none of these calls, and a guest's
addScheduledHandler block runs in the guest. Quiesce in a scheduled handler answers false at once
(neither the submit thread nor the completion thread, which the submit thread stops as it ends,
is waited for), and a device whose last handle drops there tears down on the reaper, as from a
completed handler.

For a consumer: CommandBuffer::wait_until_scheduled and wait_until_completed now return
Result<(), Error>, and SharedEvent::wait_until_signaled_value returns Result<bool, Error>
(api_signatures.tsv blessed); docs/REFUSALS.md regenerated; the README's contract says where each
kind of handler runs, what a scheduled handler may do, and that it holds its queue's later
submissions while it runs.

Tests: every_device_tears_down_from_a_scheduled_handler,
every_device_answers_false_to_a_quiesce_in_a_scheduled_handler, and
every_device_refuses_each_call_that_waits_for_the_submit_thread_in_a_scheduled_handler (each
refused entry by name, the allowed calls, the status and kernel times in the handler, and the same
calls answering once it has returned). Verified by the next jobs.
2026-11-18 13:36:21 -08:00
Anees Iqbal 99ec109264 harness: each creation row's first is a fresh object's on a device that has made one of its kind
A creation row's first sample was the first of its kind in a fresh process, so it held the
device's own first use (its first recorder, submission, upload, staging region, stamp pool)
together with the object's. A guest keeps one device for the machine's life, so what a device pays
once never reaches it. The planner ruled that every first row is judged on a new object's first use
on a warm device.

Each creation row now makes a warm-up of its kind first, made and used as the first is and kept
until the first is done, then the timed first on a fresh object:
- Shared and Private buffers: a buffer of the same length, kept, so the first takes memory the
  warm-up did not give back (a new 16 MiB Private block on rt's harness placement); the next take
  still follows the first's release.
- compute states: a state of another authored kernel (lcg_step, bound as signed_zero_products is),
  created and dispatched once, its word checked;
- render states: a state of another fragment function (sampled_fragment) with the row's vertex
  function and attachment.
The warm-up's time is its own record, `<row>/device_first`. The matrix shows it with the ratio of
its medians and never judges it (results.SHOWN_FIRST now names each shown sample with its reason).
time_states takes the first as its caller timed it; its other form had no caller left.

Tests: a host-buffer device shows the buffer row's order (the warm-up alone, the first and the
next beside it, the timed ones alone); the matrix shows a warm-up and judges the first it comes
before; the device test checks every row records its warm-up.
2026-11-18 13:06:31 -08:00
Anees Iqbal 4da77d8518 FAST-PATHS: what an NVIDIA host whose type 0 reads right loses to the Shared dma-buf refusal 2026-11-18 12:54:29 -08:00