Commit Graph
10307 Commits
Author SHA1 Message Date
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
Anees Iqbal 1ba2517654 Translator tests: a coherent access beside a storage image orders the image's texels
lower/sync/memory_model.rs refuses a function with a coherent access and a storage image
(NotImplemented{Lowering(MemoryModel)}) outside an interlock, its module doc saying the image's
NonPrivateTexel accesses "are not measured". The translator does emit them: a storage image's read
and write take memory_model::coherence(plan).texel(), NonPrivateTexel under the Vulkan model, as
every word access of shared memory takes NonPrivatePointer, so a barrier orders them with other
invocations' accesses as GLSL450 does. Under the identity domains the refusal does not fire for a
texture slot (finish counts cx.descriptors.storage_images, which a slot adds to only off identity),
and the command line on engine_atomics' coherent_image kernel for moltenvk-m3 and lavapipe (no
lowering inputs, the runtime's route) gives OpMemoryModel PhysicalStorageBuffer64 Vulkan,
OpImageRead and OpImageWrite with NonPrivateTexel|VolatileTexel, and the coherent OpStore with
MakePointerAvailable|NonPrivatePointer at Device; a variant with a threadgroup barrier over device
and texture memory between the write and a neighbour's read gives OpControlBarrier Workgroup
Workgroup with AcquireRelease|UniformMemory|ImageMemory|MakeAvailable|MakeVisible. Each module
passes spirv-val at vulkan1.2, 1.3 and 1.4 (job m3-max-83520).

This ports the refusal's two tests to the answer and adds a device test:
- engine_atomics a_coherent_access_beside_a_storage_image_orders_its_texels: the kernel with the
  coherent store compiles on every committed profile of the file and on lavapipe without the
  memory model, and passes L3. Under the Vulkan model its texture's every read and write carries
  NonPrivateTexel and no MakeTexel* (the texture has Metal's default threadgroup coherence); under
  GLSL450 its storage image is Coherent (pipeline::testing::interlocked_coherence). The kernel with
  a plain store keeps plain texel operands.
- engine_handles a_coherent_access_beside_a_heap_storage_image_compiles: a heap storage class read
  and written beside a coherent store compiles and passes L3, with and without image robustness.
- metal2vulkan-runtime tests::coherent_texels, under a device cfg on every device: a kernel reads
  its texel of a read_write texture2d<uint>, writes it plus one, crosses a threadgroup barrier over
  device and texture memory, reads its neighbour's texel and stores it with
  air.store.device_coherent, over 64x16 threads in threadgroups of 8x8; every thread must read
  its neighbour's write, never the texel's earlier value. It prints the counts before it checks
  them.

At this commit the two translator tests fail: the function is refused. The device test runs
through the runtime's identity route, which the refusal does not reach, so it passes here.

Verified on the CPU (job m3-max-83707, red leg 1): with the crates at this commit the two translator
tests fail, each at its compile.
2026-12-03 06:46:42 -08:00
Anees Iqbal df54afeef2 Cases: LOD queries through a sampler bound with LOD clamps of its own, qualified on the M3 Max
Six authored cases over the owned fixture rfs_kernel_lod: five of the kernel lod_2d and one of
the vertex function lod_vertex, each through a runtime sampler bound with
set*SamplerState:lodMinClamp:lodMaxClamp:atIndex: with a pair that differs from its
descriptor's, so the answer says which pair the query reads. The M3 Max (macOS 27.0.1, job
m3-max-83804) answers the bind's pair in every one:

