Commit Graph
9097 Commits
Author SHA1 Message Date
Anees Iqbal 75c3e49bd6 Conformance coverage: regenerated for the overlapping-copies row's new refusal
docs/CONFORMANCE-COVERAGE.md quotes each ledger row's reason; the row's words moved with its
refusal (python3 -I scripts/conformance-coverage/coverage.py).
2026-11-22 21:06:39 -08:00
Anees Iqbal 5f4067050a Runtime test: the any-offset buffer copy test names each device and copy it ran
So a card's run shows the copies ran on that card (the path line a device leg prints).
2026-11-22 21:06:39 -08:00
Anees Iqbal c358d9afd7 Runtime: a copy between buffers takes any offsets and size, as plain Metal copies them
A guest's blit copy of 62,302 bytes at offsets 0 and 0 met Refusal::BufferCopyUnaligned. Apple's page
for copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size: asks for multiples of 4 on macOS,
but plain Metal does not stop or round such a copy: it copies every byte of the range and no other.
vkCmdCopyBuffer has no alignment rule for its regions, so the copy is its one region at the
offsets and size the call names, and the refusal is gone.

Measured with probe crates/metal2vulkan-conformance/probes/blit_buffer_copy_unaligned.m, one
universal binary (built in m3-max-69612), copies (source offset, destination offset, size) =
(0,0,62302) (0,0,1) (0,0,3) (1,0,8) (0,2,8) (3,5,4097) and the controls (0,0,64) (4,8,4096),
each between two Shared, two Managed and two Private buffers, every destination byte read back:
- Apple M3 Max, macOS 27.0.1 (26A434), job m3-max-69613: 24 of 24 exact with validation off
  (AGXG15CDevice), 24 of 24 exact under MTL_DEBUG_LAYER=1 (MTLDebugDevice), which printed only
  its banner and took every copy.
- AMD Radeon Pro 5300M and Intel UHD Graphics 630, macOS 26.7.1 (25G241), job m3-max-69614:
  24 of 24 exact on each, validation off.
Every command buffer completed with no error.

The variant, its basis line, its REFUSALS.md rows and its api_signatures.tsv line go; the runtime
README says what Metal measured. The conformance ledger's overlapping-copies row now holds the
overlap refusal its first copy meets (the alignment check ran before it). The consumer's checkout
names the variant nowhere (git grep BufferCopyUnaligned at reims-vgpu 6d83a5d4f8: 0 hits).

Test: every_device_copies_between_buffers_at_any_offset_and_size copies the six ranges between
two Shared buffers and reads every byte back; it fails without the change (the refusal).
2026-11-22 21:06:39 -08:00
Anees Iqbal 7b39f0bae9 Runtime README: on the Mac host, the first submission after an idle pause pays for the bytes in the device's residency set
On KosmicKrisp (Mesa 26.3.1, Apple M3 Max, macOS 27.0.1), a bare Vulkan program's
one-fill submission after a 2 s pause started 18.45 / 23.88 / 24.44 ms (p50 / p90 / max)
after its commit while its device held 6 x 64 MiB, 12.32 ms of it in vkQueueSubmit2 at
the median, against 8.49 / 10.74 / 11.06 ms holding nothing (14 each, m3-max-69600; the
earlier m3-max-69540 read alike). After a 0.1 s pause the held bytes cost nothing
measurable (0.77 against 0.79 ms at the median). Read from the driver's source, not
instrumented: every VkDeviceMemory is a heap in one residency set added to the device's
Metal queue, and every vkQueueSubmit2 commits that set and calls requestResidency.

A Metal reference in the same job, arms interleaved, says whose cost it is: a Metal
program holding the same 384 MiB in a residency set added to its queue, committed once
and never requested, started 19.44 / 26.15 / 26.25 ms after a 0.03 ms commit; requesting
residency before each commit moved 13.18 ms (median) into the calls and left the start
where it was (20.96 / 23.74 / 26.46 ms); the same buffers in no set read like an empty
set (7.85 against 8.37 ms at the median). A Metal 4 queue, the kind the driver uses, read
alike. So at this size and pause the delay is Metal's own for bytes in a queue's
residency set, and the driver's per-submission request moves it into vkQueueSubmit2.
The README's queue gaps now state these rows, the jobs, that the machine was shared and
that the driver was read, not instrumented.

Docs only; the workspace Rustdoc (-D warnings) and doctest check of this commit is its
own job, named where the commit is handed in.
2026-11-22 20:56:53 -08:00
Anees Iqbal da020e5d7b Runtime: a compute kernel that reaches an explicit imageblock gets its state; its dispatch is refused
A compute pipeline state whose kernel reaches an explicit imageblock was refused at its make as
Gap::KernelInput of KernelInputKind::RuntimeFact naming ImageblockSize, which every arm64 macOS
guest boot meets once. The state is now made, and what stays refused is the dispatch, where Metal
reads the extent setImageblockWidth:height: set, which the compute encoder does not have:

- interface() takes RuntimeFact::ImageblockSize, keeping its cell bytes as Interface::imageblock,
  and leaves SpecKey::ImageblockWidth and ImageblockHeight at the module's default (0 by 0)
  instead of refusing them as a specialization it does not set.
- encoder::decide, which the dispatch, prepare_dispatch, dispatch_variant and the main pipeline's
  key all go through, refuses a kernel with an imageblock first, as Gap::KernelInput of
  RuntimeFact naming the fact (RuntimeFact::name). So no VkPipeline of such a kernel is made:
  finish_pipeline has no main key, and a pre-pass gets no key. A dispatch of such a kernel that
  writes no memory records nothing and is not refused, as for any kernel without effects.
- imageblock_memory_length_for_dimensions keeps its typed answer, Gap::ImageblockLength, for a
  kernel that declares an imageblock: the one recording of Metal's answer for such a kernel
  (conformance pipeline-facts-compute-imageblock, M3 Max, 256 bytes at 8 by 4 by 3) settles no rule.

The translator is untouched. Gap and KernelInputKind keep their variants; the docs of
Gap::KernelInput, KernelInputKind::RuntimeFact and Specialization, Gap::ImageblockLength (and its
basis line), the dispatch and the state's make say where the refusal now is. docs/REFUSALS.md,
docs/METAL-COVERAGE.md (setImageblockWidth:height:'s note) and docs/CONFORMANCE-COVERAGE.md are
regenerated. The runtime README's state facts and its known gap are re-worded, with the counts and
jobs kept. The conformance ledger's pipeline-facts-compute-imageblock row moves from case/state to
the facts' label and device (the consumer's own, as for every state) and imageblock_memory_length
(Gap::ImageblockLength). Validation's KernelImageblock requirement doc and its acceptance test's doc
name the dispatch's refusal and the renamed device test.

Test: tests::kernel_input::an_explicit_imageblock_kernel_is_made_and_its_dispatch_refused_as_its_named_runtime_fact
(replacing an_explicit_imageblock_kernel_is_refused_as_its_named_runtime_fact) makes a4_imageblock_extent's
state, reads its imageblock length as Gap::ImageblockLength, gets no dispatch_variant key, and has
one 4 by 2 threadgroup's dispatch refused as Gap::KernelInput of RuntimeFact { fact: "ImageblockSize" }.
2026-11-22 20:15:34 -08:00
Anees Iqbal b2fb0993d7 Runtime README: behind another queue's long work, a command buffer waits for up to two of them
The queue section said a command buffer of another queue committed later
"waits behind no more of it", which reads as the room's 16 ms. That holds for
work within the bound only: a queue always has room for two submissions
whatever their runs, and nothing cuts a command buffer, so behind long ones
another queue's command buffer waits for up to two whole command buffers.

The sentence now says both, and the queue known gaps state the consequence
once: the burst-start count on lavapipe (three command buffers of 30 ms, two
of them, 60 ms, on the VkQueue at an idle queue's commit; job m3-max-69402,
by count, not timing), that the runtime takes no queue priority, and the
Intel Mac's answers on file (UHD 630: commit order unmarked, 0.4 ms beside the
running buffer with the busy queue at a lower GPU priority, job m3-max-68129;
5300M: both at once, job m3-max-68137).

Docs only.
2026-11-22 19:37:38 -08:00
Anees Iqbal e23ac486be Runtime: an indexed draw's command buffer keeps its index buffer until it retires
The draw path kept an indirect draw's arguments' buffer (and an execution's
range buffer) with Building::keep, but never the index buffer of
draw_indexed_primitives or draw_indexed_primitives_indirect, though both docs
say the command buffer keeps it until it retires, as Metal's command buffer
retains what its draws use. A buffer is a view of a block that holds the block
(buffer.rs), so where the buffer was its block's last holder (the consumer's
plain buffers: it drops its block handle once the buffer is made), dropping it
after encoding gave the block back at once (memory.rs Pool::give_back): its
range was a free range of its allocation, a later take could land there and
overwrite the indices before the GPU read them, and with nothing in flight the
allocation itself could go once idle. The index buffer is now kept beside the
arguments' buffer, after the draw's checks and only for a draw that records.

