Commit Graph
10325 Commits
Author SHA1 Message Date
Anees Iqbal 269e501b4f Runtime test: an unkept over-copy kind counts under its cause too (red)
Metrics::over_copies_unkept_kind counts the over-copies whose kind the counters did not keep,
the 256 kinds being full, as one number, so a reader cannot say which cause those copies had:
a consumer's walk on the Radeon 780M showed 138 of them in one arm of four, and nothing named
their cause.

This adds one field a cause, over_copies_unkept_kind_<cause>, beside the cause's pair
(over_copies_<cause> and over_copy_bytes_<cause>), and extends
the_counters_name_each_copied_kind_once_up_to_their_bound: filled past the bound with kinds of
the causes in turn, the three unkept kinds (dedicated twice, surface and spilled once each) must
count under their causes, and the causes must sum to the aggregate. The fields are read from
counters that nothing moves yet, so the test fails: every cause reads 0 against 2, 1 and 1.

The API signature table is blessed for the 14 fields. The runtime-sources pin does not move
(counters.rs is not among its inputs).
2026-12-03 08:40:28 -08:00
Anees Iqbal b531238180 Tables: pin U's golden hashes and authored compile census, blessed at c6a7995260
The golden table (bless job m3-max-84114, on the M3 Max) and the authored compile census
(m3-max-84121, census at c6a7995260: 2390 cases, 9 profiles, 0 failed, 161 differences, 0
regressions) at the pin's tip. Every moved cell is attributed to its commit.

Golden (blesses at each SEMANTICS step, cell by cell per profile):
- 180 cells, 12 rows x 15 profiles, from Unsupported{IdentityDomains; NotImplemented} to
  hashes: rfs_kernel_lod's lod_2d, lod_2d_array, lod_3d, lod_cube and lod_vertex, and
  sampling_completion's lod_query_kernel, in both fixture forms (.air.ll and .ll). All moved at
  c04212227d (red) and 5b3bd800c0 (a runtime sampler's LOD query outside a fragment function
  compiles under the identity domains).
- 60 cells in 4 new rows: coherent_texture_handoff and coherent_texture_handoff_seen in both
  forms, from the fixture commits 3994ea73dc, 5410866d9a and 18e8600cbb; all hashes.
- The semantics line, 2347 to 2353. No other cell moves.

