Commit Graph
9114 Commits
Author SHA1 Message Date
Anees Iqbal fc8d0ccd15 Runtime README: a consumer that answers YES owns a dropped sample-position set
What: the known gap for programmable sample positions no longer says the consumer answers the
query NO until the setter is built. It says what is true: the runtime has no setter and answers
nothing, every multisample pass rasterizes at the standard locations (Metal's defaults at 1, 2
and 4 samples), and a consumer that answers YES owns counting and dropping a set that differs
from the defaults.

Why: the consumer answers YES, as the guest's Mac does; it counts a differing set under its
unbuilt render-pass items and announces it, and none has been seen in its recorded logs. The
NO clause in 375e4770bf was a ruling that has been withdrawn.

Verified: doc-only; the workspace Rustdoc line runs on development after the merge.
2026-11-22 22:36:39 -08:00
Anees Iqbal 375e4770bf Runtime README: until the sample-position setter is built, the consumer answers its query NO
What: the known gap of programmable sample positions now says what the consumer answers
programmableSamplePositionsSupported until setSamplePositions:count: is built: NO. The paragraph's
lines are reflowed.

Why: the planner's ruling on the row (11-22): the README names the consumer's answer while the
setter is unbuilt, so a guest is told it cannot set positions rather than having its set dropped.

How verified: docs only; nothing built or run.
2026-11-22 22:32:46 -08:00
Anees Iqbal 0cc88f6dd7 Runtime README: programmable sample positions are not built
What: a known gap of render encoders. The render pass descriptor has no field for
setSamplePositions:count:, and the runtime answers no programmableSamplePositionsSupported, so
every multisample pass rasterizes at Vulkan's standard sample locations (standardSampleLocations,
in the floor), Metal's default positions at 1, 2 and 4 samples. A pass whose set differs from the
defaults samples at the defaults, with no refusal. VK_EXT_sample_locations, Vulkan's form for set
positions, is not enabled.

Why: a guest sets sample positions (arm64 GL walks on the Mac host), and the README did not say
that the runtime does not take them. The consumer answers the support query itself.

How verified: read from the tree at d825e52482. RenderPassDescriptor (pass.rs) has no
sample-position field; no runtime source names sample locations but floor.rs's
standardSampleLocations limit; docs/METAL-COVERAGE.md lists setSamplePositions:count: and
programmableSamplePositionsSupported as missing. Docs only; nothing built or run.
2026-11-22 22:29:27 -08:00
Anees Iqbal d825e52482 Validation: the suite's pins for the table work
- runtime-sources.sha256: the runtime inputs include the translator's bind
  module, where function_table_header and function_table_entry_offset became
  public; they lay out the words the shader already read, and no run of an
  unchanged artifact does anything else, so RUNTIME_VERSION does not move.
- public_linked_modules_resolve_by_hash_without_a_private_store lists the
  new public linked module visible_table_ops.
- coverage.tsv: MTLFunctionHandle's counterpart is the translator's
  FunctionHandle (the runtime re-exports it), and
  visibleFunctionTableDescriptor is VisibleFunctionTableDescriptor's Default,
  as the coverage test finds items.

The three failed in the validation suite at dabc455312 (m3-max-69738:
1291 passed, 3 failed).
2026-11-22 22:11:30 -08:00
Anees Iqbal ee96eca15b Validation: name the bound tables' type in the runtime candidate
clippy's type_complexity refused the dispatch's binding tuple once it held
the tables (m3-max-69738, clippy plain, m2v_gpu and m2v_cpu_icd).
2026-11-22 22:11:30 -08:00
Anees Iqbal d11697b000 Conformance: the twelve compute visible-table cases match Metal on the runtime
The replay on lavapipe (m3-max-69685, llvmpipe of Mesa 26.2.4) compares
every visible-tables-compute case exactly with the M3's recordings, so their
known-gaps rows, which recorded the runtime's Slot refusal, are dropped.
The six render-stage cases stay refused as recorded. CONFORMANCE-COVERAGE.md
is regenerated.
2026-11-22 22:11:30 -08:00
Anees Iqbal 11d8892858 Validation: an authored case calls through a kernel's visible-function table
visible-table-entry-by-thread-calls-add-mul-null-sub (af884d65cb): twelve
threads of the owned visible_table_dispatch each call entry tid % 4 of a
table of four, linking table_add, table_mul and table_sub from the owned
module visible_table_ops, entry 2 left null. Installed with
corpus-case-check and qualified on Metal on the M3 in the primary reference
environment (m3-max-69730: three runs, 3, 3, 0xfffffffd, 0, 7, 15,
0xfffffffd, 4, 11, 27, 0xfffffffd, 8).

