Commit Graph
4706 Commits
Author SHA1 Message Date
Anees Iqbal 941e1105ce Fixture pooled_cells: thread pointers held in an array of structs, and Metal's answer
An owned fixture of a renderer's closure array: closure_alloc hands out the next element or
null, closure_alloc_extra hands out a thread pointer to room at the array's end, which the
element keeps among its data. Four kernels:

- pooled_closures: elements and extra room handed out at run-time indices, read back and
  summed.
- pooled_bytes: a pointer into another array copied into an element as bytes, over a length the
  run reads, then read and written through.
- pooled_spill: the same pointer's bits stored into device memory (volatile) and read back into
  the element as an integer.
- pooled_context: the closures beside a context struct holding a constant pointer to an
  argument buffer whose pointer leads to two textures' resource IDs, read by a noinline
  function through the context.

The .ll and .air.ll companions and the TOOLCHAIN line are regenerated on the M3 Max.
probes/pooled_cells.m prints Metal's words on the M3 Max (macOS 27.0.1). pooled_bytes and
pooled_spill answer alike there.

Verified: the probe ran on the M3 Max and its words are the tests' constants.
2026-11-12 10:57:17 -08:00
Anees Iqbal be2e4d5c26 Pools: an undisciplined closed cell of arena thread pointers forwards as a pool
A closed alloca whose pointer slots are not disciplined (an array of structs indexed at run time,
each element holding a thread pointer into the array among its data, as a renderer's closure
array does) used to open, and an open cell's pointer loads are Dynamic: every access through
them then opened every alloca, so a whole kernel lost its forwarded pointers, an argument
buffer's pointer kept in a context struct among them.

