Commit Graph
9913 Commits
Author SHA1 Message Date
Anees Iqbal cdadbc8d2f api_signatures.tsv: Metrics' translations_at_encode and translation_at_encode_max_nanos
The widened counter replaced variant_translations_at_dispatch; the table was
not blessed with it (the_public_signatures_are_the_committed_table failed in
the translator suites, job m3-max-79131).
2026-12-02 14:24:10 -08:00
Anees Iqbal e0f63843c4 replay: the longest translation at encode is an end line, not a frame's counter
translation_at_encode_max_nanos is a maximum since the device was made, so a
frame's difference of it means nothing: the report gives it once, as
`translation at encode longest N ns` beside the commit lock's, and keeps
translations_at_encode among the executed counters.
2026-12-02 14:24:10 -08:00
Anees Iqbal adc68cb356 rt tests: dispatches racing for the partial-threadgroups variant on emulated SIMD groups lower it once
Four threads dispatch wps_uint_k40_s32's ragged grid at threadgroups of 48
at once, each through its own queue and buffers: where the kernel's
partial-threadgroups variant runs only whole SIMD groups, one lowers the
variant on emulated SIMD groups and the rest wait for it in its OnceLock
(translations_at_encode moves by 1); every racer's whole SIMD groups have
the CPU's words.
2026-12-02 14:24:10 -08:00
Anees Iqbal 5a16277eb3 rt: one counter for every translation made at encode, with its longest make
The planner widened the counter of the fourth variant made at dispatch to
every translation made at encode, named once: Metrics::translations_at_encode
counts the makes, made or refused, and translation_at_encode_max_nanos holds
the longest (a maximum since the device was made, as maker_wait_max_nanos).

Its sites, each a module or content the state's creation did not make, made on
the encoding thread that waits for it:
- an observing kernel's partial-threadgroups variant on emulated SIMD groups
  lowered by a dispatch (not by prepare_dispatch);
- a compute state's content for a dispatch's buffers bound at a multiple of 4
  below their alignment, or its 8-bit sRGB textures' UNORM twins
  (PipelineInner::variant, one function for both);
- a render state's content for a draw's buffers bound so (for_words);
- a render state's content for a pass it does not render into as made
  (for_pass: a colour attachment the pass lacks, or a fetched colour in a 2D
  array).
The first replaces variant_translations_at_dispatch. A content the map of
contents holds is a reuse and counts nothing; one it forgot counts again. The
replay's metrics report both fields.

Tests: each site counts one make at its first need and none at a reuse:
the word-bound compute variant (and again for a second mask and a forgotten
variant), the sRGB variant, the word-bound render content per draw case, the
pass content of a lacking pass, and the fourth variant's dispatch (with the
maximum above 0).
2026-12-02 14:24:10 -08:00
Anees Iqbal c7f9a58f6e rt: decide's kernel borrows from the content, not from the need
The need now carries the state's descriptor, so the elided lifetime of
decide's returned kernel no longer has one source.
2026-12-02 14:24:10 -08:00
Anees Iqbal fc9ebee2fc rt: a ragged grid at a threadgroup of partial SIMD groups runs the partial-threadgroups variant on emulated SIMD groups
An observing kernel whose partial-threadgroups variant runs only whole SIMD
groups (a subgroup tier) refused a dispatchThreads grid that is not whole
threadgroups at a threadgroup that is not whole SIMD groups
(Gap::PartialThreadgroups, site SimdGroups). The translator now lowers the
partial-threadgroups variant on emulated SIMD groups, so the runtime runs it.

What: a fourth KernelVariant, EmulatedPartialThreadgroups, in ALL, whose
inputs set both partial_threadgroups and emulated_simdgroups. The state's make
does not lower it (the planner's form: made at the first dispatch shape that
needs it). Compiled holds its inputs and a OnceLock for its lowering, made
for a content whose partial-threadgroups variant runs only whole SIMD groups.
encoder::decide takes a Need: prepare_dispatch and a dispatch lower it from
their state's descriptor, once, a racing thread waiting in the OnceLock; the
state's make and dispatch_variant read keys and lower nothing. A dispatch's
lowering counts in Metrics::variant_translations_at_dispatch (also in the
replay's metrics), which a pre-pass that prepares every dispatch keeps at 0.
The lowering is lower_variant's, the same bounded translation through the
cache directory as every variant's; the translator's refusal of it stays the
dispatch's Gap::PartialThreadgroups { site: SimdGroups }, any other failure
is reported as itself. Its dispatches count as emulated SIMD-group
dispatches and partial-variant ragged grids. Compiled's drop releases it.

Docs: prepare_dispatch's and dispatch_variant's docs, the counter's, the
SimdGroups site's, the runtime README (which variant is made when, the gap's
narrowed scope); api_signatures.tsv re-blessed.

Tests: every_device_runs_a_ragged_grid_of_partial_simdgroups_on_emulated_simdgroups
and every_device_frees_a_ragged_grid_s_modules_with_its_content now also read
the counter: 1 for k24_s32's first dispatch on a subgroup-tier card, 0 after
k8_s48's prepare_dispatch, 0 where the variant emulates its SIMD groups
already.
2026-12-02 14:24:10 -08:00
Anees Iqbal adfd60f805 rt tests: a ragged grid at threadgroups of partial SIMD groups runs on emulated SIMD groups (red)
wps_uint_k24_s32 and wps_uint_k8_s48 over dispatchThreads grids of 184
threads in threadgroups of 48: each threadgroup one whole SIMD group and a
partial one. Where the kernel's partial-threadgroups variant runs only whole
SIMD groups (a subgroup tier), the dispatch is refused today with
Gap::PartialThreadgroups { site: SimdGroups }. The tests want the grid run on
emulated SIMD groups, the whole SIMD groups' words equal to the CPU's, the
words past the grid untouched, a prepare_dispatch ahead of k8_s48's
dispatches, and the map of compiled contents, filled past a cap of 1, freeing
the first content's modules with its state.

Red on a subgroup-tier card; passes where the variant emulates its SIMD
groups already (lavapipe, the Intel GPUs).
2026-12-02 14:24:10 -08:00
Anees Iqbal 819d811015 rt README: the Iris Xe places a texture in a Shared heap too
The known gaps of textures named lavapipe and the Radeon 780M as the
devices whose optimal images take the Shared memory type. The Iris Xe
(Mesa 26.2.6) takes it as well: its run of the rt and harness heap,
Shared-heap sampling, export and churn_rest tests at development
30e7be6aff's product code (archive m3-max-79814, run m3-max-79854)
placed a source and a target in a Shared heap, wrote, read back and
sampled them, and churn_rest held every gauge with the kind included.
The same archive on the RTX 2080 (m3-max-79855) took the refusal path
and passed, heap.rs's Shared-descriptor size queries included, and on
the Radeon 780M (m3-max-79856) placed and sampled them: 8 of 8 each.
2026-12-02 14:24:09 -08:00
Anees Iqbal 9e510fa042 rt README: a Shared heap's texture on a discrete device reads and writes across its link, 97 times as long on the RX 7900 XTX
This is the timed row the ruling on Shared heap textures asked for. It was taken on the RX 7900 XTX
(RADV, Mesa 26.2.6, job m3-max-79841), behind a PCIe 4.0 x4 link. That is the narrowest link
upstream of the card: the bridge at 16 GT/s x4. The test is a helper branch's own and does not
land.
- The harness's sample_down kernel sampled a 4096 by 4096 RGBA16Float texture (128 MiB) into a
  2048 by 2048 target, 10 dispatches in each command buffer.
- The texture was placed once in a Private heap and once in a Shared heap, with the same
  descriptor.
- 7 command buffers of each were alternated in one job. The GPU spans are the command buffers'
  own GPU start and end times.
- Private: median 2.099 ms (2.093 to 2.103).
- Shared: median 203.136 ms (203.079 to 203.184).
- The ratio is 96.8: about 640 GB/s against 6.6 GB/s, the link's rate.

