Commit Graph
5795 Commits
Author SHA1 Message Date
Anees Iqbal fac976c772 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-15 05:19:46 -08:00
Anees Iqbal 7ba0cd9fe6 RUNTIME 2343: GPU times placed by a calibration still beyond 20 us are announced and counted
A calibration pair is read again while the smallest deviation so far
states more than 20 us (`gpu_time::SETTLED`), four readings at most
(`least_deviation`). Where the least of four still stated more (93 and
125 us on the RX 7900 XTX under full parallel suites: a reading's
deviation holds the time its thread spent off the CPU), the runtime
placed the command buffer's GPU times by it, inside the command
buffer's life, with up to that error, and said nothing. Owner rule 2:
a near-equivalent is recorded and announced.

`GpuClock::span` now answers `Placement::Loose { deviation }` where the
pair places both times inside the life and its deviation exceeds
`SETTLED` (a pair outside the life is still set aside as before).
`Placement::read` gives the notice for every placement the first read
of a command buffer's GPU times announces, counting a loose one:
- new kind `Degradation::LooselyCalibratedGpuTimes`,
  `loosely-calibrated-gpu-times`, class Precision, announced once per
  device at the read (the site `uncalibrated-gpu-times` uses), its
  reason stating the deviation; not `uncalibrated-gpu-times`, whose
  cost says the times are placed by the completion, where these are
  the pair's, the duration exact;
- new `WorkCounts::loosely_calibrated_gpu_times`: command buffers
  whose times a read found placed so, counted at the read that
  announces, so the count is nonzero exactly where the kind was
  announced.

