Commit Graph
12 Commits
Author SHA1 Message Date
Anees Iqbal 41438f2693 Translator: a depth cube's read by face samples its cube view, as a colour cube's does
A read of a depth cube or depth cube array by face (depthcube<float, access::read>'s
read(coord, face, lod), air.read_depth_cube and air.read_depth_cube_array) was refused on every
profile, Unsupported{IdentityDomains; NotImplemented}: the read kept the 2D-array view
(RuntimeFact::ImageViewShape), which the identity arrays hold no element of. The resident tables
built it before the cutover to the one form, and that commit deleted its interpreter test with
them; the runtime's README listed it as a known gap.

A colour cube's read by face already samples its cube element, the texture's cube view, at the
texel's centre and the read's explicit level through element 0 of the plain sampler array (the
default sampler, nearest, every level), its operands tested in the shader. A depth cube's element
is its cube view of the depth, which that plain float sampler samples without a comparison as a
depth cube's sample() does, the depth the sample's first component. So slot::samples_cube_element
no longer excludes a depth shape: the read takes the same form, and the slot states no
ImageViewShape.

Tests:
- engine_texture's an_identity_cube_read_by_face_samples_its_cube_element compiles
  unk_read_depth_cube too, on every identity profile: L3 passes, no ImageViewShape fact, its two
  textures from the sampled float depth cube and depth cube-array classes, its sampler from the
  plain array, OpImageSampleExplicitLod and no OpImageFetch. Red with slot.rs at the base.
- The runtime's tests::cube_reads gains cr_depth (a Depth32Float depth cube of three levels) and
  cr_depth_array (a depth cube array of two cubes and two levels): every texel of every face,
  level and cube reads its uploaded depth bit for bit, and each read outside the texture reads 0.
- scripts/qualify-public-cases, CI's step, qualifies the public case
  depth-cube-and-cube-array-reads-at-32-and-16-bit-coordinates (3 x 3 depth textures, every
  texel of every face and cube, depths over many binades) on lavapipe against its Apple M3 Max
  observation.

Docs: lower::texture's module docs, slot.rs, emit.rs, API.md and RESOURCE-ID.md say a depth
cube's read by face samples its cube view; the runtime README's known gap loses the depth cube
read and names it lowered. engine_texture_unk's module docs no longer claim an interpreter run of
the depth cube reads.

Engine inventory: engine/unk_read_depth_cube.ll moves from Unsupported{IdentityDomains;
NotImplemented} to ok on all 15 profiles; its .air.ll twin moves at the M3 bless.
SEMANTICS_VERSION 2365 -> 2367 (a placeholder, renumbered at landing): the fixture's 15 golden
cells, one a profile, change from the refusal to modules, and no other cell moves. The golden
table and the authored compile census (the case's row, not_supported today) are re-blessed on
development.

Verified, at this commit's tree on 6459eaa946 (rebased since onto the sparse path's deletion,
whose only overlap is the SEMANTICS line):
- m3-max-85654, on the CPU with no device: the engine inventory's eight llvm_as parts differ
  from the table by nothing (the row moved with the change). Red, with slot.rs at the base:
  an_identity_cube_read_by_face_samples_its_cube_element fails at the depth cube; green: it and
  the 20 other cube tests of the translator pass. The golden table's cells: 105 change at this
  commit, the base's 90 (development's, blessed since) and unk_read_depth_cube's 15, the two lists
  otherwise equal. The refusal surface's check, fmt, signatures, clippy (plain, --cfg m2v_gpu,
  --cfg m2v_cpu_icd), Rustdoc, private docs, doctests and scripts/api-docs pass; the metal2vulkan
  suites ran 3,471 tests: 3,470 passed, 24 skipped, and the failure is
  golden_hashes_match_the_table, whose table is blessed on development; validation ran 1,344
  tests, all passed, 2 skipped; conformance ran 1,053, all passed.
- m3-max-85654, on devices: the runtime's every_device_reads_a_cube_by_face_as_its_texels, with
  the depth cube and depth cube array rows, passes on lavapipe (llvmpipe, LLVM 23.1.1, 256 bits,
  m2v_cpu_icd) and on the RTX 5080 Laptop GPU (m2v_gpu).
- m3-max-85654, CI's lavapipe image: scripts/qualify-public-cases exits 0, every case's slot
  current, the depth cube case's among them.
- m3-max-85857, on the CPU with no device, at this commit on the sparse path's deletion: clippy
  of the workspace (all targets and features) passes, and the 34 cube and engine-inventory tests
  of the translator all pass.
