Commit Graph
4822 Commits
Author SHA1 Message Date
Anees Iqbal ece1bf461d Test: the loaded composite writes its background before each round, and reports the route with the pixels
The second round loaded what the first left, which its fetches halved again: the
expected pixels are each round's over the background, so the CPU writes it before
each. The route check joins the pixel failures, so a run that takes the scratch
route shows its pixels too.
2026-11-12 13:51:08 -08:00
Anees Iqbal 7d9e8ce385 A render target in place over host pages takes the storage usage without the feedback loop usage
What: an image in place over host pages of a texture that renders tried the
storage usage only together with the feedback loop usage
(VK_EXT_attachment_feedback_loop_layout). It now tries, widest first, both
usages, the feedback loop usage alone, then the storage usage alone, each
where the device makes the image in place with it (its linear tiling has the
usage's format features, and the image lies at the texels' pitch in their
memory, as before), the storage usage still only where the device's check
passed for a shader's writes of its texels over the pages.

Why: MoltenVK has no feedback loop layout, so there a guest's framebuffer
surface over host pages (RGBA16Float, RenderTarget | ShaderRead) never took
STORAGE, and every pass that fetched it in the pixel interlock rendered
through a scratch image, where the fetching draws' output was lost: the
Dock's icons drawn as rims, the Finder sidebar's glyphs washed out (reims's
A/B on the M3: declaring ShaderWrite, which gives the image STORAGE, drew
both right). Devices with the feedback loop usage keep their order: both,
then the feedback loop usage alone, as before. The scratch route's own loss
stays a separate fix.

The in-place storage test now allows the storage usage without the feedback
loop usage; the docs of the in-place image, the storage form and
in_place::storable say a fetching draw reads the texture in place through it.

Verified: see the report's job ids (fetch_composite's over-host-pages case on
MoltenVK before and after, and on lavapipe).
2026-11-12 13:51:08 -08:00
Anees Iqbal 1663f1a5ff Test: a loaded composite of icons and fetches over a no-copy buffer's host pages
What: fetch_composite gains a third home for its target, a texture over a
no-copy buffer's host pages, loaded from what the CPU wrote there, as a
guest's framebuffer surface is (RGBA16Float, RenderTarget | ShaderRead).
Where the image lies in place, the device's check passed for a shader's
writes of its texels and the device fetches through storage, the test
asserts that the image took the storage usage, so the pass fetches the
target in place rather than through a scratch image; and, as for the other
homes, every pixel must be its draws' answer in draw order.

Why: on MoltenVK such a target's in-place image took the storage usage only
together with the feedback loop usage, which MoltenVK lacks, so every
fetching pass over a guest's framebuffer went through the scratch route,
where the fetching draws' output was lost (the Dock's icons drawn as rims).

Verified: see the next commit, whose fix this test checks.
2026-11-12 13:51:08 -08:00
Anees Iqbal 5ef4a9f432 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 13:50:38 -08:00
Anees Iqbal 6bf7e13e91 RUNTIME_VERSION 2146: a device whose held imports cost every submission keeps at most 64 releasable imports resident
The three commits before this one. On a device whose submission check found a per-import cost
(pointer_imports_tax_submissions: about 0.45 us a submission per held import on the 780M), at most RESIDENT_MOST = 64
releasable imports stay resident; past it the residency thread wakes at once rather than at its 500 ms tick and
releases the least recently read idle imports, paced. New counter WorkCounts::host_imports_released_over_most
(api_signatures row). HOWTO.md and HostMemory::with_dma_buf describe the cap.

Verified (on the branch): lavapipe (m3-max-22599) host_residency, pointer_residency, dma_buf_import_cycles,
host_ram_dma_buf 32/32; Radeon 780M (m3-max-22634) the same modules 31/31, with the new device test
past_the_most_resident_the_least_recently_read_import_is_released (most 2 over three buffers: exactly the least
recently read released, the others read with no re-import, the released one's next blit reads a file write after one
re-import). One release and re-import on the 780M: 37.5 us free + 153.6 us encode, ~0.19 ms. Lint green at the
pre-stack base 7f1e5d7151 (m3-max-22547); development's checks cover the tip.
2026-11-12 13:50:00 -08:00
Anees Iqbal c7f9c44530 Residency: the resident count's decrement takes try_update, fetch_update's new name
Found by the lint job (22525) on msi: fetch_update is deprecated on this toolchain.
2026-11-12 13:49:23 -08:00
Anees Iqbal cc694355b1 Residency: a device test of the release past the most, and the guide's and HostMemory's words for it
past_the_most_resident_the_least_recently_read_import_is_released: with the most held at two
(Device::keep_resident_host_imports), three dma-buf imports read in turn; one released past the
most, the least recently read; the other two read with no import again; the released one's next
blit imports it again and reads the file's writes made meanwhile. It prints the free's and the
import again's times. HOWTO.md and HostMemory::with_dma_buf say a device whose held imports cost
every submission keeps at most 64 resident.
2026-11-12 13:49:23 -08:00
Anees Iqbal 5a4746a7a5 Residency: a device whose held imports cost every submission keeps at most 64 releasable imports resident
A window keeps an import used every few seconds imported for good, so a guest that blits from many
buffers in turn kept 1,000 to 1,470 of them in RADV's global list, each in every kernel submission.
On a device whose import tax check holds, the residency thread now also releases those past
RESIDENT_MOST (64), the least recently used first, whatever their windows, woken as soon as one
more is imported past it. Counted: WorkCounts::host_imports_released_over_most.

