Commit Graph
5670 Commits
Author SHA1 Message Date
Anees Iqbal 1a6fcf6ece A kernel's patch control-point input stays refused: pin it and say why
What: an ABI test, a_kernel_takes_no_control_point_input, decodes one synthetic module's
air.patch_control_point_input (its declared, never-defined fetch function and two fields) on a
post-tessellation vertex function and checks that the same input on a kernel is refused,
InvalidInput(Abi(UnknownKey)) at argument 0 and that key. docs/API.md's kernel [[stage_in]]
section states the refusal, Metal's answer, and the two forms through which a kernel does read
vertices by index.

Why: Metal refuses the shape too. `metal` (32023.922) writes no control-point input for a
kernel: every MSL spelling fails to compile ("invalid type 'patch_control_point<CP>' for input
declaration in a kernel function"). A kernel assembled by hand in the post-tessellation shape
(xcrun metal-as, metallib) gives a library and a function on an M3 Max under macOS 27.0.1, whose
reflection lists both fields as control-point stage-input attributes. Every compute pipeline of
it fails, "Internal compiler error.", under Constant, ThreadPositionInGridX (rates 1 and 2, a
region origin of 2), ThreadPositionInGridY and both indexed steps. Without a descriptor Metal
asks for one, and a vertex step function in a compute descriptor stops at a framework
assertion. As a check that the module was well formed, the same body as a [[patch(quad, 4)]]
vertex function makes its render pipeline and fetches patch p's point j as element 4p + j. As a
check of the host and the descriptors, an MSL kernel [[stage_in]] of the same attributes makes
a pipeline under every one of them. So the refusal stays where it is, at the pipeline compile.
The ABI has no error kind for a role outside its stage other than UnknownKey (its documentation
covers a role the stage does not accept), so the error kind is unchanged and REFUSALS.md does
not move.

Verified: the M3 probes ran as potluck jobs m3-max-30194, 30197, 30201 and 30203. The test,
clippy, and a negative control (the role allowed on a kernel, which fails the test) ran in one
msi job, named in the report.

Checks (msi m3-max-30227 at 70b57adf99): clippy -D warnings plain and cpu_icd exit 0; 74 touched
tests pass; negative control (the refusal made to accept) fails the new test, exit 100. No
RUNTIME bump: the refusal and its error are unchanged.
2026-11-14 13:56:59 -08:00
Anees Iqbal b8b03a31cc Lanes: leading_costs and compositor_costs measure what a frame's attachment reads cost on the GPU
What: two ignored release lanes in metal2vulkan-validation, measurement only. No product code
changes.
- runtime_lane::attachment_read_costs::leading_costs: a reader whose snapshots lead its
  instance, against the split's copy. Its private plane lies at 64-byte aligned rows, which a
  linear image takes in place.
- runtime_lane::compositor_costs: a compositor-shaped frame of 105 render encoders, with the
  read ratios of a consumer's desktop walk. It comes in four shapes:
  - readers as they are;
  - readers whose read texel decides a branch, which take the split;
  - the same calls without barriers;
  - no reads at all, the frame's floor.
  Each shape runs over a private framebuffer and over one on host pages. The lane prints GPU ms
  a frame with passes, barriers, splits, snapshots and copied texels.

Why: to size a lever before building it. Measured (median of 15 frames, GPU ms):
- Iris Xe, ANV (m3-max-30191 at d2c9d15a73):
  - host pages: floor 28.07, readers 37.87, branch readers 39.32, no barriers 39.18;
  - private: floor 6.89, no barriers 10.94, branch readers 12.48, readers 13.30.
- RTX 5080 (b5080), floor / no barriers / branch readers / readers:
  - private: 0.97 / 1.62 / 1.99 / 2.25;
  - host pages: 30.22 / 35.17 / 38.81 / 41.06.
On Iris, serving branch readers by snapshots would save about 24 us a reader over host pages,
under the bar for building it. Fills over host pages cost 4.1x (Iris) and 31x (5080) the
private ones. No 3090 run was made.

Checks: msi m3-max-30230 at 163c7efdbf: clippy -D warnings (runtime + validation, all targets,
all features) plain and cpu_icd, both exit 0. No RUNTIME or SEMANTICS bump: no artifact's run
changes.
2026-11-14 13:55:28 -08:00
Anees Iqbal 38cc6ae244 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 13:53:44 -08:00
Anees Iqbal ec6f1a1109 RUNTIME 2313: DeviceRecovered's announced cost states the pooled ICB records RUNTIME 2311 loses; device-leg tests count lazy shadows and size depth heaps by the query
Three fixes from the device legs at 4aacef045b (Radeon 780M HawkPoint m3-max-30180) and pin 93's
checks at b89241fafa (merged m3-max-30182, lavapipe m3-max-30185).

1. Degradation::DeviceRecovered's cost string now says what docs/API.md's catalogue entry says
   since RUNTIME 2311 (dfda37628d). An indirect command buffer's records are lost at a recovery:
   - on a device that imports no host pointer;
   - where their import failed;
   - under the default DevicePolicy::indirect_records = IndirectRecordsPolicy::Untaxed, on a
     device whose check found that a held host-pointer import costs every submission (RADV, ANV
     on i915), where they lie in pooled memory.
   They are kept in the runtime's own pages everywhere else, and under
   IndirectRecordsPolicy::Carried, which exact_answers() selects. RUNTIME 2311 changed the entry
   but not the announced cost, so tests::degradation_catalogue::a_runtime_kind_s_entry_states_the_cost_it_announces
   failed on every venue.
2. The tests that check the form a texture takes as it is made (a shadow, or in place, exactly
   one) now count a texture whose shadow RUNTIME 2309 (e453efbf0a) leaves unmade until the first
   reach as a shadow. runtime_lane::shadow_forms counts shadowed_textures + shadows_left_unmade -
   shadows_made_at_use. It is used in no_copy_textures, pitched_surfaces, linear_alignments,
   in_place_textures, aliased_surfaces and device_copies; the runtime's
   texture_placement_device path() reads an unmade shadow as "shadow". Each texture still takes
   exactly one form.
3. store_out_device's two depth tests lay their no-copy heap over pages sized by
   Device::heap_texture_size_and_align, as a program sizes a heap. They had taken 64 KiB whatever
   the device answered, and failed on the 780M with OutOfMemory(Heap).

RUNTIME_VERSION moves because the device-recovered notice's announced text changes. Fixes 2 and
3 are test-only. No new Degradation kind, no WorkCounts field, no public item.

Verified (lane devlegs, msi lavapipe m3-max-30224 at 399ca0a0b3):
- clippy -D warnings plain and cpu_icd (runtime + validation, all targets, all features) exit 0;
- 129 of the 131 selected tests passed and none failed; the job was cancelled with 2 still
  running, at its RAM reservation. The passes include degradation_catalogue 5/5,
  pitched_surfaces::a_texture_that_only_reads_keeps_every_byte_of_its_pages_in_place (it fails
  at b89241fafa), no_copy_textures *_padded x5, linear_alignments, texture_placement_device x2,
  store_out_device 9/9 and degrade_notices.
The 780M rerun follows on the next pin's archive.
2026-11-14 13:53:00 -08:00
Anees Iqbal 05d5da5ba6 Re-bless the authored compile census at pin 93
The census at b89241fafa (m3-max-30184, M3) moves only the artifacts_at product fingerprint
(RUNTIME 2309-2312 and the translator changes since pin 92); every row is unchanged. The engine
golden bless (m3-max-30183) wrote no change.
2026-11-14 13:36:30 -08:00
Anees Iqbal b89241fafa Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 13:12:39 -08:00
Anees Iqbal 22fa0997b1 RUNTIME 2312: A write-only argument-buffer use of a texture whose writes Metal drops names none of its image
What. A command that makes a texture resident whose writes Metal drops
(metal::format::writes_dropped: the 4:2:2 formats, the subsampled and packed
two-plane YCbCr ones) names no use of it where its binding plan's heap holds
it at no element (no WriteSource::HeapEntry of its token): every heap storage
array holds such a texture as its neutral (bind::heap's Fit::Dropped), and a
kernel that only writes it declares no sampled array, so its function reaches
none of the texture's image (binding.rs, resident_uses_into; the storage-only
test holds_write_shadow becomes heap_holds, by class access or any).

Why. A kernel that only wrote a YCBCR8_420_2P texture through an argument
buffer (useResource WRITE) named the texture's image as a written use. That
use matched the texture's converted shadow, so the command's shadow planning
made and recorded the planes' conversion (ShadowCopies::prepare ->
YCbCrConversion::make), and on a device that converts 4:2:0 itself (Iris Xe:
the consumer's pin 92 Iris leg, writes_through_argument_buffers_of_two_plane_
ycbcr_textures_are_the_slots) that first conversion announced
ycbcr-filter-not-exact though nothing read the texture: relayed in default
mode, fatal in strict mode. The write itself was dropped, as Metal drops it.
4:4:4 textures already named only their write shadow. Now such a command
converts nothing and announces nothing; a command whose function reads the
texture through the argument buffer (a sampled array holds it) converts it
and announces the device's conversion as before.

Test: runtime_lane::ycbcr_argument_writes::a_kernel_that_only_writes_a_held_
420_texture_converts_none_of_its_planes (lavapipe and GPU lanes): resident
WRITE and READ|WRITE, the write-only kernel records no conversion
(ycbcr_refreshes + ycbcr_whole_conversions), announces no
ycbcr-filter-not-exact and leaves the planes' bytes; a kernel reading it
through the argument buffer records one conversion and announces the notice
where the device converted the texture itself. lavapipe converts 4:2:0
through Metal's arithmetic, so there the conversion count is the check that
fails without the fix. docs/API.md's catalogue entry and ycbcr.rs's writes
bullet say so.