Such a cell now forwards as a pool (CellFacts::pooled) when every pointer access of it is of a
thread-space pointer and every pointer it holds is an arena pointer (null, a stack allocation,
or Dynamic). A pointer loaded from a pool is the join of every pointer that leaks, and null. A
pointer leaks when it is stored into a pool, when it is a pool's, when it is stored into memory
that does not forward it, and when an instruction turns it into data or hands it to code no
cell sees (Cells::escapes: ptrtoint, an aggregate or vector, a call other than an intrinsic's,
an atomic's value, a return). Every pool holds every leaked pointer, so a pointer moved as data
(bytes, a memcpy, an integer of its bits) into a pool from any memory is among its loads.

A pool is verified again every round: one reached otherwise, or holding another pointer (a
table parameter's, a global's, an intrinsic's), opens, which keeps those on the paths that
refuse them. Becoming a pool counts as a failed round, so the two-failure bound on the rounds
holds. join_slot_classes treats a pool as reached at any offset and unions every pool's slot
group, so all of them store one encoding: the u32 arena offset (lower::access::cell).

Verified, on the homelab in release builds:
- Both guest kernels this was for translate on a scratch RX 7800 XT profile and pass spirv-val
  (vulkan1.2 and 1.4). Translation alone takes 1.5 s / 281 MiB and 1.2 s / 253 MiB peak RSS.
  With spirv-val, the runs take 12.0 s and 12.2 s at nice 19 on a shared node, and spirv-val's
  process is the peak (517 MiB).
- MPS census A/B over 590 rows (spirv-val on): no row's outcome differs.
- Engine inventory: no existing row's cell moved.
- The memory plan tests, and the engine and lane tests of the next commits.
2026-11-12 10:57:17 -08:00
Anees Iqbal abd049845d Fixture tns_air29: AIR 2.9's private tensor intrinsics run without a matmul2d
An owned fixture built as MSL 4.1 for macOS 27, so Apple's compiler emits AIR 2.9's forms:
air.init_strided_private_tensor.i32.{global,local} with nine operands (three more than AIR 2.8)
and air.get_extent_private_tensor.i32 with four (one more). Each of 32 threads initializes a
tensor over device memory and one over threadgroup memory with extents read from a buffer, and
writes the extents each answers. The earlier execution proof ran these forms only inside a
matmul2d; this one runs them alone.

- engine/tns_air29.metal, its .ll and .air.ll companions and the TOOLCHAIN line (regenerated on
  the M3 Max, Xcode's metal for macOS 27).
- probes/tns_air29.m: Metal's answer on the M3 Max (macOS 27.0.1): 32 of 32 threads answer the
  buffer's extents, 32 16 16 32.
- runtime_lane::tensors_air29: the companion declares the 9, 9 and 4 operand forms, and on the
  device every thread answers 32 16 16 32 under the validation layer.

Verified: the probe on the M3 Max (32 of 32); runtime_lane::tensors_air29 on lavapipe (um790,
pass); metal2vulkan-air suite 558 passed; the engine inventory's new row compiles on all 19
committed profiles ("tns_air29: ok" x19). The inventory, air_input and golden tables take the
new fixture at the next re-bless on development.
2026-11-12 10:47:22 -08:00
Anees Iqbal bdd4eb8629 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-12 10:44:02 -08:00
Anees Iqbal df0e4273d7 RUNTIME_VERSION 2132: draws rebind past re-sets of the same objects, up to 64 changed slots, and through reshapes that settle as the kept draw
The commits before this one take the two causes behind 97% of Valley's rebind stops at RV 2130 (reims's rv2130-xtx: 60.2% of 8.2 M indexed draws stopped; "slots" 74.7% of the stops, "reshaped" 22.7%).
- A set call that binds each slot exactly as it is already bound (same object, offset, stride, clamps) keeps the argument table's stamp, so it is no change.
- A rebind takes up to 64 changed slots (was 8; 64 is the table's change log limit per call), a material's texture and sampler units among them.
- Where the changed slots reshape the bind state, bring_in finds the new shape and settles it exactly as every step would; where that gives the kept draw's variant and plan, the draw is rebound and the kept settle and execution record take the new shape (e.g. textures that differ only in level count, which BindShape::for_plan leaves out of the plan's key). Otherwise it stops at reshaped, as before.
- draw_costs gains the "scene" and "rebinds" shapes (8 command buffers x 10 passes x 24 indexed draws over 4 color targets; a material change every 4 draws binds 8 textures of three sizes with their levels and 8 samplers; "rebinds" also re-binds the same objects every draw).

Measured on lavapipe (um790, m3-max-21993), instructions a draw, base / slot fixes / with the reshape fix:
- scene: 42,240 / 42,613 / 38,637 (-8.5%); stops 25% at base, 0 at the end (every draw rebound).
- rebinds: 76,682 / 46,325 / 42,305 (-44.8%); stops 100% at base, 0 at the end.

Verified on lavapipe in debug: the runtime suite passes 2363/2363 and the lane set 133/133 (m3-max-22001); new tests draws_after_calls_that_bind_as_bound_draw_again and draws_after_textures_of_other_level_counts_rebind (every second draw takes every step and is compared with the rebind); encoder_holds' rebound leg binds at an index its draw does not read, and draws_after_buffer_changes_rebind goes past the limit with 66 changed texture slots. clippy (every feature, --cfg m2v_gpu) and rustdoc -D warnings are clean (m3-max-22005).
Not run: Valley in the guest; a rerun follows.
2026-11-12 10:43:21 -08:00
Anees Iqbal fe09cc994f Tests: the level-count test's chooser closures name their types
draws_after_textures_of_other_level_counts_rebind (3b2a5068da) did not compile:
its closures took their argument and answer types from no use (E0282, E0271,
m3-max-21999).
2026-11-12 10:42:42 -08:00
Anees Iqbal 70d85cd94f draw_costs: the scene's materials sample textures of three sizes, each with its levels
A 3D engine's materials bind textures of other sizes and level counts, which
their bind states' shapes tell apart (TextureShape's level count) though their
plans do not (BindShape::for_plan). Material m's textures are now 64x64, 32x32
or 16x16 as m goes, each with its whole mipmap chain, so a material change
reshapes the bind state as such a frame's do.
2026-11-12 10:42:42 -08:00
Anees Iqbal c66597f0d0 A draw rebound after slots that reshape its bind state goes on where it settles as the kept draw
A rebind stopped wherever the changed slots may have changed the bind state's
shape (draws_rebind_stopped_arguments_reshaped): a texture of another level
count, usage or format, a sampler of another shape, an offset of another
alignment class. Many such shapes plan alike: BindShape::for_plan keeps a
sampled texture's level count out of the plan's key, and the variant follows
the plan, so the draw's every step settles to the kept draw's variant and plan
and works out what a rebind works out of them.

bring_in now finds or makes the state's shape and settles it as every step
does (LiveBind::shape, GraphicsState::settle_shape). Where that answers the
kept settle's variant and plan, by identity, for the same program and forms
(LiveBind::settle_again), the kept settle takes the new shape and the draw is
rebound; the kept draw's execution record names the new shape, as every
step's does. Else it stops at reshaped as before. The shape found and the
settle are the ones every step would make, so a draw that stops later finds
them made.

Test: draws_after_textures_of_other_level_counts_rebind (lavapipe, debug):
draws alternating a texture of one level and one of three at the slot
tob_sample samples are rebound, none stopped, with the commands and pixels of
the same draws taking every step; the debug check of every second draw
compares the kept draw with what every step keeps.
2026-11-12 10:42:42 -08:00
Anees Iqbal ac560042f2 Tests: the rebound leg binds the no-copy buffer again at an index its draw does not read
encoder_holds' VertexBuffersRebound leg bound the no-copy buffer again at the
same index and offset before its third draw, to show that a retain after calls
that bound only objects the encoder held looks at none. Since a call that binds
a slot as it is bound changes nothing (07f08c4032), that third draw is drawn
again and retains nothing, so argument_tables_held_at_bind stayed 0 where the
test expects 1 (m3-max-21956). The call now binds it at index 2, which the
function does not read: a change of the table that binds only an object the
encoder holds, as the leg means.
2026-11-12 10:42:42 -08:00
Anees Iqbal e9e6eeac6b A draw rebound takes up to 64 changed slots, a material's units among them
A rebind took at most 8 changed buffer, texture and sampler slots over a
draw's stage tables (rebound.rs SLOTS); a draw after more took every step
(draws_rebind_stopped_arguments_slots). A 3D engine's material change binds
its textures and samplers together, 16 slots and more with the buffer
offsets that move at each draw, so each such draw took every step though
its rebind works out each slot exactly as every step does.

SLOTS is now 64, as many as a table's change log keeps of one call
(CHANGES_KEPT). Changed keeps them in its fixed array as before; a rebind's
work stays the changed slots'.

draws_after_buffer_changes_rebind_what_every_step_binds now changes 66
slots between draws (33 texture slots of the vertex and fragment tables,
another texture each draw), so its draws still exceed what a rebind takes;
the samplers set again at the same slots no longer change anything.
2026-11-12 10:42:41 -08:00
Anees Iqbal df0957fdf5 A call that binds each slot as it is bound already keeps the table's stamp
A setter of buffers, textures or sampler states drew a fresh stamp and noted
its slots as changed even where it bound each slot exactly as it was bound:
the same object (by identity), at the same offset and per-bind stride, with
the same clamps, and no function table, null table or bytes there. A layer
over another graphics API that binds its units again before each draw then
made every draw a changed one: past 8 changed slots its rebind stops
(draws_rebind_stopped_arguments_slots) and it takes every step.

Such a call now changes nothing: the table keeps its stamp and its change
log, so the next draw is drawn again or rebound with only the slots that did
change. The call's checks, its retain notes and its hold on the object are
as before; a call refused binds nothing either way. Where any slot of a range
differs, the whole range is noted as before.

The stamp's contract is unchanged (while it holds, the table binds what it
bound, by identity); the debug check of a table that keeps its stamp
(check_reading) compares what it reads at every such draw.

Test: draws_after_calls_that_bind_as_bound_draw_again (lavapipe, debug):
draws after binding the same buffer at the same offset, the same texture and
the same sampler state draw again, with the commands and pixels of the same
draws after a call that changes nothing; the same sampler state with other
clamps at each draw does not draw again.
2026-11-12 10:42:41 -08:00
Anees Iqbal b8e1a678ec draw_costs: scene and rebinds, a 3D engine's passes over four color targets
Two shapes of a 3D engine's frame as a layer over another graphics API
issues it: 8 command buffers of 10 passes of 24 indexed draws over the same
four color targets, each draw at its own slots of a transform and a material
scale (buffer offsets moved), drawing one of 64 pieces of a mesh read
through a vertex descriptor. Every 4 draws a material of 6 binds its pipeline
state, 8 fragment textures and 8 samplers. In rebinds, each draw binds its
material's textures and samplers again, the same objects within a run.