2026-12-03 16:14:41 -08:00
Anees Iqbal 8e912a905d Validation cases: a device-coherent texture handed between threadgroups, Metal's answer
One authored case over engine/coherent_texture_handoff's coherent_texture_handoff: 128 threads in
threadgroups of 64, a 64 x 1 r32_uint texture of zeros, a zero flag and an output of 64 words
filled with 0xAB. It is authored_bounded: the reader's one loop runs at most 4096 loads, a constant
of the kernel. Installed with corpus-case-check and qualified on Metal on the Apple M3 Max, three
executions (m3-max-83673): every word is 1 (output sha256 08f4ad0b..., the hash of 64 words of 1),
so no read on Metal that saw all 64 writers' flag read the texel's earlier value.

scripts/qualify-public-cases with this case in its list exits 0 on lavapipe (job m3-max-83707), and
the case's Vulkan candidate on the Intel Iris Xe (RPL-P) under its venue intel-irisxe-rplp-anv
prints Match (m3-max-83680).
2026-12-03 06:47:18 -08:00
Anees Iqbal df54afeef2 Cases: LOD queries through a sampler bound with LOD clamps of its own, qualified on the M3 Max
Six authored cases over the owned fixture rfs_kernel_lod: five of the kernel lod_2d and one of
the vertex function lod_vertex, each through a runtime sampler bound with
set*SamplerState:lodMinClamp:lodMaxClamp:atIndex: with a pair that differs from its
descriptor's, so the answer says which pair the query reads. The M3 Max (macOS 27.0.1, job
m3-max-83804) answers the bind's pair in every one:

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

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

Why: under the identity domains the query reads the minimum level from the word of the
resource ID the slot pushes, and a bind with clamps pushes the ID of the state's variant of
the pair; these cases check that variant's word against Metal.
2026-12-03 06:46:39 -08:00
Anees Iqbal c5f979d985 Cases: kernel and vertex LOD queries through runtime samplers with LOD clamps, qualified on the M3 Max
Ten authored cases over the owned fixture engine/rfs_kernel_lod. Each comes from the committed
runtime-sampler case of its entry with the sampler's mip filter and LOD clamps set (no new AIR):
- lod_2d: nearest (2.7, 4) reads 3; nearest (1.5, 3) reads 1; no mip filter (2.5, 4) reads 0;
  linear (2, 3) reads 2; linear (10, 20) reads 4 (the last level); nearest (6, 9) reads 4;
- lod_2d_array: nearest (0.6, 4) reads 1;
- lod_3d: linear (1, 2) reads 1;
- lod_cube: nearest (2.2, 3) reads 2;
- lod_vertex: nearest (2.7, 4) reads 3, 64 points with no rasterization.
Every unclamped level is 0. These are exact rows only: a linear mip filter with an lodMinClamp
between whole levels, which the identity domains answer by the word's nearest level, has no case
(the planner's ruling; docs/API.md's accepted differences).

Installed with corpus-case-check and qualified with corpus-metal on the Apple M3 Max (macOS
27.0.1, environment apple-m3-max-macos27.0.1), job m3-max-83473. Each observation decodes to the
levels above, which metal::sampler::query_min_level gives. scripts/qualify-public-cases (CI's
lavapipe step) now runs these ten and the four existing runtime-sampler cases of the fixture.
Before this branch's translator fix those four were not_supported under the identity domains
(lavapipe, m3-max-83452: refusal=4); at the fix they match=4.
2026-12-03 06:46:39 -08:00
Anees Iqbal 2fb00a15ae CI: qualify kernel_handle_word_joins's four cases on lavapipe
The public case step now runs the four authored cases of the owned fixture kernel_handle_word_joins
(a sampler or a texture taken from a branch merged at a join, as integer words in a phi and in a
select, and as pointers in a phi) against their Metal observations.

