Commit Graph
5743 Commits
Author SHA1 Message Date
Anees Iqbal 4e2ec6e9d7 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 20:37:01 -08:00
Anees Iqbal fdea9b585a RUNTIME 2333: On a device whose image uses miss buffer writes in one VkCommandBuffer, an end-recorded render pass joins after byte writes and splits only where its images meet them
A render encoder whose pass records at its end joins a group after byte writes, split before its pass where it meets them

On a device where DriverFact::ImageUsesMissBufferWritesInOneCommandBuffer
holds (the RTX 3090), State::join_fold let a render encoder join no group
whose earlier encoders wrote bytes. Every render encoder after a compute or
blit write of any buffer then began a VkCommandBuffer of its own: a chain of
dispatch, draw and copy took 7 VkCommandBuffers where it took 1 elsewhere
(render_fold at pin 96). The defect is narrower: an image use after a
buffer write over the image's memory in one primary.

The join now stands on that device as on any other, and the split goes
before the pass where the pass uses such an image:
- Each draw a pass recorded at its end notes its uses apart, into its
  secondary (EncoderCore::record_aliased); where one uses an image whose
  memory meets the bytes noted written in the VkCommandBuffer (the group's
  FoldOrder::byte_writes and the encoder's own), the encoder owes a split
  (AliasWrites::noted_apart).
- The first command it then records into the VkCommandBuffer, a shadow's
  copy before a later draw or the steps and pass at its end, whose uses
  hold the attachments', goes in a new one where it owes one or its own
  uses meet the writes (AliasWrites::meets). An unordered encoder's shadow
  copy now takes the check too (EncoderCore::shadow_command).
- A pass whose first instance records inline still joins no group
  (Fold::admits): its draws record from the first on.

render_fold's counts go back to one VkCommandBuffer for the chain on every
device (no lane's pass uses an image over written bytes). heap_textures
gains the render analogue of the measured lane: a blit's copy into a
tracked heap's buffer, then a render encoder's draw reading the texture
over those bytes (recorded at its end), its pass loading and storing that
texture (at its end), and a draw reading it in a pass recorded inline,
each asserting every texel is the copy's, the join, and a split where the
fact holds for the two recorded at their end (none for the inline one).
The render functions are an owned fixture, examples/heap_draws.metal.

A texture reached through a heap made resident (useHeap:) is a read of
the heap's bytes, which meets no write; alias_split.rs says so.

Verified: cargo fmt; the fixture's regen check (metal-as round trip, LLVM
21 llvm-as). Clippy, the runtime and validation suites and the device runs
(the 3090 with a negative control, a non-splitting device) follow.

alias_split: a write after a draw noted apart, over its image, splits before the pass; use_heap guard lanes

The draw-time check of the narrowing (a render encoder whose pass records at
its end joins a group after byte writes) checked each draw recorded apart only
against the writes noted by the time of the draw. A command recorded into the
tail after that draw, but before the pass (a shadow's copy, or an emulated mesh
or tessellation dispatch writing guest bytes), adds writes the draw's images
were never checked against. The draw still runs after them, inside the pass
the encoder records at its end, in the same VkCommandBuffer: the defect the
split guards (DriverFact::ImageUsesMissBufferWritesInOneCommandBuffer, the
RTX 3090).

AliasWrites now also notes the memory the images of the commands recorded apart
use (`apart`). That list is per encoder and bounded like the writes: at most 32
keys, each key's ranges joined into one, and past that every range meets.
note() sets the owed split where a new write meets one of those images. The
check is now order-free: every image a pass's draws use is checked against
every write recorded before the pass. begun() clears the writes and the debt
but keeps `apart`, since those draws still run after whatever the new
VkCommandBuffer records before the pass. The draw-time check and the write-time
check share one bounded range set (`Noted`). UseRange::image_bytes gives an
image's place as shares_memory takes it.

The draft's scope sentence about useHeap: was wrong (devlegs agrees). A texture
of a heap made resident is its own Used::Texture token. bind's used_uses lists
it for any function that reads a texture, and resident_uses_into gives it a
Texture::bound_use image use. Two heap_textures lanes now guard that path. In
each, a blit writes the heap buffer, then something reads the texture over
those bytes only through an argument buffer, with use_heap and no
setTexture:
- a draw of a pass recorded at its end (read_argument_fragment);
- a dispatch (read_argument_kernel).
Each asserts that every texel shows the write, that the encoder joined the
blit's group, and that the split count is > 0 exactly where the fact holds. The
lane enum is TextureUse now (it covers a dispatch), the function
blit_write_then_texture_use. The fixture heap_draws.metal gains the two
argument-buffer functions (regenerated with scripts/regen-air-fixtures).

Verified: cargo fmt; the fixture regen (metal-as round trip, LLVM 21 llvm-as).
The unit test a_write_after_a_draw_noted_apart_over_its_image_splits_the_next_command
fails without note()'s new check. Builds, clippy and the device runs (with a
negative control on the 3090) follow in jobs.

Verified: job 31175 at ceb7e56415: clippy -D warnings (runtime and
validation, all targets and features), the alias_split unit tests 6/6. Job
31177 on lavapipe (--cfg m2v_cpu_icd): 25/25 (the blit-write lanes,
a_buffer_write_shows_in_an_overlapping_texture, the 13 render_fold lanes
at the non-split counts). Job 31176 compiled the --cfg m2v_gpu archive.
The 3090 tip and negative control and the 780M (31189) and the 5080 entry
are pending.
2026-11-14 20:36:13 -08:00
Anees Iqbal efe913c27a 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 20:32:03 -08:00
Anees Iqbal 51b19a5bb4 RUNTIME 2332: A pass's first instance records inline over a bound linear color, and snapshot readers inline after a split
A pass's first instance records inline over a bound linear color