The functions are draw_costs_scene_vertex and draw_costs_scene in
draw_costs.metal. Steps gain Begin (a pass of a descriptor), the two offset
setters and the texture and sampler range setters, each tallied by --calls.
2026-11-12 10:42:41 -08:00
Anees Iqbal a3acfb7c0f 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-12 10:31:25 -08:00
Anees Iqbal b62177a0ef RUNTIME_VERSION 2131: a batch held for its pipelines' making gives way to later commits of other queues
The commits before this one stop one late pipeline making from freezing every other queue. The scheduler's cross-queue commit-order hold (Order::is_behind) kept a batch held for its making in its commit-order place, so later heads of other queues that conflicted with it waited until the making finished. On an Iris Xe guest a 3 s compute pipeline making held the window server's frames behind it, and the guest froze for 3.1 s.

Now a batch held for a host step that has not taken its gate (waiting for its making, or a step that reads nothing the GPU writes) gives way: a later commit of another queue goes first, and the held batch is submitted after it, so the tracker orders it after. The batches behind it on its line give way with it.
- Still held back behind it: a head that shares a fence with it, or names a fence while the held batch's uses are not known yet.
- Unchanged: batches held for their checks or for a step whose gate was taken keep their place; event and binary-semaphore waits; order within a queue. No switch.
- The basis: the probe cross_queue_surface_order (crates/metal2vulkan-conformance/probes/, results table in the file). Metal on the x86 Macs (Radeon Pro 5300M m3-max-21850, UHD 630 m3-max-21851; the guests' class) runs another queue's later commit ahead of an earlier one, even on one tracked buffer, in the order the GPU takes command buffers; the M3 Max kept commit order (m3-max-21812, 21830). Where Macs differ, the runtime takes the cheaper form.
- The earlier exemption of host-alias uses from the cross-queue order is undone: all three Macs order two textures over one IOSurface across queues. host_aliases.rs states the measurements, no-copy buffers over one allocation being unordered across queues included.
- Docs: order.rs's contract, the scheduler's docs, WorkCounts::heads_held_for_earlier_commits, pending_dispatch.rs, docs/API.md and the runtime README.

Verified on lavapipe in debug:
- Before: a head writing a held batch's host bytes through another buffer timed out behind the held making (m3-max-21752).
- After (m3-max-21944): 250/250 plain and 250/250 under METAL2VULKAN_LANE_VALIDATION=sync over hold_sites, the scheduler's order model, host_aliases, the tracker, the IOSurface lanes, commit_and_submit, completion_order, dispatch_pending, pipeline_wait_order, gate, event_timeline, unshared_hold and every pool-hold module. hold_sites' held-making test: B completes while A is held, and A's words land over B's fill. The fence control waits behind; the gate-taken control holds in the order model and in commit_and_submit's check test.
- clippy (every feature, --cfg m2v_gpu, --cfg m2v_cpu_icd) and rustdoc -D warnings are clean (m3-max-21945, 21946).
Not run: the Iris guest; a cold rerun follows.
2026-11-12 10:30:43 -08:00
Anees Iqbal 0dae588ffe Test: a batch waiting for a pipeline holds back no batch of another queue
tests::pipeline_wait_order asserted the order before the previous change: a copy on queue B of a pass's target waited for the pass, held for its draw's making. A held batch now gives way (scheduler/order.rs, Held batches give way), so the copy completes while the pass waits, reading what was there before it (not the drawn texel), no look counts it as behind an earlier commit, and once made the pass runs after it: a later copy reads the drawn texel. Failed as before on lavapipe at f6a3a5d641 (m3-max-21913, plain and sync), the one failure of 218 lane tests.
2026-11-12 10:29:06 -08:00
Anees Iqbal fa827a3d3e Probe: what cross_queue_surface_order measured on the M3 Max, the 5300M and the UHD 630
Jobs m3-max-21812 and m3-max-21830 (M3 Max, macOS 27.0.1), m3-max-21850 (Radeon Pro 5300M) and m3-max-21851 (UHD 630, both macOS 26.7.1, the x86_64 build). The table is the runs where queue B's later commit ran after queue A's long write and read its words. Comment only.
2026-11-12 10:29:06 -08:00
Anees Iqbal b46459080d A batch held for its pipelines' making gives way to later commits of other queues
What: the scheduler's order across queues (scheduler/order.rs) no longer keeps the place of a
batch held unsubmitted for a host step that has not taken its gate: its pipelines being made, or a
step that reads nothing the GPU writes (`place_of`: `Place::GivesWay`). A later commit of another
queue that conflicts with it on a resource goes first, and the held batch is submitted after it,
so the tracker orders the two that way (submission order). The batches after it on its line give
way with it. What still holds a head back behind such a batch is a fence the two share
(`tracker::fenced`: one updates a fence the other waits for or updates, or a batch whose uses are
not known yet against one that names a fence), so no batch is moved after a fence update it waits
for. Unchanged: same-queue order, event and binary-semaphore waits (a batch waiting for the
program still keeps no place), batches held for their submission checks or for a host step whose
gate was taken (they keep their place: a later write going first would land after the step read),
and the order among submitted batches.

Why: on an Intel Iris Xe a guest process's cold compute pipeline took about 3 s to make; its
command buffer kept its place, and the other processes' heads that conflicted with it (the window
server's frames among them, over a surface they shared) waited behind it: the guest's display
froze for 3.1 s. Metal's order across queues is the order the GPU takes the command buffers, not
commit order: probes/cross_queue_surface_order.m's same-buffer control (one tracked buffer,
written by queue A's long compute, then read or written by queue B's later commit) ran B before A
once in three on a Radeon Pro 5300M and on a UHD 630 (macOS 26.7.1; m3-max-21850, m3-max-21851),
and in commit order on an M3 Max (macOS 27.0.1). Where real Macs differ, the cheapest form inside
them is taken; no switch, as matching the x86 Macs trades no accuracy. (The previous commit's
message miscounted the no-copy buffer case: unordered in 10 of 12 runs, 6 of 6 on the M3, 3 of 3
on the 5300M, 1 of 3 on the 630.)

Docs: order.rs's contract (**Tracked order across queues is the order the batches go**, **Held
batches give way**, **No deadlock**), the scheduler's tracking and gate docs,
WorkCounts::heads_held_for_earlier_commits, pending_dispatch.rs, docs/API.md's and the runtime
README's pipeline-wait passages.