A first run (job m3-max-79822) filled the texture with one repeated texel. Its Private arm read
1.28 GB in 0.458 ms, faster than the card's memory, because the image compresses a constant
texel. The row above uses texels from a xorshift64 sequence, which nothing compresses.

The NVIDIA cards place no Shared heap texture (the bullet above), so this cost is the discrete
AMD case. Nothing works around it, as the ruling says. A Mac whose Metal makes Shared heap
textures has unified memory, where the cost does not arise.
2026-12-02 14:24:09 -08:00
Anees Iqbal 0631128baf rt README: a Shared heap's texture is expected to be Gap::HeapTexture on the RTX 3090 too, not run
The RTX 2080 refused it (job m3-max-79682) because its optimal images take no Shared memory type.
The 3090 runs the same NVIDIA driver (620.70.06) and was not run, so the known gap says expected,
as the planner asked.
2026-12-02 14:24:09 -08:00
Anees Iqbal ac220d6f52 rt: the heap size query answers every storage mode alike; a Shared heap's texture is refused at its placement where the image takes no Shared type
On the RTX 2080 (NVIDIA 620.70.06, job m3-max-79682) the device's optimal images take no Shared
memory type. Two things followed from that:
- The parent commits' size query, which checked a Shared descriptor against the Shared type,
  refused Shared descriptors there. heap.rs's two Private-block tests size Shared descriptors, and
  both failed at their size query.
- A guest that sizes a texture with a Shared descriptor would have lost an answer it had before.

The size query now checks the Private type for every descriptor, as it did before this series.
Its answer does not depend on the storage mode. The Shared type is checked where the texture is
placed in a Shared block, and the placement is Gap::HeapTexture where the image does not take
it.

Follow-on changes:
- The Shared-heap device test expects the size query to answer on every device and the placement
  to be refused exactly where `Device::heap_image_fits` says the image does not take the Shared
  type.
- The conformance side holds a Shared query to the placement and read-back steps in a Shared heap,
  and to step 1 where that placement is Gap::HeapTexture (docs/API.md section 10 says so).
- churn_rest finds out once, by placing a texture for views in a Shared block and releasing it,
  whether the device places its Shared heap texture. Where it does not, the row leaves the kind
  out, naming it with the reason.
- The rt README's known gaps of textures name where a Shared heap's texture is placed: lavapipe
  and the Radeon 780M take it (jobs m3-max-79654 and m3-max-79685); the RTX 2080 does not. The
  Gap::HeapTexture doc says the same.

Ledger: the five rows of the RGB10A8_2P_XR10 heap cases (texture-fills-550, texture-fills-551,
texture-fills-heap-run-550-b5, texture-fills-heap-run-551-b5 and two-plane-heap-blits) take the
Err the replay at 1e1c3f39b8 pasted (lavapipe, job m3-max-79680). Their Shared heap no longer
refuses first, so the format's own Gap::TextureFormat answers. Their venue stays *, since the
format check comes before the placement on every device, and their justification already names
Gap::TextureFormat. CONFORMANCE-COVERAGE.md is regenerated and unchanged.
2026-12-02 14:24:09 -08:00
Anees Iqbal 220a7a6660 Harness: churn_rest places a texture in a Shared heap in each iteration, reads it by a blit and releases it
The gauge loop covers the new kind's release, as the ruling on Shared heap textures asks. Each of
churn_rest's 200 iterations:
- takes a Shared block of its own, of the texture's size rounded up to its alignment, at which
  such a block starts;
- places a 64 by 64 RGBA8Unorm texture of shader-read usage there by new_heap_texture, at the next
  index;
- copies it into the row's Shared scratch buffer in the blit encoder that reads the texture over
  the exported block;
- drops the texture and the block with the rest.
The gauges read at the 100th and 200th iterations and at the drop then include the heap texture's
texture and Shared block.

Where the device does not place the texture (the size query is Gap::HeapTexture), the row leaves
it out from the start and names it with the reason, as it does an export the device lacks.

Verification is to follow: the harness's churn_rest test on lavapipe and on one card per vendor.
2026-12-02 14:24:09 -08:00
Anees Iqbal 0caee8b62f rt test: heap.rs's Private-block tests keep their Shared descriptors, which replace_region and get_bytes take
The red commit set these two tests' descriptors to Private, the mode of the block they are placed
in. replace_region refuses a Private texture, so both tests failed at their first write on
lavapipe (jobs m3-max-79642 and m3-max-79644, heap.rs:106 and :229). They take back the Shared
descriptors they had. The runtime does not check a descriptor's mode against its heap's; the
consumer refuses that mismatch as Metal does.

The size query sizes a Shared descriptor against the Shared type now. That changes nothing on a
device whose optimal images take both types. On lavapipe the Shared-heap test placed and sampled
its textures at the fix commit (m3-max-79644), so its images take the Shared type.
2026-12-02 14:24:09 -08:00
Anees Iqbal 13951e8daf rt: a texture is placed in a Shared heap as in a Private one, where the device's image takes the Shared type
Metal places textures in a Shared heap: the M3 Max makes them, in automatic and placement heaps
(job m3-max-79576). The runtime refused every texture in a Shared block as Gap::HeapTexture. Now
new_heap_texture and new_heap_texture_for_views bind the device's optimal image in a Shared block's
memory exactly as in a Private block's. That is one form, with no linear image and no copy.

- heap_source refuses an exported block alone, whose memory is dedicated to its buffer.
- heap_fit takes the heap's memory class. At the placement, the class is the block's (Bind::Heap
  carries it). At heap_texture_size_and_align, it is the class the descriptor's storage mode names:
  Shared for Shared, Private for any other, as before.
- Gap::HeapTexture stays typed for an image the device requires an allocation of its own for, or
  whose memoryTypeBits leave out the heap's type, at the size query and at the placement. The
  consumer counts it.

The host reaches such a texture as any texture's, through replace_region and get_bytes. Their
copies go through the GPU and flush or invalidate only their staging bytes. The block's mapping
over the image holds the device's own layout, so the image's range needs no flush or invalidate of
its own. A command buffer that uses the heap (use_heap) flushes and invalidates its whole Shared
block, as it did for the heap's buffers.

Nothing in the runtime asks which Mac the guest has. Whether a guest may make a Shared heap at all
is the consumer's decision; the runtime has no heap object and hands a Shared block to any take.

Docs:
- the rt README's heap paragraph covers Shared heaps;
- the Gap::HeapTexture doc is updated, and REFUSALS.md regenerated;
- docs/API.md's heap-size entry: a Shared descriptor is now held to the placement and read-back
  steps in a heap of a Shared block, as the conformance side's heap_sizes::hold now does;
- the known-gap sentence of the UHD 630 Windows texel-buffer refusal gains its trigger: a second
  device above the floor whose formats lack those buffer features, or a walk that meets the
  refusal.

The test is the parent commit's. Verification is to follow in the handover: lavapipe red then
green, one card per vendor, the gate, and the conformance replay.
2026-12-02 14:24:09 -08:00
Anees Iqbal b32fc6677a rt test: textures placed in a Shared heap are written, read back and sampled where the device's image takes the Shared type (red)
Metal places a texture in a Shared heap on the M3 Max, and the runtime refuses every texture in a
Shared block as Gap::HeapTexture. The new device test
`every_device_samples_textures_placed_in_a_shared_heap` (sampling.rs) does two things:
- Where the device's image of a Shared RGBA16Float descriptor takes the Shared memory type with
  no allocation of its own (the Vulkan query, through the test helper `Device::heap_image_fits`),
  it places a source and a target first-fit in a Shared block's heap by the size query's answers
  and checks that nothing is allocated. It writes the source by replace_region, reads it back by
  get_bytes, and samples it into the target with the harness's sample_down, checking the linear
  filter's mean.
- Where the query excludes the type, it checks that the size query and the placement are
  Gap::HeapTexture.

The two Shared-heap refusal pins in heap.rs go, and that file's descriptors take the Private mode
of the heap they are placed in, as Metal asks. The exported block's pin (export.rs) stays.
heap_texture_size_and_align's image query moves into `heap_image_requirements`, which the test
helper shares; heap_fit takes the dedicated answer as a bool. Neither changes behaviour.

