Commit Graph
156 Commits
Author SHA1 Message Date
Anees Iqbal d2e8ab2a85 Replay player: a colour attachment's depthPlane is played
What: the new-runtime player forwards a colour attachment setter's `depthPlane` into the
runtime's RenderPassColorAttachmentDescriptor::depth_plane, as it forwards resolveDepthPlane, and
no longer holds the pass for a plane but 0 ("Unheld(depthPlane)", the encoder skipped). A depth
or stencil attachment's depthPlane is not played and holds nothing: Metal reads it of a 3D
texture alone (Apple's page for depthPlane, as fetched: "If the texture isn't a 3D texture, then
Metal ignores this property."), and the runtime refuses a 3D texture's depth or stencil
attachment by its type (TextureType) whatever its plane, which the player counts as any gap.

Why: since 3c52ee1cf1 the runtime takes a colour attachment's depth plane of a 3D texture, and the
player still skipped every pass that set one, and every pass that set one of a 2D texture, which
Metal with its validation layer off renders as at 0 (probe resolve_depth_planes.m, case plane3,
job m3-max-73495).

Docs: docs/REPLAY-STREAM.md and the player's module doc list what a held pass holds now (the
"a resolve texture" there was stale too: only a skipped one is held).

Test: replay::rt_replay::a_colour_attachment_s_depth_plane_plays_on_the_new_runtime (device
cfgs): a stream clears plane 0 of a 4x4x4 RGBA8Unorm 3D texture green (no plane set), its plane 2
red (depthPlane 2), and a 2D texture red at depthPlane 2; blits copy planes 0 and 2 and the 2D
texture out, and the stream's three checks (green, red, red) match; no encoder, call or object
skipped.

Verified (run tree 44b2cc80bf, on development 3c52ee1cf1; its tree is this commit's but for
development's bless 0c9db49765 of opened_chains.txt):
- msi, job m3-max-73511: fmt, clippy (no cfg, m2v_gpu, m2v_cpu_icd) and rustdoc exit 0; the
  player's stream device tests (replay::rt_replay) on lavapipe (Mesa 26.2.4): 57 passed, the test
  among them; metal2vulkan-validation's suite: 1305 passed, 1 failed, 3 skipped, the one failure
  every_committed_profiles_context_enables_its_pinned_chain, development's own at 3c52ee1cf1
  (job m3-max-73486), which 0c9db49765, this commit's base, blesses.
- Without the fix (the player's render.rs of 3c52ee1cf1, lavapipe, job m3-max-73514): the test
  fails, "skipped render encoders Unheld(depthPlane) 2", and the plane-2 check differs.
2026-11-24 01:56:50 -08:00
Anees Iqbal c54fa438a2 Player: a dump holds each texture a listed command buffer's compute encoders bind
--dump-command-buffers wrote every buffer a listed command buffer's
encoders named and every colour attachment its render passes stored, so
a texture a compute pass wrote showed only through a later pass that
sampled it. A play that parts between two drivers in a render pass that
samples a compute pass's textures could not say which of the two passes
parted first.

dumps::Stores now keeps the compute encoders made and not yet ended,
and each texture such an encoder binds (setTexture:atIndex: and
setTextures:withRange:, a nil one left out) is a part to dump: its first
level and slice, read once the command buffer completed, as an
attachment's parts are, into cbC-objT.bin with the cover "-". A texture
both stored and bound holds each part once, in Part order. An argument
encoder's setTexture:atIndex: is none: its receiver is no compute
encoder. docs/REPLAY-STREAM.md and the module docs say what a dump holds.

Test: a_listed_command_buffer_dumps_the_textures_its_compute_encoders_bind
(one bound texture, a range with a nil, a texture bound twice, a render
encoder's fragment texture and an unlisted command buffer's compute
texture left out).
Verified: clippy -D warnings over the workspace with all features, and
the validation suite, the new test among them (job in the land line).
2026-11-23 11:55:36 -08:00
Anees Iqbal 06c8ebccd6 Player: a tessellation factor scale of 1 plays as nothing, any other is a skipped render command
The player refused setTessellationFactorScale: ("not played on a render
encoder"), so a recording that sets the scale stopped at its first
setter. The runtime's render encoder has no scale setter: Metal reads
the scale only in a patch draw through a post-tessellation pipeline
state that enables it (tessellationFactorScaleEnabled), and the runtime
refuses every such state at its making (RenderPipelineKind::Tessellation),
which the play counts as a skipped render pipeline state.

render::factor_scale reads the setter's scale: Metal's default of 1
plays as nothing, and any other scale is a skipped render command of
kind TessellationFactorScale, counted in the report's headline with its
first frame and call. This is faithful only while the runtime refuses
every scale-enabled state; once it builds the scale, its encoder takes
the setter and the player passes the scale on. The code comment and
docs/REPLAY-STREAM.md say so.

The recording that met it (m3-max-71779, read in place, no card): 185
scale setters, every one at 1, the first in frame 409; 0 of its 1668
render pipeline records enable the scale, so no state there is refused
for it.

Test: a_tessellation_factor_scale_other_than_1_is_a_skipped_render_command
(1 as a float and a double, 2 and 0.5, and a scale that is no float).
Verified on msi: clippy -D warnings over the workspace with all features,
and the validation suite, the new test among them.
2026-11-23 11:18:21 -08:00
Anees Iqbal 1f81d53c30 Player: a compute pipeline record's stage input plays as the kernel's
The player refused every compute pipeline record whose stageInput was not
nil ("a stage input"), so a recording that makes a kernel with a
[[stage_in]] parameter stopped at that state's frame. The runtime takes
the stage input (ComputePipelineDescriptor::stage_input); only the player
lacked it.

translator::stage_input reads the record's stageInput, {layouts,
attributes, indexType, indexBufferIndex}, into the translator's
StageInputDescriptor the way vertex_descriptor reads a vertex descriptor:
layouts and attributes at their indices, a stride of 2^64 - 1 as
MTLBufferLayoutStrideDynamic, Metal's raw step functions, attribute
formats and index type through their enums, and Metal's unset layout for
a buffer an attribute reads that no layout names. Nil stays no stage
input. A raw value the enums lack, or a key the form does not hold, is
the player's refusal. A descriptor the runtime refuses is the runtime's
typed error: a gap or a translation refusal counts as a skipped compute
state in the play's report, any other error ends the play with it.
docs/REPLAY-STREAM.md states the form.

Test: a_compute_pipeline_record_s_stage_input_is_read (the record form,
a dynamic stride, a buffer no layout names, nil, and an unknown key).
Verified on msi: clippy -D warnings over the workspace with all features,
and the validation suite, the new test among them.
2026-11-23 11:03:24 -08:00
Anees Iqbal acda405b30 Player: a dump holds each colour attachment its command buffer's render passes stored
A play asked to dump command buffers (--dump-command-buffers) wrote only
the buffers their encoders named, so a draw's output reached no dump. It
now writes, once a listed command buffer completed, each colour
attachment its render passes stored, as cbC-objT.bin beside the buffers'
dumps, with a cover of "-", so compare-dumps reads them unchanged: a
texture an attachment names under MTLStoreActionStore or
StoreAndMultisampleResolve, a resolve texture under MultisampleResolve or
that one, and an Unknown store action as the encoder's
setColorStoreAction:atIndex: decides it. The dump holds the parts the
passes stored (level, slice and depth plane, or the resolve's), one after
another, each laid out as a check reads a texture's first level and
slice; a part the backend cannot read (a multisample texture stored
without its resolve) is an .unread file.

Colour only: a texture of a combined depth and stencil format reads back
one aspect at a time, through a copy with that aspect's blit option,
which this read does not make. The stream doc and the command's help say
so.

The backend gains Backend::read_texture_part; the runtime's backend reads
a part as its check reads level 0 (the CPU's read, or a blit's copy of a
Private texture), the check's read unchanged.

Verified: by the jobs named in the landing report.
2026-11-23 10:20:31 -08:00
Anees Iqbal 60a6b2746e Docs: the memory-class line measures by two whole plays on the RX 7900 XTX
29b659121e measured the memory-class line by the RTX 3090's frames 366
and 367 (about 378 s), from two arms that exited 124 at their caps on a
card whose driver then wedged (d876f56b82 added that). The planner
asked for a clean pair instead: whole plays, exit 0, on one card. On
the RX 7900 XTX the integrated-made recording took 257.2 s of compute
(m3-max-71531, all 430 frames) and the discrete-made recording of the
same benchmark 10.7 s (m3-max-71625, all 345 frames). The wedge
sentence goes too: it is a lab artifact of those killed plays, kept as
a row in the bug list, not a property of recordings.

Verified: the docs check follows as a job.
2026-11-23 10:15:23 -08:00
Anees Iqbal d876f56b82 Docs: the two killed plays on the RTX 3090 were followed by its driver's GSP timeout
After lane kernmap's two plays of the Intel-made compute recording on
um870's RTX 3090 were stopped at their time limits inside frame 368
(m3-max-71535, 09:28-09:41, and 71553, 09:42-09:57), the card's
telemetry froze from the first sample after the second (09:57:33) and
the driver logged Xid 119 (a GSP RPC timeout, fn 76) at 10:08:36, naming
no process; the node was rebooted. The consumer read its journal and
job log: no guest run touched the card from 08:34:40 until then, and
the driver's out-of-memory group at 09:57 is routine at card open (13
times that day). The planner ruled it a lab artifact of those plays, no
row, written beside the memory-class line.

Verified: the docs check follows as a job.
2026-11-23 10:14:45 -08:00
Anees Iqbal 29b659121e Docs: a recording is a timing source only on a card of its own memory class
Lane kernmap played the consumer's GPU compute benchmark recording, made
on an Intel integrated card, on the RTX 3090 (pin R; m3-max-71535 and
71553, P0, both capped inside frame 368, 0 refused). Frames 366 and 367
alone took about 378 s of GPU-busy time, against 257.2 s for the whole
play on the RX 7900 XTX and 74.3 s on the integrated 780M. The
consumer's own guest on the 3090 runs the same benchmark's workloads in
37.1 s of GPU time in all (native 33.4 s), and its recording of the
same run on the discrete AMD card is 1.3 GB, against this one's 25.3
GB: the Shared storage an integrated guest builds on. The planner ruled
the 3090's frames play-only, and that a recording times only on its own
memory class. The replay doc now says so beside the timing verdict
rule.

Verified: the docs check (workspace Rustdoc, -D warnings) follows as a
job.
2026-11-23 10:03:25 -08:00
Anees Iqbal 9a11fbd543 Docs: the replay player makes and executes no indirect command buffer
docs/REPLAY-STREAM.md said that only an indirect command buffer, "which
the runtime does not build", would read a pipeline state's resource ID.
The runtime builds indirect command buffers; the player is what does
not: making one is "not played on a device" and executing one "not
played on a render encoder" (new_runtime/mod.rs, render.rs), typed
refusals that end the play. The doc now says so beside the refusal rule,
and names what would read a pipeline state's ID: an argument buffer's
pipeline-state member, which the runtime refuses at the making of a
state whose function reads it (rt README, known gaps). The player's
comment on that ID drops the same stale reason.

Verified: the docs check (workspace Rustdoc, -D warnings) follows as a
job.
2026-11-23 09:41:53 -08:00
Anees Iqbal 17473a1a42 Player: a render encoder's residency declarations play through the runtime
The render encoder's arm played its eight residency forms (useResource:usage:,
useResources:count:usage:, useHeap:, useHeaps:count:, each with stages: or without) as nothing,
"as the runtime's render encoder has none". The runtime's RenderCommandEncoder has use_resource
and use_heap now, so they play through it as a compute encoder's do: each resource of the call,
or of its list, through use_resource with the call's usage; each heap, or each of its list,
through use_heap. The stream records each C array and its count as one list, so the usage is
argument 1, and the stages come last; the runtime's render encoder takes no stages, so they are
not read.

What each read before, and now:
- Render encoder, all eight forms: before, no argument and no runtime call; a skipped object they
  named was not counted. Now: the resource ({Buffer: object} or {Texture: object}) or heap of
  argument 0, each of a list; the usage at argument 1; a skipped object is a skipped call, each
  of a list as its own, as docs/REPLAY-STREAM.md says of skipped_calls.
- Compute encoder, the four forms: unchanged in what they read; one resolver (NewRuntime::uses)
  now serves both encoders, and heap_of, which only the compute arm called, is gone.
- The usage: before, 1, 2 or 3, any other value refused. Now MTLResourceUsage's option set of
  read (1), write (2) and sample (4), any other bit or none refused. Without the sample bit, a
  render encoder's useResource:usage: of read | sample, which played as nothing before, would
  now be refused.
- objects_named, which the unwritten count reads a render or blit encoder's call by, and which
  notes the objects a command buffer's encoders name (resource indices owed, placed buffers' and
  no-copy Managed buffers' users, tiled textures' takes): before, bare objects and lists only, so
  a residency declaration's {Buffer: object} or {Texture: object} named nothing. Now it names the
  resource too, on compute and render encoders alike.