Census (cold blesses at each step; T's committed table equals a cold bless at T, 0 changes):
- 36 cells, 4 cases x 9 profiles, from not_supported{unsupported:not_implemented
  IdentityDomains} to compiled at 5b3bd800c0, the same LOD query fix (m3-max-84197).
- 16 new cases from c5f979d985 and df54afeef2, the LOD clamp cases qualified on the M3 Max
  (m3-max-84198); 1 new case from 8e912a905d, coherent_texture_handoff.
- No compiled artifact's digest moves in the steps read so far; the remaining steps read after
  the push and are fixed forward.

States-only plays at T and at U are equal (m3-max-84116, 84117). Merge legs at c6a7995260:
m3-max-84110 (signatures, clippy plain, m2v_gpu and m2v_cpu_icd, rustdoc, translator suite 3459
passed 37 skipped, lavapipe rt 993 passed 4 skipped at its own width and at 128 bits,
validation 1349 passed 3 skipped, lavapipe validation 1477 passed 3 skipped, conformance build
and lavapipe conformance EXIT=0, all steps EXIT=0) and m3-max-84111 (copy form on the RTX 5080
Laptop, 41 passed).
2026-12-03 08:39:06 -08:00
Anees Iqbal c6a7995260 RUNTIME_VERSION 2562: a restoring make counts its waits in the metrics
The brief for this change asks for the bump at READY. A run of an unchanged artifact now adds to
six more Metrics fields (restoring_makes and the five after it) at each make of a texture in place
over host memory's import; its answers, refusals and submissions are unchanged. Main renumbers at
landing.
2026-12-03 07:47:39 -08:00
Anees Iqbal 4d88ded1c6 Runtime tests: restore_waits' make thread borrows the buffer alone
Over holds the import's host mapping, a NonNull that is not Sync, so the scoped thread could not
borrow the whole Over: the lib test did not compile (lavapipe build, job m3-max-84045). The thread
now borrows the buffer and the descriptor and sends back whether the texture is in place, as
restore_batch's does.
2026-12-03 07:47:34 -08:00
Anees Iqbal 66a1665f51 Runtime: a restoring make counts its two waits, and whether its restore rode shared uploads
The consumer's walk on the Iris Xe reads one long restore span a walk (57.3 and 57.9 ms at pin S),
in a HEIC step whose VA-API decodes write rt's exported blocks, and nothing in the runtime splits
a restoring make's wait, so the walk cannot say what the span waited for. A fenced make waits
twice: for the GPU work already submitted, before the fence's before, then for the progress value
its flush gave, inside the span. That second wait holds the batch that carries the restore (every
upload of any thread not yet submitted, and a group's copies into its textures' images), the GPU
work submitted ahead of it on the one queue and, where an upload of the batch uses memory another
API shares (an exported block's zero fill, a copy from one), the group's first part, since such
uploads signal no value of their own.

Metrics counts, with nothing run beside the work:
- restoring_makes, once each make's wait returned;
- restoring_make_drain_nanos, the fenced make's first wait;
- restoring_make_wait_nanos, the wait for the restore, and restoring_make_wait_submissions, the
  submissions the completion thread had not yet seen complete as it began (more than one: work
  submitted ahead of the restore's batch);
- restoring_makes_shared and restoring_make_shared_wait_nanos, the makes whose restore went ahead
  of a group's command buffers in uploads that use memory another API shares. Each restore's
  upload carries its make's flag (Keep::Restore's, through Restoring), which submit() sets before
  the vkQueueSubmit2 where it sends awaited uploads that share memory with no signal of their own;
  the make reads it once its wait returned.

The runtime README's fence paragraph names the fields. The signature table gains them.
2026-12-03 07:47:34 -08:00
Anees Iqbal 46ae50e00f Runtime tests: a restoring make's two waits and its shared uploads in the metrics
restore_waits.rs checks the six restore-wait fields the next commit counts, on every device of the
cfg's kind whose texture over host memory's import is in place:
- a make without a fence counts one restoring make, its restore wait and the submissions it
  waited for, and no drain;
- a fenced make counts its drain (the wait for the GPU work already submitted, before the fence's
  before) as well;
- neither counts among the shared makes;
- a make whose restore goes ahead of a group's command buffer with a new buffer's zero fill in an
  exported block (an upload that uses memory another API shares, which signals no value of its
  own) counts among the shared makes, its wait in theirs.

Metrics gains the six fields, read from atomics nothing adds to yet, so both tests fail here: the
red for the counting that follows.

Verified: red on the venues the next commit names (this commit's run is in its body).
2026-12-03 07:47:34 -08:00
Anees Iqbal 75e28a1ac5 API signatures: metal2vulkan-air's Global gains thread_local
Blessed with scripts/api-signatures/signatures.py --bless: one record added, the new field.
2026-12-03 07:47:10 -08:00
Anees Iqbal b63295b0bb Translator: the thread-local test's kernel reads its thread's index in its threadgroup
Its one threadgroup's index is the thread's grid position, which Metal's run read; the grid
position takes a push field of its own, which the test's interpreter run does not fill.
2026-12-03 07:47:10 -08:00
Anees Iqbal 0daff51641 Translator: a thread-local global of the thread address space is each thread's own, from its initializer
The AIR reader refused every thread-local global (ModuleRecord{code: 7}). Metal runs one of the
thread address space as an object each thread holds, starting at the initializer in every dispatch
and reached through the functions the thread calls (M3 Max, Metal toolchain 32023.922, macOS 27:
128 of 128 threads read the initializer, then their own 3t+1 after a barrier, in each of two
dispatches of one pipeline). That is SPIR-V's Private storage class with an initializer.

- metal2vulkan-air: Global gains thread_local; the reader reads it on a thread-space global and still
  refuses it on any other space (ModuleRecord{code: 7}), as it refuses comdats.
- metal2vulkan: the memory plan places a thread-local global as the typed Private form a closed
  constant global takes (ConstGlobalForm::Private), its writes its thread's own; one the typed form
  cannot hold is refused (GlobalVariable), as the constant blob is shared and read-only. Its
  thread-space pointers take that form, and a typed store into it is allowed where a constant's is
  ReadOnlyStore.
- SEMANTICS_VERSION 2352 -> 2353: modules with such a global now translate.

Verified: see the job lines in the lane's READY report (red at 364ad75207, green here).
2026-12-03 07:47:10 -08:00
Anees Iqbal 06c17330c9 Translator: a thread-local global of the thread address space is each thread's own, from its initializer (red)
Metal runs a module with `@g = internal thread_local unnamed_addr global i32 <init>` in the thread
address space: on an Apple M3 Max (Metal toolchain 32023.922, macOS 27) each of 128 threads read the
initializer first and, after storing 3t+1 and crossing a threadgroup barrier, read its own 3t+1 back
through a helper function, in each of two dispatches of one pipeline; the same global without
thread_local is refused at pipeline creation ("Undefined symbols: g"). The AIR reader refuses every
thread-local global (ModuleRecord{code: 7}).

Red: the reader test now expects a thread-space thread-local global to read and one of the
threadgroup space to stay refused; engine_thread_local expects the kernel to translate on every
committed profile and to leave Metal's words in the interpreter. Both fail at this commit.
2026-12-03 07:47:03 -08:00
Anees Iqbal cbd3c1f170 Conformance: stage-in-region-clamps recorded with its indexed rows at rates 2 and 3
Recorded on the M3 Max (macOS 27.0.1) by `conformance record
stage-in-region-clamps`, job m3-max-83929, RECORD EXIT=0: the three new
rows' sites (pipeline, buffers, region, dispatch, status, read-back) are
added, and the earlier rows' answers are unchanged (351 lines added, 1
changed). The recording's times half is carried as recorded.
2026-12-03 07:46:11 -08:00
Anees Iqbal 070fc2ab57 Conformance: stage-in-region-clamps gains indexed steps at rates 2 and 3
The case compared an indexed step at rate 1 only. The runtime now
fetches an indexed step at any rate, as an M3 Max read it in job
m3-max-68668, so the case now holds three rows of it:
- xi_rate2_o1_r3_g8: x at rate 2, a region of 3 from origin 1, so the
  last threads clamp
- xi_rate3_o2_r4_g12: x at rate 3, a region of 4 from origin 2, over
  12 threads
- yi_rate2_o1_r2_g2x8: y at rate 2, a region of 2 from origin 1

Unrecorded here: the M3 Max record job that follows writes the
recording in its own commit.
2026-12-03 07:46:11 -08:00
Anees Iqbal d1814ec396 Translator: SpecKey::StageInReach goes; every stage-in fetch keeps its reach check
What: the kernel stage-in fetch's specialization constant StageInReach,
its select over a thread-position step's reach check, its word estimate,
the runtime's arm that skipped it, and the codec's tag are deleted, with
tests/stage_in_element_bytes.rs, a doc-only module about the binder
that set the key and is gone. A thread-position step's reach check now
runs unconditionally, as an indexed step's already did.

Why: nothing set the key to false. The runtime kept it at its default
(true) for every dispatch (pipeline.rs, `SpecKey::StageInReach =>
continue`), so every module carried a constant and a select that always
chose the check. Consumer search: `git grep -n -w StageInReach
development -- '*.rs'` in the consumer's checkout at 40c2b1abeb has 0
hits.

Also: SEMANTICS_VERSION 2351 -> 2352 (a thread-position fetch's module
loses the constant and the select). ARTIFACT_FORMAT_VERSION unchanged:
the codec tags by name and the removed tag stays unused, which its doc
says needs no bump. The signature table blessed (one variant out);
docs/REFUSALS.md regenerates unchanged; runtime-sources.sha256
unchanged (pin-compute, a92fe0a8...).

Verified here: signatures.py --bless moved only that variant; no
StageInReach, reach_key or REACH_KEY_WORDS is left in crates/. Clippy,
rustdoc and the suites run in the jobs the lane's report names.
2026-12-03 07:46:11 -08:00
Anees Iqbal ad09d74961 Stage input: an indexed step fetches at any step rate, as Metal reads it
What: a kernel [[stage_in]] layout of an indexed step
(ThreadPositionInGridXIndexed or ...YIndexed) at a step rate past 1 is
now fetched: the thread's position on the axis divided by the rate,
clamped to the stage-in region's last element, looked up in the index
buffer, plus the region's origin. Step::Indexed carries its rate, and
the grid and indexed steps share stepped_position, the one division.

Why: an M3 Max read index[min(x / rate, size - 1)] plus the origin at
rates 2 and 3 (job m3-max-68668), so the refusal guarded a measured
answer. The runtime's Gap::StageIn of IndexedStepRate and the
translator's Feature::KernelStageIn refused it; both had no other site,
so both variants are deleted. Consumer search for the runtime variant:
`git grep -n -w IndexedStepRate development -- '*.rs'` in the consumer's
checkout at 40c2b1abeb has 6 hits, all in its refusal-label table and
the test that expects this refusal (rt_platform/diag.rs 8, 3079, 3088,
3094; rt_platform/compute.rs 1246, 1382), which change with this
answer; Feature::KernelStageIn has 0 hits there.

Also: SEMANTICS_VERSION 2350 -> 2351 (the modules of an indexed fetch
past rate 1, and a refusal gone). docs/REFUSALS.md regenerated
(refusal_surface.py) after reach.tsv lost the feature's row; the
signature table blessed (two variants out). The runtime README, the
encoder's and pipeline's docs and the gap's docs say the indexed
element at any rate. runtime-sources.sha256 unchanged (pin-compute,
a92fe0a8...).

Verified here: signatures.py --bless moved only the two variants; the
refusal surface regenerated with 0 variants unmarked. The red tests of
the commit before this one, and clippy, rustdoc and the suites, run in
the jobs the lane's report names.
2026-12-03 07:46:03 -08:00
Anees Iqbal 09eb927433 Stage input: an indexed step at rates 2 and 3 fetches Metal's element (red)
The runtime refuses a kernel [[stage_in]] layout of an indexed step at a
step rate past 1 (Gap::StageIn of IndexedStepRate), and the translator
refuses it as not implemented, though Metal's answer is measured: an M3
Max read index[min(x / rate, size - 1)] plus the region's origin at
rates 2 and 3 (job m3-max-68668).

The runtime's fetch test gains two indexed rows, at rate 2 under a region
of 3 (so threads past it clamp) and at rate 3 under a region of 8, and
its element rule divides the position by the rate before the clamp. The
unbuilt-forms test keeps DynamicStride and IndirectRegion. The
translator's refusal test expects rates 2 and 3 to compile, and the
every-profile validation and region tests take indexed rows past rate 1.

Red here: both runtime and translator tests meet the refusal. The fix
follows.
2026-12-03 07:45:48 -08:00
Anees Iqbal 1d92b18252 rt: a texture of the private bit BlockWritesOnly takes an index, as one shaders write does
usage_taken reads the bit as ShaderWrite, so reached, which decides
whether new_texture takes an index, holds for a texture of the bit alone
(0x10000): it takes an index, and one made without is
Refusal::TextureIndex. Metal's kernel write to such a texture lands
(block-writes-only-writes, recorded on an Apple M3 Max under macOS
27.0.1, job m3-max-83930). The conformance rt side gave the texture no
index, so the lavapipe replay refused it at creation (job m3-max-83976);
its texture_index now counts the bit as the runtime does. The docs of
reached, Refusal::TextureIndex and the runtime README say so;
docs/REFUSALS.md regenerates unchanged.

A consumer that decides a texture's index by its usage counts
TextureUsage::BLOCK_WRITES_ONLY as a shader write.
2026-12-03 07:45:41 -08:00
Anees Iqbal 6967f341b3 Conformance: block-writes-only-writes quotes Metal's validation message as code
Rustdoc read the message's t[1] as an intra-doc link and failed under
-D warnings (job m3-max-83944: unresolved link to 1). The message is now
a code span. Nothing else changes.
2026-12-03 07:45:41 -08:00
Anees Iqbal e97eb82941 Conformance: block-writes-only-writes carries its Metal timing
The suite's test every_case_carries_its_timing needs every case's
recording to hold a timing leg. This one's Metal leg, eight rounds, was
measured on an Apple M3 Max under macOS 27.0.1 (job m3-max-83967, with
conformance times --runs 8 --write). The recorded answers are unchanged.
The coverage table regenerates unchanged.
2026-12-03 07:45:41 -08:00
Anees Iqbal dbc0f04ef3 Conformance: block-writes-only-writes recorded on Metal
The case's Metal answer, recorded on an Apple M3 Max under macOS 27.0.1
(job m3-max-83930): for both usages, ShaderRead | RenderTarget |
BlockWritesOnly (0x10005) and the bit alone (0x10000), the dispatch
completes and every texel holds its four codes (00 ff 00 ff, 10 ef 25
fe, ...), with no notice announced. The coverage table is regenerated
with scripts/conformance-coverage/coverage.py.
2026-12-03 07:45:41 -08:00
Anees Iqbal eb049e248b Conformance: block-writes-only-writes, a kernel's write to a texture of the private bit BlockWritesOnly
The case writes buffer 0's float4s, each a code over 255, through the owned fixture
fpv_srgb_storage's fpv_srgb_write (an access::write slot) into a 16 x 1 Shared RGBA8Unorm texture
of usage ShaderRead | RenderTarget | BlockWritesOnly (0x10005, the guest's) and of the bit alone
(0x10000). It records each dispatch's status and the stored bytes.

The public MTLTexture.h of macOS 27.0.1 does not define the bit. On the M3 Max under macOS
27.0.1 (job m3-max-83917), a write to 0x10005 lands and Metal's validation passes it. The
recording is taken by the next commit's job.
2026-12-03 07:45:40 -08:00
Anees Iqbal fd07d85922 rt: a texture of the private usage bit BlockWritesOnly takes a kernel's write, as ShaderWrite does
usage_taken, the one place a descriptor's usage is read as Metal takes it, now reads the private
bit BlockWritesOnly (0x10000) as also ShaderWrite. That feeds the slot check
(Refusal::TextureUsageAtSlot), the image plan (the storage element, its view formats and the 8-bit
sRGB write twin), texture buffers, and the storage-element gap's test of a written texture.

Why: the public MTLTexture.h of macOS 27.0.1 does not define the bit. Its writes were measured
on an Apple M3 Max under macOS 27.0.1, job m3-max-83917. A kernel's access::write to an
RGBA8Unorm texture of ShaderRead | RenderTarget | BlockWritesOnly (0x10005) lands, Shared and
Private, plain and under MTL_DEBUG_LAYER=1 with no assertion. A texture of 0x5 asserts there
("writes texture (t[1]) whose usage (0x05) doesn't specify MTLTextureUsageShaderWrite (0x02)"),
and 0x7 is silent. The runtime refused the dispatch, and planned no storage element for such a
texture, so the write would have been dropped. An arm64 guest walk met the refusal 8,662 times,
at one kernel's slot 1 for 8,624 of them. The translator's heap binder already takes the bit so
(bind/heap.rs), so both crates now read it one way.

RUNTIME_VERSION 2561: a run may answer differently (a dispatch that was refused now runs).
docs/REFUSALS.md regenerates unchanged (its table carries the refusal's first line alone). The runtime-sources fingerprint does not move
(pin-compute.py: a92fe0a8... before and after); the runtime crate's sources are not among its
inputs. The runtime README's texture slot paragraph says the same.

Verified by the red test of the commit before: on lavapipe (llvmpipe, LLVM 23.1.1), job
m3-max-83922 at that commit fails it with Some(TextureUsageAtSlot) for the new row; the green run
is named in the lane's report.
2026-12-03 07:45:40 -08:00
Anees Iqbal 257c4a4f26 Tests: a kernel's write to a texture of ShaderRead | RenderTarget | BlockWritesOnly runs (red)
slot_usage's sample_down gains a destination of usage 0x10005: ShaderRead, RenderTarget and
Apple's private bit 0x10000, which the public MTLTexture.h of macOS 27.0.1 does not define. On an
Apple M3 Max under macOS 27.0.1 (job m3-max-83917), a kernel's access::write slot 1 bound to an
RGBA8Unorm texture of that usage takes the write, Shared and Private, plain and under
MTL_DEBUG_LAYER=1 with no assertion, where usage 0x5 asserts "writes texture (t[1]) whose usage
(0x05) doesn't specify MTLTextureUsageShaderWrite (0x02)" and 0x7 is silent.

The runtime refuses the dispatch today (Refusal::TextureUsageAtSlot): it reads only ShaderWrite as
granting a write, and plans no storage element without it. A guest walk on an arm64 guest met the
refusal 8,662 times, at one kernel's slot 1 for most of them.

Red: expected to fail on every device until the usage is read as granting the write.
2026-12-03 07:45:40 -08:00
Anees Iqbal 2f93c0bd04 Harness: a workload's line names its buffers' and textures' storage modes
Before a plan workload's rows, the harness now prints one line naming each of its buffers'
storage mode and length and each of its textures' storage mode, in its plan's order, for authored
and described workloads alike:

    burst_160_shared  storage: buffer 0 private 1024 bytes, buffer 1 shared 16 bytes

On a discrete card a kernel's reads of a Shared buffer cross the bus at every dispatch (the
runtime README's known gaps of memory blocks: 75 against 2.4 us a dispatch for 512 KiB on the
RX 7900 XTX), so a row's time cannot be read without knowing where its data lives.

No committed kernel workload gains a Private arm, because each one's bulk data is already
Private, as a real app would keep it: bandwidth, alu, long_4cb, threadgroup_scan, simd_reduce's
input and partials, image_filter, row_cells, dispatch_chain, wide_bindings, waves, vote_loop,
narrow_ints, zero_products, texture_read, the sampling rows, the texel buffer rows,
constant_private and the draws. The Shared buffers that remain are the ones an app keeps Shared,
or already have a Private twin:
- simd_reduce's buffer 2, the 16-byte total the CPU reads back;
- burst_160_shared's 16-byte increment, a constant argument the CPU writes, kept for the record
  beside burst_160's Managed one, as the recordings bind such arguments from Shared memory;
- row_tail_224, row_tail_27730 and row_tail_49, whose outputs are Shared, each already beside
  its _private twin.
The kernel behind the known gap was a described workload of the audit's own, never in the tree.

A test in the command's own tests checks the line for burst_160_shared, burst_160 and draw_2000.
2026-12-03 07:39:50 -08:00
Anees Iqbal e42f5e9c41 Runtime README: on a discrete card a kernel's reads of a Shared buffer cross the bus, a known gap
On the RX 7900 XTX (RADV, Mesa 26.2.6) the Shared type, the first host-visible, host-cached
type a buffer can use, lies in the host's 14.58 GiB heap, so every dispatch's reads of a Shared
buffer cross the bus. A half-precision sum reduction reading 512 KiB of a Shared buffer took
7,475 us a run of 100 dispatches, 75 us a dispatch, against 236 us a run, 2.4 us a dispatch, with
the same buffer Private, alternated three times at the card's full shader clock (about 3.07 GHz
in both arms, sampled every 20 ms; job m3-max-84013).

Ruled a recorded known gap (rung 4) rather than a second Shared type: Shared is the memory the
program's CPU reads and writes directly, and the card's device-local, host-visible types are not
host-cached, so each CPU read of a Shared buffer there would be an uncached read, which costs
more and comes more often than a kernel's reads over the bus. Metal's Shared is one memory the
CPU and the device both use (MTLResource.h), on a discrete Mac too, where a program that wants
the card's read speed keeps its data Private or Managed.

Docs only. The memory types and heaps are the job's vulkaninfo on that card.
2026-12-03 07:39:50 -08:00
Anees Iqbal 62e9d045c3 Validation player: command-replay refuses an option a subcommand does not take
Each subcommand names the options it takes beside its required ones, and
options() refuses any other with "--NAME is not an option of
SUBCOMMAND" before anything runs: exit status 2, the usage printed, as
for any bad command line. Before, an unknown --name VALUE pair went into
the map and was never read, so a mistyped or retired option played as
if absent.

The sets are what each subcommand reads: play its four required options
and blobs, managed, until-frame, past-range, states-only, state-log,
state-threads, state-keys, state-digests, gpu-wait-timeout (the
wait module's flag), video-handle, check-presents, read-device-copies,
prepass-width, dump-command-buffers and dump-dir; dump and shapes
--stream and --blobs (their stream reader reads it; the usage and the
module doc now show it); compare-dumps --a and --b; compare-plays --a,
--b and --frame; snippet video-surfaces --out and --handle. The module
doc and docs/REPLAY-STREAM.md section 10 say so.

The audit in the red commit's message found no caller passing an option
outside these sets except --probe-dump in two lab probe scripts of one
carry, which no commit here ever read.

Verified by the job named in the lane's report: the red test at the
parent and green here, clippy x3, rustdoc, the validation suite.
2026-12-03 07:28:55 -08:00
Anees Iqbal 34d0a859ee Validation test: every command-replay subcommand refuses an option it does not take (red)
command-replay's options() takes any --name VALUE pair into its map, and
each subcommand reads only the names it knows, so an option a subcommand
does not take is dropped in silence: `play --name run` plays as if no
--name were given. A mistyped or retired option should be a bad command
line instead.

replay_options::every_subcommand_refuses_an_option_it_does_not_take runs
play (--name), dump (--frame), shapes (--until-frame), snippet
video-surfaces (--stream) and compare-plays (--until-frame), each with
its required options plus one it does not take, and expects exit status
2, a standard error line "--X is not an option of SUBCOMMAND", no play
report and no snippet written.

Red here: play runs on (its report is written), and dump, shapes and the
snippet run to exit 0. The fix follows.

Callers audited before refusing (development 6a7b159d95): the in-tree
tests and docs, sched/round.py and every orchestration job script that
names command-replay (54 files), the scripts in every carry repository
(136, 35 that play), and the consumer's tree (development fdc1ecbbb5: no
caller). Every option they pass is one the subcommand takes, except
--probe-dump in two 11-27 probe scripts of one lab carry (probe-424.sh,
probe-reduce.sh), an option no commit of this repository ever had: it
was dropped in silence there, and would now stop those scripts with exit
status 2.
2026-12-03 07:28:55 -08:00
Anees Iqbal 3d191a2d66 Validation tests: the two callers 98435ae812 missed pass compute_case the entry's interface
98435ae812 gave compute_case the checked entry's AirInterface as a
second argument but left two test callers on one, so the validation
crate's lib tests and integration tests did not compile (job
m3-max-83945: E0061 at case/tests/indirect_commands.rs:107 and
tests/integration/engine_linked_cases.rs:123; clippy in all three
configurations and the validation suite failed on it).

- indirect_commands' assert_engine_refuses: the refusal comes before
  compute_case reads the interface, so a synthetic kernel interface of
  no parameters stands in.
- engine_linked_cases: the admitted case's own interface,
  checked.primary.interface.

Verified by the job that follows (clippy x3, rustdoc, the validation
suite). The same job's case runs on lavapipe at 98435ae812 (the bins
built) matched 7 of the 8 authored stage-input cases whose AIR is here;
the eighth is private.
2026-12-03 07:26:59 -08:00
Anees Iqbal 98435ae812 Validation: the engine candidate runs a kernel case's stage inputs through the runtime
What: a kernel case's stage inputs of a fixed stride, and its dispatch's
stage-in region, now run on the engine candidate as the Metal oracle runs
them (executor_contract::stage_inputs, the derivation both executors
share):
- compute_case takes the checked entry's AIR-layer interface and maps
  each input's data to its own buffer at the slot its location takes;