Not yet built or tested: the device test and the checks follow.
2026-11-12 13:49:23 -08:00
Anees Iqbal 4b99c54b07 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 13:48:48 -08:00
Anees Iqbal bac66a5b11 RUNTIME_VERSION 2145: didModifyRange's bytes are taken at the next commit, as Metal takes them
The two commits before this one. On a device without unified memory a Managed buffer has two copies, and
did_modify_range's copy in read the host copy when the GPU ran it, so a CPU write made after the commit but before
the GPU reached the copy reached the earlier command buffer. Metal takes the bytes at the commit (measured on a
discrete Mac, 5300M, macOS 26.7.1: write A, didModifyRange, commit, write B while the GPU is busy -> the command
buffer reads A; a write after didModifyRange and before the commit is read). did_modify_range, and a CPU write
through a texture over a buffer, now note the range on the device; every commit copies each noted range on the CPU
into staging as the host copy holds it then, and the next submission copies the staging in. Where staging finds no
memory the range falls back to the copy at execution. Docs: managed.rs, managed_copy.rs, API.md, the runtime README
and FAST-PATHS's managed row.

Verified (on the branch): RTX 3090 (m3-max-22616): the new lane test
device_copies::a_did_modify_range_reaches_the_bytes_the_next_commit_finds (the oracle's five steps, over pages and
runtime-made) fails without the fix at step 4 (read B, wanted A) and passes with it; device_copies::a_*,
texture_blits::, first_use:: 38/38; managed_copy_device, kept_padding, device_memory_overflow, detached_contents
27/27. Lint and the full suites run on development.
2026-11-12 13:48:09 -08:00
Anees Iqbal f62966f4f0 did_modify_range's bytes are taken at the next commit, as Metal takes them
What: did_modify_range (and a CPU write through a texture over a buffer) notes the range on the
device (managed.rs Modified); every commit, at its start and before it returns, copies each
noted range of a buffer with a host copy on the CPU into staging buffers as the host copy holds
it then (Buffer::upload_now, CallerCopy::copy_in_now, managed_copy::stage_in), which the next
submission copies into the device copy before any of its commands. A range the staging buffers
find no memory for falls back to the copy from the host copy as the submission runs.

Why: the copy in read the host copy (the caller's pages through their import, or the runtime's
own host copy) when the GPU ran it, so a CPU write made after the commit, before the GPU reached
the command buffer, was what the command buffer read. Metal on a Radeon Pro 5300M (macOS
26.7.1, reims's oracle) takes the bytes at the commit after didModifyRange: a write before the
commit (after the call, or with the command buffer encoded before it) is read, one made 30 ms
after the commit while the GPU spun is not. Capturing at the call would be wrong (steps 2 and
3 read the later write there). An RX 7900 XTX computed frame 0 of a benchmark on frame 1's
input this way.

Docs: managed.rs and managed_copy.rs state the rule and its cost (a CPU copy of the range's
bytes at the commit); API.md, the runtime README and FAST-PATHS.md's managed row follow.
managed_bytes_copied_in counts a caller copy's copies alone, as before.

Verified: the lane test of the parent commit on an RTX 3090 (job ids in the report).
2026-11-12 13:47:32 -08:00
Anees Iqbal f7b5429a8a Lane test: did_modify_range's bytes against the commit, the oracle's five steps
What: runtime_lane::device_copies::a_did_modify_range_reaches_the_bytes_the_next_commit_finds
runs the five steps reims measured on a Radeon Pro 5300M (two copies) and a UHD 630 (one),
macOS 26.7.1, for a Managed buffer over pages and one the runtime made, each behind busy work
on the GPU: CPU writes of a range, did_modify_range, and a command buffer copying the range
out, encoded and committed in each step's order. Two copies: A, B, B, A, B (a write after the
commit is not read); one copy: A, B, B, B, B.

Why: a benchmark computing each frame on the next frame's input on an RX 7900 XTX; the runtime
copied a did_modify_range's range in from the host copy as the GPU ran the copy, so a CPU write
after the commit reached the command buffer (step 4 reads B with two copies).