Tests: `tests::gpu_time::a_pair_still_beyond_the_settled_deviation_is_
announced_once_and_counted` feeds `least_deviation` a fake source of
four readings above 20 us (Loose, the kind with the deviation in its
reason, each read counted, announced once) and settled ones (Iris
Xe's 165 then 7.6 us; 20 us exactly: Calibrated, nothing), and a loose
pair outside the life (Disagreed, the uncalibrated kind, not counted).
The lane's `gpu_times` expects the kind exactly where counted, and holds
the count nonzero exactly where `calibration_deviation_most` exceeds
the slack (no disagreement); `read_kinds` adds it where counted
(mesh_draws), `disagreeable_kinds` allows it (first_use); a site const
`LOOSE_GPU_TIMES` takes it. The conformance cases that read GPU times
(`command-buffer-facts`, `empty-command-buffers`) allow its notice:
the host's load decides it, and every value still compares exactly.

docs/API.md's catalogue lists the kind; api_signatures.tsv blessed.
2026-11-15 05:18:59 -08:00
Anees Iqbal d9236a8a11 Known gaps: a commit held past 16 ms on a Radeon 780M; a teardown wait past 16 ms on an RTX 2080
Two latency tests fail on some GPUs at the 0.2.0 release candidate, recorded where a user reads
open gaps (docs/FAST-PATHS.md, Known gaps) and in the 0.2.0 CHANGELOG entry, at the owner's call to
document them as failing and release:

- tests::held_step_order::command_buffers_behind_a_waiting_step_read_scheduled: on the Radeon 780M
  (Phoenix, m3-max-31782, exclusive) the long command buffer's commit returned 405.95 / 23.66 /
  10.50 ms after its call over the test's three runs (bound 10 ms); pin 97's XTX printout shows the
  same shape (315.68 -> 12.59 -> 17.11 ms). The ordering the test is for held in every run.
- tests::teardown_threads::a_running_queue_switch_check_leaves_the_device_to_the_program_s_thread:
  on an RTX 2080 (620.70.06) it failed 3 of 3 alone (m3-max-31777): the teardown waited 33.1 / 23.3
  / 19.8 ms for the check, 19.6 / 22.0 / 18.4 ms of it the check's objects' release; it passes on
  the RTX 3090, RX 7900 XTX and Radeon 780M. That host's driver calls on the 2080 ran several times
  slower than usual during the measurement (cause open).

Docs only.
v0.2.0
2026-11-15 02:15:21 -08:00
Anees Iqbal 093d256b75 gpu_times: a calibration beyond the slack is held to the runtime's re-read rule
`command_buffers_are_timed_in_the_hosts_time_base` held every calibration
pair's stated deviation to 20 us. The runtime promises less: it reads a pair
again while the smallest so far states more than 20 us, four readings at
most (`gpu_time::least_deviation`, `WorkCounts::calibration_readings`), and
checks each placed time against its command buffer's life within the
deviation stated. A stated deviation includes the reading thread's time off
the CPU, so a loaded host states more, and no placement of the test (alone,
or the GPU held) controls the host's other jobs.

On the RX 7900 XTX (RADV, Mesa 26.2.6) the least of four readings stated
37.5 us with the test alone on a host at load average 13.7 on 16 threads
(job 31053), 93.4 us in pin 99's suite (31769) and 124.9 us in pin 96's,
each with 0 disagreements. Pins 97 and 98's suites passed it.

The test now holds a deviation beyond the slack to the rule: the pair that
stated it read all four readings (readings >= 4 + 2 * (pairs - 1)). A
re-read rule that stopped early still fails, as the Iris Xe's first reading
after idle (165 us) would.

Verified: m3-max-31778 (msi): clippy -D warnings plain and --cfg m2v_gpu (validation) 0; archive built.
2026-11-15 01:50:00 -08:00
Anees Iqbal 7c8e58275b Re-bless the compile census at 896acd2dbf
Only the product hash changes (the runtime-sources pin moved with 7ad012b7e6's doc-comment fix);
no cell's state changed. Census job m3-max-31776.
2026-11-15 01:39:07 -08:00
Anees Iqbal 896acd2dbf 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-15 01:35:50 -08:00
Anees Iqbal 7ad012b7e6 gpu_route docs: drop a redundant explicit link target
`cargo doc -p metal2vulkan-runtime --document-private-items` with -D warnings failed on
gpu_route.rs:21 (rustdoc::redundant_explicit_links): the label [`CommandTables`] already resolves
to super::CommandTables. Red at pins 97, 98 and 99 (PRIVDOC_metal2vulkan-runtime=1, since
e7b9c5bfdc RUNTIME 2329); m3-max-31774 shows the error. Comment only.
2026-11-15 01:35:09 -08:00
Anees Iqbal f53a36d0e0 Re-bless the compile census at pin 99
Only the product hash changes (the runtime-sources pin moved with 5a6d3e3515's test-only trace
points); no cell's state changed. Census job m3-max-31763 at 4a8f305e8f.
2026-11-15 01:30:02 -08:00
Anees Iqbal 4a8f305e8f CHANGELOG: 0.2.0 is the release
The release candidate for 0.2.0: development at this commit. Its product code is pin 98's (2fadc74ab7);
everything after that pin is test fixes, test-only trace points and table re-blesses. Checked by pin 99 at
this commit: the merged check, lavapipe, packaging, and the GPU legs that failed or had not run at pin 98.
2026-11-15 01:15:10 -08:00
Anees Iqbal f3d7926925 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-15 00:47:16 -08:00
Anees Iqbal 5a6d3e3515 Pin 98 diagnostics: a lost-wake failure prints the scheduler's steps; a slow taking-up prints the thread's run-queue wait
Test-only (trace points under cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))); no behaviour change, no RUNTIME bump. Both tests failed only under the 780M HP suite's load at pin 98 (m3-max-31702) and could not be reproduced (m3-max-31743: 40/40 and 3/3 under 4 CPU hogs); these make the next failure name its path. The 40 ms bound and ours = taken - in_driver are unchanged.

Three commits from steelbrain/regr98:

scheduler_held_wakes: a lost-wake failure names the scheduler's steps

What: a_held_batch_whose_wake_never_came_goes_at_the_next_slice keeps the scheduler's trace
(command_buffer::completion::trace) from the kept group's gate on, and its failure prints it.
The scheduler records, in the tests' builds alone (cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))),
each pass of its thread (after a slice or not, taking commits in or not), a waiting thread's and
a committing thread's pass, each sleep that ended at its slice, a slice's rescue, and the group
kept past its pass or sent. Nothing changes outside those builds.

