Commit Graph
9900 Commits
Author SHA1 Message Date
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
Anees Iqbal 8f708a85b8 rt: a portability device's other portability features reach the translator where it states them
The floor asked a device listing VK_KHR_portability_subset for four portability features and
enabled only those, so the translator's description withheld the six others it names
(constantAlphaColorBlendFactors, vertexAttributeAccessBeyondStride, samplerMipLodBias,
shaderSampleRateInterpolationFunctions, separateStencilMaskRef, pointPolygons) on every such
device, and the translator took its form without each (a refusal of sample-rate interpolation,
of triangles filled as points, a withheld sampler bias) though the device states it.

floor.rs: PORTABILITY_STATED holds the six. decide() copies each as the device states it, beside
the optional tables, and no device misses the floor for one; device creation enables what decide
copies (consumer_features starts from it), and ENABLED carries the table, so named_features and
shader_enables pass each enabled one to the translator. A device that does not list the subset
reports none and chains no portability structure.

README: the table of stated portability features under Portability features; tests::floor holds
it to the code.

No device above the floor lists the subset: on the M3, KosmicKrisp (Mesa 26.3.1) lists none, and
MoltenVK 1.4.2 lists it but lacks nullDescriptor and logicOp (job m3-max-79220, which ran a
device leg printing each device's stated and given features). So the change is held by the unit
test on the floor's queries.
2026-12-02 10:19:41 -08:00
Anees Iqbal e2750b6723 rt test: a portability device gives the translator each portability feature it states (red)
The floor's PORTABILITY table enables only the four portability features it requires
(imageViewFormatSwizzle, mutableComparisonSamplers, multisampleArrayImage, imageView2DOn3DImage),
so on a device that lists VK_KHR_portability_subset, shader_enables passes the translator none of
the six other portability features it names (constantAlphaColorBlendFactors,
vertexAttributeAccessBeyondStride, samplerMipLodBias, shaderSampleRateInterpolationFunctions,
separateStencilMaskRef, pointPolygons). The translator then refuses what they carry (sample-rate
interpolation in census 65547 on MoltenVK) though the device states them.

A unit test on the floor's queries: a device at the floor listing the subset and stating every
portability feature; it asks that each portability feature the translator names reach
shader_enables. Expected red until creation enables them where the device states them.
2026-12-02 10:19:41 -08:00
Anees Iqbal 4609b8c9ac Validation: the runtime guard's hash for the emulated tier's partial-threadgroups variant
The emulated simdgroup tier's partial-threadgroups variant (15e53e4209, 54d2087b83) changed
metal2vulkan/src/lower/dispatch.rs, one of the runtime inputs: KernelDecl::live now also returns
the threadgroup's live thread count, and emit_entry keeps it for the entry. That is compile-time
emission only; what it emits is in the pipeline the artifact digests, and SEMANTICS_VERSION 2318
already covers it. No behaviour of a run changes beyond that, so only the hash moves and
RUNTIME_VERSION stays 2551. Seen in merge check m3-max-79171 (lavapipe, validation suite).
2026-12-02 10:19:37 -08:00
Anees Iqbal 4edb8041ba rt test: the bound test ends its open creation while the device's last handle goes on another thread
every_device_replaces_its_pipeline_cache_past_its_bound hung on every card (XTX, RTX 2080,
Iris Xe; 600 s, then killed). It holds a creation guard open (cache::creation) so no look comes
before the teardown, and it dropped the device's last handle before that guard. Since
4346532344 the teardown's last write (Caches::last_write, with no deadline at a teardown)
waits for a creation still running, so the drop waited for the reaper, and the reaper for the
guard the same thread held: under gdb on the XTX (m3-max-79155) the test thread was in
Shared::drop -> halt -> finish -> Ended::wait and the reaper in last_write (cache.rs:1841).
8dd00ec58c hangs the same way (79155, the test alone, exit 124).

No product path can do this. The one creation guard, in made_through_cache (pipeline.rs), covers
only its vkCreate*Pipelines call (render.rs, pipeline.rs, own.rs); no consumer code, no
completion handler and no drop of a state, library or handle runs under it, and the runtime
has no completionHandler forms. A last handle dropped on another thread waits only for that
create to end. Creation's doc now says the guard lives on its creating thread for that create.

The test now drops the device on another thread, waits for the reaper to stop, and then ends
the creation. With the bound lowered past the cache, both of the teardown's writes are skipped
and counted: the reaper's last write (1), then the drop's (2), since a skipped write leaves the
size last written as it was. The blob keeps the fresh cache's data.

The hang begins at 4346532344: the test alone on the XTX passes at 9f680a352e and at its parent
1149c04081, and is killed at 120 s at 4346532344 (m3-max-79175).

Verified: the test and the other blob and stage tests, 15 in all, pass on an RTX 2080
(m3-max-79189), an Iris Xe (m3-max-79188), a Radeon 780M and an RX 550 (m3-max-79242) and the
lab's lavapipe (m3-max-79237). Lint (fmt, the generated tables' checks, clippy plain, under
m2v_gpu and under m2v_cpu_icd, rustdoc and the private rustdoc) passes (m3-max-79221).
2026-12-02 10:14:56 -08:00
Anees Iqbal fd80fd886b rt tests: the pipeline cache's blob tests ask whether the driver keeps a creation in its cache
Twelve device tests wanted a blob, a grown blob or a stage fill's pipeline wherever the device's
cache data begins with a usable header. The runtime writes the blob only where the cache's size
changed since the last write, and a stage's pipeline is made from the helper's cache data alone;
a driver may keep nothing of a creation in its cache. On Mesa 26.0.8's lavapipe (LLVM 21.1.8,
the CI's) the empty cache's data is its 32-byte header and stays 32 bytes after a render
pipeline or a kernel is made through it, so no blob is written, and a stage fill's data is
answered compile-required, which the runtime keeps as a breach and refuses as a typed
StageSize gap (StageBreach::CompileRequired). The render test failed there at 9f680a352e too,
before the blob-write changes, so this is the device's answer, not a regression. The node's own
lavapipe (Mesa 26.2.4) gives a header the runtime does not take, so those tests already took
their no-blob arm there.