- nearest mip, default clamps, bound (2.7, 4): 3 (the descriptor's pair reads 0);
- nearest mip, clamps (3, 4), bound (1.2, 4): 1 (3);
- linear mip, default clamps, bound (2, 3): 2 (0);
- nearest mip, clamps (2.7, 4), bound (0, FLT_MAX): 0 (3);
- nearest mip, default clamps, bound inverted (3, 1): 1, as under (1, 1);
- the vertex function, default clamps, bound (2.7, 4): 3 (0).

Each unclamped level is 0. The ids join scripts/qualify-public-cases, CI's lavapipe step.

Why: under the identity domains the query reads the minimum level from the word of the
resource ID the slot pushes, and a bind with clamps pushes the ID of the state's variant of
the pair; these cases check that variant's word against Metal.
2026-12-03 06:46:39 -08:00
Anees Iqbal 2fe71c4a25 Validation: a sampler bound with LOD clamps of its own, honoured by the Metal oracle and the Vulkan candidate
A case's sampler gains bind_lod_clamps, the [lodMinClamp, lodMaxClamp] pair it is bound with.
The Metal oracle binds it through the stage's set*SamplerState:lodMinClamp:lodMaxClamp:atIndex:
(compute, vertex, fragment, tile, object and mesh); the Vulkan candidate through the runtime's
set_sampler_state_with_lod_clamps and its vertex and fragment forms, which bind the state's
variant of the pair. Absent, the field is left out of the case's JSON, so every existing case
keeps its identity; a NaN bound is refused, as Metal documents no answer for one, and an
inverted pair is allowed.

Why: the runtime's bind-time variant carries its own resource ID word, which a kernel's LOD
query reads under the identity domains; only an authored case of that bind checks its answer
against Metal.

Verified: the identity tests cover the field's absence, its presence and its NaN refusal; the
cases and their runs are in the next commit.
2026-12-03 06:46:39 -08:00
Anees Iqbal c5f979d985 Cases: kernel and vertex LOD queries through runtime samplers with LOD clamps, qualified on the M3 Max
Ten authored cases over the owned fixture engine/rfs_kernel_lod. Each comes from the committed
runtime-sampler case of its entry with the sampler's mip filter and LOD clamps set (no new AIR):
- lod_2d: nearest (2.7, 4) reads 3; nearest (1.5, 3) reads 1; no mip filter (2.5, 4) reads 0;
  linear (2, 3) reads 2; linear (10, 20) reads 4 (the last level); nearest (6, 9) reads 4;
- lod_2d_array: nearest (0.6, 4) reads 1;
- lod_3d: linear (1, 2) reads 1;
- lod_cube: nearest (2.2, 3) reads 2;
- lod_vertex: nearest (2.7, 4) reads 3, 64 points with no rasterization.
Every unclamped level is 0. These are exact rows only: a linear mip filter with an lodMinClamp
between whole levels, which the identity domains answer by the word's nearest level, has no case
(the planner's ruling; docs/API.md's accepted differences).

Installed with corpus-case-check and qualified with corpus-metal on the Apple M3 Max (macOS
27.0.1, environment apple-m3-max-macos27.0.1), job m3-max-83473. Each observation decodes to the
levels above, which metal::sampler::query_min_level gives. scripts/qualify-public-cases (CI's
lavapipe step) now runs these ten and the four existing runtime-sampler cases of the fixture.
Before this branch's translator fix those four were not_supported under the identity domains
(lavapipe, m3-max-83452: refusal=4); at the fix they match=4.
2026-12-03 06:46:39 -08:00
Anees Iqbal afe186c41e Validation: an authored sampler's LOD clamps, honoured by the Metal oracle and the Vulkan candidate
A case's sampler (SamplerResource) gains lodMinClamp and lodMaxClamp, each optional and left out
of the case's JSON when absent, so every case written before them keeps its identity. The Metal
oracle sets them on its MTLSamplerDescriptor (metal::platform::samplers), and the Vulkan candidate
on the descriptor its runtime sampler state is made of (candidate::engine::resources::
sampler_descriptor, the one source of the kernel, render and argument-buffer paths); an absent
clamp is Metal's default, 0 and FLT_MAX. The checker refuses a NaN or inverted pair. A clamp is
part of the identity where authored. No executor answer changes for a case without one, so no
executor version moves.

Tests: sampler_descriptor takes the clamps; absent clamps leave the JSON and the identity alone and
authored ones change it; an inverted or NaN pair is refused; every committed case (corpus/cases,
read by name) still computes to its stored case_id under the new schema. The last test is the
evidence that no existing identity moved; it runs in the lane's validation suite job.
2026-12-03 06:46:39 -08:00
Anees Iqbal 5b3bd800c0 Translator: under the identity domains a runtime sampler's LOD query outside a fragment function reads its minimum level from the sampler's word
A clamped calculate_clamped_lod in a kernel or a vertex function through a runtime sampler
argument was refused on every profile under the identity domains ("a sampler argument whose
minimum level or emulated filter the function specializes"): the query read the slot's
SamplerMinLevel specialization, which no binder chooses there.

The query now reads the word of the resource ID the sampler slot already pushes (SlotGuestBase):
0 where the word states no mip filter, else SamplerWord::LEVEL_MIN, the level a nearest mip
filter reads at lodMinClamp, bounded by the texture's last level as before. A bind-time clamp
(setSamplerState:lodMinClamp:lodMaxClamp:) binds a variant whose word is made of the clamped
descriptor, so it is read too. That is the M3 Max's and M4's measured answer
(metal::sampler::query_min_level) for no mip filter and a nearest one, and for a linear one where
lodMinClamp is a whole level or past the texture's last level. Under a linear mip filter with a
clamp between whole levels Metal answers the clamp on its sixty-fourths grid, which the word does
not hold. MSL 4.1 section 6.13 leaves both queries undefined outside a fragment function ("Only
call the calculate_unclamped_lod and calculate_clamped_lod functions from a fragment function or
a function you call with a fragment function; otherwise, the behavior is undefined."). So, per
the planner's ruling, there is no precision note; docs/API.md's accepted differences states the
answer. The resident-table path keeps its specialization.

SEMANTICS_VERSION 2347. The runtime-sources pin does not move: pin-compute.py gives a92fe0a8...
for this tree, the same as before. docs/REFUSALS.md does not move either: the refusal text
remains for an extended-range sample's linear-mip blend. The runtime README's known-gap entry
names the lowered query. Verified by the lane's red/green job, named in the lane's report.

Landed with SEMANTICS_VERSION 2347 (renumbered above development's 2346: written 2343 on its base,
then 2346 at the lane's rebase onto 0f4114c882, which development's HandleUse also took).
2026-12-03 06:46:38 -08:00
Anees Iqbal c04212227d Tests: a runtime sampler's LOD query outside a fragment function compiles under the identity domains (red)
Under the identity domains (the runtime's policy) a clamped calculate_clamped_lod in a kernel or a
vertex function through a runtime sampler argument is refused on every profile, "a sampler
argument whose minimum level or emulated filter the function specializes": the query wants the
slot's SamplerMinLevel specialization, which no binder chooses there.

The two tests compile rfs_kernel_lod's runtime-sampler entries (lod_2d, lod_2d_array, lod_3d,
lod_cube, lod_vertex) and sampling_completion's lod_query_kernel under the identity policy on the
lavapipe and moltenvk-m3 profiles, and require L3 to pass, no SamplerMinLevel or SamplerState
specialization, the sampler slot's resource ID pushed, one OpImageQueryLevels and no
OpImageQueryLod. Red at this commit: each compile is the IdentityDomains refusal. The red run is
the lane's next potluck job.
2026-12-03 06:46:38 -08:00
Anees Iqbal dfbc157464 Bless at pin T: the golden hash table and the authored compile census
The golden hash table moves 18 rows, 133 cells, every one a hash before and after, and gains 8
rows: kernel_handle_word_joins's four entries in both fixture forms, which compile on all 15
profiles. Its semantics line goes from 2342 to 2346. The golden bless at each translator commit
since pin S (job m3-max-83753) puts every moved cell on one of two commits:
- 423fbce843 (ZeroAddress placed where a read may be checked on a device-address slot): 29 cells,
  fragment_discard_hoist:hoisted_written_read in both forms on 12 profiles and
  kernel_dynamic_cursor_across_a_call on 5 (lavapipe x3, moltenvk-m3, runtime-floor);
- aa2355716b (a half-float or RG11B10Float texel held as words converts only values in range):
  104 cells, the texture-buffer subjects of a8r_buffers, hsw_storage_writes, tb_word_formats,
  texture_ops and tob_renders on the 7 profiles that hold a texture buffer as words, and
  kernel_texture_variant_leftovers on 6 of them.
The mode-2 rounding commit (011540217d) and HandleUse move no existing cell. The engine inventory
and the air_input printouts bless unchanged, and the metallib half of
committed_air_fixtures_parse_and_link passes on the M3's SDK (bless job m3-max-83730, at
f27b62c05a).

The authored compile census recompiled every cell: 2373 cases, 9 profiles, 21,357 cells, 0
cached; 19,142 compiled, 2,215 refused, 0 failed, 0 regressions (census job m3-max-83810, wall
65.7 s, slowest compile 450 ms). Its four differences are kernel_handle_word_joins's four new
cases, all compiled on every profile; 9 rows move only their artifact digests (30 digests), and
the artifacts_at line moves to this build.
2026-12-03 06:24:51 -08:00
Anees Iqbal f27b62c05a Validation: Metal qualifies kernel_handle_word_joins's four cases
corpus-metal ran the four authored cases on the M3 Max (apple-m3-max-macos27.0.1, the primary
reference environment), from the Metal twin kernel_handle_word_joins.air.ll, and qualified all four
(job m3-max-83499, at 1d88e9bd64).

The three sampler cases record one output (they spell the same choice three ways): even threads
read the texel clamp to edge names, odd threads the texel repeat names, and the two differ at
every shared out-of-range coordinate, so a thread that took the other branch's sampler would read
another texel. The texture case records each odd thread reading element slot[g] & 3 of the
texture array and each even thread the other texture.
2026-12-03 05:57:30 -08:00
Anees Iqbal 2fb00a15ae CI: qualify kernel_handle_word_joins's four cases on lavapipe
The public case step now runs the four authored cases of the owned fixture kernel_handle_word_joins
(a sampler or a texture taken from a branch merged at a join, as integer words in a phi and in a
select, and as pointers in a phi) against their Metal observations.

Verified: syntax only (bash -n); the cases' Metal observations and the step's run come next.
2026-12-03 05:57:30 -08:00
Anees Iqbal 4457fd001f Validation: authored cases for kernel_handle_word_joins's four entries
Four cases, one for each entry of the owned fixture kernel_handle_word_joins: sixteen threads
take a sampler or a texture from a branch merged at a join (as integer words in a phi, as words in
a select, and as pointers in a phi) and write what it samples or reads.

The sampler entries read element slot[gid] & 3 of an array<sampler, 1> through a run-time GEP
index; slot holds 4g, so the index is always the array's one element. The case checker binds only
the first slot of a sampler array (the case schema has no sampler-array resource), which is why
the array has one element; engine_handle_words compiles the same entries over an
array<sampler, 8>. The texture entry reads element slot[gid] & 3 of an array<texture2d, 4>.

Installed by corpus-case-check --install at c5bbdb25b7 (job m3-max-83477, msi), which also
translated the fixture's Metal twin (kernel_handle_word_joins.air.ll through metal-as) for all four
entries (spirv-val PASS) and ran engine_handle_words, 7 of 7 passed.
2026-12-03 05:57:29 -08:00
Anees Iqbal 2b45afa2ab Fixture: kernel_handle_word_joins's sampler entries load the element at a run-time index
The sampler entries read samplers[slot[gid] & 3] again, the structure under test: a word loaded
from a sampler-array element at a run-time index (a GEP whose index is a value, not element 0)
meets the constexpr sampler's bits at a join. The array stays an array<sampler, 1>: the authored
case checker binds only the first slot of a sampler array (the case schema has no sampler-array
resource), so the cases' slot values make the index 0 and Metal reads the one element.

engine_handle_words compiles the same three sampler entries over an array<sampler, 8>, a text edit
of the fixture's byval, GEP and argument metadata types, on every committed profile under both
policies, and checks the element's load is the clamped load over its run-time index range.

Verified: nothing yet at this commit; the next job runs the tests and llvm-dis of the twin.
2026-12-03 05:57:29 -08:00
Anees Iqbal 6bd7161ae7 Fixture: kernel_handle_word_joins's sampler entries read a one-element sampler array
The authored cases bind a sampler array's parameter at its first slot
only (the case schema has no sampler-array resource; the checker
refuses samplers 1-3 of an array<sampler, 4> as bound to nothing), so
the sampler entries now read the one element of an array<sampler, 1>
at a constant index, and their unused slot parameter is gone. The
texture entry keeps its four-element array read at a run-time index,
the same element lowering for either class. The typed twin follows
(reassembled with metal-as and linked with metallib on the M3), and
merged_handle_words_are_handle_indices expects the sampler entries'
static element load.
2026-12-03 05:57:29 -08:00
Anees Iqbal 3dbea580f1 Translator: SEMANTICS_VERSION 2346 for handle words merged at a join; their docs
Handle words merged at a join now compile where they were refused
(Lowering(Access) HandleUse), and a handle phi of a constant with one
candidate of its class where it was ConstantOperand: the output for an
unchanged key changes, so the version moves above development's 2342 (2343, which the audit lane's item also targets; renumbered at landing).

lower::access::handle's module doc says what the word webs are and
when they lower; AccessCause::ConstantOperand's doc says a handle phi's
constant is refused only without one candidate of its class.

The runtime guard's inputs are untouched (the build's hash over them,
recomputed the way build.rs does, is the committed
runtime-sources.sha256), and docs/REFUSALS.md regenerates unchanged.