Why: the 780M HP suite leg of pin 98 (m3-max-31702) failed it with "1 slices, 0 slice rescues;
commits taken in 1, passes 1", the same counts as the passing runs (m3-max-31616) but the
rescue, and the kept command buffer completed 99.9 ms after the completions were published, at
the slice. Reading the scheduler names no path that lets the group go at the slice without the
pass counting its rescue; the trace says which pass sent it, and what it took in.

Verified: in the lane's report (a loaded lavapipe run).

----

queue_order: a checked commit's taking up counts the scheduler thread's run-queue wait apart

What: checked_commits_during_submissions_are_taken_up_promptly bounds the scheduler thread's own
time to take up each of two checked command buffers after the VkQueue is free (40 ms), the
time the batches' vkQueueSubmit calls spent in the driver apart. Now the time the thread, ready
to run, waited on the host's run queue for a core over the same span is apart too: each
submission handler notes its thread's schedstat under /proc (the second field, Linux's
scheduler statistics), the first command buffer's naming the scheduler's thread, whose wait the
test reads as it lets the VkQueue go. Where the system keeps none (macOS), or another thread
took the command buffer, nothing is taken apart. Every round prints it (Round::run_queue), and
the summary its most.

Why: the 780M HP suite leg of pin 98 (m3-max-31702) failed round 1 with 51.3 ms of own time; its
slowest round's later command buffer was submitted 10.3 ms after the release and its handler,
on the same thread, ran at 73.6 ms, the driver's time flat. The test ran 9.0 s in that suite
and 1.3 s alone on the same device (m3-max-31725), where it passed. A thread the host does not
run is not slow in its own work.

Verified: in the lane's report (a loaded lavapipe run shows the wait).

----

queue_order: the run-queue wait is printed, not taken out of the bounded time

What: checked_commits_during_submissions_are_taken_up_promptly bounds the scheduler thread's
own time again exactly as before 757485a87a: the time from the VkQueue's release to its taking
of each checked command buffer, less the driver's vkQueueSubmit time, under 40 ms. The thread's
run-queue wait over the same span (Linux's schedstat, Round::run_queue) stays measured and is
printed beside taken, ours and in_driver, in each failing round's message and in the summary
line, but is no longer subtracted.

Why: the loaded lavapipe run (m3-max-31743, msi, the test pinned to 2 cores beside 4 busy loops)
measured the wait (up to 3.6 ms) but did not make the 51 ms gap of the 780M HP suite leg of pin
98 (m3-max-31702), so nothing yet shows that the run-queue wait explains it. The next failure
says whether it does.

Verified: in the lane's report (msi: clippy for cpu_icd and gpu; lavapipe).

Verified: m3-max-31747 (msi) at 02af33af54: clippy -D warnings (cpu_icd, gpu) 0; both tests pass on lavapipe.
2026-11-15 00:46:35 -08:00
Anees Iqbal b01761dbed Pin 98 test fixes: the parity hazard control writes its own buffer; held_step_order's reset leg is judged by its own times
Test-only; no RUNTIME bump. Two commits from steelbrain/regr98:

parity sequences: the hazard control's second copy writes a buffer of its own

What: parity::sequences::lane::a_hazard_fails_when_its_commands_share_a_byte_and_else_is_explained
ran two serial encoders over one untracked buffer: seq_copy writing word 256, then seq_copy
reading word 256 (or 260) and writing word 400 of the same buffer. Now the second copy writes
word 400 of a second untracked buffer. Every assertion is unchanged: the read of the word the
first wrote fails as a hazard between commands that share a byte, with nothing explained; the
read of the next word is explained as untracked memory and fails nothing.

Why: since 734e1cac02 (RUNTIME 2339) bind::planned_range binds a storage slot of a Bounded
window over the buffer from 0 to its padded end, the function reading at its residual, where it
bound 16-byte granules from the bind offset before. The two copies' write descriptors of the one
buffer then overlap, and the layer reports a WRITE_AFTER_WRITE between bytes 256 and 400, which
the lane rightly explains (no shared byte, untracked memory): the test's "nothing explained" for
the shared-byte run failed on the Radeon 780M (pin 98, 780M HP suite and alone) and the RX 7900
XTX. The runtime's barriers are unchanged (it orders by the proven bytes, the slot's window);
only the layer's view of the descriptors widened. Lavapipe passed: its layer sees no kernel
writes. With the second buffer the two commands share only buffer 0, which the first writes and
the second reads: a read after write is the only hazard they can make.