tests::keeps_creations asks it: a device on no cache directory makes the test's own pipeline,
and the cache's data grew. Where it did not, it says so, and:
- the render and kernel cache-directory tests, the second-process test and the header test want
  no blob;
- the bound, quiesce, deadline, skipped-write, removal, three-times and seed tests take their
  no-blob arm, as for a device with no header;
- the stage-fill test wants the fill's make refused with the compile-required breach, and asks
  the driver before it sets the test's stage bound, while the kernel compiles in this process.
Every other assertion is unchanged; a driver that keeps its creations runs each test as before.

Verified: the CI replica's step 15 in full with no fail-fast, 2331 passed and 6 skipped
(m3-max-79120, Mesa 26.0.8 lavapipe). The twelve tests and the stage test pass on an RTX 2080
(m3-max-79189), an Iris Xe (m3-max-79188), a Radeon 780M and an RX 550 (m3-max-79242) and the
lab's lavapipe, Mesa 26.2.6 (m3-max-79237), with the next commit.
2026-12-02 10:14:56 -08:00
Anees Iqbal 91f3e1ed60 Validation: the replay's stand-in checks the hang tripwire before it opens its device
The exported-surface stand-in (replay/new_runtime/standin.rs) opens a Vulkan device of its own
with vkCreateDevice, and gpu::tests::device_opens_exist_only_behind_the_tripwire_check failed on
it: the open was in no row of the test's table. The stand-in is made at a play's first export,
after the play's GPU work began, so a hang its waits wrote to the tripwire could already be set
when it opens; the tripwire's contract is that no GPU entry point starts new work while it is
set. StandIn::new now calls refuse_if_tripped first, and the table names its open.

The test's ordered check (the tripwire check before the open, in the open's own file) held only
the runtime's device opens; it now holds every row, each of which already met it.