docs/REPLAY-STREAM.md: render and compute encoders play their residency declarations through
the runtime's encoder, the stages forms as those without; the unwritten count's reaching calls
include a residency declaration's resource.

Tests: the commit before this one (red: the skipped-object device test and the unwritten test).
2026-11-23 09:02:13 -08:00
Anees Iqbal 3e9cd15b0a Player: a release of an object its device's release dropped plays as nothing
Metal's objects keep their device, so a program may release its device before what it made: a
guest recording's last two calls release the device and then the host's display library made on
it. The player drops everything a device made at the device's release, and the library's release
that followed found no object and stopped the play as an invalid stream, after every frame had
played. The player now keeps the ids a device's release dropped, and the stream's own later
release of one removes it from that set and plays as nothing; the backend released it once,
with the device. Ids are never reused (docs/REPLAY-STREAM.md, section 4), so the set holds only
objects whose release may still come. A second release of such an object, or the release of an
object no call made, still stops the play.

Verified: an_object_released_after_its_device_plays_as_released_with_it and the replay tests in
the job named in the lane's report; no local build.
2026-11-23 08:59:40 -08:00
Anees Iqbal 15af4d5de0 Player: --dump-command-buffers takes a list of ranges and single ids
A play that should dump only the command buffers holding a changed kernel's dispatches had to
dump every command buffer between the first and the last of them: on a recording whose workloads
interleave, tens of gigabytes the compare then reads for nothing. The option now takes LIST:
FIRST..LAST ranges (both ends held) and single ids, joined by commas, in any order
(CommandBufferList, in dumps.rs beside the dumps it selects). Ranges that overlap or touch are
merged and a lookup is one ordered-map search, so a list of thousands of command buffers costs
the play nothing per call. A single FIRST..LAST range reads as before; anything else stops the
play before it starts, as a bad range did.

Before: the dump test helper passed 20..=29 as a RangeInclusive, the only form there was.
Verified: the red tests from the previous commit (a_dump_list_holds_its_ranges_and_ids_and_
nothing_between, a_play_dumps_the_listed_command_buffers_alone) run in the job named in the
lane's report; no local build.
2026-11-23 08:48:02 -08:00
Anees Iqbal 82d1c62eb5 Player: the plural residency declarations play and count as their single forms
A compute encoder's useResources:count:usage: and useHeaps:count: were refused ("not played on a
compute encoder"), so a play stopped at the first one; a guest recording on the Iris Xe stopped
at frame 290 of 430 there. They play now as Metal defines them: each resource of the list as
useResource:usage: with the call's usage, through the runtime's use_resource, and each heap of
the list as useHeap:, through use_heap. The stream records each C array and its count as one
list (docs/REPLAY-STREAM.md), so the usage is argument 1.