The lane's docs that said the runtime binds 16-byte granules (parity/sequences/hazards.rs,
runtime_lane/apart_writes.rs) state the range from the buffer's start now.

Verified: in the lane's report (msi build and clippy; lavapipe; the 780M through the
orchestrator).

----

held_step_order: the reset leg is judged by its own run's times

What: an_unshared_queue_s_fill_does_not_wait_for_another_queue_s_host_step's reset leg asked that
the unshared queue's reset of the records the pass's step reads be submitted within a quarter of
the calibrated long work (25 ms) of the long command buffer's GPU end. Now it asks that the reset
go past half of the long work by the run's own times, from its commit to the long work's end
(Run::past_the_fills). The hold assertion (a look held it behind the pass) is unchanged.

Why: the 780M HP suite leg of pin 98 (m3-max-31702) and Phoenix's of pin 97 (m3-max-31483) failed
it: the reset was held (7 looks) and went after the fills, 342 and 345 ms after its commit, but
the pass's own small batch then ended 35 and 118 ms after it, the GPU shared with the suite
(the long work ended 220 to 460 ms after the commit where it was calibrated to 100 ms). That is
the GPU's load, not the order. A reset that went at its commit, the order this guards against,
goes within a millisecond of it, as the fills of the other legs do, so it still fails. Alone on the
780M HP it passed (m3-max-31725). The 256 MiB fills of 2fadc74ab7 are not the cause: Phoenix
failed the same way at 64 MiB.

Verified: in the lane's report (msi build and clippy; lavapipe; the 780M through the
orchestrator).

Verified: m3-max-31737 (msi) at e2de86df2d: clippy -D warnings (cpu_icd, gpu) 0; lavapipe held_step_order 2/2 and the parity hazard test 3/3 (lavapipe takes its layer-blind branch; the 780M/XTX run is the proof for the parity fix).
2026-11-15 00:33:48 -08:00
Anees Iqbal f90df51114 freed_memory test: hold the queue waiters unpublished while it reads the release's counts
tests::freed_memory::a_release_waits_for_the_batch_in_flight_where_the_device_parks_freed_memory
failed on the RX 7900 XTX at pin 98 (m3-max-31704) with "parked 1, waiting 1, deallocators
delayed 1, run 1": the deallocator had run by the time the test read its count, although the
release had parked the import.

The product was right. A parked import's deallocator waits in the parked block (`Parked::after`),
and only the release a queue's waiter posts (`freed_memory.rs`'s `Unpark`) runs it, once the
waiter has published that the queue's timeline reached the batch's value (completion.rs, the
`parking.completed` and `after_completion` after the publish; `Parking::reached` filters the
blocks). The test read `Device::work_counts`, whose snapshot reads `freed_memory_waiting` under
the memory's lock near its start, and only then the deallocator's count. On the XTX the 1 GiB of
fills completes in about a millisecond. A waiter that published the batch's completion as the
release returned posted the Unpark, which took the memory's lock as the snapshot let go of it,
freed the import and ran the deallocator before the test's read. So the read of `ran == 0` raced
the batch's legitimate completion.

The test now holds the queue waiters before they publish a completed value
(`completion::trace::Point::Publish`, as `scheduler_held_wakes` does) from before the batch's
commit until it has read the counts. The host then cannot see the batch complete, so the release
always parks (the branch for fills completed before the release could no longer run, and goes)
and `ran == 0` is sound however fast the GPU is. Once the hold is let go, the deallocator must run,
on a handler thread. The device's own checks are settled first so that nothing of theirs waits for
a completion during the hold. The assertion is unchanged.

Verified: see the lane's report (clippy in three configurations, the module on lavapipe, the
fixed test on the XTX).
2026-11-15 00:26:45 -08:00
Anees Iqbal e602e06066 Re-bless the golden tables and the compile census at pin 98
The golden tables (bless job m3-max-31687 on the M3) gain the rows of abtex's owned fixture
engine/abt_descriptor_sets (its AIR input listing, golden hashes and engine expectations). The
19 device-profile rows change because DescriptorCaps gained update_after_bind_uniform_texel_buffer
and update_after_bind_storage_texel_buffer (RUNTIME 2342), which the profile fingerprints cover.
No existing fixture's translation row changed.