On a device that renders a linear image only by VK_NV_linear_color_attachment's rule
(NVIDIA's), the guest surface is a bound linear color rendered in place, and
inline_first refused it (NotInline::Attachments): every such pass recorded its first
instance into a secondary, and its splits too. The 3090 walk's counts put about 52 of
its 88 secondaries a frame there.

The refusal guarded linear_attachment::settle, which may render the bound colors apart
as the pass ends where a later instance renders a color through a stand-in of another
format. That case already has its route for an inline first instance: the stand-in
arrives later, takes the attachment's texels right after the last inline instance and
is merged back (render.rs's stand_ins_after_first and kept_after_first, as for a
fetched attachment's scratch). Every color of an instance that opens inline is linear
and the pass has no depth or stencil attachment, since apart() renders the bound
colors apart from the open otherwise, through a stand-in inline_first refuses; and no
inline instance after a split takes a view of another format. So the first instance
renders the image in place under the extension's rule, and the refusal goes.

Tests:
- tests::bound_inline (new): with the rule forced, an R32Float target over a Shared
  buffer, a first draw inline in place, an RGBA8Unorm draw through a stand-in of that
  format, a third draw; counts one inline pass, no refusal for its attachments, one
  pass through copies, and the bytes equal a private texture's.
- runtime_lane::linear_attachments: the sampling and detach tests expect the pass
  inline by the rule too; the sampling test's instance after the split is inline but
  where the reader's snapshots lead it.

Verification: the jobs that compile and run it are reported with this sha.

Instances that read through snapshots record inline after a split too

A draw that reads its pass's texture through a snapshot inside its instance, or in place,
holds those colors in the feedback loop layout for the instance's render pass instance.
Inline splits refused such an instance (inline_splits.rs, `instance.feedback ==
Feedback::NONE`), so after an inline first instance every reader split the pass into a
secondary: its begin, end, execute and whole dynamic state recorded again, which the
inline route exists to remove.

An instance recorded inline after a split now takes them as the pass's end takes a
secondary's: a render pass of the instance's shape with those colors in that layout
(render_target::final_pass with its Feedback) and a framebuffer whose views of them carry
feedback loop usage, one Later per shape, feedback colors and arrivals; the moves from
GENERAL into the layout right before its begin and back right after its end
(render_target::moved_barriers), recorded by record_kept around it, and after the pass's
last inline instance as the pass ends it. The snapshot pairs' B1/B2 and the in-place
reader's barriers record with the kept draws as before (Pair, in the recordings). A later
reader of the same colors, or of some of them, records into such an instance rather than
splitting again (snapshot_apart), as it does into a secondary's. Leading snapshots stay
out: their instance records in a secondary. The commands, their order and the barriers
between instances are the end's; only SUBPASS_CONTENTS_INLINE in the pass's command
buffer replaces a secondary and its execute.

The guard of the previous commit, tests::bound_inline, expects on a device whose draws
read colors as input attachments (lavapipe) the end's existing refusal of a bound color
put apart while every color is taken, as before.

Verification: the jobs that compile and run it are reported with this sha.

Verified: job 31111 at 5a4df749ec: clippy -D warnings plain, under --cfg
m2v_gpu and --cfg m2v_cpu_icd; rustdoc -D warnings; the runtime suite on
lavapipe 2744/2744 (tests::bound_inline among them, its refusal branch
there); the render lanes on lavapipe 133/133. Lavapipe takes neither the
bound-linear apart case nor snapshots: the pixel proof and the A/B of
begins and secondaries a frame are the 5080 and Iris runs, pending.
2026-11-14 20:31:16 -08:00
Anees Iqbal 8e052df070 Re-bless the golden hash table at 716f48fde5
SEMANTICS 2121 (3625b90721, the unit-axes variant) changes the lowering of
engine/rfs_async_copy.ll's kernels rfs_async_copy_1, _2 and _4 on every
profile: new uniformity facts and lane-level uniformity in kernels walked
predicated. Their own engine tests passed (job 31118); only the table's
cells moved.

Verified: job 31152 (bless-job.sh at 716f48fde5): inventory=0, golden=0,
printouts=0; the patch touches golden_hashes.tsv alone (6 rows).
2026-11-14 20:27:58 -08:00
Anees Iqbal 716f48fde5 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 20:24:41 -08:00
Anees Iqbal 3625b90721 SEMANTICS 2121 / RUNTIME 2331: A kernel's unit-axes variant, taken once made, never waited for
A kernel's unit-axes variant: the translator and the binding plan

In a threadgroup of one thread along an axis (Metal's threads_per_threadgroup 1
there), every thread's thread_position_in_threadgroup on that axis is 0 and its
thread_position_in_grid is its threadgroup's position, partial threadgroups
included. A kernel whose emulated simdgroups are walked predicated only because
such a position steers a synchronization (a simdgroup sum in a loop whose trip
count reads gid.y, the shape of a depthwise convolution dispatched in 8x1x16
threadgroups) pays the predicated walk's live flags and votes for nothing.

- lower::simd::uniform tracks per-lane masks for vectors of up to 8 lanes, and
  takes the lanes of thread_position_in_threadgroup and thread_position_in_grid
  on the unit axes LoweringInputs::unit_axes names as uniform.
- A kernel walked predicated (divergent::barriers, workgroup::check) states
  RuntimeFact::UnitAxes { axes: 0, relief }: bit m-1 for each mask m of axes
  under which fewer of its synchronizing blocks stay divergent (one analysis
  for all three axes, then the six others only where that one relieves).
- VariantKey::unit_axes compiles the variant; its module states
  UnitAxes { axes, relief: 0 }.
- BindingPlan::unit_axes_variant offers the variant to a dispatch whose
  threadgroups have one thread along relieving axes, where the plan's own
  variant runs it; the variant's plan sends any other dispatch back
  (dispatch_variant, NeedsVariant).

SEMANTICS_VERSION 2121: a predicated kernel's artifact states a new fact.
No new Degradation kind.

Test: engine_simd_unit_axes (lavapipe's profile, CPU interpreter, 8/16/32
lanes): predicated without the variant, unpredicated with it, Metal's words
in both; the variant traps at two threads along y (Vulkan's barrier rule), unit
x relieves nothing, and a kernel steered by x is offered no variant for unit y.

The runtime takes a kernel's unit-axes variant once it is made, never waiting

A direct dispatch whose plan offers the unit-axes variant
(BindingPlan::unit_axes_variant) takes it only where its translation is
done and each of its regions' VkPipelines is made (pipeline/unit_axes.rs).
Otherwise it settles on its plain variant, which gives the same answers,
and the variant is begun: its translation as a piece on the pipeline pool,
kept by the state (piece_holds.rs), at the first such dispatch; its objects
and pipeline notices on the program's thread at the next (no piece announces
a notice), with its regions' makings handed to the pool as any dispatch's
are. Nothing waits for the translation or a making. A dispatch planned
meanwhile is kept neither in the state's latest plans nor in its encoder's
memo, so a later one asks again. A refused translation or a failed making is
remembered, the plain variant then running those dispatches; the state tracks
at most VARIANTS such variants at once, and they live among its VARIANTS
others.

The dispatch that begins it is recorded for a later process's warm pass,
which compiles the variant and makes its regions beside the plain variant's.

The one-row and emulated-simdgroups variants are still compiled on the
encoding thread when a dispatch first asks (ComputePipelineState::settle ->
variant -> Variant::compile); this path does not follow them.

WorkCounts: unit_axes_variants_begun, unit_axes_dispatches,
unit_axes_meanwhile. No new Degradation kind. docs/API.md section 3 and the
bind module's docs state the rule and the variant; api_signatures.tsv
blessed.

Test: tests::unit_axes (m2v_gpu / m2v_cpu_icd): a 16-thread threadgroup
kernel whose simdgroup sum sits in a loop steered by gid.y; 4x2x2 never begins
the variant; 8x1x2 begins it once, runs on the plain variant meanwhile, then
settles on it, Metal's words every time.

A unit-axes variant's objects are made under its state's lock of begun variants

Two dispatches of one state could both find a translated variant gone from
the begun set while the first made its objects, and the second begin its
translation again. The first now makes them under the lock, as variant()
compiles under the lock of the state's variants.

Public: RuntimeFact::UnitAxes { axes, relief }, VariantKey.unit_axes,
LoweringInputs.unit_axes, BindingPlan::unit_axes_variant; WorkCounts
unit_axes_variants_begun, unit_axes_dispatches, unit_axes_meanwhile. No new
Degradation kind.

Verified: job 31119 at 58f7ef3c21: workspace clippy under --cfg m2v_gpu,
metal2vulkan with no feature and each feature alone, rustdoc -D warnings.
Job 31118: metal2vulkan + runtime suites 5187/5188; the one failure is the
golden hash table (24 cells of rfs_async_copy_{1,2,4}, the expected
SEMANTICS change), re-blessed on development. Job 31098 at c7f44ff865: the
engine test tests::engine_simd_unit_axes and the runtime test
tests::unit_axes on lavapipe. Iris compile-only replay of a guest's records
(31117): one depthwise state takes the variant (driver estimate 2.47M ->
0.57M cycles, spills 179:340 -> 0); the GPU-time A/B is pending.
2026-11-14 20:23:55 -08:00
Anees Iqbal 11663c0238 Bench: walk_costs takes a consumer's device policy
walk_costs makes its device through the validation lanes' options, whose exact policy
(DevicePolicy::exact_answers) sets HostPageTexturePolicy::Shadow: no in-place check
runs, settle_in_place_checks answers false at once, and the target over host pages is a
shadow for good. The 5080 entry perdraw8-before (b582060860) printed "in-place checks
settled false, textures in place over host pages 0" with shadow_attachment_passes 107
and 221.9 M texels copied in a frame, where the consumer's surface is a linear image in
place. The device now takes the default policy, a consumer's, under which the check runs
and the surface renders in place where it passed.

Test-only (runtime_lane::walk_costs).
2026-11-14 20:13:35 -08:00
Anees Iqbal c450efd13e Bench: walk_costs encodes a compositor's frame of 107 render encoders a command buffer, its targets made once the in-place checks answered
Bench: walk_costs encodes a compositor's frame of 107 render encoders a command buffer

walk_costs_frame encodes walk_costs' encoders 107 to a command buffer, as many as a compositor's
desktop frame of the consumer's guest walks holds in one (its 3090 walk at pin 92), and commits it
with commit_and_submit as the consumer's encoding thread does: WALK-FRAME prints the medians of
the encoding thread's CPU a frame, a draw and an encoder, and of the commit, with the frame's
moved work counts. walk_costs_frame_profiled encodes 400 such frames for a profiler.

A measurement, ignored by default; not yet run.

Bench: walk_costs makes its targets once the device's in-place checks answered

walk_costs made its target over host pages right after the device opened, before the
device's in-place checks answered, so the texture took a shadow for good: on the RTX 5080 and on
lavapipe every over-pages frame copied the target in and merged it back each pass
(shadow_attachment_passes 107 a frame, 221 M texels copied in a frame on the 5080), where the
consumer's surface renders in place (on NVIDIA a linear image under
VK_NV_linear_color_attachment). The workload now settles the checks first, as compositor_costs
does, and walk_costs_frame's header prints whether they settled and the textures in place.

Test-only; not yet run.

Verified: job 31048 built the validation crate's lib tests in release under
--cfg m2v_gpu at b582060860; the bench ran on lavapipe (31010) and the 5080
(perdraw8-nvprof). Test-only.
2026-11-14 19:56:25 -08:00
Anees Iqbal 363cd92fd0 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 19:52:33 -08:00
Anees Iqbal ae18097da2 RUNTIME 2330: A render state that supports indirect command buffers begins the draw replay's kernels on the pool
The first frame of a rate-mapped pass whose execution the GPU route takes
spent 95 to 105 ms in its host step on the Iris Xe (job 30970, both sides),
against 12 to 16 ms when the host read the records (job 30850), the step
making no state's pipeline. The route's prework records the draw replay's
preprocess and a merged replay's two passes, the runtime's own kernels,
which a device builds at their first use: inside that step, its SPIR-V
build and three vkCreateComputePipelines calls.

Now the creation of a render pipeline state that supports indirect command
buffers, on a device that reaches buffers by device address, begins the
three on the device's pool, once per device
(Device::begin_draw_replay_kernels). The creation waits for none; a command
that asks for one while the pool builds it waits under the kernels' lock,
as for any kernel another thread builds. A command buffer's first commit
of an execution in its GPU form, which records the same prework, takes
them built too.

WorkCounts::host_step_owned_kernels_made counts the kernels a host step
built itself. The pieces lane prints it, the kernels built, the compute
pipelines' creation time and the state's creation time.

Test: a_gpu_route_s_host_step_builds_no_kernel (the step builds none of
them on the first frame or the second).

Verified: job 31036 at c095494483: clippy for metal2vulkan and the runtime,
the runtime under --cfg m2v_cpu_icd, the runtime and validation under
--cfg m2v_gpu; rustdoc -D warnings; API tests 15/15; the runtime suite on
lavapipe 2744/2744, a_gpu_route_s_host_step_builds_no_kernel among them. A
negative control (the begin call deleted) fails it: "the step built 3
kernels". Job 31038 compiled it in release under --cfg m2v_gpu. The Iris
cold-step A/B (31055) is pending.
2026-11-14 19:51:46 -08:00
Anees Iqbal 7624644602 owned_dot_fixtures_answer_metal decides denormals per kernel
The test asserted that each dot kernel requires
VkProperty::MetalFloatDenormals exactly where the profile takes
DriverDeviation::MetalFloatDenormals. Since SEMANTICS 2116 (497e1f4ec0)
an entry that declares the 16-bit float controls, on a driver whose
profile has DriverWorkaround::FloatDenormalsKeptUnderHalfControls (NVIDIA
on the RTX 3090 and the RTX 5080 Laptop GPU), requires no such property.
The stage records PrecisionNote::DeviceDenormals instead
(pipeline/compile.rs). The dot fixtures compute half lanes, so on the 5080
at pin 96 (b5080 devlegs-devlegs-96-p4) both kernels required no property
where the profile takes the deviation. The test then failed on the old
equality (left false, right true). It had passed there at 94, before the
workaround.

The test now asserts what fused_pairs_answer_metals_nans_and_denormals
asserts per kernel. A kernel requires the property only where the profile
takes the deviation. Where the profile takes it, a kernel that requires
none records DeviceDenormals. The dot, NativeDot and word checks are
unchanged. The printed line also gives the kernel's own answer.
2026-11-14 19:37:57 -08:00
Anees Iqbal d85d807392 render_fold's counts follow the device's split at aliases
On a device whose driver fact ImageUsesMissBufferWritesInOneCommandBuffer
holds (the RTX 3090, RUNTIME 2323), State::join_fold lets a render encoder
join no group whose earlier encoders wrote bytes. Every render_fold lane
opens with a compute encoder that writes the draw's colors, so at pin 96 on
the 3090 (m3-max-30795, 30796, 30797) 9 of the 13 tests failed on their
expected counts. Their texel and colour checks still passed. The counts
read: chain and worker (11, 7, 6) with 6 barriers, against (17, 1, 6);
late resolve (1, 2), against (2, 1); execution and pending (0, 3), against
(1, 2); failed_with (2, 3), against (3, 2); and the rebind folded 0 and
encoded 1 again.

Lane::joins_after_writes reads the device's rule. Each count now follows
it. Where a render encoder does not join, it begins a group of its own,
which the encoders after it join. A pass that leaves work for later leads
none, and only the copies record a barrier at their open. The failed and
checked commits encode again the members of the render encoder's own
group. The derived counts are each the one the 3090 printed where it
printed one. failed_with and the checked commit now print what they
encoded again. Every other assertion is unchanged.
2026-11-14 19:34:54 -08:00
Anees Iqbal 4d147c4d78 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 19:21:04 -08:00
Anees Iqbal e7b9c5bfdc RUNTIME 2329: A GPU route's commands are drawn one draw per command in the replay variant, indexed
The GPU route of a rate-mapped pass's host step drew each command's corners
in its merged variant: a non-indexed draw of every index, which loses the
indexed draw's vertex reuse and looks its command up per vertex. On the
Iris Xe the wide frame's pieces took 74.2 ms against 48.0 ms when the host
read the records (job 30850).

Now the step reads back each command's VkDrawIndirectCommand and its index
entry (the device address of its first index and its index size,
bind::DRAW_INDEX_ENTRY_BYTES, now public), resolves the index address to
its Metal address through the resident set's ranges and the live table's,
and draws each command as the host draws a record it read: indexed where it
is, with its instances, base vertex and base instance, in the state's
replay variant (BufferForms::Replay), each draw pushing the command's own
slot tables at its PushHole::RootTableAddress holes (CommandTables). The
commit's settle begins the replay variants for the routed executions. The
corner cutting in the piece loop goes: an indexed routed draw is cut into
index ranges as any.

Tests: the pixel and depth test asserts indexed draws are recorded on a
routed frame; the count test runs three frames, the host step making no
pipeline on any and nothing made at all on the second and third.

Public: bind::DRAW_INDEX_ENTRY_BYTES (api_signatures, api_surface).

Verified: job 30942 at the branch tip: clippy for metal2vulkan and the
runtime, the runtime under --cfg m2v_cpu_icd, the runtime and validation
under --cfg m2v_gpu; the two route tests on lavapipe. Job 30922: lavapipe
suites 78/78, API tests 15/15, rustdoc -D warnings; a negative control
(the change reverted but its tests) fails the pixel test with 0 indexed
draws recorded. The Iris and 3090 GPU-time A/Bs are pending.
2026-11-14 19:20:14 -08:00
Anees Iqbal 3db60efc33 Tests that make command queues on three or more threads at once take the queue plan
scheduler_wakes::commits_with_idle_gaps_lose_no_wake makes a command
queue on each of four threads, so three can be live at once; whether
they are depends on timing. The runtime tests' default queue limits
(two round-robin VkQueues) panic there. A lavapipe run of another lane
hit that panic, though this lane's 2740/2740 run at 06b5fe355e did not.

A scan of every spawned thread in the runtime's tests that makes a
command queue found two more of that class, both opt-in benchmarks
compiled only under m2v_gpu: host_ram_contended_fill_bench (CLIPS = 3
threads) and host_ram_block_release_bench (its first queue, the
compositor's and the releases' queue). The others keep at most two
live at once: command_counts, deferred_calls, freed_memory,
heap_set_unlocked, managed_copy_device, fill_waits_bench,
managed_copies_bench, memory_block_bench and memory_make_hold_bench.

They now take the plan (`queue_limits: None`). scheduler_wakes gains
plan_device over a device_of, as the other modules' helpers do.
2026-11-14 19:17:16 -08:00
Anees Iqbal 56ae450542 Test: the quiet compositor's first long one outlasts its expected run
a_quiet_unshared_queue_s_first_command_buffer_waits_behind_the_idle_budget_and_one_batch
failed on lavapipe inside a whole suite's run (pin 96). All five runs let
the second long command buffer go only once the first had ended. Each run
of the same work varied several-fold under load (23.7 to 170.5 ms), while
the queue's expected run (raised at once by a longer run, halved toward a
shorter one) stayed at 63.8 to 217.3 ms. So the 16 ms idle budget
(expected end less 16 ms) never came due before the first's own
completion let the second go.