What each read before:
- The compute encoder read useResource:usage: alone (its resource as {Buffer: object} or
  {Texture: object}, the usage at argument 1) and refused both plurals.
- The covers rule and the unwritten count read useResource:usage:'s resource with as_object,
  which takes only a bare object, so a recorded {Buffer: object} wrote and uncovered nothing in
  them; both plurals fell through as calls that only name objects. They read the resource now as
  the stream records it (Value::as_resource), and each resource or heap of a plural as its single
  form.
- The render encoder reads none of its residency declarations' arguments (it plays them all as
  nothing), so it read no usage wrongly.

The player's resolvers gain held (a resource value) and block_of (a heap id), which resource and
heap_of now call. docs/REPLAY-STREAM.md says compute encoders play the four forms through the
runtime and that the unwritten count, the skipped calls and the covers rule read the plurals as
their single forms.

Tests (the two commits before this): the device test of a compute encoder's four forms, the
unwritten test of the plural and of the singular on the format, and the covers test of the
plurals. Not run here: no local builds; to be checked on development.
2026-11-23 08:21:07 -08:00
Anees Iqbal 29e54794ca Runtime: a sampler state bound with LOD clamps of its own samples with them
A bind's LOD clamps (setSamplerState:lodMinClamp:lodMaxClamp:atIndex:, its
vertex and fragment forms and the range forms) that read otherwise than the
state's own were Gap::LodClamps. Metal takes the call; on the M3 Max
(conformance cases sampler-bind-lod-clamps-kernel and -fragment) the pair
replaces the state's clamps, a lower bound above the upper reads at the upper's
level, and a plain bind afterwards reads the state's own clamps again.

How: such a bind takes the state's variant of the pair, the state's descriptor
with the pair as its clamps, its device samplers from the shared sampler table,
placed at a variant element of set 1's sampler arrays. The three sampler arrays
grow from 4,000 to 8,000 elements in the runtime's layout; elements 4,000 to
7,999 are the variants'. Shaders declare the heap arrays unsized, so the
translator is unchanged: a slot's sampler index is the runtime's push, and an
argument buffer's sampler index of 4,000 or more still reads element 0, so no
program-written ID reaches a variant. A state keeps its 16 most recently bound
variants; a new one past them takes the place of the least recently bound one
no command buffer holds, and where work holds all 16 the new one is held by its
command buffer alone. Past 4,000 live variants a bind is
Limit::LodClampVariants { max: 4000 }. The lod_clamp_variants gauge counts the
live variants. A NaN bound, which Metal documents no answer for, binds the
state as it is.

The floor's sampler limits rise to 24,000 (maxPerStage and maxDescriptorSet
UpdateAfterBindSamplers) and 286,144 (maxUpdateAfterBindDescriptorsInAllPools);
the lab's least are 500,000 (MoltenVK on the M3 Max) and 1,048,576 (Intel UHD
Graphics 630 on Windows), and Vulkan requires 500,000 of each with
descriptorIndexing.

Gap::LodClamps goes; REFUSALS.md, basis.rs, the signature table, the Metal and
conformance coverage pages regenerate. The validation replay plays clamped
binds (no skipped_clamped_samplers). The ledger drops three rows the clamped
binds now answer (compute-plural-texture-and-sampler-binding steps 11 and 14,
render-state-unread-slots). The compute single clamp form's coverage row named
set_sampler_state; it names set_sampler_state_with_lod_clamps.