The authored compile census (m3-max-31688) changes only its product hash, from the SEMANTICS 2122
bump: no cell's state changed.
2026-11-14 23:47:31 -08:00
Anees Iqbal 2fadc74ab7 Pin 97 test fixes: the busy-VkQueue join test takes its own rounds; held_step_order calibrates by its own times
Test-only; no RUNTIME bump. Two commits from steelbrain/regr97q:

command_queues: the busy-VkQueue join takes rounds of its own until a queue joined, and says what each look found

What: a_queue_joining_another_s_busy_vk_queue_is_announced_once made one busy
queue and three joiners, each joiner making one fill while 24 of the busy
queue's fills were in flight, and asserted a join where the device shares.
Now each round makes a busy queue and a joiner of its own, at least three
rounds, and, where the device shares and no queue joined yet, up to 16. The
assertions are unchanged: joins above 0 exactly where the device shares, and
queue-sharing announced exactly once where a queue joined. Every run prints,
and a failure says, the joins, the rounds, and the looks that found no other
VkQueue busy (picks_with_none_busy), passed over a busy one's old oldest batch
(joins_withheld_from_old_heads) or an unshared queue's
(joins_withheld_from_unshared), and the queues gone long.

Why: pin 97's RTX 3090 leg (m3-max-31476) failed it with "0 joins where the
device shares: true"; pin 96's passed. Nothing between them touches its path:
its work is plain blit fills, which no host-step rule sees, and joining reads
queue_share.rs's per-VkQueue state, which no commit in 9303a1f03f..eee64c8668
changed (the test queue limits of 58de9ba9a1, 3db60efc33 and 5efe2f1d73 are the
runtime crate's cfg(test) alone; this test takes the plan). A join needs the
joiner's look to land while the busy VkQueue has a batch in flight whose
oldest has run under 0.5 ms (YOUNG_HEAD), and the 24 fills of 16 MiB are about
that much of a 3090's work; on that loaded leg (its neighbours took 15-16 s
each) a late test thread or completion thread misses it at every look, or a
fill sliced between other processes' work marks the busy queue long, after
which nothing joins it. The old test could not say which. A product that never
joins still fails every round.

Verified: in the lane's report (the 3090 run of the old test alone, and this
one).

----

held_step_order: the long work's host share stays small, and a run is judged by its own times

What: command_buffers_behind_a_waiting_step_read_scheduled requires the long
command buffer and its follower to read Scheduled within 10 ms of their
commits while the step waits at its gate. It failed in two loaded venues, in
two ways:

- lavapipe on msi (m3-max-31554): of 3 runs only the first, warm-up run was
  "early"; runs 2 and 3 read Scheduled at 7.5 and 7.7 ms, but their long work
  ended 38-41 ms after the follower's commit, short of the calibrated 100 ms,
  so the filter's "half the long work" (50 ms) dropped them;
- the RX 7900 XTX suite leg of pin 97 (m3-max-31481): every run early, the
  follower Scheduled at 0.35 and 2.2 ms, but the long one at 12.6 and 17.1 ms
  after its commit call. At 64 MiB a fill the XTX's calibration takes about
  1400 fills, and that commit's encoding, planning and submission of them,
  before its pass's batch reaches its gate, falls inside the measured time
  and grows with the GPU's speed.

Now:
- each fill writes 256 MiB (the calibration starts at 16 fills, at least 2),
  so a fast GPU's long work is a quarter as many commands;
- a run counts where the long work ended at least twice the 10 ms bound after
  the follower's commit, by that run's own times: a command buffer made
  Scheduled only as the long work ended would then read it past the bound,
  so the run still tells the two apart;
- each run prints the fills and when the long one's commit returned.

The 10 ms bound and every assertion are unchanged. The other leg of the
module (the unshared queue's fill and reset) shares the fills and keeps its
own criteria.

Verified: in the lane's report (lavapipe here; the XTX through the
orchestrator).