Verified: run on an RTX 3090 against the fix's parent (expected to fail at step 4) and with
the fix (job ids in the report).
2026-11-12 13:47:31 -08:00
Anees Iqbal b95cdd8ffc Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 13:47:20 -08:00
Anees Iqbal b55eeedec3 RUNTIME_VERSION 2144: on a listed plan an object over a guest-RAM chunk not imported takes its own path and asks for no chunk
The three commits before this one. On a listed plan (held imports cost every submission: RADV, and ANV where they
do), an object over a chunk whose import is not made no longer imports its run alone and marks the chunk asked
(which had the device's thread import the whole chunk, pinning every page of it); bind_in_chunk returns None and
the object takes its own path, as over memory no RAM holds. It binds inside a chunk only where the chunk's import
is made (by a copy that needed it). AHEAD plans are unchanged. So attaching run resolvers to every no-copy object
changes no residency, and objects over chunks the copies imported leave the BO list. Removed with the path: the
object's run-again binding, Placement::over_ram_run, the residency import-again arm for runs and the counter
run_bound_buffers_made (api_signatures re-blessed).

Verified (on the branch, at e030317153):
- lint m3-max-22593: clippy every feature, --cfg m2v_gpu, --cfg m2v_cpu_icd, rustdoc, api tests.
- lavapipe m3-max-22602: host_ram_dma_buf, host_ram_device, host_ram_copy_device, device_recovery_no_copy,
  import_overlap_hazard, host_residency, dma_buf_import_cycles 77/77.
- Radeon 780M m3-max-22625: host_ram_dma_buf, host_ram_device, host_ram_copy_device 60/60, with
  where_each_listed_import_costs_a_submission_the_ram_is_long_chunks_released_once_idle asserting that the first
  object over an unimported chunk takes its own import with no chunk imported or asked a second later, and that after
  a copy imports the chunk the next object binds in it (chunk_bound_buffers_made +1, InHostRam).
2026-11-12 13:46:39 -08:00
Anees Iqbal f69a094752 Listed-plan tests import a chunk themselves before binding objects in it
On a listed plan an object over a chunk not imported now takes its own
import and asks for no chunk, so five host_ram_dma_buf tests that relied
on the first object importing its chunk failed on lavapipe (job 22517:
chunks imported 0, Copied instead of InHostRam, the tile test's holders
never imported). A test hook, Device::import_host_ram_chunk, imports the
chunk at an address as an object's import used to (RamOnDevice::chunk,
By::Object); the five tests call it before the objects they expect bound
in the chunk.

Verified: pending the lavapipe run of the touched modules.
2026-11-12 13:45:59 -08:00
Anees Iqbal 2ddc2f810e Guest RAM: drop the import the run-again binding alone used
Found by the lint job (22518) on msi: Pages was imported for Device::ram_run_in_chunk and
ram_run_alone_again, which 5b396edb5a removed.
2026-11-12 13:45:59 -08:00
Anees Iqbal 27cd4bccc0 Guest RAM: on a listed plan an object over a chunk not imported takes its own path and asks for no chunk
On a device whose plan is listed (each held import costing every submission and the RAM's
chunks its dma-bufs: RADV, ANV where the import tax holds), an object over a chunk whose import
was not made was bound in an import of its own run and asked the device's thread for the chunk,
which faulted in and imported the whole chunk: udmabuf allocates every page of it and keeps them
after the import is freed, so attaching runs to every no-copy object would make the guest RAM
under every object resident chunk by chunk (12.3 GiB of a 16 GiB guest on the 780M before the
listed plan). Now such an object is bound in the chunk only where its import is made, and
otherwise takes its own path, as over memory no RAM holds: no run import, no ask. Chunks are
imported for the copies over them, and the objects over them after that lie in them. Plans that
import ahead (NVIDIA, host-pointer chunks) are unchanged.

Removed with the object path: RunAgain, Routed::run_again, Placement::over_ram_run, the
residency's AgainFrom::RamRun with Device::ram_run_in_chunk and ram_run_alone_again, and
WorkCounts::run_bound_buffers_made (an object is never bound in a run import now; copies keep
their ranges alone and run_imports_live). Docs: host_ram.rs, host_residency.rs, copy.rs,
HostMemory::with_runs, driver_defects.rs, WorkCounts, HOWTO.md; the API signatures table
re-blessed.

Tests: the listed tests now import their chunks by copies; the first object over a chunk not
imported, with a source of its own pages as a consumer's come, takes its own import, no chunk
imported and none asked of the RAM's source, and the objects over a chunk a copy imported lie in
it. The other host RAM tests lose their run-bound terms (0 on every plan they run).
2026-11-12 13:45:59 -08:00
Anees Iqbal ccefca132d Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 13:28:21 -08:00
Anees Iqbal d57a597cd1 RUNTIME_VERSION 2143: synchronizeTexture copies a Managed texture's bytes over a two-copy buffer out
The commit before this one. On a device without unified memory a Managed texture over a Managed buffer has two
copies; the GPU writes the device copy, getBytes and the buffer's contents read the host copy, and
synchronizeTexture:slice:level: recorded nothing, so a program that synced with it and then read saw the region as
of its last didModifyRange. It now copies the texture's span out as synchronizeResource does (shared
synchronize_bytes / synchronize_texels in blit.rs).