Under Compositor::Quiet, the run now sets the expected run just before:
- twelve small fills run alone bring any longer run down to a 4096th of
  its excess;
- the warm long one then sets the expected run to its own run;
- the first of the three does three times that work, so it runs past its
  expected end unless the host gets that much faster between the two.
The assertions are unchanged. Compositor::Active and the late-pass test
are as before.

Also in this landing: 3ef078853e Test: the Scheduled test picks the run whose later one read Scheduled soonest.

Proof (m3-max-30924 at 3ef078853e, lavapipe): clippy cpuicd 0; held_step_order, the quiet test and all 20
queue_share_device tests pass. Test-only: no RUNTIME bump.
2026-11-14 19:12:06 -08:00
Anees Iqbal d6db2e4ba6 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 19:02:30 -08:00
Anees Iqbal d62ca65f36 RUNTIME 2328: Scheduled behind a host step waiting at its gate
A command buffer whose remaining batches wait only for its queue's host
step behind work already submitted now reads Scheduled at once, as Metal's
does once its dependencies are resolved, instead of with its last batch
once that work ended (50-90 ms late behind an 89 ms pass on an RTX 3090).

The precedent is hang.rs, whose thread makes the command buffers committed
behind a GPU hang Scheduled early (Scheduling::Behind). The scheduler now
does the same at a look that finds a line's head waiting at its gate
(schedule_behind_steps). It walks the line from the head
(Order::leading_mut), and each batch must wait for nothing else: the head
for its step alone; each later one for no host step, check, decode, rebind
or binary semaphore, with its event values reached, and committed after no
other line's batch. At each command buffer's last batch it calls
CommandBufferShared::schedule_early:
- hang_scheduling becomes Scheduling::Early;
- the kernel end is set now, and the start where no batch began;
- the transition is posted;
- the submission handlers run in that pass's turn.