Verified: lavapipe m3-max-31646 3/3 with clippy (m2v_cpu_icd) 0, m2v_gpu clippy 0 in m3-max-31647; 780M HP m3-max-31597 9/9 (queue_order x6, steps_apart, held_step_order x2); 3090 join test alone m3-max-31627 pass in 1.18 s.
2026-11-14 23:34:41 -08:00
Anees Iqbal 723f8fa1cd 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:33:51 -08:00
Anees Iqbal 8280b89626 SEMANTICS 2122: the texel-buffer heap classes change translated heap layouts
ec0be064d0 changes what the translator emits for a texture_buffer member of an argument
buffer (a set-1 texel-buffer class where it was refused), so cached translations keyed on
SEMANTICS 2121 are stale.
2026-11-14 23:33:10 -08:00
Anees Iqbal ec0be064d0 RUNTIME 2342, SEMANTICS 2122: Texture buffers read through argument buffers sit in texel-buffer heap classes
A pipeline whose argument buffers hold texture buffers was refused with
ArgumentBufferTextures (NotImplemented, no location): the translator's heap layout
(lower/texture/slot.rs declare_heap) had no set-1 class for a texture_buffer member, so
SPIRV-Cross-shaped tier-2 argument buffers (descriptor sets as [[buffer(n)]] structs with
texture_buffer, texture2d and sampler members) could not be made, on any device.

- Set 1 gains texel-buffer heap classes: UNIFORM_TEXEL_BUFFER for read, formatless
  STORAGE_TEXEL_BUFFER for read_write and write. The class follows the facts' texture type.
- DescriptorCaps gains update_after_bind_uniform_texel_buffer and
  update_after_bind_storage_texel_buffer; where a device lacks them a typed needs_any_of names
  the missing features. Non-uniform texel-buffer indexing and the without-format read/write
  needs are checked as for images; link counts STORAGE_TEXEL_BUFFER with the images against
  the update-after-bind limits.
- New public bind::heap::HeapElement::TexelBuffer(vk::Format).
- The runtime writes each live texture buffer's texel view at its resource ID, with a neutral
  texel view at element 0; a gone texture buffer's Texels stay alive until its tickets clear.
  A texture buffer whose bytes cannot be viewed in place (staged, tail-viewed, offset off
  minTexelBufferOffsetAlignment, past maxTexelBufferElements, swizzled, or a non-direct format)
  reads the neutral and is announced through the existing UnnamedTextureUnviewable. No new
  Degradation kind.
- docs/REFUSALS.md and api_signatures.tsv regenerated.

Test: runtime_lane::argument_texel_buffers::a_texture_buffer_in_an_argument_buffer_is_read_in_both_stages
(an owned fixture in SPIRV-Cross's shape): vertex and fragment read a texture_buffer member of a
set-0 argument buffer, the fragment also samples a set-1 texture2d through the sampler beside it;
every pixel must equal texel[1] + texel[4]*tint + albedo.

Verified: lavapipe with the validation layer, m3-max-31658 at 6626eeaff3: pass. Control
m3-max-31636 (the fixture and test at the base, without the fix): fails with exactly the
ArgumentBufferTextures NotImplemented refusal.
2026-11-14 23:33:03 -08:00
Anees Iqbal f90b069111 uniform_bind_offsets' moved-draw fixture reads through engine_dir()
RUNTIME 2339's new tests::uniform_bind_offsets::moved_state read cof_offsets.ll at
Path::new(env!("CARGO_MANIFEST_DIR")), the build machine's checkout, beside the stack that moved
every such read onto metal2vulkan_devtools' helpers and removed this file's then-unused
`use std::path::Path`. On development the merge left the read unresolved (`Path` is not imported
under --cfg m2v_gpu / m2v_cpu_icd) and the dev tools' scan check
(tests::the_carried_tests_read_the_checkout_where_the_runner_names_it) names it. It reads
metal2vulkan_devtools::engine_dir().join("cof_offsets.ll") now.

Test-only. Verification: the msi job that compiles this commit and runs the scan check and the
file's tests on lavapipe is reported with it.
2026-11-14 23:30:12 -08:00
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