Commit Graph
5776 Commits
Author SHA1 Message Date
Anees Iqbal 0ea511c7cd Re-bless the golden tables for the cof_offsets fixture
RUNTIME 2339 (734e1cac02) added the owned fixture engine/cof_offsets without its
golden rows. The bless job (m3-max-31560 on the M3, bless-job.sh) translated it and
wrote its rows: the AIR input listing, six golden hashes and six engine
expectations. Only rows for this fixture are added; no existing row changed.
2026-11-14 23:28:19 -08:00
Anees Iqbal 5c7cfa8f67 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 23:22:12 -08:00
Anees Iqbal 39bff0de2a The carried test trees read the checkout where the test runner names it
Every env!("CARGO_MANIFEST_DIR") in validation's runtime_lane.rs and runtime_lane/ and in
metal2vulkan-runtime/src/tests (135 sites) named the directory the test binary was built in. A
nextest archive built on msi and run on another node with --workspace-remap read msi's path there:
teardown_threads panicked reading runtime_examples.ll, and public_cases read no case shard.

metal2vulkan-devtools gets one resolver, workspace_dir(): two levels above the manifest directory
the runner names as the test runs (cargo and nextest name the test's crate; a remapped archive
names it in the running machine's checkout), where that root holds the validation fixtures, else
above the dev-tools crate as built (the fallback fixtures_dir already had). validation_dir() and
fixtures_dir() sit on it; engine_dir() is unchanged. The sites move onto them:
- fixture reads (fixtures/public, engine/ and examples/) onto fixtures_dir() and engine_dir(),
  with the two hand-rolled "runtime variable else built" copies (attachment_reads, encoder_holds);
- committed cases and observations (validation_dir()/corpus), and public_cases and
  public_case_names now read the public source rows through source::public_sources_under on
  fixtures_dir() instead of source::public_sources(), which bakes the path;
- the runtime tests' device profiles (validation_dir()/profiles) and degradation_sites' read of
  the lane's sources;
- the conformance recordings, docs/API.md and the runtime's own src/ through workspace_dir().
The imports of std::path the moves left unused are removed.

Test-only. tests::the_carried_tests_read_the_checkout_where_the_runner_names_it (devtools, the
previous commit) fails before this commit and passes after. Verification: the msi job that builds
both commits, runs the remapped archive at each and lints the tip is reported with this sha.

With 4e06c87523 (the scan check), e9a0927685 (render_state.rs and line_width tests; the scan covers all of runtime/src),
74aa3e44cc and 086962f1fa (fixes; source.rs fixture reads through fixtures_dir). Test code only.

Compiled in m3-max-31605 (msi: clippy x3; scan passes; lavapipe suites 6235 passed, failures all pre-existing pin-97
items or the runtime-sources pin; remapped run with the build tree hidden 201/202, the last needing an all-targets
archive, 31641). Base 4e06c87523 (31508): scan lists 135 sites; remapped run fails 63/202.
2026-11-14 23:21:25 -08:00
Anees Iqbal 3b27e62ddd 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 23:14:44 -08:00
Anees Iqbal 37fab025d4 RUNTIME 2341: A carried kept draw restates by its scissors alone only where the ended encoder's render state was its own
RUNTIME 2338 (33369d0e8e) gave every kept draw a carry holds the opening encoder's stamp beyond
the scissor rectangles where the ended encoder never set its render state beyond them and the
passes were of one extent, so the draw's next draw restated by its scissors alone and kept the
rest of its recorded draw state. That holds for a draw recorded or last restated under the ended
encoder's render state, Metal's defaults at that extent. It does not for a draw the ended
encoder carried on undrawn (the carry's last kept draw, or one its bind state set aside): its
recording is an earlier encoder's, of another extent maybe, and kept that encoder's viewport.
The debug builds' Checked comparison caught it (render/draw_again.rs, "a draw rebound records
with another draw state than its every step"); in release builds the draw rendered through the
stale viewport.

- tests::image_standing's chain: alv_level1's draw recorded in the level-2 pass (a quarter of the
  side), carried aside through sampled(alv_implicit) (the whole side) into sampled(alv_level1)
  (the whole side), drew through the quarter viewport.
- runtime_lane::fresh_clear_reach: the draw recorded over the whole texture (ClearScissor),
  carried through the next case's ClearArea pass (no draw), drew in ClearAreaDrawn over the
  smaller render area through the whole texture's viewport.

The ended encoder's defaults (RenderLowering::again_defaults, Carried::defaults) now carry its
own stamp beyond the scissor rectangles beside its extent (draw_again::Defaults), and each carried
draw takes the opening encoder's stamp only where it holds that one (Kept::carried_into, with
RenderLowering::carried_beyond's pair): recorded or last restated under the ended encoder's
render state. Every other carried draw takes a fresh stamp and restates by everything the state
decides, as before RUNTIME 2338. A draw carried in with the opening encoder's stamp and carried on
undrawn holds that encoder's, so it keeps the shortcut across encoders of one extent and Metal's
defaults, as its recording still answers there.

Tests: the two failing pin-97 tests (lavapipe m3-max-31444, 780M m3-max-31479) are the checks:
tests::image_standing::a_chain_of_passes_over_a_texture_s_levels_reads_what_the_passes_before_wrote
and runtime_lane::fresh_clear_reach::a_fresh_target_s_clear_reaches_as_metal_s_by_its_compression.
Bisect m3-max-31545 (lavapipe): passing at 5fcd8be7de, failing at 33369d0e8e.

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

With 896fb3c564: stand_ins_after_pins counts the passes whose stand-ins arrive after a pinned instance by either route

RUNTIME 2332 (51b19a5bb4) records a reader through snapshots inline after a split, so a pass's
pinned reader's instance is now inline where it was a secondary before, and the instances
recorded inline reach the last pinned one. render.rs then takes the inline route
(stand_ins_after_first: each stand-in takes its attachment's texels right after the last inline
instance, the pinned ones among them, the same point) instead of the pinned route, whose branch
alone counted WorkCounts::stand_ins_after_pins. Its doc says "passes whose stand-ins arrived
after a pinned instance": they still do, uncounted. On the Radeon 780M,
tests::self_read_storage::a_fetch_after_a_pinned_reader_renders_through_a_stand_in_from_the_fetch_on
read every pixel right and counted 0 stand-ins after pins where 1 is (m3-max-31479).

The count now follows the doc: every pass whose first instance recorded inline, a draw of which
pinned its colors, and that holds a stand-in, by either route. The routes are unchanged.

Tests: that 780M test is the check (lavapipe takes no snapshots).

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

With a16fa27d57 (test-only): The face-turn tests read after a solid draw of their pass, as a turn serves that read

RUNTIME 2337 (5fcd8be7de, the user's issue 17) has a pass's first draw that samples a color the
pass clears read the clear, through a copy cleared to it: both x86 Macs' answer, where the M3 Max
reads the texels from before the pass. Every reading pass of tests::attached_read_faces and
runtime_lane::logged_face_turns was that shape (a clear, then the read as its only draw), so
since 2337 their reads took the clear (512 bytes differ, no copy in, no busy count:
m3-max-31444, m3-max-31479). The product is right there; the tests' expectation was the M3's.

A turn of a texture's faces serves a read that takes the texels from before the pass: a later
draw with no barrier before it, which 2337 leaves reading the copy taken ahead of the load (the
M3 Max's answer). Each reading pass now draws a solid (BENEATH, 0xff) through RECT first and its
read over it, so the read is that later draw; every expected byte and count stays, and a read of
the wrong face still shows a value two passes old. Expecting the clear instead would have left
no face's texels visible to any check.

Tests: the five attached_read_faces tests and logged_face_turns' test fail at 5fcd8be7de's
shape (bisect m3-max-31545, lavapipe: passing at 86d50ef800) and are the checks.

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

Fixes pin 97 (eee64c8668) failures on lavapipe and the 780M: image_standing and fresh_clear_reach (the debug Checked
comparison at draw_again.rs:1454, a product bug from RUNTIME 2338: a carried draw kept another encoder's viewport),
the five attached_read_faces tests and logged_face_turns (tests met RUNTIME 2337's approved answer), self_read_storage's
stand_ins_after_pins count (RUNTIME 2332's inline route). Bisected in m3-max-31545. Compiled in m3-max-31578 (msi:
clippy x3; the 10 tests pass on lavapipe; the whole runtime suite 2735/2736 in debug with no Checked panic, the one
failure the held_step_order timing test owned elsewhere).
2026-11-14 23:14:03 -08:00
Anees Iqbal a54c496b6b scheduler_held_wakes: the tests' device takes the queue plan
Pin 97's 3090 q2 leg (31475): tests::scheduler_held_wakes::
a_batch_held_for_an_unshared_queue_goes_at_the_completion_published_as_it_was_looked_at
panicked at device/mod.rs:1965, "this test's device takes the runtime
tests' default queue limits (TEST_QUEUE_LIMITS: a round robin of 2
VkQueue(s), 0 for presenting) and made an unshared command queue while
the program holds 2 of it".

58de9ba9a1 gave the runtime's own device tests two round-robin VkQueues
by default. A test whose work needs more, such as an unshared queue made
while two are held, fails at once, and the remedy that commit documents
is to make its device with queue_limits: None. The file's device()
now does so, as its tests did before 58de9ba9a1. The test passed on the
Radeon 780M at pin 97 (0.140 s) and failed on the RTX 3090.

Test-only. Verified: cargo fmt. The build and the 3090 run are pending.

Pin 97 3090 q2 (31475) failure. Compiled in m3-max-31593 (msi: clippy plain and m2v_gpu, runtime archive). Test-only.
2026-11-14 23:02:36 -08:00
Anees Iqbal 19be53f4ff 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 22:55:25 -08:00
Anees Iqbal 1b5a527f5e RUNTIME 2340: Scheduler: a host step at its gate whose batch's uses are known keeps its place
What: since a7e519150b (RUNTIME 2326) a batch held for its host step, once
the step took its gate, gave way to every later commit of another queue but
for one that writes what the step reads on the host (its executions' records
and ranges) or shares a fence with it. That rule was for a step whose uses
commit could not bound (a shadowed texture's copies, tile memory, a
visibility query, an inherited function table): its footprint is not known,
so keeping its place held every queue's tracked work. It also applied to a
bounded step, whose footprint names what its commands may reach, and there
it let a later commit that conflicts with those uses go first, against the
commit order the M3 keeps:

- runtime_lane::queue_order::a_copy_committed_while_a_write_waits_for_its_
  host_step_holds_it: queue B's copy of the buffer A's indirect commands
  write (made resident for writing) went before A's execution and read
  zeros;
- runtime_lane::steps_apart::another_queue_goes_on_while_a_host_step_records:
  a pass into A's target on another queue, committed after A's, began its
  host step while A's step still recorded.

Now the step's host reads are kept for giving way only where the batch's
footprint is not known (CommandBufferShared::footprint's None). A batch
whose uses are known keeps its place from its gate on, as before a7e519150b:
a later commit of another queue that conflicts with them waits behind it,
and one that shares nothing with it goes (the compositor's fill of
tests::held_step_order). The step whose uses are not known still gives way
but to writers of its host reads, so held_step_order's unknown-uses leg is
unchanged. Docs: the scheduler's and order.rs's rules, Held::gate_reads,
place_of, is_behind, WorkCounts::heads_held_for_earlier_commits and the
host-replayed-indirect-commands notice (degradation.rs, docs/API.md).

Bisect (lavapipe, the two tests alone): 06b5fe355e, a7e519150b's parent,
passes both (m3-max-31546); a7e519150b fails both with pin 97's messages
(m3-max-31547). This commit's proof (the two tests, held_step_order's three
legs, the catalogue, clippy) is in the lane's report.

Fixes pin 97 (eee64c8668) lavapipe and 780M failures queue_order::a_copy_committed_while_a_write_waits_for_its_host_step_holds_it
and steps_apart::another_queue_goes_on_while_a_host_step_records, both bisected to a7e519150b (RUNTIME 2326; parent
06b5fe355e passes, m3-max-31546/31547). RUNTIME 2326 was for the RTX 3090 89 ms rate-mapped pass, a step whose uses
were not known (it held every queue; a bounded footprint holds only what conflicts with it). That case keeps its give-way:
held_step_order visibility-query leg passes. Compiled in m3-max-31554 (msi: clippy; lavapipe both tests, queue_order,
held_step_order fill legs, degradation_catalogue, replayed_frames footprint-once).
2026-11-14 22:54:44 -08:00
Anees Iqbal 04840a4f4a 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 22:47:54 -08:00
Anees Iqbal 734e1cac02 RUNTIME 2339: Bind a slot read at its residual over a range its bind offsets share
What: bind::instantiate::shared_range gives a descriptor-form slot of a
Bounded window that its functions read at the residual one range for a run
of bind offsets of the bound buffer: the padded buffer from 0 where it fits
the view's maximum range (and 4 GiB), else the block of half that maximum
its window starts in, to the maximum past the block's start; its
SlotBindOffset residual the rest. A window of at most half the maximum never
straddles its block's range; a longer one, or one at or past the padded end,
keeps descriptor_range's range. planned_range takes it for every Bounded
storage view (no function reads one at its bind offset alone), and for a
uniform view where the new BindState::uniform_views_at_residual says the
consumer reads every uniform view at its residual: its keys all take their
residual forms. The runtime states it where pipeline::reads_views_at_bind
does not hold (every device today: no driver carries
DriverFact::ConstantOffsetUniformReadsPreloaded), through AtBindViews, at
each bind state that states the view base alignment (render, compute twice,
tile dispatch). Shapes, plans and keys are unchanged; the flag is not part
of the shape.

Why: a constant reference at a buffer index (constant float4 &) is a uniform
view of a 16-byte Bounded window, whose range started at the bind offset
with residual 0. Every offset-only rebind (a consumer's staged
setVertexBytes: setVertexBuffer at the next 256 bytes of an upload chunk)
then wrote another descriptor: rebind_into, push_set and the driver's
vkCmdPushDescriptorSet at every draw (reims-vgpu's Iris: +538 ns a draw
against a device pointer, +93 inside the push and +99 under record). The
range at the bind offset serves only keys reading the view at the bind
offset alone, which no device takes today: the shader already adds the
residual. Now such a draw keeps its set-0 writes (writes_kept) and pushes
only its residual, as a device pointer's draw does.

Metal and Vulkan: each read inside the window reads byte
lo + (bind - lo) + m = bind + m, the bytes it read before, through the same
instructions. A read outside the window, which Metal leaves undefined,
reads the buffer's bytes inside the range. The range starts at 0 or a block
multiple, a multiple of the base alignment
(VUID-VkWriteDescriptorSet-descriptorType-00327/00328), stays within the
view's maximum (00332/00333) and the padded allocation
(VUID-VkDescriptorBufferInfo-range-00342); a dynamic descriptor's offset is
its start as before (VUID-vkCmdBindDescriptorSets-pDynamicOffsets-01971).

Verified: by the jobs that follow (unit tests of shared_range and
planned_range, the lavapipe runtime test
constants_moved_along_one_buffer_keep_their_set_zero, the release medians
of runtime_lane::constant_offsets before and after).

With (bench and tests): 78463d1e1d The moved-constant set-0 test counts every second draw again as taking every step in builds with debug assertions; 5e7d715629 The moved-constant set-0 test lists which of the second pass's draws were rebound; 99a3459dc6 The moved-constant set-0 test moves the vertex constant alone, as constant_offsets does; a9c4b07790 The moved-constant set-0 test names what the second pass's draws did where some were not moved; 5e938c75c5 The moved-constant set-0 test draws the bench's shape; a bounded storage window's dispatch test binds the shared range; 69e598a6b5 Drop the stale copy of the range-from-bind-offset test; round-trip the new BindState field; ea4602012c cof_device reads its float4 at the instance's element; cd6492fd41 constant_offsets also draws over chunks in host pages, under the consumer's policy; 4d6e17bb89 constant_offsets takes the AIR library trait into scope; 1221f53ce0 Time draws that rebind a constant reference by offset against a device pointer.

Compiled in m3-max-31548 (msi: clippy, lavapipe uniform_bind_offsets/draw_again/general_form/inline_continues/
kept_shadowed_draws 48/48). The set-0 test fails at the base (16 writes pushed, want 0; 31536). Release counts
(31392): set-0 pushes per constant draw 1.00 -> 0, push constants 0 -> 1.00. The new fixture's golden rows re-bless
on development.
2026-11-14 22:47:14 -08:00
Anees Iqbal 188606728a heap_textures: the untracked lane's texture lies in place, and splits are asserted only there
31432 (the lane at cb8c03fd25, settled pipelines) on the RTX 3090: both
forms read the write in both heaps, but it still split 0 command buffers
at aliases. No creation left its making running and the Private heap's
command buffer began no segment, so a dispatch recorded later was not the
cause.

The lane's texture was of storage usage (ShaderRead | ShaderWrite). Metal
keeps such a colour texture uncompressed (heap_tiled::metal_keeps_uncompressed),
so its bytes are Metal's tiles. The runtime keeps it as a shadow of them,
with an image in memory of its own (texture/heap.rs). No image then lies
over the heap's bytes: the shadow's copy in reads them after the write,
ordered as any read of bytes, so there is nothing to split, and the data
is right. This is read from the code; the run below shows it.

The texture is now of sampled and render-target usage, as in
blit_write_then_texture_use, which splits on the 3090. Metal compresses
such a texture, so its image lies in place where one fits. The lane
asserts a split only where a texture lay in place (no shadow form between
its making and its read, runtime_lane::shadow_forms), and the HEAPTEX
lines print it per heap. The segments print goes. The pool settle stays:
a dispatch recorded later splits nothing either.

Test-only. Verified: cargo fmt. The build and the 3090/780M run are
pending; I expect at least one split on the 3090, with a texture in place.

Compiled in m3-max-31498 (msi: clippy plain and m2v_gpu, validation archive). Test-only.
2026-11-14 22:37:35 -08:00
Anees Iqbal ac296e9b5a Bench: a download into a guest RAM over 1, 12 and 128 of its chunks
What: host_ram_spread_bench, an ignored release bench of copy_to_host_ram of a page and of a
1.6 MB tile from a Private buffer into an 8 GiB fresh memfd RAM, the tile's pages drawn from
its first chunk, its first 12, or all 128: the call's CPU time, the GPU's and commit to
completion, with the chunks touched and held and the dispatches a copy recorded; the page and
the near tile again once every chunk is imported, and a raw Private to Shared blit of each
size and an empty command buffer for scale.

Why: the consumer measured ~15 us a 64 MiB chunk a small download's pages touch on an RTX
3090; this is our own shape of it, to say where the time goes.

Verified: not yet run (this commit is what the first jobs build).

Compiled in m3-max-31435 (msi: release, --cfg m2v_cpu_icd) and archived in 31436 (--cfg m2v_gpu). Test-only (ignored bench).
2026-11-14 22:35:52 -08:00
Anees Iqbal c54c56bd3b 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 22:33:08 -08:00
Anees Iqbal 203bc97bb9 Test counters of plan walks and twin-use checks: compiled only where their test is
What: binding.rs's PLAN_WALKS and plan_walks, and encoder.rs's TWIN_USES_CHECKED and
twin_uses_checked, with every increment of them, now take
cfg(all(test, debug_assertions, any(m2v_gpu, m2v_cpu_icd))), as kept_resident_checks beside
them does.

Why: their one reader, tests::resident_uses, compiles only with debug_assertions, so a release
test build under --cfg m2v_gpu or m2v_cpu_icd warned that plan_walks and twin_uses_checked are
never used (seen in the dlrate lane's release lavapipe build, job m3-max-31435), which fails
any release test build under -Dwarnings; debug clippy never sees it.

Verified: see the lane's report (a release test build under -Dwarnings and debug clippy).

Compiled in m3-max-31462 (msi: release lib test build under --cfg m2v_cpu_icd -Dwarnings; clippy --cfg m2v_gpu debug). Test-only cfg.
2026-11-14 22:32:27 -08:00
Anees Iqbal 86f02a00fa Re-bless the authored compile census at pin 97 (eee64c8668)
corpus-triage --audit authored-compile --bless in m3-max-31443 at eee64c8668.
256 rows change their artifact digests and the artifacts_at product hash moves;
no cell changes its compiled, refused or uncovered state (checked by comparing
every changed row with the digests stripped). RUNTIME 2334-2338 change what a
case's run records.
2026-11-14 22:18:53 -08:00
Anees Iqbal eee64c8668 heap_textures: the untracked lane encodes once the pipeline pool settled
On the RTX 3090 (31247, the lane at 3df940c15f), both forms read the
kernel's write: 0 of 4096 texels as the blit wrote them and 4096 holding a
word of the write, in the Shared and the Private heap. But the device
split 0 command buffers at aliases, and the lane asserts at least one
where DriverFact::ImageUsesMissBufferWritesInOneCommandBuffer holds. The
Radeon 780M passed both forms with 0 splits.

A compute state's creation under the default PipelineWaitPolicy::Bounded
hands its making to the device's pool and returns. A dispatch whose
pipeline is still being made then records later, into a VkCommandBuffer
of its own (pending_dispatch.rs). There it is apart from the write before
it, so there is nothing to split. The lane made its two states on a fresh
scratch cache and encoded at once. The lane now waits for the pool to
settle (pipelines_settled, as draw_work and made_at_creation do), so both
dispatches record into the encoder's VkCommandBuffer, where the split
rule acts. The HEAPTEX lines print the creations that left their making
running and the segments each command buffer began, which show the path
the run took.

Test-only. Verified: cargo fmt. The build and the 3090 run are pending.

Compiled in m3-max-31407 (msi: clippy plain and m2v_gpu, validation archive). Test-only.
2026-11-14 22:05:16 -08:00
Anees Iqbal 5e3afa3d79 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 22:02:16 -08:00
Anees Iqbal 33369d0e8e RUNTIME 2338: Re-homed and carried kept draws restate by their scissor rectangles alone where nothing beyond them changed
Kept::rehomed_into and Kept::carried_into reset the kept draw's render-state stamps to fresh
ones (Stated::default()), so the next draw of each derived again everything the encoder's render
state decides (restated.rs's restate_kept: the route, the bind state's values, the draw state),
though between the walk's draws the encoders set their scissor rectangles alone: on the RTX 5080
compositor walk (107 encoders of 5 draws a frame, abwalk-203314 at 5a4df749ec) 414 of the 428
rebound draws a frame took the full restate, about 0.26 us each, and 14 restated by scissors.

A re-homed draw stays under its encoder's render state: rehomed_into now draws its `set` stamp
afresh and keeps its stamp beyond the scissor rectangles, so its next draw restates by them alone
where the encoder set nothing beyond them since (Stated::scissors_alone), and by everything where
it did. A carried draw moves to another encoder, whose render state starts at Metal's defaults:
the ending encoder records its pass's extent where it never set its render state beyond its
scissor rectangles (DrawAgain::beyond_set, RenderLowering::again_defaults, Carried::defaults), and
the opening one gives the carried draws its own stamp beyond them where its pass is of the same
extent and it set nothing beyond them either (RenderLowering::carried_stated); else a fresh one,
as before. Both encoders' render states are then Metal's defaults but for the scissor rectangles,
and the default viewport is the attachment's extent, so restate_scissors answers what
restate_kept would. The `set` stamp still differs from the encoder's, so record_rebound still adds
the restated draw's pixels to its instance's drawn area and records its dynamic states afresh.

Test: tests::split_keeps' two tests assert the re-homed draws (2) and, across two encoders, the
re-homed and carried draws (6) restate by their scissor rectangles alone
(WorkCounts::draws_restated_scissors), with the same commands, state commands and pixels as
every draw taking every step; builds with debug assertions check every second rebound draw
against every step.

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

Compiled in m3-max-31357 (msi: clippy x3; 92 runtime render and kept-draw tests on lavapipe in debug, every second rebound draw checked against every step).
2026-11-14 22:01:33 -08:00
Anees Iqbal ebbaf7eff6 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 22:00:44 -08:00
Anees Iqbal 5fcd8be7de RUNTIME 2337: A pass's first draw that samples a color the pass clears reads its copy cleared to the clear, with no barrier too
A draw that samples a texture its own pass renders reads the texture's shadow, a copy taken
before the pass's load actions (texture/attached_reads.rs). In a pass that clears the color, a
first draw that sampled it with no barrier read the texels from before the pass at every pixel it
read: the M3 Max's answer, while both x86 Macs read the clear there (probe ownread: no draw
before it, so the load and the draws before it wrote only the clear). The copy was cleared to the
clear (Texture::cleared_copy, vkCmdClearColorImage) only after a memory barrier before the pass's
first draw.

The Macs disagree, so Metal's answer is either; the macOS guests are x86 ones, and a clear of the
copy costs less than a copy of the texture. RenderLowering's draw now takes the cleared copy for
every draw that samples a color the pass clears before any draw of the pass recorded, wherever
Texture::cleared_copy holds (a whole single-sampled 2D texture of one level and slice that one
color renders in place), with a barrier before it or none; the draw keeps nothing to draw again,
as after the barrier. A pass that loads the color, and every read outside cleared_copy, read as
before.

Tests: attachment_reads' no-barrier lane becomes a_first_draw_with_no_barrier_reads_its_pass_s_load,
Load and Clear over both target kinds, the texture of its own image taking the cleared copy
(attachment_read_clears) and reading the clear where the pass clears; check() counts a cleared
copy as taking no split's place with no barrier. framebuffer_fetch gains
a_first_fetch_after_a_clear_reads_the_clear (a fetch after a Clear reads the clear, not the texels
from before the pass). The conformance rows pass-start-barrier-*-sample with no barrier accept the
clear too, as the -read rows did. docs/API.md's accepted differences and attached_reads.rs's docs
say which Macs answer what.

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

With: 645f1c3323 snapshot_reads' first test makes its readers' pipelines before the counted pass; af0a44cc6d The render lanes and inline-split tests read their fixtures where the test runner names the crate; 8b5cd6dfb4 attachment_reads' first-draw lane lets a target over a buffer's bytes take the cleared copy too (test-only).

The user's GitHub issue 17. Compiled in m3-max-31319 at 8b5cd6dfb4 (clippy x3; lavapipe lanes, the first-draw lane, the
fetch-after-clear lane, the 14 pass-start-barrier conformance rows exact and default; the negative fails).
2026-11-14 22:00:02 -08:00
Anees Iqbal 86d50ef800 heap_textures: a kernel's write of an untracked heap's buffer, read through a texture there in one encoder
A lane for an image use over untracked bytes that a buffer wrote inside
one VkCommandBuffer, on a device where
DriverFact::ImageUsesMissBufferWritesInOneCommandBuffer holds (the RTX
3090). The tracker's summaries leave untracked resources out, and
FoldOrder::byte_writes covers tracked ones only. Whether a write through an
untracked heap's buffer still splits a later image use in one encoder had
no device test.

The lane covers a Shared and a Private placement heap, both untracked,
each with a 64x64 RGBA8Unorm storage texture at offset 0 and a buffer of
its answered size there. A blit writes the texture's pattern. Then one
serial compute encoder runs scale_and_offset into the buffer (1e6 + i into
every word), a memory barrier of buffers and textures, and rows_read of
the texture. Every texel must hold a word of the write (top byte 0x49), and
none the pattern (alpha 0xCD). The write's dispatch names the buffer by its
binding, so where the fact holds the read is expected to split at aliases
(command_buffers_split_at_aliases > 0), and elsewhere none splits.

A write the dispatch's uses do not name (through an address or an argument
buffer, its buffer resident) is not covered. command_observing notes and
checks the uses alone, not the resident set, and no owned fixture stores
through a loaded pointer yet.

With e58ce1e02f: heap_textures: the untracked lane's write through an address, its buffer resident

The untracked-heap lane wrote the heap's buffer through a binding only. A
kernel that stores through the address its argument buffer holds, the
encoder making the buffer resident for writing (useResource:usage:),
writes the same bytes as the resident set's use: the plan lists the
resident buffer as a write of its whole range (bind::plan::slots::
used_uses), and the encoder notes the command's uses, resident ones
first, before the next command's image use meets them
(alias_split::AliasWrites). This lane checks that on a device where
DriverFact::ImageUsesMissBufferWritesInOneCommandBuffer holds (the RTX
3090) the read through the texture still takes the write, in a new
VkCommandBuffer, and that elsewhere none splits.

The kernel is an owned fixture, examples/argument_stores.metal
(store_through_argument: base + i into word i of the buffer whose address
buffer(0) holds), compiled by scripts/regen-air-fixtures --dir examples
argument_stores (Metal 32023.922, LLVM 21.1.8).

The two forms share one body (untracked_write_then_texture_read); the
HEAPTEX untracked lines name the form.

Verified: cargo fmt; the regen script's own check (metal-as of the typed
text disassembles to the .ll, llvm-as 21 accepts it). Clippy and the
device runs follow.

Compiled in m3-max-31391 (msi: clippy plain and m2v_gpu, validation archive). Test-only.
2026-11-14 21:51:07 -08:00
Anees Iqbal 96a504a130 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 21:40:11 -08:00
Anees Iqbal 7b1725eb34 RUNTIME 2336: Lay no more of a predicated loop's copies than keep its waiting host steps within 16
On RADV, runtime_lane::predication::every_dispatch_form_runs_in_each_pass_past_the_copies ran
40-77 s alone and passed its 60 s wait for one command buffer under the suite. The cost is the
runtime's, not the test's breadth: each piece of work a host step records after the GPU's work
before it (an indirect dispatch of a kernel that observes its partition, an indirect command
buffer's execution inside a block) is its own batch, a round trip to the host (submit, wait for
the GPU, record, submit) in every run of a loop's laying, whether its copy's pass runs or skips.
A loop was laid down as 64 copies (16 inside another), bounded only by its commands
(LAID_BUDGET), so the test's inner DoWhile of 20 + 1 passes inside a DoWhile of two laid 1024
copies of its body: measured on lavapipe at the base (msi job m3-max-31287, a timing probe), its
command buffer's first run recorded 4097 host steps and made 8195 submissions (6145 and 12291 on
the device without device addresses, whose step form records six such pieces a pass), where its
21 passes ran 84 (126); the DoWhile of 100 passes 257 (385). That command buffer was 94% of the
test's 21,772 submissions, and each costs a GPU round trip, a few milliseconds on RADV.

copies_of now bounds a loop's copies by a second budget too: the work apart whose host step waits
for the GPU (Deferred::gpu_written) that its copies lay down, at most WAITED_BUDGET (16), counted
as LAID_BUDGET counts commands, from the first copy's, inner loops' copies included
(Predication::waited, Looping::waited_at). A loop of no such work keeps its 64 or 16 copies. A
loop that ends before its copies pays at most 16 round trips for the copies it skips, and one that
runs past them one more round trip, its check, per 16. The run-again path, unchanged, takes any
count of copies down to one.

Tests: every_dispatch_form_runs_in_each_pass and the failing test assert each loop's first run
records at most 16 host steps and the check (257 and 4097 at the base: the negative control);
the 100 passes no longer run again exactly once. docs/API.md and docs/RUNTIME-PORTING.md name the
new bound.

With abd0662e9f: the budget trades nothing for accuracy, so it has no FAST-PATHS row.
2026-11-14 21:39:26 -08:00
Anees Iqbal e9a9a53e55 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 21:33:16 -08:00
Anees Iqbal 6ef0802488 RUNTIME 2335: The draw replay kernels' pool piece holds the device as a runtime holder, never the program's last handle
Device::begin_draw_replay_kernels (RUNTIME 2330) hands the pool one piece that
makes the draw replay's three kernels after the creation of a render state that
supports indirect command buffers, and the creation waits for none of them. The
piece upgraded a weak handle of the device, which device/holds.rs counts as a
program handle. A program that dropped its last handles while the piece was
still making a kernel had its drop return with the device live. The pool's
thread then let the device go last, and an exit meanwhile left that teardown
undone.

On NVIDIA's driver the exit handler of libEGL_nvidia then faults on the live
VkDevice (docs/FAST-PATHS.md, known gaps). This is
render_fold::an_execution_of_render_commands_ends_its_group's SIGSEGV after it
passed, on the RTX 3090 and the RTX 5080 Laptop GPU. The 5080's core
(systemd-coredump, job 31206) has the main thread in exit() inside
libEGL_nvidia's exit handler, in libnvidia-eglcore. No runtime thread was in a
Vulkan call, and the device's shader-cache worker was still alive; that worker
stops only in the device's teardown.

Now the piece takes the device as one of the runtime's holders
(WeakDevice::hold, Holder::DrawReplayKernels) for each kernel's making, lets it
go between kernels, and reads holds_go_on before each one. The program's last
drop stops it at its next kernel and waits for the one it is making, so the
device is torn down on the program's thread before that drop returns. The
creation still waits for none of the kernels.

Test: teardown_threads::a_running_draw_replay_kernels_making_leaves_the_device_to_the_program_s_thread.
An ICB-capable state's creation starts the making, which is held before a kernel
while it holds the device. The program drops the state and the device, and the
test asserts the teardown ended on the program's thread before the drop
returned.
2026-11-14 21:32:35 -08:00
Anees Iqbal b94c15a5c0 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 21:20:49 -08:00
Anees Iqbal e9eaa47436 RUNTIME 2334: A reader through snapshots rebound into an instance recorded inline after a split keeps its pairs
RUNTIME 2332 admits an instance whose draw reads colors through snapshots to the inline splits
(render/inline_splits.rs), but record_rebound still refused a kept reader rebound into such an
instance: the arm (Some(pairs), Some(held)) returned the internal error "a reader rebound into an
instance recorded inline after a split", whose comment the admission had made false. On ms01's
Iris Xe (ANV, which takes snapshots) runtime_lane::attachment_reads::
own_pixel_reads_copy_in_only_around_their_scissors failed its draw with that error (job
m3-max-31219, at 5a4df749ec).

The arm now keeps each of the reader's pairs in the instance's room, the drawing one inside its
coverage query, as the every-step path keeps them (Kept::draw, begin_query, end_query): the
pass's end records them through the pass's record, in order.

Verification: the jobs that compile and run it are reported with this sha.
2026-11-14 21:20:04 -08:00
Anees Iqbal 7200b49c2f heap_trimmed makes a long chain of few values live and a short one of many, on every device
The test made one kernel, 320,000 fused multiply-adds with 64 values live
(5fba5455a5), sized for NVIDIA's compile. On the Radeon 780M (RADV) its
makings left glibc under compile_memory::FREE_FLOOR free and nothing was
trimmed (m3-max-30816: 0 trims, "no large making handed its free heap
back"). The kernel before it, 600 live, made NVIDIA's compile superlinear
and past the test's wait.

A probe (scratch a54c546ec9, never landed; m3-max-31096 on um870) made six
shapes twice each, every shape in a process of its own, and read
mallinfo2's free heap after each making: NVIDIA's compile frees about 0.7
KB a step whatever the values live, fastest at 64 (334 MB at 320,000),
while RADV's leaves 195 to 277 MB with up to 256 live and 739 MB to 1.5 GB
with 600. No one shape passes the 268 MB floor fast on both, so the test
makes both on every device, with no driver key: 320,000 steps at 64 live
(NVIDIA past the floor) and 40,000 at 600 (RADV past it, about 17 s more
on the 3090). The rows are in the module docs.

The 3090's first 64-live making took 60.5 s on a shared um870, past the
60 s WAIT that covered it; the makings now wait up to 300 s (a test
constant; the assertion is the trims and the resident bound, not time).
nextest's 20-minute terminate-after covers the test's expected 106 s on a
loaded 3090.

Verified: cargo fmt. The build and runs on the 3090, 780M and XTX follow.
2026-11-14 21:18:34 -08:00
Anees Iqbal 5d25521f03 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 21:03:22 -08:00
Anees Iqbal 5efe2f1d73 Test queue limits count the program's live command queue handles
The runtime tests' default queue limits count the queues the program holds, not live ones

The check that fails a test needing the queue plan counted live queues
(QueueShared). A command buffer holds its queue's QueueShared, and the
runtime's threads let a completed one go a moment after its wait
returns. So a test that let a queue go and then made two more could
fail or pass by timing.

The check now counts the command queues the program holds a handle of:
- each QueueLine counts, under cfg(test), the command buffers alive
  whose `commandQueue` it is;
- a queue the program made is held where its strong references
  outnumber those command buffers plus the caller's upgrade
  (QueueLine::held_by_the_program, Line::program_queues_held);
- a command buffer takes its count before its handle of the queue and
  drops it after, so a count in passing reads one fewer, never one
  more.

The product's count of live queues (WorkCounts::command_queues_live_most)
is unchanged.

The device test a_default_test_device_fails_where_its_work_needs_the_plan
now keeps a command buffer of a queue it let go before making the
third. The live-queue count panicked there; the held count does not.
The message reads "while the program holds 2 of its command queues".
docs/VALIDATION.md and TEST_QUEUE_LIMITS' doc say the same.

The command buffer's count among its queue's is a guard held for its drop: _counted

Clippy (-D warnings) refused 3d6e4e5957's field `counted`, never read:
the field exists for its Drop, which takes the command buffer's count
off its queue's. Named _counted, as a guard held for its drop.

The test limits' check runs where the program makes a queue, not where a recovery places one again

With the held count, a recovery's queue that took its place on the new
generation counted itself and the program's other queues. So
device_recovery's a_loss_holds_the_hang_s_queue_until_the_recovery and
work_held_unsubmitted_at_a_loss_fails_as_its_victims_in_queue_order (two
queues each) failed on lavapipe at 577d649100. The rest of the suite
passed: 2741 of 2743.

The check now runs in Device::command_queue, for a new round-robin or
unshared queue of the program's, before its place. A queue placed again
after a recovery was counted where it was made.

Verified: job 31249 at 1f69cb2e0c: clippy plain, --cfg m2v_gpu and
--cfg m2v_cpu_icd; queue_limits, queue_limits_device and device_recovery on
lavapipe three times (22/22 each); the runtime suite on lavapipe 2743/2743;
a negative control (the old live count) fails at the third queue. Test-only
(cfg(test)).
2026-11-14 21:02:38 -08:00
Anees Iqbal cbfe9940c8 copied_base_device holds the whole-base merge under 2 s in release builds only
a_whole_written_device_base_is_read_back_by_the_gpu timed a first merge
back of a 256 MiB device base after 3 s idle and held it under 2 s. On the
RX 7900 XTX (um790) its debug build took 2911.9, 3255.3 and 3131.9 ms in
the pin 94 and 96 legs, the last exclusive, where a release build on the
same host took 291.5 ms (job 17624).

The probe (m3-max-30832, exclusive) ran the test twice from pin 96's
archive, alone and with the device kept open: the XTX's PCI
power/runtime_status stayed active and runtime_suspended_time 0 through
both, amdgpu.runpm -1, autosuspend 5000 ms, link 16 GT/s x16; the merge
took 2971.0 and 3120.7 ms, every one of 262,144 blocks read back. So no
runtime suspend: the time is the debug build's unoptimized host work.

The test keeps every claim the product controls (one read back of every
block, an exact merge) and holds the 2 s bound where the build is
optimized; a debug build prints the time.

Verified: cargo fmt. The XTX run follows.
2026-11-14 20:54:52 -08:00
Anees Iqbal dbc0bef1a5 The held-work tests encode every command buffer before the first commit
HeldWork::run encoded and committed its three long command buffers in
turn. So the window between the first's commit and the unshared one's
held two encodes of the fills. That was about 460 fill_buffer calls of
64 MiB each on an RX 7900 XTX, which took 2 to 4 ms to encode on a quiet
host and 25 to 38 ms on a loaded one.
- On the loaded host the unshared commit came 50 to 60 ms after the
  first long one started.
- The scheduler had let the second go at the first's end, as nothing
  unshared was pending, so
  an_unshared_queue_s_command_buffer_goes_ahead_of_other_queues_held_work
  and a_late_pass_sends_an_unshared_queue_s_command_buffer_before_work_let_go_with_it
  failed.
- The same job failed them at pin 94 (13bac091e1) as at pin 96: um790's
  load average was 12 to 17 on 16 cores, and the probe's timings put the
  time in the encodes (m3-max-31186). A long one's commit took 0.1 to 1 ms.

The three long ones and the unshared one are now all encoded first.
Then the long ones are committed back to back, as "three committed at
once" means, and the unshared one once the first is scheduled.
2026-11-14 20:53:26 -08:00
Anees Iqbal ed6e632f51 snapshot_reads checks that a reader's instance after an inline one records inline
The previous commit admits an instance whose draw reads through snapshots to inline
splits; no check counted it. overlapping_primitives_read_what_the_draws_before_the_barrier_wrote
now reads inline_split_instances too (Moved::inline_instances) and, where the device
takes snapshots, expects it to equal snapshot_inline_splits: the instance the first reader
splits off the pass's inline first instance records inline, and the second reader, after a
barrier, records into it (snapshot_apart's held instance). Without the admission the count
is 0 where snapshot_inline_splits is 1.

Test-only. Verification: the jobs that compile and run it are reported with this sha.
2026-11-14 20:47:58 -08:00
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