Tests: a kernel samples through the binds as Metal reads them; a state's 16
kept variants filled past that; the 4,000 variant elements filled past their
capacity; the gauge flat across a bind and retire loop and zero at device
drop. Verified: see the lane's report (jobs named there).
2026-11-23 00:11:19 -08:00
Anees Iqbal 58148264f8 Conformance: compute-imageblock-sizes, one encoder's dispatches before any imageblock size and at two it sets
A compute step for setImageblockWidth:height: on both sides, and a case that runs
a4_imageblock_extent three times in one encoder: before the encoder sets a size (one
thread, Metal's 1 by 1), then at 4 by 2 and at 4 by 4, each one threadgroup of the
imageblock's extent, into a guarded slot each. The case's test holds Metal's recorded
answer equal to the fixture's own at each extent.

The runtime README states the size as a specialization: each size a kernel runs at is
one VkPipeline made at prepare_dispatch or at the dispatch, a first-use wait, where Metal
changes the size with no compile (m3-max-69983); prepare_dispatch and dispatch_variant
take the size. REPLAY-STREAM and VALIDATION say the player and the engine candidate set
it; the ledger row for the state's imageblock length drops the dispatch refusal.

The recording follows in its own commit (taken on the M3).
2026-11-23 00:09:50 -08:00
Anees Iqbal 41b5038342 Player: a commit waits on the CPU for the backend's own surface fill before it goes
What: the replay player's surface backend keeps its last command buffer on its own queue, a
fill at a shape's making or the refill a picture owes at its first use (Surfaces::unwaited). The
stream's next commit waits for it on the CPU, once, before committing, counted as
surface_host_waits (an executed counter, and in the report's surfaces line). New test
a_surface_picture_fills_before_its_use_behind_another_queues_long_work plays the same picture
behind 256 dispatches over 4 MiB committed first on another queue, and checks the second
picture, one refill and one host wait. The runtime README's queue rule now says what Metal and
the code do: a command buffer sharing a tracked resource with an earlier-committed one of another
queue goes after it only once that one is submitted (the M3 Max rows of that section, jobs
m3-max-52432 and m3-max-52415), a cut command buffer that has begun counting as submitted until
its next piece waits for an event; an event wait holds only its own queue; the fence sentence
says what the code does, Metal's side measured only by jobs m3-max-52186 and m3-max-52188. Its
known gaps name a program that relies on commit order between queues for a shared resource with
no event or fence. docs/REPLAY-STREAM.md gives the wait and its counter.

Why: a_surface_picture_fills_its_shapes_at_their_first_use read the first picture's inverse on
the RX 550, the 780M, the Iris Xe and lavapipe at 62183f55af. On the RX 550, alternated in one
job (m3-max-68619), f979769faf passed 4 of 4 and 62183f55af failed 3 of 4, each failure reading
[239 223 207 64]x4 for [175 159 143 128]x4. The player fills an owed shape by a blit on its own
queue and relied on commit order alone to run it before the stream's kernel on queue #2. Under
the device's room the player's queue had turn 1 (its making fill still in flight) and #2 turn 0,
so has_room and rank sent the kernel's submission first; it took the upload of the first
picture's replace_region, as that upload's contract says, and the refill ran after the kernel.
At f979769faf room was per queue with no rank, so the refill went as it was staged. Metal's
hazard tracking orders such a pair only against work already submitted (the M3 Max rows above),
so the runtime owes no order there, and the player does what a program must: it waits for its
own fill, as the consumer's video paths wait on the CPU.

Verified (check tree 5c42e1bae6, this commit's code; this commit rewords the new test's doc
comment only):
- fmt, clippy plain / --cfg m2v_gpu / --cfg m2v_cpu_icd and workspace Rustdoc, all -D warnings:
  m3-max-68681.
- lavapipe under --cfg m2v_cpu_icd, LP_NUM_THREADS=1, m3-max-68682: with the fix, 129 of 129
  validation replay:: tests pass; with surfaces.rs of f21db0934c (the fix out, the test in), the
  original test reads [239 223 207 64]x4 (rt_replay.rs:2338).
- RX 550 (RADV POLARIS12), m3-max-68686 (archive m3-max-68684): both surface tests pass 4 of 4.
- The new test is not a forcing test. Without the fix it read the first picture in 9 of 9 runs
  started alone with --no-capture (m3-max-68698 one at 256 dispatches; m3-max-68707 four at 256
  and four at 1,024), and the right picture, failing only its host-wait count, in all 3 suite
  runs (m3-max-68682 at 256, m3-max-68711 at 1,024, m3-max-68717 at 1,024 run alone under
  threads-required). What tells those runs apart is not found. With the fix it passes in every
  run above.
2026-11-22 13:32:09 -08:00
Anees Iqbal d15ab4501c Validation: command-replay play --states-only yes plays the state records and presents alone, and the report's first line names the mode
A states-only play was a probe's environment variable (M2V_PROBE_STATES_ONLY, on a probe branch
that never lands): a tree without the probe played the streams in full and said nothing, so two
states-only plays of a translator change read as plays of nothing they were meant to check. The
mode is now an option of the validation player itself, --states-only yes|no (no by default), and
every report's first line names it: `mode full: every call` or `mode states-only: the device,
library, function and pipeline state records and the presents alone (--states-only yes)`. A
bad value is a bad command line (exit 2, `error states-only: ...` as that first line).

Player::states_only passes over every call but MTLCreateSystemDefaultDevice, m2v.deviceIdentity,
the newLibrary*, newFunction*, newDynamicLibrary*, newRenderPipelineState* and
newComputePipelineState* calls and m2v.present, the probe's set unchanged, so frames and the
recording range end where a full play's do and the pipeline states are made cold as a full play
makes them. A states-only play writes none of the matrix's judged metrics, since it runs none of
the work they count.

The completion-fix line keeps its place by itself, now after the mode line; its test reads it
there, and a new test reads the mode line for yes, no and a bad value. docs/REPLAY-STREAM.md
section 10 and the player's module doc and usage name the option and the line.
2026-11-22 07:32:38 -08:00
Anees Iqbal a93a0d69dc Replay player: the unwritten count reads a buffer by its slot's access and its block's earlier bytes
The player's `unwritten` line (Shared buffers a dispatch read before any recorded write, upload
or GPU pass reached them) misread in two of the three ways the tool bug row named:
(1) every buffer a compute encoder bound or used counted as read at the next dispatch, so outputs
    counted: 12,607 of one recording's 12,611 were write-only first bindings;
(3) a buffer made in a stream block counted as unwritten from its making, though m2v.write records
    into the block before the making had put its bytes there.
The third, that commits at m2v.split and m2v.commitPart are not counted, does not hold: the
player plays each as the command buffer's `commit` to the backend (frames_releases_and_splits
and a_part_commits_only_where_the_host_cut_it show the backend's commits), whose commit counts.

Now, per compute encoder, the tracker keeps the waiting buffer bound at each buffer slot, its
state's buffer accesses (ComputePipelineState::buffer_accesses) and the buffers useResource:usage:
names with their usage bits. A dispatch reads a buffer at a slot its state reads and writes it at
a slot it writes; a slot the state does not use touches nothing; a used buffer goes by its read and
write bits. A buffer another call of the encoder named, or one bound under a skipped state, is
read and written, as before, and the line says how many of the count were only counted so. In a
command buffer a dispatch's write comes before later dispatches' reads. At the commit the buffers
read while waiting are counted once each and those written are reached. Each Shared block or heap
keeps the byte ranges reached in it, merged; a buffer made over reached bytes is not waiting.

Tests: a_dispatch_reading_a_buffer_nothing_recorded_reached_is_counted_once (rewritten for slots
and the block's earlier bytes), a_dispatch_reads_a_buffer_only_where_its_state_or_its_usage_reads_it,
a_buffer_made_over_its_block_s_reached_bytes_is_not_unwritten (host), and on the device cfgs
the_unwritten_line_counts_what_a_state_reads_before_anything_reached_it (scale_offset reads #6,
writes #7, reads #11 made over an m2v.write: "unwritten 1", where the old rule counts 3).
docs/REPLAY-STREAM.md's paragraph says the rule.
2026-11-21 18:05:50 -08:00
Anees Iqbal 4a09c07658 Replay player: a play cut after its last frame names the command buffers held there, not an invalid stream
A play cut with --until-frame F (or at its recording range) ended exit 1 with "invalid stream:
command buffers [...] still wait on events at the stream's end" where a command buffer committed
before the cut waited on an event a call past the cut signals (glbench-3090-r4 cut at 400: cbs
128646 and 128648). The calls past the stop may signal it, so the stream is not invalid there.

The player now tells the stream's end from the stop after its last frame. At the stop, the
command buffers still held on events go into Report::held and a `held #ID ...` line, and the
play ends as it would without them (exit 0 for `ok`). At the stream's end a held command buffer
stays the invalid-stream error, a last frame past the end included.

Test: a_play_stopped_after_its_last_frame_names_the_command_buffers_held_there (a synthetic
stream: cut at frame 0 names #4 held and waits for nothing; played whole, the later signal lets
#4 complete; a stream ending with #4 held is invalid with no last frame and with one past its
end). Without the fix the cut play ends Err(Invalid).
2026-11-21 17:27:43 -08:00
Anees Iqbal 7911c011a0 Runtime: a queue keeps on the VkQueue only what it has room for, and another queue's later command buffer passes the rest
A queue sends a group only while it has room (submit::room): with fewer
than two submissions not seen complete always, and with fewer than
IN_FLIGHT while the expected runs behind the oldest, the group's with
them, stay within GROUP_RUN (16 ms). Without room, a command buffer the
held group does not take (by GROUP_RUN, UNSEEN_JOINS or GROUP) waits in
its queue's list, not staged, with the queue's later commits behind it;
the submit thread skips that queue and other queues' later commits go on.
Each held command buffer is scheduled as it would be in a group, in
commit order once its waits are met, its scheduled handlers run: only
its vkQueueSubmit2 waits for room (WorkState::hold). One that presents a
drawable, has nothing for the GPU, or ended sends its queue through to it,
as its group would go at once. Everything that sent a group still sends
it: a signal as staged, a host wait or send_now, stop, a busy completion
thread, an empty command buffer, a conflict with a texture copy.

A group no longer goes at its sixteenth command buffer: the seventeenth
finds it full and waits for room. A queue whose expected run is not yet
known has room for two.

Fences: a wait on another queue also goes after an update in a command
buffer held for room there, scheduled before the waiter was; that queue
goes through to it first. A held head with no group is staged before any
other command buffer, the earliest held first, so the order of holds is
the order fences read.

abandon ends the queue's command buffers not yet scheduled in place, in
the queue's order behind those held for room, which go at once.

Metrics::held_for_room counts the command buffers scheduled while held
for room (api_signatures row).

Why: one queue's backlog no longer delays another queue's command buffer
by more than about GROUP_RUN of that queue's expected GPU time.
2026-11-21 09:18:56 -08:00
Anees Iqbal 215ee0125b replay: the player plays visibility results through rt; the occlusion pools' gauge in its printouts
What: the replay player on the runtime plays a pass's visibility results instead of stopping at
them. `m2v.setPass` carries `visibilityResultType` (Reset, Accumulate) into the runtime's
`RenderPassDescriptor::visibility_result_type` beside the `visibilityResultBuffer` it already
carried, and a render encoder's `setVisibilityResultMode:offset:` plays as
`RenderCommandEncoder::set_visibility_result_mode` (Disabled, Boolean, Counting), whose counts rt
writes into the buffer at the pass's end. What rt does not build is skipped and counted as every
render command gap is (`skipped_render_commands`, a line per kind with its first frame and call):
a mode in an `Accumulate` pass is `Draw { kind: AccumulatedVisibilityResults }`, and a mode rt
refuses as Metal's validation does (no buffer, an offset off 8 or past the buffer, an allocation
byte off 8, an offset taken before) is `Refused(KIND)`, keyed by the refusal's kind alone, the
encoder's mode unchanged. Any other runtime error still ends the play. The player's two gauge
printouts, the frame-end `live` set and the at-drop list the matrix holds at 0
(`M2V-MATRIX gauge replay-rt/device/GAUGE@drop`), add `occlusion_pools`.