- ComputeCase carries the stage-input descriptor, the region (the
  dispatch's, or the grid's from the origin) and each slot's location;
- the run through the runtime makes its state with that descriptor, sets
  the region before the dispatch, and guards a stage input's data as its
  OutOfBoundsResource::AttributeBuffer target (guards::buffer_resource);
- the authored compile census compiles the kernel under it
  (PipelineRequest::Kernel::stage_input, variants::compile_kernel).

ToolingRequirement::KernelStageInput ("kernel_stage_input") becomes
DynamicStageInStride ("dynamic_stage_in_stride"): it now fires only for
an input of a dynamic stride. The runtime refuses that layout (Gap::StageIn
of DynamicStride), since its compute encoder has no
setBuffer:offset:attributeStride:atIndex:. Docs say the same:
docs/VALIDATION.md, the requirement's, case_requirements' and
compute_case's. A neighbouring line now says the implicit imageblock is
the runtime's limit, where it said explicit; the code already said so.

Why: the runtime has fetched stage inputs at every step function since
a916e61185 and sets the region (set_stage_in_region), but the candidate
built its state without the descriptor and set no region. So twelve
authored cases stayed Metal-only, the twelve the authored compile census
holds as not_supported{tooling_requirement:kernel_stage_input}.

Also: AUTHORED_COMPILE_CENSUS_VERSION 9 -> 10. Its table is re-blessed
on development. ENGINE_EXECUTOR_ABI unchanged: every case this lets run
was refused before, which its doc says needs no bump.