Not made early: one whose queue has a hang in flight or holding, one with
a storage-form switch riding on it, one already failed, and nothing at all
while a group holds a storage-form command buffer's last batch. Batches
submitted later leave the submitting flag as the early pass set it
(hang::scheduled_early). WorkCounts::scheduled_behind_host_steps counts
these command buffers. It is reported, never gated, in the conformance
cost (a LOOKS count).

held_step_order's (b) test used the long command buffer's kernel end as
the pass's submission time, and that end is now early. It reads the long
work's GPU end instead.

New test command_buffers_behind_a_waiting_step_read_scheduled: the long
command buffer, and a follower with a submission handler on its queue,
read Scheduled within 10 ms of commit while the step waits. The handler
runs first, the counter moves by 2, and the follower's times stay in
life order.

Proof (m3-max-30907, lavapipe): command_buffers_behind_a_waiting_step_read_scheduled passes; 249/250 touched tests
(the one failure is scheduler_wakes under the test queue limits of 58de9ba9a1, not this change). Negative control
(m3-max-30908, schedule_behind_steps disabled): the long one reads Scheduled 118-162 ms after commit and the new test fails.
2026-11-14 19:01:45 -08:00
Anees Iqbal fd25445219 SEMANTICS 2120: a draw replay's variant of one draw per command takes region copies and region viewports
The rate map's region-copy and region-viewport inputs refused a vertex function
compiled under replay_bindings without merged_draws: at commit, the GPU form
draws one vkCmdDrawIndirect per command, which no multi-draw of regions can
expand. A host step that has decoded each command's draw on the GPU
(render/executions/gpu_route.rs) records direct draws, so the variant can take
both. Its vertex function reads its command's buffers through the slot table at
its RootTableAddress push, and its draws' indices are their own, as an
encoder's draw's are.

The refusal goes from plan.rs's region_copy and region_viewport. Their docs and
LoweringInputs' are updated.