Verified (on the branch): RTX 3090 (m3-max-22550): runtime_lane::device_copies::a_synchronize_texture_copies_the_texels_out
fails without the fix (copy-outs expected 1, got 0) and passes with it, with the other device_copies::a_* tests,
texture_blits:: and buffer_texture_blits:: (27 passed). Lint and the full suites run on development.
2026-11-12 13:27:42 -08:00
Anees Iqbal a7ba65dd66 synchronize_texture copies a Managed texture's bytes over a two-copy buffer out
What: on a device without unified memory, BlitCommandEncoder::synchronize_texture
now copies a Managed texture's bytes over a buffer from the buffer's device copy to
its host copy (the caller's pages, or the runtime's own host copy), as
synchronize_resource of the texture already did. A level that lies in the image
alone (a tiled texture's past its first) copies nothing; a texture of an image
alone still records nothing, its CPU access reading its image. The copy is shared
code: synchronize_resource's buffer and texture arms now call synchronize_bytes and
synchronize_texels.

Why: synchronize_texture recorded nothing on every device, its doc saying Managed
memory behaves as shared memory. Without unified memory a Managed buffer is two
copies (managed.rs, managed_copy.rs), and a texture over one serves get_bytes, and
the buffer its contents, from the host copy (buffer_texture.rs Texels::read). So a
program that synchronized with synchronizeTexture:slice:level: read the CPU copy as
of its last didModifyRange: stale texels. Found reading the read-back paths for a
benchmark that fails validation on an RX 7900 XTX.

Docs: the stale doc is replaced; API.md and FAST-PATHS.md name synchronize_texture
beside synchronize_resource for the copy out; the managed counters' docs count it.

Verified: the lane test runtime_lane::device_copies::
a_synchronize_texture_copies_the_texels_out (a blit into rows of a Managed texture
over pages and over a runtime-made Managed buffer, then synchronize_texture: the
contents and get_bytes hold the rows; the copy out counted for the pages with two
copies) is run on a discrete NVIDIA GPU with this change and once without the
runtime fix (negative control); job ids in the report.
2026-11-12 13:27:01 -08:00
Anees Iqbal 95efe8405b Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 13:25:53 -08:00
Anees Iqbal 0bb4e9f42b Pipeline log: a refused kernel's compile takes a line naming its function
A compute state whose kernel's compile is refused, at its creation or at a
dispatch's variant, printed nothing under METAL2VULKAN_LOG_PIPELINES, and
the refusal itself (compile failed: LimitExceeded(SpirvWords)) names no
function, so a consumer's log could not say which kernel it was. The log
now prints, at both compile sites, a line with the kernel's function name,
the refusal, and the descriptor it was made from, as a made pipeline's
line names them. Diagnostics only: nothing else changes.
2026-11-12 13:18:48 -08:00
Anees Iqbal d782275fc5 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 13:18:23 -08:00
Anees Iqbal 358330659a SEMANTICS_VERSION 2061, ARTIFACT_FORMAT_VERSION 508, RUNTIME_VERSION 2142: heap raw arms behind a spec constant
The commit before this one. A heap float read, sample, gather or query that may meet a texture held by its raw
texels branches into the raw decode arm at every site; the arm's test is now ANDed with
SpecKey::HeapRawTextures(stage)'s HELD bit, a u32 specialization constant (default 3, every arm live) that the
compute and render plans fill from the command's heap members (heap_raw(shape, stage, reach), the value the notes
already read). Where it is 0 no handle the command names carries a raw form's class, so the arms are dead at
pipeline creation. Modules change (one OpLogicalAnd per site, about 5.6k words on the largest kernels), and the
stored specialization key carries the new constant.

Verified (on the branch):
- nextest -p metal2vulkan --all-features (m3-max-22504): 3499/3500; golden_hashes changes on the heap-reading rows
  (296 cells), re-blessed on development.
- clippy --all-features (m3-max-22498); clippy --cfg m2v_gpu and rustdoc -D warnings (m3-max-22505).
- The decode-note test checks the stage declares the constant (default 3) and the plan's key carries 0, 1 or 3 per
  bound set; it fails without the change.
- CLI translation, amd-780m-radv profile (m3-max-22496): the four largest guest kernels at 0.96-1.76 s and
  163-271 MiB translation alone, 6.9-14.1 s with spirv-val, within 20 s / 500 MiB.
Not run yet: create time on the XTX (m3-max-22515) and the lavapipe heap lanes (m3-max-22516).
2026-11-12 13:17:44 -08:00
Anees Iqbal 64d3fc4261 Heap raw arms: a spec constant drops them where no raw texture is held
A heap float read, sample, gather or query that may meet a texture held by
its raw texels (BGR10_XR, BGRA10_XR, R10Unorm_X6, RG10Unorm_X12, the bfloat
forms) branches on the handle's class index into the raw decode arm at every
site. On a large kernel those arms are most of the module RADV compiles, and
they are live even when the command's heap holds no such texture.

The test now also reads SpecKey::HeapRawTextures(stage)'s HELD bit, a
specialization constant (default 3, every arm live) that the compute and
render plans set from the command's heap members, the value its notes
already read. Where it is 0, no handle the command names carries a raw
form's class, so the gate is exact, and the arms are dead code at pipeline
creation.