Verified here: cargo fmt; signatures --check. Tests:
engine_case_families_follow_the_case_literals (red at the commit
before) and stage_inputs_map_onto_their_slots_descriptor_and_region.
Clippy, rustdoc, the validation suite and the cases' runs on a device go
in the jobs the lane's report names.
2026-12-03 07:26:52 -08:00
Anees Iqbal 3015b115dd Validation: a kernel case's stage inputs and stage-in region stop no executor but a dynamic stride (red)
A kernel case with stage inputs, or a dispatch with a stage-in region,
carries ToolingRequirement::KernelStageInput, which stops the engine
candidate: its run through the runtime makes its pipeline state without
the case's stage-input descriptor and sets no region. The runtime fetches
stage inputs at every step function since a916e61185 and sets the region
(set_stage_in_region); it refuses only a layout of a dynamic stride
(Gap::StageIn of DynamicStride), as its compute encoder has no
setBuffer:offset:attributeStride:atIndex:.

engine_case_families_follow_the_case_literals now expects no requirement
for stage inputs of a fixed stride, with or without a region, and the
requirement for a dynamic one. Red here: both fixed-stride cases still
carry KernelStageInput. The candidate's run, the requirement's narrowing
and the doc follow.
2026-12-03 07:26:52 -08:00
Anees Iqbal 23193c9bf1 Translator: the padded forms' linear mip filter blends two levels, a bfloat form's reads one
Two measured changes to an extended-range sample's level, each from the M3 Max on macOS 27.0.1:

- A padded form's linear mip filter (R10Unorm_X6, RG10Unorm_X12 and their _sRGB twins) now
  blends its two levels as BGR10_XR's and BGRA10_XR's do, through a constexpr sampler and through
  a runtime one, and records PrecisionNote::BicubicFilterArithmetic. Before, a constexpr sampler's
  was refused NotImplemented(Format), and a runtime sampler's read one level with no refusal. The
  probe extended_linear_mip_blends (job m3-max-82967; 16,384 lanes per form and filter, 2D, five
  levels, random codes) puts Metal's sample within 0.0157 of its own two levels' samples blended
  by mix at the fraction truncated onto sixty-fourths. The note's doc and its docs/API.md
  catalogue line gain that bound.
- A bfloat form's linear mip filter (R16Bfloat, RG16Bfloat, RGBA16Bfloat) is now its nearest mip
  filter, which Metal's equals on every lane whose two levels differ (4,096, 8,192 and 16,384
  lanes, nearest and linear filters). Before, a constexpr sampler's was refused. A runtime
  sampler's already read that level.

What stays refused through a constexpr sampler:
- A two-plane form's linear mip filter (not measured). The probe only shows that a five-level
  texture is made.
- RGB10A2Unorm_sRGB's linear mip filter (not measured). Jobs m3-max-83026 and m3-max-83029
  explain why. A texture of five levels holds each level's own code, which a blit reads back per
  level. Yet the M3 samples level 0's code at every explicit level, at gradients under a nearest
  mip filter, at every level under a linear one, and in a 2D array's layer 1. RGB10A2Unorm, the
  control, samples each level's code. Documented Metal samples the level asked for. So this is a
  driver defect, which is not emulated (an Apple bug report is drafted), and the format's samples
  keep reading the level the mip filter names. No conformance case samples that format's levels
  today.

Docs: three comments named binder refusals that no code makes, and none of the three exists
(ResourcePlanner is gone):
- a runtime sampler word that states mixed filters;
- a runtime linear mip filter's clamp maximum below the last level;
- a runtime linear mip filter of an unmeasured form.
The comments sat in lower/sampler/extended.rs, select.rs and the extended-range tests'
module docs. They now state what happens: the word samples as nearest, the maximum is not read,
and a two-plane form's or RGB10A2Unorm_sRGB's runtime linear mip filter reads the nearest mip
filter's level. They also say this is an open gap that no consumer meets while the runtime makes
no texture of these formats (the runtime's Gap::TextureFormat).

The probe crates/metal2vulkan-conformance/probes/extended_linear_mip_blends.m gains the nearest
mip filter at the point's level, the two-plane question and each texture's level count.
SEMANTICS_VERSION moves to the next number, because refusals are removed and samples' answers
change. runtime-sources.sha256 is re-pinned because metal/format/mod.rs is a runtime input.

Tests (tests/engine_extended_range/levels.rs):
- unmeasured_linear_mip_filters_are_refused now builds a padded and a bfloat linear mip filter,
  and still refuses a two-plane and an RGB10A2Unorm_sRGB one.
- measured_linear_mip_filters_blend_or_read_one_level: every padded and bfloat form's constexpr
  sampler compiles, valid, under either mip filter, with the note on a padded linear one alone.
  On the CPU interpreter, at 64 levels between two, through a constexpr and a runtime sampler, a
  padded form's sample lies between its two levels' nearest-mip samples on every lane and
  strictly between on some. A bfloat form's equals its nearest mip filter's, bit for bit.

Verified on the CPU with no device (job m3-max-83908): with metal/format/mod.rs,
lower/sampler/extended.rs and select.rs at 8e912a905d the two changed level tests fail, and here
the extended-range tests pass; the golden table differs from development's (semantics 2346) in 90
cells here and at 8e912a905d, so the change moves no existing cell by count; the refusal surface
check passes; cargo fmt, clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd), Rustdoc, the API
reference check and the doctests pass; the suites pass 3753 of 3754 (24 skipped), the one failure
golden_hashes_match_the_table, bless due as at 8e912a905d; the validation suite passes 1346 (3
skipped) and the conformance suite 1052. The states-only plays of this tree (m3-max-83910) make
what 8e912a905d's make (m3-max-83909): the gb-3090-r2 stream 10643 render and 15299 compute
states, the 780M windrag stream 8972 and 225, none refused.
2026-12-03 07:25:45 -08:00
Anees Iqbal 2c29742e2d Runtime README: a Mac's resolve writes the band past Metal's render area, as ours
The known gaps of render encoders said what a Mac's resolve writes into
the resolve texture past Metal's render area was unmeasured. The probe
resolve_band_past_render_area measured it on the M3 Max (job
m3-max-83924, with and without the debug layer, every command buffer
completed): a Load pass of a 300 by 300 render area that encodes no
draw, over a 600 by 600 4-sample attachment, resolved its area and the
band to 320 texels a side (90,000 and 12,400 texels changed) and left
the 257,600 texels past them untouched. The runtime's Vulkan render area
is Metal's rounded up to 32 texels a side, so it resolves the same band.
Under Clear the same pass resolved the clear value into the whole 600 by
600 texture, which the README's whole-level clear of a pass that draws
nothing already records as a known gap; the entry now says the resolve
follows it. The probe's header records the rows.

