Commit Graph
10212 Commits
Author SHA1 Message Date
Anees Iqbal efb6f79cba Conformance ledger: the KosmicKrisp venue's blend rows say the blend is in the shader there
On the Apple M3 Max venue (KosmicKrisp, Mesa 26.3.1), 82 blend rows carried the other venues'
text: that metal2vulkan-runtime "leaves the blend to the device's fixed-function unit". These are
the 73 half-output-blends-* rows (1mdc-one, ba-1mba, bc-1mbc and the rest) and the 9 argb8-targets-*
rows.

KosmicKrisp has no fixed-function step there: it blends in the fragment shader itself.
kk_lower_fs_blend runs NIR's nir_lower_blend (kk_shader.c), and Metal compiles the result under
fast math. Each row now says so. Its answer, count and bound are unchanged, and so is its note,
device-color-conversion.

docs/CONFORMANCE-COVERAGE.md was regenerated with coverage.py and did not change.

The KosmicKrisp replay at this commit (Apple M3 Max, job 83202) reports 0 unexpected lines.
2026-12-03 03:14:44 -08:00
Anees Iqbal 5eeeb8d752 Conformance ledger: the KosmicKrisp venue's 30 held lines, each under its read cause
The Apple M3 Max venue (KosmicKrisp, Mesa 26.3.1) held 30 lines after its re-record, kept back
until their causes were read. Each now has a row whose text names that cause:

- a2c and a2one, 8 texel sites: KosmicKrisp computes alpha-to-coverage in the fragment shader with
  NIR's nir_lower_alpha_to_coverage (kk_shader.c, msl_nir_lower_common.c). The mask is Mesa's
  mapping, not Metal's. Note device-alpha-coverage.
- half-output-blends-r32f sa-1msa: KosmicKrisp blends in the fragment shader (kk_lower_fs_blend,
  nir_lower_blend), compiled under Metal's fast math, so the products round in Mesa's order.
  Note device-color-conversion.
- pixel-downscales frac/slot digests, 7 sites: ours, not the device's. The slot's pixel
  coordinate goes to the normalized sampler as coordinate over size (pixel-sampler-scaling). The
  norm control matches Metal on this venue.
- The venue's 11 downscale frac/slot head and tail rows, landed with the earlier re-record, now
  carry the same "ours" text in place of "the device's own answer".
- pixel-samplers rgba8 and rgba16f linear-mirror, slot and arg, 4 sites: ours, the same scaling
  under mirrored repeat. KosmicKrisp maps mirrored repeat to Metal's own mode, and norm and const
  give Metal's digest.
- texture-buffer-fill-groups, -fill-streams and -long-fills: KosmicKrisp's
  minTexelBufferOffsetAlignment of 16 (KK_MIN_TEXEL_BUFFER_ALIGNMENT) refuses the offset-4 texture
  buffer typed (Refusal::TextureBufferAlignment), before the fillTexture step.
- texture-fills-41: A1BGR5Unorm is not made on this venue.
- texture-fills-236: KosmicKrisp offers ASTC HDR, so the case reaches fillTexture (Unavailable).

Those five cases' every-venue rows split into llvmpipe, NVIDIA, RADV and Intel rows, since
KosmicKrisp answers otherwise there. In the split texture-fills-236 rows, "on any venue" now
reads "on this venue". docs/CONFORMANCE-COVERAGE.md is regenerated (coverage.py).

Answers taken from the KosmicKrisp replay of job m3-max-82902. The KosmicKrisp replay at this commit
(Apple M3 Max, job 83133) reports 0 unexpected lines. docs/CONFORMANCE-COVERAGE.md re-run with
coverage.py on development: unchanged.
2026-12-03 03:06:36 -08:00
Anees Iqbal 401d9d5949 Translator: an extended-range 3D texture's linear mip filter blends its two levels, under BicubicFilterArithmetic
A BGR10_XR or BGRA10_XR form's (or _sRGB twin's) 3D sample under a linear mip filter now blends
its two levels' 3D filters as a 2D sample blends its levels: the device's FMix at the clamped
level's f32 fraction, through a constexpr sampler and through a runtime sampler whose word states
the filter. It records PrecisionNote::BicubicFilterArithmetic, as every level blend does
(the runtime sampler's under its linear-mip clause). Metal's blend of a 3D texture's two levels
fits no rule tried; the XR mip probe (an Apple M3 Max on macOS 27.0.1) put the closest 284 of
8,192 samples apart. The note's doc and its catalogue line in docs/API.md now state this, with a
new measure committed as crates/metal2vulkan-conformance/probes/extended_linear_mip_blends.m (the
M3 Max, macOS 27.0.1, job m3-max-82944). At 16,384 lanes per form, filter (nearest, linear) and
shape, Metal's own two levels' samples blended by mix at the fraction truncated onto
sixty-fourths lie within 0.033 of Metal's 3D linear-mip sample of BGR10_XR, BGRA10_XR and their
twins, and within 0.031 of its 2D sample, the blend the module has shipped. The module blends at
the f32 fraction instead, which moves its blend by under 1/64 of the two levels' difference from
that rule.

The select_extended doc no longer lists a 3D texture's linear mip filter among the refusals.

Before this change:
- A constexpr sampler's linear mip filter on such a 3D texture was refused
  NotImplemented(Format).
- A runtime sampler's linear mip filter on one had no refusal at all. The emitted sample read the
  nearest level, and its comment named "the binder's refusal", which no binder or runtime code
  makes (ResourcePlanner::extended_sampler no longer exists).

The same gap holds for a 2D sample of a form whose levels' blend is not built (another XR form,
ExtendedRange::blends_levels false) through a runtime sampler that states a linear mip filter. That
case is left to the oracle measure that will build it.

Red test: tests/engine_extended_range/volumes.rs volume_linear_mip_filters_blend_two_levels
replaces volume_linear_mip_filters_and_padded_forms_are_refused. A constexpr linear mip filter
compiles, valid, with the note. On the CPU interpreter, a runtime sampler's linear-mip sample at
64 levels between two lies, on every lane, between the nearest mip filter's samples of those two
levels, and strictly between on some. A padded form's 3D sample stays refused. At the base, the
constexpr case is refused, and the runtime sampler's sample is one level's.

SEMANTICS_VERSION moves to the next number: a refusal is removed and a sample's words change.