Verified in the CI replica's environment (Ubuntu's Mesa 26.0.8 lavapipe, LLVM 21.1.8, VVL
1.4.341): the test passes (job m3-max-79044), and CI's step 12 in full with no fail-fast passes,
1313 passed and 3 skipped (m3-max-79062).
2026-12-02 10:14:56 -08:00
Anees Iqbal fcdcffea07 Docs: REFUSALS.md regenerated after the slot-usage refusal met the word-bound draw
The draw now refuses a missing pipeline state at two sites, one from the word-bound content's
path (7a1da6cb22) and one from the slot-usage check (73bb5eb204); each branch regenerated the
table on its own base, so the landed tree counted one. Regenerated with
scripts/refusal-surface/refusal_surface.py; no code change.
2026-12-02 10:12:50 -08:00
Anees Iqbal c25a5b238a rt: a view made with a swizzle keeps its texture's usage at a slot, as its known gap rules
8811dd6790 checked a texture slot against the usage Metal answers, and answered a view made with a
swizzle as ShaderRead and PixelFormatView alone, so a kernel's write through such a view became
Refusal::TextureUsageAtSlot. That reversed the runtime's recorded known gap of swizzles (README,
Known gaps of textures: a view's descriptor reports its base texture's usage, so a draw into such
a view and a kernel's write through it run, the write stored unswizzled; docs/API.md's accepted
differences), on which OpenCL mode stands: Apple's OpenCL binds an image of most channel orders
as a swizzled view and writes it (tests/opencl_swizzles.rs, job m3-max-16336). The runtime suite
on lavapipe at b28f70e076 (job m3-max-78531) failed three tests on it:
opencl_mode_queries_of_a_swizzled_write_only_image_answer_the_view,
opencl_mode_writes_through_a_swizzled_image_store_the_value_as_written and
every_device_reads_through_a_view_s_swizzle_and_writes_past_it, each "the Kernel function uses
texture slot 0, whose texture's usage MTLTextureUsageShaderRead |
MTLTextureUsagePixelFormatView lacks what its access there asks".

The slot check now takes the texture's descriptor usage (TextureObject::metal_usage: Metal's
unknown usage as 0x17, a view's its texture's, a swizzled view's included). The known-gap text
and new_texture_view_with_swizzle's doc are as before 8811dd6790; the refusal's doc, the README's
Texture slots and usage and RESOURCE-ID.md say a view's usage is its texture's, a swizzled one
included. The slot_usage test's swizzled destination is now a case that runs and stores the
texel as written.

The same run failed every_device_gives_an_index_to_the_texture_placed_there_last, whose dispatch
wrote through A, a texture of ShaderRead usage alone, at sample_down's written slot: that is the
refusal Metal's validation gives, and the test's point is that A's placement empties D's storage
element. It now writes through D's ID, the same index, which D's ShaderWrite usage lets the slot
check pass, and D still keeps its texels.

Verified: cargo fmt; refusal_surface.py --check (REFUSALS.md unchanged). The suite run of this
commit follows as a job. The other 865 tests of job m3-max-78531 passed (3 skipped).
2026-12-02 10:12:04 -08:00
Anees Iqbal da03093c0c rt: TextureUsageAtSlot's basis quotes Metal's (t[0]) as code, which rustdoc read as a link
Rustdoc with -D warnings refused the basis line of Refusal::TextureUsageAtSlot: the quoted Metal
validation text "reads texture (t[0]) whose usage ..." holds t[0], which rustdoc reads as an
intra-doc link to an item named 0 ("unresolved link to `0`", error.rs, three times, in both the
public and the private-items build). The three t[0] are now code spans and the lines reflowed
under 100 columns; REFUSALS.md regenerated (the row's text; basis.rs is unchanged).

Verified: the failure is job m3-max-78486's rustdoc steps (doc and privdoc EXIT=101; fmt, clippy
over the workspace and under --cfg m2v_cpu_icd and --cfg m2v_gpu, refusal_surface --check and
the signatures check passed there). Here: cargo fmt and refusal_surface.py --check; the rustdoc
run of this commit follows as a job.
2026-12-02 10:12:04 -08:00
Anees Iqbal 73bb5eb204 rt: a dispatch or draw whose texture lacks the usage its slot's access asks is TextureUsageAtSlot
A function's texture slot bound to a texture whose usage lacks what the function's access there
asks reached no element of the texture's and ran: it read element 0 of set 1 (nil's null
descriptor) or a null element as zeros and dropped its writes, with no refusal and no count. The
textures: one no shader reaches (no index: a Depth32Float target of RenderTarget usage alone, a
texture of PixelFormatView usage alone), a colour target of RenderTarget usage alone (null
elements), a texture not made for shader writes at a written slot (no storage element), and a
view made with a swizzle at a written slot (written unswizzled, where plain Metal writes through
the swizzle).