The public qualification (CI's lavapipe step) now also runs it and the
public table-query case 3a8f75e182, which the runtime refused before.
2026-11-22 22:11:30 -08:00
Anees Iqbal f8b7752902 Validation fixtures: the companions of the linked module visible_table_ops
scripts/regen-air-fixtures --dir linked visible_table_ops on the M3
(m3-max-69721: Apple metal 32023.922, macOS SDK 27.2; its --check of the
directory passed). Three [[visible]] functions of the type uint(uint, uint)
that a case links into visible_table_dispatch's table.
2026-11-22 22:11:29 -08:00
Anees Iqbal 755b4b712d Runtime tests: name the entry function type in function_tables
clippy's type_complexity refused the bare fn-pointer slice under the device
cfgs (m3-max-69685, clippy_gpu).
2026-11-22 22:11:29 -08:00
Anees Iqbal 28e2b0e6ca Validation: a kernel case's visible-function tables run through the runtime
The runtime candidate makes each table the case binds of the pipeline
state (newVisibleFunctionTableWithDescriptor: of its size, each authored
entry set to the handle of its linked function made with the case's
constants, as the Metal oracle sets it) and binds it at its buffer index.
ToolingRequirement::KernelFunctionTable, which held such cases to Metal
alone, is retired; a render stage's table stays the runtime's limit
(RenderFunctionTable). ENGINE_EXECUTOR_ABI does not move: no recorded row
ran a kernel table case (they were refused).

The runtime README states the device answer, the encoder's bind, the
state's handles and tables, and the known gaps (a table's 64 KiB block, a
consumer-compiled kernel's handles, an argument buffer's table). The
coverage table marks the compute items implemented; METAL-COVERAGE.md and
CONFORMANCE-COVERAGE.md are regenerated. Adds the owned linked module
visible_table_ops.metal, whose companions scripts/regen-air-fixtures
writes on the Mac.

Verified: the lane's jobs.
2026-11-22 22:11:29 -08:00
Anees Iqbal bbb3d53484 Runtime: a compute state's visible-function tables call the functions their entries hold
A compute pipeline state answers functionHandleWithFunction: for its linked
functions (the translator's FunctionHandle words), makes visible-function
tables (newVisibleFunctionTableWithDescriptor:) whose words sit in a Shared
block the runtime takes, writes their entries (setFunction:atIndex:,
setFunctions:withRange:) and answers each table's gpuResourceID. The compute
encoder binds a table at a buffer index (setVisibleFunctionTable:atBufferIndex:)
through its buffer path, and the command buffer keeps the words until it
retires. The device answers supportsFunctionPointers YES. An entry past a
table's size is Refusal::FunctionTableIndex and writes nothing.

The translator's bind module makes the table's header and entry offsets
public, so the runtime writes the layout the shader reads.

Tests: function_tables (device cfg) dispatches through tables of two orders,
a null entry, no entries, an unbound slot and an entry set after encoding,
and compares every word; the conformance rt side runs the compute
visible-table cases. Evidence is in the lane's jobs.
2026-11-22 22:11:28 -08:00
Anees Iqbal de764fc389 Translator: a threadgroup atomic at a constant offset outside the arena writes nothing and yields zero
The sibling of the out-of-arena load and store. An unchecked threadgroup atomic at a constant
offset outside the arena built an access chain past the arena's word array, which the builder's
range rule rejects, an internal error. It now writes nothing and yields zero, as a contained atomic
out of bounds does (`guarded`), decided by the same plain-constant test (`local::outside_arena`):
an atomic inside the arena, or at an offset that is not a constant, is unchanged. Metal leaves the
access undefined. docs/API.md's threadgroup bullet names the atomic too. No census row reaches it.
2026-11-22 21:53:53 -08:00
Anees Iqbal 0ace70d4fb Translator test: a threadgroup atomic at a constant offset outside the arena writes nothing and yields zero
The sibling of the out-of-arena load and store: an unchecked threadgroup atomic at a constant
offset outside the arena builds an access chain past the arena's word array, which the builder's
range rule rejects, so the translation fails with an internal error. This test makes that atomic
through from_queries on every test profile and expects the module to build, every thread's atomic
to answer 0, and no arena word to take the add. It fails until the fix that follows.
2026-11-22 21:52:51 -08:00
Anees Iqbal fb69c81915 Authored case: the outside-the-array case's rationale says what holds, with no commit named
The rationale named the fix by a commit that a rebase replaced. It now says why the access cannot
be an access chain and what the translator makes of it. The rationale is outside the case's
identity, so its case id, input and Metal observation are unchanged.
2026-11-22 21:19:30 -08:00
Anees Iqbal 9d1c71e0b2 Authored case: a threadgroup load and store at a constant index outside the array, qualified on Metal
threadgroup-constant-index-outside-the-array-in-a-branch-no-thread-takes, over the owned
kernel_threadgroup_constant_index_outside_the_array fixture: two threadgroups of 64 threads, each
storing 3 t + 1 at tg[t], with flag = 0, so no thread runs the branch whose load and store
Apple's compiler writes at the constant index 0xFFFFFFFF of the array (an offset outside the
arena, undefined in Metal). Each thread writes out[gid] = tg[(t + 1) & 63] + tg[t]: 6 t + 5
below t = 63 and 191 at t = 63. Compared exactly.