Tests: tests::scheduler a_later_commit_goes_before_a_batch_held_for_its_making and
a_batch_held_for_its_making_holds_back_a_commit_sharing_a_fence (the order's model; its existing
a_later_commit_that_conflicts_waits_behind_a_batch_held_for_its_step is the kept-place control);
tests::hold_sites a_head_that_shares_a_buffer_with_a_batch_held_for_its_making_goes_first (was
..._waits_behind_it: the fill completes while the dispatch is held, and the dispatch's words land
over it), a_head_that_waits_for_a_fence_a_batch_held_for_its_making_updates_waits_behind_it (the
fence control), and the host-alias leg, which passes again.
2026-11-12 10:29:05 -08:00
Anees Iqbal aa2256b6e7 Order host-alias uses across queues again: Metal orders textures over one IOSurface across queues
Reverts a5634d48db and 3926d2d8c9, which left the uses the host aliases add out of the
scheduler's order across queues on the strength of host_aliases.rs's line that Metal orders two
textures over one IOSurface across queues only as the program orders them. The conformance probe
probes/cross_queue_surface_order.m measured that case (queue A's long compute write committed
before queue B's blit read of the same bytes, no event between them, three runs each):

- two tracked textures over one IOSurface: B ran after A and read its writes in every run on an
  M3 Max (macOS 27.0.1, m3-max-21812, m3-max-21830), a Radeon Pro 5300M and a UHD 630 (macOS
  26.7.1, m3-max-21850, m3-max-21851); untracked, the same but one run on the 5300M;
- a texture of another surface (control): ran alongside A on the M3 and the 5300M;
- two no-copy buffers over one allocation: B ran alongside A, reading stale or mixed words, on
  all three (8 of 9 runs; the 630 ran it one after the other twice);
- one tracked buffer (control): ordered on the M3; the 5300M and the 630 each took B first once.

So the alias keys' order across queues is the surfaces' order, which Metal keeps; dropping it was
wrong for the consumer's surfaces, whose textures lie over per-texture no-copy buffers.
host_aliases.rs now states those measurements, the plain no-copy buffers' among them, in place of
the M4 line. The freeze the revert reopens (a held batch's making holding other queues' heads
over a shared surface) is answered by the next commit, which lets a batch held for its making give
way across queues, as the x86 Macs' GPUs may take a later commit first.

Until that commit, tests::hold_sites::a_head_over_the_same_host_bytes_through_another_buffer_goes_while_a_batch_is_held
fails as before a5634d48db (m3-max-21752).
2026-11-12 10:29:05 -08:00
Anees Iqbal e495306c82 Probe: pick a device by name and use managed textures on an x86 Mac's GPU
So the same probe runs on the x86 oracle's 5300M and UHD 630, whose GPUs take no shared texture. Not run there yet.
2026-11-12 10:29:05 -08:00
Anees Iqbal 3e083e0a71 Probe: controls for a texture of another surface and for untracked textures over one surface
Separates an order through the shared IOSurface from a texture blit that would wait for the compute anyway (surface-apart), and an order from hazard tracking from one from the surface itself (surface-two-untracked). Not run yet.
2026-11-12 10:29:05 -08:00
Anees Iqbal 690d1d0ee7 Probe: whether Metal orders another queue's later commit behind an earlier one over shared surface or host pages
Two textures over one IOSurface and two no-copy buffers over one allocation, queue A's long compute write committed before queue B's short blit read of the same bytes, with one resource on both sides as the control. The basis of the scheduler's order across queues leaving host-alias uses out (host_aliases.rs). Not run yet; its results follow in a later commit.
2026-11-12 10:29:05 -08:00
Anees Iqbal 1f64d31f6c Docs: the order across queues holds a head only on a resource both batches name
heads_held_for_earlier_commits and pending_dispatch.rs's module docs said a batch of another queue waits where the two share a resource; since the previous commit a conflict is on a resource both name, not on two resources over the same host bytes (host_aliases.rs). The counter's doc also names the pipelines' making among the runtime's own holds. Docs only; verified by reading.
2026-11-12 10:29:05 -08:00
Anees Iqbal 1b802ea45a Cross-queue commit order counts a conflict only on a resource both batches name
What: a use the device's host aliases add (host_aliases.rs: a no-copy buffer over the bytes of
another, the consumer's textures of one IOSurface over their plane buffers) is now marked
(`Use::aliased`). The scheduler's order across queues (`Footprint::conflicts`, behind
`Order::is_behind`) leaves marked uses out, so a batch the runtime holds for a reason of its own
(its pipelines' making, a host step, its checks) holds back no later commit of another queue that
meets it only over shared host bytes. A use joined with one its command named stays named (join
and merge keep `aliased` only where both are; `covers` lets no aliased use hold a named one), so
two batches that name one resource still run in commit order, as Metal's tracking orders them.
The tracker's barriers, inside a queue and on the GPU once both are submitted, take aliased uses
as before.

Why: on an Intel Iris Xe, one guest process's compute pipeline took about 3 s to make cold. Its
command buffer kept its place in commit order (held for its making), and five other queues' heads
in each scheduling pass, the window server's frame among them, conflicted with its footprint only
through the alias keys over IOSurface pages they shared (heads_held_for_earlier_commits +5 per
pass, footprints_built +2, the scheduler otherwise idle). The frame's present waits for its
writers' completion, the guest's display pipe allows two unanswered presents, and the guest froze
for 3.1 s. Metal orders two textures over one IOSurface across queues only as the program orders
them (host_aliases.rs's measurement: an M4, macOS 27.0.1, plain and under API validation), so a
later commit of another queue through another resource over those pages does not wait for an
earlier one there; holding it was ours alone.

docs/HOWTO.md's paragraph on copied and same-surface buffers says the same; the order.rs,
scheduler gate and host_aliases.rs docs name the exception.

Tests: tests::hold_sites::a_head_over_the_same_host_bytes_through_another_buffer_goes_while_a_batch_is_held
(the previous commit) failed before this change on lavapipe (m3-max-21752: TimedOut, the fill
waited behind the held dispatch) and is expected to pass after; tests::tracker gains
a_use_the_host_aliases_added_orders_no_batch_across_queues (aliased-only overlaps unordered both
ways, a named key on both sides ordered, a named use joined with an added one of the same range
named); tests::host_aliases expects the added uses marked.
2026-11-12 10:29:05 -08:00
Anees Iqbal 75d4b66852 Test: a head over a held batch's host bytes through another buffer goes while the batch's making holds it
Two no-copy buffers over the same host bytes are two resources, which Metal orders across
queues only as the program orders them (host_aliases.rs's M4 measurement). The scheduler's
cross-queue commit-order hold (Order::is_behind) counted the use host aliases add for the
second buffer as a use of the first, so a fill through the second buffer on another queue
waited for the first queue's dispatch, held by its pipeline's making. On an Iris Xe guest a
cold 3 s compute making so held a compositor's frames behind another process's command buffer
over a shared surface's pages, and the guest froze for 3.1 s.

This commit adds the test alone (hold_sites.rs, Exact pipeline waits, the pool's test hold):
it fails until the order counts only conflicts on a resource both batches name.
2026-11-12 10:29:05 -08:00
Anees Iqbal 540ec7c4c8 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-12 10:26:49 -08:00
Anees Iqbal 5334570ad2 SEMANTICS_VERSION 2056: a private-arena pointer may be null
The commits before this one give arena and typed thread pointers a null value. Until now they had none, so a phi or select with a null incoming, and a compare of a pointer that may be null, were refused (Lowering(Access): "its copy would need the constant materialized"; LocalStrategy::NullCompare). That is the shape of a helper returning a pointer into a thread array at a run-time index or null, which callers null-check: one of the two refusals keeping a guest's path-tracing kernels from being made.
- memory::plan keeps the private arena's first word (NULL_WORD = 4) when a root set holds an alloca and null; null is offset 0, and no object has it.
- Null-only phi incomings are accepted; a maybe-null pointer compares by offset. Signed compares with null, and threadgroup or typed objects' null, stay refused.
- A null dereference reads at an out-of-arena offset, so containment reads 0 or drops the write (undefined in Metal). Under ContainmentPolicy::UnsafeOff it is an unchecked access; that policy's doc lists it.
- The owned fixture nullable_private (with its Metal probe) and engine_pointer_cells' two compares now run on every profile and check Metal's answers. Its golden rows come at the next bless.

Verified:
- The M3 oracle's words for 8 threads x 8 words (m3-max-21796); runtime_lane::nullable_private passes on lavapipe (m3-max-21869); tests::engine_nullable_private passes on every committed profile, L3 and the CPU interpreter.
- clippy and rustdoc -D warnings are clean, and the metal2vulkan suite passes 3488 tests but the golden tables, whose only change is the new fixture's row (m3-max-21897, 21947).
- macOS 27's 590 MPS functions: 0 rows differ (m3-max-21838).
- The guest's surface-shading kernel moves past the refused phi (block 217) to the next refusal, a pointer store into an undisciplined closure array (block 300), which the next change addresses.
2026-11-12 10:26:08 -08:00
Anees Iqbal b05243a537 engine_pointer_cells: a possibly null arena pointer compares by offset, as Metal's
The private arena keeps its first word for null when a pointer into it may be null, so the two
tests that pinned the old refusal (an object at offset 0 would compare equal to null) now run the
kernels on the CPU interpreter on every profile: odd threads read the array's address back and
compare equal to it, even ones read null and compare equal to null.
2026-11-12 10:25:30 -08:00
Anees Iqbal bbe4ba7c26 runtime_lane::nullable_private: import AirLibrary 2026-11-12 10:25:30 -08:00
Anees Iqbal 293fda7851 A null private pointer: tests against Metal's words, and its documented contract
- `memory::plan` tests: a select of an alloca's address and null puts the alloca in the private
  arena past its kept first word (`null_word`, the alloca at 8, the arena 16 bytes); an arena no
  pointer of which may be null keeps no word (the typed-alloca test's layout is unchanged).
- `tests::engine_nullable_private`: the owned fixture `nullable_private` compiles and passes L3 on
  every committed profile, comparing its pointer's offset with null's
  (`access.private.pointer_compare`), and on the CPU interpreter writes what the M3 Max writes
  (`probes/nullable_private.m`, run on macOS 27.0.1, m3-max-21796).
- `runtime_lane::nullable_private`: the same words on the device the cfg selects, under the
  validation layer.

Docs: `lower::access::local`'s module doc gives the null private pointer (offset 0 of the kept
word, its phi and compare) and narrows its list of what stays refused to the threadgroup and typed
pointers that may be null; `ContainmentPolicy::UnsafeOff` names a null thread pointer's
dereference (undefined in Metal) among the accesses it leaves unchecked.
2026-11-12 10:25:30 -08:00
Anees Iqbal ff6d6f0d1c Fixture nullable_private: a thread pointer that may be null, with its Metal probe
Our own MSL, compiled by this Mac's toolchain (`scripts/regen-air-fixtures`): `closure_alloc`
hands out the next element of a thread's array at an index only the run knows, or null once the
array's room is used up, and two `noinline` callees null-check it. The AIR carries the shapes the
null private-arena pointer covers: `phi ptr [ %elem, ... ], [ null, ... ]` passed to `weigh` and
to `is_null`, each comparing its argument with null.

`probes/nullable_private.m` runs the same source on Metal and prints each thread's eight words,
for the runtime lane's comparison.
2026-11-12 10:25:30 -08:00
Anees Iqbal 551cb6e08c A null private-arena pointer: offset 0 of an arena that keeps its first word for it
Blender Cycles' closure_alloc hands out a thread pointer into ShaderData's closure array at a
run-time index, or null once the array is full; its callers null-check it. The result is a `phi`
of the element's address and null (66 of them in the surface-shading kernel), and the private
arena had no null value: `lower::access::local::lowered_pointer` refused a phi with a constant
incoming pointer, and the compare of a pointer that may be null with null was refused
(Lowering(Access)).

The memory plan now keeps the private arena's first word (`ArenaLayout::null_word`,
`NULL_WORD` = 4 bytes) when some root set holds an alloca and the null root, so no object lies
at offset 0 and a null private pointer is offset 0, the value zero bytes already hold in a
pointer cell. Such an alloca is merged, so never typed: its pointers are private-arena offsets.
Then:

- a null (or undefined) thread pointer constant is offset 0 (`local_ptr`), so a `select` or
  `getelementptr` may take it;
- a phi whose only constant incoming values are null takes them, its copy storing 0
  (`pointer::phi_incoming`);
- a compare of a pointer that may be null compares offsets: null at 0 is below every object,
  as Metal's null is, so unsigned and equality compares answer as Metal's; a signed compare with
  null stays refused.

A dereference of null reads or writes the kept word (or, displaced, an object's bytes): undefined
in Metal, contained in the arena under containment, and unchecked under `UnsafeOff`.

The owned fixture `nullable_private` follows in the next commits.
2026-11-12 10:25:30 -08:00
Anees Iqbal aa6dcf54cf SEMANTICS_VERSION 2055: lockstep proves guarded spans, carry-free ors and lattice anchors apart
Kernels whose accesses the analysis now proves apart (an access's span under the unsigned tests
of the branches that dominate it, an or of a constant the other operand's zero low bits cover,
anchors that differ by a multiple of a power of two plus a bounded part) lose lockstep barriers,
and with the simdgroup ones their cross-lane class and pinned subgroups.
2026-11-12 10:19:15 -08:00
Anees Iqbal 41b8f517e9 lockstep: anchors that differ by a multiple of a power of two plus a bounded part
What: a tile store whose anchor is a GEP over a GEP from a uniform base, the inner index a
thread's column (`t & 31`) and the outer one its block (`(t & -32) << 3` words), had no spread:
gep_spread takes one varying index over a uniform base only. So every pair of its rows (stores
128 bytes apart off one anchor) was a conflict, and in a block only a simdgroup barrier may
stand in, the barriers made the kernel cross-lane and, on a device with tangled 32-lane
subgroups (the Iris profile), pinned its subgroup to 32 lanes.

The anchor's spread may now be a lattice (Spread::Lattice): walking its GEPs down to a uniform
base, each non-uniform index adds stride * index, with the low zero bits both have
(low_zeros, at most the index width) and, where the index's range is known and not negative
as a signed index, the bytes it spans. For the largest power of two g whose terms with fewer
zero bits all have spans, summing to l below g / 2, two threads' anchors differ by a multiple
of g plus at most l either way: the terms at or above g are multiples of g, and g divides
2^index_bits, so a wrap at the index width keeps the multiple; a term whose range is unknown
or negative as a signed index only counts toward g. apart() then accepts a pair only where no
multiple of g lies strictly between down - l and up + l. The tile is l = 124, g = 1024: rows
128 * j apart, 1 <= |j| <= 7, never meet; the same row (j = 0) stays a conflict (two threads
may share a column where x is a position).

Tests: engine_simd_lockstep's tile_rows_apart_by_more_than_their_columns_take_no_barrier, on
the Iris and lavapipe profiles: the tile (four rows, two simdgroups' blocks) takes no lockstep
barrier and keeps (LaneArithmetic, Linear), its words 4 (t ^ 1) + 600 at 8, 16 and 32 lanes;
the same tile with rows 64 bytes apart (lane l + 16 of row k stores where lane l stores row
k + 1) keeps three simdgroup barriers, CrossLane(BASIC) and Direct on Iris or Emulated on
lavapipe, its words the later row's. a_guarded_access_apart_by_its_bytes_takes_no_barrier now
asserts (LaneArithmetic, Linear): its simdgroup index alone puts it on the linear tier, which
pins nothing.
2026-11-12 10:19:14 -08:00
Anees Iqbal d0ca40d2f9 lockstep: an or of a constant its other operand's zero low bits cover adds without a carry
The address facts took an `or` as a sum only where the IR states `disjoint`. A vector word
`2t | 1` beside `2t` (two 16-byte words a thread stores, as compiled AIR spells them without the
flag) was then no anchor of the even word's shape, so the two stores of different threads met
for every pair the guard's span left overlapping, and took a lockstep barrier.

`low_zeros` reads the low bits a value has zero from the IR (a constant's, a shift's or scaling's
by a constant, a mask's, a sum's, an extension's), and `disjoint_or` takes an `or` of a constant
not negative whose bits those zeros cover as the `disjoint` sum it is: in `plus_const` (whose
flags then state it), the summands, `range` and `inj_int`.

Test: `a_guarded_access_apart_by_its_bytes_takes_no_barrier`'s kernel stores both words; with the
span alone one lockstep simdgroup barrier stayed there.
2026-11-12 10:19:14 -08:00
Anees Iqbal 626f5541d0 lockstep: an access's span under the unsigned tests of the branches that dominate it
The lockstep facts gave a guarded access no byte span: `range` read only the IR's own bounds, so
a store under `if (t < 4)` into the first 128 bytes of threadgroup memory spanned every offset a
thread index allows, and met every later store of its barrier interval. Each such pair took a
lockstep barrier, a simdgroup one where the place is uniform only per simdgroup, which raised
the kernel's simd class and, on a device with maximal reconvergence and pinnable 32-lane
subgroups, pinned its subgroup size to 32.

An access's span is now computed under its guards: every `x <u y` that `below` already records
for the branch edges dominating its block bounds `x` by `y`'s largest value less one, and every
exact step from `x` (extensions, shifts, masks, sums) carries the bound into the GEP index. The
value at the access is the one the edge tested, as for `below`. `range` also bounds `x | k` by
`max(x, k)` and `x + k`, which a vector word `2t | 1` needs.

Test: `a_guarded_access_apart_by_its_bytes_takes_no_barrier`, an owned kernel of that shape
(guarded vector words below byte 128, tile words from byte 128 through other address shapes),
on the Iris and lavapipe profiles: no lockstep barrier, no simd tier, and the interpreter's words
at 8, 16 and 32 lanes in both orders.
2026-11-12 10:19:14 -08:00
Anees Iqbal ace5b5e553 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-12 10:14:22 -08:00
Anees Iqbal 919ebf1d2a RUNTIME_VERSION 2130: where a rebind of other arguments stops, counted step by step
The commit before this one splits WorkCounts::draws_rebind_stopped_arguments_other, which held 60.6% of Valley's draws at
pin 53 (reims's walkprof3-xtx), into 16 fields: draws_rebind_stopped_arguments_{unkept, restated, stale, unread,
unlisted, slots, images, reshaped, unsettled, checks, narrowed, worked, vertex_buffers, shadows, barrier, detached}.
_other keeps only the stops where every step reports an error. Behaviour is unchanged; api_signatures has the 16 rows.

Verified: cargo fmt; api_signatures --check passes; lint at the branch tip follows (m3-max-21906). The counters are for
a guest run that names the step stopping Valley's draws.
2026-11-12 10:13:39 -08:00
Anees Iqbal 7f12b541b4 Work counts: where a rebind of other arguments stops, step by step
draws_rebind_stopped_arguments_other held every stop past the route, the plan's
tables, the fetch window and the reach. Sixteen new counters split it by the
rebind's step: the kept draw keeps nothing to rebind (unkept), a restated render
state, a carried draw's stale slot, a changed table read otherwise (unread) or no
longer listing its changes (unlisted), more changed slots than a rebind takes
(slots), images, a reshape, an unsettled bind state, every step's checks,
narrowed slots, set-0 writes or uses not worked out (worked), vertex buffers,
shadows, a barrier and a detached buffer. other keeps what is left: an error
every step reports. bring_in answers its stop; rebind sets the stop at each
return. Behaviour is unchanged.

The counters live in one array (draws_rebind_stopped_arguments_by), with the
public fields read from it; api_signatures gains the sixteen rows.
2026-11-12 10:13:09 -08:00
Anees Iqbal 2dec76f63a 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-12 10:03:01 -08:00
Anees Iqbal be9047e693 RUNTIME_VERSION 2129: kept draws carry across a commit to the queue's next command buffer
The commits before this one carry a command buffer's kept draws to the next command buffer of the same queue, so its first draws no longer take every step.
- At commit, settle_end_committing hands the carry to the queue place (QueueShared.carried, one carry). An earlier carry nobody took is let go and counted in kept_draws_carry_dropped_commit.
- A render encoder whose command buffer holds no carry of its own takes the queue's, under the same fit checks. The taken draws are Kept::across. Their first rebound draw retains, into its own command buffer, what every step retains beyond the argument tables: the pipeline state, the variant's objects, the VkPipeline and the call's index buffer.
- The carry names guest objects only by key and raw handle (ResourceKey is never reused; pipeline states are held weakly). Draws with a failing DepthStencilState don't carry. Strong holds are the runtime's own objects only, one carry per queue place. So a carry keeps nothing the program released alive.
- New counter kept_draws_carried_across, with its api_signatures row.
- The debug cross-check of every second draw keeps counting across the commit. When it takes every step for a rebound draw, it now compares against the rebind's own reads through copies, which also covers a carried draw that samples a texture its new pass renders.

Measured in one exclusive job (m3-max-21803, gem10): the compositor's shape, before RV 2127 / at RV 2128 / this change, a draw:
- 780M (RADV), two rounds: thread CPU 24.17-23.77 / 22.38-20.84 / 19.78-20.45 us; cycles 68.1-71.2k / 60.8-62.6k / 55.8-58.7k.
- lavapipe: instructions 51,401 / 51,181 / 50,513; cycles 64.1k / 53.7k / 48.6k.
- Draws taking every step, a command buffer: 8 / 3 / 0.05 (the run's first command buffer).

Verified on lavapipe in debug:
- a_carry_its_queue_holds_keeps_nothing_released_alive: an index buffer over host pages released after the commit that left a carry is freed before the next command buffer's pass opens; a re-made pipeline state finds no kept draw and takes every step; pixels equal the same command buffers run each on a queue of its own. Negative control (m3-max-21792): leaking the index buffer in KeptIndex::of fails the test at "the released index buffer freed".
- carried_draws' Apart::CommandBuffers frames give the same counts and pixels as passes in one command buffer.
- The runtime suite passes 2361/2361 (m3-max-21845); the kept, carried, render and host-step lanes 133/133.
- clippy (every feature, --cfg m2v_gpu) and rustdoc -D warnings are clean (m3-max-21857); api_signatures --check passes.
2026-11-12 10:02:17 -08:00
Anees Iqbal 7df115b9b8 Debug check: a rebound draw's reads through copies as its rebind worked them out
The check of every second rebound draw compared the kept draw's reads through copies
(Kept::through_copies) with every step's; a carried draw's pass may render a texture its kept
draw's pass did not, so its rebind works them out again (record_rebound keeps them). The check
now takes the rebind's, so it checks that every step works out the same. Seen across a commit:
image_standing's chain test carried a draw that sampled a texture into another target into a
pass of that texture (field through_copies, named by a split of the assertion).

The kept draw's VkPipeline goes back into the comparison: a draw of a key's general form is
never kept, so a kept draw's pipeline is the one every step finds.
2026-11-12 10:01:47 -08:00
Anees Iqbal 9c1ecce043 Debug check: a kept draw's VkPipeline may be its key's general form, which every step since replaced
The check of a draw again compares the kept draw with every step's; a kept draw recorded through
its key's general form (a residual form while its own was made) records through that form
again, where every step finds the key's own made by then. Kept::made holds what the kept
recording names, so the check takes it as the kept draw's, as it takes the command buffer of a
carried one. Seen across a commit: image_standing's chain of passes in command buffers of their
own failed the check (a draw again kept another draw).
2026-11-12 10:01:47 -08:00
Anees Iqbal 66526c0b8f Tests: the released-objects carry test leaves out the warming runs' counts
The fourth command buffer's pipeline state, made again after the first was released, is warmed
by runs on queues of their own; their counts (a carry let go between at each run's read back,
and their draws' every steps) are the device's, so the frame leaves that span out
(Frame::left_out).
2026-11-12 10:01:47 -08:00
Anees Iqbal ac20b5463c Carry kept draws across a commit to the queue's next command buffer
A render encoder's kept draws carried at its command buffer's commit were let go there
(kept_draws_carry_dropped_commit), so each command buffer's first draws of each state took
every step: two of the eight every-step draws a compositor command buffer takes.

The commit now hands the carry to its queue's place (QueueShared::carried, one a place), and a
render encoder of a later command buffer of the queue that holds no carry of its own takes it,
under the same fit as within a command buffer. Its kept draws are across (Kept::across): their
first draw, rebound, retains into its own command buffer what every step retains beyond its
tables' objects: its pipeline state, its variant's objects, its VkPipeline (Kept::made, held
while kept) and the call's index buffer. The one the queue held, which none took, is let go at
the next commit that carries (kept_draws_carry_dropped_commit), counted;
kept_draws_carried_across counts the encoders that opened from one.

The carry names the program's objects by key and handle alone: the bind state holds values,
the kept draws' index buffers are keys and handles (ResourceKey is never reused), their
pipeline states are held weakly. A kept draw whose depth/stencil state fails every fragment,
whose settings hold that state, no longer carries: it takes every step once restated anyway.
So a carry the queue holds keeps nothing the program released alive; the runtime's objects it
holds (settles' variants, VkPipelines) are bounded by the one carry a place.

The debug check of every second carried draw goes on across the commit, so draws carried
across are checked and rebound in turn.

Tests: carried_draws frames gain Apart::CommandBuffers (carried across one queue) beside
Apart::Queues (a queue a pass, which carries nothing, the every-step reference), with the same
counts and pixels as the passes in one command buffer; and
a_carry_its_queue_holds_keeps_nothing_released_alive: an index buffer over host pages released
after the commit that left the carry is freed (its deallocator run) before the next command
buffer's pass opens, whose draw of another index buffer draws that buffer's triangle, and a
pipeline state released and made again finds no kept draw of its own (draws_none_kept).
2026-11-12 10:01:47 -08:00
Anees Iqbal 8f079dc94d 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-12 09:31:49 -08:00
Anees Iqbal 118d51a18c api_signatures: Texture's private second field (the retain token)
RUNTIME_VERSION 2128 gave metal2vulkan-runtime's Texture a second private tuple field, Option<Arc<Retain>>. Both fields
are private, so nothing breaks for a consumer; the table prints the struct's declaration and moves with it. Written with
`python3 scripts/api-signatures/signatures.py --bless`; only that row moves.
2026-11-12 09:31:05 -08:00
Anees Iqbal bc3fba7400 RUNTIME_VERSION 2128: useHeap holds the heap, not its textures, so released heap textures go while the heap stays in use
The commits before this one fix a leak of released heap textures. Residency::use_heap and sync_heaps took Heap::textures_from, which upgraded every texture in the heap's weak list that had any strong handle. A texture the program had released, but that an in-flight command buffer's residency still held, was joined again to each next command buffer. While frames stayed in flight that relay never broke: the texture, its image and its automatic-heap range went only once the device drained. Metal's useHeap retains the heap only.

Now each texture handle the program holds carries a per-texture Retain token; TextureShared keeps a Weak to it. Heap::textures_from takes a texture only while its token lives and hands it out as a heap use holds it (Texture::for_heap_use), without the token. It upgrades under the list lock and filters after the lock is free, so a last handle never drops under the lock. A texture already joined to an in-flight command buffer stays held there until that buffer completes. Handles the runtime holds other than heap uses (encoder bindings) also hold the token, so a released texture still bound in an in-flight command buffer can be taken by one more useHeap; that hold ends when the buffer completes and cannot relay. The residency module docs, HeapShared.textures and both public use_heap docs say so.

Verified on lavapipe in debug:
- tests::heap_use_released::released_heap_textures_go_while_later_users_of_the_heap_are_in_flight (an automatic Private heap with 1 kept and 128 released textures; frames gated on a shared event) fails before the fix with 0 of 128 gone after 10 s (m3-max-21680) and passes after: 128 of 128 gone in 0.09 s, with the kept texture's texels right in all 4 frames (m3-max-21703).
- The runtime's heap and residency tests pass 129/129 (m3-max-21703), and the validation lanes for heaps, residency, used_resources, resource_ids, rebind_reach and executions pass 271/271 (m3-max-21707).
- fmt, clippy (default, --cfg m2v_gpu, --cfg m2v_cpu_icd) and rustdoc -D warnings are clean (m3-max-21704, 21706).
Not run: the Iris Xe or the consumer's guest.
2026-11-12 09:30:52 -08:00
Anees Iqbal 5bf8c8fadf useHeap holds the heap, not its textures: released heap textures go while the heap stays in use
A heap texture the program released was kept until nothing that used its heap was in flight. Each
use_heap and sync_heaps took the heap's textures from its weak list (Heap::textures_from), which
upgraded every texture with any strong handle. A released texture that an in-flight command
buffer's residency still held was therefore joined to the next command buffer's residency, and
from that one to the next. While frames stayed in flight that relay never broke, so the texture,
its image and its automatic heap's range went only once the device drained.

Metal's useHeap: retains the heap, not its textures. A texture's handles now hold a Retain token
(texture::Retain) that a heap use's handle does not hold. Heap::textures_from takes a texture only
while its token lives, and hands it out as a heap use holds it (Texture::for_heap_use): the object
without the token. A texture already joined to an in-flight command buffer's residency stays held
by that command buffer until it completes. A later use of the heap no longer takes it, so it goes
once the command buffers that used it while the program held it complete. Handles that
Texture::upgrade makes hold the token only while another handle does. Textures that are dropped
while textures_from upgrades them go with the heap's list lock free.

The residency module docs, Heap's list docs and both use_heap docs say so.

Verified: tests::heap_use_released, the lavapipe device test of this shape, failed at f9b3024777
(the test alone, m3-max-21680): 0 of 128 released textures gone while the three later frames
waited. The after run is on this commit.
2026-11-12 09:30:22 -08:00
Anees Iqbal f1e630fa1e Test: a heap's released textures go while later users of the heap are in flight
A device test: an automatic Private heap holds a texture the program keeps and 128 more. A first
frame, gated on a shared event, uses the heap and reads the kept texture through its resource ID.
The program releases the 128, commits three more gated frames that use the heap, and signals the
first frame alone. Once it completed, every released texture must go while the later frames still
wait; then each frame read the kept texture's texels.

Today each later frame's use_heap takes the released textures again from the heap's list, which
finds them alive in the first frame's residency, so they go only once nothing that used the heap is
in flight. The fix follows; this commit is the before.
2026-11-12 09:30:22 -08:00
Anees Iqbal 7fbd7a6d43 Golden re-bless at a96e93f4da
The engine inventory, golden hashes and air_input printouts were re-blessed on the M3 at development a96e93f4da (job m3-max-21679). The inventory, golden and printout steps each exited 0.

What moved:
- icb_depth_indexed_encode, which 82fd1b6108 edited: its new dio_encode_strided kernel has rows in golden_hashes.tsv and public_fixture_expectations_engine.tsv (its profile verdicts match dio_encode's), and the fixture's source hashes and printout changed. The existing kernels' output hashes are unchanged.
- The tns_mm printouts (edge, flags, float, int): SEMANTICS_VERSION 2054's Tensor variants now print `InitStrided { data: Device, trailing: false }` and `Extent { trailing: false }`. Their golden SPIR-V hashes are unchanged.
No other fixture's row moved.

The merged check at the same sha passed (m3-max-21678).
2026-11-12 09:26:23 -08:00