Verified: the decode note test now also checks that the stage declares the
constant and that the plan's specialization key carries its value.
2026-11-12 13:04:45 -08:00
Anees Iqbal 53afacd2a2 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 12:58:08 -08:00
Anees Iqbal f30d2c42a2 IcbShared states its Send and Sync, so a handler that keeps its reports builds at the default limit
The validation crate's release build of its tests under --cfg m2v_cpu_icd stopped building on
development (155027095f, job m3-max-22422): runtime_lane/indirect_host_steps.rs's executed-commands
handler keeps the reports it is handed (Arc<Mutex<Vec<ExecutedCommands>>>), and proving its
capture Send and Sync walked from the reports down an indirect command buffer's fields past
rustc's default recursion limit of 128 (recursion_depth_exceeding_limit, an error under
-Dwarnings). A program's crate that writes such a handler meets the same walk.

IcbShared now implements Send and Sync by hand, as Deferred does, with a constant that makes the
compiler prove each of its fields Send and Sync, naming every field, so a field added fails the
build until it is proved too. The walk from a consumer's types ends at an indirect command buffer's
shared state. Chosen over #![recursion_limit = "256"] on the validation crate: that would hide the
walk from the lanes alone, while every program's crate keeps the default limit.

tests/consumer_auto_traits.rs gains a_handler_keeps_the_reports_it_is_handed_at_the_default_recursion_limit,
the handler written as the lane writes it, in a function of its own as the file's other checks are.
2026-11-12 12:57:17 -08:00
Anees Iqbal 4909701fa1 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 12:55:35 -08:00
Anees Iqbal 93d6d2df8f Tests: the inputs encoding drops region_viewports' default as it drops the other later inputs'
pipeline::compile::tests::the_inputs_encoding_is_the_earlier_derived_debug failed at the rebased
tip (job m3-max-22386): LoweringInputs' derived Debug now ends with region_viewports, which the
key's encoding hashes only where it is set, as it does the other inputs added after the first
three. The test strips its default too.
2026-11-12 12:54:43 -08:00
Anees Iqbal a640990233 Queue times: the device tests' switch compiles only with the device tests
Under plain clippy --all-targets the device tests are out, so the switch was dead code; it is now
gated like step_aside's device-test helpers. Found by the lint job on msi.
2026-11-12 12:54:42 -08:00
Anees Iqbal 0ab547b714 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 12:54:07 -08:00
Anees Iqbal 7b27d0b63e Re-derive the generated documents at the landing tip
They are generated from the whole case set, and the set grew on `development`
while this branch was in flight, so the copy committed here counted a smaller
one.