Doc and probe only: no Rust source changes.
2026-12-03 07:22:46 -08:00
Anees Iqbal 430a2a8241 Conformance probe: whether Metal's resolve writes past the pass's render area
The runtime's Vulkan render area is Metal's rounded up to 32 texels a
side, so a 300x300 pass resolves 320x320. What a Mac's
MultisampleResolve writes into the resolve texture past Metal's area is
not measured (the runtime README's known gaps say so). This probe
resolves a 600x600 4-sample attachment into a resolve texture first set
to 0xee bytes, with a render area of 300x300 under Load and under Clear,
and without one as the control, and counts the texels that changed in
the area, in the band to 320 and past it.

Not run yet: the M3 Max job that runs it follows, and its rows go in
the README with the run named.
2026-12-03 07:22:46 -08:00
Anees Iqbal 2201f23e9f linux-gate-ci: the 128-bit runtime step checks the width took, as ci.yml's does
cpu_icd_tests_128 ran the runtime's tests with LP_NATIVE_VECTOR_WIDTH=128 but never showed that
llvmpipe took the width, so a green run proved nothing about 128 bits. It now runs ci.yml's check
first, with the same greps: vulkaninfo at that width, its deviceName and subgroup-size lines printed,
and the step fails unless the device name says 128 bits and maxSubgroupSize is 4. It also takes
ci.yml's --no-fail-fast, keeping the function in step with ci.yml's run text as the file's header asks.

Verified: bash -n; and the step end to end on a host lavapipe, not in the gate's container: job
m3-max-83977 defined step() and cpu_icd_tests_128 from this file and called the step on Mesa 26.2.4
lavapipe (LLVM 23.1.1). The device line read 'llvmpipe (LLVM 23.1.1, 128 bits)' with
maxSubgroupSize 4; Summary 991 tests run: 991 passed, 4 skipped; step ok. The container run is
unverified, and METAL2VULKAN_TEST_REQUIRE_PINNED_LLVM, which the script exports at its top, was not
set (the host's LLVM is not the pin).
2026-12-03 07:20:32 -08:00
Anees Iqbal 4b68322b79 Conformance ledger: the Iris Xe's rgb10a2unorm texture-buffer write matches Metal now
What: drops the known-gaps-rt.tsv row norm-storage-codes-rgb10a2unorm | Iris(R) Xe | divergent |
case/hsw_buffer/texels, and regenerates docs/CONFORMANCE-COVERAGE.md from it.

Why: pin S's real-card round replayed the ledger on the Iris Xe (RPL-P, Mesa 26.2.6) and reported
"now matches: 1": that case no longer diverges there, and the ledger must not outlive the gap it
stands for. Pin R's round passed the same leg (job m3-max-83399), so the change came between R and
S: there a read-write texture buffer whose format's own view reads none without a format became
words (1c68dd10f4), and a texture-buffer storage slot is declared without a format (1ae0e3c302), so
the Iris's RGB10A2Unorm texture buffer is written through the shader's own conversion, which gives
Metal's codes. The other Iris rows of the case (hsw_read_write, hsw_write, hsw_held) still diverge
there, and llvmpipe's and NVIDIA's rows are unchanged.

Verified: the conformance replay on the Iris Xe at 14c37cc76d (job m3-max-83990) listed this row as
its only surprise; coverage.py --check reads the document as derived. The replay after this commit
runs in the next pin's round.
2026-12-03 07:19:29 -08:00
Anees Iqbal 6a7b159d95 Runtime README: no kept replay stream reaches a fetching draw as translated
The fetch known gap (UnorderedFetchWithinDraw: overlapping read-modify-writes of one draw may
leave one application) now says whether real work meets it. In every one of the 26 replay
streams counted, each colour input ([[color(n)]]) a fragment function declares is gated by a
function constant that the stream's pipeline states set off, so no state fetches.

Counted states-only on lavapipe, with a fresh shader cache per stream, every MODE line "mode
states-only". Probe on a never-landed branch:
- For each render state made, the runtime's own Draws::fetched (empty for all) and its notes (no
  UnorderedFetchWithinDraw).
- The validation checker's evaluation of each colour input's predicate under the state's
  constants (AirInterface::new): 0 live, 0 unevaluated, and 0 states whose input is live while
  fetched is empty.

| Stream | Render states | Fetching | Declaring a colour input, all gated off | Job |
|---|---|---|---|---|
| windrag-780m-b2 | 8262 | 0 | 6313 | m3-max-83458 |
| windrag-780m-b4-um790 | 8972 | 0 | 6957 | m3-max-83458 |
| webdiv-780m-2 | 9014 | 0 | 6977 | m3-max-83458 |
| webdiv-780m-3 | 9645 | 0 | 7424 | m3-max-83458 |
| gb-3090-r2 | 10643 | 0 | 8177 | m3-max-83458 |
| glbench-3090-r4 | 9834 | 0 | 7492 | m3-max-83494 |
| bB-c1 | 494 | 0 | 392 | m3-max-83494 |
| boot-idle-780m-1 | 6817 | 0 | 5172 | m3-max-83494 |
| gb-3090-r3 | 10040 | 0 | 7752 | m3-max-83494 |
| gb-780m-u2 | 9038 | 0 | 6923 | m3-max-83494 |
| gb-780m-u3 | 8269 | 0 | 6339 | m3-max-83494 |
| gb-780m-u4 | 5850 | 0 | 4487 | m3-max-83494 |
| glbench-780m-r1 | 7435 | 0 | 5566 | m3-max-83494 |
| glbench-780m-r2 | 8538 | 0 | 6437 | m3-max-83494 |
| syncview-4k-780m | 1952 | 0 | 1585 | m3-max-83695 |
| windrag-780m-b4 | 8154 | 0 | 6252 | m3-max-83889 |
| windrag-780m-b3 | 8082 | 0 | 6256 | m3-max-83889 |
| web3d-780m-r1 | 8587 | 0 | 6593 | m3-max-83889 |
| web3d-780m-r2 | 8438 | 0 | 6478 | m3-max-83889 |
| web3d-780m-esc1 | 7253 | 0 | 5538 | m3-max-83889 |
| rtdesk-780m-rtrec1 | 7584 | 0 | 5850 | m3-max-83889 |
| rtdesk-780m-rtrec3 | 7636 | 0 | 5888 | m3-max-83889 |
| rtdesk-780m-rtrec4 | 10118 | 0 | 7784 | m3-max-83889 |
| vaapi-780m | 8604 | 0 | 6591 | m3-max-83889 |
| vaapi-780m-wd | 8403 | 0 | 6466 | m3-max-83889 |
| glbench-780m-r4-recnil | 3756 | 0 | 2669 | m3-max-83954 |

One windrag-780m-b2 function shows the gate (job m3-max-83522):
- It declares 3 used colour inputs and 60 function constants, and its state supplies all 60.
- Each input's predicate is a global computed from the constants.
- The gate opens only with constant index 4 set to 1 together with one of indices 0, 35, 55 or
  56; the state gives index 4 the value 0.

The runtime translates under the identity domains, so a surviving fetch would be
PushField::FetchedColor, which fills Draws::fetched.

Values plays on one Radeon 780M (RADV) agree with this:
- glbench-780m-r2 (job m3-max-83322) and windrag-780m-b4-um790 (job m3-max-83381).
- In each, development twice (A, A2) and a build that splits every fetching draw per primitive
  (B): 0 draws split, and every compared frame equal.

Docs only: the runtime README is not a runtime-sources input.
2026-12-03 07:12:10 -08:00
Anees Iqbal 2549c339c6 CI: the runtime's device tests again on lavapipe at 128-bit vectors, with a Mesa shader cache of their own
What: a Linux step after the CPU ICD step runs the runtime's device tests from that step's archive
with LP_NATIVE_VECTOR_WIDTH=128 (lavapipe's subgroups of 4, the width arm64 lavapipe runs at) and
MESA_SHADER_CACHE_DIR set to a directory of the leg's own in the workspace. It prints vulkaninfo's
device name and subgroup sizes first and fails unless they show 128 bits and subgroups of 4, so a
green step shows the width ran. scripts/lavapipe-image's nextest command takes --write and --env as
run does, so the leg's cache directory and variables reach the container. scripts/linux-gate-ci
gets the same step, as docs/VALIDATION.md asks of every Linux step. AGENTS.md's CI line and
VALIDATION.md's note on the width name the leg and the cache rule. Nothing in product code reads
either variable.

Why: the planner wants a stand-in for a device whose SIMD group is 4 wide (tile GPUs are a target).
The lab's 128-bit runs failed because of llvmpipe's disk cache, not our lowering. llvmpipe keys its
texture functions (lp_texture_handle.c) and its cache id (lp_screen.c) without
lp_native_vector_width (Mesa 26.2.4), so a cache that 256-bit runs filled gave a 128-bit shader an
8-wide texture function. A cache of the leg's own cannot collide with the 256-bit one.

Verified on lavapipe (Mesa 26.2.4, LLVM 23.1.1, 128 bits, subgroups 4), at aeb0ca9560, the
runtime's whole cpu_icd suite:
- shared default cache: 989 tests run: 887 passed, 102 failed, 4 skipped (job m3-max-83853);
- the cache off: 989 tests run: 989 passed (2 slow), 4 skipped (job m3-max-83888);
- gdb on two of the crashes stops at the same JIT store, vmovaps of a ymm register, the 4th of
  four plus a byte at 0x80: an 8-wide texel struct written into a 4-wide caller (job m3-max-83878).
The step itself ran in the lab from ci.yml's step text, in the pinned lavapipe image (Mesa
26.2.4-arch1.1, LLVM 23.1.1): deviceName = llvmpipe (LLVM 23.1.1, 128 bits), subgroupSize 4 (min
and max 4); 764 runtime device tests listed; Summary 762 tests run: 762 passed, 231 skipped; job
exit 0 (job m3-max-83928, on the RTX 5080 Laptop machine's lavapipe). scripts/linux-gate-ci's
new step passed bash -n only; it has not run end to end. No Rust changed, so clippy, Rustdoc and
the suites have the inputs they had.
2026-12-03 07:03:08 -08:00
Anees Iqbal b9f3210e24 Translator docs: the instance count and object arena paragraphs name no stage table
lower/raytracing/mod.rs and pipeline/facts.rs still named
StageTable::acceleration_structures, StageTable::threadgroup_lengths and
bind::BoundAccelerationStructure, which went with the binder's cut
(b5916b2f7b and the cut before it; the runtime binds through no stage table,
46a9a57522). The paragraphs now say what the binder writes without them.

Comments only. Neither file is a runtime input the validation guard hashes
(build.rs's list), so runtime-sources.sha256 stays a92fe0a8, recomputed with
no build; grep finds no other StageTable or BoundAccelerationStructure in
crates/ or docs/.
2026-12-03 06:52:49 -08:00
Anees Iqbal b3908325dd Fixture: gsm2_vertex_quad_permutes' header says its quads lower to shuffles on every device
The header said the translation emits Vulkan's quad instructions where the
vertex stage takes them. It lowers every vertex function's quad broadcast and
shuffle-xor to a subgroup shuffle through the ballot of the live lanes on
every device, as the fixture README's row and the engine test
vertex_quad_permutes_shuffle_through_the_live_lanes say, since a vertex quad
may lack a lane past the draw's vertex count.

Comment only: the generated .ll and .air.ll carry no comment of the source and
are unchanged (regen-air-fixtures not needed), and the corpus cases key on the
AIR's hash, not the source's.
2026-12-03 06:52:49 -08:00
Anees Iqbal faa76cc8af Validation: the tiled and linear textures over a buffer reach the cover rule's texture branch
Covers::saw took a call as a texture's making only where its selector starts
with newTexture, so newTiledTextureWithDescriptor:offset:bytesPerRow: and
newLinearTextureWithDescriptor:offset:bytesPerRow:bytesPerImage: never
reached it: the rule held such a texture as no texture at all, neither over
its buffer nor written with it, and the linear selector's arm there was never
taken. The branch now also takes every selector makes_texture_over_buffer
names.

Found by the previous commits' test, which failed at the fix commit too (the
RTX 5080 laptop's node, job m3-max-83777: the tiled and linear textures read
uncovered).
2026-12-03 06:52:49 -08:00
Anees Iqbal 5f1686fb55 Validation: a texture over a heap buffer is covered where its buffer is
The cover rule held a buffer's cover on the buffer alone, so a texture made
over a covered heap buffer read as uncovered: its check was compared and its
dump carried no cover, and compare-dumps could report as a difference the
bytes Metal leaves undefined once a heap texture's write aliased them.

Covers::covered now maps an object to the one whose bytes it holds (a view to
its texture, a texture over a buffer to that buffer), the same mapping the
rule already used to decide whether a texture's write is tracked. The rule
also takes the player's own list of the selectors that make a texture over a
buffer (makes_texture_over_buffer), which adds the tiled form
(newTiledTextureWithDescriptor:offset:bytesPerRow:) the rule had missed.
docs/REPLAY-STREAM.md and dumps.rs say a texture's cover follows its buffer's.

Verified by the test the previous commit added (red there, green here); the
jobs are in the lane's report.
2026-12-03 06:52:49 -08:00
Anees Iqbal 33b55b26a4 Validation: a texture over a covered heap buffer is covered with it (red)
The replay player's cover rule (covers.rs) covers a heap-placed buffer that a
heap texture's write meets, but a texture made over that buffer
(newTextureWithDescriptor:offset:bytesPerRow: and its tiled and linear forms)
holds the buffer's bytes and is not marked covered, so a check or a dump of it
carries no cover and compare-dumps can report the bytes the cover rule leaves
undefined as a difference.

This test makes one texture over a heap buffer by each of the three selectors,
covers the buffer by a dispatch that writes a heap texture placed over it, and
expects each to be checked as covered until the buffer is written whole. It
fails at this commit; the fix follows.
2026-12-03 06:52:48 -08:00
Anees Iqbal 599da8cacf REFUSALS: regenerate after the coherent-image landing
The coherent access beside a storage image no longer refuses (d0665778b7), so
lower/sync/memory_model.rs's not_implemented site of feature::Lowering is gone: 31 sites
become 30. Generated by scripts/refusal-surface/refusal_surface.py at 8e912a905d; the
runtime's error/basis.rs comes out unchanged. Found by lane lowrows's regeneration at that
tip.
2026-12-03 06:52:41 -08:00
Anees Iqbal 8e912a905d Validation cases: a device-coherent texture handed between threadgroups, Metal's answer
One authored case over engine/coherent_texture_handoff's coherent_texture_handoff: 128 threads in
threadgroups of 64, a 64 x 1 r32_uint texture of zeros, a zero flag and an output of 64 words
filled with 0xAB. It is authored_bounded: the reader's one loop runs at most 4096 loads, a constant
of the kernel. Installed with corpus-case-check and qualified on Metal on the Apple M3 Max, three
executions (m3-max-83673): every word is 1 (output sha256 08f4ad0b..., the hash of 64 words of 1),
so no read on Metal that saw all 64 writers' flag read the texel's earlier value.

scripts/qualify-public-cases with this case in its list exits 0 on lavapipe (job m3-max-83707), and
the case's Vulkan candidate on the Intel Iris Xe (RPL-P) under its venue intel-irisxe-rplp-anv
prints Match (m3-max-83680).
2026-12-03 06:47:18 -08:00
Anees Iqbal 5c42c16e7b Runtime tests: a device-coherent texture handed between threadgroups, its reads that saw the flag counted
tests::coherent_texels gains each_device_hands_a_device_coherent_texture_between_threadgroups,
under a device cfg on every device: engine/coherent_texture_handoff's coherent_texture_handoff_seen
from the fixture's .ll, through the runtime's identity route, dispatched as two threadgroups of 64
threads over a 64 x 1 R32Uint Shared texture of zeros, its flag and output in one Shared block
(new_buffer zeroes the flag). Of threadgroup 1's 64 reads it counts those that saw all 64
writers' flag and, of those, the ones that read the written texel, prints both, and fails where a
read that saw the flag read anything else. A device that ends the bounded wait before
threadgroup 0 runs shows no flag; its line says so, and its run then proves only the barrier
test's ordering within a threadgroup.

Counts:
- Intel Iris Xe (RPL-P): of 64 reads, 64 saw every writer's flag, and of those 64 read the written
  texel (m3-max-83672); the barrier test beside it: 1024 of 1024 threads read their neighbour's
  write;
- lavapipe (llvmpipe, LLVM 23.1.1): of 64 reads, 64 saw every writer's flag, and of those 64 read
  the written texel (m3-max-83707); the barrier test beside it: 1024 of 1024.
2026-12-03 06:47:13 -08:00
Anees Iqbal 18e8600cbb Tables: coherent_texture_handoff's golden printout, and its inventory rows confirmed by the bless
bless_engine_goldens under the pinned LLVM 21 (Homebrew 21.1.8) on the M3 (m3-max-83664) writes the
fixture's printout: its four texture calls decoded with device_coherent: true.
bless_engine_inventory in the same job, with every assembler, leaves the table as the previous
commit wrote it: the four coherent_texture_handoff rows stand, and no other row moved. Both bless
tests passed.
2026-12-03 06:47:13 -08:00
Anees Iqbal 5410866d9a Fixtures: coherent_texture_handoff's companions, and its inventory rows
The typed .air.ll and the opaque .ll from scripts/regen-air-fixtures on the M3 (m3-max-83664:
Metal 32023.922, SDK 27.2 26B118), and the fixture's TOOLCHAIN line. Apple's compiler names the
texture's read and write air.read_texture_2d.device_coherent.u.v4i32 and
air.write_texture_2d.device_coherent.u.v4i32, the writer's fence air.atomic.fence(i32 4, i32 3,
i32 2) and the reader's air.atomic.fence(i32 4, i32 2, i32 2) (texture memory, release or acquire,
device scope), and the flag's add and load air.atomic.global.add.u.i32 and
air.atomic.global.load.i32 at relaxed order and device scope.