Verified: syntax only (bash -n); the cases' Metal observations and the step's run come next.
2026-12-03 05:57:30 -08:00
Anees Iqbal 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 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 d0664f2c10 CI: qualify the float and half function-constant cases on lavapipe
scripts/qualify-public-cases runs a named list of the owned public cases on
lavapipe against their committed Metal observations. It now names lane
fcfloat's 15 cases (engine/fc_float_gate: a kernel's gated argument and a
fragment's gated sample mask; engine/fc_half_gate: the sample mask), so CI
keeps Metal's answer for a float or half predicate: present at 1.5, -0.0
and a quiet NaN, absent at +0.0 and unsupplied (Apple M3 Max, jobs
m3-max-75714, 75716, 75726). The lane's candidate ran these 15 on lavapipe
at 7de0a8c8bb's tree plus the half fixture: 15/15 Match, every slot current
(job m3-max-75728). The script itself runs in the gate at the pin tip.
2026-11-26 17:35:09 -08:00
Anees Iqbal c718924d44 CI: qualify the AIR 1.8 sampling case on lavapipe with the other public cases
scripts/qualify-public-cases runs case 884ad7d75a22 against its committed Metal row. Run by hand
under the same operator environment (ci-lavapipe, job m3-max-73980 on lavapipe 23.1.1): Match,
candidate output 7d65bff73d82, Metal's bytes.
2026-11-25 13:37:09 -08:00
Anees Iqbal 11d8892858 Validation: an authored case calls through a kernel's visible-function table
visible-table-entry-by-thread-calls-add-mul-null-sub (af884d65cb): twelve
threads of the owned visible_table_dispatch each call entry tid % 4 of a
table of four, linking table_add, table_mul and table_sub from the owned
module visible_table_ops, entry 2 left null. Installed with
corpus-case-check and qualified on Metal on the M3 in the primary reference
environment (m3-max-69730: three runs, 3, 3, 0xfffffffd, 0, 7, 15,
0xfffffffd, 4, 11, 27, 0xfffffffd, 8).

The public qualification (CI's lavapipe step) now also runs it and the
public table-query case 3a8f75e182, which the runtime refused before.
2026-11-22 22:11:30 -08:00
Anees Iqbal 79d95a2887 Validation: the robustness-off leg and its slots are deleted
The ruling Q3: the validation executor runs each case in one context,
which enables every robustness feature its device states. Its second
leg (every robustness feature off, the ID@engine+robustness-off slots)
measured an encoding that metal2vulkan-runtime never runs, since the
runtime's floor fixes the robustness it enables. The tier table keeps
both of its compiles: they are translator coverage of what the runtime
ships, so coverage::Leg stays as the tier table's type alone.

Deleted:
- the executor's leg: corpus-vulkan's and corpus-moltenvk's
  --robustness-off, the device worker's leg, engine_slot's leg (an engine
  slot is ID@engine or ID@engine@P; an ID@engine+robustness-off is no
  engine slot), the enable lists' leg (engine_list enables what the
  description states), and the leg in a row's environment and census
  (ExecutedCensus.leg, environment.robustness.leg) with its validation;
- the batch's legs: corpus-vulkan-batch takes no --leg. Its passes are
  Pass::Engine and Pass::Metal, so a done-list line names "engine" where
  it named "stated", and a log is CASE.engine.txt. Its report lines carry
  no leg= field, and batch-slowest names pass=engine;
- the authored compile census's robustness-off profiles: a profile is
  its committed stem (ProfileStem, which was ProfileLeg); a label with a
  "+" names no profile. corpus/authored-compile.tsv loses its 9
  +robustness-off columns mechanically. Every other cell stays, and the
  reader takes the new layout in this commit. The rows are re-blessed
  at the next named pin. the_committed_expectations_parse holds the file
  to what a bless renders. No test is expected to read red until the
  bless, since no kept cell changed (unaudited until development's census
  runs);
- C3's legs: a venue lists no legs and has one slot (c3-venues.json
  drops its legs fields). c3-reviewed.json drops the 12 observations
  recorded in robustness-off slots;
- the committed rows of the +robustness-off slots: 193 rows and
  refusals out of corpus/observations, which empties and removes 44
  shards. "leg":"stated" is stripped from the remaining rows' census and
  environment;
- scripts/qualify-public-cases' second run per case, and
  scripts/rerecord-venue's --leg; docs/VALIDATION.md's robustness legs.

corpus-triage's usage, corpus-status' --c3 help and the census's file
comment say "profile" where they said "profile-leg".

Verified: cargo fmt. The compile gate follows as a potluck job.
2026-11-20 22:15:02 -08:00
Anees Iqbal 13b279df1b Squash 11203 commits of translator, runtime, and validation work
Rolls up everything since 43c46ac8 into a single commit. Its tree is
identical to the tree of private master at
b3c77f2d2b20a432be10591a2129547c10b1c24b.

- A Cargo workspace of five crates under crates/: metal2vulkan (the
  translator and the metal2vulkan command), metal2vulkan-runtime (the
  Metal API on Vulkan), metal2vulkan-air (the AIR front end),
  metal2vulkan-validation and metal2vulkan-devtools.
- Dual license: GPL-2.0-or-later OR LGPL-3.0-or-later.
- docs/: API, architecture, fast paths, how-to, Metal coverage,
  refusals, runtime porting and validation guides.

Private-Commit: b3c77f2d2b20a432be10591a2129547c10b1c24b
2026-10-11 20:09:13 +03:00