Expected red on lavapipe: the source's placement in the Shared block is Gap::HeapTexture.
2026-12-02 14:24:09 -08:00
Anees Iqbal a6efc7ab79 rt README: the mixed-pass plane copies' known gap gives measured figures
The known gap for a pass that mixes a linear-only surface plane with another attachment gave a
worked 1920x1080 example. It now gives what was measured on the RTX 3090 (job m3-max-79781): a
guest's screen recording of 1676 frames renders one such pass a frame (a 3648x2038 R8Unorm luma
plane beside a 3648x2038 RG8Unorm colour attachment, both loaded and stored), paying 1676 copies
in and 1676 out of 7,434,624 bytes each (12.46 GB each way), with at most 8 stand-ins of
59,768,832 bytes. The planner ruled no form change for this pass: the forms that drop the copies
run fragment side effects twice, grow rule 3's exceptions, or trade one workload for another.

Docs only; no build.
2026-12-02 14:24:08 -08:00
Anees Iqbal 86386c4873 Refusal surface: --check compares the totals, and REFUSALS.md counts Refusal::TextureUsageAtSlot
docs/REFUSALS.md listed 89 runtime Refusal variants but its two totals tables still counted 88
(and 24 metal-measured where there are 25). A union of two branches' rows keeps every variant row
and one side's totals, and --check compared only the variant rows, so it passed. The totals count
variants alone (no sites, no line numbers), so they are structural: --check now compares them too.