Verified: regenerating at this tip leaves no change beyond the `Generated at`
stamp.
2026-11-12 12:53:37 -08:00
Anees Iqbal d09897f9fb RUNTIME_VERSION 2141: a draw that reads its pass's color at its own pixels with no barrier takes the snapshot, writers included
The commits before this one let snapshot_wanted take own-pixel readers with or without a Metal barrier, so a
draw that reads the color it writes (a compositor's backdrop: mix(read, colour) into its own target) reads a
snapshot of the earlier draws (pixel interlock, drawn twice) instead of a copy of the target, on devices with
attachmentFeedbackLoopLayout, extendedDynamicState3ColorWriteMask and fragmentShaderPixelInterlock. A fallback
counts as a split reason only where the draw would otherwise split; a no-barrier reader that falls back reads
the copy as before. The Macs disagree on such a read (the M3 answers the texels from before the pass; the
5300M and the UHD 630 the earlier draws' writes): docs/API.md's accepted difference now covers writers and names
both answers: a private target's reader through small scissors keeps the M3's answer by the area rule, a
surface's reader gets the x86 Macs'. FAST-PATHS and attached_reads.rs say the same; the conformance pass-start
read rows with no barrier accept the drawn answer (DRAWN_WITHOUT_BARRIER).

Verified (Radeon 780M, RADV, gem10):
- GPU time per frame, a compositor's shape (6 passes over BGRA8 surfaces, a backdrop draw per pass, exclusive,
  m3-max-22298): 4.069 ms with the copy -> 3.406 ms with the snapshot; shadow copies 8 -> 2; with the write-mask
  feature withheld 4.074 ms (the copy route in the same binary).
- At 7d45829efd (m3-max-22455): validation in_place_reads, snapshot_reads and attachment_reads 23/23 (the surface
  no-barrier test Moved { snapshotted: 2, splits: 0, copies: 0 }, pixels drawn; the private one copies 2, the
  M3's answer); 31/31 runtime attached-read tests; conformance pass_start unit tests 7/7 and the replay of all 14
  pass-start-barrier rows exit 0, over-buffer-read differed and justified by the accepted difference.
Running: fmt, clippy default, --cfg m2v_gpu and --cfg m2v_cpu_icd, rustdoc (m3-max-22457, 22462).
2026-11-12 12:52:52 -08:00
Anees Iqbal fb286f3492 Attached-read standing test: a read with no barrier takes the snapshot where the device reads so
tests::attached_read_standing reads a texture over a Private buffer's plane, whose image aliases
the bytes; with the snapshot route taking own-pixel readers with no barrier, a device with the
route reads it through a snapshot and copies nothing in. The test holds each read to the route
its counts show, as it already did after the barrier, and checks the bytes either way; lavapipe,
with no snapshot route, still checks the copies' cuts.

Verified: it failed on the 780M at c67027e1a9 (job m3-max-22418) with Read all zeros where the
copy was expected; the rerun follows.
2026-11-12 12:52:10 -08:00
Anees Iqbal 9b629fac02 Attachment-read lane: no-barrier own-pixel reads over a buffer's bytes take the snapshot
With the snapshot route taking own-pixel readers with no barrier, a reader of a target over a
buffer's bytes on a device with the route reads through a snapshot and sees what the draws before
it wrote: A's red in an_own_pixel_read_without_a_barrier_reads_the_texels_from_before_the_pass, the
clear in a_draw_after_a_clear_with_no_barrier_reads_the_texels_from_before_the_pass (psb_read), and
the load in a_barrier_at_the_pass_start_costs_nothing_without_a_read_of_a_cleared_color, with or
without the pass-start barrier alike. Each test holds the answer to the route the counts show, and
allows the snapshot only for the target over a buffer; check() takes a snapshot with no barrier.

Verified: the three failed on the 780M at 9894244e5d (job m3-max-22401) with exactly these
answers (128 for A's red, (120, 200, 40, 255) for the reordered clear, one snapshot for the loaded
read); the rerun follows.
2026-11-12 12:52:10 -08:00
Anees Iqbal df9ae6b02d Snapshot reads with no barrier: API.md's accepted difference covers writers
docs/API.md's accepted difference for a draw that reads its own pass's color at its own pixels
with no barrier now covers a draw that writes the color too: it reads what the draws before it
wrote where the runtime takes no copy for it (in place, or through a snapshot where the device
takes that route and the snapshot costs no more than the copy: a surface's reader always, a
private texture's by the area rule), else the copy, the M3 Max's texels. Its lead-in is the slug
the pass-start-barrier read rows name. FAST-PATHS.md's row and texture/attached_reads.rs say the
same, each naming both answers.

Verified: docs only; the conformance unit test that the slug exists runs in the 780M job.
2026-11-12 12:52:10 -08:00
Anees Iqbal 3e620240f2 Snapshot reads with no barrier: docs, a surface lane test and the pass-start read rows
The snapshot route's docs, WorkCounts::reading_draws_snapshotted and the 780M timing that keeps
it: a compositor's frame of six backdrop readers over surfaces with no barrier took 3.41 ms of GPU
time through snapshots against 4.07 ms through copies (backdrop_costs, job m3-max-22298, base
e303b7adbb against e7641d633f; 4.074 ms with extendedDynamicState3ColorWriteMask withheld at the
tip, the copy). New lane test snapshot_reads::without_a_barrier_a_surfaces_readers_take_the_snapshot.
The conformance rows that read at their own pixels with no barrier
(pass-start-barrier-{private,over-buffer}-read) accept the clear, the answer a snapshot reads, under
docs/API.md's accepted difference DRAWN_WITHOUT_BARRIER (its entry follows in this branch).

Verified: not yet compiled; the 780M lane run follows.
2026-11-12 12:52:10 -08:00
Anees Iqbal 72c1dc128f Snapshot reads with no barrier: a draw reads its pass's texture through a snapshot where it can
Route (b), for timing: a draw that reads, at its own pixels, a texture its pass renders, and
writes the color it reads, now takes the snapshot route with no barrier before it too, in place
of the copy taken before the pass. It then reads what the draws before it wrote, the x86 Macs'
answer (docs/API.md's accepted differences), as with a barrier. Where the snapshot route does not
take the draw it reads the copy as before, and the fallback counts under no split reason
(Wanted::split_otherwise).

Verified: not yet; the 780M timing (backdrop_costs, base e303b7adbb against this) decides whether
it stays. Lane tests and docs for the no-barrier answer follow if it does.
2026-11-12 12:52:10 -08:00
Anees Iqbal a5254ead3a Cost lane: backdrop_costs, a window compositor's backdrop reads with no barrier
A release-mode measurement in runtime_lane::attachment_read_costs: one command buffer a frame of
a pass over each of six BGRA8Unorm surfaces (IOSurface planes over private buffers, five layers
loaded and a 3840x2400 framebuffer cleared), each a fill, a draw that reads the surface at its own
pixels with no barrier before it and writes what it read, and another fill. Printed per device
(default, and with extendedDynamicState3ColorWriteMask withheld): the median GPU time per frame
and the work counts per frame. It weighs the copy such a reader takes before its pass against a
snapshot of it.

Verified: not yet compiled; the 780M timing job builds and runs it.
2026-11-12 12:52:10 -08:00
Anees Iqbal 5b969352d5 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 12:47:08 -08:00
Anees Iqbal 82499c710a Test: the in-place check's notes test prints every settled verdict and note
The notes test settles the device's check, then printed only the notes of
shapes the check made no image of. It now prints every verdict
(IN-PLACE-VERDICT) and every note (IN-PLACE-NOTE), among them what the check
found changed where a verdict failed, so a device's report is read from a
settled check: a report printed before the check settles reads Pending for
every verdict. The assertions are unchanged.

Verified: built and run on gem10's 3090 (see the run's job).
2026-11-12 12:45:56 -08:00
Anees Iqbal 090930eebf Queue times: a default-off diagnostic notes when a command buffer became its queue's head and when its submission returned
What: with METAL2VULKAN_QUEUE_TIMES set, each command buffer notes two host times beside its kernel
times (gpu_time::KernelTimes), read through two hidden runtime-extension methods:
- CommandBuffer::queue_head_time: its first batch became the first of its queue's batches the
  scheduler had not taken. Noted as the scheduler takes it in onto an empty line, or as the batch
  before it on its line is taken for submission (Order::next, in the scheduler's passes and a
  committing thread's).
- CommandBuffer::submit_returned_time: the vkQueueSubmit that carried its last batch returned
  (submit.rs for a batch submitted now, group.rs for a group's members). kernelEndTime is that
  call's start, so the two bracket the driver's time in the call.
Unset, nothing is noted and no line is looked up: a relaxed load of the device's flag (read once
from the environment into gpu_time::Timing) per take and per submission.

Why: walkprof5 (m3-max-22376) put commit -> submission start at 37.0 ms p50, while kernel start to
kernel end was 0.008 ms, which does not bracket the vkQueueSubmit cost (the call starts at the
kernel end). The consumer's trace needs to split commit -> submission into time behind the
queue's earlier work and time held at its head, and to see each call's own length.

Docs: env_vars.rs's registry entry and accessor, docs/API.md's diagnostics paragraph, the
validation artifact note's list of variables the runtime reads; api_signatures.tsv blessed (two
hidden methods).

Tests: tests::kernel_end_device::queue_times_are_noted_in_the_order_of_a_queue_s_submissions_and_only_where_asked
(three command buffers on one queue, committed back to back): unasked, both read 0; asked
(Timing::note_queue_times, test-only), head <= kernel start <= kernel end <= returned for each,
heads in commit order, and each submission returned before the next one's kernel start.
2026-11-12 12:45:56 -08:00
Anees Iqbal 000989b78e Host RAM copies: say why the validation layer's write-after-write between a gather's dispatches is no race
What: one comment where a word-wise host RAM copy binds its dispatches' sets. Each dispatch binds
the whole window it writes (a gather's binding 1) and writes only its pieces' words there.

Why: the validation layer's synchronization checks (SYNCVAL_SHADER_ACCESSES_HEURISTIC) count a
bound storage range as written whole, so two dispatches of one window read as a write-after-write.
No word is written twice: a copy whose runs name a destination byte twice goes to rounds of
regions (`twice`). ddsync3-xtx (m3-max-22331 at d9478fc91f, pipelines named): all 54
WRITE_AFTER_WRITE reports name "metal2vulkan: PagesCopy(Gather)", binding 1 of its pushed set.

Verified: comment only; cargo fmt.
2026-11-12 12:45:56 -08:00
Anees Iqbal 38ab829481 Re-bless the golden tables and engine printouts at 757a6f44d2
The 14 profile rows move: every profile's key now covers VK_EXT_multi_draw and multiDraw (SEMANTICS_VERSION
2060's region viewports); no translation hash moves. New rows and the printout for the owned fixture
overlapping_slots (SEMANTICS_VERSION 2059).

Verified: bless on the M3 at 757a6f44d2 (m3-max-22420): golden hashes, engine goldens, printouts and inventory
blessed; merged check at the same sha on msi (m3-max-22419): clippy every crate with --cfg m2v_gpu,
api_signatures, api_surface, fast_paths, rustdoc -D warnings.
2026-11-12 12:45:30 -08:00
Anees Iqbal 757a6f44d2 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 12:39:07 -08:00
Anees Iqbal b223f58b9f SEMANTICS_VERSION 2060, ARTIFACT_FORMAT_VERSION 507, RUNTIME_VERSION 2140: a rate-mapped pass draws its regions 16 at a time through VK_EXT_multi_draw
The commits before this one. Where the device enables multiDraw, multiViewport, shaderOutputViewportIndex and
shaderDrawParameters, a direct draw in a rate-mapped pass of a vertex+fragment pipeline whose vertex function
chooses no slice or viewport asks for the region variant (VariantKey::region_viewports, RuntimeFact::
RegionViewports: a new RuntimeFact, so ARTIFACT_FORMAT_VERSION), whose vertex stage stores DrawIndex as
ViewportIndex. Each batch of k regions (k = min(regions, maxViewports, maxMultiDrawCount - 1)) sets the device's
full batch of viewports and scissors, padded with empty scissors, and records one vkCmdDrawMulti[Indexed]EXT of
as many identical draws as regions. Mesh, tessellated, amplified and indirect draws keep the per-region route.
The route depends only on the pass having a map, so a mutable map's reset changes no pipeline. Also: a pass
left for its draws' pipelines takes its encoding again once they are made, so a map reset after the making is
spliced in instead of refused (rate-map-reset-unencoded); older than the route, made common by it.

Why: a rate-mapped pass recorded each draw once per region (Apple's rate-map sample: about 880k region draws a
host step on the Iris), which filled ANV's dynamic state pool (fixed in RUNTIME_VERSION 2138) and rendered that
sample at 0.9 presents a second on the Iris, against 7.7-10 without rate maps.

Verified (at 287e4d1517, the same code before its rebase onto 155027095f):
- CPU per frame, 3840x2160, quality [0.3,0.6,1.0,0.6,0.3], 256 guest draws of 2624 regions: lavapipe 134 ->
  31.77 ms (m3-max-22356); Iris Xe 187.00 -> 54.64 ms (m3-max-22368); Radeon 780M 140.04 -> 41.86 ms
  (m3-max-22369). Commands a frame 671,744 draws (+ as many viewport and scissor sets) -> 41,984 multi-draws.
- Iris dynamic state (imgleak's probe shape, 2 rounds, m3-max-22368): drm-total growth per heavy command buffer
  about 224 -> 115 MiB.
- Pixels: the batched draws' bytes equal the per-region draws' bytes, plain and indexed, 36 regions as 3
  multi-draws; rate-map lanes, rate_map tests, public_render_cases and depth_executions 90/90 plain and 80/80
  under sync validation on lavapipe (m3-max-22356); all 17 rate-map lanes, 3 depth_executions lanes and the
  pixel test on the Iris (m3-max-22368) and the 780M (m3-max-22369); the reset-after-making lane ran its
  pending path on lavapipe.
- Lint: fmt, rustdoc, clippy default, --cfg m2v_gpu and --cfg m2v_cpu_icd, metal2vulkan with no feature and
  each alone (m3-max-22357, 22370).
Running on the rebased tip: clippy and the translator suite (m3-max-22386), the lavapipe lanes (22387), fmt,
doc and gpucfg clippy (22388). Not measured: a translation census of the vertex variant (the translator tests
bound its added words at 40 or fewer).
2026-11-12 12:38:26 -08:00
Anees Iqbal f10321aad5 A pass left for its draws' pipelines takes its encoding again once they are made
A render pass whose draw's VkPipeline was still being made as it was encoded records as a segment
of its encoder once the pipeline is made (render/pending.rs). A rate map's reset after that
making finished, before the command buffer's commit or after it while the command buffer waited,
encoded the pass again from its log, and the splice refused it: the segment in its place was
neither one whose pipelines are still being made nor work recorded on the GPU alone. The pass
then drew by the map it took and the reset announced rate-map-reset-unencoded, where Metal's GPU
draws by the map as reset. The rate-mapped multi-draw route made this common: its vertex variant
is made at a pass's first draw, so the reset lanes failed by timing
(a_reset_shows_in_a_pass_not_yet_submitted and a_reset_shows_in_every_pass_not_yet_submitted on
lavapipe, jobs m3-max-22179 and m3-max-22244).

The splice now also takes the place of a render pass left for its draws' or tile dispatches'
pipelines alone and executing no render commands (Deferred::left_for_pipelines,
DeferredPass::left_for_pipelines), made since or not: the encoding again recorded those draws
where it found their pipelines made, or left a segment of its own where they were still being
made, and what the first recording took stays retained, as for a segment still being made.

Verified, before the fix: a diagnostic on lavapipe (job m3-max-22327) waited a second after the
draw and refused the splice in both cases ("keeps false gpu_alone false ... making false"),
shading the identity's 64 by 64 pixels with the notice; without the wait the pipeline was still
being made and the splice took it. The new lane
a_reset_shows_in_a_pass_whose_pipeline_was_made_after_its_draw waits for the making
(WorkCounts::variant_pipelines_made) and checks the half map's 33 by 33 pixels and no notice.
2026-11-12 12:37:47 -08:00
Anees Iqbal 2117d6af79 Lane: the batched-region test takes the physical size's u64s as they are
clippy::useless_conversion under --cfg m2v_gpu (job m3-max-22248): the physical size's width and
height are u64 already.
2026-11-12 12:37:47 -08:00
Anees Iqbal 8ae3ee4a26 Rate-mapped batches: route by the pass's having a map, each command the device's full batch
A pass's draws took the multi-draw route only over a map of layers that is not the identity, and
each batch's VkPipeline took as many viewports as the least of the regions' count and the
device's batch. A reset of a mutable map so changed the variant or the VkPipeline its pass's
encoding again draws with: a pass encoded over the identity, reset before its commit to half
quality and again after it to a quarter, was encoded again at the commit with a pipeline still
being made, which leaves work for a host step and so keeps no log, and the second reset could not
encode it again: it shaded the half map's 33 by 33 pixels where Metal shades the quarter's
32 by 32 (runtime_lane::rate_mapped_passes::a_reset_shows_in_every_pass_not_yet_submitted, on
lavapipe, job m3-max-22179).

Now the route follows the pass's having a map at all (draws_region_batches), and every batched
command sets the device's whole batch of viewports and scissors, past its regions its first
viewport through empty scissors (region_states), so the pipeline never follows the map's
contents. The pixels are the region by region route's as before: each draw's ViewportIndex is
its own index, and the padding entries are never indexed.

regions_vary goes: nothing else used it.
2026-11-12 12:37:47 -08:00
Anees Iqbal bc0e2281d5 Re-bless the opened enable chains for VK_EXT_multi_draw
The validation device now opens VK_EXT_multi_draw and its multiDraw feature where the profile
reports them, so each profile's chain gains one member and one extension.

Verified: bless_opened_chains on msi (job m3-max-22182); every row moves by one member and one
extension.
2026-11-12 12:37:47 -08:00