The engine inventory gets four rows, the two kernels from each text. Each reads and writes a uint
texture2d declared read_write, as format_scout's scout_read_write_u does, and takes its row: ok on
every profile but the three Intel profiles and the runtime floor, which have no storage-image read
without a format and need the texture's format (NeedsInput StorageTextureFormat at texture 0).
2026-12-03 06:47:13 -08:00
Anees Iqbal 3994ea73dc Fixtures: coherent_texture_handoff, a device-coherent texture handed between threadgroups (source)
Our own MSL (metal4.1, macOS 27.0): two kernels over a texture2d<uint, access::read_write,
memory_coherence_device>, a device atomic_uint flag and an output buffer, dispatched as two
threadgroups of 64 threads. Each thread of threadgroup 0 writes its texel (1000 + i), fences
texture memory at device scope with release order and adds 1 to the flag (relaxed); each thread
of threadgroup 1 loads the flag until it reads 64 or for at most 4096 loads, fences texture memory
at device scope with acquire order and reads the texel of its index.

coherent_texture_handoff stores 2 where a reader saw all 64 writers' flag and read anything but
the written texel, else 1: its words are 1 whatever the scheduling, so the case stays
deterministic for Metal qualification. coherent_texture_handoff_seen stores each reader's flag
value and texel, for the runtime's device test to count the reads that saw the flag.