Verified locally (plain script, no build): with the old REFUSALS.md, --check exits 1 naming the
two stale Refusal totals rows; after regeneration it exits 0. The regeneration changes only those
two rows; basis.rs is unchanged.
2026-12-02 14:24:08 -08:00
Anees Iqbal b723c90272 rt: Device::default_sample_positions answers getDefaultSamplePositions:count:
The runtime answered no default positions (its README's known gap). Device::default_sample_positions
answers a count with the positions a pass of that many samples that sets none rasterizes at:
Vulkan's standard sample locations, which the floor's standardSampleLocations makes every such pass
take, and which are plain Metal's answers at 1, 2 and 4 samples on an Apple M3 Max, macOS 27.0.1
(probes/default_sample_positions.m, m3-max-78953). supports_texture_sample_count answers at most
1, 2 and 4, so no other count is answered. A count it does not answer is
Refusal::DefaultSamplePositions (basis metal-measured: plain Metal asserts "count (n) is not
supported on this device." and ends the process, at 0, 3, 5, 6, 8, 16, 17, 32 and 33 on the M3).

README (the device's answers; the sample-positions gap sentence), coverage.tsv (I), and the
generated REFUSALS.md, basis.rs, api_signatures.tsv, METAL-COVERAGE.md and CONFORMANCE-COVERAGE.md.

Verified on lavapipe, job m3-max-79650: clippy, doc and private doc EXIT=0; the runtime suite 923
passed, 3 skipped. Metal's answers: m3-max-78953 (Apple M3 Max).
2026-12-02 14:24:08 -08:00
Anees Iqbal 1e92b0a71e rt test: getDefaultSamplePositions:count: answers Metal's positions, and a pass set to them is one set to none (red)
Plain Metal's answers on an Apple M3 Max, macOS 27.0.1 (probes/default_sample_positions.m, job
m3-max-78953): (0.5, 0.5) at 1 sample; (0.75, 0.75), (0.25, 0.25) at 2; (0.375, 0.125),
(0.875, 0.375), (0.125, 0.625), (0.625, 0.875) at 4; and for 0, 3, 5, 6, 8, 16, 17, 32 and 33, which
the M3 does not render, the assertion "count (n) is not supported on this device." ends the
process, with or without the validation layer.

- placed::the_default_positions_are_metal_s_at_each_count_it_renders: the standard locations the
  runtime answers with are those values, bit for bit.
- on_device::every_device_answers_metal_s_default_positions_and_a_pass_set_to_them_is_one_set_to_none:
  on every device, Device::default_sample_positions answers them at each count the device renders
  and Refusal::DefaultSamplePositions at every other count; a pass of that count that sets them,
  under a triangle whose slanted edge crosses the target's pixels, resolves to the same bytes as one
  that sets none.

Red: the runtime has no such method or refusal yet, so the tests do not build (job named in the
next commit).
2026-12-02 14:24:08 -08:00
Anees Iqbal 24fa970780 Conformance probe: what Metal answers for getDefaultSamplePositions:count: at each count
A probe of plain Metal's answer at counts the device renders and counts it does not, each count
in its own process so a validation stop ends only that count, the reference the runtime's answer
is read against. Run on the M3 oracle in the commit that adds the runtime's answer.
2026-12-02 14:24:08 -08:00
Anees Iqbal 38306b95ba rt test: a fragment's SIMD-group fills read only words of the draw, on every device
fragment_simd_fills (engine/gsm2_quad_ops.ll), whose shuffles-and-fills read other lanes of its
simdgroup, is now drawn over a whole 8 by 8 RGBA32Float target cleared to -1 on every device with
shaderQuadControl. Every channel of every pixel must be a word some pixel of the draw holds: its
index_at or that plus 10000. A lane that takes no part gives no promised value, but never one no
invocation holds.

The point is lavapipe. Its fragment subgroups are 8 lanes (4 on arm64), and no card's fragment
stage is narrower than 32, so lavapipe is the one device that takes the translator's
PartialFragment tier. There, a fill whose source is a Metal lane at or above the subgroup's size
reads the calling lane's word without naming that lane, testing the source against the
SubgroupSize builtin. Until now only translation tests (spirv-val, and an interpreter on a
synthetic 4-lane profile) covered that lane-naming branch; no device drew it. On such a device the
test also asserts that the fragment stage reads SubgroupSize, so the run shows the tier ran.

The draw of the existing 32-wide lane test moves into a helper both tests share.
2026-12-02 14:24:08 -08:00
Anees Iqbal a3a91a10f2 Conformance ledger: the Accumulate cases' rows as the replay of the Reset answer gives them
The rows of visibility-boolean-accumulate, visibility-counting-accumulate (both),
visibility-counting-accumulate-one-command-buffer and visibility-counting-accumulate-revisit
named the Gap::Draw{AccumulatedVisibilityResults} refusal, which is gone. The conformance
replay on lavapipe at efa04c576a (job m3-max-79548) read those five rows as fixed and gave
six in their place, pasted as it printed them with the venue widened to every venue, as the
rows they replace were:
- divergent at case/pass-0/words and case/pass-1/words of the Boolean and the Counting
  shapes, and at case/pass-1/words of the one-command-buffer shape: Metal on the M3 Max adds
  into the words, the runtime writes each result in place of its word;
- refused at case/pass-0/calls/0-render of the revisit shape: its first mode is now taken,
  so the second mode at the same offset meets Refusal::VisibilityResultOffsetTaken, the
  refusal of visibility-counting-revisit's row, whose text it takes.
No other row moved in that run. docs/CONFORMANCE-COVERAGE.md regenerated.
2026-12-02 14:24:08 -08:00
Anees Iqbal ce471296d5 rt: an Accumulate pass writes its visibility results as a Reset pass does, on every device
set_visibility_result_mode refused Boolean and Counting in a pass whose
visibilityResultType is Accumulate (Gap::Draw{AccumulatedVisibilityResults}, counted in
Metrics::accumulated_visibility_refused). MTLRenderPass.h documents Accumulate in one
sentence, "Accumulate visibility results data across multiple render passes." Measured
(the conformance recordings, values.rs VisibilityResultType): Metal on an Apple M3 Max
(macOS 27.0.1) adds a Counting result into the word's low 32 bits and ORs a Boolean one,
while Metal on a Radeon Pro 5300M and a UHD Graphics 630 (macOS 26.7.1) writes it in
place of the word, as Reset does. The documented sum needs an add of a query's count into
a buffer word: a scratch copy of the query results and a kernel of the runtime's own after
the rendering, which is not built. The planner ruled that the runtime answers Accumulate
as Reset on every device until that sum is built, which then replaces it everywhere.

So the setter takes every mode in an Accumulate pass as in a Reset pass, and the
encoder no longer keeps the pass's visibilityResultType, which nothing reads now.
Removed public items: DrawKind::AccumulatedVisibilityResults and
Metrics::accumulated_visibility_refused (the consumer's checkout names neither in code;
two doc comments and one test of its rt platform describe the refusal:
rt_platform/render.rs:76 and its test at :2299, rt_platform/descriptor.rs:21).
DrawKind::VisibilityResultInterrupt stays refused, its doc now saying why: its answer
needs the same add. docs/API.md's accepted differences records the measured answers; the
rt README, VisibilityResultType's doc, the validation replay's docs and
docs/REPLAY-STREAM.md follow. The validation replay test of an Accumulate stream now
holds that its modes write as a Reset pass's, nothing skipped. REFUSALS.md regenerated
(Gap::Draw loses one site); api_signatures blessed (the two removed records).
2026-12-02 14:24:08 -08:00
Anees Iqbal 002c917994 rt test: an Accumulate pass writes what a Reset pass of the same modes and draws writes (red)
set_visibility_result_mode refuses Boolean and Counting in a pass whose
visibilityResultType is Accumulate (Gap::Draw{AccumulatedVisibilityResults}). The planner
ruled that the runtime answers Accumulate as Reset on every device: Metal on a Radeon Pro
5300M and a UHD Graphics 630 does, and Metal on an Apple M3 Max adds each result into its
word, which no form here builds yet.

The test replaces the refusal's pin: two passes of one command buffer, Reset and
Accumulate, each Counting at 0 over the whole target, Boolean at 8 over its top half and
Counting at 16 with no draw, into buffers of 0xaa bytes. Both read 64, 32, 0 and the
untouched word. Red at the base: the Accumulate pass's first mode is refused.
2026-12-02 14:24:07 -08:00
Anees Iqbal 053a57b831 Harness: churn_rest executes each indirect command buffer it makes, and records the preprocess bytes executions hold
The planner asked for the executed path's objects in churn_rest's gauges. Each iteration's
indirect command buffer (16 indexed draws, three vertex buffers and one fragment buffer a
command, as the owned fixture engine/icb_merged_indexed.ll's icb_indexed_vertex and
icb_indexed_fragment read) is now executed whole, in a pass of its own into an RGBA32Uint target,
with a state of those functions made once for indirect command buffers. Its commands are as the
commit resets them, each drawing nothing: the execution records and takes its preprocess region
as any does. The row's records add preprocess_used_bytes, 0 once a command buffer completed, at
100, 200 and the drop; the first iteration's line shows the idle preprocess bytes kept for the
next execution, which are no record, as they fall to zero at an idle age a settled read does not
fix.
2026-12-02 14:24:07 -08:00
Anees Iqbal 2dc8b1c002 rt: the triangle fill mode of raw value 2 draws as Fill on every device
set_triangle_fill_mode refused TriangleFillMode::Points, the raw value 2 that no SDK
header declares (MTLRenderCommandEncoder.h declares Fill and Lines alone), as
Gap::Draw{FillMode} on every device. Apple's OpenGL renderer sends it for
glPolygonMode(GL_POINT). Metal refuses it on no Mac measured, and the Macs disagree: an
Apple M3 Max and an Intel UHD Graphics 630 draw a triangle's vertices as points, an AMD
Radeon Pro 5300M fills the triangle. The planner ruled that the runtime takes the Fill
answer, which needs no device feature, no pipeline of its own and no precision note.

The setter now takes Points as Fill. DrawKind::FillMode keeps one case, Lines on a
device without fillModeNonSolid. docs/API.md's accepted differences records the
measured answers and that a points form waits for a guest's report that the points
answer matters; the rt README's fill modes and known gaps say the same. REFUSALS.md
regenerated, unchanged (it lists no DrawKind text).

Verified: tests::raster::on_device::every_device_draws_the_fill_mode_of_raw_value_2_as_fill
on lavapipe, red at the test's commit (the setter refused), green here.
2026-12-02 14:24:07 -08:00
Anees Iqbal a98a3f748e rt test: the fill mode of raw value 2 draws what Fill draws, on every device (red)
set_triangle_fill_mode refuses TriangleFillMode::Points, the raw value 2 that no SDK
header declares, as Gap::Draw{FillMode} on every device. Metal refuses it on no Mac
measured: an Apple M3 Max and an Intel UHD Graphics 630 draw a triangle's vertices as
points, a Radeon Pro 5300M fills it. The planner ruled that the runtime takes the Fill
answer, which needs no query and no new path.

The test draws the edge triangle under Fill and under raw value 2, in passes of one
command buffer, and holds that both targets read the same filled texels, and that the
second pass makes no pipeline and waits for none. Red at the base: the setter refuses.
2026-12-02 14:24:07 -08:00
Anees Iqbal 51c4700a76 Validation: the play's own textures take its video and exported surface planes, held from frame 100 to 200
The excess judge's count of the play's own textures adds the planes of its video surfaces
(`Videos::held`) and of its exported surfaces, a plane object that outlives its surface among
them (`Exported::held`); no matrix stream makes either, so neither term had a test. The new
replay test makes a video surface and an exported surface by frame 100, then a second video
surface, releases the exported surface and its plane 1 while keeping plane 0's object, and makes
another exported surface by frame 200: where the device makes every surface the play holds 6
textures at frame 100 and 11 at 200, and every kind's excess holds still.
2026-12-02 14:24:07 -08:00
Anees Iqbal 8209b0d83b Harness: two churn rows make and release every kind of their group in each of 200 iterations, their gauges read at 100, 200 and the drop
The thirteen gauge kinds no replay judges and no harness workload recorded now each have a loop,
grouped as the planner ranked them. `churn_all_day` (OwnRow::ChurnAllDay) makes, uses and releases
in each iteration: a host memory import with a buffer over it; an exported block with a buffer
over it; a video surface of each decoder route the device exports (a dma-buf at the VA-API
layout, the host's opaque handle at NVIDIA's), as the replay player makes them, with a view of
each plane at an index, its buffer in place, and plane 0 kept past the surface's release; the
runtime device tests' plane stand-in surface (two RGBA8Unorm planes of the opaque handle) whose
plane 0 a pass renders beside another colour attachment; two render pipeline states; and a
Private target and a target over a Shared buffer, each drawn into, then read through a texture
after a memory barrier. `churn_rest` (OwnRow::ChurnRest) makes a compute state of one of 40
contents in turn (past the 32 stage entries kept), a draw under a Counting visibility mode into 4
samples resolved into a texture over a Shared buffer, a texture over an exported block read by a
blit, and an indirect command buffer.

Each row reads the device's gauges once it settles (no release waiting, no command buffer
unretired, two reads 20 ms apart equal) after the 100th and the 200th iterations, and once more
after its device dropped (own::run, through the counters that outlive it), and the command prints
them as `M2V-MATRIX gauge harness-<runtime>/<row>/<gauge>@100|@200|@drop`: the harness's gauges
and the eleven kinds they left out (imports, exports, surface imports and buffers, plane
stand-ins, shadows, stage entries, resolve images, textures copied over, occlusion pools,
indirect command buffers). The matrix judges them as every gauge. A kind the device does not
make is left out with its reason on the row's lines; the first line gives each of the group's
kinds live in the first iteration before its release. No kind needed a consumer-side object: the
host import's memory is the row's own, as in the runtime's import tests.

The device tests churn_all_day_holds_every_gauge_still_and_frees_all_at_the_drop and
churn_rest_holds_every_gauge_still_and_frees_all_at_the_drop hold the matrix's rule on the
report.
2026-12-02 14:24:07 -08:00
Anees Iqbal 09e7277972 rt: an event's semaphore counts the event's signals, not Metal's values
rt put Metal's 64-bit event values on the event's timeline semaphore as they were. Vulkan bounds
a signal's distance from the semaphore's value and from every signal pending on it by the
device's maxTimelineSemaphoreValueDifference (VUID-VkSubmitInfo2-semaphore-03883), which a
device may report as 2,147,483,647 (two committed profiles do: nvidia-pascal-linux and
runtime-floor; the 780M under AMDVLK reports 2^32 - 1). So an event's first signal of 2^31 or
more, or a GPU signal just above a host value far above the last GPU signal, was outside valid
usage there.

One form on every device: the k-th signal of an event the submit thread stages signals its
semaphore to k (submit.rs stage), and the event keeps each pending signal as (count, Metal
value). Both rise, since a signal not above the highest value submitted or set is still left
out, so the value the host sees is the value of the signal the confirmed count reached
(EventState::value_of), and a wait for a Metal value waits for the count of the first pending
signal that reaches it (EventState::count_reaching). Every signal moves the semaphore by one, so
no signal lies further from its value than the signals pending on it. rt submits no semaphore
wait for an event, so 03884 never applied; the README's known-gap paragraph, which named it and
waits, is removed, and the event paragraph says what the semaphore holds. The completion thread
confirms and takes in counts (EventInner::take_in); reached() now takes the state its callers
hold. No Vulkan call, GPU work or copy is added: per signal one increment and a (u64, u64) pushed
where a u64 was; per host read an index into the pending signals under the lock already taken.

Metal's answer for a lower signal: the MTLEvent.h and MTLCommandBuffer.h headers say nothing of
one; the conformance case event-highest-signal, recorded on an Apple M3 Max under macOS 27.0.1,
reads 7 after 7 then 4 and after 4 then 7, so a lower signal changes nothing. rt matches: it is
left out and takes no count.

The pending signals have no bound of their own: one 16-byte entry each, which the signals the
submit thread has staged bound (256 of one command buffer were pending at once behind the gate
on the RX 7900 XTX, job m3-max-78721). The count cannot wrap: at one signal a nanosecond, 2^64
counts take about 584 years.

the_largest_value_is_kept no longer skips a device whose limit is below u64::MAX, and its
semaphore reads 1. The tests of the previous two commits failed at them on the RX 7900 XTX (jobs
m3-max-78698 and m3-max-78708: the semaphore read 7 for a 7, 2^40 for a 2^40, 9 for a 9).
2026-12-02 14:24:07 -08:00
Anees Iqbal 182d1d56df rt tests: many pending signals are checked as the submit thread stages them
The first run of many_pending_signals_each_take_the_next_count on the RX 7900 XTX (job
m3-max-78698) found 61 of the 256 signals pending at its first read, not 256: the submit thread
stages a command buffer's signalling segments as its queue's room allows, so the test now reads
the pending signals 200 ms after the first submission, prints how many, and checks that they are
the first ones in order with the semaphore still at 0. Its check of the semaphore's count once
the GPU runs is unchanged, and still fails here.
2026-12-02 14:24:07 -08:00
Anees Iqbal 8220e260b9 rt tests: an event's semaphore counts its signals, not Metal's values
rt puts Metal's 64-bit event values on the event's timeline semaphore as they are, so a signal
can lie further from the semaphore's value than the device's maxTimelineSemaphoreValueDifference
(VUID-VkSubmitInfo2-semaphore-03883; Vulkan lets the limit be as low as 2,147,483,647). These
tests ask for the semaphore to count the event's signals instead:

- a first signal of 2^40 is the semaphore's 1, one of 3 * 2^40 its 2;
- a lower signal moves neither the value nor the semaphore (Metal keeps the highest value: the
  conformance case event-highest-signal, recorded on an Apple M3 Max under macOS 27.0.1, reads 7
  after 7 then 4 and after 4 then 7; the MTLEvent.h and MTLCommandBuffer.h headers say nothing of
  a lower signal);
- a host set between two GPU signals leaves the semaphore where it is, and the next GPU signal
  above it moves it by one;
- a host wait for 8 is met by the later of two pending signals (9), and one at the host's value
  at once;
- 256 signals pending at once take the counts 1 to 256.

They fail at this commit, where the semaphore reads Metal's values: the fix follows.
2026-12-02 14:24:06 -08:00
Anees Iqbal c72ba75343 rt: a blob write skipped past the bound keeps its size as the last written
A blob write skipped past the bound left the last written size where it was. So when the reaper's
last write had read the cache's data and skipped its write past the bound, the device's drop
(Caches::close) found the size changed since the last write. It read the same data again from the
driver and counted a second skip (Metrics::pipeline_cache_writes_skipped) of data that had not
changed.

A skip past the bound now records the cache's size as the last written. The drop then finds no
change since the reaper's last write and neither reads nor counts again. A look never meets this
path: it replaces a cache past the bound before it would write. Skips for a quiesce's deadline
record nothing, so the drop still writes what a quiesce skipped for time.

The cache module's doc, the field's doc, write's doc and the runtime README say so.

Verified, at this commit, by red then green on every_device_replaces_its_pipeline_cache_past_its_bound.
Each job ran the test at this tree, then with cache.rs from the red commit:
- Iris Xe (ANV), m3-max-79405.
- RX 7900 XTX (RADV), m3-max-79427.
- RTX 5080 Laptop (NVIDIA 615.71.09), m3-max-79433.
Green on all three: "writes skipped at the teardown 1", PASS. Red: left (2, 2), right (1, 1).
Lint and the suite on lavapipe, m3-max-79406: clippy -D warnings plain, m2v_cpu_icd and m2v_gpu
EXIT=0; rustdoc EXIT=0; workspace rustdoc of private items EXIT=0; the runtime's suite 914
passed, 3 skipped. On lavapipe this test returns before the teardown part, since lavapipe keeps
no blob or creation to bound.
2026-12-02 14:24:06 -08:00
Anees Iqbal e0026355e7 rt test: the drop reads and skips no blob write the reaper's last write skipped (red)
A blob write skipped past the bound leaves the cache's last written size where it was. So when the
reaper's last write has read the cache's data and skipped its write past the bound, the device's
drop (Caches::close) finds the size changed since the last write. It reads the same data again and
counts a second skip of it.

The bound test now counts the reads of the cache's data for a blob write at the teardown, through
a cfg(test) counter (Counters::read_cache_data, read at the look's, the last write's and the
drop's reads). With the bound at 1 and the cache grown since its last write, the teardown should
read the data once, in the reaper's last write, and count one skip. The test asserted 2 skips
before.

Expected red today: 2 skips and 2 reads at the teardown.
2026-12-02 14:24:06 -08:00
Anees Iqbal 014b3919b1 rt README: idle recorders' 48 says what was measured and what is by structure
The paragraph said only a burst reaches past 48 idle recorders. What was measured is narrower:
the most recorders idle at once in three steady plays (36 on an RTX 5080, 31 on an RX 7900 XTX,
28 on an Iris Xe), so in those plays no recorder of steady use took the releasing reset. The
memory the release gives the driver back is by structure, not measured, and the CPU cost per
frame is not resolved by the Iris instruction count, whose plays spread 22%. Docs only.
2026-12-02 14:24:06 -08:00
Anees Iqbal 4c8152ddd0 rt: idle recorders past the first 48 release their pools' memory and hazard tables
The device keeps up to 64 idle recorders. Until now, every reset that idled one kept its pool's
memory and its hazard table, so a burst of command buffers left up to 64 pools holding the memory
of the largest command buffers they had recorded until the device went.

The idle recorders now sit in two lists:
- warm: at most WARM (48), taken first. A reset that idles a recorder while fewer than 48 are warm
  keeps the pool's memory and the table, as before. Releasing at every reset cost the UHD 630's
  Windows driver about 170 us per command buffer (m3-max-46545).
- cold: past the warm ones, which only a burst reaches, the reset releases the pool's memory
  (RELEASE_RESOURCES) and the recorder drops its hazard table.
64 idle in all stay the bound, and one given back past them is destroyed.

WARM comes from the most recorders idle at once in steady play of three recorded streams, measured
by a probe build (never merged):
- RTX 5080, m3-max-79136: 36, every recorder the play made, idle at each frame's end; in use p50
  5, p90 10.
- RX 7900 XTX, m3-max-79135: 31 (p50 15, p90 26).
- Iris Xe, m3-max-79134: 28 (p50 20, p90 23).
The XTX and Iris counts leave out the moments the play's work drained, when 56 and 64 were idle.
48 is the most (36) and a third. The steady ~50 in use on the XTX and Iris plays are command buffers
held at once; every recorder came back by teardown.

The reset runs outside the lock, after it reads the warm count. A give-back on another thread can
pass that count meanwhile, and a recorder that kept its memory then goes cold, holding it until
its next use, as the doc says.

The runtime README states the rule after the parameter ring's.

Verified:
- Red, then green on the test, a_burst_s_recorders_past_the_warm_ones_release_their_memory. Each
  job ran the test at 904bfe3b45 (base 6a14aa4192), then with this commit's record.rs taken from
  the red commit. Green: 72 given back, 48 idle kept their memory, 16 released it. Red: left
  [(64, 64), (0, 0)], right [(48, 48), (16, 0)].
  - Iris Xe (ANV): m3-max-79201.
  - Radeon 780M (RADV): m3-max-79202.
  - RTX 5080 Laptop (NVIDIA 615.71.09): m3-max-79203.
- At the rebased tip, m3-max-79278 (lavapipe suite): clippy -D warnings plain, m2v_cpu_icd and
  m2v_gpu EXIT=0; rustdoc EXIT=0; workspace rustdoc of private items EXIT=0; the runtime's suite
  913 passed, 3 skipped.
- CPU instructions on Iris Xe, m3-max-79308. The same 792-frame recorded stream was played a b a b,
  each play with a fresh pipeline cache and Mesa's disk cache off (512 pipelines created in each).
  perf stat counted user-space instructions over the whole play: a = the parent, b = this commit.
  - a: 198.1 and 192.7 M per frame.
  - b: 212.1 and 170.1 M per frame.
  The means are 195.4 (a) and 191.1 (b). No increase shows, but the measure only resolves
  differences well above the plays' own spread (b against b, 22%).
- What the device tests show is the pools reset with release and the tables dropped. The memory
  a driver gets back is not measured.
2026-12-02 14:24:06 -08:00
Anees Iqbal 7a2a2247f8 rt test: a burst's idle recorders past the warm ones release their memory (red)
The device keeps up to 64 idle recorders, and every reset that idles one keeps its pool's memory
and its hazard table. So a burst of command buffers leaves 64 command pools holding the memory of
the largest command buffers they recorded, plus their hazard tables, until the device goes.

The test: 64 and 8 recorders, each with a command buffer recorded and a hazard table marked, are
given back. The first 48 (WARM) should keep their memory and tables, and the other 16 should be idle
with both released. Taking the 48 again should leave the released ones idle, and giving them back
should make them warm again. Taking every idle one records into the released ones as well, and
giving them back should leave the same split.

The test seams are cfg(test): WARM, the idle accessor (kept and released, each with how many hold
a table) and Hazards::holds_table.

Expected red today: the burst leaves 64 idle that kept their memory and tables, and none released.
2026-12-02 14:24:06 -08:00
Anees Iqbal d9054b5164 Validation: a play's gauge records are the runtime's objects past the play's own, of each kind the program makes one at a time
A play's frames 100 and 200 are not one loop's iterations: the program makes and releases
objects between them (glbench-3090-r4 holds 62 textures at frame 100 and 690 at 200), so a
runtime gauge held flat there judged the program. The matrix's records of a play are now,
for buffers, textures, samplers and events, the runtime's live objects of the kind less the
play's own (`KIND_excess`): the stream's live objects the backend made, and the backend's own
that stand for them (two-copy Managed buffers' CPU copies and the released ones a commit still
copies, the asides, the guest RAM scratches; the planes' shapes, one texture a plane and shape
that the plane's surface textures and views are views of; the video and exported surfaces'
planes). The settled end lines at frames 100 and 200 carry the play's count of each kind as
KIND_held. An excess below zero is written as it is, which results.py takes for no count.
The runtime's other kinds follow the program's objects and work, not one object each: they are
not replay records (the harness's loops hold those its workloads reach), and every kind stays
held at zero at the device's drop.

Verified: in the hand-over.
2026-12-02 14:24:06 -08:00
Anees Iqbal f4eb47d792 Validation: a play's gauges at frames 100 and 200 go out as the matrix's records, every kind on its end lines
What:
- The runtime backend's end lines (`Backend::live`) carry every count of an object kind the
  runtime keeps live: samplers, LOD clamp variants, level elements, kernel variants and entries,
  render contents, attachment views, descriptor slots, device samplers, shadows, resolve images,
  plane stand-ins, buffer set pools, surface buffers, indirect command buffers, releases waiting
  and handles out join them, and the pipeline cache's bytes.
- At the ends of frames 100 and 200 (GAUGE_FRAMES) the player reads them once they hold still
  (Backend::settled_live): the runtime backend reads them every 10 ms until no release waits and
  two reads in a row agree on every recorded kind, for at most 2 s, a wait no frame's time holds.
  What the program released goes on the runtime's block-maker and reaper threads after the work
  before it retired, so a read straight after the frame's waits could differ between two plays.
- command-replay prints, where the play ended frame 200 and skipped nothing by then,
  `M2V-MATRIX gauge replay-rt/STEM/GAUGE@100` and `@200` for each kind of GAUGED (gauge_records).
  scripts/matrix/results.py judges them as it judges the harness's: equal at 100 and 200, blocks
  no higher at 200.
- Left out, and why: handles_out (1 while the play holds the device), releases_waiting (lowered by
  the block-maker thread whenever it runs), private_units (a layout of memory that follows the
  bytes the program holds), and every byte and age gauge, which follows the program's content and
  the pool's idle clock: the pipeline cache's data (bound 128 MiB), the translator's entries'
  bytes (bound 64 MiB), the staging bytes, the pool's allocated, idle, reserved, reused, taken and
  block bytes, and the shadows', resolve images' and stand-ins' bytes, whose counts are recorded.

Why: the matrix's leak rule (live gauges per resource kind flat between iterations 100 and 200)
reached only the harness's compute workloads. The kinds only draws and passes make (render
contents, attachment views, shadows, resolve images, stand-ins, the samplers draws reach) had no
such check, and a play's end lines lacked 17 of the kinds.

Docs: REPLAY-STREAM.md section 10 (the end line's gauges, the settled read, the records),
VALIDATION.md's gauge row, command-replay's module doc.

Tests: replay::tests the_player_settles_the_gauges_at_frames_100_and_200_alone and
the_gauge_records_are_the_counted_kinds_at_frames_100_and_200; replay::rt_replay
the_end_lines_carry_every_gauge_the_gauge_records_carry (device); test_results.py
test_a_plays_gauges_at_frames_100_and_200_are_held_flat_as_the_harness_s.

Verified: in the hand-over.
2026-12-02 14:24:06 -08:00
Anees Iqbal da37e9e5df validation test: skip an input whose version the toolchain refuses as above its newest
Tally::refused now reads the input's own version and keys the skip on the toolchain's own refusal
of it, compared with the version the toolchain says it takes:

- typed AIR: the input's `!air.version` node, and `xcrun metallib`'s "air version set to X (...),
  but expecting Y". Skipped only where X is the input's version and Y is below it.
- MSL: the source's `// metal-std:` standard S, and `xcrun metal`'s "invalid value 'S' in
  '-std=S'". Skipped only where every `metalX.Y` the compiler's notes offer is below S.

Anything else stays a failure. finish lists each skipped input with both versions, then prints
"SKIP <n> of <inputs> inputs above the toolchain's newest version".

Over the public fixtures, 31 of 582 typed inputs state AIR 2.9.0 (545 state 2.8.0, the rest
older) and 10 of 747 MSL sources name metal4.1. Those are the counts of the two refusals in CI
run 46959260218 on macos-26 (31 and 10). On that runner, the two round trips should print
"SKIP 31 of 582" and "SKIP 10 of 747" and pass.

ci.yml is unchanged. The macos-26 arm64 image 20261123.0526.1 carries Xcode 26.0.1 to 26.6
(default 26.6) and SDKs up to macOS 26.5, so no Xcode on it takes AIR 2.9.
2026-12-02 13:54:10 -08:00
Anees Iqbal 55cca59b13 validation test: an input above the toolchain's newest version is skipped and counted (red)
On macos-26, CI's Xcode 26.6 refuses the public fixtures of AIR 2.9 and Metal 4.1, which come from
the macOS 27 SDK: `xcrun metallib` says "air version set to 2.9.0 (...), but expecting 2.8" for 31
typed fixtures, and `xcrun metal` says "invalid value 'metal4.1' in '-std=metal4.1'" for the 10
sources that name metal4.1. typed_fixtures_round_trip and msl_fixtures_round_trip fail on them.

round_trip_all now keeps each input's outcome in a Tally, whose finish lists every skipped input
and the total above the toolchain's newest version. The tests own their inputs and need no Mac: a
fixture of AIR 2.9 refused by a toolchain that states 2.8, and a source naming metal4.1 refused by
a compiler whose notes offer up to metal4.0, are each to be skipped and counted; every other error
(another metallib error, a refusal whose expected version is not below the input's or names
another version, a refused standard the source does not name or that the compiler offers, any
other compiler error) is a failure, and a failure fails the round trip.

Red here: Tally::refused files every refusal as a failure, so the two skip tests fail.
2026-12-02 13:50:51 -08:00
Anees Iqbal cffa762bda rt: a heap texture placed over another's bytes moves from undefined at its first use, not in an upload
A newer heap texture placed over an older one's bytes moved out of UNDEFINED
in the upload ahead of its first command buffer. Vulkan lets that move write
the image's memory (a compression state's initialization), and a command
buffer that reads the older texture before writing the newer one then reads
changed bytes, where Metal changes none. AMDVLK does this on a Radeon 780M
(round job m3-max-79662, 1 of 915 failed; RADV and ANV pass).

The ruled form, one form on every device with no device or driver key: no
upload moves such a texture. Its first use moves it, in the command stream,
after the earlier reads.

- alias: a texture placed with links is unmoved (Placement::unmoved) as well
  as stale. A first use in a command buffer of a texture unmoved as it is
  encoded, a read included, adds a check at the head of its segment, as a
  first write already did. The segment ends first where a link was read in
  it. The submit thread resolves the check in queue order: a write's check
  moves a stale texture, and any check moves an unmoved one, which is then
  unmoved no more.
- Each heap lists its unmoved textures (Places::unmoved). An entry leaves as
  its texture moves or is released, so the list never holds more than the
  heap's live placements. The device counts them, so use_heap on a device with
  none loads one atomic and locks nothing.
- use_heap (compute and render) is a read of each unmoved texture of the heap,
  since a kernel or a draw may reach it next through an address: its check
  goes where the use_heap is.
- get_bytes of an unmoved texture moves it in its own upload, ahead of its copy
  (alias::host_read). replace_region already moved a stale texture
  (host_write).
- Image.over and its source scope in Image::homing are gone: an unmoved
  image is made homed and never enters an upload's homes.
- Runtime README: the heap texture contract says when the move happens. The
  known gap of textures carries the residuals: a never-written newer texture
  that is read; an older texture read through a heap declaration after a newer
  one over its bytes was made and before that one is written (in both, the
  move may change the older bytes, as AMDVLK's does); a first use rt cannot
  name; and a draw's first use, checked where the pass's part of the command
  buffer starts.

To verify at this commit (jobs in the handover): the red commit's counts test
and heap_alias on lavapipe, clippy in three configurations, doc and private
doc, the runtime and validation suites on lavapipe, AMDVLK on a Radeon 780M
red at the red commit and green here, and RADV, ANV and NVIDIA unchanged.
2026-12-02 13:04:25 -08:00
Anees Iqbal 78af808c98 rt test: a texture placed over another's bytes moves at its first use, not in an upload (red)
A newer heap texture placed over an older one's bytes takes its move from
UNDEFINED in the upload ahead of its first command buffer. Vulkan lets that
move write the image's memory. If the command buffer reads the older texture
before it writes the newer one, the read can see changed bytes, and Metal
changes none. The pin round's AMDVLK leg showed it: Radeon 780M under AMDVLK,
job m3-max-79662 at 685df4244e, 1 of 915 failed. The failing test is
heap_alias's every_device_reads_an_older_texture_before_a_newer_one_over_its_bytes_is_written:
554 of 262144 texels of the older RGBA16Float texture read NaN, for the
RGBA8Unorm 256x256 newer shape, with the RGBA16Float 256x128 and R32Float
256x256 shapes failing the same way. RADV and ANV pass it. That test's comment
now says so.

New counts test in tests/alias.rs, deterministic on every device lavapipe
included. P is written; then Q, R, S and U are each placed over P's bytes:
- Q is written after a read of P: checks [0, 1], one heap move, no upload
  barrier.
- R is read after a read of P: the same for a first use that reads.
- S's heap is declared (useHeap:), then P is read: checks [1], one heap move,
  no upload barrier; declaring the heap again moves nothing.
- U is read by the host (get_bytes): its upload moves it once, the second
  read not at all.
At this commit the uploads move each newer texture, so the upload-barrier,
check and heap-move counts differ (red); the fix follows.
2026-12-02 13:04:24 -08:00
Anees Iqbal 9a89d5e25c CI: the lavapipe image's udmabuf decided by the node's presence, its downloads saved on fetch, its build step limited
lavapipe exports a dma-buf through /dev/udmabuf. The image's containers now get the host's node
wherever the host has one (docker's daemon opens it for them; rootless podman only where the
user may), with the node's group, and `lavapipe-image udmabuf`, which the build step runs, says
which. Where they get none, `nextest` skips the tests and `replay` (new: the conformance replay in
the image) leaves out the cases scripts/lavapipe-image/needs-udmabuf names, each named in the log:
those are measured, each failing without the node and passing with it. The workflow decides by the
node's presence alone; no test is loosened. LAVAPIPE_IMAGE_UDMABUF names another node, or none,
which is how the lab's replica shows what a runner without the node runs.

The downloads are restored before the build and saved right after it, keyed on the pin (the
tarball's sha256, the date and the packages' versions), so a job whose later steps fail still
keeps them. The build step's limit is 90 minutes: a cold fetch at the slowest rate measured from
the archive, one connection at 57 KB/s, of the 127 MB tarball and 135 MB of databases and
packages (262 MB) takes 77 minutes. A fetch that fails ends the build step with the URL and curl's
status, or pacman's, before any test runs; the fetches retry three times.

Measured at this change's parent plus the probe (job m3-max-79668, lavapipe on x86-64 AVX2, no
node passed in): of 807 device tests run, 806 pass and
replay::rt_replay::a_video_surface_is_waited_for_at_its_ready_point_once fails with "the device
exports no DmaBuf"; with the node (m3-max-79517) every one passes. The four surface-textures cases
are refused at replace-region without the node (m3-max-79408) and hold the ledger's expectations
with it (m3-max-79517).
2026-12-02 11:59:40 -08:00
Anees Iqbal 7687644485 CI: the device-executing steps run on lavapipe in an image of one Arch Linux Archive date
CI's lavapipe steps ran on Ubuntu's Mesa 26.0.8 (LLVM 21.1.8), whose llvmpipe faults in its JIT
code on the conformance case reconvergence-constructs' rc_break draw (a null load on its
rasterizer thread), while the ledger's llvmpipe rows were recorded on Mesa 26.2.4 with LLVM 23.1.1.
The device tests, the conformance replay and public case qualification now run in a container
image of exactly that Mesa and LLVM, and nowhere else.

scripts/lavapipe-image/pin names the image: the Arch Linux bootstrap tarball of 2026.10.01 and its
sha256, the archive date 2026-10-05 its packages come from, and each package's exact version
(vulkan-swrast 1:26.2.4-1, llvm and llvm-libs 23.1.1-1, vulkan-icd-loader and
vulkan-validation-layers 1.4.363.0-1, spirv-tools 1:1.4.363.0-1, vulkan-tools 1.4.363.0-1,
python 3.14.7-1). scripts/lavapipe-image/lavapipe-image builds it: the tarball by curl -A curl,
checked against the sha256; its root imported with docker or podman; then pacman, against that
date's archive repositories alone, fetching through curl -A curl (XferCommand), with signatures
required and checked by the bootstrap's own keyring. Its downloads stay under
~/.cache/m2v-lavapipe-image, which CI caches keyed on the pin, so a run whose pin has not moved
downloads nothing. `ensure` prints the pin, the packages the image holds and its device's name and
driver, and fails where any differs from the pin or from the ledger's new `# llvmpipe:` line,
which names the venue's Mesa, LLVM, loader and layers. That line holds upstream versions: the
image is Arch's build (mesa 1:26.2.4-1), and the rows were recorded on another distribution's
build of the same release (3:26.2.4-1).

The tests are built on the host and only run in the image, with no network, only the
environment named, and the checkout mounted read-only (qualification writes the corpus alone).
lavapipe exports a dma-buf through /dev/udmabuf, so a container gets the host's where the host's
user may open it, and offers the exports the host's lavapipe does. Each container is held to its job's memory (LAVAPIPE_IMAGE_MEMORY, else the host's) and CPUs
(CARGO_BUILD_JOBS, else the host's), since the container runtime runs it outside the job's
processes. The archive serves a connection slowly at times, so the build fetches the
transaction's packages eight at a time with the same curl command before pacman runs.
The device tests are the tests the --cfg m2v_cpu_icd build lists and the plain builds do not
(only_in.py): a test that opens a device compiles only under the cfg, and the plain builds' tests,
the .ll fixtures' test with Ubuntu's LLVM 21 among them, run on the host as before. They go into
the image as a nextest archive, which needs no toolchain there; the replay and qualification run
the binaries built in the checkout. The host keeps the Vulkan loader and no driver.

AGENTS.md and CONTRIBUTING say in one sentence each that the pin and the ledger's line move
together.

Verified in the lab's replica of CI's Linux job (job m3-max-79517, at this change on
e086e51c7e, docker 29.10.1, lavapipe on x86-64 AVX2): the image builds from the cached downloads
in 55 s and its check passes (every package equal to the pin; "llvmpipe (LLVM 23.1.1, 256 bits)",
"Mesa 26.2.4-arch1.1 (LLVM 23.1.1)"). The device tests: 810 listed, 809 run, 809 passed. The
conformance replay holds exactly the 4,712 open gaps the ledger expects on llvmpipe, with no fault.
Public case qualification passes. Without /dev/udmabuf (m3-max-79408) one device test met "the
device exports no DmaBuf" and the replay refused four surface-textures cases at replace-region;
with it both are as the ledger expects. The two red host steps of both runs, golden_hashes and
the pinned opened chains, are the tables the next pin blesses, not this change.
2026-12-02 11:50:03 -08:00
Anees Iqbal d122da6ae3 Tests: the killed-helper test's threads drop their device clones before they answer
a_helper_killed_mid_make_leaves_every_make_its_refusal_at_once makes each
pipeline, and the stage fill, on a detached thread holding a clone of the
device, and that thread sent its answer before its clone was dropped. After
the last answer the test drops its own device and returns, so a detached
thread could hold the last reference and destroy the device while the
process exits. Each thread now drops its clone before it answers, so the
test's own drop is the device's last.

Test-only: no product file changes.

Seen once: the pin round's runtime item on a Radeon RX 7900 XTX (RADV
NAVI31), job m3-max-79526, at 685df4244e: the test printed its two lines
and "test result: ok", then the process ended with SIGSEGV. The same item
passed this test on the Iris Xe, the Radeon 780M, Hawk Point, the RX 550,
the RTX 2080 and the RTX 5080 Laptop.
2026-12-02 11:47:36 -08:00
Anees Iqbal 71750115c3 Tests: a video surface's ready wait counts in the copy form too
a_video_surface_is_waited_for_at_its_ready_point_once asserted that only a
surface in place counts a ready wait, the copy form's returning at once.
d0a424060a made Surface::wait_until_ready wait in both forms, the copy
form's for its block's making, and documented it so; the test kept the old
expectation. Its device runs were on devices that take the surface in place
(lavapipe, the Radeon 780M, the UHD 630), so the copy form's count was not
run until the pin's round on discrete cards, which take this 64 by 64
surface at a 64-byte pitch as a copy. The test now expects one wait in
either form.

Test-only: no product file changes.

Verified (red), at 685df4244e, the round's runtime item, 979 of 980 passed,
"surface_waits" left 1 right 0 with the surface copied: GeForce RTX 2080
(m3-max-79524), Radeon RX 550 (m3-max-79581), GeForce RTX 5080 Laptop
(m3-max-79542). The Iris Xe and the Radeon 780M of the same round take it in
place and passed.
2026-12-02 11:34:10 -08:00
Anees Iqbal f645dde503 Tests: the time-breach lives skip a driver whose pipeline cache keeps no creation
a_time_breach_is_asked_once_more_by_a_later_device made the pipeline from
a helper's fill on every device that keeps a blob. lavapipe of Mesa 26.0
keeps nothing of a creation in its pipeline cache (keeps_creations' doc), so
there a fill's entry makes no pipeline and the make after the fill met
CompileRequired. The product answered as documented; the test lacked the
guard a_kernel_past_the_stage_bound_is_made_only_from_its_helpers_fill has.
The test now asks keeps_creations for each device while the kernel is within
the bound, as that test does, and skips a device that keeps none.

Test-only: no product file changes.

Verified (red): the CI replica's lavapipe step (Ubuntu's Mesa 26.0.8, LLVM
21.1.8), job m3-max-79286, at the cut: "after the fill: a stage of entry
weight 264 past the stage bound is not made: its helper's compile met
CompileRequired".
2026-12-02 11:29:06 -08:00
Anees Iqbal 685df4244e Validation: the authored compile census re-blessed at semantics 2318
The census table moves with the translator since the last pin: 1903 rows change, every one a
new artifact hash (the product fingerprint moves with SEMANTICS_VERSION 2311-2318). Fifteen rows
change class, all from not_supported to compiled, none the other way: eight that needed the
IdentityDomains form, which the identity-domain reads since 2f16658ac2 build, and seven whose
PixelCoverageAtSampleRate or SampleRateShading needed ShaderSampleRateInterpolationFunctions,
which the moltenvk-m3 profile's stated portability feature now meets (341b80cdef). Blessed by
corpus-triage --audit authored-compile --bless on an Apple M3 Max (job m3-max-79338, census
exit 0). Table only.
2026-12-02 10:54:32 -08:00
Anees Iqbal 6d7127708d Tables: golden hashes at semantics 2318, and the MoltenVK profile's opened chains with its stated portability features
The golden hashes table moves from semantics 2310 to 2318 (the bumps of 2311-2318 since the last
bless): 2418 rows change, 1136 engine .ll and 1131 engine .air.ll fixtures plus 151 others, every
change a hash to a hash. Blessed by bless_golden_hashes on an Apple M3 Max (job m3-max-79327),
where the engine inventory and the AIR printouts were blessed unchanged and the metallib half of
committed_air_fixtures_parse_and_link ran un-skipped and passed (linkhalf 0).

opened_chains.txt: the moltenvk-m3 device and restricted contexts now enable the portability
features that profile states (constantAlphaColorBlendFactors and the others 341b80cdef passes on),
so their chain hashes move. Blessed by bless_opened_chains (job m3-max-79328, lavapipe node);
every_committed_profiles_context_enables_its_pinned_chain passes after it, and failed before it
in the pin's lavapipe suite (job m3-max-79276).

Tables only; no source change.
2026-12-02 10:36:52 -08:00