Verified (lane ycbcrnote, at 12dbbcc67e on fe38b678dc):
- msi lavapipe m3-max-30151: touched lane tests 173/173 and runtime cpu_icd
  tests 238/238; clippy -D warnings plain and cpu_icd exit 0. Negative control
  in the same job (binding.rs back to fe38b678dc): the new test fails at "the
  writing command converted the planes".
- RTX 5080 (b5080 entry ycbcrnote-held420-130832, prebuilt m2v_gpu archive):
  passes; device conversion true, write-only commands announce nothing, the
  reading command announces YCbCrFilterNotExact once.
- msi m3-max-30159: clippy -D warnings under m2v_gpu and rustdoc -D warnings
  exit 0.
Expected, not run: the consumer's Iris strict test passes.
RUNTIME_VERSION moves: the same artifact's write-only commands now record and
announce nothing where they converted and announced before.
2026-11-14 13:11:54 -08:00
Anees Iqbal 4aacef045b Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 12:49:52 -08:00
Anees Iqbal dfda37628d RUNTIME 2311: ICB records lie in pooled memory where a held pointer import taxes every submission
What: DevicePolicy gains indirect_records (IndirectRecordsPolicy, a runtime
choice no profile carries). Under the default, Untaxed, an indirect command
buffer's records and overflow slots take fresh pages of the runtime's own
(a pointer import held for the buffer's life) only where the device's import
tax check has not found that a held pointer import costs every submission, or
has not answered; where it has (RADV, ANV on i915), they lie in pooled
host-visible memory as the runtime's other buffers do. Under Carried, which
exact_answers() selects, they lie in fresh pages wherever the device imports
host pointers, as before, so a recovery keeps them. A recovery of a taxed
device under the default loses pooled records and rewrites them as a new
buffer's (carry.rs's existing pooled path); the device-recovered notice
already counts such buffers ("N indirect command buffers, M of them whose
records were lost"), as on a device without pointer imports and for
device-local records on discrete GPUs. No new Degradation kind.

Why: on a Radeon 780M (RADV, Mesa 26.2.6, Linux 7.3.3) beside a guest game
whose ICB records were the process's only pointer imports (3 buffers, 19.6 MB),
the submission thread had 5 windows of 65-140 ms in 12 s in which every
amdgpu_cs_ioctl waited in mmu_interval_read_begin or returned EAGAIN (373 of
the run's 382 failed calls, retried at once by libdrm). RADV lists every
imported memory in every CS, amdgpu re-faults every userptr page each CS and
adds the CS fence to every listed BO, so a page migration of one of those
pages (kcompactd, khugepaged, and the runtime's own block making in direct
compaction) waits in amdgpu_hmm_invalidate_gfx for all the process's GPU work
in flight while every submission waits behind it. With no userptr BO listed,
compaction migrates pages without waiting on any fence.

Docs: the FAST-PATHS ledger row (default, switch, the recovery cost, the
measured chain), API.md's device-recovered text, HOWTO's residency section,
fresh_pages.rs, indirect_command_buffer.rs and carry.rs, the conformance
crate's Policy::Exact list. API: signatures blessed, api_surface row,
REFUSALS.md regenerated.

Tests: tests::icb_records_policy (Linux, cpu_icd/gpu): the import tax forced
Holds/Fails; under Untaxed+Holds the records lie in pooled memory, no fresh
pages made, a recovery moves them and its notice counts 1 lost; under
Untaxed+Fails and Carried+Holds in the runtime's own pages, kept, 0 lost. The
translator's fast_paths names the choice, checks it keys no profile and that
exact_answers() takes Carried. icb_carry_race's own-pages cases run on a
Carried device (device_recovery::carried_device), so they assert the carry of
own pages whatever the device's verdict.

RUNTIME_VERSION moves: where records lie and what a recovery keeps change on taxed devices.
New public items: metal2vulkan::device::IndirectRecordsPolicy { Untaxed, Carried } and
DevicePolicy::indirect_records.

Verified, msi m3-max-30127 at cba1ec585a (the fix plus a test-only fix: DevicePolicy is
non-exhaustive, so the tests set the field on a copy):
- clippy -D warnings --all-targets --all-features: metal2vulkan + runtime plain 0, runtime
  --cfg m2v_cpu_icd 0;
- translator tests 49/49 (fast_paths with the new choice, its no-profile key and exact_answers
  tests, api_surface, api_signatures);
- runtime under cpu_icd on llvmpipe 34/34: icb_records_policy, icb_carry_race, icb_records_home,
  indirect_command_buffer*, device_recovery_every_kind, device_recovery_carry.
ICB-RECORDS lines:
- Untaxed with the tax forced Holds: records not in own pages, 0 fresh-page buffers, the
  carry moved them, notice "1 of them whose records were lost";
- Untaxed with the tax forced Fails: own pages, 2 fresh-page buffers, kept;
- Carried with the tax forced Holds: own pages, 2, kept.
Workload proof owed: reims's traced loaded-desktop walk on the 780M (per-CS get_user_pages 0, no
-EAGAIN windows).
2026-11-14 12:49:09 -08:00
Anees Iqbal 483b4650d1 fixed_index_draws example: a frame of indexed draws whose indices a dispatch before each draw writes
What a GL-on-Metal layer's frames cost the GPU where a compute dispatch before each draw fixes
up that draw's index buffer (each dispatch writing a Private buffer of its own, in serial compute
encoders of 256 dispatches, then render passes of 26 indexed draws, 4 passes a command buffer),
beside the same frame with the indices written once before (prefixed) and the compute encoders
alone (dispatches). The defaults follow a GL benchmark's per-second counts on the runtime (about
470 compute encoders of 256 dispatches, 4,650 passes of 26 draws, 1,270 command buffers).

The kernel and the draw's functions are a new owned MSL fixture,
fixtures/public/examples/fixed_indices.metal, compiled by regen-air-fixtures --dir examples.

Release measurement on an RTX 5080 Laptop GPU (b5080 entry glfix-framesplit-124152; GPU busy per frame, union of
command-buffer spans, median of 60 frames; a frame of 1280 draws):
- fixed: 0.526 ms;
- prefixed: 0.404 ms;
- compute encoders alone: 0.116 ms (0.09 us a dispatch).
fixed minus prefixed equals the dispatches' own time, so the compute-to-render transitions and the extra command
buffers cost about 0.006 ms a frame. No runtime source changes; the runtime pin moves alone.