The fences are MSL 4.1's release and acquire, not seq_cst: the runtime refuses a seq_cst fence
beyond the thread under the identity domains (IdentityDomains, "a sequentially consistent fence",
a known gap in its README), which a first form of this fixture met on the Iris Xe (m3-max-83655).
2026-12-03 06:47:13 -08:00
Anees Iqbal 611a37ff04 Translator: a device-coherent texture's reads and writes are coherent at device scope
MSL 3.2's memory_coherence_device texture is read and written through members of the read and
write families named device_coherent, first after the stem and before .i16: Apple's compiler
(macOS 27.0.1, metal 32023.922) names a 2D uint texture's read and write
air.read_texture_2d.device_coherent.u.v4i32 and air.write_texture_2d.device_coherent.u.v4i32
(job m3-max-83533), a 2D half texture's at 16-bit coordinates
air.{read,write}_texture_2d.device_coherent.i16.v4f16, a texture buffer's
air.{read,write}_texture_buffer_1d.device_coherent.u.v4i32 and a 3D float texture's
air.{read,write}_texture_3d.device_coherent.v4f32 (job m3-max-83599), each with the operands of
the same access to a texture of the default threadgroup coherence and the same argument metadata.
The SDK's metal_texture headers pass the coherence to every read, sparse read, block read and
write; atomics take none. The translator refused each as UnknownIntrinsic.

Now:
- metal2vulkan-air: Texture::device_coherent holds the token, which Texture::parse reads first after
  the stem for a read, block read or write and refuses for any other operation (a name the
  grammar does not know stays unknown). Block-read canonicalization keeps it on the reads it
  makes. The module doc gives the token's place.
- metal2vulkan: such a read or write takes its coherence as a buffer's *_coherent access does
  (sync::memory_model::coherent_access, texture::device_coherent): under the Vulkan memory model,
  where the profile has vulkanMemoryModel and its device scope, a read carries NonPrivateTexel
  with MakeTexelVisible and a write with MakeTexelAvailable, at Device (Read::coherent,
  Write::coherent, emit::texel_memory); elsewhere the function keeps GLSL450 and every storage
  image is Coherent. A texture buffer held as words reads and writes through routines of their
  own made at Device scope (words::Routine's coherent), under the Vulkan model only.

Public surface: metal2vulkan-air's intrinsics::Texture gains the public field device_coherent
(api_signatures.tsv blessed). A consumer that builds a Texture with a struct literal must set it;
the Debug form of a Texture prints it, so the engine fixtures' AIR input snapshots
(crates/metal2vulkan/tests/air_input/*.txt) print device_coherent: false on every texture call.

SEMANTICS_VERSION moves above development's: a refusal becomes a module.

Verified (job m3-max-83707): the command line on that kernel gives, for lavapipe and moltenvk-m3,
OpImageRead with MakeTexelVisible|NonPrivateTexel|VolatileTexel and OpImageWrite with
MakeTexelAvailable|NonPrivateTexel|VolatileTexel at scope Device (%uint_1), each module valid under
spirv-val at vulkan1.2, 1.3 and 1.4; the engine_atomics, engine_handles and air_input tests pass
(84); cargo fmt, clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd), Rustdoc, the API reference check
and the doctests pass; the suites pass 3742 of 3743 (24 skipped), the one failure
golden_hashes_match_the_table, bless due as at 011540217d; the validation suite passes 1343 (3
skipped) and the conformance suite 1052. The states-only plays of the branch's tree
(m3-max-83739) make what 011540217d's make (m3-max-83738): the gb-3090-r2 stream 10643 render and
15299 compute states, the 780M windrag stream 8972 and 225, none refused.

Landed with SEMANTICS_VERSION 2349 (renumbered above development's 2348: written 2347 on its base).
2026-12-03 06:47:10 -08:00
Anees Iqbal 3b85893447 Translator tests: a device-coherent texture's texels made available and visible at device scope
A texture declared with MSL 3.2's memory_coherence_device (texture2d<uint, access::read_write,
memory_coherence_device>) compiles, under macOS 27.0.1's metal 32023.922 at the default -std and at
-std=metal3.2, to the same argument metadata and type as a texture of the default threadgroup
coherence; only its reads and writes change, to members of the read and write families named
device_coherent: air.read_texture_2d.device_coherent.u.v4i32 and
air.write_texture_2d.device_coherent.u.v4i32 (job m3-max-83533). The SDK's metal_texture headers pass
the coherence to every read, sparse read, block read and write of every texture type, the texture
buffer's included; atomics take none. The translator parses no such member: Texture::parse finds
three tokens after the stem and answers None, so the function is refused as UnknownIntrinsic.

This adds a no-device test: engine_atomics
a_device_coherent_textures_texels_are_made_available_and_visible_at_device_scope compiles the
coherent_image kernel with its read and write renamed to the device_coherent members on every
profile of the file and on lavapipe without the memory model, and passes L3. Under the Vulkan model
each read must carry NonPrivateTexel with MakeTexelVisible and each write with MakeTexelAvailable,
at Device; under GLSL450 the storage image must be Coherent.

At this commit the test fails: the function is refused as UnknownIntrinsic.

Verified on the CPU (job m3-max-83707, red leg 2): with the crates at this commit the test fails at
its compile, and the command line on the kernel prints FALLBACK, UnknownIntrinsic
(air.read_texture_2d.device_coherent.u.v4i32), for moltenvk-m3 and lavapipe.
2026-12-03 06:47:03 -08:00
Anees Iqbal d0665778b7 Translator: a coherent access beside a storage image compiles, its texels non-private
lower/sync/memory_model.rs's finish refused a function with a coherent access, or anything else
that selects the Vulkan memory model, beside a storage image outside an interlocked body
(NotImplemented{Lowering(MemoryModel)}), its module doc saying the image's NonPrivateTexel
accesses were not measured. The accesses were already right: a storage image's read and write
take the function's coherence (texture::emit::texel_memory), NonPrivateTexel under the Vulkan
model, so a barrier orders them with other invocations' accesses as GLSL450 does; under GLSL450
the module decorates every storage image Coherent beside the coherent accesses. Under the identity
domains, the runtime's route, the refusal never fired for a texture slot.

Now the refusal is gone, and with it texture::TexturePlan::heap_storage_images, which only it
called. The module doc says what a storage-image access takes and names the runtime test that
measures it.

SEMANTICS_VERSION moves above development's: a refusal becomes a module.

Verified on the CPU (job m3-max-83707): the two translator tests pass; the golden table differs from
development's (semantics 2342) in 72 cells here, as at 011540217d and at the tip, so the change
moves no existing cell by count; the refusal surface check passes.

Landed with SEMANTICS_VERSION 2348 (renumbered above development's 2347: written 2346 on its base 011540217d).
2026-12-03 06:46:59 -08:00