Each dispatch and draw now checks, once after the pipeline state or a binding changes and before
it records anything, each texture its functions' slots reach against the usage Metal's validation
asks by the access the function declares there (pipeline::slot_usage): ShaderRead for a sample or
read slot, a size query alone included; ShaderWrite for a write or read_write slot; both for a
read_write slot it reads. The texture's usage is Metal's answer (TextureObject::metal_usage):
the descriptor's, Metal's unknown usage as 0x17, and a texture reading through a swizzle other
than the identity ShaderRead and PixelFormatView alone. A texture short of it refuses the command,
Refusal::TextureUsageAtSlot { stage, index, usage }, binding and recording nothing. The binds take
every texture, as Metal's do. Gap::SwizzledReadWrite stays checked first for a read_write slot it
reads. The check reads facts the interface and the texture already hold; nothing runs per draw.

Basis (the previous commit's measurement, an Apple M3 Max, macOS 27.0.1, jobs m3-max-78392 and
m3-max-78422): plain Metal reads and writes the texels; Metal's validation asserts "Compute
Function(k_read): reads texture (t[0]) whose usage (0x04) doesn't specify
MTLTextureUsageShaderRead (0x01)", "writes texture (t[0]) whose usage (0x01) doesn't specify
MTLTextureUsageShaderWrite (0x02)" (an access::write argument asked only its width included), and
"Fragment Function(f_first): Shader reads texture (t[0]) whose usage (0x04) doesn't specify
MTLTextureUsageShaderRead (0x01)".

Docs: REFUSALS.md regenerated (the refusal's site); the runtime README's Textures section states
the rule (Texture slots and usage) and its compute encoder, render encoder and swizzle entries
name the refusal; RESOURCE-ID.md's sentence that a slot binding a colour target of neither usage
reads nil now says what a runtime refuses; the doc comments of set_texture, set_vertex_texture,
dispatch_threadgroups, draw_primitives, gpu_resource_id and new_texture_view_with_swizzle name it.

The test literals of the kernel interface and of a content's draws (tests/compute.rs,
tests/indirect.rs) take the new field.