Landed with SEMANTICS_VERSION 2338 (renumbered above development's) and runtime-sources.sha256 4361761c, recomputed on development.
2026-12-03 02:55:10 -08:00
Anees Iqbal 6191bf763d Translator: mode-2 fragment storage writes run: Metal's RGB9E5Float word, the device's half and RG11B10 rounding
Under TextureWriteRoundingMode::NearestEven (Apple's textureWriteRoundingMode 2) every fragment
storage write now runs; the refusal NotImplemented(PrivateRenderState(TextureWriteRounding)) and
the facts RuntimeFact::StorageTextureWriteRounding and HeapWriteRounding are deleted.

Measured first, by the probe committed here as
crates/metal2vulkan-conformance/probes/texture_write_rounding_storage.m (an Apple M3 Max under
macOS 27.0.1, jobs m3-max-82793 and m3-max-82824): a fragment function writes 65,536 texels of
float and of half texels into RGBA16Float, RG11B10Float and RGB9E5Float storage textures, once in
a pipeline of mode 0 and once of mode 2. Mode 0 rounds every channel toward zero. Mode 2 rounds
a half-float channel to nearest even, a value past the midpoint above 65504 to the infinity
(262,112 of 262,112 non-NaN channels); an RG11B10Float channel to nearest even, held at the largest
finite value (196,583 of 196,583, float and half texels alike); and an RGB9E5Float texel's
mantissas half up under the largest clamped channel's exponent, moved up where that mantissa
rounds to 512, which is Vulkan's own rule for the format (65,536 of 65,536 texels, float and half
alike). Every mode-2 code lies within one unit of mode 0's.

- RGB9E5Float: the word is the module's own arithmetic (texture::rgb9e5_word), so under mode 2 it
  is now Metal's mode-2 word exactly: the product times 2^(25 - e) converted toward zero keeps the
  half's bit, one added and a shift right round half up, and a largest mantissa of 512 moves the
  exponent up before every mantissa is rounded again. Write::half_up carries it to a
  SharedExponentBits slot's write (emit::to_image) and WordsPlan::half_up to the texture-buffer
  words' write routine. A kernel, tile or other function, a word attachment and the default mode
  keep the truncation.
- RG11B10Float, float and half texels: the device's conversion as at the default mode, recorded
  as PrecisionNote::DeviceColorConversion (unconditionally for a declared format, under
  small_float_storage's clauses for a formatless slot or a heap). A half-float channel's note for a
  float texel stays half_storage_facts's. The note's storage clause and its catalogue line in
  docs/API.md state the measured counts.

Red tests:
- lower/arith/tests/color_write.rs rgb9e5_words_are_metals_at_either_mode: the emitted word, run
  in the SPIR-V interpreter over the probe's 65,536 texels (probe_texels rebuilds them from the
  probe's SplitMix64; its input and half hashes are checked against the probe's), hashes (FNV-1a)
  to the texture Metal wrote, bit for bit, for float and half texels at either mode. It is red with
  the half-up arm disabled.
- tests/engine_link.rs mode_two_fragment_texture_writes_round_as_metal_or_the_device replaces
  mode_two_refuses_fragment_texture_writes_it_would_round. It draws over an RGBA32Float attachment,
  whose output records no note (the previous test's RGBA8Unorm attachment recorded
  DeviceColorConversion itself, which made the earlier commit's note check vacuous). Every case
  compiles and links valid at either mode. A declared R16G16B16A16 slot records
  DeviceColorConversion at both modes, a B10G11R11 slot under mode 2 alone, and an RGB9E5 word
  slot at neither. It is red with the product files at the base, which refuse.

Public surface: PrivateRenderField::TextureWriteRounding and the two RuntimeFact variants are
removed (api_signatures.tsv rows). The consumer's checkout at a20576e1fd has 0 hits for
PrivateRenderField, StorageTextureWriteRounding or HeapWriteRounding (git grep). The mechanism
test's variant indices move StencilBitDraws and RobustStorageBuffers into the two freed places.
docs/REFUSALS.md is regenerated.

Not in scope, a follow-up: a texture buffer of half-float or RG11B10Float held as words
(texel_buffer_form) converts by the module's own toward-zero routine, recorded under the same note.

SEMANTICS_VERSION (refusal removed, notes and words under mode 2) and ARTIFACT_FORMAT_VERSION (two
RuntimeFact variants removed from the codec) each move to the next number.

runtime-sources.sha256 re-pinned (4361761c): the edited translator sources are runtime inputs.

Landed with SEMANTICS_VERSION 2337 (renumbered above development's) and runtime-sources.sha256 4361761c, recomputed on development.
2026-12-03 02:55:10 -08:00
Anees Iqbal a03b74c95c Translator: a fragment float write to a half-float or RG11B10Float storage texture under mode 2 is the device's conversion
Under TextureWriteRoundingMode::NearestEven (Apple's textureWriteRoundingMode 2), a fragment
function's float texel written to a storage texture whose slot declares a half-float or
RG11B10Float format was refused NotImplemented(PrivateRenderState(TextureWriteRounding)). It now
runs with the device's conversion, as at the default mode, and records
PrecisionNote::DeviceColorConversion: Metal's mode 2 rounds such a channel to nearest even
(RG11B10Float held at the largest finite value), the device's store toward zero on every measured
driver. The half-float note comes from half_storage_facts, which every float write runs; the
RG11B10Float note from mode_rounded_write, under the clauses of small_float_storage (unconditional
for a declared format, by the bound format for a formatless slot, by the heap's small-float family
for a heap element). The note's storage clause in artifact.rs and its catalogue line in docs/API.md
state the mode-2 case.

The writes whose mode-2 rounding was not measured keep the refusal: a float texel into
RGB9E5Float, and a half texel into RG11B10Float or RGB9E5Float. RuntimeFact::
StorageTextureWriteRounding and HeapWriteRounding stay for a slot whose bound texture decides and a
heap handle, their docs narrowed to those cases; their field `halves` (a float texel, which also
refused half-float textures) is renamed `float`, since a half-float texture no longer refuses
(api_signatures.tsv's two variant rows follow). The consumer's checkout at a20576e1fd has 0 hits
for StorageTextureWriteRounding or HeapWriteRounding (git grep).

Fixed with it: a slot declaring RGB9E5Float through its word alias (R32_UINT,
StorageImageClass::SharedExponentBits, the choice every profile makes for the format) was not
seen as a mode-2 target at all, so under NearestEven it compiled with the default's word, no
refusal and no mode recorded. It now records the mode and is refused under NearestEven, as a
declared E5B9G9R9_UFLOAT_PACK32 was.

SEMANTICS_VERSION 2333 -> 2334: a refusal class changes (mode-2 storage writes), and a fragment
stage writing an RGB9E5Float word slot now records the mode in StageIo.

Red test: engine_link's mode_two_refuses_fragment_texture_writes_it_would_round gains a
SharedExponentBits case (refused under mode 2) and expects the declared R16G16B16A16_SFLOAT and
B10G11R11_UFLOAT_PACK32 cases to compile under mode 2 with DeviceColorConversion, no fact, and to
link valid.

runtime-sources.sha256 re-pinned (2ac17122): lower/texture/mod.rs and the other edited sources
are runtime inputs.

Landed with SEMANTICS_VERSION 2336 (renumbered above development's) and runtime-sources.sha256 2ac17122, recomputed on development.
2026-12-03 02:55:02 -08:00
Anees Iqbal 965e707277 Conformance ledger: the Apple M3 Max venue (KosmicKrisp) re-recorded, but the sites still to be read
The M3's conformance replay on KosmicKrisp (Mesa 26.3.1) at 6989666062 (job m3-max-82902; the
product of development's 13c6ba8a91, which adds one rt test change) printed 269 lines the ledger
did not expect. The venue had 14 rows; every other row it held was another venue's or every
venue's. This commit records what is mechanical and leaves the rest as it is.

- 197 rows added at sites another venue already lists: 158 with that venue's answer, 39 with the
  same answer but for its numbers. Each takes that venue's gap text, except 18 whose text named
  another device:
  - 6 indirect-range cases: KosmicKrisp does not list VK_EXT_device_generated_commands;
  - 11 pixel-downscales frac sites: the device's sampler, within the 2/255 recorded on lavapipe;
  - 1 half-tanh site: the other venue's first-element values are dropped.
- 14 every-venue rows (astc-*-hdr zero-blocks/texture) split into llvmpipe, NVIDIA, RADV and Intel
  rows. KosmicKrisp makes ASTC HDR textures (textureCompressionASTC_HDR in kk_physical_device.c),
  so the M3 now matches Metal there.
- 1 M3 row removed: discard-quad-sum-placement hoisted_known/pipeline, which the venue now reads as
  lacking the feature.
- 15 rows added for refusals no venue listed, each from a device query:
  - 10 surface-textures cases: KosmicKrisp exports no dma-buf, opaque fd or Win32 memory;
  - 2 lines and facing draws: no fillModeNonSolid;
  - 3 A1BGR5Unorm textures (fresh-pattern-41, extended-swizzles-a1bgr5unorm,
    texture-round-trip-41): not made for the usage.
- 6 bicubic-texel-classes M3 rows: the answer is the one the 780M, RX 550, RTX 5080, RX 7900 XTX
  and Iris Xe rows record. The M3 answers it since the Converted half pair is decorated
  NoContraction (699f1167d6).

Left as they are, to be read first (30 lines):
- alpha-to-coverage texels: a2c-* and a2one-*, 8;
- pixel-downscales frac digests, 7;
- pixel-samplers linear-mirror sites, 4;
- texture-buffer fills refused off KosmicKrisp's 16-byte texture-buffer alignment, with
  texture-fills-41 and -236 (5), plus the 5 every-venue rows they no longer hold;
- half-output-blends-r32f sa-1msa, 1.

docs/CONFORMANCE-COVERAGE.md regenerated (scripts/conformance-coverage/coverage.py).
Verified: the edit is derived from that replay's lines; the conformance suite and a replay on the
M3 with this ledger are in the READY note.
2026-12-03 02:50:42 -08:00
Anees Iqbal edb02c7f38 Translator: SEMANTICS_VERSION 2335 for texture-buffer slots declared without a format
Rebased onto development 13c6ba8a91, where 699f1167d6 (a Converted half rounding's conversion
pair decorated NoContraction) took 2334. The previous commit's own bump, 2333 to 2334, is
upstream's line now, so the rebase left it out; this change, a refusal that becomes a module
(Unsupported{IdentityDomains} for a texture buffer's slot without a format), takes 2335.

The previous commit's jobs ran at 1db43f3bd8, the same change on development 22861fde72 under
2334: red m3-max-82957, Iris Xe m3-max-82971, UHD 630 m3-max-82977, Linux gate m3-max-82968,
golden diff m3-max-83023. This tip's own gate and UHD 630 leg are named in the lane's report.
2026-12-03 02:50:42 -08:00
Anees Iqbal 1ae0e3c302 Translator: under the identity domains a texture-buffer storage slot is declared without a format
Under the identity domains no input names a storage slot's bound format. storage_format declared
a slot without a format only where shaderStorageImage{Read,Write}WithoutFormat grant its
accesses, or where the formats' own bits grant its read (reads_by_format_bits: the neutral
R32_SFLOAT and every read-write tier format's view carry STORAGE_READ_WITHOUT_FORMAT), and
refused anything else as Unsupported{IdentityDomains}, not implemented, with no symbol. Intel's
Windows driver 101.2145 on the UHD 630 lacks shaderStorageImageReadWithoutFormat and lists
neither WITHOUT_FORMAT bit in any format's buffer features (vulkaninfo there, jobs m3-max-82912
and m3-max-82917), so every function with an access::read_write texture buffer at a slot was
refused at the make: tb_word_formats for all 15 formats of
every_device_reads_and_writes_texture_buffers_of_formats_held_as_words (job m3-max-82853, pin Q
aed8b7eba3). The refusal is the own-view arm's declaration and took the words twin with it,
though that device holds every format with a word layout as words, which the twin reaches through
the R32ui words array and no formatless access.

A texture buffer's slot is now declared without a format wherever the profile reads and writes
storage so at all (texel_buffer_without_format: DeviceProfile::accesses_without_format, the
features, or Vulkan 1.3 or VK_KHR_format_feature_flags2, which enable the SPIR-V capabilities
StorageImageReadWithoutFormat and StorageImageWriteWithoutFormat). Vulkan asks the format's bits
of each view an access reaches (VUID-vkCmdDispatch-OpTypeImage-07029, -07030), and the runtime
already answers that per texture buffer at the draw or dispatch from the slot's interface
(declared_format false): an own view whose buffer features lack the access's bit is
Gap::StorageElement, a texture buffer held as words reads and writes true (texel_form). A nil
texture at the slot reads a null descriptor, which is no view: the floor's nullDescriptor
(runtime README, Floor, Features: `nullDescriptor`, VkPhysicalDeviceRobustness2FeaturesEXT; the
floor also requires Vulkan 1.3, its first line). Decided by the profile's Vulkan answers alone.
Images keep reads_by_format_bits; its texture buffer arm goes, as the new rule takes every
profile it took.

The refusal narrows from every state over such a function to the bindings the runtime README
already records: on a device whose buffer features lack STORAGE_READ_WITHOUT_FORMAT for a format
held as its own view, a read of that format's texture buffer through access::read_write at a
slot is refused at the draw or dispatch. The README's paragraph now says that the slot's
declaration is made on every device and the refusal is the dispatch's, per texture buffer, that
a nil texture there reads the floor's null descriptor, and that the UHD 630 reads and writes its
word formats through access::read_write; the refusal list's no-symbol item is now a storage
texture's alone, not a texture buffer's.

SEMANTICS_VERSION 2334 (development held 2333): a refusal becomes a module. No RUNTIME_VERSION
bump: a run of an unchanged artifact does nothing else. runtime-sources.sha256 is unchanged:
neither lower/texture/slot.rs nor cache/mod.rs is a runtime input (validation's build.rs list),
and the guard test passed at this tree (below). docs/REFUSALS.md does not move: storage_format
stays an IdentityDomains site (refusal_surface.py --check passed below).

Verified at 1db43f3bd8, a commit of this same tree (tree 569677eeac) on a try branch:
- red: the test before this one (849c883ab3), job m3-max-82957: refused as
  "unsupported: IdentityDomains; needs NotImplemented", the UHD 630's text;
- Intel Iris Xe (RPL-P, Mesa 26.2.6), job m3-max-82971: the runtime's texture buffer tests
  (--cfg m2v_gpu, filter test(texture_buffer)), 11 run, 11 passed; its word formats every answer
  the CPU's, and B5G6R5Unorm, BGR5A1Unorm and BGR10A2Unorm (own views) refused read_write by name;
- Intel UHD 630 (Windows driver 101.2145, validation layer 1.4.363.0), job m3-max-82977 (the
  win-cross build m3-max-82970): the runtime's whole suite, 984 run: 983 passed, 1 failed, 4 skipped;
  every_device_reads_and_writes_texture_buffers_of_formats_held_as_words passed (it asserts the
  words twin ran once per dispatch where the format is held as words, all 15 formats there), as
  did one_path's the_scan_reads_the_translators_product_sources_alone and
  the_product_sources_take_one_path_for_every_device. The one failure,
  half_simd_reductions' every_device_sums_and_multiplies_half_simdgroups_as_metal, failed the
  same way at pin Q (job m3-max-82853) and is outside this change;
- the Linux gate, job m3-max-82968: cargo fmt --check, signatures --check,
  refusal_surface.py --check, clippy -D warnings (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd) and
  rustdoc all clean; the translator's and AIR suites 3457 run: 3456 passed, 1 failed, 22 skipped; the
  runtime guard (the_runtime_sources_are_the_committed_ones) passed. The one failure is
  golden_hashes_match_the_table, a bless due under 2334 (job m3-max-83023): exactly two cells
  changed, both refusals that became modules on the runtime-floor profile,
  engine/a8r_buffers.ll a8r_buffer_read_write and engine/tb_word_formats.ll tb_word_formats,
  Unsupported{IdentityDomains; NotImplemented} to modules; the .air.ll rows need macOS's metal-as
  and were not compared. The table is re-blessed on development.
2026-12-03 02:50:42 -08:00
Anees Iqbal aa51aeb7f4 Translator test: a read-written texture buffer slot is formatless where no buffer format reads so (red)
On the UHD 630 under Intel's Windows driver 101.2145 (job m3-max-82853, pin Q aed8b7eba3) the
runtime test every_device_reads_and_writes_texture_buffers_of_formats_held_as_words made no
pipeline of tb_word_formats for any of its 15 formats: Unsupported{IdentityDomains}, not
implemented, with no symbol. That device lacks shaderStorageImageReadWithoutFormat and lists
neither STORAGE_READ_WITHOUT_FORMAT nor STORAGE_WRITE_WITHOUT_FORMAT in any format's buffer
features (vulkaninfo there, jobs m3-max-82912 and m3-max-82917), so storage_format refuses the
kernel's access::read_write texture buffer slot under the identity domains: the slot's read is
granted neither by the feature nor by the neutral R32_SFLOAT's buffer read bit
(reads_by_format_bits). The refusal takes the whole make, the words twin with it, though every
format the test reads is held as words there and reached through the R32ui words array.

This test builds that device's answers device-free: the Iris Xe's profile
(intel-irisxe-rplp-anv, which lacks the feature too) with both bits cleared from every format's
buffer features. It asserts that tb_word_formats compiles under the identity domains and passes
L3, requires the StorageImageReadWithoutFormat capability and not the feature, plans the words'
routines, and states its written and read-written texture buffer slots as storage slots without
a declared format. Expected red until the fix: the compile is refused as IdentityDomains.
2026-12-03 02:50:42 -08:00
Anees Iqbal 0959445d39 Bless at pin R: the golden hash table and the authored compile census
The golden hash table moves 399 rows and its semantics line goes to 2334:
the Converted half rounding's NoContraction pair (699f1167d6) changes the
module wherever that form is emitted. 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-83055; the first bless job, 82992, gave the same 400-line change, but
its workspace was released before its patch was read).

The authored compile census recompiled every cell: 2369 cases, 9 profiles,
21,321 cells, 0 cached; 19,106 compiled, 2,215 refused, 0 failed,
0 differences, 0 regressions (census job m3-max-82993). Only its
artifacts_at product fingerprint line moves.
2026-12-03 02:46:11 -08:00
Anees Iqbal 13c6ba8a91 Tests: the half rounding test names its partition's element type
7d9aa2207f's partition left its element type to inference, which rustc could not settle
(E0282, job m3-max-82776). It is now the conversion triple's reference. Test only.
2026-12-03 02:10:26 -08:00
Anees Iqbal 7d9aa2207f Tests: the half rounding test holds the rounding's pair to NoContraction, apart from the store's narrowing
converted_half_rounding_is_the_exactly_rounded_half (red two commits back) asserted that every
OpFConvert in its kernel is decorated NoContraction in both forms. Its kernel also stores the half
result, and that store's narrowing to bits (narrow::to_bits) is no pair: it is decorated under the
float controls alone, which a_half_encode_is_the_devices_narrowing_in_every_form holds and the fix
keeps. So the assertion also failed at the fix, on the store's narrowing ("round Converted:
[Allowed, Allowed, Allowed]" before the fix, job m3-max-82752).

The test now finds the pair by structure (a narrowing of an f32 to 16 bits and a widening of its
result back to 32 bits), asserts both are NoContraction in both forms, and asserts every other
conversion takes its form's decoration: NoContraction under the float controls, none in
Converted. Test only; no translation output changes.
2026-12-03 02:10:22 -08:00
Anees Iqbal 699f1167d6 Translator: a Converted half rounding's conversion pair is decorated NoContraction, as the Controlled one is
A `half` rounding in `QuantizeForm::Converted` (a profile with shaderFloat16 whose float
controls do not make the conversion Metal's) was an undecorated OpFConvert to 16 bits and
its widening. Vulkan assumes AllowTransform on every operation not decorated
NoContraction ("Precision and Operation of SPIR-V Instructions"), and Mesa's NIR folds
`~f2f32(f2f16(a))` into `a` wherever the instruction is not exact (nir_opt_algebraic.py;
vtn marks NoContraction exact), so the value went on unrounded. On KosmicKrisp (Mesa
26.3.1, Apple M3 Max) that broke half_simd_reductions: each round of the half tree kept
float precision, and 224 of 256 words differed from Metal's (job m3-max-82540, pin P's
leg). The MSL KosmicKrisp emits showed no half() between rounds; with the pair decorated,
0 words differ (job m3-max-82662).

`narrow::converted` now emits each conversion with `convert_no_contraction`, as
`narrow::controlled` does. The pair relies on Vulkan's environment rule, which reaches a
conversion, where the SPIR-V specification words NoContraction for an arithmetic
instruction only; the docs state that reliance at the Controlled pair's (narrow.rs), on
QuantizeForm::Converted, and in docs/API.md's native-half-conversion entry, and that a
driver which folds a decorated pair leaves the device's own answer, within
PrecisionNote::NativeHalfConversion, which a Converted module already records. NVIDIA's
measured fold of the decorated Controlled pair stays as recorded. SEMANTICS_VERSION 2333
-> 2334: every Converted module's words change (moltenvk-m3 is the committed profile on
that form; KosmicKrisp takes it at run time).

Evidence, all on the arms of this change before the ruling:
- KosmicKrisp conformance replay on the Apple M3 Max: 53 sites that differed from Metal
  at the base now match, none added (job m3-max-82685).
- Cost: +0.46% host wall on half_mix on the M3 under KosmicKrisp, job 82685, three
  alternated rounds of 200, spread 0.03%.
- Golden tables: 216 moltenvk-m3 cells change, no other profile's (job m3-max-82679).
  They re-bless at the next named pin.

The red test (the commit before) asserts both forms' conversions are NoContraction;
it fails before this change and passes with it (the gate's jobs are in the READY note).
2026-12-03 02:10:22 -08:00
Anees Iqbal 720753ca9d Tests: a Converted half rounding's conversion pair is decorated NoContraction, as the Controlled one is (red)
The Converted form (shaderFloat16 without the 16-bit float controls) rounds an f32 to half by an
OpFConvert to 16 bits and its widening, undecorated. Vulkan assumes AllowTransform on an
operation not decorated NoContraction, and Mesa's NIR folds the widening of a narrowing under it
(nir_opt_algebraic.py, Mesa 26.3.1, line 1271: ~f2f32(f2f(a)) -> f2f32(a), then x2xN(a@N) -> a).
So on every Mesa driver on a Converted profile the value is never rounded. On the Apple M3 Max
under KosmicKrisp (Mesa 26.3.1), the runtime's half_simd_reductions device test read the f32 sum
rounded once at the store in 224 of 256 words, not Metal's tree of rounded halves (0x3c10 for
Metal's 0x3c0f on the first sum; job m3-max-82540). The MSL KosmicKrisp emits for that kernel has
no half conversion between the tree's rounds (MESA_KK_DEBUG=msl, m3-max-82662).

converted_half_rounding_is_the_exactly_rounded_half now asserts that both forms' conversions are
NoContraction. It fails on the Converted form until the next commit decorates the pair.

Verified: cargo fmt only. The red run is the next commit's base arm.
2026-12-03 02:10:22 -08:00
Anees Iqbal 22861fde72 rt test: rule 2's scan labels each source with / on every host
The scan labelled each product source by Path::display, which joins its
components with `\` on Windows. The labels the tests name and the allowances
key on are written with `/`, so on the UHD 630 under Windows (job
m3-max-82853, at aed8b7eba3) the_scan_reads_the_translators_product_sources_alone
found no "metal2vulkan/src/device/description.rs". And
the_product_sources_take_one_path_for_every_device reported allowed lines,
such as "metal2vulkan/src/ash_interop\convert.rs:36 DriverId", as findings.
The label now joins the path's components with `/`. Test-only:
runtime-sources.sha256 is unchanged (recomputed: 3ec63863).
2026-12-03 01:47:02 -08:00
Anees Iqbal cd356da852 Docs: a state's precision notes are recorded at its creation, never announced at a draw
Rule 1 fixes a precision note per operation and never decides it at run
time. metal2vulkan-runtime follows that: each state carries its stages'
whole precision_notes from its creation (pipeline.rs, render.rs) and
reads no specialized note at a draw or dispatch (0 hits for
specialized_notes or precision_notes_bound in its sources). Its README
says the same ("fixed at creation and never decided at dispatch").
Several translator docs said otherwise:

- Ten said the runtime announces or reads a note at a draw or dispatch that binds
  a texture, or only while a sampler state of pixel coordinates lives:
  pipeline/artifact.rs (DeviceNanEncoding, ArgumentPixelSamplerScaling),
  lower/sampler/select.rs (three), lower/texture/heap_raw.rs,
  lower/texture/mod.rs (four, stored_where's "the runtime reads ... at
  each draw or dispatch" among them). They now say the note holds under the
  bound value and is among the stage's notes, which the runtime records
  whole at the state's creation.
- Two named announcements with no runtime code: artifact.rs's
  `non-strict-residency` and facts.rs's PlanDiagnostic::CrossClassHeapNeutral
  ("which the runtime announces"; the runtime reads no PlanDiagnostic).
  Both claims go.

The same class beyond those eleven, so the docs agree with README.md
(the caller announces a note; the runtime records it): metal/state.rs
named an announcement `unorm-depth-bias`, which no code has (the render
encoder's note is PrecisionNote::DeviceDepthBias); artifact.rs's
SrgbTexelDecode said the runtime reads the bound format at a draw;
"the runtime announces" becomes "records" at artifact.rs (three),
compile/numbered.rs,
link/band.rs, the runtime README (DevicePackConversion) and validation's
c3.rs; three test docs drop the run-time claim (engine_spec_bits,
engine_sampler, engine_cross_class); validation's coverage.rs said an
executed module's notes are its bound ones (precision_notes_bound),
where every executor records the state's whole notes; and the runtime's
translator_fields row says "records".

Comments and docs only. metal/state.rs is a runtime input, so
runtime-sources.sha256 takes the inputs' new hash; no run changes.

Verified: rustfmt --check on every .rs file changed; the job named in
the handover.
2026-12-03 01:35:27 -08:00
Anees Iqbal 333ae1b40f Translator: PrecisionNote::code states each note's stable degrade code
A precision note's stable code, `metal2vulkan-degrade-` and the note's
name in kebab case, was written only in the conformance crate
(degradation.rs), which is unpublished. So no published item gave a
caller the code to announce a note by, and README.md said the runtime
announces each note once with a stable code, which it does not: the
runtime records each state's notes when the state is made, exposes them
through its getters, and prints and sends none (docs/API.md section 9
says so).

- PrecisionNote::code (pipeline/artifact.rs) returns the code, one arm a
  note, as docs/API.md's catalogue names it.
- The conformance crate reads it from there: Degradation::code is its
  note's code, through Degradation::note, the inverse of
  from_precision_note. Each kind's doc names its note, not a second copy
  of the string.
- README.md's "Recorded differences" says what is true: the runtime
  records each state's notes at creation and exposes them with a stable
  code; the caller announces them. docs/API.md's catalogue lead names
  PrecisionNote::code.
- The signature table takes the method under both crates that export
  PrecisionNote.

The 83 codes are unchanged: each equals the conformance crate's string
before this commit (checked by script against its code() table), and
every_kind_is_a_catalogued_precision_note still finds each in the
catalogue. New tests: every_precision_note_code_is_its_name_in_kebab_case
(translator, serde feature: every variant read from the enum's source,
its code the kebab rule, no code twice) and every_kind_is_its_notes_kind
(conformance: note() takes from_precision_note back for every kind).
No translation, runtime or refusal changes; no runtime input changes, so
runtime-sources.sha256 stays.

Verified: rustfmt --check on the four .rs files; the job named in the
handover.
2026-12-03 01:35:25 -08:00
Anees Iqbal aed8b7eba3 Bless at pin Q: the golden hash table and the authored compile census
The golden hash table moves 16 rows. The profile fingerprint moved at
a4491c1436 and the translator changed since pin P. 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-82822).

The authored compile census recompiled every cell: 2369 cases, 9 profiles,
21,321 cells, 0 cached. 19,106 compiled, 2,215 refused, 0 failed, 0
regressions, and 6 new cases blessed (census job m3-max-82823, 97.6 s wall).
Its slowest compile was 1.67 s and its largest worker 232 MiB RSS, inside
the 20 s and 500 MiB ceilings.

The first bless and census jobs (82767, 82768) lost their compiles when the
build cache's daemon died: the daemon belongs to the job that starts it and
went with that job when it ended. Nothing in this tree changed between
those jobs and the reruns.
2026-12-03 01:34:29 -08:00
Anees Iqbal e79864f16f Runtime README: the fenced span's measured length on the M3 Max, the 780M and the Iris Xe
What: the known gap of memory blocks (a texture in place over host memory's import) states how long
a RestoreFence holds its span: from before returning to after being called. In microseconds, the
median of 16 fenced makes and then the largest, without the validation layer:
- 1920x1080 BGRA8Unorm: Apple M3 Max (KosmicKrisp 26.3.1) 455 and 645; Radeon 780M (RADV PHOENIX,
  Mesa 26.2.6) 603 and 877; Iris Xe (ANV, Mesa 26.2.6) 3267 and 3504.
- 16x4 RGBA8Unorm: 328 and 396; 120 and 169; 507 and 934.
It also says the span holds the whole submission that carries the restore.

Why: the consumer picks its fence from these numbers.

Verified: printed by the new test (host_in_place's
each_device_fences_a_host_writer_around_the_restore_alone) at 7bc3d18e4e, with
METAL2VULKAN_TEST_UNVALIDATED=1, in jobs m3-max-82721 (M3 Max), m3-max-82720 (780M Phoenix) and
m3-max-82734 (Iris Xe). Under the validation layer, in the same jobs, the 1080p numbers were 478
and 591, 1240 and 1972, and 3731 and 3993; the 16x4 numbers were 350 and 444, 209 and 825, and
793 and 1411. Docs only.
2026-12-03 01:06:30 -08:00
Anees Iqbal 1ee4cd95d5 Runtime: the caller's RestoreFence is called around a restoring make's save, move and write-back
What: Device::texture takes the fence that Buffer::new_texture_fenced and
Buffer::new_texture_in_place_fenced pass. On a restored make alone (in place over host memory's
import, Keep::Restore), after the refusals ahead of the restore, the make runs on its own thread:
it waits for the progress already submitted (Work::progress), calls the fence's before, adds the
image's move home to the upload (Work::home), flushes, waits for that value, and calls after.
before comes ahead of home and not just ahead of flush because a commit from another thread can
carry the upload out as soon as the move is in it (take_uploads). after is called from a drop
guard (Fenced), so it runs on every exit once before returned Ok: the make done, Quiesced from
home, a lost device in the wait, or a panic unwinding. A before that answers Err(reason) refuses
the make with Refusal::RestoreFenceRefused { reason }. Then nothing is recorded, saved, moved or
written back, the texture made so far is dropped, nothing counts, and after is not called: before
undoes its own work, and after always pairs with a before that returned Ok. Every other make, and
every make with no fence, takes the match's other arm, so an unused seam costs one branch. The
make itself is unchanged.

Public shape: a trait object (&mut dyn RestoreFence, before -> Result<(), &'static str> and after)
on two new twins, not an Option argument on new_texture and new_texture_in_place. This tree has
about 90 four-argument calls of those two, and the consumer's development has 6, of which 2 need
the fence; the twins leave every other call unchanged. A &mut trait object lets before keep a guard
or a token in the fence for after to release. The reason is &'static str so that the refusal stays
Copy, as Refusal is.

Docs: the runtime README (Imported blocks, "The caller's fence"; the known gap of memory blocks;
the API list) states the contract. Between before and after the runtime saves, moves and writes
back the block's bytes, so a host write to them in that span is lost; the span holds the whole
submission that carries the upload, a group's included. A caller with such a writer fences it
there; one without passes nothing. Vulkan documents no form that keeps the bytes without the
write-back (sections 12.10.1 and 7.7.6: an acquire keeps bytes only after the other owner's
release; section 11.2.6: host-pointer memory is shared with the host under host access
synchronization). The rustdoc of the trait, the twins, the refusal and Buffer::new_texture says
Metal has no such span. Refusal::InScheduledHandler's doc names the twins. docs/REFUSALS.md is
regenerated (RestoreFenceRefused, one site). Not touched: RUNTIME_VERSION and runtime-sources.sha256,
whose inputs are the translator's listed files (metal2vulkan/src, metal2vulkan-air/src); this change
edits none of them.

Verified, red: at 4e941d8015 (the fence passed nowhere) the new test failed on lavapipe (llvmpipe,
LLVM 23.1.1, Mesa 26.2.4), job m3-max-82710. With no fence, 632 of 86,252 stamped words were lost.
With the unwired fence, 7,507 of 98,879 were lost, 0 writes found the gate held, and before and
after ran 0 times. Green runs and the gate follow in the lane's report.
2026-12-03 01:06:30 -08:00
Anees Iqbal 5c9d6c19a4 Runtime: RestoreFenceRefused's basis arm, and the seam's rows in the signatures table (red, fixed forward)
6b8b3af925 added Refusal::RestoreFenceRefused without regenerating error/basis.rs, so the runtime
did not compile (non-exhaustive match in Refusal::basis; job m3-max-82706, lavapipe). basis.rs is
regenerated by scripts/refusal-surface/refusal_surface.py from the variant's Basis line. The
signatures table takes the five new public items and the new variant
(scripts/api-signatures/signatures.py --bless). No behaviour changes: the fenced twins still drop
the fence, so the red test stays red.
2026-12-03 01:06:30 -08:00
Anees Iqbal 7034d61636 Runtime test: a host writer keeps its writes across a restoring make only behind the caller's fence (red)
What: the runtime's public seam on its one make that saves and writes back a buffer's bytes, a
texture in place over host memory's import on an integrated or CPU device. RestoreFence (before,
which may refuse with a reason, and after), Buffer::new_texture_fenced and
Buffer::new_texture_in_place_fenced, and Refusal::RestoreFenceRefused { reason }. In this commit
the twins take the fence and Device::texture drops it: neither method is called.

The test, host_in_place's each_device_fences_a_host_writer_around_the_restore_alone, puts a host
writer on a 1920x1080 BGRA8Unorm frame over its own import. The writer stamps one word every 64
bytes, one a microsecond, each through a mutex gate, starting before the make and stopping after
it returns. With no fence (new_texture, up to four makes) some stamped words hold their old bytes:
the write-back reverted writes that landed between the save and the write-back. With a fence whose
before takes the gate and whose after gives it back, the writer must find the gate held at least
once and lose no word. The fence runs once each way. The restore pair (OverCause::HostMemoryRestore)
is the same as the unfenced make's, and every word not stamped holds the bytes written before the
make. A before that refuses ("unsettled") must give RestoreFenceRefused with that reason, no after,
no copy and no texture counted. The in-place-alone twin runs the fence the same way. Sixteen fenced
makes each of 1080p BGRA8 and 16x4 RGBA8 print the span between before and after and the make's
time (median and largest). Off unified memory (a discrete or virtual device, or the two-copy view),
neither method runs, and the in-place-alone twin is refused as not in place.

At this commit the fenced arm fails: the writer loses words behind the fence, and before never
runs. Red runs are named in the next commit's message.
2026-12-03 01:06:29 -08:00
Anees Iqbal 096742809b Runtime docs: a restored make's upload goes in the next submission, its own or a group's
What: the runtime README (Imported blocks, and the known gap of memory blocks), the rustdoc of
Buffer::new_texture, Metrics::over_copies_host_memory_restore and the make's comment said that a
texture in place over host memory's import has its restore (save, move, write-back) go "alone, in
a submission of the runtime's own". They now say what the code does: the make seals the upload
and flushes it (Work::flush), and the submit thread's next submission carries it. Where no
queue's group goes at that turn, that is a submission of the runtime's own (submit.rs, the flush
branch after the group loop); otherwise a group's close takes it (WorkState::close calls
take_uploads, which takes every flushed upload), and submit() puts it ahead of the group's
command buffers, in the first part where the group goes member by member. The make waits for that
submission's value, so it waits for those command buffers too.

Why: the consumer reads these sections to decide how to fence its host writers around the make;
"alone" told it the span holds nothing of its own.

Verified: read against submit.rs (Work::flush, WorkState::flush, WorkState::close, take_uploads,
submit, parts). Docs and comments only; no code changes.
2026-12-03 01:06:29 -08:00
Anees Iqbal a4491c1436 Translator: drop LeafCaps::zero_initialize_workgroup_memory and a dead anisotropy test
Two pieces of dead code go (rule 4).

LeafCaps::zero_initialize_workgroup_memory was set from the
shaderZeroInitializeWorkgroupMemory query in device::derive and read
nowhere. Lowering and the verifier read the enabled feature set instead
(lower/access/local.rs, spirv/verify/rules.rs), so no answer changes.
The field is not public: device::profile is pub(crate) and LeafCaps is
not re-exported. A git grep of the consumer's checkout at eadc8b4a0d
finds 0 hits for the field or LeafCaps.

The profile's fingerprint is a hash of the fields' Debug text, so every
profile's fingerprint moves with this commit. Cache keys miss once and
recompute; there is no false hit, so no SEMANTICS_VERSION bump. The
golden table goes stale by key alone and re-blesses at the next pin: at
this tree 28,860 cells (1,924 rows x 15 profiles) are "under a changed
profile", with 0 new, 0 gone, 0 under a changed fixture source and none
changed under an unchanged key. Stored observations name the field in
their environment/profile Debug text: 12 shard files, 55 lines (4 under
observations/refusals/vulkan, 8 under observations/vulkan). They are
left as stored; their text already differs from today's profile shape.

lower::sampler::anisotropic::select returns as soon as the profile has
samplerAnisotropy, so its later `if anisotropy && !reached` test could
never be true. It goes with its comment. Behaviour is unchanged on every
profile.

runtime-sources.sha256 takes the runtime inputs' new hash. derive.rs and
profile.rs are inputs, and this change alters no behaviour of a run.
The hash also covers two earlier comment-only edits to inputs that left
the guard red on development: b07b697aac (device/metal.rs) and
7be9f00a3f (device/policy.rs, device/profile.rs). Their .rs diffs change
comment lines alone. At 7be9f00a3f the guard test fails and names
5aa066e0..., against the pinned 36ba0695... (job m3-max-82683).

Verified on the CPU with no device:
- m3-max-82633, the gate at 2523fe20c6 (this change before the hash update):
  signatures, clippy (plain, m2v_gpu, m2v_cpu_icd), rustdoc and private
  rustdoc of metal2vulkan all exit 0; conformance 1051/1051; doctests 0.
  Product suites: 3734 of 3735 passed, 24 skipped; the failure was
  golden_hashes (stale, above). Validation: 1321 of 1322 passed, 3
  skipped; the failure was the runtime guard, which this hash fixes.
- m3-max-82683 at 413a1db3f9 (this tree): the runtime guard passes; golden_hashes is
  stale by profile key alone (above). With the four files at 7be9f00a3f:
  the guard fails (development's red), and golden_hashes passes (1,924
  rows x 15 profiles match).
- rustfmt --check on the three .rs files.
2026-12-03 00:50:00 -08:00
Anees Iqbal 16ce2c2070 Runtime README: KosmicKrisp's indirect patch draws of two instances name the three tests and their runs
The known gap said the runtime's two device tests of it "fail there". The bug is a race (the
driver's indirect tessellation grids are thread counts dispatched as threadgroup counts, so one
instance's extra vertex work overwrites the next instance's), and the tests' results on
KosmicKrisp vary by run:
- every_device_reads_a_patch_draw_s_base_instance_after_tessellation and
  every_device_reads_a_patch_s_position_as_its_primitive_id_under_a_patch_index_buffer failed in
  m3-max-81082 and passed in m3-max-81774 and m3-max-82540, with no change to patch.rs between
  those runs;
- every_device_reads_control_points_and_patch_indices_through_their_index_buffers (indirect,
  no index type, no patch index buffer) passed in m3-max-81774 and failed in m3-max-82540: the
  second instance's slots for positions 2 and 3 read 0, and slots for positions 5 and 6 read the
  first instance's id, 3. That is the first instance's vertex threads past its 3 patches writing
  positions 4 to 6 over the second instance's 3 vertex slots, with position 4 culled.
The bullet now says it is a race, that a draw can be right, what the failed draw showed, and the
runs of all three tests on the Apple M3 Max under KosmicKrisp (Mesa 26.3.1), plus the third
test's passes on RADV on the RX 7900 XTX (m3-max-82574) and the Radeon 780M (m3-max-82583) in
the same round.

Verified: docs only; the results are read from those jobs' logs. The driver's grids were read in
Mesa 26.3.1's kk_tessellation.cl (libkk_tess_setup_indirect) and kk_cmd_draw.c
(kk_dispatch_compute), not instrumented.
2026-12-03 00:32:38 -08:00
Anees Iqbal b3d7464945 Validation: a threadgroup target is checked nowhere, so its case is refused before it runs
What: executor_contract::out_of_bounds::containment() reports a threadgroup target as the arena
unchecked (Check::Unchecked), on every profile and under either domains. out_of_bounds_run then
refuses the case before anything is made, as not_supported{uncontained:unchecked threadgroup},
as it refuses a loaded pointer under the identity domains. The read rule's in-shader arm no
longer names the arena. The module docs, the Unchecked variant, ContainmentForm::Threadgroup,
the coverage note on which accesses the encodings govern, and docs/VALIDATION.md say so.
ENGINE_EXECUTOR_ABI moves to vulkan-engine-v214: the executor records a refusal for a case it
ran before.

Why: since 990328afe1 no profile checks a threadgroup access (lower::access::local::contained;
docs/API.md, "Threadgroup memory": one past the memory is undefined, as in Metal; the runtime
README states it too). The contract still reported the arena as checked in the shader, so the
candidate ran the only authored case with a threadgroup target, tg-twice (7efae163,
loads-and-stores-past-a-threadgroup-allocation), and read what the device held past the
allocation. On the Radeon 780M (RADV, Mesa 26.2.6) job m3-max-82582 ran it 10 times at
f606e43b30 and got 10 different output hashes: word 6, a load of tg[40], which no thread
writes, held a different value each run. The kernel's SimdgroupAccessOrder note made the failed
zero rule a NotedDifference. Vulkan does not define an access past a Workgroup array either, so
no part of that run is evidence.

What else moves: no other authored case declares a threadgroup target (all case shards
searched for "form":"threadgroup": one hit), so only tg-twice moves from noted_difference to a
refusal. The case, its AIR and its Metal row are unchanged. No classifier input changes
(executor_contract/out_of_bounds.rs, coverage.rs and case/out_of_bounds.rs are not in
build.rs's classifier list), and the authored compile census compiles the case as before
(case_compile reads no containment), so neither census version moves.

Verified: see the green job named with this commit's READY.
2026-12-03 00:30:04 -08:00
Anees Iqbal 576d9384ec Validation test: a threadgroup target is checked nowhere and its case is refused (red)
What: the out-of-bounds contract's tests now state what the product does with threadgroup
memory. threadgroup_memory_is_checked_nowhere_and_its_case_is_refused asks containment() for a
threadgroup target on every committed profile, under either domains: the arena unchecked
(arena:unchecked), read rule Any, and out_of_bounds_run refuses the run as
not_supported{uncontained:unchecked threadgroup}. The coverage test of the ob1 fixtures expects
ob1_threadgroup's compiled target to be arena:unchecked.

Why: since 990328afe1 no profile checks a threadgroup access (lower::access::local::contained;
docs/API.md, "Threadgroup memory": one past the memory is undefined, as in Metal), but
containment() still reports the arena checked in the shader, so the candidate runs the
tg-twice case (7efae163, loads-and-stores-past-a-threadgroup-allocation) and judges its reads
past the allocation by the zero rule. On the Radeon 780M (RADV, Mesa 26.2.6) job m3-max-82582
ran it 10 times at f606e43b30: 10 different output hashes, all NotedDifference. Words 0 to 3
equal Metal's; words 4, 5 and 7 are the values threads 4, 5 and 7 stored past the allocation;
word 6, the load of tg[40], which no thread writes, differs in every run (9a2e1730, 982ec630,
9a2e4632, ...). The kernel's SimdgroupAccessOrder note made the failed zero rule a
NotedDifference.

Verified: red expected; the job that runs these tests at this commit is named in the fix's
commit.
2026-12-03 00:30:04 -08:00
Anees Iqbal 7be9f00a3f Docs: only tests build the resident-table domains
The docs of DevicePolicy::RESIDENT_TABLES, PointerDomain::ResidentTable,
HandleDomain::Table, the lockstep module, docs/API.md and three test
comments said the resident form was the validation executor's alone and
that the executor builds the resident root and handle table itself, or
called it "the old runtime's, until the cutover deletes it". Neither is
true: the validation executor (engine.rs), the runtime, the command line
and the compile worker all build their device under
DevicePolicy::default(), and every RESIDENT_TABLES in the tree sits in a
test (the translator's src/tests and device tests, the validation
crate's #[cfg(test)] modules including coverage::tier_table, the
harness's tests and the validation integration tests).

The comments now say that: nothing outside tests builds the form, and
the runtime, the tools and the validation executor take the default.
Comments and docs only; no code changes.

Verified: git grep of RESIDENT_TABLES, PointerDomain::ResidentTable and
HandleDomain::Table at 8140229b9c, each hit outside the translator's own
tests read for its #[cfg(test)] scope; cargo fmt --all; the workspace
rustdoc check with -D warnings, doc 0 and private-items doc 0 on all seven crates (job
m3-max-82621).
2026-12-03 00:23:31 -08:00
Anees Iqbal 8140229b9c Docs: a new texture reads zero for a stated reason, and its cost stays counted
The runtime README called the zero clear of a new texture the runtime's choice. It now gives the
reasons the answer stands on: Metal leaves a new texture's contents undefined, programs read
textures they never wrote, an Apple M3 Max answered zero for new Shared and Managed textures, and
zero is the one answer that cannot show a program bytes something else left in the device's
memory. The clear is counted by Metrics::texture_clears and texture_clear_bytes. No behaviour
changes.

Verified: the paragraph reads as one, and no other doc states the old reason.
2026-12-03 00:17:20 -08:00
Anees Iqbal cb09012f99 rt test: capture's lists for a commit stay bounded when Managed buffers go uncommitted
capture::Changes holds two lists that wait for a commit, both of weak entries:
- the ranges that didModifyRange named, with their index by buffer;
- the bytes of each Managed buffer made since the last commit.
Each list drops the entries of buffers that are gone once it doubles, starting from SWEEP_FLOOR
(64) entries. Nothing tested that bound. A program that makes, names and drops Managed buffers
without committing would grow the lists without limit if the sweep broke.

every_device_bounds_what_managed_buffers_gone_left_for_a_commit makes, names and drops four times
SWEEP_FLOOR Managed buffers, each with its bytes, and commits nothing. With a device copy, each
list and the index fill to the floor and never hold more. With one copy, nothing is listed. The
test reaches the lists through two accessors that exist only for the device tests
(Changes::entries, Work::changes). SWEEP_FLOOR becomes pub(crate) so the test can name it.

Verified in job m3-max-82584, at a commit with the same tree (c3ea874a68):
- with both sweeps disabled in a probe copy of capture.rs, on lavapipe in its two-copy view:
  "after 65 Managed buffers gone, [named, indexed, made] are [65, 65, 65], past 64", red;
- as committed, on lavapipe: one copy [0, 0, 0], two copies [64, 64, 64] at most, green;
- the RTX 5080 Laptop (two copies), under --cfg m2v_gpu: [64, 64, 64] at most, green;
- managed.rs's 37 tests on lavapipe, green;
- signatures, clippy plain, m2v_gpu and m2v_cpu_icd, doc and privdoc, all 0.
2026-12-03 00:13:19 -08:00
Anees Iqbal b07b697aac Docs: the M3's and the 5300M's supportsTextureSampleCount: answers cite their jobs
The translator's TEXTURE_SAMPLE_COUNTS comment and the conformance sample-position family's module
doc stated the Apple M3 Max's answer for 8 samples with no measurement behind it. Job 82550 asked
an Apple M3 Max under macOS 27.0.1: yes for 1, 2 and 4, no for 3, 5, 8, 16 and 32. Job 82204 asked
an AMD Radeon Pro 5300M under macOS 26.7.1: yes for 1, 2, 4 and 8, no for 16. Both comments now
cite them. Comments only; the recorded EIGHT_NEVER_RE_RECORD text, which the 8x recordings carry,
is unchanged.

Verified: both jobs' SAMPLES and P8 lines read from their logs; cargo fmt --all leaves the tree
unchanged.
2026-12-03 00:12:44 -08:00
Anees Iqbal 0912a69508 rt test: rule 2's scan reads the translator's product sources, and the identity spellings it missed
the_product_sources_take_one_path_for_every_device (rt's tests::one_path) enforces rule 2: product
code names no vendor, device or driver identity, reads no environment variable and declares no
policy type. Until now it read only the runtime's sources and missed several spellings. It now
reads the translator's two crates too, and it catches:
- driver_version, conformance_version, the device, driver and pipeline-cache UUIDs and
  PhysicalDeviceIDProperties;
- ash's device_name_as_c_str, driver_name_as_c_str and driver_info_as_c_str accessors, and
  vk::VendorId;
- the vendor IDs written in decimal;
- getenv;
- the device type, which rule 2 lets decide unified memory alone.

The translator's tests are left out: its tests directories, its tests.rs and *_tests.rs files, the
modules it declares under #[cfg(test)], and its inline #[cfg(test)] modules. A test checks that
exclusion.

The lines the scan may find something on are listed in ALLOWED, by file and text, each with its
reason:
- the device type where unified memory is decided;
- the stage cache's key;
- the translator's DeviceDescription and its two readers;
- DevicePolicy;
- Vulkan's driver enum, mirrored;
- the environment variables' registry;
- the command line's device file;
- three table and grammar numbers that equal a vendor's ID.
A listed line that no longer holds a finding fails the test, so the list cannot go stale. The
module docs say what a scan cannot see: a policy switch spelled as a bool field, a constant or a
cfg(feature) gate, and code after a // inside a string literal.

from_queries_derives_one_profile_whatever_the_identity now also varies the device's name and the
driver's version, and the profile stays the same.

Verified on the CPU with no device, in job m3-max-82544. Probe files were put beside the product
sources; no module declares them, so they were never compiled. They hold one line of each new
form (nine in the runtime's src, one in the translator's):
- the scan at a0d2d2efdd passes over them, which is the gap;
- this change's scan fails, naming all ten lines;
- without the probes, the four one_path tests and the identity test pass;
- the runtime's and the translator's suites: 3091 passed, 22 skipped.
Gate A ran in job m3-max-82570 at a commit of this tree (0339453fe7): signatures, clippy plain,
m2v_gpu and m2v_cpu_icd, doc and privdoc, and the one_path tests again after the one clippy fix
(an explicit auto-deref).
2026-12-03 00:05:10 -08:00
Anees Iqbal c3d37b4fd3 Runtime: a commit looks up only the Managed buffers with a device copy its encoders named
Changes::take used to look up, at every commit, each buffer the command buffer keeps and the
buffer under each texture it keeps, in the hash map of the Managed ranges named. Only a Managed
buffer with a device copy can have a range named, so every other lookup was wasted. The command
buffer now lists those buffers as its encoders keep each object for the first time
(ByKind::managed): a buffer kept by a slot, a declaration, a blit or any other way, and the buffer
under a texture kept. The take visits only that list. The list is cleared with the recording's
other lists, keeps its room up to KEPT_BOUND, and holds at most one entry for each buffer and
texture kept. Lending a buffer for a slot learns whether the buffer is new from the same set
insert it already made (Kept::keep_first). The commit order and the rule for which commit takes a
range do not change.

Red: the previous commit's test fails at 52d871017b, its parent, on lavapipe (llvmpipe, LLVM
23.1.1; job m3-max-82510). In the one-copy form the commit looks up 7 buffers where none is
wanted. An earlier run, m3-max-82505, failed on the test's own setup, since fixed.

Verified, before the re-lay onto development, at the same change on 1a84985dd4:
- lavapipe (job m3-max-82510): the test passes in both forms (the two-copy view); the runtime's
  whole suite reads 976 passed, 4 skipped; clippy plain, --cfg m2v_gpu and --cfg m2v_cpu_icd exit
  0; Rustdoc and the runtime's private-items Rustdoc exit 0.
- RX 7900 XTX, RADV of Mesa 26.2.6 (job m3-max-82512): the runtime's 36 Managed tests pass under
  --cfg m2v_gpu, among them the first-naming test that guards the frame-396 crash fix.

Counted, on the RX 7900 XTX (job m3-max-82512): one whole glbench-3090-r4 play per arm, 1,050
frames, release players, with a diagnostic (never landed) counting the user-space instructions of
the take at each of the 24,883 commits:
- before (development plus the diagnostic): 34,299 instructions a commit, 812,822 a frame;
- after: 5,301 a commit, 125,635 a frame. That is 687,188 fewer a frame, 84.5% of the take.
- The committing thread retired about 850 million user-space instructions a frame in both arms,
  so the take was 0.096% of them before and 0.015% after.
- Runtime command buffers (20,195), upload barriers (35,025), barriers (522,991), submissions
  (24,886), passes, bytes copied (432,472,763) and Managed bytes captured (7,215,718,372) are
  equal in both arms.
Lavapipe keeps one copy of a Managed buffer, so no range is named there and the take does no
lookup; the count was read on the XTX alone.
2026-12-02 23:58:07 -08:00
Anees Iqbal ed307c3e1e Runtime test: a commit looks up only the Managed buffers with a device copy it names (red)
At every commit, Changes::take looks up each buffer the command buffer keeps, and the buffer under
each texture it keeps, in the hash map of the Managed ranges named. That walk came with the
first-naming rule (51ac48c788). On a recorded play on an RTX 3090 it cost 35,453 user-space
instructions per commit, about 840,000 per frame, on the committing thread (job m3-max-82470, a
diagnostic build). It visits every Shared buffer and texture of the command buffer, though only a
Managed buffer with a device copy can have a range named.

The walk now sits in capture::Names::addresses, which the take uses, so a test can read what a
commit would look up (CommandBuffer::capture_lookups, test-only). The test's command buffer
dispatches over a Managed buffer and two Shared ones, and copies out of a texture over another
Managed buffer and out of one over a Shared buffer. The test expects the commit to look up the two
Managed buffers, once each, where the device keeps a copy, and nothing where it keeps one. Today
it also looks up the Shared buffers and the Shared texture's buffer, so it fails in both forms.
No behaviour changes.

Red runs follow in the next commit's message.
2026-12-02 23:58:06 -08:00
Anees Iqbal 08b4bf6020 Translator: SEMANTICS_VERSION 2333 for an unknown runtime-library routine refused as its family
4a96499072 refuses a surviving call to an unmodeled body-less ___metal_* routine as
UnknownIntrinsic, and a __tensorops_impl_* function in air.externally_defined outside the
matmul2d ABI as Tensors, where both were refused as Linking. A refusal's class is part of the
semantics key, so a cached FALLBACK of such a kernel names the wrong class under an unchanged key.
The golden tables are re-blessed on development.

Verified: the one line changed; 4a96499072's own checks are in its body (m3-max-82525,
m3-max-82527).
2026-12-02 23:57:47 -08:00
Anees Iqbal 4a96499072 Translator: an unknown runtime-library routine is refused as its family, and AGENTS.md allows the families
AGENTS.md's name rule now also allows the body-less runtime-library routines Metal's compiler
links by symbol: the ___metal_* maths routines and the __tensorops_impl_* family. Their
declarations have no body, so the symbol is the only thing that says what the routine is. An
unknown member of such a family is a typed refusal.

Both families were already gated on that structure. The bitcode reader classifies a routine
name only on a declaration, and the matmul2d lowering takes a __tensorops_impl_matmul2d_op_*
function only when it has no body and is in air.externally_defined. Two tests now show that a
defined function of either name is the module's own:
- a_defined_function_named_as_a_runtime_routine_is_the_modules_own (bitcode, through llvm-as);
- a_defined_function_named_as_a_tensor_op_is_the_modules_own (canon).
Both tests pass at the base as well.

An unknown member used to be refused as Linking, the refusal for an undefined function that
linking could supply, which these never are. Now the post-check refuses a surviving call to a
body-less declaration as its family:
- an unmodeled ___metal_* routine as an unknown intrinsic, the same refusal an unknown air.* name
  gets;
- a __tensorops_impl_* function in air.externally_defined, outside the matmul2d ABI, as Tensors,
  which is how the matmul2d lowering already refuses its own unmodeled functions.
The same name outside that section is not a family member, and still needs linking.
intrinsics::is_routine_family and tensor_ops::in_family state the two families. docs/REFUSALS.md
lists the new Tensors site.

Verified on the CPU with no device, in job m3-max-82525 at a commit of the same tree
(4974c671a8):
- an_unknown_runtime_library_routine_is_refused_as_its_family is red with this change's product
  files at a0d2d2efdd (___metal_ldexp_float: Linking, expected UnknownIntrinsic) and green with
  them;
- the two look-alike tests and surviving_calls_are_refused_by_family_naming_the_callee pass in
  both runs;
- the refusal surface regenerates to these files exactly, and its --check passes;
- the metal2vulkan-air and metal2vulkan suites: 3455 passed, 22 skipped.
2026-12-02 23:56:01 -08:00
Anees Iqbal a0d2d2efdd rt: a failed wake of the completion thread is owed to the next wake, and a failed host wait is made again
vkSignalSemaphore fails only for want of memory or with VK_ERROR_UNKNOWN,
never with a loss. The wake ignored the failure and marked the thread woken,
under a comment that said a failure is a loss. The thread stayed in its GPU
wait with nothing to end it, and every later flight-only wake returned early,
because the thread already waited for the progress semaphore. With work in
flight, a listener or an end then waited for the front batch to complete.
That is a deadlock where that batch waits on a host signal the listener
would give.

The form (the planner's ruling, which withdrew its "next wait is bounded"
form, a record the wait in progress cannot read):
- A failed signal leaves the wake owed. The thread stays marked waiting on
  the GPU, and the next wake from any thread signals again at a higher
  value, flight-only wakes included. The thread clears the debt as it next
  reads the state.
- There is no polling: tests/event_values.rs's thread-does-not-spin
  assertion holds as before.
- The limit, stated in the code: a failed wake that no later wake follows
  waits for the wait's other semaphores.

vkWaitSemaphores (the dma-bufs import's bind wait before vkDestroyBuffer)
and vkDeviceWaitIdle ignored every failure under a comment that named loss
alone. Both now go through complete::wait_through:
- success, a loss the call reports, or a loss the runtime has seen ends the
  wait;
- an out-of-memory or unknown result, which says nothing of what is
  pending, is called again 100 ms (LOSS_POLL) later.
So a lasting out-of-memory result on a live device waits, and no buffer
whose bind may still be pending is destroyed. On a lost device,
vkDeviceWaitIdle returns success or VK_ERROR_DEVICE_LOST in finite time
(Lost Device), so a teardown does not spin on a dead device.

The two tests of the previous commit, failed_waits.rs, turn green here
through the same seams (fail_wakes, fail_waits).
2026-12-02 23:36:31 -08:00
Anees Iqbal ed23a06f5f rt test: a failed wake and a failed idle wait, red before their fix
Two device tests through two test seams on Core, in fail_begins' style:
fail_wakes fails the completion thread's next wakes as vkSignalSemaphore out of
host memory, and fail_waits fails the device's next idle waits before the
driver is called. Each seam is wired into today's path unchanged: the wake
still ignores the failure and marks the thread woken, and the idle wait still
returns.

- a_failed_wake_is_owed_to_the_next_wake: a fill is in flight behind the Busy
  gate, a listener is posted at a value the host already set, and its wake
  fails. The test expects a second fill's commit, a flight-only wake, to
  deliver the owed wake while the gate still holds both fills. Today that
  wake returns early, so the listener waits for the gate.
- a_failed_idle_wait_is_made_again: a fill is in flight behind the gate and
  the idle wait's first call fails. The test expects the idle wait not to
  return while the gate holds the fill. Today it returns at once.

Both are expected to fail at this commit. The next commit is the fix.
2026-12-02 23:36:31 -08:00
Anees Iqbal f606e43b30 Tests: re-bless the golden tables at pin P
The engine inventory, the golden hash table and the air_input printouts, re-blessed at
1a84985dd4 on the M3 (potluck job m3-max-82483: inventory=0, golden=0, printouts=0, and the
metallib half of committed_air_fixtures_parse_and_link un-skipped, linkhalf=0). The texture
buffer words, sRGB draw writes and mul24 work since the last bless added the tb_word_formats,
fpv_srgb_draw_storage and int24_products fixtures and moved SEMANTICS_VERSION to 2332, so the
bless-due tests (engine_fixtures_match_their_golden_printout, inventory_lists_every_fixture_in_order,
golden_hashes_match_the_table, llvm_as parts 4 and 8) read red until this commit.

Files: golden_hashes.tsv, public_fixture_expectations_engine.tsv, and the two new printouts
air_input/tb_word_formats.txt and air_input/fpv_srgb_draw_storage.txt. Nothing else.
2026-12-02 23:35:58 -08:00
Anees Iqbal 1a84985dd4 Validation test: a texture over a no-copy import asserts the copies of the form the run reports
The test a_bytes_form_no_copy_buffer_is_an_import_and_a_descriptor_form_one_a_pool_buffer
asserted one imported over copy: the copy at use of a texture over host memory's import held in
an image of its own. A texture over host memory's import is now in place on an integrated or CPU
device whose external image query takes a linear image for that handle, its bytes saved and
written back once around its move home, so it counts that restore pair: two imported copies and
none at use. On the 780M (Phoenix, RADV, job m3-max-82442) the test read 2 and failed; its line
was "textures over buffers 2: 2 in place, 0 in an image of their own", with 2048 bytes of
host-memory restore. The product's count is the documented one; the test's expectation was
stale.

The test now reads each texture's form from what the run reports and asserts the copies that
form makes:
- #6, the one texture over an import, is in place where the device counts one texture in place
  over an import (textures_in_place_over_imports). Then it takes the restore pair: two imported
  copies and two host-memory restores of equal bytes, each at least the 784 bytes under the
  texture's rows, and none at use. Else it takes one imported copy of its 64 bytes at use, for
  host memory's cause or a linear-image decline.
- #13, over pool buffer #4, is in place where the textures-over line's in-place count, less #6,
  says so, with no copy. Else it takes one pool-side copy of 64 bytes at use.
- The at-use copies by cause sum to the textures in images of their own.
The test prints each texture's form and, where declined, its cause.

Verified on the fix's first form, the same assertions:
- 780M (Phoenix), m3-max-82451: both in place, #6 by its restore pair (2048 bytes), passed.
- Iris Xe, m3-max-82452: both declined for pitch (the linear image's row pitch or start is not
  the texture's 256), one copy each at use, passed. That is why the Iris read 1 before.
- RTX 2080, m3-max-82453: #6 for host memory (a discrete device), #13 for pitch, passed.

Product code is unchanged.
2026-12-02 23:25:26 -08:00
Anees Iqbal 28e4da1f17 Docs: Metal's resolve rounds a tie as its GPU does, and the alpha-to-coverage note's devices at 8 samples
The planner's ruling on resolve rounding: rule 1 counts a resolve among the device's own answers,
and two Macs round an average that lies exactly halfway between two codes differently, so Metal
fixes no answer there for a guest. An Apple M3 Max (macOS 27.0.1) rounds the tie up, as the
conformance recordings sample-positions-default-2x and -4x hold (red 1/255 over half the samples
resolves to 1); an AMD Radeon Pro 5300M (macOS 26.7.1) rounds it to the even code (red 0 at 1 of
2, 2 of 4 and 4 of 8 samples, an alpha of 127.5 to 128; m3-max-82284). The device's own rounding
stands; no behaviour changes and neither Mac's rounding is emulated.

- PrecisionNote::DeviceRoundedResolve's doc and docs/API.md's catalogue entry name both measured
  answers with their sources.
- The seven known-gaps-rt.tsv rows of sample-positions-default-2x and -4x (Iris Xe, RADV, NVIDIA,
  llvmpipe) say they differ only by how a tie rounds, and why that stands;
  docs/CONFORMANCE-COVERAGE.md regenerated from them.
- PrecisionNote::DeviceAlphaCoverage's doc and its catalogue entry say exactly which devices are
  measured at 8 samples: the 5300M (m3-max-82239); the M3 Max, which renders no 8 samples and so
  has no answer there; no device the runtime runs on. They said before both that the 5300M was
  measured at 8 and that 8 was unmeasured on every device.
2026-12-02 23:19:49 -08:00
Anees Iqbal e54cf61edd Translator: SEMANTICS_VERSION 2332 for mul24 and mad24
12cd7bc987 lowers air.mul24 and air.mad24 (both signs, i32 and 2 to 4 of its lanes), which the
translator refused as UnknownIntrinsic, so a kernel that calls one translates under an unchanged
key where it refused before: a cached FALLBACK of it is stale. The golden tables are re-blessed on
development.

Metal's answer: the product of the operands' low 24 bits, zero-extended for u and sign-extended for
s, and for mad24 its 32-bit sum with z, in the specification's range and outside it, at every word
of int24-products-in-range and int24-products-outside-24-bits on the Apple M3 Max under macOS
27.0.1 (m3-max-82247); the AMD Radeon Pro 5300M under macOS 26.7.1 answers both cases with the same
output sha256 as the M3's, 5bf881c0 and f8cce5fb (the fixture compiled at run time, the cases'
buffers; m3-max-82284).

Verified: at this change on ee6911e100 (cab2e25131), clippy plain, --cfg m2v_gpu and
--cfg m2v_cpu_icd and Rustdoc clean; the core suites 3715 passed, 39 skipped; validation 1322
passed, 3 skipped; conformance 1050 passed; doctests 2 passed; both cases Match Metal's rows on
lavapipe (m3-max-82325) and on the AMD Radeon RX 7900 XTX (m3-max-82350); the guest's kernel that
was refused compiles, PASS on the RADV and lavapipe profiles (m3-max-82349). At this change on
86190052f5 (68e8a17200): fmt --check and clippy plain clean, the translator and AIR suites 3437 passed, 37
skipped, both cases Match Metal's rows on lavapipe (m3-max-82408).
Before that: the int24_products kernel PASS with spirv-val clean on all fifteen profiles (m3-max-82287); a states-only play of glbench-780m-r4-recnil on lavapipe, 3756 render and
484 compute states made, 0 refused (m3-max-82292).

Re-laid onto d12395fc12, whose new commits touch no file of this change but the version file's
RUNTIME_VERSION line.
2026-12-02 23:17:29 -08:00
Anees Iqbal 5150424104 Translator: the math sweep takes mul24 and mad24 at 32-bit lanes alone; the signature table's two variants
every_math_entry_decodes_and_checks spells every table entry at every integer width, and read
air.mul24.s.i8 as unknown, which 12cd7bc987 means: mul24 and mad24 are of i32 lanes alone. The
sweep now skips their other widths, as it skips dot's scalars; the decode test of 12cd7bc987
holds those widths unknown.

api_signatures.tsv gets the two variants 12cd7bc987 adds to the published
metal2vulkan-air::intrinsics::MathFn, Mul24(Sign) and Mad24(Sign)
(scripts/api-signatures/signatures.py --bless): an addition, nothing removed or changed.

Both failed in the gate at 12cd7bc987 (m3-max-82287), whose other 3431 translator and AIR tests
passed, the arith sweep's mul24 and mad24 kernels and the new decode test among them.
2026-12-02 23:17:08 -08:00
Anees Iqbal 0d4295e5f6 Tables: int24_products's golden printout, and its inventory rows confirmed by the bless
bless_engine_goldens under the pinned LLVM 21 on the M3 (m3-max-82288) writes the fixture's
printout, its sixteen calls decoded as Mul24 and Mad24 of both signs at 1 to 4 lanes.
bless_engine_inventory in the same job leaves the two int24_products rows of 617853c57b as they
are: the kernel translates on all fifteen profiles from the opaque and the typed text.

The same bless also wrote rows and a printout for engine/tb_word_formats, another change's fixture
already on development; they are left to development's bless, as are the golden hashes.
2026-12-02 23:17:08 -08:00
Anees Iqbal 12cd7bc987 Translator: mul24 and mad24 are the 32-bit product of their operands' low 24 bits
A guest's screen-sharing encoder makes a compute pipeline whose kernel calls air.mul24.u.i32, and
the translator refused it as UnknownIntrinsic. The guest's module declares four of the family
(air.mul24 and air.mad24, s and u, of i32); Apple's compiler spells sixteen
(air.{mul24,mad24}.{s,u}.{i32,v2i32,v3i32,v4i32}, m3-max-82233). All sixteen decode now.

The Metal Shading Language specification (4.1, section 6.4, Table 6.2): mul24 "multiplies two
24-bit integer values x and y and returns the 32-bit integer result. x and y are 32-bit integers
but only the low 24 bits perform the multiplication"; mad24 "uses mul24 ... adds the 32-bit
integer result to the 32-bit integer z". Below the table the product is defined for x and y in
[-2^23, 2^23 - 1] signed and [0, 2^24 - 1] unsigned and implementation-defined outside them.
The Apple M3 Max (macOS 27.0.1) answers outside that range too with the product of the operands'
low 24 bits, zero-extended for u and sign-extended for s: 480 of 480 words of
int24-products-outside-24-bits, where the 32-bit product of the whole operands differs at 386
(m3-max-82247). That outside-range equality is measured on the M3 only.

Now:
- intrinsics::math decodes air.mul24.<s|u>.<T> and air.mad24.<s|u>.<T> as MathFn::Mul24 and
  MathFn::Mad24, for T i32 or a vector of it; any other element width stays undecoded.
- canon::routine replaces each call, after SCCP as it does OpenCL C's mad, by plain AIR in T's
  shape: each operand's low 24 bits (and 0xffffff for u; shl 8 then ashr 8 for s), their 32-bit
  mul, and for mad24 the 32-bit add of c, all without nsw or nuw. One form on every device and no
  precision note: it is the table's own wording, and it equals Metal at every word measured.
- Lowering takes them as it takes any such instructions; a Mul24 or Mad24 call that survived
  canonicalization is an invariant failure, as a mad call is.

Tests: mul24_and_mad24_decode_on_32_bit_lanes_alone (the sixteen names; i16, i64, i8 lanes, a
float, no sign and a prefix stay unknown). The arith sweep's five mul24 and mad24 kernels
(cc5adc7e7c), the int24_products inventory rows (617853c57b) and its two validation cases
(7fcd661645) are the red tests this turns green.
2026-12-02 23:17:08 -08:00
Anees Iqbal cc5adc7e7c Translator test: mul24 and mad24 multiply their operands' low 24 bits on every profile (red)
Five kernels of the arith sweep, each validated and interpreted on every profile:
air.mul24.u.i32 of 0x01FFFFFF and 0x00FFFFFF (0xFE000001, where the 32-bit product of the whole
operands is 0xFD000001), air.mul24.s.i32 of 0x00800000 and 0x7F000003 (bit 23 sign-extends:
0xFE800000, not 0x01800000), air.mad24.u.i32 adding all 32 bits of -1, and per-lane
air.mad24.s.v4i32 and air.mul24.u.v3i32 of operands with bits above bit 23. The expected values
are the product of the operands' low 24 bits, zero-extended for u and sign-extended for s, then the
32-bit sum, as the M3 Max answers the int24_products cases in and outside the specification's
range (m3-max-82247).

Red: the translator refuses each as UnknownIntrinsic.
2026-12-02 23:17:08 -08:00
Anees Iqbal 7fcd661645 Validation cases: Metal's answer for mul24 and mad24 in and outside their 24-bit range (red)
Two authored cases over engine/int24_products, 12 threads, out filled with 0xAB: operands in the
range the Metal Shading Language specification gives mul24 (section 6.4, after Table 6.2:
[0, 2^24 - 1] unsigned, [-2^23, 2^23 - 1] signed), and operands outside it, each beside small
in-range partners, where the specification calls the product implementation-defined. The addends
are full 32-bit words in both. Installed with corpus-case-check (m3-max-82243) and qualified on
Metal on the Apple M3 Max, three executions each (m3-max-82247).

Metal's outputs against the kernel computed on the CPU, word for word (480 words each):
- in range: equal to the 32-bit product of the operands, and equal to the product of their low
  24 bits (zero-extended unsigned, sign-extended signed), which agree there;
- outside the range: equal to the product of the operands' low 24 bits at all 480 words; the
  32-bit product of the whole operands differs at 386 of them.

scripts/qualify-public-cases runs both on lavapipe against those rows. They are red until the
family is lowered: today the translator refuses the kernel as UnknownIntrinsic.
2026-12-02 23:17:08 -08:00
Anees Iqbal 617853c57b Fixtures: int24_products's companions, and its inventory rows written as ok on every profile (red)
The companions come from scripts/regen-air-fixtures on the M3 (job m3-max-82233: Metal 32023.922,
SDK 27.2). Apple's compiler spells the family as sixteen intrinsics, air.mul24.<s|u>.<T>(T, T)
and air.mad24.<s|u>.<T>(T, T, T) for T in i32, v2i32, v3i32 and v4i32, and the fixture's module
declares all sixteen. MSL on macOS spells no wider form: the header's 8- and 16-lane overloads sit
behind __HAVE_NATIVE_WIDE_VECTORS__, which is not defined there, and uint8 and int16 are reserved
names (the same job).

The engine inventory's two rows expect the kernel to translate on every profile. They are red
until the family is lowered: today each profile refuses it as UnknownIntrinsic. The golden
printout under tests/air_input follows the decoder's change.
2026-12-02 23:17:08 -08:00
Anees Iqbal 2c8f839869 Fixtures: int24_products, mul24 and mad24 of both signs at every width MSL spells them (source)
Our own MSL for the air.mul24/air.mad24 family the translator refuses as UnknownIntrinsic (a
guest's screen-sharing encoder meets air.mul24.u.i32 in a compute pipeline). One kernel calls
mul24 and mad24, unsigned and signed, as a scalar and at 2, 3 and 4 lanes, over 12-value operand
rows of each sign rotated per thread, with full 32-bit addends, and stores every lane's bits:
40 words a thread. The companions come from scripts/regen-air-fixtures in the next commit.
2026-12-02 23:17:08 -08:00
Anees Iqbal d12395fc12 Versions: runtime 2557 for supportsTextureSampleCount: answering 8
RUNTIME_VERSION 2556 -> 2557: a device whose framebuffer colour, depth and stencil sample counts
hold 8 answers yes for 8 to supportsTextureSampleCount:, answers getDefaultSamplePositions:count:
at 8 with Vulkan's standard 8 locations instead of refusing it, and a pass at 8 samples takes
custom positions where its answer to programmableSamplePositionsSupported is yes.

runtime-sources.sha256 holds the inputs' new hash, computed as the build script computes it (the
same computation gives development e0fe34be0c's committed 70aa1707cd...).
2026-12-02 23:13:13 -08:00