rt: a test runs 200 command buffers one after another, each a pass that sets `Counting` and draws;
the occlusion pools read 1 after the 100th and the 200th (a command buffer gives its pools back
before `wait_until_completed` returns), the word 64, and 0 once the device drops. The README's
visibility section says what the gauge counts.

Docs: docs/REPLAY-STREAM.md says the backend plays visibility results, lists the two skipped forms
under the skipped render commands, drops the visibility result buffer from the pass properties the
runtime does not hold (a skipped one still skips the encoder), and names the query pools among the
frame-end gauges.

Why: the planner's ruling for the visibility follow-ups: the player plays the visibility calls a
stream records through rt, counts what rt refuses, and the occlusion pools get the leak gauge
every resource kind has.

Verified: cargo fmt. rt_replay (lavapipe): a Reset pass's Counting and Boolean words (16 and 16 for
a 4 by 4 target, the untouched word's bytes kept), an offset taken twice counted as
Refused(VisibilityResultOffsetTaken) at its call, and an Accumulate pass's two modes counted by
their gap with the buffer's bytes kept; the compile and lavapipe jobs are named in the lane's
report.
2026-11-21 07:09:56 -08:00
Anees Iqbal fc021c92d8 replay: a released index is kept back until every commit before its release has retired
The runtime leaves its consumer the duty never to place at an index pending work may use: a
placement writes the index's set-1 elements, which Vulkan does not define while a pending
command buffer uses them, and a consumer keeps a released ID back until every command buffer
committed before the release has retired (runtime README, "An index has one owner"). The player
stands in for that consumer, but owed an index only to the commits of command buffers that named
its object. A command buffer that reached the object through an ID in memory, and the play's own
blits and copies, owed nothing, so a play could make the undefined write.

Indices::give now owes the released object's index to every commit so far, in commit order. The
naming path stays for command buffers not yet committed at the release, and for a live object a
later one displaces.

A placement owed to a commit held on records not yet played (its command buffer waits for an
event only a later record signals, or is behind one that does on its queue) cannot wait for it
without a deadlock. It used to take the index anyway, counted. It is now kept back: the object
takes the highest free index of its class that no commit in flight is owed, outside the
program's sequence, counted on 'indices kept back N: ...' (it replaces 'indices given while a
commit they owe is held N'). The held buffer reads the object it bound. The kept object's ID
differs from the one the program saw, and the id lines report it. A placement waits only where
no owed commit is held, so every wait can end.

An index the player chooses itself skips one still owed instead of waiting or ignoring it: a
constexpr sampler's (the highest free sampler index; it never waited before) and a texture's
outside the program's IDs (place_outside). A sampler state equal to the one placed last at its
index still takes it without waiting: the runtime writes no element for it.

Tests:
- rt_replay an_index_released_after_a_held_commit_is_kept_back_though_it_names_nothing is the
  forced-order test. Held command buffer #6 binds nothing and was committed before #5's
  release, and its event holds it past #8's placement. #8 must take the highest sampler index,
  counted.
- a_placement_a_held_commit_owes_is_kept_back_and_counted replaces the old take-without-waiting
  test.
- The Indices unit tests cover a release owing every commit before it, and top skipping an owed
  index.

Docs: docs/REPLAY-STREAM.md section 5 (resource IDs, textures outside the program's IDs) and the
backend's report paragraph; the indices.rs module doc.

Verified by the compile and suite jobs named in the hand-over.
2026-11-21 05:28:13 -08:00
Anees Iqbal a449642cc7 rt docs: placing at an index pending work may use is the consumer's duty, not the program's
The sentence said no work in flight may read a displaced object through the index, "the program's
duty, as it is Metal's". It was wrong on both counts:
- A placement at an index a released object still holds for an unretired command buffer writes
  set-1 elements with one vkUpdateDescriptorSets (arrays.rs place_texture, place_samplers_locked).
  Under UPDATE_UNUSED_WHILE_PENDING with PARTIALLY_BOUND, the spec allows that only where no shader
  invocation dynamically uses the element (vkspec 1.4.366, the binding flags' text), so Vulkan
  does not define it.
- Metal hands a released ID out again at once on a Radeon Pro 5300M (oracle job m3-max-63074), so
  a program may be given an ID that work in flight still reads. Keeping the write away from pending
  work is the consumer's duty: it keeps a released ID back until every command buffer committed
  before the release has retired.

The placement is not refused (form (ii), not built). Between the last holder's retirement and the
block-maker's deferred vacate the index is still the released object's, and a placement then is
defined; a refusal would meet a guest there. The displaced form stays for that window, and the docs
say so.

Docs only: the runtime README's index paragraph and sampler line, docs/RESOURCE-ID.md, the replay
player's rationale in docs/REPLAY-STREAM.md, and the safety contracts of place_texture,
place_samplers and hold_samplers and new_texture's doc. Verified: cargo fmt, the API signatures
check; Rustdoc runs in the quick check after the land.
2026-11-21 04:34:13 -08:00
Anees Iqbal 53d429143a Replay: a lost device's fault addresses are placed among the stream's buffers and heaps
What: the runtime player's `loss` line places each access address of the driver's fault report
among the stream's buffers and heaps, as the play made them. An access's range is the address
rounded down to its precision, `precision` bytes long. The line names each live buffer or heap
the range meets, by address, with the address's offset in it. Then it names each of the last
65,536 released ones it meets, newest first, with the frame and call of the release. It shows
at most 8 of each, then "N more". Where none meets the range, it says the address is outside
every buffer and heap of the stream. The released spans are kept in a bounded queue, filled at
each release. Live spans are read from the object table only when the device was lost. A
texture is placed only through the heap or block it lies in, and the play's own buffers are not
placed. docs/REPLAY-STREAM.md documents the line.

Why: the runtime reports the driver's addresses as given (DeviceLoss::fault) and places none,
since only its caller knows what each range was. The player is that caller for a stream: a
replay that loses the device on a 3090 then says which of the stream's objects the fault hit,
whether it was live or freed (and when), or that it hit none.

Test: new_runtime::tests::a_fault_s_access_is_placed_among_the_stream_s_buffers_and_heaps:
- a live buffer and the live heap it lies in, by address with offsets;
- a page that meets a buffer starting past the address (negative offset);
- two released buffers, newest first, with their release positions;
- an address outside everything;
- the queue filled past its 65,536 entries, so the oldest is gone.

Verified: cargo fmt --all. Build, clippy and the tests run in the job named in the lane's report.
2026-11-21 00:59:14 -08:00
Anees Iqbal 5ea6b63f01 Replay: a render encoder's residency declarations play as nothing
What: the runtime player plays a render encoder's useResource:usage:, useResource:usage:stages:,
useResources:count:usage:, useResources:count:usage:stages:, useHeap:, useHeap:stages:,
useHeaps:count: and useHeaps:count:stages: with no runtime call. Until now each was refused
("not played on a render encoder"), which ended the play. What these calls name is still
noted before the call plays, as for any encoder call (tiled-texture takes, index reads,
covers, place users). docs/REPLAY-STREAM.md lists the eight among what render encoders play.

Why: a recorded consumer stream (run 62101 of the 3090 Xid 13 investigation) stopped at frame
239 on its first render encoder's useHeaps:count:stages:, before any heap-pass draw. The
consumer's runtime backend makes no rt call for these either (reims-vgpu 14c00263ef,
crates/reims-vgpu-vulkan/src/rt_platform/render.rs:310-312 puts UseHeaps and UseHeapsStages in
the arm that does nothing; :301-309 notes a useResources texture's tiled take and
own-index read, and makes no rt call). The runtime's render encoder has no residency call, and
every object of a play is resident.

Test: rt_replay's a_render_encoder_s_residency_declarations_play_as_nothing (device tests,
--cfg m2v_gpu or m2v_cpu_icd). After a triangle, a stream makes a heap and declares all eight
forms on the render encoder, naming the heap and the vertex buffers, then draws again. The play
ends, nothing is skipped and the target checks green. Before this change the first declaration
was refused.