Verified: corpus-case-check installed it (m3-max-69680: case c97238d294b9, input_sha256
91077149e913), and corpus-metal qualified it on the M3 (apple-m3-max-macos27.0.1, m3-max-69691)
with output_sha256 01a9ad8b1b5c..., the sha256 of those 128 words computed apart from Metal.
2026-11-22 21:18:45 -08:00
Anees Iqbal 44472b664c Fixture: a threadgroup load and store at a constant index outside the array, compiled from owned MSL
kernel_threadgroup_constant_index_outside_the_array reads and writes tg[t - 1u] of a 64-word
threadgroup array, the arena's only object, in a branch where t == 0 and a buffer's flag is not 0.
Apple's compiler, knowing t == 0 there, writes both as the constant GEP [67108863, 63] of the
array: the arena offset 0xFFFFFFFC, outside the arena. It is the public form of the corpus shape
that failed with an internal error (the corpus's is an inbounds GEP [0, 4294967295] instruction;
both reach the arena access with that constant offset). Compiled by scripts/regen-air-fixtures on
the M3 (metal 32023.922, SDK 27.2, recorded in TOOLCHAIN); its inventory rows are ok on every
profile.

Verified: the base translator (da020e5d7b plus a probe report) refuses the fixture's .ll with
"internal error: Build: SPIR-V builder rejected construction: Operand { op: AccessChain, rule:
Range(1) }" on runtime-floor (m3-max-69680), the corpus rows' error.
2026-11-22 21:18:45 -08:00
Anees Iqbal 0b1053f0cc Translator: a threadgroup load or store at a constant offset outside the arena is a zero load or no store
An unchecked threadgroup arena access whose offset is a plain constant outside the arena built an
OpAccessChain into the arena's word array with a constant index past its length, which the SPIR-V
builder rejects (OperandRule::Range), so the function failed with an internal error instead of
translating or refusing. Such an access lies outside every threadgroup object, which Metal leaves
undefined, so it is now decided at translation time as a contained arena's constant access is: a
zero load, or no store. The decision reads the offset and the arena's size as plain constants and
interns nothing, so every access inside the arena, and every module that built before, is
unchanged; an arena whose size is a specialization constant is never decided this way (its word
array has no constant length to break).

The shape: Apple's compiler, knowing t == 0 in a branch, writes tg[t - 1u] of a static
threadgroup array at arena offset 0 as element 0xFFFFFFFF, a wrapped arena offset of 0xFFFFFFFC.
It is the whole of the translation census's internal errors at da020e5d7b (18 functions in 4
libraries on all five profiles, kindcount's m3-max-69549): each a load of an i32 word from a
static [N x i32] or [N x float] threadgroup global through an inbounds GEP [0, 4294967295], in a
branch, on the arena's u32 words.

SEMANTICS_VERSION 2277: those functions' outcome moves from an internal error to a module.

Verified: probe m3-max-69624 (base da020e5d7b plus a report at the builder's range rule) found
that one site and shape for all 18 rows; probe m3-max-69654 reproduced the same internal error
from owned MSL. The new test drives a load and a store at element 4294967295 of a 64-word
threadgroup array through from_queries on four profiles, in an arena of u32 words and one of
float words, and checks L3 and the interpreter's answers (the load reads 0, no word takes the
store).
2026-11-22 21:18:45 -08:00
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