Commit Graph
10009 Commits
Author SHA1 Message Date
Anees Iqbal fcbb221b5f rt test: a render pipeline takes the loop's colour flag only where a draw reads its attachment (red)
Every render pipeline is made with VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT on a
device with the attachment feedback loop, whether or not a draw reads an attachment through it.
Vulkan asks for the flag only where a draw reads, as a non-attachment, an attachment that is in
the feedback layout (vkspec 8.10.2).

The test replaces the one that held every pipeline to the flag:
- an ordinary pass draws a state whose fragment function reads no texture and one whose function
  reads a texture no attachment renders; each state's pipelines carry no flag;
- two passes draw blue, then, after a memory barrier, each pixel read plus green; the reading draw
  makes its state's flagged pipeline once, at the first pass, and every pixel reads blue plus
  green each time, each reading draw one attachment_loop_reads;
- a device without the loop makes every pipeline with no flag and reads through a copy.

RenderCompiled::made_flags, for the device tests, lists the create flags of each pipeline a
content made.

Red here on a device with the loop: the ordinary pass's pipelines carry the flag.
2026-12-02 18:17:41 -08:00
Anees Iqbal 9186e2fe46 Validation test: the oracle-fuel fixture round trip skips what the toolchain is too old for and puts its status at the oracle's slot
oracle_fuel::tests::public_fixtures_with_loops_round_trip_instrumented failed on macOS CI (run
47003321413, macos-26, MetalToolchain 17.6), the first macOS run to reach it, in three ways:

- Ten .metal fixtures that name metal4.1, newer than that toolchain's metal4.0: "invalid value
  'metal4.1' in '-std=metal4.1'".
- tns_mm_fp8, tns_mm_left and tns_mm_v2 .air.ll: metal-opt "unrecognized architecture
  'air64_v29' provided." for the fixtures' own target triple.
- parked_heap_handles (.metal and .air.ll, four entries each): "buffer argument m2v_oracle_status
  has invalid location (<29,1>)". The fixture binds buffers 28 and 29, and the test put every
  status buffer at a fixed slot 29. The oracle itself puts it at the highest slot the entry's
  interface leaves free (NativeBufferSlots::from_interface(..).allocate(), via producer_slots);
  that is slot 30 here. This one is a test defect on any SDK.

The air writer's round trips already skip, list and count an input above the toolchain's AIR
version or Metal standard (Tally::refused). That rule moves into
air_writer::tests::above_the_toolchain and gains a third case, arch_ceiling: metal-opt's
refusal of an `air64_v<N>` architecture that the input's own target triple names. Each is the
toolchain's own refusal of something the input states; any other error stays a failure.

The oracle-fuel round trip now applies above_the_toolchain to a failure of a step on the fixture's
own AIR (compiling or assembling it, and finding the strictest level metal-opt passes). It prints
each skip and their count, "SKIP N of M inputs above the toolchain's newest version", as the air
writer's round trips do. A failure of the instrumented module's own round trip is never skipped.
Each entry is instrumented with its status buffer at the slot the oracle gives it, from the
entry's interface (status_slot).