Verified: cargo fmt. The red and green runs, clippy and the runtime suite on lavapipe follow as
jobs.
2026-12-02 10:12:04 -08:00
Anees Iqbal 9ad296c6cd rt: Refusal::TextureUsageAtSlot, and a test of slots whose texture lacks the usage they ask (red)
A texture slot a function uses, bound to a texture whose usage lacks what the function's access
there asks, reaches no element of the texture's, and nothing refuses it: the slot reads element 0
of set 1 (nil's null descriptor) as zeros and its writes are dropped. A texture no shader reaches
(a Depth32Float target of RenderTarget usage alone, a texture of PixelFormatView usage alone) has
no index; a colour target of RenderTarget usage alone has an index whose elements are null; a
texture not made for shader writes has no storage element. This is the index-free direct bind of
the consumer's row 194 that is still open after f3bb94275b, which refuses the bind of a texture
reached through its views alone.

Metal binds such a texture and its validation stops the command that uses the slot, by the
argument's declared access; plain Metal reads and writes the texels. Measured on an Apple M3 Max,
macOS 27.0.1 (jobs m3-max-78392 and m3-max-78422, runtime-compiled MSL):
- setTexture:atIndex: binds every such texture, under the validation layer too;
- the validation layer asserts at the dispatch "Compute Function(k_read): reads texture (t[0])
  whose usage (0x04) doesn't specify MTLTextureUsageShaderRead (0x01)" for a sample, a read or a
  get_width alone of an access::read or access::sample argument; "writes texture (t[0]) whose
  usage (0x01) doesn't specify MTLTextureUsageShaderWrite (0x02)" for an access::write argument,
  its get_width alone included; both for access::read_write; and at the draw "Fragment
  Function(f_first): Shader reads texture (t[0]) whose usage (0x04) doesn't specify
  MTLTextureUsageShaderRead (0x01)", the pass's own attachment included;
- Metal's unknown usage answers 0x17 and passes every access; a view's usage is its texture's
  (0x14, 0x11); a view made with a swizzle answers 0x11 (ShaderRead | PixelFormatView) of a
  texture of 0x13 and of one of unknown usage, and a write of it asserts;
- with the layer off, plain Metal reads the depth (0.75), the texels (64, 128, 192, 255) and the
  width (4) in every case, and writes a swizzled view through its swizzle.

This commit adds the refusal a dispatch or draw will return (stage, slot index, the texture's
usage as Metal answers it), its basis line, REFUSALS.md, basis.rs and the signature table, and the
device test slot_usage: sample_down (slot 0 sampled, slot 1 written and its size asked),
depth_fill_read and first_texel_fragment over textures of each usage. Its controls (read and
write usage, unknown usage, a view of a read texture, a read depth) run with their texels; a
render-target colour source, a read-only destination, a swizzled view's destination, a
render-target depth with no index and a PixelFormatView-only texture with no index expect the
refusal and their bytes kept. The commands do not refuse yet, so the test is red here: they run
and read zeros (or drop or unswizzle the write). The next commit makes them refuse.

Verified: cargo fmt; the red run is the next commit's job.
2026-12-02 10:12:04 -08:00
Anees Iqbal 1b240ba508 rt README: an M3 Max runs a wait met early in another queue's command buffer beside it
The queues' known gap (c9cf5bb1cc) said what the runtime does and what Metal's documented order
asks. This adds what Metal does, measured in the same two shapes by a new conformance probe,
cross_queue_event_stall.m: A on one queue runs a short dispatch, signals an MTLEvent, then 25
spins of 4.00 ms; B on another queue, committed after it, waits and runs one thread over its own
buffer; then the same with an MTLSharedEvent the host sets after both commits. Five rounds each,
MTL_DEBUG_LAYER unset, job m3-max-79181 on an M3 Max with macOS 27.0.1: B's GPU end came 0.01-0.08
ms after A's GPU start while A ran 99.96-100.00 ms, and 0.13-0.15 ms after the host's set while
A ran 99.95 ms. So the gap stands: the runtime's waiter starts at the signalling command buffer's
end (28.5-111.0 ms in the runtime's measurement), Metal's at the signal.

The probe's header records the result. Docs and a probe only.
2026-12-02 10:00:39 -08:00
Anees Iqbal c9cf5bb1cc rt README: a wait met early in another queue's command buffer runs after that whole command buffer (known gap)
L65. Every queue submits to the device's one VkQueue and each segment ends with one global
barrier, so a waiter runs after every segment its signaller submitted ahead of it: the rest of
the signalling command buffer, not only the signal. Metal's documented order asks only for the
signal. Recorded in the queues' known gaps with what was measured.

Measured by a WIP probe (not landed; steelbrain/fix-rt-l65 7d5b5cbd21, lavapipe at cef6068642):
A runs a short dispatch, signals an Event, then about 100 ms of dispatches; B, committed after
it on another queue, waits and runs one short dispatch over buffers of its own; five rounds,
then the same with a SharedEvent the host sets after both commits. The stall beyond the event's
order: RTX 2080 99.2-100.8 ms (job m3-max-79162), Radeon 780M RADV 99.6-99.7 ms (79142), Iris Xe
ANV 28.8-46.0 ms (79143, its A 28-46 ms), lavapipe 110.5-110.9 ms (79126, B on A's buffers);
host shape 100.9-101.0, 100.5-101.4, 28.5-29.0, 110.3-111.0 ms. Docs only.
2026-12-02 09:56:42 -08:00