Verified: msi m3-max-30123 at 195f2073fd:
- runtime crate clippy -D warnings --all-targets --all-features, plain and --cfg m2v_cpu_icd: 0;
- release build: 0;
- a lavapipe run of all three shapes: the index check passed after each.
2026-11-14 12:46:26 -08:00
Anees Iqbal fe38b678dc Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 12:23:29 -08:00
Anees Iqbal ce54ad8b25 RUNTIME 2310: an unshared commit on its way goes before another queue's batch whose room came after it
A scheduler pass that found another queue's batch's room let it go while an unshared queue's
commit there, taken in, waited only for the runtime: its host step (handed to the steps'
thread in the same pass), its submission checks, or a shared event's value whose signal was
already submitted and had not landed. Order::next refused the unshared head and sent the
other batch; the unshared command buffer then waited for that whole batch on the GPU. In
reims's traced walk ld91 (um870 Radeon 780M, guest compositor beside gameload) another queue's
batch went in while a compositor's command buffer so waited ahead of 33 of the 46 frames
answered more than a refresh late: 20 at its host step (e.g. take 1794684425.009: gameload
#19392 committed -3.0, submitted +2.6, inside WS #19398's commit +2.3 -> submit +2.8), 13
waiting for the landing of its other unshared queue's signal.

The rule (unshared_hold.rs, "Commits on their way"): each unshared commit carries its place
among those posted on its VkQueue (SlotShare::posted_unshared now answers it). Each look
collects the unshared heads on their way (on_its_way: binary semaphores ready, every event
value reached or reached by a submitted signal, held only for its host step with no pipeline
making pending, or for its checks) that wait behind no earlier commit (is_behind), and a
batch whose room came is held (behind_commits) while one posted before its noted count leads
its line so. The step's end, the checks or the landing wake the scheduler's thread, whose
next pass sends the unshared one first. Each look asks again: a head waiting for anything
else (a value nothing submitted reaches, a binary semaphore, a making, a decode, a rebind) or
behind an earlier commit (the held batch's own included) holds nothing, so neither waits for
the other. Other threads' passes leave such batches to the scheduler's thread
(first_for_the_thread widened to heads on their way), which they wake. Counted in the
existing WorkCounts::heads_held_for_unshared_commits (doc widened). No switch, no public item,
no Degradation kind. Docs: unshared_hold.rs, FAST-PATHS unshared-isolation row, API.md.

Tests: unshared_hold unit test of behind_commits with places on their way; queue_share_device
(lavapipe), each leg by the scheduler's pass and a committing thread's:
an_unshared_head_at_its_host_step_goes_before_work_whose_room_came_after_its_commit,
an_unshared_head_waiting_for_a_signal_to_land_goes_before_work_whose_room_came_after,
an_unshared_head_behind_an_earlier_commit_of_the_held_queue_holds_nothing,
an_unshared_head_waiting_for_a_value_nothing_submitted_reaches_holds_nothing.

RUNTIME_VERSION moves: what a run submits, and in what order, changes.

Verified (msi lavapipe):
- m3-max-30046 at 71c8bf7337 (the rule plus a test-only fix), runtime crate, --all-features
  --all-targets -D warnings:
  - clippy plain and --cfg m2v_cpu_icd: 0;
  - 103/103 tests: unshared_hold, queue_share, queue_share_device, scheduler,
    scheduler_held_wakes, scheduler_wakes, inbox, waiter_submits, commit_and_submit, hold_sites,
    dispatch_pending, queue_limits_device, stall.
- New tests, each run once through the scheduler's pass and once through a committing thread's:
  - at its host step: the other buffer began 0.168 / 0.199 ms after the unshared one;
  - waiting for a signal to land: 0.183 / 0.206 ms after;
  - behind an earlier commit: holds nothing;
  - waiting for an unreached value: holds nothing.
  The RV2303 tests still pass.
- Negative controls:
  - m3-max-30021, rule off: both "goes before" tests fail (the other buffer began 1.519 ms
    before the unshared one);
  - m3-max-30036, the two no-hold exclusions removed: both no-hold tests time out at 20 s.
- Test-only fix in this change: RV2303's committing-thread test held its scheduler thread with an
  application batch that now correctly waits behind the stepping unshared dispatch. Its holder is
  now a command buffer on another unshared queue, which nothing holds back.
2026-11-14 12:22:47 -08:00
Anees Iqbal bfb51bc5c2 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 12:16:00 -08:00
Anees Iqbal e453efbf0a RUNTIME 2309: a texture whose rows are in place makes its shadow at the first reach of its image
A device-gap texture over a buffer (its image refused for a reason that leaves its rows in
place: format, pitch, placement, source, dma-buf) was a shadow made at new_texture: its
VkImage, memory and views, its notice and shadow-log line, and its slot in the texture table
and every heap set. A slot whose function only reads, writes or asks its size binds the rows
in place, so a texture only ever bound that way paid for a shadow no command used (reims's
gbs91 on the 780M: hundreds of such textures, 8 to 52 MB each).

Now such a texture (rows in place, no pending in-place verdict, not over a heap's buffer) is
made with its shadow left unmade (texture/lazy_shadow.rs): the storage accessor makes it at
the first reach, once, under a lock, with the making's notice, log line and counts, then
places its slot (its resource ID reads the neutral until then). Paths that must not make it
read the recipe instead (rows binding, placement and heap-set writes, CPU copies, blits on
the bytes, shape and plan questions, logging). The reaches that make it: a slot that binds
the image (before the command's copies are planned from its uses), use_resource, a pass's
attachment, an execution of commands inheriting the bindings, a view, its VkImage handed out.
An out-of-memory making fails the reaching call, as new_texture did.

WorkCounts::shadows_left_unmade and shadows_made_at_use count both halves; docs/API.md says
when the shadowed-texture notice is given.

Not in scope: two kinds still make their shadow at new_texture. A texture waiting on its pages'
in-place verdict may move in place. A texture over a heap's buffer is made resident by use_heap
through a path that checks the shadow.

RUNTIME_VERSION moves because the run's announcements change. The shadowed-texture notice and the
shadow-log line come at the making, and a texture only ever bound through its rows gives neither.
A resource-ID read of an unmade texture gets the neutral. No new Degradation kind. No FAST-PATHS
row: the copy work follows uses, not the shadow's existence (an unbound shadow was copied 0 times
per commit before and after), so no accuracy is traded. The saving is the making: the VkImage, its
memory, views and heap-set slots.

Test: tests::texel_rows_device::a_shadow_is_made_at_the_first_reach_of_its_image, on a copied
buffer, since over the pages lavapipe lays the rows in place. Three cases:
- a written-only texture: shadows_left_unmade +1, none made, shadowed_textures 0,
  shadow_copies 0, texels inverted in the pages;
- a rows write then a sample in one command buffer: made at the sample, copies > 0, pixels equal
  to a device-own texture's;
- use_resource: made at the call.
joined_residency's helper asserts shadows_bytes() where it asserted the shadow at new_texture.

Verified, msi m3-max-30024 at 088a73d3b7:
- clippy -D warnings, runtime crate, all targets and features: plain and --cfg m2v_cpu_icd exit 0;
- lavapipe 206/206: texel_rows, shadow*, read_twin*, joined_residency, padding/kept_padding,
  exported_*, first_host_texture, surface_shapes, attached_read*, copied_device, fresh_pages,
  texture::*;
- translator api_signatures, api_surface and fast_paths: 47/47;
- the negative control in the same job (lazy = false): the test fails at "Copy: left unmade",
  (0,0,1) against (1,0,0).
2026-11-14 12:15:15 -08:00
Anees Iqbal 9972bec765 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 12:06:15 -08:00
Anees Iqbal 160837e4e0 Rebound draws gather shadow uses that differ from the kept draw's instead of stopping
A draw rebound that was not carried in went on only where its uses of shadowed
textures (ShadowUse::used_as: the shadow, writes, area, own-pixel read bounds)
equalled its kept draw's, since it gathered nothing into its instance. Another
shadow at a changed slot, or own-pixel bounds that follow a restated scissor,
stopped it, and the draw took every step. That is the largest rebind stop in the
780M desktop walk (draws_rebind_stopped_arguments_shadows 62,642 of 98,870
stops; Launchpad 24.1k, Mission Control 26.6k).

Now such a draw gathers its own shadow uses into its instance as every step
does (shadow::join, through InstanceShadows::add, or InstanceShadows::join for
a narrowed draw), as a carried draw already did, and keeps them as the uses the
next draw rebound compares with. It still stops where it uses some and its kept
draw used none, or the other way: Kept::again follows that. A new check stops a
draw that reads a color's copy after a barrier inside its instance (counted
_checks): every step splits there or weighs the spare, and only the shadow stop
kept such draws out before. The debug rebound check compares a ninth part, the
draw's shadow uses against its every step's.

kept_shadowed_draws: the kept frame's commands recorded (every kind) and copies
equal the every-step frame's; its second-target and scissor draws rebound
instead of stopping; a lane of draws of other arguments (base instance
alternating) rebinds every draw after the first; a lane across a barrier stops
at the new check, with the split and texels of every step.

Also: examples/draw_costs gains a "backdrops" shape (every compositor draw reads its pass's colour
at its own pixel under its own scissor), which the A/B below uses.

No new WorkCounts field or Degradation kind. No RUNTIME_VERSION bump: the commands, copies and
pixels are those every step records. The runtime pin moves alone.

Verified (msi lavapipe):
- Base repro m3-max-29949: the kept frame had as_before 2, rebound 0, stopped 2.
- kept_shadowed_draws, 4 lanes. Each compares the kept frame with an every-step frame on pixels,
  copy counts with copied texels, and the recorded command map. At the tip:
  - plain lane: stops 2 -> 0;
  - other-arguments lane: _arguments_shadows 2 -> 0;
  - a lane where the rebound draws are the last to use a shadow: _shadows 3 -> 0;
  - barrier lane: _checks 1, with 1 split.
- Negative control m3-max-30008, by hand:
  - restoring the stop fails 3 lanes (_shadows 2/2/3);
  - removing the gather fails 3 lanes on copied texels (1124 vs 2048) and on the last-use lane
    (copies 1 vs 2, texels 525 vs 1313).
- Release A/B m3-max-29983/30002:
  - base 88f577d11c md5 48293e84, tip 882c9a785b md5 daa3de5b;
  - own target dirs, P-cores, 5 interleaved rounds, medians per draw.
  Results:
  - backdrops: cpu 9963.7 -> 6688.9 ns (-32.9%), instructions 75034 -> 50632 (-32.5%);
    _arguments_shadows 1856 -> 0 and rebound 383 -> 2239 over 2240 draws;
  - compositor: instructions 54492 -> 54493 with identical counts (time +2.2%, noise).
- m3-max-30016 at 1494716c54: clippy -D warnings --all-targets --all-features (runtime crate), plain
  and --cfg m2v_cpu_icd, exit 0; 204/204 touched tests: draw_again, kept_shadowed_draws,
  render_fold, encoder_fold, kept_*, rebind_*, shadow_*, attached_read_*, render::shadows.
2026-11-14 12:05:33 -08:00
Anees Iqbal 15eab80f10 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 12:04:22 -08:00
Anees Iqbal 818ebc942d A render encoder that split carries its kept draw: the Split check holds pieces alone
carry_ends refused to carry the kept draw of an encoder whose pass split into instances (a reader
of a colour after a barrier over the targets). The check came in with the first carry commit
(fa7bb25dd2) as a scope limit, not a Metal ordering rule. A carried draw records into the next
encoder's own first instance, after everything the ended encoder recorded, so nothing is
reordered, and carried_into already resets every field that depends on the instance (stated,
between, stamps, under, command_buffer, settled). The check now refuses only an instance split
into pieces: draws recorded before an execution of render commands, or the draw of a pipeline
still being made. The counter names (Uncarried::Split, encoders_uncarried_split,
encoders_none_kept_next_split) stay; their docs now say pieces.

No new WorkCounts field or Degradation kind. No RUNTIME_VERSION bump: the commands, state commands
and pixels are those every step records. The runtime pin moves alone.

Test: split_keeps' kept_draws_past_a_split_carry_into_the_next_encoder: two encoders of A, B, a
barrier, a reader, A, B, B again twice, each on a queue of its own. Kept run against every-step
run:
- kept_draws_rehomed (4, 0); draws_rebound_carried drawn_alone(2) (1 in debug, where the first
  carried draw takes the every-step check);
- draws_none_kept (4, 14); no unlike, stopped or carry-stopped draws; encoders_uncarried_split and
  encoders_none_kept_next_split (0, 0);
- the same commands, draw states recorded and pixels as every step.
draw_again's run_into can now open several encoders: the first clears, later ones load.

Verified (msi lavapipe):
- m3-max-29979 at 150bcb4dc5 (later commits change only doc comments): clippy -D warnings, plain and
  --cfg m2v_cpu_icd, exit 0; 145/145 tests in 35 touched modules, carried_draws and both split_keeps
  tests among them.
- Negative control m3-max-29991, the old check restored: the test fails on draws_rebound_carried,
  (0, 0) against (1, 0).
- Release A/B of walk_costs' barriers private shape:
  - builds m3-max-29980, base 042d11378b md5 0f833451, tip md5 27e08f2f, own target dirs;
  - runs m3-max-30010, 15 interleaved rounds on P-cores.
  Per frame: draws_none_kept 9 -> 3, draws_rebound 6 -> 12 (6 carried), encoders_uncarried_split
  3 -> 0, no cmd_* count changed. CPU per frame: base median 175.9 us, tip 175.2; paired median
  -4.2 us, tip slower in 6 of 15. msi's load average was 13-27 throughout, so: neutral within noise
  on lavapipe, where ~76% of the encoding thread is the driver.
2026-11-14 12:03:41 -08:00
Anees Iqbal 6353690110 Re-bless the golden hashes and the authored compile census at SEMANTICS 2114
SEMANTICS 2114 (2960070096: write() through an argument buffer to a two-plane YCbCr texture)
changed the SPIR-V of heap float writes, so 14 golden hashes moved. The authored compile census
was re-run at the same tip.

Verified: pin 92 at 5c9d222e05. The merged job m3-max-29974 failed only
tests::golden_hashes::golden_hashes_match_the_table (5748/5749 core; validation 1387/1387,
conformance 1043/1043, clippy, doctests, rustdoc, private docs all 0). Bless m3-max-29975
(inventory, golden, printouts 0) gave this table. Census m3-max-29976 exited 0.
2026-11-14 12:01:47 -08:00
Anees Iqbal 5c9d222e05 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 11:35:28 -08:00
Anees Iqbal e0744825a5 A replayed draw walks its plan's heap members and its resident uses once, not at each draw
A plan's descriptor writes and uses number one for each resource its heap
reaches (every texture an encoder made resident, in each heap array), and a
draw's uses begin with those of everything its encoder made resident. Three
per-draw checks walked them at every draw, though their answers are fixed for
the plan or for the resident uses' identity, so a host step's replay of an
indirect command buffer paid every resident texture at every command:

- binding::binds_own_zeros (every write of the plan) is now a fact of the plan,
  worked out as its pipeline state settles it (PlanFacts::own_zeros);
- the read-twin slot proofs (read_only_slot / read_only_buffer_slot, a walk of
  the plan's uses and writes for each slot) are worked out once for the plan,
  the first time a draw asks on a device with read twins, and kept in its facts
  (binding::TwinProofs, which replaces TwinSlots::of with TwinProofs::slots); a
  command's own uses name no slot (debug-asserted), so the proofs are the
  plan's alone. A dispatch works its out per dispatch, as before; a test's
  device that binds twins unproven proves them at each command;
- EncoderCore::note_draw's check for a write of a read twin walks the uses of
  what the encoder made resident once for their identity (ResidentPrefix,
  process-unique; the same uses wherever it is) and the draw's own uses past
  them at each draw (refuses_twin_write_past).

render.rs and render/draw_again/rebound.rs change one statement each at their
call sites (facts.twins().slots, facts.own_zeros()).

Test: tests::resident_uses's
draws_walk_their_plan_and_resident_uses_once_however_many_textures_are_resident
counts, on a device with a read twin, the plan walks and twin-write checks of
each draw with 0 and 64 more textures made resident: the first draw walks
more with more, every later draw the same and nothing of its plan.
Also: examples/icb_reads gains a gpu-step shape (`icb_reads --only gpu-step --heap-textures H
[--no-twin] --runs 9`), a host-stepped execution of textured draws a kernel writes, reading its
textures through a material argument buffer over a heap. It prints host_step_ns_per_command.

No RUNTIME_VERSION bump: the same commands and answers, worked out fewer times. The pin moves
alone. No new Degradation kind or WorkCounts field; the walk counters are test-only.

Verified:
- msi m3-max-29962 at be9eff60d2 (runtime crate, --all-features --all-targets, -D warnings):
  - clippy plain, --cfg m2v_cpu_icd and --cfg m2v_gpu: 0;
  - rustdoc: 0;
  - 134/134 touched tests on lavapipe: resident_uses, draw_again, read_twin_device, twin_reads,
    twin_flights, shadow_twins, host_step_neutrals, icb_carry_race, icb_records_home,
    indirect_command_buffer and its device suite, kept_heap_uses, carried_draws,
    neutral_zeros_shared.
- Negative control by hand (m3-max-29957): the count test fails. Per draw, 147 plan entries walked
  and 11 uses checked with 0 extra textures, against 531 and 75 with 64.
- Release A/B (m3-max-29960, msi lavapipe):
  - base 5608c77dbb md5 65c9a10d, tip 0aae380fcc (this fix before its clean rebase) md5 197ac4e6;
  - own target dirs, P-cores, 3 interleaved rounds, 8192 commands a step, medians of 9.
  Host-step ns per replayed command, base -> tip:
  - H=8: twin 3851 -> 3839, no twin 3866 -> 3811;
  - H=512: twin 4676 -> 3881, no twin 4268 -> 3864;
  - H=2048: twin 7533 -> 3991, no twin 5845 -> 3981.
  At the tip the cost is flat in H.
2026-11-14 11:34:48 -08:00
Anees Iqbal 042d11378b Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 11:32:19 -08:00
Anees Iqbal 88f577d11c A split keeps the encoder's kept draws: re-homed into the instance after it
A draw that recorded into a later render pass instance after a split (a read
of a color attachment's texture after a barrier over the render targets, the
walk's reader) kept nothing, and a draw that keeps nothing forgets every kept
draw its encoder set aside: each later draw of the pass's other states took
every step again. A draw recorded into an instance recorded inline after a
split (render/inline_splits.rs) was never kept either (draws_unkept_other).

What changed:
- render.rs: `split_alone`, set where a draw keeps nothing only because it
  began a later instance after a split (no continuation, no stand-in's
  arrival), of the shape, views and formats of the instance before, its
  other steps a plain draw's. Then `rehome_aside` keeps the kept draws set
  aside with other states' bind states into that instance, but those that
  read the pass's colors other than through snapshots of their own, readers
  through snapshots, draws carried in and not drawn since, and those whose
  `Under` (moves, residency, sampler slots, rebinds, aliases) differs, which
  it lets go.
- draw_again.rs: `Kept::rehomed_into` marks a kept draw re-homed (`rehomed`):
  after draws of other states, under a render state of another stamp,
  through no record, so its next draw is rebound.
- rebound.rs: a re-homed draw's uses are made whole and its shadowed
  textures' uses gathered into its new instance where it uses them as its
  kept draw did, as a carried draw's are.
- A plain draw into an instance recorded inline after a split is now kept
  (`plain` no longer requires no room). A kept draw's next draw there is
  always rebound (draw_again's room guard), and its recording goes into the
  room (`record_rebound`), recorded at the group's end through the pass's
  record as every step's; `settled` stays None there.
- The debug check compares `rehomed` as the every step it takes keeps it.

New WorkCounts field: kept_draws_rehomed. No new Degradation kind.

Test: tests/split_keeps.rs, kept_draws_set_aside_are_rebound_past_a_split
(A sampling, B adding, a barrier, a reader of the target that splits, A and B
of other bindings, B twice again with no call between): 2 kept draws
re-homed, the draws after the split rebound (drawn_alone(4)), none unlike or
stopped, no draws_unkept_other, the same commands, state commands and pixels
as every draw taking every step, and the pixels of the draws after the split
those of what they bound. tests/draw_again.rs: `run_into` (a run into a
given target) split out of `run_on`; `checks_ended` and `drawn_alone` shared.

No RUNTIME_VERSION bump: the commands, state commands and pixels are those every step records.
The runtime pin moves alone.

Verified on msi (lavapipe):
- m3-max-29952 at 15ba7cf939: clippy -D warnings, plain and --cfg m2v_cpu_icd, exit 0; 143 of 144
  tests in 35 touched modules passed (draw_again, inline_splits, inline_continues, carried_draws,
  kept_*, snapshot_reader_*, attached_read_*, learned_coverage, leading_snapshots, shadow_runs and
  others). The one failure was the new test. Its first draw ran before any fragment buffer was
  bound, so that draw's rebind stopped, which is correct. The test now binds fragment buffer 0
  first, as the walk does.
- m3-max-29958 at e8daf89d87 (test code only since 15ba7cf939): clippy --cfg m2v_cpu_icd exit 0;
  split_keeps passes.
- In debug, the re-homed draw and the draw in the room take the every-step check and pass it.
2026-11-14 11:31:39 -08:00
Anees Iqbal f07887b354 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 11:30:38 -08:00
Anees Iqbal 41bac06524 RUNTIME 2308: no explicit DRM_FORMAT_MOD_LINEAR plane at a row pitch NVIDIA's shaders misread
On NVIDIA's proprietary driver, a DRM_FORMAT_MOD_LINEAR image with an explicit plane at a row
pitch that is no multiple of 32 bytes is made, and vkGetImageSubresourceLayout reports that pitch
back, but its shaders read the rows at another pitch. Measured case: 64 x 64 BGRA8Unorm at rows
272 bytes apart is read by a kernel at 256 and copied out by a blit at 272. Rows 288, 320, 384 and
1024 apart read right.

Measured on:
- the RTX 5080 Laptop GPU (615.71.09): the sweep over every multiple of 16 bytes to 1024;
- the RTX 3090 (620.70.06).
Both over host pages and over the device's own memory.

Vulkan makes the implementation validate an explicit plane layout and refuse one it cannot use
(VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT), so no documented rule explains the
misread: it is a driver defect. It caused the 5080's wrong texels on development. A texture in
place over host pages, at rows padded 16 bytes past their texels, read other rows through the
pitched route; a read twin at rows 272 apart was one such texture.

The change:
- RuntimeDriverDefect::ExplicitPlanePitchMisread, on every NVIDIA GPU and release until a probe
  finds a clean one.
- Device::explicit_plane_pitch refuses such a plane at a row pitch that is no multiple of 32 where
  the device has the defect. It does so in both makers of an explicit plane: pitched_image (host
  allocations and the device's own memory) and explicit_plane_image (dma-bufs). The texture then
  takes its shadow (Refusal::Pitch; the shadowed-texture notice names the pitch), or texel rows
  for a slot that only reads.
- The bound is the measurement, not the driver's own linear alignment. The driver's own linear
  images lay rows at multiples of 128, and keying on that would shadow 288 and 320, which read
  right.
- A cfg(test) switch, DeviceShared::explicit_plane_pitch_misread_forced, stands in for the defect
  on a driver that reads such planes right (lavapipe).
- docs: a FAST-PATHS known gap (NVIDIA's pitch, with both measurements); api_signatures.tsv +1.
  REFUSALS.md is unchanged.

No new Degradation kind or WorkCounts field. RUNTIME_VERSION moves because in-place routes change
on NVIDIA, and the linear-alignment records are keyed on it.

Tests:
- textures_at_padded_rows_read_their_bytes: 64 x 64 BGRA8Unorm at 256, 272, 288, 320, 384 and
  1024, over host pages and the device's own memory, each read by a kernel and by a blit. No
  pitched image at 272 where the defect applies.
- The same test under the forced defect: on lavapipe, 272 moves off the pitched image and reads
  right, while 288 stays pitched.
- driver_defects lists the new defect.
- The padded-rows sweep tests, and the shadow log test's twin at padded rows.

Verified:
- msi m3-max-29913 at 7a64d31930:
  - clippy -D warnings, all targets and features: plain, --cfg m2v_gpu and --cfg m2v_cpu_icd all
    exit 0;
  - lavapipe read_twin_device, driver_defects, in_place_check and shadow_causes_device: 43/43;
  - api_signatures, api_surface and fast_paths: 47/47.
- Negative control (rule disabled): the forced test fails with pitched 1 at 272.
- RTX 5080 at 39d564abc4 (archive md5 dd1f3982, b5080 entry roip2-fixarch-5080-112137):
  read_twin_device 20/20. That includes the shadow log test that failed before: its twin at 272
  now takes the twin's shadow.
- The RTX 3090 run of the same archive (m3-max-29951) is queued; its result follows in the lane.
2026-11-14 11:29:56 -08:00
Anees Iqbal b0ed7c6c24 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 11:07:50 -08:00
Anees Iqbal 1db01c30be Compute encoders park their core's box and bind state between group members; command buffers reuse record-list storage
== Compute encoders park their core's box and bind state, with its memo, in the command buffer for the next
A command buffer of one-dispatch compute encoders (dispatch_chain's encoders shape) cost the
host about twice a serial encoder of the same dispatches: on msi lavapipe (release, d2c72548cd)
4270/3557 ns a dispatch folded against 1458/1539 serial. Each folded encoder's first dispatch
settled again what the encoder before it had settled for the same bindings: each end let the
dispatch memo go as it gave the bind state to the device's spares, and the next encoder's new
table took a new stamp.

- An ended compute encoder parks the box of its core and its bind state, with its memo, in its
  command buffer (State::park_compute, under the end's one lock), and the command buffer's next
  compute encoder opens on them (under the open's one lock) rather than on the device's spares.
  The commit gives them back to the device, its memo let go. The core's contents are built at
  each open as before; only its box goes on.
- A parked entry lets go of the device's sampler states it listed
  (DispatchMemo::unlist_samplers), as the command buffer holds none of them; the dispatch that
  takes it lists them again (restamp): those the device lists at the count of sampler slot
  changes the entry compares, so the very states it listed. The resident textures' lists are
  emptied at each end as before.
- A dispatch whose memo entry holds in every input but its table's stamp brings the state in
  place, and where that changed no value of any kind (Reshape::moved empty) and the samplers'
  maps are the entry's, takes the entry under the new stamp (LiveDispatch::settled_across,
  Across::Taken): the entry is a function of the bind state and of the inputs DispatchMemo
  compares beside the stamp, which stands only for the table-derived part of that state. Builds
  with debug assertions assert the entry's planned shape is the state's. Where a value moved,
  settle_live takes the state as that refresh left it, with its samplers' maps, and does not
  bring it in place again (Across::Refreshed): the same inputs, so the same state.
- WorkCounts: parked_compute_taken and dispatches_settled_across_encoders (new).
  api_signatures.tsv (+2).
- New tests::compute_parked (m2v_gpu / m2v_cpu_icd): eight compute encoders of the same bindings
  in a command buffer, each after a blit fill of their output, on a device holding a live
  sampler state, take 7 parked and settle 7 across encoders in each of two command buffers, and
  the last writes its words after the fill; eight that each bind another offset of the output
  take 7 parked and settle none across, each writing its own words.
- Call sites of end_with_replay in blit.rs and render.rs pass no parked state (render.rs: one
  line).

Verified:
- Clippy (-D warnings, --all-targets --all-features, runtime crate; plain and --cfg m2v_cpu_icd)
  and nextest on msi lavapipe (m2v_cpu_icd): the runtime suites compute_parked,
  compute_instantiated, compute_bind_memo, encoder_fold, render_fold, encoder_state_locks,
  encoder_holds, held_lately, dispatch_pending, dispatch_tracking, inert_dispatch, submit_check,
  submit_check_device, submit_failure, submit_failure_device, pending_rebind,
  rebind_behind_a_wait, rebind_descriptor_slip, rebind_making_wait, tiled_texture_reencode and
  in_place_check, and the validation runtime_lane suites predication, protection_options,
  dispatch_work, failed_commits, rebinds, rebind_reach, submission_checks, parallel_encodes and
  commit_work. m3-max-29815 (this change before the settle took the refresh, Across): clippy
  0/0, runtime 119/119, validation 87/87. m3-max-29896 (this tree with the next commit on top):
  clippy 0/0, runtime 120/120, validation 87/87.
- Negative control by hand (m3-max-29802: settled_across false, nothing parked): both
  compute_parked tests fail (parked 0 against 7, across 0 against 7).
- Release A/B on msi lavapipe (m3-max-29900; frame pointers; base d2c72548cd md5 5f091a78 and
  this tree md5 24f39604 in their own target dirs; dispatch_chain --host 3 --dispatches 2300
  --groups 64 --runs 9; 8 rounds, the order alternating; paired medians, ns a dispatch):
  folded binds 1 encode -153 (lower in 5 of 8 rounds), folded binds tex +76 (3 of 8), serial
  binds 1 +16, serial binds tex +45: inside the noise. The folded shape's dispatches settle
  across encoders 1.00 a dispatch (dispatches_settled_across_encoders; parked_compute_taken
  1.00), against 0 before. A dispatch that takes the entry still reads its table whole, lists
  the device's sampler states and lists them into the entry again; that this is most of what a
  settle that finds its plan as before costs is expected from the earlier profile, not measured
  apart. An earlier A/B before the settle took the refresh (m3-max-29814) showed serial binds
  tex +56 in 8 of 8 rounds, the table read twice.

== Command buffers start on the storage of the record lists a released command buffer left
A folded compute encoder's end grew its command buffer's lists of records one reallocation at a
time: the ended encoders' records, their recordings and the group's stashed logs (about 190 ns
of the end on msi lavapipe by perf, dispatch_chain's encoders shape at 2300 encoders a command
buffer), and the commit's held logs.

- command_buffer/record_storage.rs (new): a device keeps up to 2 storages of those lists
  (DeviceShared::record_storage), each of at most 8 MiB of room. CommandBuffer::new starts on the
  latest one a released command buffer left, emptied with its room kept; the release (Drop of
  CommandBufferShared) takes the lists whole, empties them there (what they held goes as it went
  before, at the release) and gives the storage back.
- A group of encoders recorded into one VkCommandBuffer takes the command buffer's stash room as
  it begins and gives it back, emptied, as it closes with more than one member (close_fold: the
  held logs by append, the kept ones by drain); a lone member's close consumes it as before.
- WorkCounts: record_lists_grown (lists that held more room at the release than the storage they
  started on, counted once each) and record_storage_kept (new). api_signatures.tsv (+2).
- New tests::record_storage (m2v_gpu / m2v_cpu_icd): after a warming command buffer, command
  buffers of 32 compute encoders, one after another's release: the first's lists grow (at least
  2), the next two grow none. compute_parked's kernel is shared with it.

Verified:
- m3-max-29896 (msi lavapipe, m2v_cpu_icd): clippy (-D warnings, --all-targets --all-features,
  runtime crate; plain and --cfg m2v_cpu_icd) 0/0; the runtime suites of the commit before with
  record_storage 120/120; the validation runtime_lane suites 87/87 (the commit before lists
  them).
- Negative control by hand (m3-max-29934: no command buffer starts on a kept storage): the test
  fails, round 1's lists grown 4 against 0. The test passes with this change (m3-max-29896).
- A count run (m3-max-29894, dispatch_chain --host 3 --binds 1, 2300 encoders a command buffer):
  record_storage_kept moved and record_lists_grown did not, folded and serial. At the first cap
  tried (4 storages of 2 MiB) the folded shape's storage was not kept (record_lists_grown moved,
  record_storage_kept did not), so the cap is 2 of 8 MiB.
- Release A/B on msi lavapipe (m3-max-29895; frame pointers; the commit before, md5 24f39604, and
  this tree, md5 670342b3, in their own target dirs; dispatch_chain --host 3 --dispatches 2300
  --groups 64 --runs 9; 8 rounds, the order alternating; paired medians, ns a dispatch):
  folded binds 1 encode -172 (lower in 8 of 8 rounds: end -230, commit -52, dispatch +63),
  thread CPU -222; folded binds tex encode -164 (6 of 8: end -320, commit -80, dispatch +113),
  thread CPU -245; serial binds 1 -3, serial binds tex -70 (5 of 8).

No answer, refusal or recorded command changes: RUNTIME_VERSION stays; the pin alone moves.

Verified (msi lavapipe): m3-max-29896 clippy plain and --cfg m2v_cpu_icd 0, runtime suites 120/120,
validation runtime_lane 87/87. Release A/Bs in alternating order, paired medians a dispatch: park
(m3-max-29900) folded binds 1 -153 ns, binds tex +76, serial +16/+45 (neutral; memo hits 1.00 a
folded dispatch); record storage (m3-max-29895) folded binds 1 encode -172 (8 of 8), binds tex -164
(6 of 8), thread CPU -222/-245. Negative controls by hand: compute_parked 0 vs 7 (m3-max-29802),
record_storage 4 lists grown vs 0 (m3-max-29934).
2026-11-14 11:07:09 -08:00
Anees Iqbal 60088bcf3a Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 10:54:50 -08:00
Anees Iqbal e4747b174b handle_entry_flags: name FLAG_YCBCR_WRITES without a link to the private item
Rustdoc at 8e992466f7 (-D warnings) failed: the public function's doc
linked the crate-private memory::handles::FLAG_YCBCR_WRITES. It names
it in code instead, as the docs name the other flags.

Docs only. Verified: rustdoc -D warnings on the three published crates at 7f92e76fe8 (m3-max-29884) 0;
development's rustdoc at 8e992466f7 failed on this link (m3-max-29876).
2026-11-14 10:54:09 -08:00
Anees Iqbal 8dd9d3af55 Refusals name what they saw: an unknown ABI key's string or shape, a stage-size refusal's weight and bound
- Every Abi(UnknownKey) that named no key now carries what the reader found: the unknown string
  (an argument's role or attribute, a visible function's key, a node's tag, a compile option, a
  signature kind, a module flag), cut at 64 bytes, or, where there is no string, the operand's
  shape in LLVM spelling. The detail is a crate-private field of InputError (`saw`), printed by
  Display and Debug; it lives there and not in Location because a Location field grew the
  translator's Error past clippy's result_large_err. No public item or refusal kind changes;
  REFUSALS.md regenerated unchanged.
- The ANV stage-size refusal (Feature::StageSize, DriverDefect) names the module's entry weight
  and the bound it passed in its symbol, which Display prints: "entry weight N, past the bound B".
  The bounds and the refusal are unchanged; the FAST-PATHS known-gap row says so.

Why: a consumer's log of a GL-on-Metal kernel refused as UnknownKey at an argument with key None
and of two kernels refused for stage size could say neither which key nor how far past the bound;
one rerun at the pin carrying this names both.

Translation output unchanged: no SEMANTICS or RUNTIME bump.

Verified (msi, m3-max-29879 at 2ddbda8ecf): clippy air + translator 0; metal2vulkan-air 567 passed
incl. abi::tests::an_unknown_key_names_what_it_read (a synthetic node per site, whole location,
seen detail and Display); metal2vulkan a_kernel_past_the_stage_bound_keeps_the_widest_pin_or_is_refused
(symbol and Display name weight and bound past each defect's bound), error::tests and engine_handles
compute tests 10 passed, llvm-as present (no SKIPPED).
2026-11-14 10:52:44 -08:00
Anees Iqbal 198f7a3606 walk_costs: a WALK-MOVED line of every work count a shape's frames moved
The WALK-COUNTS list names 24 counts and none of the reasons a draw
took every step, a kept draw was let go or a rebind stopped
(kept_draws_let_go_*, draws_unkept_*, draws_rebind_stopped_arguments_*,
draws_carry_stopped_*, stage_tables_read_whole_*, ...). Each shape now
also prints every count its timed frames moved, a frame, through
video_frames::moved_per_frame, which reads WorkCounts' Debug, so no hand
list goes stale. Validation only; a measurement, no check changes.
Verification: msi lavapipe job (clippy --cfg m2v_cpu_icd, walk_costs
run).

Verified (msi lavapipe, m3-max-29866): clippy validation --cfg m2v_cpu_icd 0; walk_costs 1 passed,
all 4 shapes printed WALK-COST, WALK-COUNTS and WALK-MOVED.
2026-11-14 10:48:34 -08:00
Anees Iqbal 8e992466f7 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 10:47:07 -08:00
Anees Iqbal 2960070096 SEMANTICS 2114 / RUNTIME 2307: write() through an argument buffer to a two-plane YCbCr texture stores or drops as the slot write does
An argument buffer's texture2d<float|half, write> of a two-plane YCbCr
texture died at dispatch (its storage heap member was refused). Metal
stores through a handle exactly what it stores through a slot (the M3
Max under macOS 27.0.1, measured by the consumer): nothing of
YCBCR8_420_2P, both planes of the unpacked 4:4:4 formats byte for byte
the slot's.

- bind::heap: a storage class holds a texture whose writes Metal drops
  (metal::format::writes_dropped) as its neutral (Fit::Dropped), and a
  4:4:4 texture whose writes Metal stores (ycbcr_writes_stored) through
  the R32G32B32A32_SFLOAT view of its write shadow; its table entry
  carries FLAG_YCBCR_WRITES (bit 15). A stage that reads the storage
  class (new RuntimeFact::HeapStorageReads, a PlanTimeCheck) refuses
  either texture it reaches there, Format / NotImplemented, as a slot
  that reads one is refused.
- memory::handles: the search carries the flag into handle bit 29
  (HANDLE_YCBCR_WRITES) under the stage's new SpecKey::HeapYCbCrWrites,
  a u32 constant the plan gives from the command's members (1 where a
  member it names is such a texture, usage writing). At 0 the carry
  mask, the element mask and the write's test are spec-constant
  folds, so a command naming no such texture runs the pipeline it ran
  before (the predicted bindings name none).
- lower::texture: a float/half 4-lane 2D heap write selects
  (rgb, 1.0) where the handle carries the flag: the mark the write-back
  kernel reads (nonzero), in place of any member conversion.
- runtime: the write shadow's image is MUTABLE_FORMAT with an
  R32G32B32A32_SFLOAT view where the device stores that format; the
  heap's float storage element is that view; a command making such a
  texture resident for writing names the shadow in its uses (its copies
  clear the marks and encode the marked texels into the planes), and
  the texture's own image only where it reads it too.

Tests: src/tests/engine_heap_ycbcr_writes.rs (interpreter run at the
constant's 0 and 1, plan values and one variant for every command
naming no shadowed texture, the storage-read refusal);
runtime_lane::ycbcr_argument_writes (500/503/507/523/527/542/545
through an argument buffer against the slot's bytes, and the pipeline
count). REFUSALS.md regenerated; api_signatures blessed: two new
variants of #[non_exhaustive] enums, nothing breaks for a consumer.

Metal (M3 Max, macOS 27.0.1, m3-max-29643): argument-buffer writes are byte-identical to slot writes
for 500/503/507/523/527.

Verified (msi lavapipe, --cfg m2v_cpu_icd): m3-max-29859 clippy translator/runtime/validation 0,
runtime 243/243, lavapipe lanes 75/75, translator 246/247 (a word bound the mark raised, fixed in
ce01da189e); m3-max-29865 at ce01da189e clippy 0, translator 4/4, lavapipe 2/2: argument-buffer
writes byte-equal to slot writes for all 7 formats (alpha-0 writes, so an unmarked write stores
nothing); pipelines 1 after RGBA8/RGBA16Float/500 commands, 2 after the first 503 and still 2
after a second.
2026-11-14 10:46:27 -08:00
Anees Iqbal 15fc7f62a5 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 10:41:24 -08:00
Anees Iqbal 7f36b6ee36 draw_again: a carry sets aside up to seven other pipeline states, not three
Doc only: the module docs' carried bullet still said three, from before
live_bind::SET_ASIDE became 7 (RUNTIME 2267). Verified by reading
live_bind.rs (const SET_ASIDE: usize = 7) and render/carried.rs's docs.

Comment only; the runtime-sources pin moves with it.
2026-11-14 10:40:44 -08:00
Anees Iqbal de69a4a218 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 10:38:39 -08:00
Anees Iqbal 73b97e1e0c A draw after scissor rectangles alone restates by them alone
A render-state call drew one fresh stamp, so a kept draw's next draw after
set_scissor_rect(s) ran restate_kept in full: the route and DrawSettings
again (compared by value), the pipeline clone, the fragment tests, the
depth/stencil descriptor, the shape-memo lookup and clone, and two
FixedState compares, only to take new Vulkan scissors, which none of those
read. Compositor shapes and the walk set a scissor before nearly every
draw.

What changed:
- The encoder's render-state stamp is now a pair (`Stated`): `set`, drawn
  afresh by every render-state call, and `beyond_scissors`, drawn afresh by
  every one but set_scissor_rect(s) (`log_restating_scissors`).
- `Kept::restates_by_scissors`: whether the kept draw's route meets every
  condition a restate asks (no failing state, no hidden depth/stencil, no
  restart strip, provoking vertex as-is or native), set where every step
  keeps the draw and where a full restate succeeds, so the debug Kept
  comparison holds.
- A draw whose kept draw's stamps differ in `set` alone, of such a route,
  takes the encoder's scissors into its kept recording's draw state (as a
  draw that finds its state in the shape memo takes them) and derives
  nothing else; every other restate is unchanged.

New WorkCounts field: draws_restated_scissors (counted at each such
restate, a debug check turn's too). No new Degradation kind.

Test: draws_after_scissor_rectangles_alone_take_them_alone (runtime
tests/draw_again.rs): 8 draws again after scissor sets alone restate by
them alone, rebound, with the same commands, state commands and pixels as
every step; a viewport set before one draw takes the full restate, still
rebound. In debug builds every second rebound draw takes every step and
compares the draw state the restate left. Verification follows on msi
(lavapipe, potluck).

Recorded commands are unchanged (the draws rebound record the same commands, state commands and
pixels as every step), so RUNTIME_VERSION stays and the runtime-sources pin alone moves.

Verified (msi, lavapipe): m3-max-29822 clippy plain and --cfg m2v_cpu_icd 0, 103/103 of 20 touched
modules incl. draw_again::draws_after_scissor_rectangles_alone_take_them_alone; negative controls
m3-max-29825: fast path off reads 0 against 8; stale scissors trip the debug rebound check. Release
A/B m3-max-29845 (7 interleaved rounds, medians a draw): compositor 57,172 -> 55,820 instructions,
8.81 -> 8.64 us (1216 of 2237 restates by scissors alone); pass17 33,003 -> 30,783, 4.48 -> 4.18 us.
2026-11-14 10:37:58 -08:00
Anees Iqbal c28a0e0523 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 10:22:47 -08:00
Anees Iqbal 948b5e37fb RUNTIME 2306: a texture over a bit-24 buffer that no image lies over reads a shadow of its read twin, not of the copy
A no-copy buffer of Metal's private option bit 24 is a copy of its pages off macOS, beside a read
twin over the pages in place. A slot that only reads a texture over such a buffer binds the
texture's read twin, but only where the twin's texture lies in place over the twin's bytes. Where
it did not (RADV lays no DRM_FORMAT_MOD_LINEAR plane whose rows or first byte are off a multiple
of 256: a window server's 48x48 textures at rows of 192 bytes, its 128x128 ones at rows of 512
from 32 bytes in), the twin's texture was made as a shadow and dropped. The slot then bound the
program's texture, itself a shadow of the copy for the same reason, so its command buffer used the
copy and its commit compared the whole copy with the pages.

Workload reason (reims's appwalk17 desktop walks, numbers only): twin textures not in place
780M 362, RTX 3090 304, Iris Xe 1; copies compared 52,537 (2,897 MB), 43,384 (2,138 MB) and 331
(35 MB); the Iris compared in one walk step only, the one that made its one twin not in place.
Copies compared plus twin slot reads come to about the same total on all three (56,775, 52,277,
54,233): every such read that missed a twin read the copy.

Now the twin's texture is kept as a shadow of the twin's bytes where the program's texture is a
shadow too, and the slots that only read the texture bind it under the same proof as before. The
program's texture lists it beside its own shadow (shadow::texture_copies, held weakly), so draws,
rebound draws, dispatches and resident textures copy it in from the pages in place at its first
use in each command buffer, where they copied the texture's own shadow in from the copy (a shadow
of a copy of Shared memory never stands). Where the pages carry a log of their writes only the
changed rows move. The command buffer names the twin's and the shadow image's keys, never the
copy's, so its commit compares nothing. No store reaches the pages: the twin's one GPU access is
the copy in's read, the shadow is the runtime's own image no call returns, the slots only read it,
and a copy back would write the twin's key, which every encoder refuses.

Discrete devices take it too: their copy lies in system memory (MemoryClass::Shared), as the
pages do, so the shadow's copy in crossed the bus before and crosses it now; what goes is the
CPU's comparison. Cost: an image of the texture's size per such texture while it lives.

- WorkCounts::read_twin_texture_shadows (new field). No new Degradation kind.
- The shadow log's twin line says whether the twin's shadow serves the read slots.
- cfg(test) DeviceShared::linear_pitch_rule_forced: RADV's LINEAR plane rule at Device::unplaced.
- Tests (read_twin_device): the two shapes sampled by a draw and the 128x128 one read by a
  kernel through the twin's shadow (compares 0, a CPU write read next, a fill read back through
  the copy, pages kept); over logged pages the second command buffer copies nothing in and a told
  write moves its rows alone. The screen-sized texture lavapipe lays no image of now reads its
  twin's shadow too.
- Docs: read_twin.rs, shadow_log.rs, API.md and the FAST-PATHS row on bit-24 memory;
  api_signatures.tsv (+1).

Verified (msi lavapipe, m3-max-29778 at 69f0a567b1): clippy plain and --cfg m2v_cpu_icd 0;
read_twin_device, copied_device, copied:: units, texel_rows_device, dirty_pages_device and
waited_reads 73/73; api_signatures and fast_paths 35/35. With RADV's LINEAR rule forced (offset
and pitch multiples of 256): 48x48 at pitch 192 and 128x128 at pitch 512 offset 32 sampled by a
draw and read by a kernel: twin slot reads +1, compares 0, texels the pages', a CPU write read
in the next command buffer; a fill in the same command buffer reads back through the copy with
one compare, pages kept; over a dirty log an unchanged twin copies 0 bytes. Negative control
(serves cut back to in-place only): the 3 new tests fail, the commit compares the copy.
2026-11-14 10:22:01 -08:00
Anees Iqbal 607f2d430a Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 10:21:14 -08:00
Anees Iqbal 7325cef772 Spare command pools: take before making, in sections too, each pool up to 32 of a level
A command buffer whose pools handed out every VkCommandBuffer of a level they held now takes the
spare holding the most of that level from its first hand-out on (before: only past 16 handed out,
making the rest in its first pool), and inside a section of the exit guard (the scheduler's
barrier command buffers, a host step's recording) it takes a spare whose command buffers need no
reset (before: no spare at all). Where no spare holds one, it makes it in its last pool, up to
POOL_HOLDS (32) of the level there, past which it takes a pool for more (a spare holding none of
the level, or a new pool). HELD stays the hard bound; idle sheds and recent-uses frees are
unchanged; no new switch.

Why: under command buffers of fenced one-dispatch compute encoders split into parts (a guest's
fluid simulation's shape), the barriers' command buffers, made in sections, were 64% of the
allocations and the first-pool makes 34%; the pools grew past what was in use at once to HELD,
and each give-back shed the oldest pool whole, which the next takers made again (45,914 made over
30 rounds of 200, about 1,250 a round, on lavapipe). On RADV each made VkCommandBuffer is a new
buffer object with cleared pages.

New WorkCounts field: command_buffers_made (vkAllocateCommandBuffers' count), POOLED in the
conformance cost table.

Tests: tests::spares unit tests take `settled` and a new one checks a section takes only a spare
that needs no reset; the device test of a small and a large command buffer now asserts none is
made where the spares hold them; tests::spares_parts (device): fenced command buffers 16 in
flight make none once warm and hold at most the in-use bound; a load that falls sheds down.

No answer, refusal or recorded command changes (only which VkCommandBuffers the spares
hand out), so RUNTIME_VERSION stays 2305 and the runtime-sources pin alone moves.

A/B (msi lavapipe release, m3-max-29720, spares_compute_parts: 200 command buffers a round
of 2-120 fenced one-dispatch encoders, 48 in flight, rounds 6-30, two interleaved runs):
command_buffers_made 1,498/1,448 a round -> 8.8/4.3; spare_command_buffers_shed 1,460/1,447
-> 0; spares held pinned at HELD -> 3,251/3,263; committing thread CPU per command buffer
-7%/-6%, scheduler -4%/-8%, queue waiters -12%/-9%, free thread to 0; anonymous RSS at round
30 187/190 -> 71/74 MiB. Control (sections take no spare): 2,189/2,305 made a round, fails
the steady test.

Verified (m3-max-29776 at 2a5db4d65e, msi): clippy runtime+conformance plain and
--cfg m2v_cpu_icd 0; tests::spares and spares_parts 26/26; conformance cost 0; signatures 0.
2026-11-14 10:20:31 -08:00
Anees Iqbal 26b8d7b4d1 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 09:52:10 -08:00
Anees Iqbal 9fa1fe4a7a SEMANTICS 2113 / RUNTIME 2305: write() and render into the _sRGB two-plane 4:4:4 twins (523, 527) store what Metal stores
write() (kernel and fragment) into YCBCR8_444_2P_sRGB (523) and YCBCR10_444_2P_sRGB (527) over a
surface plane, and such a texture as a render attachment, were refused (the encoding unknown).
Metal's bytes, measured on an M3 Max (macOS 27.0.1; 8 colours, kernel write, fragment write and
Clear+Store over 444v/x444 surfaces), fit one reading exactly: each channel is sRGB-encoded first,
then converted as the non-sRGB twins 503/507 convert (here BT.601 video range). Metal's own paths
differ by one code on one 10-bit luma (kernel 696, pass 697).

- metal::format: ycbcr_writes_stored and ycbcr_renders take 523/527; the 4:2:0 and 4:2:2 sRGB
  twins stay refused (unmeasured).
- bind::ycbcr_write: one shape word, SRGB: per channel the pass's half (pass only), then
  lower::arith::pack::srgb_encode (the device's Pow), then the existing grid step and rows. The
  device's float curve is the conversion we implement (no sRGB view can store a matrix
  combination of encoded channels); no PrecisionNote: any difference is within Metal's own
  one-code spread.
- A pass that Loads a twin is refused at its start, and a pipeline that blends into one at its
  attachment, both NotImplemented(Format) (Metal's load and blend of the twins unmeasured).
  REFUSALS.md regenerated (Format sites 124 -> 125).
- CPU references ycbcr_write/ycbcr_store encode the twins by the same f32 steps.

Verified (msi, lavapipe, m3-max-29687 at db17bcce16): clippy (metal2vulkan, runtime, validation,
--cfg m2v_cpu_icd) 0; translator tests 13/13 (reference and interpreter give Metal's eight
colours for 523/527); lavapipe 14/14 (lane ycbcr_srgb_twins: both planes against Metal's table
for kernel, fragment and Clear+Store, one code allowed on the 10-bit luma only; load and blend
refusals; the 503/507/542/545 tests unchanged). Negative control (SRGB word forced to 0,
m3-max-29701): the CPU test and the kernel, fragment and pass tests fail on grey,
(0.2,0.6,0.9) and (0.9,0.3,0.1).
2026-11-14 09:51:17 -08:00
Anees Iqbal 6a9a05ccad Tests: pin 91's three failures and the tile fixture, test-only
- tile_pending: tile_state resolves its fixture through metal2vulkan_devtools::engine_dir()
  (the run-time CARGO_MANIFEST_DIR, else the build's), as heap_border_texels and a8_over_buffers
  do, so a carried archive finds it.
- render_merged_executions: a rebind of a shadowed target's bytes encodes again the named
  encoders and the rest of their fold group (RUNTIME 2302: the pass joins the writer's compute
  encoder's group, and a rebind encodes a group whole); rebound_run reads the group from
  encoders_folded. Rows and pixels unchanged.
- compile/tests.rs: the earlier-derived-debug test drops SEMANTICS 2112's empty texel_rows.
- property_reads: rounds go on until each thread has landed inside a submission, bounded by
  30 s instead of 8 rounds; the window is a 0.05-0.2 ms submission and the full suite's load
  closed it for 8 rounds at both a91629c1a6 and d8666d430f (m3-max-29674), so the fold is not
  the cause. A thread that never lands still fails.

Verified (msi, lavapipe): 29662 all 7 tile tests; 29685 the four tests; 29686/29700 clippy
cpuicd and plain 0 for metal2vulkan, runtime and validation; 29699 property_reads alone round 1,
beside 64 busy loops in 4.8 s. Negative control (status() takes the state lock submit_batch
holds): fails at the bound, the status reader never inside in 214 command buffers over 30 s.
2026-11-14 09:49:08 -08:00
Anees Iqbal d2c72548cd Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 09:40:17 -08:00
Anees Iqbal be62103f73 One state lock per encoder open and one per end
A compute encoder opened after another took its command buffer's state lock
7 times as it opened and 3 times as it ended (a debug count on lavapipe):
the protection check, settle_end's three takes, the open itself,
enter_predication and inherited_residency; end_predication,
note_scheduled_work and the end itself. About 17 ns each under perf, 118 ns
of a folded dispatch's open and 55 of its end on msi.

- EncoderCore::open checks the protection options (compute and render),
  settles the last render encoder's end where one waits (CommandBuffer::
  settled: the three takes only where something is there, else the lock it
  holds), and runs the kind's own state work as a closure under its lock:
  compute's enter_predication and State::inheriting, blit's protection
  options.
- end_with_replay notes the scheduled work and, for a compute encoder whose
  command buffer has no predication record, its unit's work under its own
  lock. Captures::unpredicated tracks that: false at open where the command
  buffer has a record, cleared by the encoder's own record, false for an
  encoding again, so those keep end_predication's lock.

Tests: tests::encoder_state_locks (debug, device): a compute encoder and a
blit encoder opened after a compute encoder lock once at open and once at
end.

No behaviour changes (what a run answers, records and submits is the same), so RUNTIME_VERSION
stays 2304 and the runtime-sources pin alone moves.

Verified (msi, lavapipe): tests::encoder_state_locks 1 lock at open and 1 at end for compute and
blit (negative control with the base sources: compute 7/3, blit 5/2); touched runtime suites
156/156 (render_fold 13, encoder_fold 22, ...); validation predication and protection_options
18/18; clippy plain, m2v_gpu and m2v_cpu_icd 0; rustdoc 0. Release A/B (base 0c3c24ec0e vs
tip, own target dirs, medians of 4 interleaved): host time per dispatch within the run's noise
(about 200 ns): long folded encode 4246 -> 4303, short folded 4122 -> 4018. Kept as a
correct, neutral change.
2026-11-14 09:39:37 -08:00
Anees Iqbal 7f01a06014 queue_share: the quiet unshared queue's test makes again a run whose first long one's completion let the second go
Pin 91's lavapipe suite (0c3c24ec0e, under the whole suite's load) failed
a_quiet_unshared_queue_s_first_command_buffer_waits_behind_the_idle_budget_and_one_batch at
'a head let go under the idle budget': the first long one ran 63.5 ms against its queue's
expected 81.1 ms, so it completed before the 16 ms budget's point (about 65.1 ms) and its
completion let the second go at 64.0 ms, which neither budget holds and none counts as let go
under the idle one. Such a run shows nothing of the bound, as a run whose unshared command buffer
was committed after the third was let go shows nothing: it is now made again too, up to
HELD_RUNS runs (the second let go before the first's GPU end). A product that ignored the idle
budget still fails: a run that lets the second go while the first runs is still required, and
the counts and the early let-go are asserted on it.

Not a product change, and not RUNTIME 2303's: alone on msi lavapipe (m3-max-29668) the test
passed 3 of 3 at 2216540a68 (before 2303, binary md5 8963d218) and 3 of 3 at 6b6c9a002f (2303,
md5 21cdc46a), each run letting the second go at about 20 to 24 ms, under the idle budget, with
one head counted. 2303 changes only passes of committing and waiting threads with an unshared
head in the order; this test's unshared queue has none there while the long ones go.

Verified (msi lavapipe): the test alone 3/3 at 2216540a68 and 3/3 at 6b6c9a002f (m3-max-29668);
pin 91's failure was the suite's load (the first long one completed at 63.5 ms, before the
idle budget's let-go point). At the tip (m3-max-29677): clippy plain and cpuicd 0, 29/29 of
queue_share_device and unshared_hold.
2026-11-14 09:38:07 -08:00
Anees Iqbal 0c3c24ec0e Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 09:05:32 -08:00
Anees Iqbal 933b4e774d SEMANTICS 2112 / RUNTIME 2304: a texture no image can lie over is read and written in place through a texel buffer of its rows
A texture over a buffer is Metal's linear layout: texel (x, y) at offset + y * bytesPerRow +
x * bpp. Where the device refuses the image route over the buffer's pages (a texture over pages
that need more than one dma-buf, a LINEAR plane at a refused pitch or offset) but the buffer is
in place, a slot whose function only reads (read, not sample or gather), writes or asks the
size of that texture now binds a storage (or uniform) texel buffer view over the buffer's bytes,
addressed as rows (the row pitch in texels and the size from a push field), instead of a shadow
image copied in and out. The texel buffer view's format converts as the image's would: the
device's own conversion, no note.

- Translator: a structural fact of the slot (its uses are read/write/size only, proven in
  lowering), a push field and a variant key, after the YCbCr in-place variant's machinery.
- Runtime: the planner takes the rows variant where the image route is refused for a stated
  reason; the tracker sees the slot's writes as writes of the buffer's bytes (rows only, the
  bytes between rows untouched); a buffer with a read twin takes no rows (its twin texture
  stays the shadow of its truth). Sample and gather uses, levels past the first, arrays, 3D and
  compressed formats stay shadows.
- WorkCounts: texel_rows_textures, texel_rows_bound. No new Degradation kind, no precision note.
- Docs: API.md variant section, FAST-PATHS known gap narrowed, the shadow log's rows line.

Workload reason (consumer's 780M diagnostic, numbers only): of the device-gap shadows in three
compute workloads, half the textures are only written by their kernels (1.67 G texels per pass),
the other half only sampled; the written half takes this route.

Verified (msi, lavapipe): texel_rows and read_twin tests 28/28 at f848389cfc (m3-max-29579):
over a copy that lavapipe refuses as an image (pitch 272), no shadow copy, rows bound, texels
inverted in the pages, gap bytes kept, a sample in the same and the next command buffer read the
rows' writes; RGBA8Unorm 1024 codes read / 1024 floats stored and RGBA16Float 65536 / 65536 bit
for bit against the image route. Clippy plain, --cfg m2v_cpu_icd and --cfg m2v_gpu 0; rustdoc 0
(m3-max-29541 at 532be1f473, route code unchanged since). Negative control (the row word swapped
for the width word): 6 of 13 tests fail. Release first dispatch of a new state on lavapipe: base
4.12 ms cold / 0.98 warm, rows 2.80 / 1.56 (the rows side also commits over a copied buffer).
2026-11-14 09:04:48 -08:00
Anees Iqbal 6b6c9a002f Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-14 09:02:07 -08:00