Test: every_device_keeps_index_buffers_dropped_before_the_commit_until_their_draws_retire
(tests/draw.rs): a direct indexed draw and an indexed indirect draw, each index
buffer the one holder of a Shared block, both dropped after encoding and before
the commit, two blocks of the same length then taken and filled with other
indices; the target reads back exact (each half its own draw's colour), neither
block is back in the pool before the retirement, and both are after it.
2026-11-22 19:36:05 -08:00
Anees Iqbal 5110fc3021 Validation: the runtime-row imports live in the Linux-only function that uses them
CI's macOS clippy under --cfg m2v_gpu (run 122057987258 at eb69a32299) denied
two unused imports in candidate/tests/acceptance_pipelines.rs: `RuntimeRow`
and `FunctionConstantValues` serve only `made`, which is
`#[cfg(target_os = "linux")]`. They now sit inside `made`, so every target
that compiles the file uses what it imports. Our own m2v_gpu clippy runs only
on Linux, which is why it did not see them.
2026-11-22 19:35:41 -08:00
Anees Iqbal 71dab7bba8 Conformance: the killed-scratch test asks for the holder's path only when it runs
CI's Linux clippy (`cargo clippy --workspace --all-targets --all-features`,
run 122057987258 at eb69a32299, nightly-2026-11-03) failed to compile
tests/killed_scratch.rs: "environment variable `CARGO_BIN_EXE_scratch-holder`
not defined at compile time". The macOS leg compiled nothing of the crate (its
cache held it), so it says nothing either way.