Test: tests::engine_region_fan_out::a_replay_variant_fans_out, the merged test's
twin over replay_bindings alone (Draw, Probe, DrawFew, RegionCopies, and region
viewports) on lavapipe, the Iris Xe and Pascal descriptions: compiled, L3-valid,
ReplayBindings stated, MergedDraws not, RootTableAddress pushed, settling on its
own key.
2026-11-14 18:49:22 -08:00
Anees Iqbal bd9128e6a3 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 18:38:48 -08:00
Anees Iqbal a9d8a3274c RUNTIME 2327: A GPU route's merged variants are begun at commit, not made at the host step
The host step of a rate-mapped pass draws an execution its GPU route takes
(render/executions/gpu_route.rs) in the merged form, its probe and fan-out
included, but commit's settle (DeferredPass::settle) began only the
large-buffer form's pipelines. So the step made the merged variants' VkPipelines
itself, a hitch on the first frame. On the Iris Xe (Mesa 26.2.6, m3-max-30850,
rate_mapped_pieces_host_step_inherited and its _wide twin), the host step was
137 ms and 170 ms cold, against 12 to 16 ms before the route ("2 (4) pipelines
made there").

The settle now finds the executions the route takes (DeferredPass::route_forms,
the route's own decision, which the step's gpu_routes now calls too) and
settles their draws in BufferForms::Merged, lists alone, with the probe's and
the fan-out's variants. The other executions stay in the large-buffer form.

Test: tests::rate_mapped_gpu_route::a_gpu_route_s_host_step_makes_no_pipeline,
over two frames: the execution is routed where the device fans out, and the
host step makes no pipeline (host_step_pipelines_made 0).

RUNTIME 2327: an unchanged artifact's routed execution no longer makes its merged variants at the host step.
Proof (m3-max-30873): a_gpu_route_s_host_step_makes_no_pipeline (first frame 0 made, second 0); 78/78 lavapipe; clippy
plain + cpuicd 0. Negative control (settle back to BufferForms::Large): first frame makes 4.
2026-11-14 18:38:04 -08:00
Anees Iqbal 90d023e344 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 18:36:04 -08:00
Anees Iqbal a7e519150b RUNTIME 2326: Scheduler: a host step held at its gate gives way but to writers of its reads
What: a batch held for its host step, once the step took its gate, kept its
place in the order across queues, so every later commit of any queue whose
footprint conflicted with it waited host-side until the GPU work before the
step completed and the step recorded. A step whose uses commit could not
bound (shadowed textures, tile memory, a visibility query, an inherited
function table) conflicts with every batch that makes a tracked use, so it
held every queue, the compositor's unshared queues included. On an RTX 3090
a rate-mapped pass executing a GPU-written indirect command buffer held every
queue's commits for the 89 ms pass before it in its command buffer.

Now such a batch gives way, as it already did before its gate (the x86 Macs
take a later commit of another queue first; the M3 keeps commit order), but
for a later commit that writes what the step reads on the host (its
executions' records and ranges), which the gate does not cover, or that
shares a fence with it. The batches after it on its line give way with it.
A step whose host reads are not known (staged gathers and scatters, indirect
dispatches, loop checks, predicated executions, indirect sparse updates)
keeps its place from its gate on, as before.

How: Held keeps the step's host reads as a footprint when the gate is taken
(CommandBufferShared::step_host_reads, step_reads without the bounded-uses
requirement; Footprint::of_uses); place_of answers GivesWay for it; the
order's comparison for a batch that gives way checks fences and, for such a
step, a later write of its reads. Order itself is unchanged. Docs: the
scheduler's and order.rs's rules, gate_of, WorkCounts, and the
host-replayed-indirect-commands notice (degradation.rs, docs/API.md).

Verified: tests::held_step_order on lavapipe, three legs (results in the
report): an unshared queue's fill while the pass waits at its gate, the pass
bounded and not, goes with no look held behind it; a reset of the records the
step reads still waits behind the pass's batch. Before this change the
unbounded leg's fill went 111.40 ms after its commit, 0.2 ms before the pass
(m3-max-30848 at cd77de72d8, 3 looks held).

Also in this landing: cd77de72d8 Test: an unshared queue's fill waits for no other queue's host step.

RUNTIME 2326: an unchanged artifact's later commits on other queues no longer wait behind a host step held at its gate.
Proof (m3-max-30854, lavapipe): held_step_order's unknown-uses leg 0.17 ms after commit, 0 looks held (base 111.40 ms,
3 held); a reset of the step's records still waits. Negative control m3-max-30866 (the old gate condition): that leg
fails, 125.03 ms, 4 looks held.
2026-11-14 18:35:15 -08:00
Anees Iqbal 06b5fe355e rate_mapped_pieces: a host-step frame of commands that inherit the pipeline state
The lane's commands each set their own pipeline state, so the host step reads
every record and the GPU route (render/executions/gpu_route.rs) never runs
there. Two frames now execute commands that inherit the encoder's state
(rate_mapped_pieces_host_step_inherited and its _wide twin): the execution
takes the GPU form but for the rate map, so a fanning-out host step decodes the
records on the GPU. Each line also states the records the host read
(indirect_records_read), the executions routed on the GPU
(rate_map_gpu_routes), the host's wait for their decode
(rate_map_gpu_route_wait_nanos), and the GPU's idle time within the command
buffer (its GPU time less its pieces' and its probes'). Where the frame fans
out, the inherited frames assert no record read, one execution routed and its
wait counted.

The workload of the GPU-time A/B of the route on the Iris Xe and the RTX 3090.
Verified: cargo fmt only so far; the build job follows.
2026-11-14 18:26:06 -08:00
Anees Iqbal 83c4b135c8 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 18:25:12 -08:00
Anees Iqbal 58de9ba9a1 The runtime's own device tests take four VkQueues by default, not the plan's 18
What: in the runtime crate's test build, DeviceOptions::default() carries queue limits of a round
robin of two VkQueues and none for presenting (TEST_QUEUE_LIMITS), beside the staging and fill
queues: four on NVIDIA's families, where the queue plan takes 18. Outside the crate's own tests the
default is unchanged (None, the plan), and on RADV's and lavapipe's one graphics queue the limits
leave the plan as it is. DeviceOptions' Default is now written out (every field named) so that its
queue_limits can be the test default there; the API signature table is re-blessed for the derive
moving to an impl, which changes nothing for a consumer.

A test whose work needs more than the default gives on a device with queues to spare (the
program's third command queue, unshared or not; a presenting queue; reserved or extra queues; a
read of the queue sharing) panics where it asks for it, on every device, and makes its device with
`queue_limits: None`: the runtime lane's LANE_QUEUE_LIMITS rule, whose failure is the device's
metal2vulkan-queue-limits-reached and so is said only on a device with queues to spare. Here the
check reads no plan, so a lavapipe run finds every such test. least_queue_plan and many_devices
measure the plan and take it.

Why: NVIDIA's driver makes and destroys one device at a time across processes, and each VkQueue
adds to both. Measured on the RTX 3090 (620.70.06, a probe build that timed each phase of a
device's opening and teardown, m3-max-30672): alone, vkCreateDevice took 540-575 ms and
vkDestroyDevice 163 ms of a device test's 1.17 s (priming 129-142 ms, loader and instance 93 ms,
the runtime's own phases under 25 ms); at 12 threads 55 device tests took 66.9 s, 1.2 s each, no
less than one at a time, their vkCreateDevice a median of 8.1 s and vkDestroyDevice 2.8 s. On the
RTX 5080 Laptop GPU a device of 2 queues took 145 ms against 445 ms with 17
(DeviceOptions::queue_limits' measurement).

Verified: tests::queue_limits::the_tests_default_devices_take_four_of_nvidia_s_eighteen_queues
(no device: NVIDIA's families give 4 VkQueues under the default, 18 at the plan; fails without the
change, whose default is the plan) and
tests::queue_limits_device::a_default_test_device_fails_where_its_work_needs_the_plan (on the
device the cfg selects: the third command queue, an unshared one past it, a presenting queue, a
read of the queue sharing and a reserved queue each panic under the default, and a plan device
makes each).

Also in this landing (the lane's later commits):
- 1edf6b494a The runtime tests' default queue limits fail a test by its live command queues, not its made ones
- 9a2bfa7bc5 Tests that ask for reserved or extra queues take the queue plan
- b9e7cd775b Tests that keep more than two command queues live take the queue plan

Proof (m3-max-30836 at b9e7cd775b): clippy plain and cpuicd 0; the no-device tests 33/33
(the_tests_default_devices_take_four_of_nvidia_s_eighteen_queues: 4 of 18 placed); lavapipe runtime
suite 2732/2732. Negative control m3-max-30752 (default_queue_limits returns None): fails at the 4-of-18
assert. No RUNTIME bump: the product default is unchanged.
2026-11-14 18:24:24 -08:00
Anees Iqbal 5fba5455a5 heap_trimmed's kernel takes 320,000 steps with 64 values live
The test's kernel of 150,000 fused multiply-adds with 600 values live did not
finish its making within the test's wait on an RTX 3090 (NVIDIA 620.70.06),
alone on its node (m3-max-30563: TimedOut at the first dispatch, the making
still in the driver past 117 s). The 5080's 615 driver had made it in 13 s.

A probe on the 3090 (m3-max-30699, one process making one size after another)
showed the compile time growing faster than the steps with 600 live (40,000:
8.3 s; 80,000: 27.5 s), and the free heap a making leaves growing about 1.25 KB
a step with 64 live, at about 30 us a step (80,000 steps: 2.4 s). The trim
needs more than FREE_FLOOR (256 MiB) free after a large making. 320,000 steps
with 64 live frees about 400 MB by that slope, at about 10 s.

The test's claim and its assertions are unchanged. The module docs give the
measurement behind the size.

Verified: cargo fmt. The proof is the test itself, in a fresh process on the
3090 and um870's 780M, in one exclusive job.
2026-11-14 18:09:28 -08:00
Anees Iqbal ff68ba6764 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 18:03:47 -08:00
Anees Iqbal b585744208 Boxed draws: the constant's numbers count the three draws the patches frame still fanned out
GEOMETRY_TRIANGLE_WORK's doc (5983bb3e72) split the patches frame's boxed piece
time as if the 3 draws still fanned out held 3/64 of its triangles. By the
lane's layout they are its three largest commands (161,820 and twice 89,184
indices, boxes of 110, 99 and 72 regions), 112,356 of its 301,150 triangles; a
simulation of its patches, map and bucket rule boxes the same 61 at 180, into
14,816,646 vertex-regions against the 15,286,908 counted. With their fan-out
taken out, a boxed vertex-region cost 0.49 / 0.48 ns on the Iris Xe, 0.73 ns on
the Radeon 780M and 0.13 ns on the RTX 3090, so a fanned-out triangle's geometry
stage is worth 31 / 32, 29 and 72 of them, not 26, 25 and 49. The boxed draws
held about 84 vertex-regions a triangle and took about 2.5, 2.8 and 1.1 times
their fan-out, as those ratios predict (2.7, 2.9, 1.2).

The constant stays 24, below the least (29.4): a draw it boxes costs at most
about 0.82 of its fan-out on each of the three. The doc, docs/FAST-PATHS.md's
row and the two tests' docs carry the corrected numbers; tests::rate_mapped_boxed_rule
checks the boxed draws' own average (9285 indices, 27 regions a box), fanned out
at 24 and boxed at 180.

Verified: arithmetic from m3-max-30553/30686/30687's warm pieces; the rule test
and clippy in the job that follows this commit.
2026-11-14 18:02:57 -08:00
Anees Iqbal 8c5d761673 Re-bless the authored compile census at pin 96
The census at 9303a1f03f (M3 job m3-max-30743, corpus-triage --audit
authored-compile --bless) moves only the artifacts_at product hash: no
case's artifact changed. The engine goldens' bless (m3-max-30742) left
no patch.
2026-11-14 17:51:24 -08:00
Anees Iqbal 9303a1f03f 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 17:43:09 -08:00
Anees Iqbal 34036eed94 alias_split: note a key's write without borrowing the list twice 2026-11-14 17:42:23 -08:00
Anees Iqbal 123f2fc7e7 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 17:41:28 -08:00
Anees Iqbal f40cc8595b RUNTIME 2325: A rate-mapped pass's host step decodes GPU-written records on the GPU (its GPU route)
A render pass over a rasterization-rate map that executes an indirect command buffer the GPU
may write goes to the host step. There the host read every record, decoded it and drew each
command through the probe and the fan-out routes. On the consumer's RTX 3090 that step took
44.7 ms of a 65.8 ms frame, reading 781 records a frame. The only rule its executions broke was
the rate map's.

At a host step that fans the pass's triangles out, an execution whose records the GPU may write,
and which takes its merged GPU form once the rate map's rule is passed over (the cause.rs
decision), now takes its GPU route (render/executions/gpu_route.rs):
- The step records the form's prework: the head, the preprocess and the two merge passes. It
  copies each command's first corner and the merged draw's two VkDrawIndirectCommands to the
  host, submits that with a fence and waits, as it does for its probe.
- The host reads those words and no record. Each command that draws becomes one direct draw of
  its corners in the state's merged variant, with the merged header pushed
  (RenderLowering::merged_header).
- The probe and the routes take those draws as they take commands the host read: probed, then
  fanned out, boxed, in parts or region by region. A long corner draw is cut into piece-sized
  ranges, as an indexed command is.
- The host reads the records as before where the total reaches MERGED_CHUNK corners, where the
  prefix does not rise to the total, or where the prework did not complete.

RenderExecution::record_gpu's prework moves into RenderExecution::prework, which both paths
share. The replay loop takes a GPU route's corners beside the records the host read (Replayed,
StepCommand). The new counters are WorkCounts::rate_map_gpu_routes and
rate_map_gpu_route_wait_nanos.

Tests:
- New, tests::rate_mapped_gpu_route. Eight commands of a buffer that inherits the encoder's
  pipeline state: grids, one in two instances, one without indices, and the large, medium and
  wide triangles the probe flags. Each command is nearer than the one before, under LessEqual
  depth and half-alpha blending. It asserts no record read, one route, one probe and three
  flagged draws, and that the colour and Depth32Float bytes equal the encoder's own draws.
- Changed, tests::host_step_rules. Its empty command, through the route, counts as
  nothing_to_probe.

Also in this landing (the lane's later commits):
- d2728b735e: the step's commands are one vector of reads or of corners (no per-command enum of 3.3 KB); clippy.
- 51afad9359: HostReplayedIndirectCommands' cost names the GPU route's second round trip (the notice's text changes).

RUNTIME 2325: an unchanged artifact's rate-mapped host step now decodes GPU-written records on the GPU, and the
notice's text changes. Negative controls (m3-max-30703): the plan.rs lifts reverted fail
a_merged_draw_s_variant_fans_out (NotImplemented(RasterizationRateMap)); the route turned off fails
rate_mapped_gpu_route's counts ([8, 0, 1, 3] against [0, 1, 1, 3]).
2026-11-14 17:40:26 -08:00
Anees Iqbal 7222b5cb82 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 17:38:46 -08:00
Anees Iqbal 5983bb3e72 RUNTIME 2324: Boxed draws: a fanned-out triangle's geometry stage is worth 24 vertex-regions, not 180
The boxing rule (RUNTIME 2318) took GEOMETRY_TRIANGLE_WORK = 180 from the pieces
lane's bands frame, whose 22-by-10-pixel triangles cost 132 ns each fanned out on
an Iris Xe: mostly their fragments, which every route shades, not the geometry
stage boxing saves. Its 61 boxes on the patches frame (2-pixel quads, about 18
regions a box) lost on every device measured, the pass's warm piece:
  Iris Xe (Mesa 26.2.6)    4.64 ms fanned, 9.21 / 9.06 ms boxed  (m3-max-30553)
  Radeon 780M (Mesa)       6.47 / 6.46 ms, 13.57 / 13.57 ms      (m3-max-30687)
  RTX 3090 (620.70.06)     2.80 / 2.77 ms, 3.01 / 3.00 ms        (m3-max-30686)
On that frame, whose fragments cost little, a fanned-out triangle cost 15.4,
21.5 and 9.3 ns, a boxed vertex-region 0.59, 0.87 and 0.19 ns: 26, 25 and 49
units. The constant is the least, 24.7, rounded down, so a draw it boxes costs
no more than its fan-out on each of the three; a lower constant only boxes
fewer draws than 180 did. The doc and docs/FAST-PATHS.md's row carry the numbers.

tests::rate_mapped_boxed_draws: the 120-by-40 strip across ten regions (50
units a triangle, the patches frame's boxes about 55) is now fanned out, and a
patch across four regions' corner is boxed in its place, so the test still
boxes a draw across region borders: counts [1, 0, 3, 4, 4]. At 180 the strip is
boxed and the counts fail. tests::rate_mapped_boxed_rule checks the rule on the
patches frame's average draw: 18 regions fanned out, 4 boxed. The lane's patches
frame no longer asserts that it boxes a draw.

RUNTIME 2324: an unchanged artifact's rate-mapped draw that boxed at 180 fans out at 24.
2026-11-14 17:37:51 -08:00
Anees Iqbal 84dd5beebe 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 17:36:56 -08:00
Anees Iqbal acd25fd445 RUNTIME 2323: NVIDIA's RTX 3090 image uses miss a buffer's write in the same VkCommandBuffer: such a use goes in a new one
runtime_lane::heap_textures::a_buffer_write_shows_in_an_overlapping_texture,
a_heap_texture_metal_compresses_keeps_the_driver_s_compression_by_default and
an_adopted_device_stating_host_image_copy_aliases_its_heap_textures failed on the RTX 3090
(NVIDIA 620.70.06) at pins 93b and 94 (m3-max-30259, 30260, 30491, 30492): a Shared heap's
64x64 RGBA8Unorm texture, a linear image in the heap's memory, read all 4096 texels as they were
after a copy into a buffer over the same bytes. The encoder trail (each encoder its own
submission) passed at the same archive (30469), and so did the trail half of 30552 at
c6a823ff13, whose folded half failed.

A scratch probe (not landed) ran the copy and the read four ways on the 3090 (m3-max-30571):
in two blit encoders (folded into one VkCommandBuffer) and in one blit encoder, a global
TRANSFER_WRITE -> TRANSFER_READ barrier between them, 4096 of 4096 texels left alone three times
each; in two VkCommandBuffers of one submission (an MTLFence keeping the encoders apart) or two
command buffers, none. 1024x1024 and 16x16 (a Tiled shadow read through buffers) left none in any
form. Vulkan defines the answer (a buffer and a linear GENERAL image over the same memory are
host-accessible aliases, ordered by a memory dependency), so it is the driver's defect, shown by
blit folding (RUNTIME 2293) and present before it in one blit encoder. NVIDIA's 615.71.09 on the
RTX 5080 Laptop GPU answered every form right (b5080 batch m3-max-30599), so it is not listed.

Now:
- DriverFact::ImageUsesMissBufferWritesInOneCommandBuffer, one MEASURED row: NVIDIA on the
  RTX 3090, its measurement in the module docs, the reverse direction named unmeasured.
- On a device with it (DeviceShared::splits_at_aliases), an encoder notes the bytes its commands
  write into its current VkCommandBuffer (alias_split.rs, at most 32 keys apart, a key's
  writes joined), an encoder that joined a group starting from the group's FoldOrder byte
  writes. A command through command_observing whose uses name an image of a key whose noted
  bytes meet the image's place (UseRange::shares_memory) ends the VkCommandBuffer and goes on in
  a new one, its barrier first; a folded encoder so goes on in its own after the group's tail,
  which its part's submission orders after the group's first part, the measured fence form. A
  render encoder joins no group whose order wrote bytes there. Counted:
  WorkCounts::command_buffers_split_at_aliases. Elsewhere nothing is noted.
- heap_textures' alias round trip also copies and reads in one blit encoder, and the alias test
  asserts the split count is nonzero exactly where the fact holds.
- tests::alias_split (any host): the measured shape meets; a place apart, another key, a buffer
  read, a write through an image and a new VkCommandBuffer do not; a joining encoder meets the
  group's write; past 32 keys every image use meets; only the fact's devices split. And
  device::tests::driver_facts: the 3090 takes the row at every release, the 5080 Laptop and
  desktop do not.

No new Degradation kind or notice: the split is exact. RUNTIME 2323: on the 3090 an unchanged artifact's command buffer now splits where it did not.
Verification: the msi check job and one 3090 rerun, reported with the landing.
2026-11-14 17:36:04 -08:00
Anees Iqbal a02b41dfc4 The placing-wait device test drops the buffer on a runtime thread while the placing is held
The landed test (7765813cb4) let go of the indirect command buffer through a
command buffer's completion and expected its home's drop to wait for an unseen
placing submission. On the RTX 3090 (m3-max-30646) the completion let go of the
buffer last (1 completed where seen), but 0 drops waited: by the drop, a poll of
the staging queue had already seen the placing submission complete, so the drop
made no driver call. The test passed on the device for a reason other than its
claim, and failed its assertion there.

The test now places the records through a command buffer it never commits, so
only the program holds the buffer, and moves the buffer's last hold to a thread
of the runtime's (exit_guard::spawn), which drops it while the placing
submission is still held on the GPU (Device::hold_staging_submissions). The test
signals the hold only after that thread starts. The host cannot have seen the
submission complete before the drop, whatever polls the staging queue. It
asserts that the records were placed with no hold left, and that exactly one
drop on a runtime thread waited for the unseen placing submission.

Verified: cargo fmt. The device runs and the negative control (the same test
without Home::drop's section) are reported with the landing.
2026-11-14 17:25:49 -08:00
Anees Iqbal d32c12af29 Re-bless the engine goldens and the authored compile census at ebfd1b311d
The engine goldens' bless (M3 job m3-max-30664) moves the hashes of 19
rows: the indirect command buffer encode shaders (icb_copy_encode,
icb_inherited_dispatches, icb_mesh_encode, icb_replay_encode,
icb_reset_encode, icb_routed_writes) and mesh_commands, in both their
.ll and .air.ll forms, plus the profile row. The census (m3-max-30665,
corpus-triage --audit authored-compile --bless) moves the product hash
and, in 228 rows, two variant artifacts' hashes; no row gains or loses
an artifact. Both ran at development's tip after SEMANTICS 2117-2119.
2026-11-14 17:22:25 -08:00
Anees Iqbal ebfd1b311d SEMANTICS 2119: A merged draw replay's vertex function draws regions several at a time
A rate-mapped pass draws its draws region by region through a multi-draw, each region's
viewport at the draw's index (VariantKey::region_viewports). A merged draw replay's vertex
function now takes that variant too. Its corner is its VertexIndex and InstanceIndex's, which
each draw of a multi-draw gives from its own first vertex. Its viewport is its DrawIndex's, which
the merged read does not touch. Only a replay of one draw per command (replay_bindings without
merged_draws) is still NotImplemented(RasterizationRateMap). A host step that draws a
GPU-decoded merged replay's commands region by region needs this, as it needs the region
copies (SEMANTICS 2118).

tests::engine_region_fan_out::a_merged_draw_s_variant_fans_out now also compiles the merged
region-viewports variant on lavapipe, the Iris Xe and the Pascal. It checks L3 on every module,
both facts stated, the viewport index stored, and the plan settling on itself.
2026-11-14 17:15:37 -08:00
Anees Iqbal 47100120d1 SEMANTICS 2118: A merged draw replay's vertex function takes region copies
A rate-mapped pass draws a merged draw replay (VariantKey::merged_draws) through region copies
as it draws an encoder's draw: the region-copy vertex function's corner is its VertexIndex and
InstanceIndex's, which a multi-draw's draws each give from their own first vertex, and its region
its DrawIndex's, neither of which the merged read moves. Only a replay of one draw per command
(replay_bindings without merged_draws) stays NotImplemented(RasterizationRateMap). This is the
translator half of drawing a GPU-written render ICB's merged replay in a rate-mapped pass on the
GPU.

tests::engine_region_fan_out::a_merged_draw_s_variant_fans_out compiles the merged variant in
each fan-out mode on lavapipe, the Iris Xe and the Pascal: L3 on every module, the header's
address pushed, the region box pushed by a region-copy variant, and the plan settling on itself.
2026-11-14 17:12:05 -08:00
Anees Iqbal 5a619026c0 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 17:09:01 -08:00
Anees Iqbal c42dbfa163 RUNTIME 2322: Host RAM copies: one dispatch for up to 30 imports, through a descriptor array
What: a copy of word runs between a guest RAM and a buffer recorded one dispatch of the pages
copy per import its runs touch (and per window of the buffer), each binding that one import.
Where a RAM's chunks are 64 MiB pointer imports (NVIDIA, lavapipe: no listed plan), a surface
whose guest pages lie across an 8 GiB RAM touched ~35 chunks, so ~35 dispatches a copy (the
consumer's walk: 55,778 dispatches for 1,574 copies on an RTX 3090, ~35 on an RTX 2080, 1.2 on
RADV, whose copies go through run lists of their own pages).

How: `bind::pages_copy_module`'s scattered binding is now a descriptor array of
`PagesCopyModule::imports(device)` storage buffers, and each table entry (now four words) names
its run's element. The element is read once per workgroup from the workgroup's entry, so it is
dynamically uniform within the invocation group (Vulkan: for shaders with workgroups the
workgroup is the invocation group), which `shaderStorageBufferArrayDynamicIndexing` allows; the
module declares StorageBufferArrayDynamicIndexing and requires that feature where the array holds
more than one, and needs no NonUniform. `imports` is 1 where the device does not enable the
feature (the array indexed by the constant 0), else the room the device's
maxPerStageDescriptorStorageBuffers, maxDescriptorSetStorageBuffers, maxPerStageResources and,
with push descriptors, maxPushDescriptors leave beside the two other bindings, at most 30 (so a
push set holds at most 32 descriptors, maxPushDescriptors' minimum). The runtime's owned kernels
take a first storage-buffer binding of several descriptors (layout count, pool needs, pushed and
allocated writes by binding and element); `plan` groups the runs by `slot / array` and window;
each dispatch binds its group's imports, the elements past them its first import again, so every
descriptor is valid without partiallyBound.

Expected: n chunks touched -> ceil(n / 30) dispatches on every device here (maxPushDescriptors
is 32 on NVIDIA, RADV and lavapipe), ~35 -> 2.

Tests: the device tests' counts over two chunks are now `dispatches_over(device, 2)` (1 where the
array holds more than one; they said 2 before); `plan` unit tests for arrays of one, two and an
import past an array; the pages copy module's interpreter test of one dispatch over three
elements both ways, and its validity on every committed profile at the profile's array length
and at one, the dynamic-indexing feature required exactly where the array holds more than one.

Verified (lane hostcopy, msi, at a9a2aba8de; the two later commits only rename one device
test): lavapipe host_ram + owned_pushes suites (--cfg m2v_cpu_icd) 92/92 (m3-max-30625),
the 3 count tests expecting 1 dispatch over 2 imports among them; hand negative control
steelbrain/hostcopy-control (m3-max-30626) fails exactly those 3 on the count (2 vs 1);
clippy -D warnings plain (m3-max-30622) 0; translator bind::pages_copy tests 6/6;
api-signatures --check 0. The 3090 release bench follows on development.
RUNTIME 2322: what a host-RAM copy records changes (one dispatch for up to K imports).
Public API: bind::pages_copy entry() takes the import index and returns [u8; 16],
ENTRY_WORDS 3 -> 4, new PagesCopyModule::imports(&Device). No Degradation kind or WorkCounts field.
2026-11-14 17:08:10 -08:00
Anees Iqbal 4ba0b1ecc4 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 17:07:13 -08:00
Anees Iqbal 7765813cb4 RUNTIME 2321: An indirect command buffer's home waits for its placing inside an exit-guard section
Home::drop waits on the host for the staging submission that placed the records in
device-local memory. The drop runs wherever the buffer's last hold lets go, and
that can be a command buffer's completion on its queue's waiter or a handler
thread. When the host had not seen the placing submission complete, the wait's
vkWaitSemaphores ran there outside any section. In debug builds exit_guard::check
ends the process at such a call: the XTX abort of
runtime_lane::resource_ids::an_indirect_command_buffer_s_id_is_held_as_metal_holds_it
at pin 94 (queue-wait-0, complete_rest's drop of the residency).

The wait now runs inside a section, as texture/staging_copy.rs's Flushed::drop
does. While the process exits no section starts: the drop returns without
waiting, and the records' buffer stays to the end, as release.rs leaves every
object then. exit_guard::check is unchanged. vkWaitSemaphores is already in the
sections' call table.

Verified: cargo fmt. The device runs of the previous commit's test are reported
with the landing.

Test: Device test: a command buffer's completion that lets go of an indirect command buffer last waits for its placing.
On a device that places indirect command buffer records in device-local memory, a
buffer the program lets go of while a command buffer that uses it is in flight goes
as that command buffer completes, on a queue's waiter or a handler thread. Its
home's drop then waits for the staging submission that placed the records. When the
host has not seen that submission complete, the wait calls vkWaitSemaphores, which
the exit guard requires to run inside a section on the runtime's threads.

The test holds the staging submissions on a test timeline
(Device::hold_staging_submissions), places a Private buffer's records through a
compute encoder's useResource, commits, lets go of the buffer, then signals the
timeline. The command buffer completes only after the placing submission, and
nothing waits for it on the host before the drop. A test-only count in Home::drop
(RUNTIME_PLACING_WAITS) records a wait for an unseen placing submission on a
runtime thread, so a pass on a placing device is not vacuous. A device that keeps
records in the host's memory says so and passes.

This commit has the test alone. On a placing device, without the section the next
commit adds, the drop's call ends the process (exit_guard::check): the XTX abort of
runtime_lane::resource_ids::an_indirect_command_buffer_s_id_is_held_as_metal_holds_it
at pin 94.

Why: on the RX 7900 XTX at pin 94 (m3-max-30428), runtime_lane::resource_ids::an_indirect_command_buffer_s_id_is_held_as_metal_holds_it
aborted in a debug build: "the runtime's thread metal2vulkan-queue-wait-0 reached the device outside an
exit-guard section". The queue waiter's completion dropped the last Arc of an indirect command buffer, and
Home::drop's wait for the staging submission that placed the records (vkWaitSemaphores) ran with no section.

Verified (lane devlegs, msi m3-max-30615): clippy -D warnings, runtime crate, plain and --cfg m2v_gpu 0;
the m2v_gpu archive at the fix built. Landed (main) at once: the 5080 negative control (test without the
fix aborts, with it passes) and the 3090 run follow on development.
RUNTIME 2321: an exiting process's last drop no longer waits for a placing it cannot guard.
2026-11-14 17:06:15 -08:00
Anees Iqbal 12ae9f668b 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 17:05:06 -08:00
Anees Iqbal 7c223b02e4 RUNTIME 2320: A host step's notice names every GPU-form rule its pass breaks; rate-mapped steps that probe nothing are counted by why
What: where `commit` keeps a pass whose indirect commands the GPU may write from the GPU form,
and the `host-replayed-indirect-commands` notice of that first rule is to be announced
(`Device::announces_host_step`, a peek that counts nothing), the decision runs again passing over
each rule once named (`render/executions/cause.rs`'s `Passed`, `DeferredPass::rules_past`), and the
notice names every rule past the first that the pass breaks too, each judged as though the rules
before it were kept: the rate map's as though the pass had none. A rule the rest takes its answer
from (the commands' one primitive type, the pipeline state and its kind, the inherited state's
tessellation, vertex function and tile memory, the buffer's size, a refusal) is never passed over.
The commit path is unchanged where the notice was announced already: the first rule decides, as
before. Three WorkCounts fields count the rate-mapped passes a host step records without a probe:
`rate_map_steps_unfanned` (no fan-out: policy, features, memoryless attachment, shadowed texture),
`rate_map_steps_nothing_to_probe` (no command read) and `rate_map_steps_probing_none` (commands
read, no draw probed); with `rate_map_probes` they count every such pass once.

Why: the consumer's walk of a 3D renderer sees one notice, naming the rate map, so whether a GPU
form for rate-mapped passes would cover its pass (rules past the rate map) is unknown; and about
half a host step a frame there probes nothing, for no counted reason.

The notice's text changes (a RUNTIME bump at landing). API: three public WorkCounts fields
(api_signatures.tsv blessed); nothing removed.

Verified: tests::host_step_rules on lavapipe (an indexed triangle and an empty command of a
GPU-written buffer, executed in a rate-mapped pass: the rate map's notice names that rule alone;
with a visibility result mode set, the notice names the visibility rule, then the rate map past
it, which fails without this change; the counts: probed once each, the empty command's pass
probing none).

Also: host_step_rules: the buffer inherits the encoder's pipeline state; Degradation::HostReplayedIndirectCommands says its notice names the rules past the first.

Verified (lane icbgpu, msi m3-max-30616 at eec7881980, lavapipe): clippy -D warnings plain
and --cfg m2v_cpu_icd 0; 74/74 over host_step*, icb_*, indirect_command_buffer*,
notice_command_buffers, rate_map*, rate_mapped*, degradation*, trail_gpu_forms and
draw_shape_notices, the new host_step_rules among them; api-signatures --check clean.
Landed (main) at once: the hand negative control, gpucfg clippy and rustdoc run after.
RUNTIME 2320: the notice's text and what a run records change. WorkCounts gains
rate_map_steps_unfanned, rate_map_steps_nothing_to_probe, rate_map_steps_probing_none.
No Degradation kind.
2026-11-14 17:04:25 -08:00
Anees Iqbal fac8049bd1 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 16:22:29 -08:00