Verified: cargo fmt --all. Build, clippy and the lavapipe device tests run in the job named in
the lane's report.
2026-11-21 00:56:28 -08:00
Anees Iqbal 0156925ec6 Runtime: a lost device's loss carries the driver's fault report (VK_EXT_device_fault)
What: device creation enables VK_EXT_device_fault and its deviceFault feature where the device
lists the extension (one of the floor's optional extensions; Vulkan requires the feature of a
device that lists it). At the device's first loss of the runtime's own whose result is
ERROR_DEVICE_LOST (a failed vkQueueSubmit2, or the completion thread's semaphore read or wait),
the runtime reads vkGetDeviceFaultInfoEXT once, counts then records, into the new
DeviceLoss::fault: the driver's description, its memory accesses and its instruction pointers
apart (each a FaultAddress of kind, address and precision, as reported), and its vendor records.
A loss the consumer reports (Device::report_loss) is never read: it may name a device that is not
lost, and the query is valid only on a lost one (VUID-vkGetDeviceFaultInfoEXT-device-07336). The
runtime places no address; the consumer, told of every allocation's map and unmap, places them
among its own blocks and buffers. The replay player prints the loss and its report as a `loss`
line of its report (docs/REPLAY-STREAM.md).

Why: two RTX 3090s lost the device with Xid 13 (Graphics SM Warp Exception: MMU Fault) in a
consumer step, and neither the runtime nor the consumer could say which address faulted.

Public API (breaking): DeviceLoss gains `fault` and is no longer Copy; new DeviceFault and
FaultAddress; floor::Features gains `fault`; OPTIONAL_EXTENSIONS gains VK_EXT_device_fault.
api_signatures.tsv blessed; docs/REFUSALS.md regenerated (unchanged).

Verified: the 11-19 minimal repro (a dispatch reading through a freed buffer's address) with
deviceFault enabled, on um870's RTX 3090 (NVIDIA 620.70.06), job m3-max-62203: the device was lost
at the first empty submission after Xid 109 (11.5 s after Xid 13), and the report gave
READ_INVALID 0xdef63a3000 precision 0x1000, inside the freed buffer's range, and
INSTRUCTION_POINTER_FAULT 0xdefdfeb950 precision 0x10; no description, no vendor records.
2026-11-21 00:45:34 -08:00
Anees Iqbal 62c563f564 replay: the over-copies' causes among the executed counters
The report counted over-copies and their bytes, and those over imported blocks, but not why the
runtime keeps each texture in an image of its own. The runtime already splits them by cause in
Metrics (over_copies_host_memory, _pitch and the ten like them, each with its bytes). The backend
now reports all twelve pairs, so a frame's, a completed group's and the total's over-copies split
by cause. This is what the planner asked for to split the 48,710 small over-copies across the link.

Validation only; the runtime is unchanged. The replay stage test now also checks that two of the
keys are there.
2026-11-20 20:10:00 -08:00
Anees Iqbal 9027bd2aa3 rt: count scheduled-to-start under earlier GPU spans, GPU-end-to-handler steps and calibrations
The clean 5080 re-play's print needs three things the stage sums alone cannot give.

First, how much of each command buffer's span from scheduling to GPU start lies under other
command buffers' GPU spans, the runtime's own uploads and copy-ins included, against the part
under none of them. This is Metrics::scheduled_to_gpu_start_behind_nanos.

Second, its span from GPU end to handlers split at the completion thread's own steps. This is
Metrics::gpu_end_to_handler_steps_nanos, six steps:
- seen: GPU end to the thread seeing the completion;
- told: telling the submit thread;
- stamp read: reading the round's timestamps;
- calibration: a calibration, where the round runs one;
- earlier: the round's earlier retirements, their handlers included;
- own: its own retirement until its handlers begin.
The same steps are kept for the command buffers of 1,024 us or more (gpu_end_to_handler_tail
and its steps), so a 1-8 ms tail can be placed in a step.

Third, the calibrations and their calls' time. The counter that only the tests had becomes
Metrics::calibrations, beside calibration_nanos.

The replay backend reports all of these as executed counters.

Counting only; nothing changes form. There are no new waits, locks or allocations. What each
count costs:
- Completion thread, per round: two clock reads (the stamp read's start and end), and a third
  where it calibrates. The period check reuses the stamp read's end, so it no longer reads the
  clock itself.
- Per command buffer retired: one clock read where its retirement begins, then for one that
  counts stages:
  - one pass over a fixed ring of the latest 128 GPU spans, a stack array in the completion
    thread;
  - a sort, on the stack, of those that meet its span;
  - one relaxed atomic add for the behind part;
  - six for the steps, and seven more for one in the tail.
- Per upload or copy-in retired: the timestamps it already read go into that ring. There is no
  second query read.
- Per calibration: two clock reads and two relaxed atomic adds.

Retirement returns an upload's and a copy-in's two timestamps (times::retire_own). The
completion thread places them on the host clock by the calibration as it stands
(Calibration::at, which moves nothing), and the program's command buffers' spans as placed.

Tests:
- host tests for the ring's merged, clipped union and its oldest-first replacement;
- a host test for the round's steps adding up to the span;
- the device stage test now checks that the six steps add up to gpu_end_to_handler_nanos, that
  the behind part is at most scheduled_to_gpu_start_nanos, and that the device start
  calibrated;
- the replay stage test checks the same through the report's keys.
2026-11-20 20:09:37 -08:00
Anees Iqbal b1b5168fd6 Replay report: untimed waits, the runtime's stage sums and its stage histograms by frame
The 5080 play of a 3090 compute recording waited 42.5 s of 95.1 s wall with 23.1 s of gpu_busy;
before a fix is ruled on, the report must say where the other 19.4 s went. Three reads were
missing from it:

- A waited command buffer with no GPU interval (start 0, or end not past start) adds nothing to
  gpu_busy while its wait counts in full. Each frame's end line now has untimed_waits and
  untimed_wait (the wait spent on them), and the report sums them in an `untimed waits` line.
- The runtime already histograms every command buffer's commit to scheduled, scheduled to GPU
  start, GPU run and GPU end to handler, but only in power-of-two buckets, which give no seconds.
  Metrics now keeps each stage's sum beside its histogram (commit_to_scheduled_nanos and the
  three like it), counted in the same call as the bucket.
- The player printed none of it. The backend's executed counters, so every frame line and the
  total, now carry the four sums, held_starts and held_start_gap_nanos, runtime_command_buffers
  and runtime_command_buffer_gpu_nanos (the uploads and copy-ins that run outside every Metal
  command buffer's GPU interval), and untimed_command_buffers. The four histograms print at the
  play's end as `stages F ...` lines, cumulative as each frame ended, and `stages end ...`.
  They are not per-frame counters, so the 69k `completed` lines of a long play do not grow by
  92 keys each.

Tests: the runtime's stage histogram test also checks each sum against the three command
buffers' own times (exact for the first three stages, bounded by the host time after each
finished for the fourth); a player test on the synthetic backend counts a frame's untimed
waits (none and zero-length intervals) and the report's sum; a lavapipe replay test reads the
new counters and the stages lines across two frames.
2026-11-20 19:44:55 -08:00
Anees Iqbal 999b82bfe2 player: a pipeline state's making counts what it made, lowered, loaded and VkPipelines, and a load makes its content new
What: each group and each slow making carries "L lowered, D loaded, P VkPipelines"
(translations, translations_loaded, pipelines_created). A making is of "new" content where it
made any of them, and "held" where it made none.

Why: the warm pass of m3-max-60954 showed the first form calling a load-only compute state
"held", and using the word "cold" in a second pass.

Verified: the same test, which now also checks the counts and the held state's zero driver time,
green in m3-max-60980.
2026-11-20 17:38:00 -08:00
Anees Iqbal 10d00d44b4 player: each pipeline state's making split into the translator's, the driver's and the rest
What: the replay report gains a `pipeline makes N states: ...` summary line and up to ten
`pipeline make slowest K #ID KINDS ...` lines, documented in docs/REPLAY-STREAM.md. KINDS is
kernel, vertex or post-tessellation vertex, plus +fragment.

How: each render and compute state's making is read from metal2vulkan-runtime's own Metrics on
the player's thread before and after it, with the wall time on rt::host_time (the counters' own
clock): translation_nanos against pipeline_creation_nanos, and the rest as "other". No runtime
counter is added. rt makes every state on the calling thread, and the only other thread that can
run beside a making is the player's own pre-pass. So the pre-pass pool now tallies its
prepare_dispatch calls begun and ended. A making that ran while one of them ran is counted
("beside a pre-pass call") and marked, since its figures include that call's work. The compute
states' `pipeline I wall_nanos=` lines take their wall time from the same clock.

Why: the next cold number needs its cause beside it: per pipeline, the translator's work against
the driver's vkCreate*Pipelines.

Verified: replay::rt_replay::each_pipeline_state_s_making_is_split_into_the_translator_s_and_the_driver_s_time
on lavapipe (m3-max-60980, with fmt, clippy plain, m2v_gpu and m2v_cpu_icd, and workspace
Rustdoc green). Without the line it fails at the summary-line find. On a real card: the cold and
warm states-only plays of one recorded stream on an RTX 3090 (m3-max-60954).
2026-11-20 17:38:00 -08:00
Anees Iqbal 2628c03fb2 player: a Windows host's video surfaces through an NT handle (--video-handle opaque-win32)
The Windows plays of boot-idle-780m-1 stopped at frame 212, the stream's first video surface:
"error newTextureWithDescriptor:iosurface:plane:: the device exports no DmaBuf" (60780). The
video stand-in knew only the Unix routes, a dma-buf (the default) and an opaque fd, while the
runtime exports a surface on Windows through an NT handle (ExportHandle::OpaqueWin32), and
answers NoExport for a dma-buf there, correctly.

VideoHandle gains OpaqueWin32 (`--video-handle opaque-win32`): the surface is exported as an NT
handle at the opaque fd's layout, pitch multiple 4, start multiple 1, no rows below. The runtime
lays both opaque handles alike, each plane's LINEAR image at the driver's own pitch (its guide,
the surfaces' handles), and its own Windows surface tests make the surface at those multiples
(tests/surface.rs: the NVIDIA row and BUSY_ROWS on Windows). command-replay and
docs/REPLAY-STREAM.md name the route.

Test: new_runtime::tests::each_video_handle_names_its_export_and_layout.
2026-11-20 16:53:38 -08:00
Anees Iqbal 1fc878dc12 player: count every creation it does not attempt, by selector, reason and root
A call that makes an object on a skipped receiver, or naming a skipped object, made its result
skipped without a line: such a pipeline state counted only in skipped_objects or skipped_calls,
so a stream's 494 render pipeline states against the play's 493 passed unseen.

Each such creation is now counted by its selector and reason (its receiver is skipped, or it
names a skipped object), the reason naming the selector that made the chain's first object
skipped; each skipped object keeps that root, inherited along the chain and removed at release.
The report prints a `not attempted SELECTOR N: WHY, the first #ID (its root #ROOT)` line for
each, the counter `not_attempted`, and a line that adds up the pipeline states: render states
made, refused and not attempted, and the compute states the same. The existing counts are
unchanged.

Test: new_runtime::tests::creations_not_attempted_are_counted_by_kind_and_root (a library from
source skipped, a function of it, two render states of that function, one refused state).
2026-11-20 15:52:07 -08:00
Anees Iqbal 66e8f70882 replay player: the m2v.privateBytes snapshot path goes; the unsnapshotted count stays
What, deleted:
- Backend::snapshots, and its answers on the runtime backend (false) and the tests' mock;
- Player::without_snapshots and the player's snapshots flag, and command-replay's
  --snapshots yes|no option; the device line is now `device NAME runtime rt`;
- the split around a named dispatch (split, blit_between, the player's own objects and the
  open-encoder tracking it needed), the snapshot compare, Snapshot, Around and sized;
- Report's private, splits and split_executed, with the `private ...` and `split N executed`
  lines, and PrivateBytes with its re-export; the covered and receivers lines lose their
  always-zero snapshot range counts;
- Covers::meets, which only the split used.

Kept: the records are still read ahead, with the same check of their form and that each names
an earlier call. Each dispatch they name plays as the program made it and counts on the
`unsnapshotted` line.

Tests: the split test goes. The two no-snapshot tests become one that checks the named
dispatch plays as recorded and is counted, and one that checks a record naming no earlier call
stops the play. The covered and receivers tests take the new line text.

Docs: REPLAY-STREAM.md drops the option, the snapshot wording, the `private` line and the bytes
before as a write path, and says what the player does with the records now.

Why: the runtime backend is the only one left, and it answered snapshots() false, so on every
play the split, the compare and their report fields could not be reached. Only the mock reached
them.

How verified: the lane's compile gate with the validation suite on lavapipe.
2026-11-20 11:18:04 -08:00
Anees Iqbal c120b74608 replay player: a noted buffer's address in written bytes moves with the buffer
What: once the stream notes a buffer escaped (m2v.bufferEscaped), the player no longer stops at a
written word whose value lies in that buffer's recorded range (PlayError::NotedWord, now deleted).
It moves the word with AddressMap::move_noted to AddressMap::relocated(value), the address the play
gave the innermost live range the value lies in plus the same offset, the same move an address
argument gets. This happens after the census counts and before the bytes reach the backend, on
all five write paths:
- set*Bytes data;
- a copied buffer's contents;
- m2v.write;
- the m2v.copyFromGuestRam pieces;
- the m2v.privateBytes bytes before a dispatch.
A new stream count, noted_words, counts the words moved. The census counts are still taken from
the bytes as the stream holds them.

Why: the runtime backend makes objects where it has room, so a pointer the program wrote into
memory held the recorded address and pointed at nothing in the play. The stop ended every replay
of a stream whose buffers escape (one of reims's plays stopped at frame 216). Every live range has
the address the backend made its object at; a make without one already stops at the make. So
every noted word can be placed, and the stop has no case left. A pointer into memory no live
range holds cannot be told from data and plays as recorded, as before. This runs on every
backend and device; nothing is keyed by identity.

Docs: REPLAY-STREAM.md section 5 (written words and the escape note) and section 10 (the stream
counts and the addresses line), VALIDATION.md, and command-replay's addresses line, which gains
noted_words.

Tests:
- Unit (mock backend), a_word_into_a_buffer_noted_escaped_moves_with_it. After the note, a word
  in an m2v.write and a word in setBytes data each move to the mock's base plus their offset,
  and are counted as noted. The same word written before the note, and a word into a buffer with
  no note, play as written.
- lavapipe, a_noted_buffer_s_address_in_written_bytes_moves_and_a_kernel_follows_it. A block at a
  recorded address holds a data buffer noted escaped (kind 0) and a buffer whose written word is
  the data buffer's recorded address plus 16. The fixture kernel ab_address (out[i] = held.p[i])
  follows the moved word, and out holds the data words from the fifth on, exactly.
- Negative: the two tests on development's tip without the move. The play stops with NotedWord.

How verified: the lane's compile gate with the validation suite on lavapipe, and the negative job.
2026-11-20 10:50:42 -08:00
Anees Iqbal 58beab6630 REPLAY-STREAM: the player as it plays now, on the runtime alone
The player's one backend is the runtime's (replay/new_runtime, through
rt_replay, from command-replay play). The doc still described a second
backend over the deleted runtime and every rule where the two parted:

- Section 5's recorded-address placement (pins, heaps split by their
  buffers and textures, PlayError::Unpinned) is deleted; the backend
  places each object where the runtime has room and moves the address
  arguments. The resource-ID rule says the runtime's own placement.
- Section 9's heap note on the old player goes.
- Section 10: one copy rule for Managed buffers, one announced-bytes
  rule, no old backend refusal list; the snapshot procedure is replaced
  by what the backend does (it takes none, so each named dispatch plays
  as it is, on the unsnapshotted line) and the split line goes with it;
  the executed counts are the runtime's metrics (Device::counters, as
  new_runtime's counters() reads them); the tiled-texture stand-in and
  the video-surface pages no longer name the old forms; the report's
  device line reads 'runtime rt', and its pinned line and the old
  runtime's gauges and covers go.
- 'the new runtime' and 'either runtime' read 'the runtime'; two plays
  compare across devices or commits.

Not built; docs only. The gate for the whole pass follows.
2026-11-20 10:27:18 -08:00
Anees Iqbal 8871d40bdf Validation: delete the old runtime's lane, parity harness, player backend and old-only tools
The old runtime goes at the cutover, and validation's old-runtime-only parts go with it:

- runtime_lane/ (the old runtime's device tests) and the Metal predication probe that pinned
  its streams. Its one rt-based module, the replay player's rt device tests, moves to
  replay/rt_replay.rs with its three old-runtime comparisons cut (the census test on both
  runtimes goes; its rt half is its own test) and a pipeline cache directory of its own in the
  scratch root.
- parity/ (Metal programs compared with the old runtime alone) and its Metal records under
  corpus/observations/parity.
- The player's old backend (replay/old_runtime): command-replay always plays on the new runtime,
  and `--runtime` is gone.
- corpus-draw-ab and format-scout (old-runtime-only tools), scripts/making-bench (corpus-draw-ab's
  bench), and the eleven public fixtures only the deleted sources used.
- The nextest overrides of runtime_lane tests, the queue-plan test group and the few-channels
  profile; the matrix's device-test filter now names replay::rt_replay.
- VALIDATION.md, REPLAY-STREAM.md and validation's README lose the lines of what went.

The candidate executor's runtime path, and validation's dependency on metal2vulkan-runtime, go in
the next commit.
2026-11-20 05:42:33 -08:00
Anees Iqbal 5458ac7954 validation: a check or dump of a buffer with two copies names the copy it read
A two-copy stream's Managed buffer has a CPU copy, which Metal's contents answers, and a device
copy, which commands read. The player's check and dump read the CPU copy (Backend::read on the new
runtime), and nothing said so: on a discrete card, two plays' dumps of #106455 agreed as CPU copies
while the device copies the kernel read differed (count word 1848 against 12), and the verdict
'inputs equal' rested on them.

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

Tests: a_read_of_a_buffer_with_two_copies_says_which_copy_it_took (no device: both labels in the
check lines and dumps, the compare of like and unlike copies) and, on a device,
a_check_of_a_managed_buffer_names_the_copy_it_read (a blit's fill reaches the device copy: the CPU
copy reads zeros, the device copy read back reads 7s; the header line where the device keeps a
device copy). docs/REPLAY-STREAM.md section 10 says it.
2026-11-19 20:00:32 -08:00
Anees Iqbal f61fee8aac replay: the new runtime's play reports its commits' waits for the work lock
The executed counters take the runtime's commit_lock_wait_nanos, so a frame's line gives its
commits' waits for the work lock, summed; the backend's lines give commit_lock_wait_max_nanos,
the longest wait in the play, which is a maximum and no frame's counter. The runtime has no
product metric of the other calls' waits for the lock (the surface make's included): only the
device tests' per-thread total times those (crate::submit::waits).

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

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

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

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

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

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

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

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

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

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

Tests: replay::tests::a_kept_present_writes_the_shown_texture_s_bytes_and_each_end_its_time,
a_picture_difference_is_sized_by_texels_channels_and_box,
two_plays_kept_pictures_that_differ_are_sized.
2026-11-19 16:55:04 -08:00
Anees Iqbal c46b159238 replay: the new runtime's play reads a Private texture through a copy
A check of a Private texture (a stream's m2v.check, or the shown texture of a present that
--check-presents lists) read it with getBytes, which the runtime refuses for a Private texture as
Metal does, so a digest play on the new runtime stopped at the first listed present whose texture
is Private ("the CPU reaches no Private or Memoryless texture"; syncview plays on Iris and the
3090 stopped at frame 296). The old runtime's play reads every texture through a blit. The new
runtime's now copies a Private texture's first level into a Shared block on its read queue, as it
reads a Private buffer, and waits for it; a texture the CPU reaches keeps getBytes.

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

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

Verified: see the check job named in the landing.
2026-11-19 15:29:30 -08:00
Anees Iqbal 42fd38d03a replay: the player's video surface waits for its ready point once it is made
The surface make now submits and waits for nothing (9c4eca8313): each in-place plane image leaves
the undefined layout in the runtime's next submission, a move that may discard the memory's bytes,
and the consumer calls Surface::wait_until_ready before the other API's first write. The player's
rt arm made video surfaces without that wait, so its plays of a video recording did not do what the
product does between a surface's make and its first picture. It now waits once at the make (the
earliest the player knows the surface's format and size), before any m2v.externalWriteDone
acquires it, and the report's executed counters carry the runtime's surface_waits.
docs/REPLAY-STREAM.md section 10 says so.

Test: runtime_lane::rt_replay::a_video_surface_is_waited_for_at_its_ready_point_once (Unix: one
surface for two plane textures, two acquires, surface_waits equal to the surfaces made in place).
2026-11-19 14:30:47 -08:00
Anees Iqbal c6d78ec93f replay: --check-presents checks the texture a listed frame's present shows
A timing verdict between two plays (compare-plays) needs equal digests at the judged frame, and a
stream without m2v.check records (the desktop-and-video recording has none) gave no frame a
verdict. command-replay play --check-presents F,... now checks, at the m2v.present of each listed
frame, the texture the present shows, as an m2v.check of it with no recorded checksum would: a
check line of that frame, which compare-plays reads as the frame's digest. A present of nil
checks nothing. The readback is the player's own work (uncounted) and its time is the frame's
read, so the digests come from a play apart from the timed ones; docs/REPLAY-STREAM.md says so
in the player's section and in the verdict rule.

Test: replay::tests::a_listed_present_checks_the_shown_texture (no checks unlisted; checks at
frames 1 and 3 of the listed 1, 2, 3, frame 2's present being nil; the line's digest is the
backend's bytes; every present still ends its frame).
2026-11-19 14:20:06 -08:00
Anees Iqbal 798dfcda6a replay docs: the video surfaces' form and --video-handle
docs/REPLAY-STREAM.md section 10 now says how the new runtime's backend plays a buffer made as a
video surface's pages (one surface through Device::new_exported_surface, its plane textures' views,
the acquire at m2v.externalWriteDone, no shapes or refills), what --video-handle picks (dma-buf with
the VA-API layout, opaque-fd with NVIDIA's), what the video-surfaces report line and the video_*
counters count, and how the old runtime's backend plays the same buffer; section 4's table says the
same for the two records. Docs only.
2026-11-19 14:20:06 -08:00
Anees Iqbal 347a33736a replay rt: the report counts patch draws through a pipeline record without tessellation
A render pipeline record without the tessellation key comes from a recorder
that did not carry it (glbench-3090-r2, glbench-3090-r3 and glbench-780m-r1
hold 19 post-tessellation records, none with the key; the newer recorders
write the key on every record, the defaults included), so the program's
tessellation state there is unknown and the player draws with Metal's
defaults in its place. The new runtime's backend marks each such state at its
making, carries the mark to the encoder at setRenderPipelineState:, and counts
the patch draws it plays through one: patch_draws_unrecorded_tessellation in
each frame line and the total, and a report line saying the state is unknown.
A released state drops its mark. REPLAY-STREAM.md says a record without the
key does not hold the program's state.

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

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

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

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

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

Tests: two device-free tests in replay::new_runtime::tests. The refusal test fails on the old
single `Translation` key; the substitute test does not build without the per-kind count.
2026-11-19 13:37:53 -08:00