On our nodes the same toolchain checks the crate with no compiler cache and a
fresh target, and the variable is defined there (job m3-max-69411: the
crate's clippy at eb69a32299 exits 0). What leaves it undefined in CI is not
found; CI resolves the dependencies afresh, with no lockfile, and restores a
target from its cache, and neither is reproduced here.

The path is now `option_env!`, so the file compiles whether or not a build
defines it, and the test asks for it when it runs, where a test build that
links the binary has it. Verified: m3-max-69411 at the fix (9a4bcac58e, the
same diff), the workspace's clippy exits 0 and killed_scratch's 2 tests pass.
2026-11-22 19:35:41 -08:00
Anees Iqbal eb69a32299 Bless: the pin e3a3f5c7dc's golden and census header lines
The pin e3a3f5c7dc moved SEMANTICS_VERSION 2275 -> 2276 (6adfe028d8, a half
vector joined from read lanes keeps their bits). Its one bless at that tip
changes two header lines and nothing else: golden_hashes.tsv's semantics line
(2275 -> 2276) and authored-compile.tsv's product fingerprint. No golden cell
and no census row changed.

Verified: bless job m3-max-69312 on the M3 Max at e3a3f5c7dc:
bless_engine_inventory, bless_golden_hashes, bless_engine_goldens and
bless_opened_chains exit 0, and corpus-triage --audit authored-compile --bless
exit 0. The patch is the job's staged diff, applied unchanged.
2026-11-22 18:57:17 -08:00
Anees Iqbal e3a3f5c7dc Runtime: the queue cut comes off again
Reverts, in one commit, the nineteen commits of c38852d665..c2088436aa
that carry the queue cut and its order fixes (newest first): 333adf36cf
8828e8ad6c daaccb7bb0 4f683ad891 7cd99ae0b1 5f93a64342 6523e2b65c
76f369dbbf 2bcac43a53 c5e98be51d 635da9d820 1f7f77e4cc 4b1cdaf505
9e8baebc48 b1b375b8e1 40a9982a94 02923fb2ae ec24ba8439 69754cb203.
piece.rs and its tests go, and the README rows on the pieces' cost.

Kept: 6adfe028d8 (a half vector joined from read lanes keeps its bits),
7d8aabed34 and c2088436aa (the 780M import-cost rows). Against
c38852d665 the tree differs only by those three commits' paths and
changes. The cut bumped no version, so none moves here.

Why: the fallback for the Iris Xe regression under the planner's 18:00
PST box. The guest's image step reads take-to-show p90 17.16 ms cold and
24.66 ms warm (Iris Xe, the consumer's walks, job 67930) against 4.34 and
4.42 ms before. The cut, with no green fix tip by the box, comes off with
the one-module move that caused it; the cut continues on its own branch.
2026-11-22 16:25:58 -08:00
Anees Iqbal c2088436aa Runtime README: the 780M import-cost row names its memory measure
7d8aabed34 gave the Managed arm's extra memory as "device memory", but the figure is the
runtime's gauges of its own Shared and Private memory (2.3 to 2.5 GiB more). The driver's own
total of device memory also counts the no-copy arm's imports, which are the guest's own pages,
and reads about 1.4 GiB more (2.36 and 2.25 GiB against 3.66 and 3.69 GiB). The column and the
closing sentence now name the gauges and give the driver's totals beside them, so the two
figures do not read as a contradiction.

The figures are from the consumer's runs, jobs m3-max-68988, m3-max-69040, m3-max-69016 and
m3-max-69073. Docs only.
2026-11-22 16:09:59 -08:00
Anees Iqbal 7d8aabed34 Runtime README: the import cost measured on a guest's compute benchmark on the 780M
The imported-blocks cost paragraph gives the cost on idle imports beside a play. This adds what it
measures on a guest's own work. A guest's compute benchmark on a Radeon 780M (RADV, Mesa 26.2.6)
ran two runs in each of two arms:
- on the device's own unified answer, where the guest makes no-copy buffers (about 800 imports live);
- on a two-copy answer given by a probe, where the guest makes Managed buffers (about 120 live).

The no-copy arm spends 0.80 to 0.83 ms in each vkQueueSubmit2 against 0.11 to 0.12 ms, and 12.7 to
13.0 s of the submitting thread's CPU time against 2.3 s. The scored pass takes about 10.8 s longer,
and the score differs by 1.1%. The Managed arm holds 2.3 to 2.5 GiB more device memory.

Jobs m3-max-68988 and m3-max-69040 (no-copy), m3-max-69016 and m3-max-69073 (Managed), from the
consumer's runs on the 780M. Docs only: no product change follows, since the score does not move
past its 5%.
2026-11-22 16:08:34 -08:00
Anees Iqbal 6adfe028d8 Translator: a half vector joined from read lanes keeps their bits; 20 NaN ledger rows
The RTX 5080 Laptop's replay at 2953064a1c (NVIDIA 615.71.09, job m3-max-68835) read 34 sites of
attribute-format-fetches that known-gaps-rt.tsv does not list.

The 29 at attribute3 (`half2 h`, read as Half or Half2) were ours. The case's inputs there are half
NaNs: attribute_coding.rs's Half codes 0x7E01 and 0xFE01, at threads 9 and 10 in component 0 and 6
and 7 in component 1. Metal's recording returns every attribute3 input unchanged at all 29 leaves.
The 5080 differs at as many elements as there are NaNs (2 at Half, 4 at Half2), first at a NaN
(Metal 0x7e01, ours 0x7fff), and its largest difference, 32258, is 0xFE01 - 0x7FFF. That every
differing element is a NaN is read from the counts, the first element and the largest difference,
not from a full print. The kernel only reinterprets the fetched value (`bitcast <2 x half> to
<2 x i16>`), which the module's own contract keeps as the field's bits (PrecisionNote::
NativeNanEncoding: "a `half` stored back unchanged keeps its bits"), so no note covered it.

The cause: fetch::decode joins the lanes it widened with one OpCompositeConstruct. from_bits noted
each lane's bits, but narrow::known_bits looked through struct members and lane inserts only, so
the bitcast's to_bits found no bits for the vector and encoded it: the device's narrowing of the
device's widening. On NVIDIA a half NaN widens to 0x7fffffff (attribute0's answer on all three
NVIDIA cards) and narrows to 0x7fff. Mesa's widening keeps the payload and its narrowing gives it
back, so the Mesa cards showed nothing; the RTX 3090 and RTX 2080 (620.70.06) showed nothing either
(expected: that compiler folds the round trip; unverified).

The class, at the base: three product sites join half lanes whose bits are noted with a vector
construct and lose them there: the pulled fetch (fetch::decode, for a kernel's [[stage_in]], a
pulled vertex attribute and a post-tessellation attribute), math::unpack_float (air.unpack of the
11/11/10 float formats into half lanes) and chunk::from_words (a chunked bitcast's half lanes), and
one test-only one, the arith tests' own load of a narrow vector. Texture reads, ops::of_lanes_bits
and narrow::unpacked_from_bits widen the whole vector at once and note it; lane inserts were
already followed. So the fix is in known_bits, for the whole class at once:

- spirv::builder records the parts of every OpCompositeConstruct of an f32 vector
  (ModuleBuilder::vector_parts, FunctionBuilder::vector_parts), counted in the builder's
  footprint.
- narrow::constructed_bits: a vector constructed of parts whose bits are each known (noted, a
  constant's, or a lane of a vector's noted bits) has the construct of those bits. Nothing is
  emitted when a part's bits are unknown. known_bits tries it before the lane inserts.
- SEMANTICS_VERSION 2275 -> 2276: the modules of every such vector's store or reinterpretation
  change (the encode becomes the construct of the known bits). The golden table is re-blessed on
  development.
- docs/API.md's native-nan-encoding entry and NativeNanEncoding's doc name the vector join among
  the paths that keep a half's bits.

The other 5 sites (attribute0, the `float4` widening of Half, Half2, Half3, Half4 and FloatRG11B10)
are the device's own answer under device-nan-encoding, as the 3090's rows. The ledger takes each
card's rows from the replays of the round at 2953064a1c, named no wider than the card that ran,
each row's detail equal to what the replay printed and its text the template card's whose answer
it shares:
- RTX 5080 Laptop GPU (job m3-max-68835): every payload bit set (0x7fffffff), as the RTX 3090.
- RTX 2080 (NVIDIA 620.70.06, job m3-max-68939): the same 5 answers as the RTX 3090.
- "AMD Radeon 780M Graphics (RADV PHOENIX)" (Mesa 26.2.6): the PHOENIX run (job m3-max-68941) and
  the HawkPoint run (job m3-max-68942) print that one venue and answer as the RX 7900 XTX:
  0x7fc02000 for the halves, 0x7ffe0000 at 9 RG11B10 elements.
- "AMD Radeon RX 550 / 550 Series (RADV POLARIS12)" (Mesa 26.2.6, job m3-max-68993): the same
  answers as the RX 7900 XTX.
The 2080, 780M and RX 550 runs show no attribute3 site. docs/CONFORMANCE-COVERAGE.md regenerated
(ledger rows 7968 -> 7988).

Tests, each failing at the base's product code and passing with the fix:
- lower::arith::tests::narrow::a_constructed_narrow_vector_keeps_its_lanes_bits (interpreter):
  four decoded lanes, two beside the constants 0 and 1.0, and the harness's loaded vector keep
  0x7E01, 0xFE01, 0x7C01, 0xFDFF and the rest bit for bit, where the encode answers 0x7E00.
- tests::engine_kernel_stage_in::a_half_attribute_reinterpreted_unchanged_encodes_no_half:
  stage_in_fetch with Half2 and Half at attribute 3 holds no OpFConvert to a 16-bit float and no
  PackHalf2x16 on any committed profile, with each half form among them (Controlled, Converted,
  and Device, the profiles without shaderFloat16).

Verified:
- This change on 5f93a64342 (probe 73dead9f70, tree 56642f49), compile job m3-max-69015:
  the two tests against 5f93a64342's product code FAIL, with the fix PASS; fmt,
  signatures, clippy --workspace --all-targets --all-features -D warnings plain, under
  --cfg m2v_gpu and under --cfg m2v_cpu_icd, and workspace Rustdoc -D warnings exit 0; the
  metal2vulkan and metal2vulkan-air suites: 3348 tests passed, 22 skipped, peak 11.3 GiB.
- The tree at 8134bb4201 (on c38852d665; its crates/metal2vulkan/src and
  metal2vulkan-air equal 73dead9f70's), recheck m3-max-68965: against the base's product
  code the engine test reads "30 of 30 modules encode a half": every committed profile with Half2
  and with Half, one OpFConvert to 16 bits each, two PackHalf2x16 each on nvidia-pascal-linux and
  runtime-floor (no shaderFloat16). Compile job m3-max-68956 at 9f921a841c (the same translator
  code): the metal2vulkan and metal2vulkan-air suites 3348 passed, 22 skipped, peak 11.9 GiB.
  golden_hashes_match_the_table passed at SEMANTICS 2276 in both suite runs: 0 cells of those it
  compares on Linux moved, so no "bless due"; the cells that need metal-as are compared at
  development's bless.
- RTX 5080 Laptop GPU (NVIDIA 615.71.09), the conformance replay on rt: at 8134bb4201, job
  m3-max-68961, and at 73dead9f70, job m3-max-69047: exit 0, no unlisted site;
  attribute-format-fetches differs only at its listed rows (the 8-bit unsigned normalized
  formats' 1-ulp rows and the 5 new attribute0 rows), none of the 29 attribute3 sites differs,
  and "the 4607 row(s) above are exactly the open gaps known-gaps-rt.tsv expects on this venue".
- States-only play on lavapipe, 9 streams, every MODE line states-only: 8134bb4201 (job
  m3-max-69001) against c38852d665 (job m3-max-68979). In each stream both made the same render
  and compute states and pipelines (gb-3090-r2: 10643 render, 15299 compute, 568 pipelines;
  glbench-780m-r4-recnil: 3756, 484, 498), refused 0 and left 0 unattempted. 8134bb4201's
  translator code equals 73dead9f70's.
- Not run: the RTX 2080's, the 780M's and the RX 550's rows are as those cards' replays printed at
  2953064a1c; their replays with this change are the next round's. "The RTX 3090 shows nothing at
  attribute3" stays unverified.

The branch is rebased onto development after the jobs; the commits between 5f93a64342 and its
base change runtime files alone (crates/metal2vulkan-runtime), none of this change's.
2026-11-22 15:51:40 -08:00
Anees Iqbal 333adf36cf Runtime: a head held behind an idle queue's sharer is staged into a group of its own, held
What: next_ready skips a head that sends_past holds only where it would join a group held whose
first command buffer sends_past does not hold. Otherwise it stages the head as before: into a group
of its own, or into a held group whose first is held too. Such a group waits in its queue. It has
no room and wants none, and no host wait sends it through (has_room, wants, goes), until the
earlier commit is submitted.

Why: 530842c0bc skipped every such head, so it stayed committed and unscheduled until that commit
was submitted. every_device_submits_a_write_on_an_idle_queue_before_another_queues_later_read
waits for its reader to be scheduled, held in a group for the device's room. It timed out at the
reader's status on lavapipe (m3-max-68984, 674 of 675) and on the Iris Xe (m3-max-68985, 676 of
677). A held group goes only by those three gates, so staging the head into one changes no
order. Skipping it is needed only where it would join a group that goes before the earlier commit.

Verified: not run when committed; its jobs follow.
2026-11-22 15:37:40 -08:00
Anees Iqbal 8828e8ad6c Runtime: no work goes before an earlier sharer of another queue that Metal submitted at its commit
What: one predicate in submit.rs, WorkState::sends_past(index, pending). It answers whether
`pending`, a command buffer of the FIFO at `index`, would go before an earlier commit of another
queue that Metal had submitted at its commit (Fifo::idle_first: the first command buffer not yet
submitted of a queue committed to it idle, with a part ready) and that shares a tracked resource
with it (by the hazards' ids), or where either reaches memory outside its resources. It replaces
the host-wait-only sends_past and is asked at every place that lets work go:
- next_ready: such a head is not staged, nor a head that would join a group whose first is such
  a one (the head choice);
- has_room and wants: such a FIFO has no room and wants none, so it holds no other queue back by
  rank (the FIFO choice, and the groups that go at once, which stage only with room);
- goes and waits_for_room: no host wait sends it through (the host-wait send).
A group is asked by its first command buffer (Fifo::sends); those that joined it go with it.
wants takes the FIFO's index in place of the FIFO, for the predicate.

Why: the planner's (h3) shape, a regression of the cut. C, committed to an idle queue, is held by
block_shared behind X, a cut command buffer of another queue it shares with. While held, C wants
nothing. D, a sharer of C on a third queue committed after C and sent by no host wait, then took
the room between X's pieces and copied C's buffer before C wrote it. Metal submits C at its
commit, so its hazard tracking orders D after C.

goes_before stays separate. It orders the closes of groups that all go now within one pass and
holds nothing. sends_past decides whether work goes at all. They overlap only for sharers, and
there goes_before still orders the groups that go without a room check: at teardown (stop), and a
fence updater sent through by its waiter (updater_held).

The over-hold row: the holder is still read when the work is staged or takes the room, not at
its commit, as the host-wait rule read it. That is unchanged in kind, but it now covers every send,
not only a host wait's. Two readers of one resource share it here, as in the cut rule (no read or
write mode is kept per resource), so a read waits behind an idle queue's earlier read of the same
buffer, which Metal does not order: an over-hold, now written in the README. No more is held:
an earlier commit not submitted at its commit (its queue's work ahead of it), or one whose next
part waits for an event not yet met, holds nothing, as before.

Seen, not patched (each a shape of its own): updater_held sends a fence updater through to its
waiter with no room check, so an updater held by this rule would still go.

README: the cross-queue paragraph's host-wait sentence now states the rule for every send, the
(h3) case and the over-hold.

Verified: not run when committed; its jobs follow.
2026-11-22 15:37:40 -08:00
Anees Iqbal daaccb7bb0 Tests: the later-sharer test prints the device's counts once all completed too
What: every_device_copies_an_idle_queues_copy_of_a_long_write_into_a_later_sharer prints the
device's metrics a second time, once every command buffer has completed and before its assertion.

Why: the planner's reading of the (h3) job needs proof that the second copy's submission went
before the writer's last piece. That proof is Metrics::pieces_passed: a submission of a queue that
went to the VkQueue while another queue's cut command buffer still had pieces not submitted
(WorkState::close counts it while that command buffer is still its queue's head, and the head
leaves its FIFO once its last piece is staged). The first copy is held until the writer's last
piece is staged, so in this test only the second copy can make that count. The first print comes
before the gate opens, before any of that happens.

Verified: not run when committed.
2026-11-22 15:37:40 -08:00
Anees Iqbal 4f683ad891 Tests: the later sharer's queue has a known short run, so it fits the room behind the pieces
What: in every_device_copies_an_idle_queues_copy_of_a_long_write_into_a_later_sharer, the third
queue first runs one command buffer with no commands, and its expected run is then set to
BODY_RUN (1 ms, the test's own input), before the busy gate is made.

Why: in job m3-max-68964 the test passed on both arms, 3 of 3. On the cut arm it printed cuts 5
(the writer's six pieces) and shared_holds 1 (the first copy held). But the second copy's queue had
no expected run, so its group asked for room at u64::MAX, and room() takes such a group only with
fewer than two submissions in flight. The writer's pieces, each of run 0 and ranked behind it,
kept two or more in flight until the last one was staged. That released the first copy, which is
committed earlier and also at turn 0, so it ranks first. So the second copy followed the first
because of its own unknown run, not because of a rule that orders it after the first. With a run
of 1 ms the second copy fits room(), and its rank, turn 0, comes before the writer's next piece.
That leaves the planner's (h3) shape free to show.

Both items are on development c38852d665 too (QueueInner::set_run_for_test, BODY_RUN).

Verified: not run when committed.
2026-11-22 15:37:40 -08:00
Anees Iqbal 7cd99ae0b1 Tests: an idle queue's copy of a long write, then a later sharer of a third queue with no host wait
What: every_device_copies_an_idle_queues_copy_of_a_long_write_into_a_later_sharer. Behind the busy
gate, a writer on one queue makes six dispatches of x = x * 2 + 1, two kernels of unknown rate in
turn, so a runtime that cuts by a kernel's rate makes six pieces, more than the device's room
takes. Then a copy of its buffer is committed to an idle queue, and a copy of that copy is
committed to a third idle queue, with no host wait. An empty command buffer committed after them
is scheduled before the gate opens. The test asserts the words Metal's order gives: 63 in the
written buffer, the first copy and the second. It prints the device's counts once the copies were
seen, so a run shows its cuts and shared holds where the tree counts them.

Why: the planner's (h3) shape. A command buffer held behind a cut sharer of another queue wants
nothing for the device's room, so a later sharer of it on a third queue that no host wait sends
could go before it. Metal submits the first copy at its commit, as its queue has nothing ahead of
it, and its hazard tracking orders the second copy after it (the runtime README's "Queues, command
buffers and events" rule, from the M3 Max rows of job m3-max-68673).

The test uses only items that development c38852d665 also has, so it runs there unchanged.

Verified: not run when committed. Its lavapipe arms job (base c38852d665 with this commit, and
this tree) follows.
2026-11-22 15:37:40 -08:00
Anees Iqbal 5f93a64342 Runtime README: the RX 7900 XTX's benchmark score is 3.7% lower with the pieces, cause not found
What: a known gap under Queues. A guest's compute benchmark on an RX 7900 XTX (RADV, Mesa 26.2.6)
scores 3.7% lower on the mean with the pieces over eight runs: 118,115 against 122,618. The line
gives all eight runs with their jobs and builds.
- Pair one, with the pieces at f21db0934c against no pieces at f979769faf: jobs m3-max-68746,
  m3-max-68756, m3-max-68738 and m3-max-68783.
- Pair two, the deciding chain, with the pieces at fa77a9035b plus counters (c59f5ced31) against
  2953064a1c: jobs m3-max-68959, m3-max-68974, m3-max-68955 and m3-max-68969. Every run with the
  pieces scored under every run without, and the means are 3.35% apart.

What was read is in the line:
- the submissions, held starts, GPU busy time and wall time are level, and the time inside the calls
  is 84 ms more over a 118 s pass;
- one workload's GPU time is higher in every run with the pieces, by 7.0% over the last pair and
  10.5% over the eight, though it is cut 1 to 6 times a run;
- the other workloads are mixed.
A clock sentence was withdrawn by the planner before this commit: the run with the highest
busy-weighted clock of the chain (1,624 MHz) has its lowest score.

Why: rung 4 of the workaround ladder, by the planner's rule set before the chain read. No single
form wins on every device, so the form best on the slowest GPU is taken and the loss on the others
is recorded. On the Iris Xe the pieces bring the image step's frames over 16.7 ms from 6 and 17 to 0
warm, and its score is level, as is the RTX 3090's. One boxed lane reads that workload's per-command-
buffer output and one play; it gates nothing.

Verified: a README change alone. The rows are the consumer's benchmark logs and per-10 s summaries
as reported.
2026-11-22 15:34:25 -08:00
Anees Iqbal 6523e2b65c Runtime README: the RTX 3090's benchmark score with the pieces is level, by both alternated pairs
What: the known gap of each piece's submission cost said the 3090 guest scored 6.3% higher with the
pieces. That rested on one base run, 75,949 (job m3-max-68789). The second base run, job
m3-max-68954, scored 80,946, above both runs with the pieces: 80,706 (m3-max-68865) and 80,730
(m3-max-68889). So the sentence now gives all four runs and says the score did not move beyond
the base runs' own spread. The base arm spreads 6.6% and the pieces arm 0.03%; the means are 2.89%
apart.

The host side gives both pairs:
- submissions 23,670 and 23,489 with the pieces, against 20,750 and 20,406 without;
- 912 and 923 ms inside the calls, against 606 and 666 ms.
The clocks were the same in all four runs (busy SM p50 1,935 MHz, mostly P2), by the consumer's
clock block.

Why: the planner read the 3090 cell as spread, and the old sentence claimed a gain the rows do not
show. The Iris sentences stand.

Verified: a README change alone. The rows are the consumer's benchmark logs as reported. Workspace
Rustdoc is next.
2026-11-22 15:14:56 -08:00
Anees Iqbal 76f369dbbf Runtime README: each piece is a submission, and what that costs a guest's benchmark on the Iris Xe and the RTX 3090
What: a known gap under Queues. Each piece of a cut command buffer is a submission, so the host
pays a vkQueueSubmit2 call's price once per piece. The line records a guest's compute benchmark
with the pieces (f21db0934c) against no pieces (f979769faf):
- Iris Xe (ANV, Mesa 26.2.6), one timed pass each, jobs m3-max-68858 and m3-max-68837:
  - 63,704 submissions against 18,764;
  - 47.1 s against 15.3 s inside the calls;
  - 49.1 s against 15.8 s of submit-thread CPU;
  - equal GPU busy time, and a score 0.36% lower.
- RTX 3090 (NVIDIA 620.70.06), jobs m3-max-68865 and m3-max-68789:
  - 14% more submissions;
  - 912 ms against 606 ms inside the calls;
  - a score 6.3% higher.

Why: the planner ruled that the Iris's host cost is not a gate on the cut. It is a known gap that
lands with the cut, so the trade-off is on development the moment the cut is. The existing
instruction-cost line covers encoding, not submissions.

Verified: a README change alone. The rows are the consumer's benchmark logs as reported, with the
driver from each run's own device line.

Verified for the re-land's commits before this one, which say "Verified: pending". They were
checked at their tree before the rebase onto c38852d665 (64c010de39). The rebase dropped only
d8703833f0, whose patch is c38852d665's, byte for byte, so the source tree is the same.

The fixes:
- be23534527, the cut back with 53bf3a3f3c's rule ported into its submit.rs;
- c5e98be51d, a queue whose work all completed takes turn 0;
- 2bcac43a53, what a host wait sends waits for a sharer that Metal had submitted.

The checks:
- lavapipe, m3-max-68912: fmt, signatures, clippy plain / m2v_gpu / m2v_cpu_icd and workspace
  Rustdoc all green. The rt suite ran 674 tests, all passed, 3 skipped. That includes the pieces
  tests, the hold-spin forms, the room-hold forms and the ruling-6 overlap test.
- lavapipe, m3-max-68913, the three wait-split tests (T1 send, T2 behind busy work plus a host
  wait, T3 a stale idle queue), 3 rounds of each arm:
  - all fixes: 3/3 each;
  - without 2bcac43a53's rule: T2 fails 3/3;
  - without c5e98be51d's: T3 fails 3/3.
- lavapipe, m3-max-68901, the cut before the re-land: the tests alone fail 3/3; with the port, T1
  passes and T2 and T3 fail.
- lavapipe, m3-max-68891, development 165ef68096 with the tests, where the cut is not: T2 passes
  3/3. So T2 is the cut's own.
2026-11-22 14:52:05 -08:00
Anees Iqbal 2bcac43a53 Runtime: what a host wait sends waits for a sharer of another queue that Metal had submitted
What: a queue sent through by a host wait (Work::send, send_now) goes through only once no command
buffer of another queue, committed before one it sends, the first not yet submitted of a queue that
has submitted nothing since a commit found it idle (Fifo::idle_first), with a part ready, and
holding a buffer or texture it holds by the ids the hazards track them by (or where either reaches
memory outside its resources), is left unsubmitted (WorkState::sends_past). Until then it waits
for the device's room, whose order sends that one first. The runtime README says so.

Why: on the cut the device's room is shared. With busy work of a third queue filling it, a command
buffer that fills, waits for an event and fills again on an idle queue is held up to its wait in a
group for room, and a later command buffer of another queue that copies what it filled and signals
the event, sent by a host wait, went past the room and ahead of it: its copy read none of the
fill. Metal submits the first at its commit and orders the copy after its fill before the wait
(the conformance case event-signaller-of-a-wait, M3 Max, job m3-max-68673). Only such a pair is
held, and only until the first's ready part is submitted; a command buffer committed behind its
own queue's work holds nothing, as on Metal (the README's M3 Max rows).

Verified: pending.
2026-11-22 14:51:17 -08:00
Anees Iqbal c5e98be51d Runtime: a queue whose work all completed takes turn 0 at its next commit, seen or not
What: WorkState::push reads the progress value the completion thread has seen complete
(Done::completed), passed in by enqueue and commit: a queue with nothing queued and nothing in
flight past it takes turn 0, as one that never submitted.

Why: the submit thread forgets a queue's completed submissions only as it next looks (settle), and
a completion with nothing held does not wake it. So a queue whose last submission had completed
kept its old turn at its next commit, and a later commit of another, idle queue ranked before it
(rank) and went first, the first's fill before its wait passed. Metal submits a command buffer
committed to a queue with nothing ahead of it at its commit (the runtime README's M3 Max rows).

Verified: pending.
2026-11-22 14:51:17 -08:00
Anees Iqbal 635da9d820 Runtime README: the 3090 read's build with pieces also fetches stage input, outside the encoders' path
What: the known gap of the pieces' instruction cost named f979769faf as "the same runtime with no
pieces". The build it was read against, fa77a9035b, also carries the stage-input fetch
(a916e61185), so the line now says so, and that the fetch changes pipeline creation and no
encoder's path.

Why: the two arms differ by more than the pieces. By diff, a916e61185 changes encoder.rs only by
documentation and a new method that always refuses (set_stage_in_region_with_indirect_buffer),
and pipeline.rs in device pipeline creation, Compiled's build and interface(), so the encoding
thread's per-command-buffer and per-encoder counts are the pieces' alone. That is a read of the
diff, not a measurement.

Verified: a README change alone; see the job named where it is handed over.
2026-11-22 14:51:17 -08:00
Anees Iqbal 1f7f77e4cc Runtime README: the pieces' cost in instructions and the Iris Xe's cross-queue wait, as known gaps
What: two known gaps under Queues. The first records what the pieces cost on the compute
harness: the encoding thread's instructions a command buffer on an RTX 3090 (burst_2000 +1,239,
2.5%; burst_160 +1,609, 3.5%; burst_160_shared +1,633, 2.7%; frame_5cb +1,843, 2.8%; burst_2000x5
+4,566, 4.4%, about 830 for each compute encoder past the first; the one-command-buffer rows +952
to +1,166), the remainder counts on an RX 7900 XTX (+964 and +883, and 848 to 1,014 and 550 to 745
with parts of the path put back, 710 and 465 with all of them: spread over the path, nothing
built), and the times, of which none moved 3% or more beyond its spread. The second records the
Iris Xe's two_queues waiter: its GPU start 30.4 us after the signaller's end at the median,
against 9.0 us with no pieces (where the waiter waits is not placed), and the late frames the pieces
bring in on that device (23.7 ms against 34.8 ms at the median, committed to completed).

Why: the close rule is widened from the burst rows to every harness row: every row over 3%,
burst or not, goes into the known gaps with its number; a row over 5% whose loss is a fixed
amount a command buffer is recorded beside the Iris's +21 us line; a row over 5% whose loss
grows with the work is a regression of the cut. In the randomized read no time row is over 3%
and none over 5%, so no row goes beside the Iris line and none is a regression; the instruction
rows over 3% (burst_160 3.5%, burst_2000x5 4.4%) are recorded. The form stays: no other form
that keeps Metal's order was found to fix the Iris Xe's late frames, which the pieces do.

The read: compute harness, RTX 3090, job m3-max-68794, exclusive, four rounds of the two builds
in random order (A B, A B, B A, A B), every run at P0 but six samples
at P8 at round 1's start: A is f979769faf (harness built in job m3-max-68792), B is fa77a9035b
(job m3-max-68791). B against A, means of four runs, each arm's spread: bind_2000 +2.6% (1.2%,
2.5%), burst_160 +0.1%, burst_160_shared +0.2%, burst_2000 +0.1%, burst_2000x5 +0.2%,
frame_5cb_from_idle +0.0%, all read pass; frame_5cb +0.4% (4.4%), waves +2.9% (5.6%),
constant_private -3.3% (4.2%), sampling_distinct_512x512x16 -0.8% (3.5%),
sampling_distinct_64x64x16 -19.5% (one A run at 77.0 us against 36.7-37.3), all read not
resolved. The harness has no second size of bind_2000 or constant_private;
sampling_distinct_64x64x16 is the second size of sampling_distinct_512x512x16. The Iris rows are
jobs m3-max-68441, m3-max-68517, m3-max-68545 and m3-max-68608; the remainder, job m3-max-68607.

waitshare's fix (53bf3a3f3c) is on development, not on queue-cut, so no part of it rides here.

Verified: a README change alone; see the job named where it is handed over.
2026-11-22 14:51:16 -08:00
Anees Iqbal 4b1cdaf505 Tests: the room-hold present tests signal a semaphore of their own, which the stand-in present waits on
What: presenting_by_room presents with a binary semaphore it makes (present.rs's semaphore()),
and once both command buffers complete, the stand-in present (show()) waits on it and copies the
image out; the semaphore is destroyed with the stand-in.

Why: the present named VK_NULL_HANDLE, which present_drawable's contract does not allow (ready is
a binary semaphore of the device). With the spin fixed, the presenting command buffers reached
the device, and both forms ended in SIGSEGV on lavapipe (m3-max-68769 at c4ba1b9d1d), the
submission signalling no semaphore at all: the tests' own error, not the runtime's.

Verified: see the jobs named where it is handed over.
2026-11-22 14:51:16 -08:00
Anees Iqbal 9e8baebc48 Runtime: behind a cut head waiting for room, what would be sent through waits in its queue's order
What: next_ready does not pick an entry that hold() would send its queue through to (ended before
it went, nothing for the GPU, or presenting: Entry::sent_through, the one condition both now
read) while the FIFO's head that waits for room is a cut command buffer. The FIFO offers nothing
until room comes; the head's pieces go at the room's pace, and the entry goes behind them in the
queue's order, scheduled as it reaches the head (or, presenting, once submitted). The runtime
README's room paragraph says so.

Why: the submit thread spun with the work lock held. Behind a cut head waiting for room
(waits_for_room's None arm), next_ready returned the first entry not held, with waits; hold()
took its early return for it (ended, empty or presenting), raising send_through and leaving it
unheld, and a cut head never goes through on send_through (waits_for_room's `through`), so
nothing next_ready reads changed: pass() continued on Staged and picked the same entry again, for
as long as the room stayed full. Completions are settled only at pass()'s top and commits wait
for the lock, so the room never came back. A cut command buffer of three or more pieces waits for
room at its third piece by room() alone, so the window opened during each such command buffer's
run. The fix holds Metal's order within the queue: the entry completes after the head and is
scheduled no earlier than it.

Verified: the four forms, each a test and a process of its own, hang without the fix and pass
with it on lavapipe; with the compile check, the pieces tests and the runtime suite on lavapipe:
see the jobs named where it is handed over.
2026-11-22 14:51:16 -08:00
Anees Iqbal b1b375b8e1 Tests: each room-hold form is a test of its own, so no hung form masks another
What: the pieces test becomes every_device_retires_an_empty_command_buffer_behind_pieces_waiting_for_room
and every_device_retires_an_ended_command_buffer_behind_pieces_waiting_for_room, and the present
test every_device_retires_a_presenting_command_buffer_behind_pieces_waiting_for_room and
every_device_sends_a_cut_presenting_command_buffer_as_the_room_comes, each one form through a
shared body (behind_pieces, presenting_by_room) on a device of its own, under nextest a process
of its own.

Why: a hung form ends its process (exit 101 past the 10 s bound), so in m3-max-68758 the ended
form and the cut presenting form never ran behind the empty and the present-behind forms that
hung. Each form now shows its own answer.

Verified: see the jobs named where it is handed over.
2026-11-22 14:51:16 -08:00
Anees Iqbal 40a9982a94 Tests: the two room-hold tests show their window by the head's status and its pieces sent
What: both tests (pieces.rs, present.rs) show the window open by the cut head's status,
Scheduled, and two of its four pieces submitted 50 ms after the second went, asserted and
printed before the command buffer under test is committed. They no longer wait for
Metrics::held_for_room to rise.

Why: a cut command buffer whose later pieces wait only for room is scheduled with its first
piece and marked held there (WorkState::step, the cut-and-leads arm), with no held_for_room
counted; hold() never takes it. So the count never rose, and both tests timed out in their
window wait, 60 s, before committing anything (m3-max-68752 at 31a1f91891, m3-max-68755 at
acfac8f4d2): the window was not shown, and nothing was tested.

Verified: see the job named where it is handed over.
2026-11-22 14:51:16 -08:00
Anees Iqbal 02923fb2ae Tests: a presenting command buffer behind or among pieces waiting for room goes
What: every_device_retires_a_presenting_command_buffer_behind_pieces_waiting_for_room, with
present.rs's stand-in drawable, behind the busy gate, the kernel's rate 3 ms a threadgroup (the
test's input), in two forms:
- behind: a cut command buffer of four pieces has two on the device and its head held for room
  (Metrics::held_for_room); a command buffer of its queue that only presents the drawable is
  committed behind it, and retires after it.
- cut: another queue's cut command buffer holds the room the same way; a cut command buffer that
  presents, its first piece waiting for that room, is committed, and goes as the room comes.
The window is printed before each commit. The commit and both completions are waited for on
another thread within 10 s each; past that the test ends its process. Every step lands.

Why: the present forms of the planner's spin read: hold() takes its early return for an entry
that presents and leaves it unheld (submit.rs:1811-1814), while a cut head never goes through on
send_through (:1696).

Verified: see the job named where it is handed over.
2026-11-22 14:51:16 -08:00
Anees Iqbal ec24ba8439 Tests: an empty or ended command buffer behind pieces waiting for room retires after them
What: every_device_retires_an_empty_or_ended_command_buffer_behind_pieces_waiting_for_room. A
cut command buffer of four pieces (the kernel's rate 3 ms a threadgroup, the test's input) has
two on the device behind the busy gate and waits for room for the rest, the head held for room
(Metrics::held_for_room), shown before anything else is committed. Behind it on its queue comes
a command buffer that holds nothing for the GPU, or one ended before it went (a fill, enqueued,
its queue abandoned, then committed). Its commit and both completions are waited for on another
thread within 10 s each; past that the test ends its process, as a submit thread spinning with
the work lock held lets no handle drop. Both retire, the pieces first, every step landing.

Why: the forcing test of a spin the planner read in submit.rs: hold() takes its early return for
an entry that is ended, empty or presents and leaves it unheld (submit.rs:1811-1814), while a cut
head never goes through on send_through (:1696), so next_ready can return the same entry with
waits for room forever, and pass() continues on Staged with the lock held (:2440).

Verified: see the job named where it is handed over.
2026-11-22 14:51:16 -08:00
Anees Iqbal 69754cb203 Runtime: the queue cut comes back, as it stood at f0b6fff640, for its fixes to build on
This reverts e3d30c5101. With it, the runtime crate, its README, its tests and api_signatures.tsv
equal f0b6fff640 again: the queue cut, its fixes 1 and 2, the cycle fix, the rate inputs of the
tests, and the README's cross-queue rule with its known-gap line.

This branch carries the cut until it re-lands on development as one series. It re-lands when the
spin fix is green in all four forms, and the XTX compute benchmark is within 3% in an alternated
pair or the owner rules on the trade. It also waits for the wait-split sharer fix, if that is the
cut's regression.

Verified: the tree equals f0b6fff640's (git diff f0b6fff640 HEAD is empty).
2026-11-22 14:51:16 -08:00
Anees Iqbal c38852d665 Tests: the wait-split pair behind busy work, and on a queue whose last work completed unseen
What: the wait-split test's pair is a helper, wait_split, with Metal's answer beside it
(metal_wait_split). Two more tests run it: every_device_copies_an_idle_queues_fill_before_its_wait_behind_busy_work
(a third queue's busy work holds the GPU and fills the device's room, the copy sent) and
every_device_copies_a_fill_before_its_wait_on_a_queue_whose_last_work_completed (the first's queue
ran one command buffer, held on the GPU by the busy gate until the submit thread is parked, then
let complete before the first is committed, so the thread has not seen it complete; the copy not
sent).

Why: the two shapes a runtime whose room is the device's can pass the fill in: a group held for the
device's room that a host wait's group passes, and a queue whose completed work the submit thread
has not yet seen, so its next commit does not count it idle.

Verified (this tree, as 22d01fe06d): the three wait-split tests on lavapipe (Mesa 26.2.4), each
alternated without 53bf3a3f3c (reverted) and with it, 3 rounds: 0 of 3 pass without, 3 of 3 with,
the copy reading [0 x256] without against Metal's [1 x128, 0 x128], m3-max-68891; compile at
34157fd7cc, its change before the rebase onto 165ef68096, m3-max-68811; the runtime suite on the
RTX 3090 660 of 660, m3-max-68892, and on the Iris Xe (RPL-P, ANV) 660 of 660, m3-max-68893.

Verified for 53bf3a3f3c (was b270a7c0d3): compile m3-max-68795; lavapipe test 0 of 3 without the
fix, 3 of 3 with it, window forced, m3-max-68796; prioform's case replay differed only at the
accepted timing site, m3-max-68796; lavapipe rt 654 of 654, m3-max-68797; with this commit's
tests on top, RTX 3090 rt 660 of 660, m3-max-68892, and Iris Xe rt 660 of 660, m3-max-68893.
2026-11-22 14:47:58 -08:00
Anees Iqbal 165ef68096 Runtime: a helper that ends before its reply is kept as StageBreach::Ended, refused like Time
A stage helper that ends before its whole reply, with no end of the consumer's (no cap, no time
limit, no cancel), had no breach to be kept as. fill_stage answers StageFill::Ended and keeps
nothing, so every later make, prepare_dispatch and dispatch of that pipeline answered
Error::StageUnfilled again with no limit. A consumer that asks again meets the same end each time.
On the Iris Xe (ANV, Mesa 26.2.6) a heavy kernel at 1,024 threads a threadgroup ended its helper
eight times in a row that way (job m3-max-68748). The fault is in libvulkan_intel.so under the
helper's vkCreateComputePipelines (jobs m3-max-68793 and m3-max-68824).

StageBreach::Ended is that end. The consumer records it through record_stage_breach, the one way an
end is kept. It is kept and refused as Time is (Gap::StageSize, StageGap::Breach), with no helper
asked again: the first such end is the answer, and there is no count and no retry. A crash is not
StageBreach::Compile, which says the driver answered an error.

A kept end must not outlive a fix of ours to the helper. The entry holds, beside its byte, the
helper version it was kept under: HELPER_VERSION, 4 bytes, the way a Memory entry holds its
ceiling. An entry under a lower version is a miss and is removed, so the make asks for a fill
again. HELPER_VERSION starts at 1, and its doc says to bump it with every change to what the
helper's own code does (serve_stage, serve, compile, read_request). The stage key, WIRE_VERSION,
fills and the other breaches are unchanged.

Tests:
- an_ended_breach_holds_to_its_helper_version_and_is_a_miss_below_it: an ended entry kept under
  HELPER_VERSION is 62 bytes and reads back under every ceiling. One under a lower version, with
  no version, or with a cut version is a miss and is removed. The digest of the helper's code text
  must equal the pair recorded for the current HELPER_VERSION, so a change to the helper that
  misses the bump fails there.
- a_helper_that_ends_before_its_reply_is_kept_as_an_ended_breach (device): a helper that reads the
  request and ends with no reply gives StageFill::Ended. Once that is recorded, the next make, and
  a later device's on the same directory, answers Gap::StageSize(Breach(Ended)) with no fill.

The runtime README's stage section records the Iris end, as read with a debugger, and the Ended
breach's line. The signatures table gains the variant. docs/REFUSALS.md and basis.rs were
regenerated and did not change.
2026-11-22 14:30:24 -08:00
Anees Iqbal 722872edec Runtime README: the 780M modifier answer says what was asked and answered
What: the known gap for a texture over a dma-buf's one import on the Radeon 780M now states
the DRM_FORMAT_MOD_LINEAR answer as asked: offered at the program's pitch for the usages asked,
the image requiring a dedicated allocation (job m3-max-68847). It adds that an import of its own
per texture was not tried and is not built, and sizes what it could remove: 3.54 GB of the
40.49 GB a guest's run copies over its imports (job m3-max-68603), under 5% of each workload.

Why: the earlier wording read as if the device had no in-place form, which was not shown.

How verified: docs only; the figures are the jobs' printed answers.
2026-11-22 14:27:40 -08:00
Anees Iqbal ed91da1c04 Runtime README: the 780M's dma-buf texture answers and the import copies' share per workload
What: the known gaps of memory blocks gain the Radeon 780M's answer for a texture over a
dma-buf's one import. Its external image query refuses the dma-buf handle with LINEAR tiling for
every usage asked, while the same linear image without the handle takes the program's pitch.
With DRM_FORMAT_MOD_LINEAR tiling the image is offered at that pitch, but it requires a
dedicated allocation. The textures' known gap on counted copies gains the share of its timed GPU
time each workload of a recorded compute play loses to the copies over imported buffers.

Why: the copies over a dma-buf import had no measured cost, and the gap line did not say which
part of the driver's answer refuses.

How verified: the format queries ran on the Radeon 780M (jobs m3-max-68787 and m3-max-68847).
The shares are from the recorded play in job m3-max-68694, which alternated the no-copy buffers
as udmabuf imports against the runtime's own Shared memory. The leading uploads' GPU time is
exact; copies inside a command buffer are bounded by the time those command buffers lose
against the other arm, paired by command buffer. Docs only.
2026-11-22 14:24:43 -08:00
Anees Iqbal 53bf3a3f3c Runtime: of the groups that go at once, the one committed first goes first
What: before the submit thread closes a group, each other queue's group that goes now and whose
first command buffer was committed before every one it holds goes first (WorkState::goes_before,
Fifo::first_committed), and the group right after, before anything more is staged.

Why: a command buffer that fills, waits for an event and fills again, on an idle queue, is staged
up to its wait into a group that goes only at the end of the pass, as that segment holds no
signal. A command buffer of another queue committed after it, which copies what it filled and
signals the event, went at its signal, ahead of that group, so its copy read none of the fill.
Metal submits the first at its commit and its hazard tracking orders the copy after the fill
before the wait (the conformance case event-signaller-of-a-wait, M3 Max, job m3-max-68673). Both
groups go now either way; only their order changes, and nothing waits longer.

Verified: pending.
2026-11-22 14:09:06 -08:00
Anees Iqbal d271b7523d Tests: an idle queue's fill before its wait is copied by a later sharer of another queue it sends
What: the device test every_device_copies_an_idle_queues_fill_before_its_wait_into_a_later_sharer_it_sends.
On one idle queue a command buffer fills the first half of a tracked buffer with 1, waits for a
shared event's value 1, then fills the second half with 3; on another idle queue, committed after
it, a command buffer copies the buffer and signals the value, and the host sends it (send_now).
The submit thread, parked in a scheduled handler, first looks at the two once both are committed
and the second sent. The test checks that the copy reads 1 in the first half and 0 in the second,
as Metal's did (the conformance case event-signaller-of-a-wait, M3 Max, job m3-max-68673), and
bounds every wait.

Why: the conformance case read 0 in the first half on lavapipe (job m3-max-68692): the copy ran
before the fill ahead of the wait.

Verified: pending (the before-run on lavapipe).
2026-11-22 14:09:06 -08:00
Anees Iqbal 542ae6d906 Runtime README: the corpus's 26 kernels past the stage bound by profile, and two of them filled on three cards
Under "Kernels past the stage bound": the private corpus's kernels compiled for every committed
profile with no device hold 26 past the bound on some profile (25 on each NVIDIA, AMD and Intel
profile, 26 on moltenvk-m3 and the lavapipe profiles, 24 on runtime-floor). Twenty-four are twelve
pairs of equal or near-equal weight from two libraries, row 205's family. The paragraph gives each
pair's weights by key, no names. The heaviest kernel (weight 171,236 on the Intel profiles, 205,223 on
NVIDIA and AMD) and a lighter kernel with its pair were each filled once in the helper, under the
3,072 MiB cap, from empty caches, at width 32 and at 1,024:
- RTX 3090 (job m3-max-68749) and RX 7900 XTX (job m3-max-68750): all six made at both widths; the
  largest peak is 1,991 MiB (the heaviest at 1,024 on the 3090).
- Iris Xe of RPL-P (job m3-max-68748): none made. Five were refused past the cap, the heaviest at
  width 32 with a 3,129 MiB peak; the heaviest at 1,024 ended on a helper SIGSEGV after 48.8 s at
  1,291 MiB.

Verified: the weigh is job m3-max-68532 at f979769faf, compile-only over all 15 committed profiles;
the translator has not changed between f979769faf and this commit's base. The fills ran
heavyrun f2eccefe58fcba18, built in job m3-max-68741 at 9da0f0a63b plus the probe's fill hooks
(f979769faf is 9da0f0a63b plus blessed tables). The twin modules' words were compared with irisweigh
in job m3-max-68741: the pair differs by 199 words in every variant on every profile. The peak is
the helper process's VmHWM and VmRSS, read every 20 ms. Each fill ran once, and the numbers above
come from that one run.
2026-11-22 13:59:00 -08:00
Anees Iqbal 2953064a1c Runtime README: a stage fill's memory follows the threadgroup size; one kernel refused at 1,024 on the Iris Xe
What: one paragraph in Kernels past the stage bound. A fill's memory follows the threadgroup size its pipeline is made at; on the Iris Xe of RPL-P one emulated module of weight 46,491 took 794 MiB at 1 thread a threadgroup, 2,630 MiB at 32 and passed the 3,072 MiB cap at 1,024, where the pipeline is refused.

Why: an open gap a guest can meet (the planner ranks it a bug: an app that fills the threadgroup is the ordinary Metal pattern), recorded where a reader of the runtime meets it. A probe of a form that removes it is under way; this line changes with it.

Verified: m3-max-68473 (Iris Xe, Mesa 26.2.6; the same words, SHA-256 d5a653c7, in every arm, only the workgroup-size specialization differing; A B C A B C from empty caches: 794/792 MiB, 2,630/2,630 MiB, killed at 3,108/3,250 MiB after 46.1/46.3 s; the peak is the helper process's VmHWM and VmRSS sampled every 20 ms). Docs only.
(cherry picked from commit cd7716adb0)
2026-11-22 13:57:24 -08:00
Anees Iqbal d3e0384a43 Runtime README: the pitch copies' counts on a recorded compute play, their cost unresolved
What: the known gap of textures over a buffer whose pitch the device's linear image does not meet gains one measured row: 80 textures of 2448x3264 RGBA8 at 9,984 bytes a row against the RTX 5080 Laptop's linear row of 9,856 took 206 copies of 3,835,938,720 bytes in three frames (95.2% of that play's pitch-copy bytes), and their cost on those frames was not resolved.

Why: bug row 68 closes as a known gap (planner 11-22). The A B A B play against a probe that skips every Pitch copy read means under 5% (GPU busy +0.86%, wall +2.16%) with the two pairs of opposite sign, so the line states the counts and that the cost was not resolved, not a cost.

Verified: m3-max-68398 (RTX 5080 Laptop, NVIDIA 615.71.09, the stream played in full, 1115 frames an arm, 0 refused; the probe's pitch counters read 0 and its skip printed 120 lines an arm); probe branch steelbrain/pitchcost-probe, never lands. Docs only.
(cherry picked from commit e78626ce6d)
2026-11-22 13:57:24 -08:00
Anees Iqbal e0dcaaa16c Runtime README: the UHD 630 arena line says the cause is not found
The line said the cause ranks as the driver's. Nothing shows that: there is no standalone repro, one tree failed 2 of 31 alone and another 0 of 31, and the read-checking probe was clean in 5 runs (m3-max-68367). The line now states what was seen and that the cause is not found. Docs only.

(cherry picked from commit 9c03db5a4a)
2026-11-22 13:57:24 -08:00
Anees Iqbal 730cb55301 Runtime README: the UHD 630's Windows driver can return wrong words from a long arena dispatch
What: one known gap under the queues' known gaps. On the Intel UHD 630 under Windows (driver
101.2145), a kernel whose thread memory is in the private arena can return 1 or 2 wrong results in
512 from one long dispatch of its whole grid, intermittently.

Why: the arena test's wrong words on that card are an old intermittent of the driver, not a
regression of ours. The older build fails as often or more (2 of 31 alone at 28e1026b3d, 0 of 31 at
91fed9449c; 1 failing suite leg of 11). The planner closed the row as the workaround ladder's rungs
3 and 4: an upstream report draft staged for the owner to file, and this line. No product change.

Verified: the rates come from m3-max-68291, m3-max-68314 and m3-max-68142 (UHD 630, driver
101.2145). The read-checking probe kernel ran 5 times alone with no bad read and no bad fold
(m3-max-68367, probe branch steelbrain/winrows-probe, never lands). Docs only.

(cherry picked from commit 1533969b9a)
2026-11-22 13:57:24 -08:00
Anees Iqbal e3d30c5101 Runtime: the queue cut comes off development until its gates pass; the runtime is f979769faf's with stage input
What: the runtime crate goes back to f979769faf's, plus stage input. Its sources, its tests and
api_signatures.tsv now equal those of f979769faf with a916e61185, f21db0934c, 59e0a3f7ca and
58e9267b6c applied, file for file.

This one new commit takes out the queue cut and everything built on it:
56cdcb7075, 929718d58f, 9adc440ec6, f997dfa7d3, 544f21b48f, c9c53b85cf, 75773059e7, 855eb86147,
62183f55af, 2ec8680181, eaba828dcd, 600b38fda7, f268d3ca07, 59481e60bd, e74f1480ed, 5686863157
and f0b6fff640. That covers piece.rs, tests/pieces.rs, the rate inputs of the barrier, heap and
event tests, and the README's sections on pieces and the device's room.

It also removes the parts of 41b5038342 that state the cut's cross-queue rule. Those are the
README's "goes after it only once that one is submitted" sentence and its known-gap line on commit
order between queues. Without the cut, a command buffer never goes ahead of an earlier-committed
one it shares a tracked resource or a fence with, and the README says so again.

Kept:
- stage input, from a916e61185 and f21db0934c;
- its NaN rows for the XTX, the Iris Xe and the RTX 3090, from 59e0a3f7ca and 58e9267b6c;
- the replay player's host wait for its own surface fill, from 41b5038342: the player, its test
  and docs/REPLAY-STREAM.md;
- the README's import-cost paragraph, from f53ddc5917.

Why:
- development carries a confirmed stall. A cut command buffer waiting for room, with an empty or
  present-only command buffer behind it on its queue, spins the submit thread with the work lock
  held. Lavapipe, m3-max-68758.
- It carries a candidate benchmark regression: the compute benchmark on the RX 7900 XTX scored
  5.09% lower in the consumer's first pair (m3-max-68746 against m3-max-68738). Its second pair
  is still being read.
- Stage input is a refusal a guest met. The consumer pins only exact commits on development, so
  stage input reaches it only through a development commit without the cut.
The cut and its fixes go to steelbrain/cut, as this commit's revert plus the fixes. They come back
to development as one series when the spin fix is green in all four forms, the XTX benchmark is
within 3% in an alternated pair or the owner rules on the trade, and the wait-split sharer fix is
in, if that turns out to be the cut's regression.

Verified:
- The runtime crate's tree and api_signatures.tsv equal steelbrain/pin-stagein (ce10a0d627).
- The diff to it is the README's import-cost paragraph, the replay player's two files and
  docs/REPLAY-STREAM.md.
- fmt, the refusal surface, the signatures table, the conformance coverage and the Metal coverage
  all check as current.
- The quick check and the suites at this commit are named where it lands.
2026-11-22 13:55:40 -08:00
Anees Iqbal f0b6fff640 Tests: the heap-texture pass is sized from the shorter of its first two spans
What: every_device_keeps_heap_textures_read_through_their_indices_past_their_release sizes the
pass that samples as its textures drop from the shorter GPU span of the first two forms' one
dispatch, not the first's alone, and prints each.

Why: the first form's dispatch holds the kernel's first use. On a loaded lavapipe it spanned
2206321 ns, so the pass took 90 dispatches, which ran 7.8 ms at about 87 us each and ended 9 ms
before the textures dropped 20 ms after the commit: the assertion that the drop comes before the
pass's GPU end failed (m3-max-68726 at 9c7286dd8a, argument_sampling.rs:427). The second form's
dispatch, behind long work on the same queue, runs after that first use. A span stretched another
way only makes the pass shorter, so the shorter of the two is taken.

Verified: see the branch's lavapipe and compile jobs, named where it is handed over.
2026-11-22 13:34:07 -08:00
Anees Iqbal 5686863157 Tests: three device tests hold on a loaded device by their own inputs and structural bounds
What and why, one test each; the runtime does not change.

- every_device_schedules_a_wait_for_an_event_s_value_as_it_is_submitted: the two queues'
  expected runs (BODY_RUN, 1 ms, the test's own input) are set as each round begins, not once
  before both. Its 60.9 s on a loaded lavapipe (m3-max-68664, command.rs:188) was the test's own
  room deadlock, not the runtime: round 1's command buffers retire and their measured runs
  replace the input (QueueInner::ran, rising at once to a longer run). Past 2 ms, round 2's
  `next` has no room (submit::room: the two runs behind the oldest past GROUP_RUN) while Busy's
  gate holds every completion, so its submission waits out the 60 s PATIENCE. Each round now
  prints the runs its input replaces. PATIENCE stays.
- every_device_keeps_heap_textures_read_through_their_indices_past_their_release: the pass that
  samples as its textures drop is sized from the GPU span of round 0's one sampling dispatch, to
  about 200 ms of run (PASS_RUN), at most the 40,000 dispatches it always took (about 200 ms on
  an RTX 3090). On a loaded lavapipe the fixed 40,000 ran past PATIENCE at finished()
  (m3-max-68664, 79.5 s). It now asserts the drop came before the pass's GPU end, so the round
  is the release while its pass runs that it names, and prints the count it took.
- every_device_rates_a_one_piece_command_buffer_without_the_run_ahead_of_it: the short command
  buffer's rate behind the long one is bounded structurally, its run (one threadgroup: the rate)
  under the long one's run left as the short one was submitted (end - sent_at, about 20 ms). A
  pair begun at its submission, or anywhere earlier in the long run, holds at least that much;
  the right pair holds its own run alone. The bound it replaces, under twice the rate alone,
  compared two single runs of about 100 us taken milliseconds apart, and on lavapipe the device
  is the host CPU: under load the rate behind came to 2.26 times (220300000 ps against 97564000
  ps alone, m3-max-68647), the run itself, as the pair measured it. The rate alone and the ratio
  are still printed.

Verified: see the branch's lavapipe and compile jobs, named where it is handed over.
2026-11-22 13:34:07 -08:00
Anees Iqbal 58e9267b6c Conformance coverage: the ledger rows the three cards' NaN answers added
docs/CONFORMANCE-COVERAGE.md regenerated by scripts/conformance-coverage/coverage.py after
edb361410a added fifteen ledger rows: the ledger count reads 7968 and the gaps table lists the
fifteen. Job m3-max-68716 at edb361410a failed only its coverage check on this document (the
conformance crate ran 1024 tests, and 1023 passed); its replay on lavapipe read 0 ledger drift.
2026-11-22 13:33:00 -08:00
Anees Iqbal 59e0a3f7ca Conformance: the stage-in fetch case's NaN rows on the XTX, the Iris Xe and the RTX 3090
attribute-format-fetches widens five NaN-bearing attributes (Half, Half2, Half3, Half4 and
FloatRG11B10) in the shader's fetch, and the device keeps its own NaN bits there under
`device-nan-encoding`. The ledger held those five sites for llvmpipe only, so each card's replay of
the case read them as gaps with no row for the card.

The three cards' replays (built at f21db0934c, job m3-max-68667):
- RX 7900 XTX (RADV, Mesa 26.2.6), job m3-max-68678, and Iris Xe (ANV, Mesa 26.2.6), job
  m3-max-68679: the same five answers as llvmpipe's, to the bit. Halves read 0x7fc02000 where Metal
  reads 0x7fc00000. RG11B10 reads 0x7ffe0000, at 9 elements.
- RTX 3090 (NVIDIA 620.70.06), job m3-max-68677: every payload bit is set (0x7fffffff), and the
  largest difference is 4194303 at each site. RG11B10 differs at 10 elements, not 9.

Metal's recording answers exactly 2, 4, 6, 8 and 10 NaN words at these sites, all 0x7fc00000. So the
3090 differs at every one of them. On the Mesa drivers, one RG11B10 NaN keeps a payload that widens
to the canonical bits, which leaves 9.

The 3090 differs from the Mesa drivers, so the rows stay per card: five for "RX 7900 XTX", five for
"Iris(R) Xe" and five for "NVIDIA GeForce RTX 3090", each named no wider than the card that ran. The
fifteen rows equal the rows the three runs printed, field by field. No other site differed on any
of the three cards. On each card the runtime device suite ran 667 tests and all passed, 3 skipped.
2026-11-22 13:33:00 -08:00
Anees Iqbal 41b5038342 Player: a commit waits on the CPU for the backend's own surface fill before it goes
What: the replay player's surface backend keeps its last command buffer on its own queue, a
fill at a shape's making or the refill a picture owes at its first use (Surfaces::unwaited). The
stream's next commit waits for it on the CPU, once, before committing, counted as
surface_host_waits (an executed counter, and in the report's surfaces line). New test
a_surface_picture_fills_before_its_use_behind_another_queues_long_work plays the same picture
behind 256 dispatches over 4 MiB committed first on another queue, and checks the second
picture, one refill and one host wait. The runtime README's queue rule now says what Metal and
the code do: a command buffer sharing a tracked resource with an earlier-committed one of another
queue goes after it only once that one is submitted (the M3 Max rows of that section, jobs
m3-max-52432 and m3-max-52415), a cut command buffer that has begun counting as submitted until
its next piece waits for an event; an event wait holds only its own queue; the fence sentence
says what the code does, Metal's side measured only by jobs m3-max-52186 and m3-max-52188. Its
known gaps name a program that relies on commit order between queues for a shared resource with
no event or fence. docs/REPLAY-STREAM.md gives the wait and its counter.

Why: a_surface_picture_fills_its_shapes_at_their_first_use read the first picture's inverse on
the RX 550, the 780M, the Iris Xe and lavapipe at 62183f55af. On the RX 550, alternated in one
job (m3-max-68619), f979769faf passed 4 of 4 and 62183f55af failed 3 of 4, each failure reading
[239 223 207 64]x4 for [175 159 143 128]x4. The player fills an owed shape by a blit on its own
queue and relied on commit order alone to run it before the stream's kernel on queue #2. Under
the device's room the player's queue had turn 1 (its making fill still in flight) and #2 turn 0,
so has_room and rank sent the kernel's submission first; it took the upload of the first
picture's replace_region, as that upload's contract says, and the refill ran after the kernel.
At f979769faf room was per queue with no rank, so the refill went as it was staged. Metal's
hazard tracking orders such a pair only against work already submitted (the M3 Max rows above),
so the runtime owes no order there, and the player does what a program must: it waits for its
own fill, as the consumer's video paths wait on the CPU.

Verified (check tree 5c42e1bae6, this commit's code; this commit rewords the new test's doc
comment only):
- fmt, clippy plain / --cfg m2v_gpu / --cfg m2v_cpu_icd and workspace Rustdoc, all -D warnings:
  m3-max-68681.
- lavapipe under --cfg m2v_cpu_icd, LP_NUM_THREADS=1, m3-max-68682: with the fix, 129 of 129
  validation replay:: tests pass; with surfaces.rs of f21db0934c (the fix out, the test in), the
  original test reads [239 223 207 64]x4 (rt_replay.rs:2338).
- RX 550 (RADV POLARIS12), m3-max-68686 (archive m3-max-68684): both surface tests pass 4 of 4.
- The new test is not a forcing test. Without the fix it read the first picture in 9 of 9 runs
  started alone with --no-capture (m3-max-68698 one at 256 dispatches; m3-max-68707 four at 256
  and four at 1,024), and the right picture, failing only its host-wait count, in all 3 suite
  runs (m3-max-68682 at 256, m3-max-68711 at 1,024, m3-max-68717 at 1,024 run alone under
  threads-required). What tells those runs apart is not found. With the fix it passes in every
  run above.
2026-11-22 13:32:09 -08:00