Landed with SEMANTICS_VERSION 2346 (renumbered above development's 2345: ZeroAddress 2343, finding 1 2344 and 2345). runtime-sources.sha256 recomputed on development, unchanged (a92fe0a8).
2026-12-03 05:57:20 -08:00
Anees Iqbal 0367a0607a Tests: handle words merged at a join, their refusal edges, and the fixture's Metal twin
The fixture kernel_handle_word_joins.ll states in its header that it is
written from our own source and today's compiler's output for it;
kernel_handle_word_joins.air.ll is its typed-pointer twin, which xcrun
metal-as assembles for the Metal oracle (assembled and linked with
metal-as and metallib on the M3).

engine_handle_words adds:
- merged_handle_words_are_handle_indices: each entry's element load is
  the clamped element, the select merge a handle select, and each
  inttoptr (and the texture parameter's ptrtoint) a handle copy;
- an_observed_handle_word_is_refused: a merged integer with an
  arithmetic use, or stored, keeps Lowering(Access) HandleUse;
- a_handle_word_of_another_class_is_refused: a web merging a sampler's
  bits with a texture's, and one whose inttoptr makes a texture of a
  sampler's bits, are HandleAsPointer;
- a_handle_phi_of_a_constant_that_is_no_handle_of_its_class_is_refused:
  a sampler phi of a constant GEP of the sampler state is
  HandleAsPointer (provenance's class conflict refuses it before
  lowering's ConstantOperand);
- a_handle_phi_of_null_is_the_null_handle.

The fixture inventory gains the pair's eight rows, ok on every profile
(the .ll rows as the red test's run at e32daf9d9b compiled them; the
.air.ll rows expected, taken from the expectations off macOS).
2026-12-03 05:57:19 -08:00
Anees Iqbal 9e6b0df231 Translator: handles copied as integers and merged at a join are the handle of the branch taken
An older Metal frontend spells `cond ? samplers[i] : constexpr_sampler`
by copying each branch's handle as a 64-bit integer (an element of a
handle array as a plain integer load through its address, a constexpr
sampler or a handle parameter as the ptrtoint of its pointer), merging
the integers in a phi or select, and turning the merged integer back
into a handle with inttoptr. Lowering refused the integer load
(Lowering(Access), HandleUse), and the same merge of the pointers
themselves, today's form, was refused for its constant incoming value
(ConstantOperand).

Provenance now finds these word webs by structure alone
(memory::provenance::words): integers merged by phi, select, or freeze,
each a plain integer load, a ptrtoint of a pointer, a ptrtoint
constant expression, or another merge, all as wide as the pointer, and
every use another merge or an inttoptr as wide (a sink). Any other use
of an integer (arithmetic, a compare, a store, a call) or any other
operand of a merge leaves the web out, and its inttoptrs stay pointers
made from an integer. A sink of a merge joins its sources' facts while
each is a handle (a load through a handle-array element, the bits of a
handle parameter, a constexpr sampler, or null), so its candidates are
the same merge's of the handles; its class is seeded from the arrays
and merged with the converted pointers, so a web mixing classes is a
class conflict. The bits of a handle such a web carries are not an
escape.

Lowering plans each web whose sinks, loads, ptrtoints and constants all
hold one class's handles (each constant with exactly one candidate):
its integers are handle indices (HandleWord::Joined), its selects and
freezes routed to the access family, and each constant its handle
index. A handle phi takes a constant incoming value in only when the
constant has exactly one candidate of the phi's class (the null handle
or a constexpr sampler's; under the identity domains an argument
buffer's sampler takes only null, as its nil ID); any other keeps the
ConstantOperand refusal.
2026-12-03 05:57:19 -08:00
Anees Iqbal 5a6495e57c Red: name every refused entry and profile 2026-12-03 05:57:19 -08:00
Anees Iqbal 6f4090a5e0 Red: handles copied as integers and merged at a join (kernel_handle_word_joins), refused today 2026-12-03 05:57:18 -08:00