Verified: red job m3-max-81148 (msi CPU) failed
an_input_of_an_architecture_the_toolchain_does_not_know_is_skipped_and_counted, and
every_other_toolchain_error_fails passed, at bec8a8dea1. The green and the macOS runs are named
in the hand-over.
2026-12-02 18:09:53 -08:00
Anees Iqbal 4bd7516305 Validation test: the L3 stand-in finds its parent with pgrep -a on macOS
translation_l3_stage::spirv_val_runs_in_the_l3_stage_that_replaced_the_translation failed on
macOS CI (run 47003321413, macos-26), the first macOS run to reach it: 'spirv-val ran under
"96367: not the L3 stage", not the worker's L3 stage'. The worker is right; the test's stand-in
is wrong. The stand-in spirv-val asks pgrep for the processes whose arguments hold
"--l3-stage engine" and looks for its parent there. macOS's pgrep leaves out its own ancestors
unless given -a (pgrep(1): "By default, the current pgrep or pkill process and all of its
ancestors are excluded"), and the L3 stage is pgrep's grandparent, so it never matched. procps's
pgrep on Linux excludes only itself, which is why the Linux job passes.

The stand-in now passes -a on Darwin alone: procps reads -a as --list-full, which would print each
command line beside its pid and break the exact pid match.

Verified: a local probe of the same script under `bash -c "sh standin.sh; :" --l3-stage engine`
on macOS 27 printed "not found" with plain pgrep and "found" with the fixed line. The test itself
runs on the next macOS CI run; it is not run on the M3 (no tests there).
2026-12-02 18:09:53 -08:00
Anees Iqbal e85535dbfa Validation test: an input whose architecture the toolchain does not know is skipped and counted (red)
macOS CI (run 47003321413, macos-26, MetalToolchain 17.6) failed
oracle_fuel::tests::public_fixtures_with_loops_round_trip_instrumented on tns_mm_fp8, tns_mm_left
and tns_mm_v2 .air.ll: that toolchain's metal-opt answers "unrecognized architecture 'air64_v29'
provided." for the fixtures' own target triple, which is newer than it knows. The air writer's
Tally already skips, lists and counts an input above the toolchain's AIR version or Metal
standard; it has no rule for this third refusal, so the fixture counts as a failure.

The new test hands Tally::refused that refusal for tns_mm_v2.air.ll and expects a skip. Two more
cases join every_other_toolchain_error_fails: an architecture the input's triple does not name,
and one refused for an input with no triple, both still failures.

Red: string-only, so it runs on Linux; expected to fail until the classifier lands (next
commits).
2026-12-02 18:09:53 -08:00
Anees Iqbal dddd91b993 Tables: golden hashes at semantics 2325
The bless for mad (2324) and the half form on devices lacking only 16-bit
DenormPreserve (2325). 1413 cells move, 471 in each of lavapipe,
gate-lavapipe and gate-lavapipe-x86_64, over 320 fixtures; no other profile's
cell moves, as T3's comparison predicted (the 3090 column is still owed). No
row is added or removed; mad's fixtures are not in the public set.

Blessed on the M3 (job m3-max-81107): inventory, golden hashes and printouts
exit 0; the metallib half of committed_air_fixtures_parse_and_link exit 0.
2026-12-02 17:58:54 -08:00
Anees Iqbal 59326c8dff Translator: half computes in 16 bits where only 16-bit DenormPreserve is missing, noting half denormals
The planner's ruling (T3). On a device with shaderFloat16, 16-bit RoundingModeRTE and 16-bit
SignedZeroInfNanPreserve whose only missing 16-bit control is DenormPreserve, the half operations
narrow::half_controls gates take the 16-bit route: a half + - * / sqrt and fused multiply-add on
the device's 16-bit instructions, half values held at 16 bits, the controlled pair for a float
rounded to half, and a half widened from and narrowed to its bits by the device's conversion.
It is the 16-bit floats query's existing form, read from one more of its properties.

narrow::controlled_modes declares RoundingModeRTE and SignedZeroInfNanPreserve for 16 bits there
and no denormal mode: not DenormPreserve for 16 bits (VUID 06296), nor the 64-bit one the
independence for 32 bits only ties to it (VUID 06289 asks for the same denormal mode at 16 and
64 bits). The independence rules decide which devices take it as before, and a device missing any
other 16-bit control keeps half in float.

MoltenVK on the M3 stays off the route: its denormal modes are not independent at all
(denormBehaviorIndependence NONE), where the form would tie float's denormal mode to half's and
change how the module's float arithmetic reads denormals, which Metal flushes; and its rounding
modes are not independent while it offers no 64-bit RoundingModeRTE, so the 16-bit
RoundingModeRTE the form declares cannot be declared at every width as VUID 06292 asks.

Every module that declares those controls on such a device (narrow::flushes_half_denormals)
records the new static note PrecisionNote::DeviceHalfDenormals, "half denormals may flush to
zero where Metal preserves them": the Vulkan spec leaves a 16-bit denormal to the device in an
entry declaring no 16-bit denormal mode. No other module records it. The conformance suite holds
its code, metal2vulkan-degrade-device-half-denormals, among the native notes beside
device-denormals (the device's own denormals, the one form built there); validation allows it
unbounded, as it does NativeHalfConversion.

Run on lavapipe, whose committed profile has this shape: its half arithmetic moves from float to
16 bits. Turnip on an Adreno GPU before the 8xx series reports the same controls (Mesa 26.3.1,
tu_device.cc lines 534, 1038-1048: shaderFloat16, RTE and SignedZeroInfNanPreserve for 16 bits,
DenormPreserve for 16 bits false below A8XX, independence ALL): not measured on a tile-based
phone GPU; no such device in the lab. No performance claim is made.

Tests: engine_native_half's new test (the red commit before this) now also asks for the note on
each such module and for none under all three controls or without another one. The tests that
held lavapipe as the conversion form now hold it under the controls (engine_native_half's
rounding kinds, memory and decode widenings and controlled modes; engine_half_hold's held values
and division; engine_arith's 16-bit fma profiles), and the conversion form on lavapipe's
description without 16-bit RoundingModeRTE.

SEMANTICS_VERSION 2325 (development holds 2323; 2324 is mad's), and ARTIFACT_FORMAT_VERSION
601 -> 602 (the new note's codec member). Golden rows are blessed at the pin.

Docs: the precision-note catalogue (docs/API.md, the new entry and the conversion entry's
controls), docs/HOWTO.md, the runtime README's shaderFloat16 row and its half fma line, the
NativeHalfConversion note's device list, api_signatures.

The conformance ledger. The form moves lavapipe, whose float controls lack only 16-bit
DenormPreserve, onto the 16-bit route. The conformance replay in the pinned lavapipe image (Mesa
26.2.4, LLVM 23.1.1) then answers 79 of the runtime ledger's llvmpipe rows otherwise:

- 47 now match Metal and are dropped: vertex-format-half4 28 and integer-vertex-attributes 16
  (the rows said lavapipe folds the unrounded OpFConvert pair, with no 16-bit DenormPreserve to
  make it Metal's; the pair now rounds under the 16-bit controls), and half-texel-nans-rg11b10f's
  3 (nearest-sample, read, widened).
- 32 now answer otherwise and are replaced, each with the answer and a reason written from this
  run's printout (first differing element):
  - vertex-format-half4, 8 rows (Float..Float4, Half..Half4): only the NaN differs now, Metal
    0x7fc00000, the device 0xffc00000; one element per component, where the rows recorded the
    unrounded values (Float, the largest difference inf) or the kept payload (Half).
  - half-texel-nans, 18 rows (nearest-sample, read and widened of r16f, rg16f, rgba16f, r32f,
    rg32f, rgba32f): a 16-bit float texel's NaN now narrows to 0x7e00 (the payload dropped, as
    read-through-sample already answered; Metal hands back the texel's code); a 32-bit one to
    0xfe00 (Metal 0x7e00); the widening answers 0xffc00000 (Metal 0x7fc00000). Six rows count more
    elements than before (the 16f nearest-sample and read rows: 215 -> 472, 428 -> 940,
    852 -> 1874), twelve fewer.
  - bicubic-texel-classes, 6 rows: fewer elements at every site, each count and largest
    difference the one the 780M and RTX 5080 rows record; within the bicubic note's bound.
  None of the 79 is a half denormal.

docs/CONFORMANCE-COVERAGE.md regenerated (scripts/conformance-coverage/coverage.py): ledger rows
7932 -> 7885. The image is the pinned one, so the ledger's llvmpipe line does not move.

Not replayed, a follow-up: the six bicubic-texel-classes rows of venue "llvmpipe (LLVM 23.1.4,
256 bits)", a lavapipe outside the pinned image; this commit leaves them as they were.

Verified: the replay of this tree without the ledger edit, job m3-max-80972 (pinned lavapipe
image): exit 1 with row differs 32, now answers otherwise 32, now matches 47; the rows are written
from its printout. The same counts in job m3-max-80871 (the pre-rebase fix, against its base,
which exits 0). coverage.py --check: as derived.

No lab card's translation moves. The golden blesses at development (15898e612e) and at this
change, over the committed profiles plus the RX 7900 XTX's vulkaninfo --json capture (job
m3-max-80916), compared cell for cell, job m3-max-81006 (macOS, every fixture, 3624 rows): every
column but lavapipe, gate-lavapipe and gate-lavapipe-x86_64 (471 cells each) is equal, among them
the XTX capture, amd-780m-radv, amd-780m-hawkpoint-radv, intel-irisxe-rplp-anv,
intel-irisxe-anv and moltenvk-m3; no profile fingerprint moves (job m3-max-80958, the
same over the 1910 rows a Linux host assembles, agrees). Not run on an RTX 3090: its column is
owed until the card is back.

Gate at this tree, job m3-max-80990: clippy -D warnings plain, under m2v_cpu_icd and under m2v_gpu
0; rustdoc -D warnings 0, and with private items for metal2vulkan 0; the runtime's suite on
lavapipe 945 passed, 4 skipped (whole suite); translator and AIR 3415 passed, 37 skipped (the
golden hash table, the fixture inventory and the engine printouts excluded: their bless is due at
the pin); validation 1319 passed, 3 skipped; conformance 1048 passed. CI's lavapipe steps in the
pinned image, job m3-max-81012: device tests 841 passed (843 listed), the conformance replay exit 0
(the 4640 gaps the ledger expects, exactly), public case qualification exit 0.
2026-12-02 17:49:23 -08:00
Anees Iqbal 306f8b00eb Translator test: half computes in 16 bits under RTE and SignedZeroInfNanPreserve where only 16-bit DenormPreserve is missing (red)
The planner's ruling (T3): on a device with shaderFloat16, 16-bit RoundingModeRTE and 16-bit
SignedZeroInfNanPreserve whose only missing 16-bit control is DenormPreserve, the half
operations narrow::half_controls gates take the 16-bit route, and any other missing control
keeps today's 32-bit form, under today's independence rules.

engine_native_half's new test asks, on the committed lavapipe profile and on the RTX 5080
Laptop GPU's and the Radeon 780M's descriptions without shaderDenormPreserveFloat16, for the
16-bit instructions the full controls give (a sum, a product and a chain of two on 16-bit
floats, the controlled pair for a half narrowed alone), an entry declaring RoundingModeRTE and
SignedZeroInfNanPreserve for 16 bits and no DenormPreserve at any width (the 780M's
independence for 32 bits only would tie a 64-bit one to a 16-bit one, VUID 06289), no
DenormPreserve property required, L3, and each operation rounded on the interpreter. And it
asks that the RTX 5080 Laptop GPU without 16-bit SignedZeroInfNanPreserve too, MoltenVK on the
M3 (denormal and rounding modes not independent), and the 780M without 64-bit DenormPreserve
stay in float.

Red: half_controls asks for 16-bit DenormPreserve, so lavapipe computes half in float.
2026-12-02 17:49:16 -08:00
Anees Iqbal 4fa543f9e6 rt test: a half mad answers the fused 2^-12 only where the module records NativeHalfConversion
opencl_mode_mad_rounds_its_product_and_its_sum failed on lavapipe (llvmpipe, LLVM 23.1.1):
the half mad(a, a, c) at a = 1 + 2^-6, c = -(1 + 2^-5) answered 0x0c00, the fused 2^-12,
where the M3 Max answers 0. The float and float4 rows answered 0 there too, as on every
device.

lavapipe has no 16-bit denormal-preserve control, so the module computes the half product
in float and rounds it through the conversion pair, records NativeHalfConversion, and
lavapipe's compiler folds the pair: the product stays exact and the sum is the fused
answer. That is the note's documented bound (docs/API.md), so the test now accepts 0x0c00
only where the module records NativeHalfConversion, as the vstore_half test beside it
does; every other row, and the half row on a module without the note, stays exact. The
test prints the half it read and the notes, so a run shows which case it took.

When the 16-bit route for lavapipe lands, the half mad there is the device's 16-bit
multiply and add, the module records no NativeHalfConversion, and this test is exact on
lavapipe too.

Verified: m3-max-80986 (msi, 8dbd521441) failed the test on lavapipe; m3-max-81037 read its
assertion, half 0x0c00 with the float rows 0. The run of this commit on lavapipe is the
hand-over's job.
2026-12-02 17:49:12 -08:00
Anees Iqbal 90950389a8 canon: routine_len takes a routine's operands with get, not a slice index
clippy's indexing_slicing lint refused `&any[..r.kind.arity()]` in routine_len, in all three
configurations (job m3-max-80905, STEP clippy_plain, clippy_gpu and clippy_cpu EXIT=101: "slicing
may panic"). The operands are now `any.get(..arity)`; an arity past three is an invariant error,
which no kind has.

Verified: cargo fmt only on this host; the check job reruns clippy.
2026-12-02 17:49:12 -08:00
Anees Iqbal 9f42b4c1f3 Translator: OpenCL C's mad is its multiply and its addition, each rounded on its own
Apple's OpenCL compiler spells OpenCL C's mad(a, b, c) as air.mad.<T>. No
family decoded it, so a kernel that calls it (a real OpenCL workload's
image-scaling kernel, air.mad.f32 in AIR 2.8) was refused as
UnknownIntrinsic. OpenCL C leaves how mad rounds its product to the
implementation. The M3 Max's GPU rounds the product and then the sum.

- Decode: MathFn::Mad, which Math::parse reads from air.mad.<T> for the
  three types the compiler was measured to spell (MAD_TYPES: f32, v4f32,
  f16), each T (T, T, T), always Precision::Precise. Every other type
  (v2f32, v3f32, v8f32, v4f16, bf16, i32) and spelling (fast_mad,
  native_mad, a sign token) stays undecoded, as the planner ruled. mad is
  not a TABLE stem, so Math::float_stems (Metal's own functions) is
  unchanged.
- Lowering, the planner's option (2): canon::routine, which already
  rewrites the frexp and ilogb routine calls into plain AIR after SCCP,
  now replaces each mad call with an fmul of a and b followed by an fadd
  of that product and c. Both carry no fast-math flags, whatever the
  call's own flags are. Lowering then gives them exactly what an
  unflagged fmul and fadd get: NoContraction on each, the profile's half
  form, and no new note. air_math's invariant arm (Frexp, Ilogb) now
  takes Mad too.
- Which form is smaller: the canonicalization. The families rows need a
  DeclClass::Air, so MathFn::Mad cannot be avoided, but the rewrite
  reuses the routine pass's expander, about 40 lines. A lowering of its
  own would need a new FloatFn and its half forms.

Evidence, with its caveat as it is:
- Spellings come from Metal's OpenCL mode (newLibraryWithSource with
  sourceLanguage 1, macOS 27.0.1, AIR 2.9), over our own kernels on the
  M3 (job m3-max-80752).
- Answers come through the OpenCL framework on the M3 Max's GPU (job
  m3-max-80759), not through a Metal pipeline of OpenCL mode:
  - float, at a = b = 1 + 2^-12 and c = -(1 + 2^-11): mad answers 0,
    fma 2^-24, and a*b+c 2^-24;
  - float4: each lane of mad answers 0;
  - half, at a = b = 1 + 2^-6 and c = -(1 + 2^-5): mad answers 0 and
    fma 2^-12.

Tests:
- families_tests OBSERVED rows (previous commit, red).
- intrinsics::tests::opencl_mad_decodes_in_its_measured_types_alone.
- engine_arith::opencl_mad_is_its_multiply_and_its_addition, over our
  own .ll on the three profiles:
  - each mad kernel's linked SPIR-V has the same opcodes as its twin
    written as an unflagged fmul and fadd, with the same notes;
  - the float and float4 kernels have OpFMul and OpFAdd, each
    NoContraction, and no Fma;
  - the interpreter answers 0 on the probe's inputs.
- runtime opencl_data::opencl_mode_mad_rounds_its_product_and_its_sum, a
  kernel of OpenCL mode: +0 on the float, on each float4 lane and on the
  half, under a device cfg.

Public surface: MathFn gains Mad (api_signatures.tsv blessed), so an
exhaustive match over MathFn in a consumer breaks. docs/REFUSALS.md was
regenerated and is unchanged. docs/API.md lists mad beside the OpenCL C
native_ and half_ functions.

SEMANTICS_VERSION 2323 -> 2324: a module that calls air.mad translated to
a refusal before and translates now. The authoring classification follows
on its own, since its key fingerprints the product's sources
(ANALYZER_ABI), so no census version needs a bump.
2026-12-02 17:49:11 -08:00
Anees Iqbal 3507ce2694 Intrinsics: observed rows for OpenCL C's mad (red)
Apple's OpenCL compiler, through Metal's OpenCL mode (newLibraryWithSource
with sourceLanguage 1, macOS 27.0.1, AIR 2.9), spells OpenCL C's mad(a, b,
c) of float, float4 and half as air.mad.f32, air.mad.v4f32 and
air.mad.f16, each T (T, T, T). No family decodes them, so a kernel that
calls one is refused as UnknownIntrinsic (air.mad.f32).

The three declarations go into OBSERVED, which observed_declarations_decode
requires to decode. Red until the next commit decodes them.

Spellings from our own OpenCL C kernels on the M3 (potluck job
m3-max-80752), carved from each entry's bitcode and disassembled with
metal-opt. The probe produced no other vector width, so no other is added.
2026-12-02 17:49:11 -08:00
Anees Iqbal 8798938407 Tests: the indexed-patch factors test builds devices of the identity domains
The link test of IndexedPatchFactors read the identity domains off the
committed profiles, whose policy is the resident tables', so it tried none
and failed only on its own count (job m3-max-80982 on the msi CPU:
'a committed profile takes the identity domains'). It now builds each
committed profile with bufferDeviceAddress and shaderInt64 under the
identity domains' policy, as the engine test of the address form does,
and asserts the policy took. The engine test's doc names the cause.
2026-12-02 17:39:09 -08:00
Anees Iqbal 0c12c606fa Translator: the address form's indexed patches name their cause
The last cause-less Feature::Tessellation refusal of the translator, the
address form's in pipeline/link/tessellation control_plan
("addressed && !fits"), now names TessellationCause::IndexedPatchFactors:
a control-point index type beside a per-instance factor step or a factor
scale where pointers are device addresses used directly, where the
control-point indices' address takes the control stage's push words that
hold the factors' instance stride and scale (control::address_fits).
Every Feature::Tessellation NotImplemented refusal now carries a cause:
the translator's through Unsupported::tessellation, the AIR front end's
through its conversion.

Tests: the link test of the commit before this one (each such pair on
every committed profile of the identity domains); the engine test of the
address form's stepped and scaled descriptors asserts the cause too.
api_signatures blessed (the variant), REFUSALS.md regenerated (the
control_plan site moves under error/mod.rs's Unsupported::tessellation).
runtime-sources.sha256 unchanged: neither file is a runtime input.
2026-12-02 17:39:09 -08:00
Anees Iqbal 56a86dcc14 Tests: indexed patches beside instanced or scaled factors name their cause (red)
TessellationCause gains IndexedPatchFactors: a control-point index type
beside a per-instance factor step or a factor scale where pointers are
device addresses used directly. The link test asserts it for each such
pair on every committed profile of the identity domains, and that each
pair without the index type is planned. The address form's refusal
(pipeline/link/tessellation control_plan) still names no cause, so the
test fails.
2026-12-02 17:39:08 -08:00
Anees Iqbal 530fb4ea4c Validation: the runtime route refuses no patch draw through index buffers, which no case makes
The engine candidate's runtime route required a patch draw to name no patch
or control-point index buffer, and refused one that did as
executor_not_implemented. No case reaches that refusal: the case mapping
(graphics::patch_draw) names neither buffer for every patch draw, the case
schema has no field for them, and the AIR states nothing about a draw's
index buffers. The conformance suite's tessellation-patch-indices case
compares drawIndexedPatches and patch index buffers against Metal.

The route now takes every patch draw, its refusal message and
VALIDATION.md's sentence drop the clause, and the routing test drops its
patch draw through a patch index buffer. The runtime platform's draw keeps
its own check of the translator's DrawCall fields, which fails a draw that
names an index buffer visibly.
2026-12-02 17:26:54 -08:00
Anees Iqbal 7dff42d6a5 command-replay: SIGTERM stops the play at its next frame end
A watchdog's SIGTERM killed a play inside a frame; on a 3090, plays killed mid-frame were
followed by a wedged card (11-23), which is why a play on an NVIDIA card ends at an
--until-frame. The player now takes a stop flag (Player::stopping_on): once it is set, the
play stops after the frame then playing ends, as at --until-frame, and command-replay tears
the device down as at any end. The SIGTERM handler writes its progress line and sets the
flag instead of re-raising; after the stop the play writes `progress stopped after SIGTERM:
frame N of M ended last at T s`, no judged metric, the report verdict `stopped SIGTERM after
frame N, short of its range` and exit status 1. A frame that never ends (a call that never
returns) is left to the caller's kill (timeout -k).

Not yet built: a lavapipe job plays one stream under a forced 150 s watchdog with the player
before this commit (red: killed inside a frame) and with it (green: ends at a frame).
2026-12-02 17:21:11 -08:00
Anees Iqbal af4dc848bd command-replay: progress lines every tenth frame and at the last, and a line on SIGTERM
A play killed by a caller's watchdog left no line saying how far it got: the 5080 stream
arm of job m3-max-80863 ended at its 840 s watchdog with the frame unknown. play now writes
`progress frame N of M ended at T s` to the standard error at the end of every tenth frame
and of the last frame it plays to, counted at the one flush the player makes as each frame
ends (Player::with_frame_lines), and on SIGTERM (Unix) `progress SIGTERM at T s: frame N of M
ended last` (or `no frame ended`), formatted without allocating, before SIGTERM ends the
process as it would have. Test-side only: the validation crate's binary.

Not yet built: the players' rebuild job and the 3090 rehearsal with a forced watchdog check it.
2026-12-02 17:21:11 -08:00
Anees Iqbal 778e7c3acc Replay player: the patch draw helper's buffers as one named type
Clippy's type_complexity refused the helper's return type in every
configuration (job m3-max-80857). AtOffset names a buffer a draw names, at its
offset, or none.
2026-12-02 17:12:14 -08:00
Anees Iqbal ac99c98778 Replay player: drawPatches from an indirect buffer, and drawIndexedPatches direct and indirect
The player refused three of Metal's four patch draws as not played on a
render encoder, so a stream whose program draws patches through an indirect
buffer or a control-point index buffer lost those draws. Each now plays as
the runtime's call (draw_patches_indirect, draw_indexed_patches,
draw_indexed_patches_indirect), beside drawPatches, through one helper the
four share: a nil patch index buffer is none, a draw naming a skipped buffer
(patch index, control-point index or indirect) is a skipped draw, a draw
skipped by its state or a bound object is counted as before, and a draw
through a state whose record lacks the tessellation key is counted.
REPLAY-STREAM.md names the patch draws among what render encoders play.
2026-12-02 17:12:14 -08:00
Anees Iqbal e50911e861 Replay test: the three patch draws the player refuses, played through the runtime (red)
Three device tests of the replay player: a stream of the owned fixture
tess_indexed_patches draws twice into one pass, once with a nil patch index
buffer and once through one at offset 4, by
drawPatches:...indirectBuffer:indirectBufferOffset: (no control-point index
type), drawIndexedPatches:patchStart:...:baseInstance: (UInt16) and
drawIndexedPatches:...indirectBuffer:indirectBufferOffset: (UInt32). Each
checks both output buffers against the values Metal writes (the runtime's
patch test holds the M3 Max's runs) and asserts nothing skipped.

Red until the player plays those selectors: it refuses each as not played on
a render encoder.
2026-12-02 17:12:13 -08:00
Anees Iqbal 64ea7aaedc Docs: the DontCare store gap names its form and when it is built
The runtime README's DontCare store gap now says an Unknown store action
stores too, and states the form on file: each rendering recorded into a
secondary command buffer of its own, its begin recorded as it ends, when
its store operations are known, which would also take the late store
action RenderPassKind::LateStore refuses. It is not built while no
tile-based phone GPU is in the lab, no measurement on one shows the
write-back as a cost, and no guest program is known to meet that refusal.
The pass counts are those of the store census, jobs m3-max-80663,
m3-max-80681 and m3-max-80720 (the README quotes the last). The paragraph
is rewrapped at 100 columns.

Docs only.
2026-12-02 16:52:24 -08:00
Anees Iqbal ce337e89a7 Docs: the overlap refusal's basis cites the Mac readings; a DontCare store is a known gap
Refusal::BufferCopyOverlap's Basis line kept "ours" with no reading of
Metal behind it. It now cites the two: on an Apple M3 Max, macOS 27.0.1,
arm64 and x86_64 under Rosetta (job m3-max-80419), and on a Radeon Pro
5300M, macOS 26.7.1 (job m3-max-80501), every overlapping copy equals
memmove's, forward and backward, Shared and Private, 64 bytes to 16 MiB,
five runs each; on that Mac's UHD Graphics 630 a forward overlap of 64 KiB
and up differs from memmove's in each of five runs, at the same first byte
and the same count of bytes. Metal's validation layer was on in both and
stopped none. The kind stays "ours": the readings show plain Metal takes
the copy, which the refusal-surface script calls metal-takes, and the
runtime's RefusalBasis has no variant for it, so naming it is a public type
change, not this docs commit. REFUSALS.md regenerated.

The runtime README's render encoder gaps gain the DontCare store: it
stores, because Vulkan fixes a rendering's store operation as it begins
and a pass may become several renderings for commands met after it
begins, so a tile-based GPU writes back attachments Metal lets a program
discard; not measured on a tile-based phone GPU, no such device in the
lab. The counts are from the store census over two replay streams (jobs
m3-max-80663, m3-max-80681 and m3-max-80720, the last the one the README
quotes, after the census also followed descriptors made by
renderPassDescriptor): 6,401 of 80,906 passes over 1,115 frames (5.74 a
frame, 7.9%) and 4,886 of 73,212 over 1,036 frames (4.72 a frame, 6.7%),
each such pass storing one colour attachment and not caring about a second
or its stencil attachment.

Docs only: a doc comment, the generated REFUSALS.md and the README.
refusal_surface.py --check passes.
2026-12-02 16:52:24 -08:00
Anees Iqbal dec74d9cf7 Translator: a tessellation refusal names the structure it met
Feature::Tessellation with Needs::NotImplemented covered fourteen refusal
sites behind one name, so a walk's log line ("the translator refused the
feature Tessellation, needing NotImplemented", cause None) could not say
which without the AIR. A tessellation refusal now carries
Cause::Tessellation(TessellationCause), one variant per structure the
sites refuse, the way an access refusal names its AccessCause; sites that
refuse the same structure share a variant, none is named by a file, a line
or a string of its own:

- PatchStep: a layout stepping per patch or per patch control point read
  by a vertex function that is not post-tessellation (metal/vertex.rs
  fetch_as, fixed-function input; lower/stage_io/fetch.rs, the pulled
  fetch).
- PatchInterface: a patch input or a patch builtin in a function that is
  not post-tessellation (lower/stage_io/plan.rs, two arms).
- UncountedPatch: [[patch(kind)]] with no count, or a count of 0 whose
  control points are read (lower/tessellation plan_entry and select).
- InstanceStepRate, AttributeStep: a patch attribute per instance at a
  rate above 1; a step the attribute's input has no element for.
- Builtin, VertexInput, SimdGroup: another builtin, a vertex input, or
  SIMD-group semantics in a post-tessellation vertex function.
- ControlPointInput: the AIR front end's Tessellation, which is that one
  structure (its two arms in canon post_check); the conversion from the
  front end's refusal names it, so the front end's types are unchanged.

lower/tessellation's not_implemented() helper takes the cause, so the
compiler makes each of its sites name one; thirteen of the fourteen arms
name a cause. The fourteenth, the control-point index type
on the address form (pipeline/link/tessellation control_plan) is left as
it is: the drawIndexedPatches change removes that arm.

Feature stays Tessellation, so validation's outcome key (feature_key, the
Debug of the feature) and the census are unchanged; nothing stores the
cause (as for the access cause). No version bump.

Tests: the error module's Display test of a tessellation refusal and of
the front end's conversion; the cause asserted at the fixed-function and
pulled patch-step refusals (metal/vertex.rs, engine_vertex_fetch), the
uncounted patch (reflection), post-tessellation SIMD-group functions, and
a new test of a control-point layout stepping per patch, a patch layout
stepping per vertex (AttributeStep) and per instance at 2
(InstanceStepRate). The commit before this one adds those tests against
the cause-less sites.

runtime-sources.sha256 rewritten: metal/vertex.rs's refusal names its
cause, and no run behaves otherwise. api_signatures blessed
(TessellationCause, Cause::Tessellation), api_surface lists the enum,
REFUSALS.md regenerated (the sites are built through error/mod.rs's
Unsupported::tessellation), docs/API.md's error table names the cause.

Consumer uses (consumer-uses.sh, read-only, over the consumer's
development 33784022f1 and its lane tips of the last day):
Feature::Tessellation and TessellationCause, 0 hits.
2026-12-02 16:51:29 -08:00
Anees Iqbal c932d15639 Tests: a tessellation refusal names the structure it met (red)
The error module gains Cause::Tessellation(TessellationCause), one variant
per structure a Feature::Tessellation NotImplemented refusal meets, and
Unsupported::tessellation; the front end's Tessellation refusal maps to
ControlPointInput. The tests assert the cause at the sites: the patch-step
fetch (metal/vertex.rs, engine_vertex_fetch), the uncounted patch
(reflection), SIMD-group functions after tessellation, and a new test of
an attribute step a patch input has no element for and a patch instance
rate above 1. The sites still build cause-less refusals, so these fail.
2026-12-02 16:51:29 -08:00
Anees Iqbal 15898e612e Tables: golden hashes at semantics 2323, and tess_indexed_patches's inventory rows and printout
Re-blessed on the M3 at 466d447c6a (bless job m3-max-80813: inventory, golden, printouts and the metallib link half all EXIT=0). The golden table moves 94 rows for split-store (semantics 2322) and drawIndexedPatches (2323), and adds tess_indexed_patches's rows; the engine inventory gains the fixture's .ll and .air.ll rows; tests/air_input/tess_indexed_patches.txt is its printout. These are the four bless items lavapipe named in m3-max-80734 (golden cells, the inventory's 1338 against 1340, llvm_as part 1's row, the missing printout).
2026-12-02 16:25:48 -08:00
Anees Iqbal c50fd04219 rt: drawIndexedPatches, and patch draws through a patch index buffer
The runtime refused a patch draw through a patch index buffer
(Gap::Draw of DrawKind::PatchIndexBuffer) and had no indexed patch draw.
The viewer draws every patch with drawIndexedPatches, indirectly, through
a nil patch index buffer and a UInt32 control-point index buffer (reims's
walk at development 8a2f155883, job m3-max-80637 on the XTX: 4202
draw_indexed_patches calls left unbuilt).

The encoder now:
- takes a patch index buffer in draw_patches and draw_patches_indirect;
- has draw_indexed_patches and draw_indexed_patches_indirect, whose two
  index buffers come as one PatchIndexBuffers (the patch index buffer or
  none, and the control-point index buffer, each with its offset), as the
  indexed primitive draws take an IndexBuffer;
- pushes each index buffer's address plus its offset beside the factors'
  (FieldValue::PatchIndices, FieldValue::ControlPointIndices, 0 for none),
  and fills the push bytes again when they change. The control stage reads
  the indices through those addresses, unchecked, as it reads the factors;
- counts each index buffer among the draw's reads, as an index buffer
  (a Managed one's device copy brought up to date first), and keeps it until
  the command buffer retires.
Metal's validation refuses four things (an Apple M3 Max, job
m3-max-80366), and the runtime refuses them typed, direct and indirect:
- drawIndexedPatches through a state of index type None,
  Refusal::IndexedPatchDrawWithoutIndexType;
- drawPatches through a state with an index type,
  Refusal::PatchDrawWithIndexType;
- a patch index buffer offset that is not a multiple of 4,
  Refusal::PatchIndexBufferOffset;
- a control-point index buffer offset that is not a multiple of the index
  size, Refusal::ControlPointIndexBufferOffset.
Indices at a byte of the buffer's allocation off that multiple (a no-copy
buffer over such a pointer) are Refusal::ArgumentPlace, as an indexed
draw's are.

DrawKind::PatchIndexBuffer is deleted: nothing returns it. consumer-uses
at the consumer's development db87b77b07 (104 refs) finds PatchIndexBuffer
at 0 code hits; the consumer's DrawKind uses construct AttachmentRead and
LineWidth, and its one match on DrawKind has a wildcard arm
(render.rs:283-287), so the deletion breaks nothing there.

The conformance suite's runtime side draws RenderStep::DrawIndexedPatches.
Its tessellation-patch-indices case now compares on lavapipe (announced:
only the declared winding notice), so its four refused rows leave
known-gaps-rt.tsv; indirect-render-commands-patch-draws now makes its
indexed patch pipeline and reaches its command buffer, whose
indirect_command_buffer call the side answers Unavailable as the case's
siblings do, so its row moves there. docs/CONFORMANCE-COVERAGE.md is
regenerated. The runtime README, docs/REFUSALS.md, the refusal bases, the
API signature table and the Metal coverage map say the same.
2026-12-02 16:25:48 -08:00
Anees Iqbal 082248f947 Translator: the address form reads patch and control-point indices through their pushed addresses; a fragment's primitive id is the patch's position
Under the identity domains (the runtime's), a post-tessellation function's
control stage reads its factors through their pushed address and binds no
buffer. It had no way to read a patch index buffer or a control-point
index buffer, so it took each patch's index from its position and refused
a control-point index type (NotImplemented(Tessellation)). The viewer's
two pipelines are UInt32 control-point indices drawn by
drawIndexedPatches, and both were refused.

The control stage's push range now holds, at its offset:
- 0: the factors' address (u64), as before;
- 8: under a control-point index type, the control-point index buffer's
  address plus its offset (PushField::ControlPointIndexAddress, u64);
  otherwise the per-instance step's stride at 8 and the scale at 12, as
  before;
- 16: the patch index buffer's address plus its offset
  (PushField::PatchIndexAddress, u64), 0 for a draw without one.
24 bytes in all, below the post-tessellation function's window
(push::TESSELLATION_BASE). A control-point index type beside a
per-instance factor step or an enabled factor scale has no room for both,
and stays NotImplemented(Tessellation) (control::address_fits); the
runtime refuses those two at state creation anyway.

What the stage reads, from the Apple M3 Max's tables (jobs m3-max-80366
and m3-max-80398):
- the patch at position p (patchStart plus its place in the draw) reads its
  factors at p, whatever its patch index;
- its [[patch_id]] is the uint at index p of the patch index buffer where
  the pushed address is not 0, else p;
- control point j of patch pid is the vertex the index at pid * N + j of
  the control-point index buffer names (a ushort read out of its aligned
  word for UInt16, a uint for UInt32), else pid * N + j.
Each read goes through the address unchecked, as the factor reads do. No
check form is added.

A fragment function's [[primitive_id]] behind the stage is the patch's
position, with a patch index buffer or without (the same tables): the
control stage writes p to a flat varying at PATCH_POSITION_LOCATION (3),
which the evaluation stage hands on, and the control point varying moves
to location 4. Before, the varying carried the patch index, which equals
the position only without a patch index buffer.

The cache codec carries the two new push fields: ARTIFACT_FORMAT_VERSION
601. Translation output changes for every post-tessellation pipeline
under the identity domains: SEMANTICS_VERSION 2323 (2322 is split-store's).

Tests: control/tests.rs runs the address form's patch index and control
points on the SPIR-V interpreter (both index types, a nonzero and a zero
patch index address) and checks the pushed fields of each form;
engine_tessellation compiles the stream's state under UInt16 and UInt32
on every committed profile with the identity domains, with the fields at
0, 8 and 16, and refuses UInt32 beside a per-instance step or a scale;
lower::push checks the range fits below the window for every step, scale
and index type the form takes.
2026-12-02 16:25:21 -08:00
Anees Iqbal 975a9c0fc2 rt test: patch draws read control points and patch indices through their index buffers, factors and primitive ids at the position (red)
What Metal reads under a patch index buffer and a control-point index
buffer, from the Apple M3 Max's tables (jobs m3-max-80366 and
m3-max-80398, every form: drawPatches and drawIndexedPatches, direct and
indirect, with and without a patch index buffer):
- patch p of a draw (patchStart plus its index) is patch
  pid = patchIndexBuffer[patchIndexBufferOffset / 4 + p], or p without one;
- control point j is element
  controlPointIndexBuffer[controlPointIndexBufferOffset / size + pid * 3 + j]
  under drawIndexedPatches (u16 and u32 alike), and pid * 3 + j under
  drawPatches;
- the factors are entry p of the factor buffer, and [[primitive_id]] is p,
  whatever pid is;
- [[instance_id]] includes the base instance, and both instances agree.
Metal's validation refuses four things: drawIndexedPatches through a state
of index type None; drawPatches through one with an index type; a
controlPointIndexBufferOffset that is not a multiple of the index size; and
a patchIndexBufferOffset that is not a multiple of 4.

The tests, in tests/patch.rs:
- every_device_reads_control_points_and_patch_indices_through_their_index_buffers
  uses the new fixture tess_indexed_patches. It draws three patches of two
  instances from patch 1 and base instance 3, under each index type (None
  through drawPatches; UInt16 and UInt32 through drawIndexedPatches, their
  indices one index into the buffer), with and without a patch index buffer
  (position p is patch 6 - p), direct and indirect. Factor entries 1 and 4
  cull, so a build that read factors at the patch index would draw position
  1's patch 5 and cull position 2's patch 4.
- every_device_reads_a_patch_s_position_as_its_primitive_id_under_a_patch_index_buffer
  draws tess_primitive_ids with a patch index buffer that maps positions 1
  and 2 to patches 3 and 0. Each tile sits at its patch index and reads its
  position as [[primitive_id]].
- every_device_refuses_the_patch_draws_it_does_not_build now expects the four
  refusals, direct and indirect, as typed Refusal variants. The indexed state
  is made, where the translator refused it. The indirect test no longer
  expects a patch index buffer's Gap::Draw.

The indexed calls take their two index buffers as one PatchIndexBuffers
(the patch index buffer, or none, and the control-point index buffer, each
with its offset), as the indexed primitive draws take an IndexBuffer.

Red: the runtime has no draw_indexed_patches, draw_indexed_patches_indirect,
PatchIndexBuffers or new refusal variants yet, so the tests do not build
(lavapipe, job named in the next commit).
2026-12-02 16:25:21 -08:00
Anees Iqbal 4a08c04013 Fixtures: tess_indexed_patches, a post-tessellation function's control points and patch index through index buffers
An owned engine fixture for drawIndexedPatches and patch index buffers. It
is a rasterization-disabled post-tessellation function: triangle patches of
three control points, each with one float attribute through a
PerPatchControlPoint layout. Patch pid of instance iid writes its three
control points' values and iid to slot (iid % 2) * 8 + pid % 8. So a
patch's slot names its patch index, and the slot's values name the elements
its control points read.

Regenerated by scripts/regen-air-fixtures on the Apple M3 Max (job
m3-max-80491; one fixture of 585, Apple metal 32023.922, macOS SDK 27.2).
The fixture README gives its row. Its inventory rows and air_input
printout are for the landing bless.
2026-12-02 16:25:21 -08:00
Anees Iqbal 30a7654ac5 CLI: --tessellation FILE sets a post-tessellation vertex function's tessellation state
The command built its render descriptor from separate options and set no
tessellation state, so a post-tessellation vertex function always compiled
under Metal's default state: no control-point index type, factor 16,
clockwise. A pipeline of another state, such as one whose control points
come through a UInt32 control-point index buffer, could not be compiled
from the command line.

--tessellation FILE reads the JSON form of TessellationDescriptor (it
derives serde already) into the descriptor's tessellation field. Without
it the descriptor has no tessellation state of its own, as before. A repro
bundle carries the file as tessellation.json, as it carries the stage-input
and vertex descriptors. The README's command-line section and --help name
it. The option lives in the command's binary, which the cli feature
builds.
2026-12-02 16:25:21 -08:00
Anees Iqbal a3fb852de3 rt: a heap makes texture buffers in place in its bytes
Metal's heap makes a texture buffer (MTLTextureTypeTextureBuffer): heapTextureSizeAndAlign
answers its texels' bytes at an alignment of 16, and newTextureWithDescriptor:offset: lays the
texels linearly in place at the offset (m3-max-80369, m3-max-80398). rt refused both with
Refusal::TextureBufferNotOverBuffer.

Now:
- Device::heap_texture_size_and_align of a texture buffer answers width x texel bytes, unrounded,
  at 16, or at the device's texel-buffer offset alignment for the format where that is larger
  (minimum_texture_buffer_alignment). No Vulkan call.
- Device::new_heap_texture and new_heap_texture_for_views of a texture buffer place a buffer of
  those bytes at the offset as new_heap_buffer places one, and make the texture buffer over it as
  Buffer::new_texture makes one, through the same texel_texture: one buffer view, one form on
  every device, no query. It takes the heap buffer's heap id and placement, so its uses are the
  heap's in the hazard sets and its writes mark the heap's aliasing textures stale.
- Its backing is TextureBacking::Texture, as Metal answers its buffer with nil.
- A placement past the heap or off the alignment is Refusal::HeapTexturePlace. A heap in an
  exported block makes one too: a buffer view needs no image.
- texel_texture's descriptor checks move to texel_shape and texel_width, shared with the size
  answer.

TextureBufferNotOverBuffer stays for new_texture, new_texture_for_views, new_managed_texture and
new_drawable_texture. The test also checks HeapTexturePlace at offset 8 and past the heap's end.

Docs: the runtime's README (textures, heaps, exported blocks), docs/API.md's heap-size accepted
difference, the refusals' docs; docs/REFUSALS.md regenerated.

Conformance ledger (docs/CONFORMANCE-COVERAGE.md regenerated):
- 22 rows of a one-level RGBA8Unorm, R8Unorm or RGBA16Float texture buffer's heap size in the
  texture-pairs cases are dropped: the replay now matches them;
- 6 rows of a texture buffer of 2 or 7 levels now record Refusal::TextureLevelCount, as
  Buffer::new_texture refuses it, where Metal's heap answers one level's footprint;
- 11 rows of RGBA16Float_XR, YCBCR8_420_2P, Unspecialized and BGRA4Unorm texture buffers' heap
  sizes now record Gap::TextureFormat;
- the device's newTextureWithDescriptor: rows keep TextureBufferNotOverBuffer, their reason
  naming the heap as the other way to make one.

Verified (the change at 6d5f748347 on 787fbbb061, then this commit rebased onto development
8a2f155883, the same change):
- red: the test fails at heap_texture_size_and_align on llvmpipe (job m3-max-80460) and on the
  RX 7900 XTX and the 780M (m3-max-80461);
- green: it passes on llvmpipe, whose 6 dispatches reach the buffers at their addresses
  (m3-max-80460), and on the RX 7900 XTX and the 780M, bound (m3-max-80461). Each device's
  texel-buffer alignment for R32Uint is 4, so all three answer 16 at 16;
- the conformance replay matches known-gaps-rt.tsv: llvmpipe, every case (m3-max-80487, and on
  this tree m3-max-80503); the RX 7900 XTX, the 8 cases the ledger edit touches (m3-max-80488);
  the conformance suite, 1047 passed (m3-max-80493);
- on this tree (m3-max-80502): signatures, refusals, both coverage checks, fmt, clippy plain,
  --cfg m2v_gpu and --cfg m2v_cpu_icd, rustdoc and private rustdoc, all 0; the runtime suite on
  llvmpipe 942 passed, 1 failed, 4 skipped. The failure,
  private_sinks::every_device_keeps_a_store_past_a_private_array_off_its_words, fails the same
  at development 8a2f155883 without this change (m3-max-80535) and passed at 787fbbb061 with it
  (m3-max-80462, 940 passed).
2026-12-02 16:25:21 -08:00
Anees Iqbal 4786da9503 rt test: a heap makes texture buffers in place at offsets 0, 16 and 4096 (red)
A guest's viewer asks heapTextureSizeAndAlignWithDescriptor: of a texture-buffer descriptor and
makes the texture in a heap. rt refuses both with Refusal::TextureBufferNotOverBuffer.

The test asks for what Metal does on an Apple M3 Max (m3-max-80369 and m3-max-80398):
- a 4-texel R32Uint texture buffer is sized 16 bytes at an alignment of 16;
- a Shared and a Private heap make it at offsets 0, 16 and 4096;
- it reads the bytes a buffer placed at the same offset wrote, because placement keeps a reused
  region's bytes;
- tb_atomic adds 3 to each texel, and the sums land in place, linear, in the heap's bytes, with
  the sentinels past them unchanged.

Red here: heap_texture_size_and_align refuses the descriptor.
2026-12-02 16:24:50 -08:00
Anees Iqbal 2e5503c0f7 Translator: a store moves into the ways of a branch only under a key that orders nothing
The sink (lower::access::quad::sink) ran on the specialized entry, before lockstep's order, on
every profile. Lockstep pairs only accesses that reach each other on one path, so a store moved
into each way of a branch whose lanes diverge lost its pairs with the other way's accesses:
under a key that orders lanes (the resident-table domains), a pair the program has, which
lockstep would have ordered, went unordered. The sink now runs on the ordered entry, and only
under a key that orders nothing (OrderKey::orders_nothing, the identity domains, which order no
pair and so lose none); under a key that orders, the store stays in its block. Under the
identity domains the same stores move; the order, which inserts nothing there, now finds the
pairs behind its SimdgroupAccessOrder note in the program as written.

engine_store_quad's descriptor-profile test now asks for sst_split's seven word stores there.

Verified: the test fails before this change, on moltenvk-m3 with seven stores where six are
expected (filtered, 3 tests), and passes after (filtered, 47 tests), with clippy clean
(m3-max-80575). Under the identity domains the change moves the same stores: the row_tail module
is byte-identical before and after it on the committed rtx50, lavapipe, 780M and Iris Xe profiles
(m3-max-80635). At the branch's last commit: clippy in all three configurations, rustdoc, the
runtime's suite on lavapipe (942 passed, 4 skipped), the translator's (3412 passed, 37 skipped,
the tables a bless is due for left out), validation's (1319 passed, 3 skipped) and
conformance's (1047 passed) (m3-max-80665).
2026-12-02 16:24:50 -08:00
Anees Iqbal 862b698c22 Translator docs: a bound range ends at the buffer's length, not at a multiple of 16
memory::views said every bound range is a whole number of 16-byte units, and lower::access::quad
leaned on it for the 16-byte store through a robust view. A range is its bind offset plus the
buffer's length, rounded up only to robustStorageBufferAccessSizeAlignment (at most 4), so a
16-byte unit can straddle its end, and Vulkan lets a device drop the whole unit there. Such a unit
holds bytes past the end of the Metal buffer, which only a program that accesses past its
buffer's end reaches, and Metal does not define that; for every other unit the old reasoning
holds. Both docs now say so. No code changes.
2026-12-02 16:24:50 -08:00
Anees Iqbal 647825639e Translator test: a store before a divergent branch stays where lockstep orders lanes (red)
sst_lanes, written by hand: thread g stores g + 1 at word 4g of out, then branches on its index
in its simdgroup. The lanes below 16 store zero at the next three words, so the store before the
branch begins four at consecutive words in that way, and read word 4g + 64, which lane t + 16
stored before the branch. Under a key that orders lanes, lockstep pairs the store with that read
and orders the two; moved into each way of the branch, the copy in the other way reaches the read
on no path and the pair is lost. The test asks, on the descriptor profiles, for the AIR's six
stores in the ordered entry beside an inserted barrier, and under the identity domains, which
order nothing, for the store moved into both ways (seven) and no barrier.

Red: the sink runs before lockstep's order on every profile, so the descriptor profiles' entries
hold seven stores.
2026-12-02 16:24:50 -08:00
Anees Iqbal 71aa9829d0 Validation cases: Metal's answer for a row of floats written four at a time with its tail guarded
Four authored cases over engine/split_store_tail, 16 threads at two a row over 8 rows, out
filled with 0xCD: sst_split at rows of 7, 6 and 5 floats (each row's second thread writes
three, two or one float after its first) and sst_block at rows of 7 (the four in one block,
nothing where the row does not hold them). A row starts at 4w bytes times its index, so the
first word of a run of four sits at every residue of 16 across the rows. Installed with
corpus-case-check (m3-max-80423) and qualified on Metal on the Apple M3 Max, three executions
each (m3-max-80428). Each Metal output equals the MSL's stores computed on the CPU, byte for
byte (output sha256 d875b981, 2f994d06, 1a84d360, 21ceb16b).

scripts/qualify-public-cases now runs the four on lavapipe against those rows. At the branch's
last commit their Vulkan runs match Metal on lavapipe (m3-max-80560), the AMD Radeon RX 7900 XTX
(m3-max-80568) and the AMD Radeon 780M (m3-max-80570). Not run on an Intel card.
2026-12-02 16:24:50 -08:00
Anees Iqbal 8e2fc13cfe Translator: four word stores of one block at consecutive words are one 16-byte store where aligned
A row of floats written four at a time from a float4, with its tail guarded, stores the first
float in one block and the other three in the block its branch takes when the row holds them.
Each store was its own word store. Now the specialized entry moves such a block's last store
into both successors of its branch, where one of them opens with the three stores after it
(`lower::access::quad::sink`). Selection then finds, in one block, four plain word stores at
byte offsets k, k+4, k+8 and k+12 from one base with nothing between them that touches memory,
all reaching one slot (`quad::plan`). The last of them emits the four; the others emit nothing.

At emit each invocation tests the first word's offset: where it is a multiple of 16 and the 16
bytes pass the slot's containment check, the four words are one uvec4 store (through the slot's
uvec4 view where the kernel binds its buffers, at the device address with Aligned 16
elsewhere); otherwise the four word stores run as selected, each checked by itself. At a device
address the 16 bytes are checked in the shader, so a store that straddles the buffer's end keeps
every in-range byte. One form on every device: the memory decides only where the store goes, as
for every other access. Under the descriptor profiles, where lockstep orders lanes, a barrier it
puts between the stores keeps them words.

engine_word_phases's alignment test now allows the two tested 16-byte stores of vwp_words's
two runs of four word stores. SEMANTICS_VERSION 2322 (development holds 2321): the SPIR-V of
such kernels changed.

Verified: engine_store_quad, engine_word_phases and the access tests pass on the interpreter
in both forms at bind offsets 0, 4, 8 and 12 (m3-max-80331, m3-max-80352); clippy in all three
configurations, rustdoc, the runtime's suite on lavapipe (937 passed, 3 skipped) and the
translator's (3404 passed, 37 skipped, the tables a bless is due for left out) at the change
(m3-max-80386).

Timed with the harness's row_tail workloads, the harness commit against this change, the arms
alternated in one job per card; GPU time, the median of the rounds' medians:
- NVIDIA GeForce RTX 3090 (m3-max-80449, 4 rounds): the Shared rows fell from 46.3 to 2.12 ms
  (224 floats a row), from 52.4 to 3.29 ms (49) and from 24.8 to 19.4 ms (27,730, bimodal in
  both arms); the Private rows took 0.2 to 0.4% longer.
- AMD Radeon RX 7900 XTX (m3-max-80450, 4 rounds): every row within 1.1% of the base.
- AMD Radeon 780M (m3-max-80482, 8 rounds): the times fall in two clock states, the change's
  runs in the slower one in 5 of 8 rounds and the base's in 2 to 4; within a state the change
  takes 0.973 to 1.014 of the base's time.
Not run on an Intel card. Those jobs ran an earlier build of this change on an older
development; its row_tail module equals the one at this branch's last commit byte for byte on
the committed rtx50, lavapipe, 780M and Iris Xe profiles (m3-max-80707, m3-max-80705).
2026-12-02 16:24:50 -08:00
Anees Iqbal 3e2bf11a5c Translator test: four word stores of one block are one 16-byte store where their offset is a multiple of 16 (red)
engine_store_quad compiles split_store_tail's two kernels on every committed profile under the
identity domains, each with its kernel buffers at their device addresses and, where the profile
binds them, bound. It asks for one 4-lane store into buffer memory beside the word stores of the
other arm and the kernel's other ways, the uvec4 view of `out` where the buffers are bound, and,
on the interpreter at bind offsets 0, 4, 8 and 12 with rows of 5 to 8 floats, every word of
`out` as the MSL stores it. A second test holds the descriptor profiles: where lockstep puts a
barrier between the stores none joins.

Red before the change: `out` has one view, not two, and no 4-lane store (m3-max-80271).
2026-12-02 16:24:49 -08:00
Anees Iqbal cfc69949a4 Harness: row_tail workloads, rows of floats written four at a time with the tail guarded
row_tail writes a row of `shape.x` floats four at a time from a float4: the first float, then
the next three where the row holds them, else the next two, else the next one. Six workloads
run it: rows of 224 floats (every row 16-byte aligned), 27,730 (every other row) and 49 (one
row in four), each into a Shared buffer over about 381,000 threads and into a Private one over
16 times as many. Each checks the whole output against its CPU reference. They time the store
shape the translator's next change merges.

Companions regenerated by scripts/regen-air-fixtures --dir harness on the M3 (m3-max-80294).
2026-12-02 16:24:49 -08:00
Anees Iqbal 2005dae350 Fixtures: split_store_tail, a row of floats written four at a time with its tail guarded
Our own MSL of the shape a guest kernel writes its output in: thread gid reads in[gid] (a float4)
and writes its lanes to a float buffer at element row * w + col, col = (gid % d) * 4. sst_split
stores the first lane in one block and the other three in the block its branch takes where
col | 3 is inside the row (else the next two, else the next one); sst_block stores the four in
one block. Apple's compiler keeps the four scalar stores, at add i32 %i, 1 / 2 / 3, zext to i64.
The element's byte offset is a multiple of 16 only where w is.

Companions from scripts/regen-air-fixtures (job m3-max-80214 on the M3: Metal 32023.922, SDK
27.2). The engine inventory gets its four rows, written as ok on every profile, and the golden
printout under tests/air_input comes from bless_engine_goldens on the M3 (m3-max-80509); the
golden hashes are left to the bless on development.
2026-12-02 16:24:49 -08:00
Anees Iqbal 6a922c4ea2 CI: every nextest suite runs to its end (--no-fail-fast)
At da37e9e5df's macOS leg (run 46984549568) the validation suite stopped at its first failure,
with 831 of its 1326 tests not run; the failure before it had hidden that one for a whole cycle in
the same way. Every nextest step of both legs now passes --no-fail-fast: the three suites
(metal2vulkan and its sibling crates, validation, conformance) and, on Linux, the device tests
lavapipe-image runs in the image (its nextest command takes nextest's arguments after the
filters). A red step stays red; only how much runs after the first red changes. The CI replica
reads ci.yml, so it runs the same way.

Verified: the replica job named on the ready line runs these steps.
2026-12-02 16:24:22 -08:00
Anees Iqbal 0fe4e38198 validation: an engine run answers a case's Metal qualification gap before the host's gate
The CI's macOS leg at da37e9e5df (run 46984549568) failed
check::admission::tests::a_metal_row_from_an_earlier_oracle_needs_metal_qualification: on macOS
engine::execute returned Failed("Vulkan candidate execution is not available on macOS") where the
test expects NeedsMetal(OracleAbi). execute_prepared called validate_host before it read the
case's Metal observation, so on macOS the host's refusal hid the admission's device-free answer.
Whether a case needs Metal qualification does not depend on the host.

Now execute_prepared reads the Metal observation (MetalObservation::current, from the case's Metal
shard alone, no device) first and refuses the host after it, before the device half. A run on
Linux is unchanged: the gate passes there. The order of every other refusal is unchanged.

The same order decides the_engine_candidate_is_admitted_whatever_its_loops (the same file; it
expects NeedsMetal(Missing) on both devices), which never ran on macOS: nextest stopped at the
first failure. No other test reaches validate_host: engine::execute's callers are those two tests
and corpus-vulkan's candidate_common; the device worker's tests start the worker directly.

Verified: on Linux in the jobs named on the ready line. On macOS expected from the code reading,
not run; the remote macOS leg is the run.
2026-12-02 16:24:22 -08:00
Anees Iqbal f1689ad668 conformance: a ledger row lists each answer its venue's hosts give, where they part by what the venue does not state
The CI's ubuntu leg at da37e9e5df (run 46984549568) failed its conformance replay: on an x86-64
AVX-512 runner, llvmpipe of Mesa 26.2.4 and LLVM 23.1.1 gave five sites the counts the ledger keyed
to AVX2 hosts, where the AVX-512 runners of runs 46969176610 and 46974578786, in the same image,
gave the AVX-512 rows' counts. The count follows a property of the host finer than its widest
vector set, which the venue does not state, so no venue key separates the two.

Ruled by the planner: for those five sites only, the llvmpipe row accepts the set of counts
recorded there, each named with the run it came from; any other count on those sites, and any
difference on any other site, still fails. The venue string carries no new property.

Now:
- known_gaps: a row's answer field may list more than one answer, with ` | ` between them
  (ANSWER_SEPARATOR). KnownGap::answers lists them; the row covers each and no other, in both
  directions: a run holding any of them holds the row, a third answer is a new gap and reads the
  row as no longer held, and a site that no longer diverges reads it as fixed. A row of one answer
  is compared as before.
- known-gaps-rt.tsv: the AVX2 and AVX-512 rows of each site become one llvmpipe row:
  - fetch-ordered-bgra8unorm-srgb and fetch-ordered-rgba8unorm-srgb at case/x3 and case/x3-depth:
    6304 or 6496 elements (U8), the largest difference 2;
  - blend-interaction-format-srgb8 at case/blended/one-one-subtract: 81 or 78 elements (U8), the
    largest difference 3.
  Each row's gap names the runs of each count, from the commits that wrote the rows and CI's runs:
  6304 by the lavapipe legs of m3-max-55331 to 55337 (x3) and m3-max-55569 to 55574 (x3-depth),
  m3-max-56427 (LLVM 23.1.1) and CI run 46984549568; 6496 by m3-max-56238 and m3-max-56342
  (LLVM 23.1.4) and CI runs 46969176610 and 46974578786 (LLVM 23.1.1); 81 by m3-max-50686 and
  m3-max-56427 (LLVM 23.1.1), m3-max-63645 (LLVM 23.1.4) and CI run 46984549568; 78 by
  m3-max-56238 and m3-max-56342 (LLVM 23.1.4) and CI runs 46969176610 and 46974578786. The venue
  is llvmpipe, as the same cases' x1 and x2 rows are, so the lab's LLVM 23.1.4 hosts, which gave
  the same counts, stay covered.
- Docs: the ledger's header, the conformance README and known_gaps's module doc describe the form;
  Venue::host's doc and the README no longer say a CPU venue's answers follow its vector set.
  CONFORMANCE-COVERAGE.md regenerated (5 ledger rows fewer).

Verified: coverage.py --check, refusal_surface.py --check and metal-coverage --check pass here;
the red test, the CI replica and the lint are in the jobs named on the ready line.
2026-12-02 16:24:22 -08:00
Anees Iqbal dc6ab2fda7 conformance test: a ledger row of two answers covers either and no third (red)
The CI's ubuntu leg at da37e9e5df (run 46984549568) failed its conformance replay on an x86-64
AVX-512 runner, llvmpipe of Mesa 26.2.4 and LLVM 23.1.1: five sites gave the counts
known-gaps-rt.tsv records under the AVX2 venue (6304 elements at the x3 and x3-depth sites of
fetch-ordered-bgra8unorm-srgb and fetch-ordered-rgba8unorm-srgb, 81 at blend-interaction-format-
srgb8's one-one-subtract), where runs 46969176610 and 46974578786, on AVX-512 runners of the same
image, gave the AVX-512 rows' 6496 and 78. The property that decides the count is finer than the
host's widest vector set the venue states, and a row holds one answer.

The test: a row of the ledger's own format listing two answers with ` | ` between them covers a
run that answers either; a third answer is a new gap and reads the row as no longer held; a run
that no longer diverges reads it as fixed; a row of one answer covers that answer alone, as
before.

Red here: the ledger compares the whole answer field, so neither answer of the two-answer row
matches it.
2026-12-02 16:23:52 -08:00
Anees Iqbal b12d57dc98 Tables: golden hashes at semantics 2321, for the array-field sink
The bless for pin I at 5e0d5fb6ea, run on the M3 Max (job m3-max-80645): bless_engine_inventory,
bless_golden_hashes and bless_engine_goldens each exited 0, and the metallib half of
committed_air_fixtures_parse_and_link ran unskipped (linkhalf=0). Only golden_hashes.tsv moves:
40 rows, the run-time indexes into array fields that now go to the private sink rather than the
last element (511f31b0ba). Generated by the bless tests; no hand edits.
2026-12-02 15:44:39 -08:00
Anees Iqbal 5e0d5fb6ea Docs: the array-field bound's lowering doc and the parked-handles test say the sink, not a clamp
The two doc lines 511f31b0ba missed: memory::provenance's array_bound and
engine_parked_handles' compile test still said each run-time index into the
array field is clamped. Lowering sends such an access to the private sink
where an index is past its array. Doc text only; cargo fmt.
2026-12-02 15:19:29 -08:00
Anees Iqbal 511f31b0ba Translator: an index past an array field's array sends its private-arena access to the sink, not onto the last element
a992aa6929 bounded a GEP into an array field of a thread variable to its
array, so a struct holding handles beside a run-time-indexed array closes
as a forwarding cell. In the private arena it held every run to that bound
by clamping each run-time index to the array's last element. A store past
the array then landed on the array's own last word. The runtime's
private_sinks contract wants such a store kept off every word a thread
reads, as a store past a private array is. On lavapipe at development
8a2f155883 (job m3-max-80535),
every_device_keeps_a_store_past_a_private_array_off_its_words failed: the
fold over the arrays moved by about 193,700, which is b[k]'s store of
t + 200000 over b[N - 1]. The same test at 8a2f155883 with a992aa6929
reverted (scratch tree, job m3-max-80554) is the cause check.

The bound only promises that no run reaches outside the variable; where an
out-of-range index lands is undefined in MSL. So the GEP's offset is now
the sink's, 2^32 - 1, where any run-time index is above its array's last
element: ULessThanEqual per index, LogicalAnd across them, and one select.
No arena holds that offset, so the access's existing containment check
makes it a zero load or no store, as an access past a private array is,
off the array's words and every other's. The forwarding analysis keeps
relying on the in-field assumption alone (memory::provenance, unchanged).
parked_heap_handles' run-time-indexed array fields stay bounded and the
struct still closes (access.private.gep.array, 3 uses).

docs/API.md's accepted difference says it: a read past the end of an array
field reads zero and a write is dropped, in the private arena as in a
variable of its own. The local, provenance and parked-handles docs say the
same. The device-arena budget test's run-time-index shapes cost one
instruction more than the clamp (a compare and a select in place of a
UMin): bounds 14, 13 and 25. SEMANTICS_VERSION 2321 (development holds
2320).
2026-12-02 15:16:20 -08:00
Anees Iqbal 77ec1b3bb6 Tables: golden hashes at semantics 2320, and the parked-handle and tessellation fixtures' inventory rows and printouts
The bless for pin I at 8a2f155883, run on the M3 Max (job m3-max-80469): bless_engine_inventory,
bless_golden_hashes and bless_engine_goldens (llvm-as 21) each exited 0, and the metallib half of
committed_air_fixtures_parse_and_link ran unskipped on the fixtures' SDK (linkhalf=0).

- golden_hashes.tsv moves from semantics 2318 to 2320: the dead-type removal, the evaluation
  stage's output limit and the post-tessellation series.
- public_fixture_expectations_engine.tsv gains the seven new rows: parked_heap_handles,
  parked_heap_handles_read, _copied and _stepped, tess_primitive_ids,
  tess_primitive_ids_fragment and tess_draw_bases.
- air_input printouts for parked_heap_handles, tess_primitive_ids and tess_draw_bases.

Generated by the bless tests; no hand edits.
2026-12-02 15:08:39 -08:00
Anees Iqbal 8a2f155883 Fixtures: the post-tessellation draw-bases function moves to a fixture of its own, tess_draw_bases
engine/rvc_draw_bases.ll is the public source of four committed cases,
which check its hash. Regenerating it to add draw_bases_after_tessellation
(and under a newer metal) failed all four in
committed_public_cases_check (lavapipe's host, job m3-max-80338). The
fixture goes back to the AIR its cases check, and the function moves,
unchanged, to engine/tess_draw_bases, regenerated by
scripts/regen-air-fixtures on the Apple M3 Max (job m3-max-80403; one
fixture of 584 regenerated, Apple metal 32023.922, macOS SDK 27.2). The
fixture README gains its row and rvc_draw_bases's row is as before.

The translator test the_base_instance_after_tessellation_is_the_patch_input_or_the_push_lane
reads base_instance_after_tessellation from rvc_draw_bases and
draw_bases_after_tessellation from tess_draw_bases, and the runtime's
every_device_reads_a_patch_draw_s_base_instance_after_tessellation draws it
from there. The engine inventory's new row is tess_draw_bases's, in place
of rvc_draw_bases's draw_bases_after_tessellation, for the landing bless.
2026-12-02 14:41:35 -08:00
Anees Iqbal e93d7e6b1b Docs: a fragment's primitive id behind tessellation is the patch's position without a patch index buffer
The evaluation stage's varying carries Metal's patch index, which is the
patch's position in its draw only where no patch index buffer is bound. With
one, Metal's [[primitive_id]] stays the patch's position while its patch
index is the buffer's entry (an Apple M3 Max, job m3-max-80366), so the
docs now say which draws the varying's value is Metal's for, and that the
runtime records no patch draw through a patch index buffer
(DrawKind::PatchIndexBuffer stays refused). The translator module docs,
lower_inputs, the tessellation link module, docs/API.md and the runtime
README say so; no code changes.

Doc lines past 100 columns in stage_io/plan.rs, lower_inputs.rs, the
tessellation link module and the engine_device_arena and engine_draw_bases
tests are rewrapped, and the patch test's println is shortened under the
limit.
2026-12-02 14:41:35 -08:00