Commit Graph
164 Commits
Author SHA1 Message Date
Anees Iqbal ff6d387aa7 Ledger: RADV's extended-swizzles family, 193 rule-1 rows
The whole RADV replay (RX 7900 XTX, RADV NAVI31, Mesa 26.2.6; potluck
job m3-max-4016 at 7470a49e6d) read 704 lines not in known-gaps.tsv;
193 of them are the extended-swizzles family (extended-range,
padded 10-bit, packed 16-bit, bfloat and sRGB-twin formats under
every swizzle and op). Each is a site the case's M3 Max, NVIDIA and
llvmpipe rows already hold, and each is the same answer:

- 124 sites read exactly the count and largest difference another
  venue's row holds, and 15 more (the sRGB twins' gathers and reads)
  differ from it only in the largest word difference (91309 here
  against 91311-91315), the same one-step code; their row texts state
  the module's own decode and encode arithmetic and the device's
  conversions, venue-neutral, under device-pack-conversion, which
  every one of these cases announced on RADV, so they are reused as
  they stand;
- 20 extended-range linear samples (sl) blend their taps by the
  device's FMix, under bicubic-filter-arithmetic, which these cases
  declare and which fired on RADV (none of them is among the cases
  whose declarations did not all fire); each row now names RADV's
  own first mismatch and how far apart it is in value;
- 14 bfloat NaN sites keep the NaN's sign and payload where Metal
  answers 0x7fc00000 (RADV's first: ours 0xFFEF0000), under
  device-pack-conversion;
- 20 packed 16-bit linear samples are the device's own filter and
  widening, under device-sampling and device-texel-conversion
  (announced); each row names RADV's first differing element and
  that device-sampling's RADV bound (0.548 of a code) is measured on
  unpacked formats only.

All are scoped to RADV. CONFORMANCE-COVERAGE.md re-derived.

(cherry picked from commit b255f138531068fea5f2d4edc2be7f2084d24c09)
2026-11-07 08:37:37 -08:00
Anees Iqbal fde4ef5bb3 Ledger: RADV's sRGB decode beyond the read-write tier, four rule-1 rows naming srgb-texel-decode
The whole RADV replay (AMD Radeon RX 7900 XTX, RADV NAVI31, Mesa
26.2.6; potluck job m3-max-4016 at 7470a49e6d) read four lines not in
known-gaps.tsv at the 8-bit sRGB `beyond` sites of
read-write-tier-round-trip-float (768 elements, largest 67649) and
read-write-tier-held (192 elements, largest 64922), for BGRA8 and
RGBA8 alike. They are the device's native sRGB decode, the same
answer the case's llvmpipe and NVIDIA rows hold at the same sites:

- both cases announce srgb-texel-decode on RADV;
- the U32 difference is between f32 bit patterns, not codes: the
  round trip's first element is Metal 0x3C840841 (66 / 4095) against
  our 0x3C830000; the held read's are Metal 0x3D080881 (136 / 4095)
  against our 0x3D0798DA, the transfer of code 51, and 0x3BB80B81
  (23 / 4095) against 0x3BB7AD6B, the transfer of code 17;
- RADV stores no sRGB format (its optimal tiling of B8G8R8A8_SRGB and
  R8G8B8A8_SRGB lists no STORAGE_IMAGE, read with vulkaninfo, job
  m3-max-4052), so the held texture is read through its UNORM alias
  and decoded through the device's Pow, as on the other two venues.

The rows are scoped to RADV: the decode is the driver's compiler's,
not one Mesa build's. CONFORMANCE-COVERAGE.md re-derived (2600 rows).

(cherry picked from commit 6efa9157436862f6e6d990f298f53fd84ab11b06)
2026-11-07 08:37:20 -08:00
Anees Iqbal b64908f468 Ledger: the RTX 5080's own YCbCr conversion and filter, twenty rule-1 rows for ycbcr-gathers and ycbcr-minify
The 5080 replay of the two-plane YCbCr cases (potluck b5080 entry
replay-replay-nv-ycbcr-072438 at 394b4db3f6) read twenty lines not in
known-gaps.tsv: ycbcr-gathers-{edge,zero,white,repeat} at
case/samples/{420v,x420}/{float,half} and ycbcr-minify-band-{x,y} at
case/samples and case/samples/ends, each a digest Metal's and ours
differ at. The digests are the ones the 5080 answered at 10012a618f.

They are the device's native answers. The 5080's memory is not the
host's, so the runtime binds the texture's image of converted texels
rather than reading the planes in place (lavapipe and MoltenVK read
them in place and match Metal at every one of these sites):

- the 8-bit 420v surface: the device converts the format itself
  (ycbcr_device.rs; NVIDIA 615.71.09 enables samplerYcbcrConversion
  and its optimal tiling of G8_B8R8_2PLANE_420_UNORM reports
  SAMPLED_IMAGE, TRANSFER_DST and MIDPOINT_CHROMA_SAMPLES, read with
  vulkaninfo, potluck job m3-max-3911), and samples are its own
  filter: announced as ycbcr-filter-not-exact and device-sampling;
- the 10-bit x420 surface and the minify bands: the device does not
  convert it (RuntimeDriverDefect::TenBitCodesReadAsWords names
  NVIDIA), so the texels are Metal's fixed-point conversion and only
  the filter is the device's: announced as device-sampling.

Both notes are suite native notes, which loosen no value
(replay::NATIVE_NOTES), so each site is a row naming its note. The
sites compare by digest, so which lanes moved is not separated, and
the rows say so. CONFORMANCE-COVERAGE.md re-derived.

(cherry picked from commit 05a4e4d3994ef83845ca55417f480aa0aab3606d)
2026-11-07 08:36:55 -08:00
Anees Iqbal f118559e73 Binary archives: add mesh pipelines, and load a metallib as an empty archive
Two of the conformance ledger's every-venue rows, both of the runtime's
archive surface.

binary-archive-mesh-adder: BinaryArchive had three of Metal's four
pipeline adders. add_mesh_render_pipeline_functions
(addMeshRenderPipelineFunctionsWithDescriptor:error:) makes the state as
new_mesh_render_pipeline_state does with the default options, answering
its error, and keeps the descriptor's archive key (metal_key::mesh). A
mesh creation compiles its pipeline whole and looks in no archive, so
the add keeps no compiled artifact. Under FAIL_ON_BINARY_ARCHIVE_MISS a
mesh creation, which every listed archive missed before, now hits an
archive holding its key (binary_archive::mesh_missing). Which fields
Metal keys a mesh pipeline by is not measured, so the key holds every
field of the descriptor: a creation hits only an add of an equal
descriptor, where Metal's hits too, and one differing in a field Metal
does not key misses here where Metal's may hit, as the add's and
new_mesh_render_pipeline_state's docs say.

binary-archive-sources: Metal takes a metallib as an archive (the case's
M3 Max recording); container::read refused it as no archive of ours. A
file that parses as a metallib (Library::from_metallib, container tags
alone) now loads as an archive holding nothing: its lookups miss and it
serializes as one nothing was added to. What Metal's archive of a
metallib holds is not measured; new_binary_archive's doc says so.

The suite's runtime side answers the mesh add through the new call. The
ledger's two rows go; api_signatures.tsv gains the method, and
METAL-COVERAGE (coverage.tsv) marks the call implemented. Tests: unit
tests the_mesh_key_holds_every_field_and_a_lookup_names_the_mesh_function
and a_metallib_loads_as_an_archive_holding_nothing; lane test
a_mesh_add_is_found_by_its_own_descriptor_and_a_metallib_loads_as_an_
empty_archive (hit, miss before the add and for another color format,
the add's error, serialize and reload, the metallib's miss and nothing
to serialize). Verified by those tests and a whole lavapipe conformance
replay (see the tip report).

(cherry picked from commit adadb73f7c2063341e1dbe54fe887a5ceddf86b7)
2026-11-07 08:02:57 -08:00
Anees Iqbal 0d368fbfe7 Draw a split depth/stencil resolve's drawn aspect into its own texture
Metal resolves separate Depth32Float and Stencil8 textures with the
depth filter Min or Max beside the stencil filter Sample0, each into its
own resolve texture. On a device with no MIN or MAX depth resolve mode
(lavapipe) the runtime draws the picked depth after the pass, but a
split resolve (aspects resolving into different textures) refused any
drawn aspect NotImplemented(DepthStencilResolve): the draws wrote the
first step's scratch image, whose copy takes that step's aspect alone.

Now a split resolve draws its drawn aspect into that aspect's own
resolve texture (or a scratch image copied there, Destination::attach),
held as the resolve's drawn_into, which drawn_target prefers; the other
aspect resolves in its subpass step as before. Both aspects drawn, each
into its own texture, stays refused. The image separate textures render
through is made sampled where such a resolve may be drawn
(resolve::may_draw, which shares the filter-to-mode choice with
depth_stencil through aspect_modes), since the draws read its samples.

The ledger's two llvmpipe rows of resolve-stencil-under-depth-filters
(Sample0 under Min and Max) go. The lane test
split_depth_and_stencil_resolves_are_metals now expects every case but
both-aspects-drawn to be built and to hold Metal's answers; before this
change sep_min, sep_max, two_min, two_max and slices_max were refused
on lavapipe. Verified on lavapipe: the lane test and the conformance
replay (see the tip report).

(cherry picked from commit c2b4cbc80bf7f8f209d02ecbd5e5aec186b04d96)
2026-11-07 07:28:20 -08:00
Anees Iqbal 9b1a531a25 Re-derive the conformance coverage document for attribute-stride-vertex-buffer
python3 -I scripts/conformance-coverage/coverage.py: one more case module
and recording, and setVertexBuffer:offset:attributeStride:atIndex: on the
render encoder now exercised by the Metal leg (812 of the reachable).

(cherry picked from commit dce4bd753c2e298f3b1cbb84b5c808d2cabb85b1)
2026-11-07 07:21:49 -08:00
Anees Iqbal e39a0cab5c Conformance: a tile state's thread limit follows its dispatch's device-gap ruling
tile-simd-blur-columns and -rows on llvmpipe compared the tile state's
maxTotalThreadsPerThreadgroup, Metal's 1024 against the runtime's 960,
as a divergence of ours, while the same case's 32x32 dispatch, refused
typed with Feature::LocalSize and a Capability::Limit, already read as
the device's gap (a_dispatch_the_device_cannot_take_is_the_devices_gap).
960 is lavapipe's: its emulated 32-lane simdgroups hold 960 threads of
the blur's pipeline, and the runtime reports the device's lower limit
by contract (pipeline/tile.rs).

Now the tile_threadgroups family, where the device refused a dispatch
Metal ran of the state as its gap and the state's descriptor states no
limit, states the state's maxTotalThreadsPerThreadgroup site as that
gap (Sites::device_gap), and the comparison reads a value site our side
stated so as a DeviceGap instead of a divergence (compare.rs, before
any allowance, as a refused site's gap). A state whose answer matches
Metal's records nothing; an unstated difference still diverges.
Metal's side never states one: its failures carry no lacks.

The two llvmpipe ledger rows go; the cases now read lacks-feature
there. Test: a_getter_our_side_states_is_the_devices_limit_is_the_
venues_gap holds both directions (stated reads lacks-feature, the same
answer unstated reads divergent, a stated site matching Metal exact).
Verified by the conformance unit tests and a whole lavapipe replay
(see the tip report).

(cherry picked from commit ffa0411fb87a3dc61ca14a5418b16a60e06c3fa2)
2026-11-07 07:20:06 -08:00
Anees Iqbal 027bb2e682 A compute state's static threadgroup length is the kernel's own, as Metal reports it
ComputePipelineMetalInfo::static_threadgroup_memory_length answered, on
a device that emulates simdgroups, the declared arena plus the scratch
of the most threads (32768 on lavapipe for compute-threadgroup-simd-
scratch, whose kernel declares 24 KiB), and elsewhere the kernel's
static part plus a predicated walk's vote word. Both additions are
ours: Metal's staticThreadgroupMemoryLength is the static part of the
kernel's own layout (KernelFacts::static_threadgroup_bytes), and the
getter now answers exactly that.

The planner keeps counting the scratch and the vote word in each
dispatch's total (bind::plan::compute: the arena from
RuntimeFact::SimdgroupEmulation, the vote beside it, the scratch rule
per region), so a dispatch whose threadgroup lengths fit beside the
reported length but not beside the scratch is refused
ThreadgroupMemorySize, the device's gap, where before the inflated
getter kept a well-behaved client from asking. The emulated tests
check both: region_k reports 0, a Metal client's remainder beside it is
refused at the most threads, and a region that fits beside the arena
and the scratch runs; barrier_k reports its own 31 KiB.

The compute-threadgroup-simd-scratch llvmpipe row goes. The runtime
getter's doc names the refusal. SEMANTICS_VERSION 1980 -> 1982 (1981 is
rows2's).

Verified: runs next (targeted translator tests, lavapipe replay).
(cherry picked from commit dd3d0a893bf900fbf11cb885f5fb9a7b7cfd9055)
2026-11-07 06:57:11 -08:00
Anees Iqbal def2c7f1d7 Re-derive the conformance coverage document after the ledger removals
python3 -I scripts/conformance-coverage/coverage.py: the ledger count
falls from 2619 to 2605 (the four attribute-stride rows, the three
slice-past used-size rows and the seven move rows), the slice-past row's
note follows the ledger, and the sparse families count the
allowGPUOptimizedContents call the move rows now make.

Found by tests::the_conformance_coverage_document_is_what_the_sources_derive
failing at fcfdf2bcb1 (job m3-max-3620, the only failure of 1,019).

(cherry picked from commit cc6e6740161cc876cfdf2f8ccc008088de24970b)
2026-11-07 06:26:54 -08:00
Anees Iqbal 91a95766bb Conformance ledger: lavapipe's extended-range blends read the half shadow beside the input attachment
With the shadow held over input attachments (and the input-form draws
kept for recording again), the lavapipe xr replay on msi (m3-max-3561,
at 43b2d2dd54; 109 xr-* cases) answers the 26 group-1 texel sites
exactly as the RTX 5080 does, and 22 of them as the M3 Max does (the
four xr-gradient-*blended* rows differ from the M3's by the device's
arithmetic, as the 5080's do):

- xr-gamut-bgra10xr-{over,straight}-{half,float}-{x1,x4}, the sRGB twins
  and the x4-stencil pair, xr-masked-bgra10xr{,-srgb}-rgb-over,
  xr-masked-bgr10xr{,-srgb}-red-over and
  xr-gradient-bgra10xr{,-srgb}-blended-{x1,x4}: each row's answer is the
  measured one, and its text the 5080's (the device's blend arithmetic,
  encode and resolve, in replay::NATIVE_NOTES or announced and
  declared), saying the function blends over the input attachment and
  reads and writes the shadow beside it in the interlock. None is our
  gap any more.
- The four notice rows of xr-masked-bgr10xr{,-srgb}-{red,blue-green} go:
  extended-range-blends-stored-codes is no longer announced, as the pass
  holds the shadow.

The gamut and masked cases' allowance docs no longer say lavapipe holds
no shadow. CONFORMANCE-COVERAGE.md regenerated.

Verified: the msi replay above (lavapipe, LLVM 23.1.1). The whole
replay on the homelab lavapipe (LLVM 23.1.4) runs next.

(cherry picked from commit cd910afb74e5faf67a0e6affdea77ced18205747)
2026-11-07 06:19:16 -08:00
Anees Iqbal 14e55e0c6c A reset compute pipeline descriptor is a fresh one: an accepted difference
MTLComputePipeline.h documents -[MTLComputePipelineDescriptor reset] as
"Restore all compute pipeline descriptor properties to their default
values", and maxTotalThreadsPerThreadgroup as "If it is not set,
returns zero". The runtime's reset is ComputePipelineDescriptor::new,
every field at its default. Metal's reset on the M3 Max (macOS 27.0.1)
keeps threadGroupSizeIsMultipleOfThreadExecutionWidth,
maxTotalThreadsPerThreadgroup and requiredThreadsPerThreadgroup as the
program set them (true, 96 and 8 by 6 by 2 in compute-descriptor-reset),
while the tile and mesh descriptors' resets restore every field on the
same machine. The owner's decision: the header's contract is Metal's,
and the compute descriptor's kept fields read as one release's defect.

docs/API.md section 10 (Kernels) states it. compute-descriptor-reset
loosens its five thread-shape sites to the runtime's default alone
(AnyOf the default, so Metal's kept value is still a divergence),
justified by that entry, and its five known-gaps rows go. A module test
holds the entry, the five paths and the defaults; the other two shapes
loosen nothing. CONFORMANCE-COVERAGE.md regenerated.

Verified: the conformance suite and clippy run on this branch next.
(cherry picked from commit 3dbd14b8fa45f6fcb836603b32aace527d009c0e)
2026-11-07 05:47:31 -08:00
Anees Iqbal f8ca661520 Conformance ledger: the RTX 5080's held sRGB reads, and its BGR10A2 held write runs
The 5080 replay at 3e5ef48250 (b5080 entry replay-r4-nv-043226, whole
suite, 1228 verdicts) reported three ledger mismatches beyond the 20
known ycbcr gather and minify sites:

- read-write-tier-held diverges at BGRA8Unorm_sRGB and RGBA8Unorm_sRGB
  (192 elements, largest 64919). The 5080 stores neither sRGB format,
  so the heap views a held texture through its UNORM alias and the
  function decodes by the MSL transfer through the device's Pow, as on
  lavapipe; srgb-texel-decode is announced for the case. Two rows, in
  the sRGB decode section, whose header now names both venues and the
  held alias read.
- norm-storage-fields-bgr10a2unorm no longer refuses hsw_held/dispatch
  on the 5080 (the heap's storage aliases, f4c1fbd170): its row goes.

The held BGR10A2Unorm texels match Metal on the 5080 (no row), and so
do the RGB9E5 attribute reads: the one RGB9E5 site left,
attribute-format-fetches' attribute3/Half2, is the listed half NaN
quieting of another attribute.

Verified: the replay output above; coverage regenerated with
scripts/conformance-coverage/coverage.py. Not verified: a 5080 replay
at this commit.

(cherry picked from commit e127ed348db352da2a4a4fa97fecd8f836ea867f)
2026-11-07 05:40:03 -08:00
Anees Iqbal 25b6686318 Regenerate CONFORMANCE-COVERAGE.md for the host-scoped lavapipe rows
bc3e17852b split five ledger rows by host (2619 to 2625 rows), which
conformance_coverage::the_conformance_coverage_document_is_what_the_sources_derive
caught (potluck job m3-max-3361). Regenerated with
scripts/conformance-coverage/coverage.py.

(cherry picked from commit a348cf1f29cacd026d796a2ecadae48fc70c8384)
2026-11-07 05:40:03 -08:00
Anees Iqbal 99c195f869 Conformance ledger: lavapipe's held read-write rows follow the heap's alias views
f4c1fbd170 lets the heap view a held RGBA8Unorm_sRGB, BGRA8Unorm_sRGB or
BGR10A2Unorm read-write texture through its storage alias. On lavapipe
(CachyOS, LLVM 23.1.4, 256 bits, job m3-max-3206 on homelab-gem10-1)
read-write-tier-held's three `beyond` rows now dispatch, and their
read-back, status, stored and stored-bytes sites are exact; only texels
differ, by the device's own answers:

- BGR10A2Unorm: 10 elements one f32 ulp low (Metal 0x3E48320D, ours
  0x3E48320C), the device's reciprocal product, device-texel-conversion,
  as the slot path's row of read-write-tier-round-trip-float says;
- the two sRGB formats: 219 elements, the largest difference 64921 bits,
  the MSL transfer through the device's Pow where Metal takes its
  twelve-bit table (Metal 0x3BB80B81 = 23/4095, ours 0x3BB7AD6D, the
  transfer of code 17), srgb-texel-decode, which the runtime announced for
  the case in that run, as did device-pack-conversion.

So the 18 refused and only-Metal llvmpipe rows go and three native-answer
rows take their place, and norm-storage-fields-bgr10a2unorm's llvmpipe
refusal at case/hsw_held/dispatch (the same heap write, refused the same
way) goes: that site now dispatches. The NVIDIA rows wait for a 5080 run.

The engine_heap_binder table test now allows FLAG_RED_BLUE and checks it
is set on the BGRA8Unorm member alone (it failed at f4c1fbd170: "other
flags are reserved", left 4). read-write-tier-held's allowance comment
says when unnamed-texture-unviewable fires now. CONFORMANCE-COVERAGE.md
regenerated.

Verified at f4c1fbd170 (the binary of this commit differs only in the
ledger and that test): 317 of 318 selected metal2vulkan tests passed, the
one failure the table test fixed here; the replay's unlisted and stale
sites for these rows are the ones this commit lists and removes.

(cherry picked from commit 3e5ef48250375a08ec2f9eadccae7a83481add6b)
2026-11-07 04:56:07 -08:00
Anees Iqbal e9b236a978 Pull a FloatRGB9E5 vertex attribute on every device
Lavapipe reports VERTEX_BUFFER for E5B9G9R9_UFLOAT_PACK32, so a
FloatRGB9E5 attribute went to fixed-function input there, and lavapipe
answered 0 in the fourth component (Metal and Vulkan both say 1) and
other values in the first three: vertex-format-float4 and -half4
differed in 32 (LLVM 21.1.8) or 38 (LLVM 23.1) elements by up to 65409,
and vertex-format-instance-step in its 12 fourth components.

The decision is now structural, made from the format, not the driver:
fetch_as pulls the shared-exponent format on every profile
(fixed_function_format). Vulkan requires no device to fetch it as vertex
input (Table 95, "Mandatory Format Support: 64-bit/uneven Components",
lists only sampled-image features for it), and its decode has no rounding
to leave to the device: each component m * 2^(e - 24) is an f32 and the
fourth is 1. So the module's own decode (lower::stage_io::fetch) gives
the answer a conformant fixed-function fetch gives, and lavapipe gives it
too. FloatRG11B10, the other packed float, stays fixed function: its NaN
widening is the device's.

The vertex-format sweeps now compile two modules where they compiled one
(the pulled format's), and the engine tests say so. SEMANTICS_VERSION
1977: a FloatRGB9E5 attribute's projection and module change. The three
RGB9E5 rows of known-gaps.tsv go (vertex-format-float4 and -half4 on
LLVM 21.1.8, -instance-step on llvmpipe); the LLVM 23.1 pair went in
613a98e22d. docs/API.md's vertex_input entry says it.

Verification: in the commit after this (Linux unit tests, lavapipe
replays on CachyOS LLVM 23.1.4, LLVM 23.1.1 and Ubuntu LLVM 21.1.8, the
5080 and the M3 Max).

(cherry picked from commit 6f2a6f3572b130db513bf457a9daf365ea241951)
2026-11-07 04:56:07 -08:00
Anees Iqbal 8623866704 Conformance ledger: unlist two product bugs this stream's rows recorded
A ledger row is right only where the divergence is the device's native answer (owner, 11-07:
"If its a failure, fix it. Dont sweep it under the rug"). Two sets of rows this stream wrote
record product bugs instead, so they go, and the bugs go back to the orchestrator:

- read-write-tier-held on the RTX 5080 (18 rows): we refuse the dispatch's bind state,
  `Unsupported(ArgumentBufferTextures, NotImplemented)`, for a read-write texture of a `beyond`
  format (`RGBA8Unorm_sRGB`, `BGRA8Unorm_sRGB`, `BGR10A2Unorm`) held in an argument buffer, which
  Metal round-trips. Runtime and translator work (a held read-write texture whose format the heap
  array cannot view).
- vertex-format-float4 and -half4's `FloatRGB9E5` attribute on lavapipe LLVM 23.1 (2 rows): the
  format reaches fixed-function vertex input as `E5B9G9R9_UFLOAT_PACK32`, and lavapipe answers 0
  for the missing fourth component (Metal 1.0) and decodes other elements wrongly; translator work
  (pull the fetch, or fill the component after the load).

The sites read as unlisted on those venues until the bugs are fixed. The same bugs' older rows
(lavapipe's read-write-tier-held, the "llvmpipe" and "LLVM 21.1.8" RGB9E5 rows) were not this
stream's and are handed back with them rather than removed here.

Verified: only those 20 rows are removed; docs/CONFORMANCE-COVERAGE.md regenerated.
(cherry picked from commit 613a98e22de81f35fb926228fc4534ddcd7e848b)
2026-11-07 04:56:07 -08:00
Anees Iqbal 25a0afe356 Conformance: rgb10a2-srgb's sample cases declare the decoded-tap filter's note
rgb10a2-srgb-samples-{nearest,linear}-{f,h} sample `RGB10A2Unorm_sRGB`, which no Vulkan format
holds, through a runtime sampler. The module does not know the slot's state, so it holds the
linear filter of the decoded taps whatever the slot's filter, and records that filter's sum as
the device's arithmetic (`lower::sampler::select`: a filtered access of a decoded form records
`PrecisionNote::BicubicFilterArithmetic` unless its sampler is a constant nearest one). Every
venue run announces `bicubic-filter-arithmetic` for the four cases (the M3 Max's ledger rows, the
RTX 5080 and both 256-bit lavapipe replays), and the cases declared it nowhere, so each read as an
undeclared notice: a test artifact. two_plane_samples declares the same note for the same reason.

The cases now declare it (a notice declaration: it loosens the notices site alone, so every
sample still compares exactly), and the M3 Max's four case/notices rows, which only restated it,
are removed. The module doc no longer says the cases carry no allowance.

docs/CONFORMANCE-COVERAGE.md regenerated: the ledger-row count goes from 2662 to 2658 and nothing
else moves, so the count development carries is the one its sources derive.

Verified by the replays that follow on the M3 Max (MoltenVK), lavapipe and the RTX 3090.

(cherry picked from commit ac79ff3f6a158bdb86a51b291c992436208005e5)
2026-11-07 04:56:06 -08:00
Anees Iqbal 0fe90ba3d4 Leave rgb10a2-srgb-samples' unclassified notice site unlisted off the M3 Max
rgb10a2-srgb-samples-{nearest,linear}-{f,h} announce `bicubic-filter-arithmetic`, which the
cases declare nowhere, on the RTX 5080 and both 256-bit lavapipe venues. The rows the two
earlier commits gave that site reused the M3 Max's text, which describes the format's value
conversions and says nothing of the notice; whether the cases should declare it or the note is
recorded wider than their accesses is not established, so the site stays unlisted there.

Verified: the 8 rows removed are the only rows of those cases' case/notices site outside the M3
Max; docs/CONFORMANCE-COVERAGE.md regenerated.

(cherry picked from commit e28a9842627a2b1c0291c488ec0e317cb17659ba)
2026-11-07 02:59:46 -08:00
Anees Iqbal 231972d92e Cite only the notes each venue's run announced in the new ledger rows
The fix2 replays print, for each failing row, the native notes its own run announced. Read
against them, 36 of the new rows cited a note the case did not announce on that venue:

- fetch-ordered-*-srgb on the RTX 5080 holds the attachment in the interlocked storage form, so
  its conversions are the module's (`device-pack-conversion`), not `srgb-texel-decode` and
  `device-color-conversion`; the row says so and leaves the per-write bound open;
- half-write-nans-*16f on the 5080 announces `native-nan-encoding`, not `device-nan-encoding`;
- integer-vertex-attributes cited `device-vertex-conversion`, which covers normalized fields only;
- vertex-format-half4's narrow-float NaN rows on the 5080 are `native-half-conversion` and
  `native-nan-encoding`;
- half-texel-nans-rg11b10f's rows on the 5080 and both 256-bit lavapipe venues cited
  `device-texel-conversion`, which none announced.

Verified: every note a 5080, LLVM 23.1.1 or LLVM 21.1.8 row cites that is one of
`replay::NATIVE_NOTES` is in that case's announced list in the venue's fix2 replay, but the
xr-gamut and xr-masked rows, which name each of the two blend-source notes for its own fill kind.

(cherry picked from commit 1f14597553913a62fbbce2c462577b25b0fd2a03)
2026-11-07 02:59:40 -08:00
Anees Iqbal b739f0a49a Scope the lavapipe ledger rows by LLVM and vector width
The generic "llvmpipe" rows were measured on the arm64 container's lavapipe (LLVM 21.1.8, 128
bits). CI's Ubuntu 26.04 lavapipe (amd64, LLVM 21.1.8, 256 bits) and msi's (LLVM 23.1.1, 256 bits)
answer otherwise at 79 of their sites, and 253 sites no lavapipe row named:

- a row a 256-bit venue no longer holds is re-scoped to the venues it does hold ("128 bits",
  "LLVM 21.1.8"), and each 256-bit answer gets its own row ("256 bits" where both 256-bit venues
  answer alike, else per LLVM). A row whose text states no number the new answer moves keeps its
  text; the rest get texts from that venue's first differing element: the half NaN families (the
  quiet bit set and the payload kept at 256 bits, a sign and payload, LLVM 23.1.1 dropping the
  half round trip), norm-storage-codes (the 128-bit text plus the case's NaN of each sign, which
  the two sides store at opposite ends of the format; Vulkan leaves a NaN's conversion
  unspecified), 3D samples on LLVM 23.1.1, and the RGB9E5 attribute row's counts;
- the extended-range, padded 10-bit, sRGB 10-bit, xr blend and two-plane families reuse the M3
  Max's venue-neutral texts (mechanism only, no site numbers); xr-planes alpha gets a lavapipe
  ties-to-even text; pixel-samplers-subnormal a digest-only text;
- the 14 compressed-blits-rg11b10f and -rgb9e5f rows are removed: the accepted difference
  `a-device-answers-as-the-class-of-mac-it-presents` now justifies those sites on every venue
  without lossless compression (313abb4b47).

The two sampler-mip clamp-float-max sites get no row: the next commit fixes them.

Verified: every new row is generated from the fix2 census's own paste rows at 2776dd8f06 on each
256-bit venue (site, expects and answer verbatim); a prediction against those censuses leaves 2
sites unlisted (the sampler-mip ones) and no stale row on either venue. A replay at this tree on
both venues is what proves it. docs/CONFORMANCE-COVERAGE.md regenerated.

(cherry picked from commit a1dd53b33b5676b46fdc7654de060ccc8ab0d239)
2026-11-07 02:59:24 -08:00
Anees Iqbal f98735bbdb List the RTX 5080's native-arithmetic divergences in the conformance ledger
886 rows for "NVIDIA GeForce RTX 5080 Laptop GPU", each a site the whole-suite replay on the
5080 (NVIDIA 615.71.09, exact policy, at b982d02d53) reported as divergent or refused and the
ledger did not list, each with the class it was triaged into and the note that records it:

- device NaN encodings (half NaN 0x7FFF, float 0x7FFFFFFF, small-float all ones; gathers of NaNs
  and denormals) under device-nan-encoding, native-nan-encoding, native-half-conversion and
  device-texel-conversion, whose documentation already names this device's encodings;
- BC decode against compressed-texel-decode's NVIDIA bound (covered, or past the colour bound and
  named as open, or not established for an sRGB form's decoded value);
- packed 16-bit texels widened by bit replication (device-texel-conversion's 0.18-code bound);
- 8-bit unorm stores a code apart near a tie (fragment outputs, storage writes, fills, a2c
  targets) under device-color-conversion, which states the 5080 stores 0.5 as 0x7f; each
  norm-storage-codes texel holds one value in four channels, so the largest word difference
  bounds every channel at one code;
- attributes read as half keeping the float, NVIDIA folding the conversion pair
  (native-half-conversion, DriverWorkaround::HalfConversionPairFolded);
- the nearest mip level at a halfway clamp (device-sampling states the shape);
- filters, 3D samples, pixel samplers, downscales and resolves through the device's own units,
  whose bounds are measured on lavapipe and MoltenVK and not on this device: those rows say so
  and name the bound as open;
- read-write-tier-held's refusal, the same open runtime work lavapipe's rows name.

The 80 xr rows and 191 rows reusing venue-neutral texts of the M3 Max's rows are among them.
Sites that the accepted-difference slug fix and the two shared-memory declarations remove
(fresh-*, compressed-blits-*, xr-clear-routes-*, buffer-textures-stride-below-the-row,
format-footprints-plain-stragglers) get no row. ycbcr-gathers-* and ycbcr-minify-band-* (20
digest-only sites) stay unlisted: their class is not established, and the YCbCr notes are
another stream's work.

Verified: the rows are generated from the 5080 census's own paste rows (site, expects and answer
copied verbatim), each text from the site's first differing element in that run; a replay at
this commit on the 5080 is what proves they hold. docs/CONFORMANCE-COVERAGE.md regenerated.

(cherry picked from commit 0bf9ec15eac473fa19002a218ec2978f2e7a1f0f)
2026-11-07 02:59:12 -08:00
Anees Iqbal ffbfb8631d Bump SEMANTICS_VERSION to 1974 and regenerate the conformance coverage at stack 37's picks
Three picked branches each moved SEMANTICS_VERSION from 1972 to 1973 on their own: runtime sampler
slots' filter notes now carry a test of the bound sampler word; an object function's barriers
are predicated so a partial object threadgroup runs as Metal's; and extended-range partial masks
and unwritten padded or bfloat attachments link. Together their outputs differ from any one
branch's at 1973, so the version moves once more. docs/CONFORMANCE-COVERAGE.md is regenerated
from the merged sources and recordings (the picks' conflicts kept the earlier text).

Verified: conformance-coverage --check, signatures.py --check and refusal_surface.py --check pass
on this tree; metal-coverage is current.
2026-11-05 21:15:23 -08:00
Anees Iqbal e10552b553 Re-record the mesh limits cases on the M3 Max, time every new case, regenerate the coverage document
What: the 17 mesh-limits cases' Metal answers and M3 cost bounds over the
trimmed fixture, the timings of all 34 new and re-recorded cases (times
--write, both legs; the host's load was above the gate's 26, so the
verdict is to be re-read on a quieter host), docs/CONFORMANCE-COVERAGE.md
(MTLMeshRenderPipelineDescriptor 27 of 27 items compared, the
MTLRenderPipelineState getters 18 of 22), and the golden and inventory
rows of the trimmed fixture.
Why: the fixture's AIR changed; the suite's own tests ask each case for
its cost and timing records.
Verified: M3 jobs m3-max-2732 (bless, 155 touched translator tests pass)
and m3-max-2737: replay on MoltenVK of the 34 cases, 29 exact, 4
announced (the partial-barrier draws' emulation notices), 1 refused as
known-gaps.tsv expects (mesh-limits-amplification-2), exit 0; the
conformance crate's 1023 tests pass.

(cherry picked from commit d8031c15692c56abc40b3c6fc80579091bbfb680)
2026-11-05 21:13:16 -08:00
Anees Iqbal 570df3cc95 Answer maxArgumentBufferSamplerCount from the set-1 sampler array and the sampler limit
What: `DeviceProperties::max_argument_buffer_sampler_count`, Metal's
`maxArgumentBufferSamplerCount`: one fewer than the smaller of a set-1
sampler array's elements and the device's maxSamplerAllocationCount
(element 0 of the array, and one of the device's samplers, are the
neutral sampler's; each state the array holds takes an element and a
sampler of its own). The array's elements are a new public translator
function, `pipeline::heap_sampler_capacity`: link's heap capacity for a
heap of one sampler array with set 0 counting no sampler, the least of
the handle table's 65536 entries (TABLE_CAPACITY) and the two
update-after-bind sampler limits, 0 where a function cannot read a set-1
sampler array (the layout's features or the module's non-uniform
sampled-image indexing). Link's heap_capacity now reads the same limit
table (`heap_limits`) and arithmetic (`room`), and heap_set the same
layout-feature check (`heap_layout_lacks`), so the sizing and the answer
cannot drift. The runtime's `Device::sampler_array` (each state's
creation-time check) now calls it too: it was the two update-after-bind
limits without the handle table's reach, 500000 on MoltenVK where link
makes 65536 elements, so a state past 65535 was not announced as it was
made. The device's SamplerCount and the answer read one value, the
identity's maxSamplerAllocationCount.

Why: the consumer computed it as the least of the two update-after-bind
sampler limits and maxSamplerAllocationCount; that misses the handle
table's reach (500000 against our 65535 on the M3) and the neutral's
element (32768 against 32767 on lavapipe, 4000 against 3999 on NVIDIA).

Metal on the M3 Max (macOS 27.0.1) answers 500000 (a Swift query of
MTLCreateSystemDefaultDevice, potluck job m3-max-2496), recorded in the
field's docs and docs/API.md's accepted differences.

Tests: engine_handles::an_argument_sampler_array_has_the_heap_sampler_capacity
(link's array equals the function on every committed profile, follows
lowered limits, 0 without the features); capabilities::
argument_buffer_samplers_are_one_fewer_than_the_array_and_the_sampler_limit
(every committed profile, pinned venue values); the device test
argument_sampler_count (the kernel's array, the device's count, the
driver's limit and the answer agree; elements-1 states unannounced, the
next announced). Verification follows in the branch's report.

(cherry picked from commit 7a2b84f15a1dde81e35cbc0b9367962e54d8332f)
2026-11-05 18:59:21 -08:00
Anees Iqbal 7d813def6f Regenerate the derived tables at stack 35's picks
The private-doc-link mend shortened the degradations! macro's note link and a refusal's doc link
to in-scope paths, which moves the macro's template in api_signatures.tsv and one row of
docs/REFUSALS.md; no item's signature changed for a consumer. The mesh change runs a partial object
threadgroup, so the two mesh-object-draws-partial-threadgroup cases leave the conformance ledger
(1378 rows to 1376) in docs/CONFORMANCE-COVERAGE.md, whose conflict the pick resolved to the
earlier text.

Verified: signatures.py --check, refusal_surface.py --check and conformance-coverage --check pass
on this tree; metal-coverage is current.
2026-11-05 17:14:20 -08:00
Anees Iqbal c305c66a7f Give mesh pipelines Metal's descriptor limits, state queries and refusals
The mesh descriptor gains Metal's fields, with Metal's defaults:
max_total_threads_per_{object,mesh}_threadgroup, max_total_threadgroups_per_mesh_grid,
the two threadgroup-size-is-multiple-of-width flags, payload_memory_length,
max_vertex_amplification_count (1) and required_threads_per_{object,mesh}_threadgroup. The
descriptor key reads every one.

A compiled mesh pipeline carries MeshPipelineMetalInfo (RenderPipeline::mesh_info), and the
runtime's RenderPipelineState answers Metal's five mesh queries from it, plus the two required
sizes. Each thread limit is the descriptor's maximum, else the function's
[[max_total_threads_per_threadgroup(n)]], else 1024, held to the device's own limit where that is
lower: the task and mesh stages' invocations with VK_EXT_mesh_shader, the compute stage's where
both stages run as compute work. The widths are 32. The grid limit is the descriptor's, else the
object function's [[max_total_threadgroups_per_mesh_grid(n)]], else 2^20, held to
maxMeshWorkGroupTotalCount where mesh functions run natively. Without an object function the
object stage answers 0 and 0, where the M3 Max answers 3 and 32 (an accepted difference).
DeviceProfile::emulates_mesh_shading says how a device runs the stages, so a consumer no longer
copies the compile layer's rule; with the getters, no separate per-stage query is needed.

What Metal refuses is refused as Metal's rule, DescriptorError::MeshPipeline with a
MeshPipelineProblem, measured on the M3 Max (mesh_pipeline_limits.m, plain and under
MTL_DEBUG_LAYER): a required size with an axis of 0, past 1024 threads or past its stage's
maximum, or for an object stage without an object function (process ends); a maximum past 1024,
a function maximum other than the descriptor's, a mesh stage's required size of other threads
than its maximum, and a payload past 16384 bytes (creation errors, codes 3 and 2). An
amplification count of 0 is VertexAmplificationCount, as a render pipeline's; one above 1, which
Metal makes, is NotImplemented(VertexAmplification), recorded in FAST-PATHS' known gaps.

payloadMemoryLength widens the object and mesh functions' payload arena past the declared type
(LoweringInputs::object_payload now reaches the object stage too); an object stage compiled on
its own without it is NeedsInput(ObjectPayload). SEMANTICS_VERSION 1971 and
ARTIFACT_FORMAT_VERSION 488 for that and the new artifact field; the runtime's warm record
format 4 for the descriptor's fields.

Docs: the new_mesh_render_pipeline_state doc now says how each device runs mesh stages, and
what it refuses; API.md's accepted differences gain the mesh pipeline rows. api_signatures
blessed (it also records RuntimeFact::PartialObjectThreadgroups from the partial-threadgroup
commit), api_surface lists MeshPipelineMetalInfo and MeshPipelineProblem, REFUSALS.md,
METAL-COVERAGE.md and CONFORMANCE-COVERAGE.md regenerated.

Tests: engine_mesh's a_mesh_pipeline_answers_metals_mesh_queries_within_the_device and
a_mesh_descriptor_metal_refuses_is_refused_as_its_rule over every committed mesh and
emulating profile; the validation lane's
a_mesh_state_answers_metals_queries_and_refuses_what_metal_refuses on a device. Not yet built:
the next steps are the M3, lavapipe and RTX 5080 runs.

(cherry picked from commit d6934967fad363ca2185c49935204141f253b416)
2026-11-05 17:12:37 -08:00
Anees Iqbal 81d45b6d40 Conformance: ledger rows for the wide-gamut cases on the RTX 5080
The RTX 5080 Laptop replay of the 32 cases (NVIDIA, b5080 batch m3-max-1762, binary at
aa91079622) made every pipeline and ran every case. The linear unwritten and masked cases match
Metal code for code; the rest differ at their texels in the families the MoltenVK rows name, in
the same shapes (the blend over the half shadow in the pixel interlock at one sample, the blends
over stored codes and the runtime's resolve at four, the sRGB twin's encode through the device's
Pow): a code from Metal's for the linear form, up to three for the sRGB twin at four samples.
26 rows, venue NVIDIA GeForce RTX 5080 Laptop GPU, in the MoltenVK rows' words.

The run's other gap, dont-care-store announced by the depth-only unwritten pipeline, is the one
46ff85e725 already declares (that binary predates it).

docs/CONFORMANCE-COVERAGE.md regenerated.

(cherry picked from commit 0f5ffdf4b634171cfcbecc386a58942f9002dd34)
2026-11-05 13:14:42 -08:00
Anees Iqbal 38210e8938 Conformance: the wide-gamut cases on lavapipe, declarations and ledger rows
The lavapipe replay of the 32 cases (llvmpipe, LLVM 23.1.1, job m3-max-1679) made every
pipeline, the four-sample ones included, and announced two notices the cases did not declare:
extended-range-blends-stored-codes at one sample too (lavapipe blends over the input attachment,
and the half shadow is built only for passes fetching in the pixel interlock), and
dont-care-store for the depth-only unwritten pipeline (its pass stores depth DontCare). The
blended draws and the blended masked write now declare the first, the depth-only unwritten
cases the second; each loosens the notices site alone.

26 llvmpipe rows for the texel sites: the linear blends a code from Metal's, the sRGB twin up
to three (four under the color mask), each saying which notes record it and what is open (the
half shadow over an input attachment and at four samples; the stored-codes note's stated code
does not cover an sRGB twin). The linear unwritten and masked cases match Metal on lavapipe.

The translator test's note on lavapipe at four samples now says what it is: the committed
profile states framebufferIntegerColorSampleCounts of one and no per-format count, so the
profile refuses; the device itself renders them (this replay).

docs/CONFORMANCE-COVERAGE.md regenerated.

(cherry picked from commit 46ff85e7254d5626292ad8e906c484b7c94d4bcf)
2026-11-05 13:14:42 -08:00
Anees Iqbal 0f04983d25 Conformance: ledger rows for the wide-gamut cases' MoltenVK texel differences
26 rows, venue Apple M3 Max, one per texel site the MoltenVK replay of the new cases left
unlisted (job m3-max-1657). Each says whose answer moves the codes:

- linear BGRA10_XR at one sample: the shader's blend over the half shadow in the device's
  float arithmetic (extended-range-blend-source / -float-blend-source), one code;
- linear at four samples: the same, plus the blends over stored codes and the runtime's resolve
  (extended-range-blends-stored-codes, extended-range-resolve, both announced), one code; open:
  the half shadow is single-sampled;
- the sRGB twin: the same plus the encode through the device's Pow (device-pack-conversion),
  one code at one sample and up to three at four, which extended-range-resolve's measured
  bound covers; the unblended sRGB rows take the existing sRGB-twin family's words.

The linear unwritten and masked cases need no row: they match Metal code for code.
docs/CONFORMANCE-COVERAGE.md regenerated (`scripts/conformance-coverage/coverage.py`).

(cherry picked from commit aa9107962298198722825148379784d1f5b546cc)
2026-11-05 13:14:41 -08:00
Anees Iqbal 4f32162f99 Regenerate the conformance coverage document for stack 28's cases and recordings
The coverage document is generated from the suite's sources and recordings; the stack's picks
each regenerated it on their own base, so it is derived again here once over all of them.
Verified: python3 -I scripts/conformance-coverage/coverage.py --check reports it as derived.
2026-11-05 02:09:58 -08:00
Anees Iqbal 95859dac16 Regenerate the conformance coverage document for the composited row
python3 scripts/conformance-coverage/coverage.py over the tree with
pass-start-barrier-private-composited's recording: one more recording, case and Metal-run answer,
and the Metal items the row reaches counted once more.

(cherry picked from commit 0147b3a386081175dfaffa7c72513efac6def034)
2026-11-05 02:08:34 -08:00
Anees Iqbal 215a9f7583 Time the pass-start barrier family on the M3 Max, and count it in the conformance coverage
What: `conformance times --runs 8 --write` over the 13 pass-start-barrier cases keeps both
legs' figures in their recordings, and docs/CONFORMANCE-COVERAGE.md is regenerated
(scripts/conformance-coverage/coverage.py): 1141 recordings in 153 case modules, and
`MTLBarrierScopeRenderTargets` now compared.

Why: `times::every_case_carries_its_timing` holds every case to a timing record, and the
coverage doc is derived from the recordings and the suite's sources.

How verified: potluck job m3-max-37 on the Apple M3 Max, debug build, exit 0: 13 cases carry
their timing; 4 within 10x, 9 unmeasured because our leg announces render-pass-split (and the
display row two more), so its work is not Metal's. The host's load was 188 while Metal's leg
ran, so the margin is reported, not judged. coverage.py --check passes.

(cherry picked from commit 8ce6ed8262789fb7887794bb7073eb63dbed249e)
2026-11-04 21:54:22 -08:00
Anees Iqbal 9e698176bc Record what Metal does with a wait whose signal is already running
What: a conformance case, event-wait-behind-a-running-signal, in the event_orders family, with
two rows, one for MTLEvent and one for MTLSharedEvent. Queue A's command buffer runs 192 fills
of 256 MiB into a private buffer, then signals a companion shared event at 1, then the event
under test at 1. Queue B's command buffer waits for the event at 1, then fills 256 shared bytes.
A is committed, then B. RUNNING_WINDOW (20 ms) later the case reads B's status and handlers,
the shared event's value, A's status, and last the companion. A companion still at 0 proves the
signal had not landed by any of those reads, since one command buffer's signals land in order.
A run whose companion reads 1 records only that fact, so it differs from an answer rather than
passing as one. B's Scheduled status is the proxy for "submitted, and so checked"; the case's
docs say so.

Why: reims's platform sets a submission check on every command buffer, and the runtime holds a
checked head until each value it waits for has landed. checks.rs justified that with "Metal
submits the submission, and checks it, once the signal happened", which nothing had measured.
event-cross-queue-wait reads a waiter only while its signaller is not yet committed, and
event-held-command-buffer only while only the host can raise the event.

Metal's answer, recorded on the M3 Max (macOS 27.0.1): 5 of 5 runs identical, and the
validated leg ran.
- MTLEvent: B reads Scheduled with its scheduled handler run while A still reads Scheduled and
  the companion reads 0. Metal submits it at once, with the wait on the GPU.
- MTLSharedEvent: B reads Committed with no handler run, signaledValue 0, A Scheduled. Metal
  holds it until the signal lands.

The fills measured 156 to 163 ms of GPU time on the M3 Max (a throwaway Metal probe,
GPUEndTime less GPUStartTime, three runs), so the read falls about eight windows before the
signal.

Our side replays divergent on the M3 (MoltenVK) on the plain row: B still reads Committed at
20 ms. A's vkQueueSubmit takes 10 to 27 ms there, in MoltenVK's encoding of our fills by
transfers. A later commit reduces that.

(cherry picked from commit 2efae5489b87b0c37603d1c5e7b51a5222a49414)
2026-11-03 16:16:40 -08:00
Anees Iqbal 61a9508e92 Build visibilityResultType: Accumulate takes a pass's results into the buffer's words
RenderPassDescriptor gains visibility_result_type (MTLVisibilityResultType: Reset, the default
and today's behaviour, and Accumulate). Under Accumulate no query result is copied over its
offset's word: every query of an offset, the first one too, is copied into the upload region the
continuations already use, and the crate-owned combine takes them into the word as the buffer
holds it. The combine already loaded the destination word as its accumulator, so Accumulate is
the first query becoming one more source. A `Boolean` word ORs the device's results in; a
`Counting` word is summed in through a new table mode of the combine, into the word's low 32 bits
alone, wrapping there, its high 32 bits kept (ContinuedResult::low_half / in_low_half). That last
part is what the M3 Max answered when recorded: 0xffff_fff8 plus 16 samples writes 8, and
0xffff_ffff_ffff_fff8 plus 16 writes 0xffff_ffff_0000_0008. A plain 64-bit sum was divergent there.
An offset set with no draw after it keeps its word, because a query with no draw adds 0. Where a
no-copy buffer's bytes start off a multiple of 8, so the results land in an upload region, the
words are now copied into that region before the combine (Landing::inward). Reset records exactly
what it did before.

Conformance: RenderPass gains visibility_type (typed()), and words() appends it only where it is
not Reset, so existing fingerprints read as before. Both sides set it. There are four new
visibility cases, recorded on the M3 Max (macOS 27.0.1): visibility-counting-accumulate (two
command buffers; words 100/5/7/0xffff_fff8/u64::MAX-7), visibility-counting-accumulate-one-command-buffer
(two passes in one command buffer, read once), visibility-counting-accumulate-revisit, and
visibility-boolean-accumulate (words 0/2/3 under covering and non-covering draws, an offset set
with no draw, then a second command buffer). The family's acts key states the type, and a joined
shape adds a command-buffer input. Cost and timing records for the new cases are not written here.

Lane tests (runtime_lane): accumulated_counts_add_to_the_words,
accumulated_booleans_or_into_the_words, and
host_bytes::accumulated_visibility_results_land_where_their_bytes_lie. Unit tests: the combine's
accumulated_counts_are_summed_into_the_low_half, its plan's table mode, and the type's raw values.

Coverage: coverage.tsv marks MTLRenderPassDescriptor.visibilityResultType implemented (its unused
"visibility" group is removed), and METAL-COVERAGE.md is regenerated. MTLVisibilityResultType joins
the enum table, so metal_enumerators.tsv and CONFORMANCE-COVERAGE.md are regenerated. The API
signatures are re-blessed. REFUSALS.md is regenerated: VisibilityResultType::from_raw is one more
UndefinedValue site. The regeneration also picks up two bind/graphics.rs sites the committed file
was missing. The degrade docs (landed results, Boolean) state Accumulate.

Verified on the M3 Max under MoltenVK 1.4.2:
- The 52 visibility-touching lane tests pass: visibility, host_bytes, depth_never, amplified_draws,
  degrade_notices and the framebuffer_fetch split pass.
- The visibility family's replay is all announced (no divergence), after the low-half change.
- Negative control with Accumulate forced to Reset: all three Accumulate lane tests fail, and all
  four new cases replay divergent.
- Negative control with no inward copy: the landing test fails at 4 bytes past a page (2 read 0,
  100 read 16).
- Before the low-half change, visibility-counting-accumulate replayed divergent at words 3 and 4.
- The combine's low-half test fails on the interpreter without the high-half select ([8, 1] for
  [8, 0]).
clippy (plain and --cfg m2v_gpu), rustdoc and scripts/api-docs are clean.

SEMANTICS_VERSION: no translated shader changes, but the owned combine module's words do
(main's call). RUNTIME_VERSION and the runtime-sources pin are not touched here.

(cherry picked from commit 1c172968ad6492cebcae2a568fc99e90565d4d11)
(cherry picked from commit 9f47ebcf006920f7561a16a77f77e422de7201c1)
2026-11-03 11:08:01 -08:00
Anees Iqbal d806c0a792 Write Boolean visibility results as the device's nonzero query result, without the resolve
Metal's Boolean visibility result is nonzero where any sample passed and 0 otherwise. The
Apple M3 Max writes 1; Metal on the AMD Radeon Pro 5300M and the Intel UHD Graphics 630
(macOS 26.7.1, the reims-vgpu team's probes) writes the samples that passed. The runtime
had a crate-owned dispatch (bind::visibility_resolve_module) after every pass with a
Boolean offset whose only job was to rewrite that word to exactly 1. Under AGENTS.md rule
1 the device's native answer is the only form: a Boolean result is now the imprecise
occlusion query's own result, which Vulkan states as "When any samples are passed,
boolean queries will return a non-zero result value, otherwise a result value of zero is
returned" (occlusionQueryPrecise). Across a split pass's render pass instances the
combine still ORs the continuations, so zero stays zero exactly where no instance passed
a sample. Counting queries stay precise.

- Runtime: the resolve's plan, uploads, sets and dispatch are gone from visibility.rs, and
  OwnedModule::VisibilityResolve from owned_kernel.rs. A pass with no continuation now
  records only vkCmdCopyQueryPoolResults. The combine's in-place words are declared as
  shader reads and writes for every combined offset (they were declared only for Boolean
  ones). A new precision degradation, DeviceBooleanVisibility
  (device-boolean-visibility), is announced where a pass's Boolean results record; its
  catalogue entry is in docs/API.md section 9 and a device-gaps row in docs/FAST-PATHS.md,
  as for the other native-answer kinds.
- Translator: bind/visibility_resolve.rs and its tests are deleted (VisibilityResolve,
  VisibilityResolveModule, visibility_resolve_module leave the public surface). Its
  shared helpers (windows, words_buffer, u32_value) move into visibility_combine.rs; the
  combine's plan tests take the two refusal cases only the resolve's tests held. No
  translation output changes.
- Conformance: a new Loosening::Nonzero, and an allowance may name one element of a byte
  region as <site>/<byte offset>. The visibility family loosens each Boolean result's word,
  and only that word, by Nonzero, justified by device-boolean-visibility, which its Boolean
  cases also declare at the notices site. Every other word still compares exactly. No
  recording changes. README and docs/CONFORMANCE-COVERAGE.md (regenerated) say so.
- Validation lane: every Boolean expectation reads the word by its contract
  (visibility::by_contract: nonzero and not the buffer's starting word reads as 1), in
  visibility, framebuffer_fetch, host_bytes, depth_never and amplified_draws; the notice
  is a new lane site (visibility::BOOLEANS) taken by
  boolean_results_announce_the_device_s_value and expected where other tests' notice sets
  are exact. boolean_results_are_copied_with_no_dispatch counts one query result copy and
  no vkCmdDispatch for a pass of two Boolean offsets.

Verified: cargo clippy --workspace --all-targets --all-features -D warnings with
--cfg m2v_gpu; the runtime's degradation catalogue and site tests, the translator's
combine, owned-division, resolve-helper users', api_surface and api_signatures tests;
the conformance suite's 1024 device-free tests. The device lane tests run on the M3 with
the next step.

(cherry picked from commit a4976cdc3734c21c1b9ed4cf603bbf6bab2523f0)
(cherry picked from commit 34e44e3a12a46e6ff4b651cc4689002690d680fc)
2026-11-03 11:08:01 -08:00
Anees Iqbal 53e2a6be78 Complete a command buffer that needs no GPU work without submitting it
What: a command buffer whose encoders recorded nothing and whose one batch waits for and signals
no event and no binary semaphore (so presents no drawable) is taken by the scheduler with no
vkQueueSubmit (State::needs_no_gpu, decided from what it recorded), once it leads its logical
queue's line, no group is held and no first work of the device's waits (that still rides in it,
as before). Everything else its last batch's taking does is kept: kernel times, scheduling (by a
hang's thread where one makes it), submission handlers, heap tickets, own textures, holds. Its
batch is watched at its VkQueue's last submitted value (Completion::watch_unsubmitted), so it
completes in its queue's order, after the work submitted before it, from the turn that finishes
that work. Where its queue reached that value already and no turn is under way, no waiter is
woken: the thread that took it (the scheduler's after its round's submission handlers, or a
thread about to block, after its pass) makes the turn once it holds no lock
(Completion::turn_owed), running only the transitions a thread there may run. A turn no longer
wakes a parked waiter whose queue it emptied (it has nothing to arm for; the next watch or a stop
wakes it). New WorkCounts: command_buffers_unsubmitted, completion_turns_where_taken. GPU-time
placement is unchanged (NoWork: a point at the later of its kernel end and its queue's latest
end), which the new conformance case shows matches Metal's booleans.

Why: the consumer commits empty command buffers as sync points; each was a vkQueueSubmit, a
waiter wake and a turn. Metal completes them without its GPU (M3 Max, macOS 27.0.1: idle, commit
and wait 15 us p50, GPU interval 0 to 0.3 us, 1 to 9 us after kernelEndTime; behind a fill,
after the fill, 65 to 135 us after its GPUEndTime).

Conformance: new case empty-command-buffers (statuses in handlers and after the wait, the four
timers' signs and orders, GPU interval one point, behind a 64 MiB fill: completed-handler order,
the fill's status in the empty one's handler, kernel and GPU times against the fill's), recorded
on the M3 Max (5 of 5 runs identical), cost and contrast and times written; replayed on the M3
Max over MoltenVK: announced (only gpu-times-from-host, declared). completion_turns_where_taken
is reported, not gated (which thread made the turn is a race with the GPU); the M2 handler
counters are classified with the submission region. Coverage doc regenerated.

The lane test empty_command_buffers_submit_no_command_buffer becomes
empty_command_buffers_make_no_submission (0 submissions, 8 unsubmitted).

Verified on the M3 Max (MoltenVK 1.4.2), --cfg m2v_gpu: tests::unsubmitted (3 tests; idle: 81
unsubmitted, 0 queue submissions, 40 of 40 waited ones finished by the taker, 0 waiter wakes);
negative control with the path disabled: 0 unsubmitted, 81 submissions, 40 waiter wakes, both
empty tests fail. The whole runtime GPU suite: 1506 of 1507, the one failure
video_interop::a_raw_submission_is_ordered_by_a_shared_event_s_semaphore read its event's
signal already Reached under the full suite's load, and passed 6 of 6 alone (its command buffers
wait and signal, so never take this path). The conformance crate's tests 1010 of 1010; clippy
(workspace, all targets and features; and runtime + validation under --cfg m2v_gpu) clean.
Not run here: the validation lane tests (commit_work, first_use, gpu_times) and lavapipe.
Owed on development: conformance cost bounds of cases with empty command buffers now read fewer
queue_submissions and a nonzero command_buffers_unsubmitted (a re-bless).

(cherry picked from commit 304bdd2a24e31f7aeb3045e33b9d21209ca7df97)
2026-11-02 22:30:22 -08:00
Anees Iqbal 4b194d24af Write Metal's encoding through compressed BGRA10_XR blits under an exact-answers switch
What: a new DevicePolicy switch, `extended_range_blits` (ExtendedRangeBlitPolicy::Kept, the
default, and ::Canonical, which `exact_answers()` selects). Under Canonical a blit or fill through a
BGRA10_XR or BGRA10_XR_sRGB texture Metal keeps losslessly compressed writes Metal's canonical
encoding: each 16-bit field's low six bits cleared and, for a blit, the alpha code clamped to
[384, 894].
- bind::extended_canonical_module, a compute kernel that rewrites a texel range's words in place
  (bind/extended_canonical.rs, with extended_range_canonical as its reference and interpreter
  tests); the runtime owns it as OwnedModule::ExtendedCanonical.
- The runtime (extended_canonical.rs): after a blit into such a texture, or out of one into another
  texture of the format, the written regions go out to a scratch buffer, one dispatch per region
  rewrites them, and they go back; after a blit out of one into a buffer, or into a texture over a
  buffer's bytes, one dispatch rewrites the words in place at the layout's rows. A fill's texel is
  encoded before it is written (fills clear the low bits alone: Metal's fill keeps alpha codes 4
  and 1023 on the M3 Max under 27.0.1). A buffer the device cannot bind (offset or pitch off 4,
  past maxStorageBufferRange) or a texture over a buffer whose rows share bytes keeps the bytes and
  announces extended-range-bits-kept, as under Kept. Under Canonical the note is not announced for
  the blits it makes exact.
- copy_from_buffer_to_texture's body moved into buffer_into_texture, which a fill's row copies call
  with Writer::Fill (so a fill announces its own wording and is never rewritten as a blit).

Why: Metal's GPU blits through the compression rewrite these bits (measured on the M3 Max under
macOS 27.0.1, plain Metal, xr_matrix: compression iff allowGPUOptimizedContents, shorter side >= 16,
neither ShaderWrite nor PixelFormatView usage; every storage mode alike; CPU copies keep the bytes;
fills clear the low six bits only). The device's copy keeps the bytes. It is the runtime's choice,
not a native answer (no device arithmetic is involved: a copy's bytes), so per rule 1 the fast form
stays the default and the exact form is the switch.

Ledger: FAST-PATHS row (fast defaults), API.md section 1 bullet and the extended-range-bits-kept
catalogue entry, the Degradation doc, the conformance Policy doc. Known gaps: the 28 rows of
compressed-blits-bgra10xr and -srgb (7 sites x 2 formats x Apple M3 Max and llvmpipe) dropped:
under the suite's exact policy those sites now hold Metal's bytes.
RUNTIME_VERSION 1728 -> 1731 (a run under the exact policy writes other bytes).

Also fixes forward a clippy needless borrow in engine_arith's pack test (7a99b93af2).

Verified (M3 Max, macOS 27.0.1, MoltenVK 1.4.2; and lavapipe in scripts/linux-gate, arm64,
LLVM 21.1.8 128 bits):
- runtime_lane::compressed_blits on MoltenVK: both tests pass; the new
  extended_range_blits_write_metal_s_encoding_under_the_canonical_policy checks every direction,
  level 3 into padded rows, Shared CPU/blit mixes, texture to texture both ways, a fill of a
  compressed and a plain texture, and a copy into a texture over a buffer with padded rows, under
  both values (Canonical: Metal's bytes and no notice; Kept: the bytes and the notice once).
- conformance replay of the four compressed-blits cases on MoltenVK: exit 0, the ledger as
  edited (bgra10xr and -srgb `announced` only for staged-texture-copy/shadowed-texture).
- the full `conformance replay --cpu` on lavapipe at 68074019a3 and at this change: the only
  difference is the 14 llvmpipe sites of the two XR cases, which no longer diverge (divergent
  244 -> 242, exact 458 -> 460); the 265 other ledger mismatches of that arm64 venue are the same
  at both (it is not CI's amd64 lavapipe).
- 154 touched validation lanes on MoltenVK (blits, fills, extended-range, NaN, pack, padded,
  rotated, no-copy, two-plane heap): 143 passed, 10 failed, 1 ignored; the same 10 fail with the
  same messages and the same differing texels at 68074019a3 (pre-existing).

(cherry picked from commit 612ff50b86bc29515b158d9b2596b14a45431467)
2026-11-02 13:13:17 -08:00
Anees Iqbal 575ac2b103 Read a pixel-coordinate sample's texel as Metal's sampler does
A `coord::pixel` sampler handed the device the coordinate divided by the texture's size. At a
texel edge whose quotient is inexact the device's normalized sampler read the texel before it:
on the consumer's 258x258 matrix 28 of 1042 nearest clamp-to-zero and clamp-to-border cells on
MoltenVK and up to 500 on an RTX 5080. Metal reads `floor(x)` for nearest and quantizes `x - 0.5`
to its 1/256 grid for linear filters and gathers.

Now, decided from the sampler's state and the access's structure:

- A constexpr pixel sampler that Vulkan's unnormalized sampler can state (one filter, no mip
  filter or anisotropy, clamp to edge, zero or border; a 1D or 2D non-array image, no comparison,
  no status read) samples and gathers through the device's own unnormalized sampler at the
  coordinate itself, on a view of level 0 (`CombinedSampler::unnormalized`,
  `SamplerDesc::unnormalized`). A linear sample's or gather's constant offset folds into the
  coordinate; a nearest sample's offset is applied to its texel's centre (`floor(x) + 0.5 + k`).
- A constexpr nearest pixel sampler the unnormalized form cannot take (an array, a mirror mode)
  samples at its texel's centre over the size, `(floor(x) + 0.5) / N`, which the device's
  normalized sampler reads as that texel exactly.
- A runtime slot's sampler takes the centre where a new pipeline constant,
  `SpecKey::NearestPixelSampler`, says the bound state is a nearest pixel sampler (1 only for
  those, so normalized states make no new pipeline); an argument buffer's sampler tests its word
  (`SamplerWord::nearest_pixel`, which replaces `exact_fetch`).
- Linear samples and gathers through runtime or argument-buffer samplers, arrays and 3D,
  comparisons, level queries and status reads keep the scaled coordinate and its note: their
  state is unknown where the shader is made, or Vulkan's unnormalized sampler forbids them.

`PixelSamplerScaling` is now recorded only where a scaled form remains; `DeviceDenormals` where
a centre's `floor` may read a subnormal coordinate as the device does. The pixel_samplers lane
also asserts Metal's answer for every constexpr and nearest configuration on MetalSampler devices.
The conformance case declares `pixel-sampler-scaling` for its linear cases alone, and the
llvmpipe ledger rows follow the run: two `rgba16f-nearest-mirror` rows are gone (Metal's answer
now), seven take the new digests. `SEMANTICS_VERSION` 1945, `ARTIFACT_FORMAT_VERSION` 482. No
`RUNTIME_VERSION` bump: an unchanged artifact (no unnormalized sampler, no new constant) binds and
runs as before.

The new fixture `px_edges` (own MSL, through regen-air-fixtures) samples every form at texel and
block edges, quarter offsets and each border colour on three NPOT sizes, and the new
`runtime_lane::pixel_edges` holds each nearest cell to the CPU's `floor` rule on every device and
every probe to Metal's digests on MetalSampler devices. Fixture comments in `sampling` and
`sampling_completion` no longer say the coordinate is scaled (their AIR bodies are unchanged).

Verified on the M3 Max under MoltenVK 1.4.2: the consumer's matrix compared with Metal's
results, 0 differing cells on every kernel and size (28 of 1042 before on three kernels);
lavapipe 0 before and after; `runtime_lane::pixel_edges`, `pixel_samplers` and `pixel_downscales`
pass; conformance replay of the 23 pixel cases holds the ledger on MoltenVK; on arm64 lavapipe
the whole set's replay departs from the parent's ledger, beyond what the parent's own replay
does, at exactly the nine rows edited here (the answers are the report's own). Core suite 4988
passed; validation suite under `--cfg m2v_gpu` passes the new and pixel tests, its other failures
fail the same on the parent commit; conformance 1007 passed; goldens, hashes and inventory
blessed. Release translation of every px_edges and px_samplers kernel on four profiles: slowest
0.08 s, largest peak 6 MB.

(cherry picked from commit 888ad9bae9f0aaaf769360740e1dd16817245ca4)
2026-11-02 10:03:17 -08:00
Anees Iqbal ddccbfac5a Bump RUNTIME_VERSION to 1722 for ASTC passes, storage slots and 4x2 and 8x4 footprints
What: RUNTIME_VERSION 1721 -> 1722; the runtime-sources pin recomputed on this tree
(3314ddbb...); api_signatures.tsv blessed (Degradation::AstcStorageNeutral and
PlanDiagnostic::AstcStorageNeutral added); docs/CONFORMANCE-COVERAGE.md regenerated (one ledger
row fewer, one more module declaring a notice); `cargo fmt` of the footprint case's allowance.

Why: a run of an unchanged artifact and plan now does something else: a pass over an ASTC
attachment drops it instead of refusing, a storage slot over an ASTC texture binds a neutral and
announces `astc-storage-neutral`, and the 4x2 and 8x4 footprints make textures. docs/REFUSALS.md
and docs/METAL-COVERAGE.md regenerate unchanged.

Verified: `signatures.py --bless`, `refusal_surface.py`, `metal-coverage/coverage.py --check`,
`conformance-coverage/coverage.py` on this tree (rebased onto fbc086020f).

(cherry picked from commit a37ab781870cf9d3c1e9672026f9773f3f6dfdf2)
2026-11-02 02:17:10 -08:00
Anees Iqbal 81441ca877 Regenerate the surfaces for pull-model interpolation
- RUNTIME_VERSION 1719: the runtime answers supportsPullModelInterpolation
  and refuses a draw reading an interpolant at a sample at custom positions.
- scripts/metal-coverage/coverage.tsv: supportsPullModelInterpolation
  implemented (DeviceProperties::supports_pull_model_interpolation);
  docs/METAL-COVERAGE.md and docs/CONFORMANCE-COVERAGE.md regenerated.
- docs/REFUSALS.md regenerated: feature::PullModelInterpolation and
  gap::InterpolateAtSampleWithPositions (reach rows in reach.tsv).
- crates/metal2vulkan/tests/api_signatures.tsv blessed: additions only but
  Query::ALL's length (8 to 9) and value.
- crates/metal2vulkan-runtime/README.md: the query and what differs.
- runtime-sources pin recomputed (pin-compute.py).

Verified: refusal_surface.py --check, signatures.py --check,
metal-coverage --check and conformance-coverage --check all current.

(cherry picked from commit 2dcbbf39b6e5caeb3e87079d7f2f36540ceb0dd0)
2026-11-01 23:38:39 -08:00
Anees Iqbal ceb666187a Answer Metal's supports32BitMSAA from the device's own textures
The runtime had no answer for supports32BitMSAA (METAL-COVERAGE listed it
missing), so the consumer passed None through. Metal's answer promises a
multisample texture of each 32-bit integer format and the resolve of
each 32-bit float one; the M3 Max, a Radeon Pro 5300M and a UHD 630 all
answer 1.

What the runtime did before was read first: a multisample texture of each
of the nine formats is planned as any texture is (image_plan), within the
device's limits for the image (vkGetPhysicalDeviceImageFormatProperties2),
and refused as a count its format lacks; draws and texture2d_ms reads of
it, the float formats' AVERAGE resolves (Metal's own on MoltenVK,
device-rounded-resolve elsewhere) and the refusal of an integer resolve
(ResolveFormat, as Metal stops it) were all in place. The render
pipeline, sample planes and interleave all take a format's own counts
beside framebufferIntegerColorSampleCounts. Nothing was wrong; the
query was missing.

Device::supports_32bit_msaa answers yes where the device makes every
texture and resolve the answer promises, each probed exactly as
pixel_format_capabilities probes a capability (the probe closure of
families::formats::answers is now a function both share): the texture
sample counts hold 4, a 2D multisample RenderTarget|ShaderRead texture of
each of the nine formats is made at every count above 1 the textures take,
and each float format resolves (its Resolve capability). A device method,
as supports_family is, because it reads the device's per-format limits:
Vulkan floors an integer format at framebufferIntegerColorSampleCounts,
one sample on RADV and lavapipe, while their 32-bit integer formats each
take 1 to 8 (1, 4, 8 on lavapipe), as the venue profiles' captured
per-format counts state.

Tests:
- runtime tests::msaa_32bit: every committed profile pinned, with the
  limits it states (a venue profile's own per-format color attachment
  counts, else Vulkan's floors). Yes on every venue (moltenvk-m3, both
  780M RADV, both gate lavapipe, the ANV and NVIDIA ones) and on the
  Intel and NVIDIA profiles whose floors cover the counts; no on
  amd-rdna2/rdna3-radv, lavapipe, lunarg-desktop-baseline-2023,
  swiftshader and vk12-floor (R32Uint at the lowest count, naming
  FramebufferIntegerColorSampleCount), and roadmap-2022 (no 4 samples).
  A yes agrees with each format's Msaa and float Resolve capabilities;
  the rule needs 4 and every count, and a missing resolve texture says
  so. A negative control that probes 4 samples alone fails two of them.
- validation runtime_lane::msaa_32bit (--cfg m2v_gpu): the answer is what
  the device makes; R32Uint and RGBA32Uint targets at 2 and 4 drawn at
  sample rate hold every bit, read back through texture2d_ms<uint>
  (Metal: every channel as written); an RG32Float 4-sample target keeps
  its samples and resolves to the probe's Metal texels, exact where the
  driver's average is Metal's; an RGBA32Uint resolve is refused.

Verified: runtime tests msaa_32bit, families and capabilities, the
metal_coverage and runtime-sources pin tests; on the M3 Max (MoltenVK
1.4.2, macOS 27.0.1) through the Mac GPU lock, runtime_lane msaa_32bit,
families and capabilities 7/7: supports32BitMSAA true, counts [2, 4],
nothing refused, 0 integer channels differ, 32 of 32 resolved channels
as Metal's, device-rounded-resolve not announced. clippy with all
features and with --cfg m2v_gpu, rustdoc -D warnings, refusal_surface
--check (no refusal moved), api-signatures (one method added),
METAL-COVERAGE and CONFORMANCE-COVERAGE regenerated (the item now
implemented, not yet exercised by the suite).

RUNTIME_VERSION 1718 (a new answer); runtime sources re-pinned.

(cherry picked from commit 2376157b3bf7bf99221579f42a795ef351b8144c)
2026-11-01 22:35:40 -08:00
Anees Iqbal bf3ce3813c Read Core Image kernel libraries and split whole aggregate accesses
A Core Image kernel library (metal -fcikernel, metallib -cikernel) is a
metallib of file type 1 whose kernels (!air.ci) are listed as function
TYPE 5 over one shared module. The container refused the file type
(Unsupported LibraryKind(1)), so newLibraryWithData: failed where Metal
succeeds; the consumer's graphics-kext lane hit it on Core Image's own
helper library in a macOS 26 guest, so every Core Image path stopped
there.

What Metal answers, measured with kernels written from scratch on an M3
Max under macOS 27.0.1 (probe programs over Metal's API and objc's message
log of a CIColorKernel render):
- newLibraryWithData: takes it as MTLLibraryTypeExecutable; functionNames
  is empty; the private externFunctionNames lists the kernels in the
  reverse of the table's order (libraries of two and four kernels);
- newFunctionWithName:, newFunctionWithDescriptor: and the private
  newExternFunctionWithName: make each kernel with functionType 4 (no SDK
  enumerator; its description prints "Unknown"); newExternFunctionWithName:
  answers as newFunctionWithName: for any library, a kernel of an
  executable one included, and nil for a missing name;
- a compute pipeline made from an extern function fails ("Function tint
  was not found in the module");
- Core Image fetches each kernel and its own helpers with
  newExternFunctionWithName: and links them on the CPU, in Metal.framework's
  base device class, into an ordinary executable library holding one
  kernel, ciKernelMain, of which it builds a plain compute pipeline.

So now:
- container: file type 1 is read (executable; its functions may share one
  bitcode range, hashed once, as a dynamic library's); TYPE 5 is the new
  FunctionStage::Extern, no stage: the ABI cross-check refuses it as a
  mismatch, Library::Function compiles it as no entry (EntryNotFound,
  available 0). Unobserved file types stay LibraryKind refusals.
- FunctionType gains the private enumerator Extern = 4
  (regen-metal-enums PRIVATE); reflection maps Extern to it.
- runtime Library: function_names leaves extern functions out;
  extern_function_names (reverse table order) and
  new_extern_function_with_name are new.

ciKernelMain itself was refused next: Lowering(Arith) at its first
load, `load [4 x <4 x float>], ptr addrspace(2)`, a whole array loaded
from the constant buffer and passed by value to a helper. Lowering reads
and writes buffer and threadgroup memory a scalar or vector at a time.
The new canon pass `aggregates` (after SCCP, beside the other expansions)
replaces each non-volatile, non-atomic load or store of a pointer-free
array or struct in device, constant or threadgroup memory by its members'
accesses in layout order (a getelementptr i8 at the member's distance, the
access's alignment lowered to what the distance allows, joined by
insertvalue or split by extractvalue), at most 256 members, 8 deep.
Thread memory, pointer-holding aggregates (handles), volatile accesses
and larger types stay whole as before. The same-type pointer bitcast
beside the load was never the problem (verified alone).

Public surface: metal2vulkan-air FunctionStage::Extern; metal2vulkan
FunctionStage::Extern and FunctionType::Extern; runtime
Library::extern_function_names and new_extern_function_with_name
(api_signatures blessed: 5 added, none changed or removed). devtools
gains core_image_metallib. The metal-enum generation now records the
macOS 27.2 SDK (the host's Xcode); no SDK value changed, only Extern was
added. LibraryKind's doc and reach note name what it refuses now.

No cache version moves: file type 1 and aggregate accesses outside thread
memory were refused before, so no key reached them, and
golden_hashes_match_the_table passes unchanged (every public fixture
assembled: this Mac's Xcode 27.2 now has its Metal toolchain). The
runtime-sources pin moves (runtime library.rs): re-pinned here to
23766690fd75227c5333e976bfc1fdfafa6ff78f43e0c5ba8fa5183574cd9371.

Verified (M3 Max, macOS 27.0.1):
- Metal versus this tree's runtime on MoltenVK: Core Image's linked
  ciKernelMain for a tint color kernel and for a sampler kernel (both
  from-scratch CI kernels; the linked libraries captured from Metal in
  scratch and deleted after), same constant buffer, source texture and
  sampler, 4x4 RGBA32Float target: byte-identical texels, the early-out
  column untouched on both. The parent tree answers FALLBACK (Lowering
  Arith) for both. Release CLI: 0.01-0.03 s, 11 MiB each.
- Release CLI, parent vs this tree, largest public fixtures
  (hfb_filter_bank render pair, tns_mm_flags), three runs each:
  0.12-0.13 s vs 0.12-0.16 s and 0.05-0.06 s vs 0.04-0.05 s, 27 MiB both
  (runs beside a test suite; the same within noise).
- New tests: canon aggregates (split loads, stores with nested arrays and
  lowered alignments, threadgroup; volatile, pointer-holding and
  300-element aggregates stay whole), an engine test running a
  ciKernelMain-shaped kernel on the CPU interpreter on three profiles,
  core_image_libraries (container types, stages, shared hash, functionType
  4, EntryNotFound), and a runtime device test on MoltenVK (names, extern
  names, both lookups, pipeline refusal, an executable library's kernel
  through the extern lookup). Negative controls: the split and execution
  tests fail with the pass disabled; the library tests fail with file
  type 1 refused.
- cargo nextest -p metal2vulkan -p metal2vulkan-air -p metal2vulkan-runtime
  -p metal2vulkan-devtools --all-features: 4927 passed (golden hashes and
  the metal-as fixture parts included); -p metal2vulkan-validation
  -p metal2vulkan-conformance: 2369, all passed after the re-pin; doctests
  ok; clippy --workspace --all-targets --all-features -D warnings and the
  runtime's under --cfg m2v_gpu: clean; rustdoc -D warnings and
  scripts/api-docs: clean; REFUSALS, METAL-COVERAGE and
  CONFORMANCE-COVERAGE re-derived (MTLFunctionTypeExtern is listed as not
  yet compared by a conformance case). Not run: a corpus translation
  census, and the device suites beyond the new runtime test.
2026-10-31 03:39:16 +02:00
Anees Iqbal 7d1323ebcc Convert extended-range, padded and bfloat texels by the device's arithmetic
A read is float(c - 384) times the f32 nearest 1/510 (a padded code's float(c)
times 1/1023), a write RoundEven(clamp(v)*510)+384 (padded *1023), an sRGB
twin's colour the MSL transfer by the device's Pow on the magnitude, a half
result the device's narrowing, a bfloat code its bit shift with NaNs as
computed. Metal's correctly rounded quotients, exact-product rounding, ties-away
half rounding and its extended/padded sRGB tables leave the shader path:
extended_range/table.rs, R10X6_SRGB_DECODE_STEPS, round_exact_product(_lanes)
and the plan's table fields are deleted. Each such module records
DevicePackConversion; FAST-PATHS' air.pack row and API.md's catalogue state the
bounds (one f32 ulp, one code, half a 2^-13 sRGB step, R10X6_SRGB 1.64 steps).
The host-side clear_texel and the bicubic code still read extended_srgb.rs's
tables, so on an sRGB twin a clear and a shader write can differ by one code.

Verified: 331 touched lib tests; clippy plain and m2v_gpu; rustdoc; conformance
ledger tests; M3 replay of 89 extended-range cases (exit 0, 276 ledger rows,
+254/-57 against development); validation heap_extended on the M3 (6/6); the
new tests fail with FDiv decode. Golden: 346 cells in 20 heap/argument-buffer
subjects move (blessed on development). Translation words of an sRGB twin's read
4433 -> 588, write 5540 -> 632.

One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 8acec5a4a2, then 96d8394995 (the re-pin).
2026-10-29 15:43:54 +02:00
Anees Iqbal 63859d8cc1 Sum emulated filters' taps in the device's arithmetic
Rule 1: where the device has a native form it is the only form. The
emulated filters reproduced Metal's datapath bit for bit: a 2^-16
Catmull-Rom weight table, two-word integer sums truncated onto grids
and rounded half up, exact quotients, ties-away half rounding, a 12-bit
sRGB grid snap, 64ths of a level and 256ths of a blend, and the
anisotropic filter's piecewise log2 and chord exp2. All of it is gone.

Bicubic (lower/sampler/bicubic.rs, bicubic/routines.rs):
- One routine, `Plane::sum`: Catmull-Rom weights computed in f32 from
  the fraction (vec4 Horner), the sixteen taps summed by the device's
  multiply and add, rows then columns; Metal's bilinear rule (32-bit
  float formats, a level under four texels) is the device's FMix of
  the four inner taps already fetched; UNORM/SNORM clamps.
- 1D: `Line::sum`, the device's FMix of its two taps.
- An 8-bit sRGB twin's taps are the device's transfer, not the
  1/4095 grid. A half result is the device's narrowing
  (`narrow::round`), not ties-away.
- Kept: Metal's footprint, addressing, mirror pin, filter selection,
  `Quad::exact` (in-place YCbCr's filter, owner form H, not touched).
- Deleted: the weight table routine, the exact/half/accumulated plane
  and row routines, the block and float-quad routines, their words and
  specials; metal::bicubic's test-only table and its test.

Extended range (lower/sampler/extended.rs):
- Linear, 3D and the linear mip filter's level blend decode their taps
  through xrconv's functions as they are, then FMix in f32 at the f32
  fractions; the level weight is the f32 fraction, not 64ths; a half
  result is the device's narrowing. Bicubic clamps into the format's
  decoded endpoints. The in-place decode keeps `Quad::exact`.
- Deleted: the step tables' callers (steps_of, step, level_taps,
  half_of) and, in xrconv's extended_range.rs and texel_round.rs, the
  helpers only they used (STEPS_WORDS, has_steps, steps, step_grids,
  ratio_by_255_to_f32, normal_half_bits; minimal edits in another
  lane's files).

Anisotropic (lower/sampler/anisotropic.rs):
- The device's Log2 and Exp2 replace Metal's piecewise log2, chord exp2
  and truncations; the level and spacing are not rounded to 256ths,
  4096ths or a 6-bit mantissa.
- Each tap is one explicit-level sample: under a linear mip filter the
  fractional level, which the device's own linear mip filter blends.
  The two-samples-a-tap form existed because an RTX 3090's blend of a
  fractional level is not Metal's (1.03 codes off without anisotropy);
  under rule 1 that blend is the device's. A nearest mip filter's level
  stays whole (the 3090's anisotropic sampler blends the next level at
  a fractional level whatever its mipmap mode).
- Kept: Metal's length, tap count thresholds, floor(256/n) weights,
  kappa fit and direction.

Notes: PrecisionNote::BicubicFilterArithmetic is reused, broadened to
the extended-range linear, 3D and level blends (select.rs records it);
AnisotropicFilter's doc names the device's logarithm and blend. No new
variant, no ARTIFACT_FORMAT_VERSION bump. FAST-PATHS: the two
"not built yet / none known" bicubic rows are now one device-gap row
(the device's sum is the form); the known-gaps bullet loses the sRGB
grid snap. API.md's catalogue entries rewritten.

SEMANTICS_VERSION 1922 -> 1923.

Tests: the plane routine's interpreter differential against an f32
Catmull-Rom reference in the routine's order (fails on the old table
and integer sum), the line routine's FMix, the routines' word bounds;
engine_bicubic against the polynomial within 2^-18 (+ half ulp);
extended-range engine tests compare within the filter's bound
(`filtered_close`); xr_bicubic's `near` adds Metal's table's
deviation from the polynomial (WEIGHTS_BOUND 2.1e-3); anisotropic and
bias-reach tests count one sample a tap and two Exp2 per emulation.

Lanes and the conformance suite:
- runtime_lane::extended_range_samples compares linear samples within
  `xr_bicubic::filtered_close` (moved to devtools from the engine test,
  which re-exports it); two_plane_samples holds the digest of nearest
  cases only (a linear one's values are compared by the conformance
  suite's xr-two-plane-samples cases).
- runtime_lane::anisotropic_filter's bounds re-measured on the M3 Max
  with samplerAnisotropy withheld: linear 10.375 codes max (mean 0.21),
  nearest mean 0.82 and 6.7% of channels a code or more off, clamp to
  edge 6.531 max. Other devices not measured.
- conformance: the XR two-plane-samples and extended-range/padded
  extended-swizzles cases declare bicubic-filter-arithmetic; 32
  known-gaps rows (Apple M3 Max) for the linear sites the device's FMix
  moves.
- runtime-sources.sha256 re-pinned: metal/bicubic.rs lost its test-only
  table and docs; no run's behaviour depends on it.

Verified (this M3 Max, macOS 27.0.1): metal2vulkan + devtools suites,
3302/3303 passed (golden_hashes_match_the_table fails: 1001 cells moved,
not blessed). Module words of a bicubic sample (ANV Iris Xe profile):
xr_bicubic xrb_edge 12990 -> 2093, a2_bicubic_weights 15731 -> 3858,
bcx_rules 30727 -> 11388; anisotropic emulation (vk12-floor)
2705 -> 1884.

Also in this packet: the padded 10-bit formats' linear samples join the known gaps (d326b293c0), and the conformance coverage document is regenerated for the filter rows. Anisotropic emulation (devices without samplerAnisotropy only) now takes the device's Log2/Exp2 and level blend, and Metal's spacing roundings (r' to 256ths, g*S to 4096ths, S to a 6-bit mantissa) are gone with them: on the M3 with samplerAnisotropy withheld, linear reads up to 10.4 codes from Metal (mean <= 0.21), bounded in runtime_lane/anisotropic_filter.rs.

One work packet, landed as 2 commits on archive/development-linear-2026-10-29: abc366a2fa, then 8f506cb2fd (the re-pin).
2026-10-29 15:43:53 +02:00
Anees Iqbal 20287666c0 Blend extended-range attachments in the device's arithmetic; drop the 32-bit float Metal blend
Rule 1 (owner, 10-29): where the device has a native form, it is the only form.
An extended-range attachment's raw codes are something no blend unit reads, so the
shader still blends it (capability), inside the pixel interlock or over lavapipe's
input attachment. Its arithmetic used to be Metal's compiler's: lerps, common
factors, fusing by factor rank, half rounding at every step, a separate float4
model and computed-output tables. Now it is a blend unit's arithmetic: S*Fs op D*Fd
in float, in the order of the blend equation, with the source, second source and
blend color clamped to the form's range first (`extended_range::blend::native`).
- computed.rs is deleted. blend_color.rs keeps only the two source ranges.
- input_blend.rs and fetch.rs call native().
- The blend color is pushed as raw f32 bits (HalfBlendColor), so
  PushField::BlendColor is gone.
- Every blended extended-range output that stores a channel now records
  ExtendedRangeBlendSource (half) or ExtendedRangeFloatBlendSource (float).
- The refusals ConstantColorDifference, SrgbForm and FloatOutput are gone, as is
  the fast-math DualSource refusal for extended range. Every factor, operation
  and mask is built; only outputs other than four half or float lanes are
  still refused (Output).

The 32-bit float storage-form blend (`Blend::float32`, `fetch::float32_blended`)
computed Metal's fused forms in float. Every committed profile except
roadmap-2022 and vk12-floor sets COLOR_ATTACHMENT_BLEND on R32/RG32/RGBA32_SFLOAT,
so that form copied Metal's bits where the device blends natively. It is removed:
- a fetched 32-bit float attachment takes the generic float blend
  (UnmeasuredFetchBlend);
- one that is not fetched gets the device's blend after the pass splits.
The float4-output paths of the half/unorm8 model (Atom::Sf, Arith::Kept,
round_inner, Blend::float/narrow/takes_float) were dead after this and are pruned.

Removed:
- the Metal blend-table validation lane (extended_range_blend_table.rs)
- devtools xr_blends
- the xr_blend_table*.txt fixtures
- lower/arith/tests/blend32.rs
- the extended_range tests that pinned Metal's forms

Added:
- every_blend_is_the_devices_arithmetic: every form, 19 factors, 5 operations,
  rotating masks and adversarial sources, bit-exact against a float model of
  S*Fs op D*Fd
- every_blend_is_built_but_a_placeholder

Docs:
- FAST-PATHS: the "Metal's rounding per shape" fast row is removed. The
  extended-range blend is now a device-gaps row with the two notes. The
  32-bit float row and the interlock section are fixed.
- artifact.rs note docs and the API.md catalogue are rewritten.
- REFUSALS is regenerated, reach.tsv updated and api_signatures blessed
  (removed ExtendedRangeBlend::{ConstantColorDifference, FloatOutput, SrgbForm},
  PushField::BlendColor).
- Conformance: the two notes join replay::NATIVE_NOTES, and 16 Apple M3 Max
  known-gaps rows hold the xr-blend add/premul sites the device's arithmetic
  moves: one code, two at the sRGB premultiplied sites.
- SEMANTICS_VERSION 1923, ARTIFACT_FORMAT_VERSION 479.

Size: a premultiplied half4 fill into RGB10A8_2P_XR10 on moltenvk-m3 goes from
3275 to 1937 SPIR-V words (the blend itself from 2133 to 795). The float4 fill
goes from 3435 to 1951 words, and BGRA10_XR_sRGB premultiplied from 7992 to 6654.

Verified:
- metal2vulkan lib, touched modules: 511/511.
- Sabotage: rounding the source to half in native() fails
  every_blend_is_the_devices_arithmetic; restored, it passes.
- clippy, plain and with --cfg m2v_gpu; rustdoc -D warnings.
- M3 Max conformance replay of 25 cases: half-output-blends-*,
  blend-interaction-format-float32 and xr-blend-*-one-zero are justified; the 16
  xr-blend add/premul sites are held by the new rows.
  The replay exits 0 with the ledger held exactly. The conformance crate
  passes 1007/1007, CONFORMANCE-COVERAGE is regenerated, and runtime
  degradation/catalogue and api_signatures/api_surface/refusal_surface pass.
- M3 device tests (memcap + maclock, --cfg m2v_gpu): 11/11 of
  runtime_lane::extended_range_blends and framebuffer_fetch::generic_blend.
  The renamed blends_of_half_outputs_into_extended_range_texels asserts
  Metal's bytes for one-zero and prints the 16 add/premul outputs the device's
  arithmetic moves.

One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 808143ef80, then 18431ee908 (the re-pin).
2026-10-29 15:43:53 +02:00
Anees Iqbal 3ec4a69763 Record the native-answer work left open, and name lavapipe's pulled constant step
docs/FAST-PATHS.md's known gaps gain two entries. The first lists the places
that still compute Metal's own answer where the device has one: fast::atan2's
reciprocal flushed past 2^126, a bicubic sample of an 8-bit sRGB format through
its UNORM twin snapping each decoded tap to Metal's twelve-bit step, and half
fmod's zero sign on the exact remainder routine. The second is the shadow
merge's per-word stores over PCIe, measured on an RTX 5080 over 4 MiB of host
pages: 150 ms of GPU time with every other word changed, 0.40 ms with a 64x64
square, 0.86 ms with every word. Whole blocks take under 1 ms in each shape but
would rewrite unchanged bytes a CPU may be writing, which Metal keeps.

The five llvmpipe vertex-format-constant-step half/RG11B10 NaN rows said
fixed-function vertex input; lavapipe reports no nonzero first instance, so the
constant step is the vertex function's own fetch there, and device-nan-encoding
is recorded on that pulled read (397e431a36). Their text now says so.
docs/CONFORMANCE-COVERAGE.md regenerated.

Verified: tests::fast_paths and the conformance ledger tests pass.

One work packet, landed as 1 commit on archive/development-linear-2026-10-29: 189c16e23f.
2026-10-29 15:43:51 +02:00
Anees Iqbal fa854417c0 Hold lavapipe's answers at the sites tonight's native commits moved
The native-answer commits were verified on the Apple M3 Max only. Replaying
the whole conformance set on lavapipe (scripts/linux-gate --icd lavapipe,
llvmpipe LLVM 21.1.8, Mesa 26.0.8) found ten llvmpipe sites the ledger did
not hold:

- vertex-format-constant-step, five rows added (UChar, UChar2, UChar3,
  UChar4, UChar4_BGRA normalized): 33a8839b7c expected none, but lavapipe
  reports supportsNonZeroFirstInstance = false (vulkaninfo in the gate
  image), so the constant step is the shader's own fetch there too; the
  sites read 0x3EFEFF00 where Metal reads 0x3EFEFEFF, the one-ulp product
  the stage-in rows hold (device-vertex-conversion).
- Five rows updated to lavapipe's new answers after the sRGB transfer,
  maths and half-narrowing commits: math-frexp-ilogb-half's two mantissa
  sites (3 elements, largest 0x1FF: lavapipe's narrowing drops a NaN's
  payload, native-nan-encoding); pass-bytes-half-tanh-regimes half-tanh
  (63 words, largest 0x80008000, a NaN's sign first) and fast-float-tanh
  (2851 words, first one ulp); pass-bytes-srgb-decode-all-bytes words
  (1136 elements, largest 0x00F90001, the M3's same counts). Where a
  replay reads only the first and largest element, the row says so and
  leaves the element-by-element read open.

docs/CONFORMANCE-COVERAGE.md regenerated: it also picks up the ledger
changes of a049fcd0ee, d49cbcd398 and 0d7093d826, which left it stale.

Verified on lavapipe, conformance replay --cpu over the whole case set at
b7f6dec939 with these rows: exit 0 (487 exact, 407 announced, 177
divergent, 36 lacks-feature, 11 refused, 4 never-returned); without them
exit 1 at exactly these ten sites. The five llvmpipe
attribute-format-fetches rows (33a8839b7c) and the llvmpipe
fetch-ordered-*-srgb rows hold unchanged. Mac: the conformance ledger
tests and the conformance_coverage binary, 14/14.

One work packet, landed as 1 commit on archive/development-linear-2026-10-29: e3a4094d6e.
2026-10-29 15:43:50 +02:00
Anees Iqbal 5f2c69e087 Decode a pulled normalized vertex field by the device's reciprocal product
Pulled normalized fields (vertex, [[stage_in]], post-tessellation) take the device's product,
and a post-tessellation pulled read records its NaN note as the vertex and stage-in reads do.

One work packet, landed as 2 commits on archive/development-linear-2026-10-29, in order:

* Decode a pulled normalized vertex field by the device's reciprocal product (33a8839b7c)

The owner's ruling of 10-29: no exact emulation where the GPU has a native
answer. A normalized field the shader pulls (a vertex attribute fixed-function
input cannot fetch, a kernel's [[stage_in]] attribute, a post-tessellation
function's) was Metal's correctly rounded quotient via exact_division::div_exact.
It is now the device's product float(c)*float(1/m), rounded once, the signed one
max(., -1), as fixed-function fetch already converts it (78ed264c90).

The product is within one f32 ulp of Metal's quotient: 126 of 256 8-bit unsigned
codes one ulp high; 16 signed 8-bit, 24 unsigned 10-bit, 512 unsigned and 1,536
signed 16-bit codes one ulp toward zero; 0, the maximum and -1 exact.
Int1010102Normalized stays exactly Metal's (Metal computes the same product).
Read as half, only 16-bit fields differ, at four codes.

fetch::conversion_notes records PrecisionNote::DeviceVertexConversion on every
profile where the product misses Metal's answer, at the vertex, stage-in and
tessellation pulled reads. Updated: the note's docs, the runtime Degradation
doc, the docs/API.md catalogue entry, the FAST-PATHS row, and known-gaps.tsv
rows for the M3 (constant step, stage-in) and llvmpipe (stage-in) 8-bit
unsigned sites; CONFORMANCE-COVERAGE.md regenerated. SEMANTICS_VERSION 1915.

Verified: fetch unit tests 13/13, including a decode that is FMul with no
UDiv/FDiv and an exhaustive note-versus-Metal check; restoring the old decode
fails 5 of them. Engine constant-step sweep on moltenvk-m3 notes 18 float4 and
8 half4 formats. Clippy (plain and m2v_gpu) and rustdoc clean; golden hashes
unchanged. On the Apple M3 Max: runtime_lane normalized_vertex_fetch 3/3 (its
legs take fixed-function fetch there); conformance replay of
vertex-format-constant-step and attribute-format-fetches (shader-pulled on the
M3: 10 sites read 0x3efeff00 where Metal reads 0x3efefeff, the note accepted)
exits 0 with the new rows; float4/half4/instance-step/class-crossings
unchanged. llvmpipe stage-in rows expected, not run.

* Record a post-tessellation pulled read's NaN note as the vertex and stage-in reads do (397e431a36)

A post-tessellation function's pulled attribute decodes through the same fetch::decode as a
vertex function's and a kernel's [[stage_in]] attribute's, so a narrow float format (a half
format, FloatRG11B10) read as float widens its NaN by the device's bits where Metal answers
0x7fc00000. The vertex and stage-in reads recorded PrecisionNote::DeviceNanEncoding for it;
lower::tessellation's pulled_read recorded only DeviceVertexConversion, so such a function's
artifact under-stated its difference from Metal.

The two note rules are now one function, fetch::decode_notes (DeviceNanEncoding for a narrow
float read as float, DeviceVertexConversion where the normalized product misses Metal's), which
all three pulled reads call; narrow_float_nans and conversion_notes are gone. The NaN note's doc
names the three reads. SEMANTICS_VERSION 1920: a precision note of an
artifact changes under an unchanged key.

Test: engine_tessellation::a_patch_attribute_s_decode_records_the_vertex_fetch_s_notes gives the
fixture's per-patch float4 tint a Half4 (DeviceNanEncoding), UChar4Normalized
(DeviceVertexConversion) and Float4 (neither) format on every committed profile with
tessellationShader. Restoring the pre-fix behaviour (the tessellation read recording only the
normalized note) fails it at Half4; restored, it passes.

Verified: nextest engine_tessellation, lower::stage_io, lower::tessellation,
engine_kernel_stage_in, engine_vertex_fetch, engine_vertex_variants, fast_paths and
api_signatures: 85/85.
2026-10-29 15:43:49 +02:00
Anees Iqbal 487e23f3ee Declare a half color output 16-bit where the device enables storageInputOutput16
A fragment function's half color output is declared 16-bit where the device enables
storageInputOutput16 and shaderFloat16, so the device blends the half Metal's attachment
receives (the M3's 52 half-blend rows no longer diverge). SEMANTICS 1909, ARTIFACT 476.

One work packet, landed as 6 commit(s) (9e8b40289e..f5e9c26fe3 on archive/development-linear-2026-10-28-evening), in order:

* Declare a half color output 16-bit where the device enables storageInputOutput16

What: a fragment function's `half` color output through a variable of its
own type (not an extended-range or word attachment's raw texel, not an
attachment held with its channels rotated) is declared with 16-bit float
lanes on a profile that enables `storageInputOutput16` and `shaderFloat16`,
and stored by one OpFConvert of the f32 that holds the half (exact: the
value is a half). The module then requires StorageInputOutput16 (derived
from the Output pointer as before). `StageIo::half_outputs` lists the keys
so link's contract check holds the module to the 16-bit declaration
(`io_type_matches` takes the float width); the artifact codec carries the
field. Every other interface variable stays 32-bit, and a device without
the feature (lavapipe, NVIDIA's 615.71.09) keeps the half widened to float.

Why: the widening hid the output's type from the device. With the half
declared as a half, the device blends and converts the value Metal's
attachment receives as its own half output: on MoltenVK that is Metal's
compiler handling Metal's own output type. No Metal arithmetic is emulated
and no note changes (HalfOutputPrecision and HalfOutputFastMathBlend fire
as before; a computed fast-math output may still differ).

Verified:
- M3 Max, MoltenVK 1.4.2, macOS 27.0.1: `conformance replay` of the six
  `half-output-blends-*` cases: every value exact (verdict `announced`, the
  case's declared notice only); the 52 M3 rows of known-gaps.tsv (17, 17, 18
  sites of r16f, rg16f, rgba16f) all read "no longer diverges", so they are
  removed. The 32-bit float formats stay exact. A replay of the 40 cases whose
  recorded fragment functions return half (half-output-blends-*, xr-*,
  rgb10a2-srgb-stores-h, render-then-sample-magnified-*,
  fragment-imageblock-reflection): 39 announced, 1 exact, no other ledger
  difference.
- New unit test `a_half_color_output_is_declared_16_bit_where_the_device_enables_it`
  (moltenvk-m3 and amd-rdna3-radv 16-bit, lavapipe 32-bit; a float output
  and a rotated attachment 32-bit everywhere; L3 on each module).

* Bump the cache versions for 16-bit half color outputs

SEMANTICS_VERSION 1907 -> 1908: a fragment function's half color output is
declared 16-bit on a profile that enables storageInputOutput16 and
shaderFloat16, so its module's words and requirements change under an
unchanged key (golden_hashes reports 657 cells changed; the table is
re-blessed on the lane branch, not here).

ARTIFACT_FORMAT_VERSION 475 -> 476: StageIo gains `half_outputs`, which the
artifact codec encodes.

Verified: cargo check; the version constants alone moved.

* Regenerate the conformance coverage document for the 52 removed M3 rows

What: docs/CONFORMANCE-COVERAGE.md, written by
`python3 -I scripts/conformance-coverage/coverage.py`. Its ledger count goes
from 1129 to 1077 rows and its ledger table loses the 52 Apple M3 Max rows of
`half-output-blends-r16f`, `-rg16f` and `-rgba16f`, which the 16-bit half
output commit removed from known-gaps.tsv (they read "no longer diverges" on
the M3 replay).

Why: the document is derived from the ledger, and
`conformance_coverage::the_conformance_coverage_document_is_what_the_sources_derive`
failed on the stale copy.

Verified: the diff is those 52 lines and the count, nothing else.

* Record the M3's safe-math half blends under the 16-bit half output

What: PrecisionNote::HalfOutputPrecision's documentation said MoltenVK on
the M3 Max stores Metal's bytes in every draw of the safe-math sweep. It now
states what the lane measures with the output declared 16-bit, and that the
NVIDIA, RADV, ANV and lavapipe bounds were measured with the output widened
to float (RADV and ANV, which enable storageInputOutput16, now take the
16-bit form and are not re-measured: host away).

Measured on the M3 Max, MoltenVK 1.4.2, macOS 27.0.1, with
`runtime_lane::half_output_blends::half_output_blends_against_metals_rule`
under --cfg m2v_gpu (the measurement prints HALF-BLEND-SUMMARY lines):
- at this branch (16-bit output): R16Float, RG16Float, RGBA16Float 28 of 28
  measured blend draws Metal's rule's value in every channel, largest
  distance 0; R32Float 28, RG32Float 28, RGBA32Float 26 of 28 (zero-1msa k0
  and k4: one channel of 262,144 off by a zero's sign, distance 0);
- at 0db5825a60 (float output; a lean snapshot built in a seeded target):
  6 of 28 in each 16-bit float format, up to 2 half ulps apart at the
  operands' magnitude; the 32-bit formats identical to the above, the same
  two draws included.
So the 16-bit output moves the 16-bit float formats to Metal's rule and
leaves the 32-bit ones as they were. Both runs: the five
runtime_lane::color_writes tests pass too.

* Give the 16-bit half output its own SEMANTICS_VERSION, 1909

The half16 commits were written on 0db5825a60 and bumped SEMANTICS_VERSION
1907 -> 1908. On the release base b8f5007845, 1908 is already the
serializer's element-by-element array copy (8b7a8aa2d8), so the rebase took
that hunk as already applied and two different changes of translated words
shared one version. A cache filled at the release would then serve the
32-bit half outputs to this lane under an unchanged key. 1909 separates them.
ARTIFACT_FORMAT_VERSION 476 (StageIo::half_outputs) stays: the release did
not move it.

Verified: the constant alone moved.

* Re-bless the golden hashes for the 16-bit half output on the native lane

73 rows of golden_hashes.tsv move: the fragment entry points whose half
color outputs are now declared 16-bit on profiles that enable
storageInputOutput16 and shaderFloat16 (SEMANTICS_VERSION 1909). The engine
inventory and the engine golden printouts blessed with no change.

Verified: bless_engine_inventory, bless_golden_hashes, bless_engine_goldens
pass on macOS at fc8e43eff0; clippy --workspace --all-targets --all-features
-D warnings clean.
2026-10-28 21:19:27 +02:00
Anees Iqbal 7cce610704 Delete the shader-side dropped-store mask
One work packet, landed as 5 commits (a31d02e99a..46c3156d42 on archive/development-linear-2026-10-28), in order:

* Delete the shader-side dropped-store mask

What. The per-stage mask of buffer slots whose stores the shader drops
goes, with everything that existed only for it:

- translator: the store-dropping lowering (lower/access/sink.rs; the
  guarded stores in emit, psb, pulled, dynamic, atomic and blob; the
  write-only store-sink binding and the OpSelect of two storage-buffer
  pointers that chose it, with its VariablePointers requirement), the
  specialization key, the stage-table field and their codec tags;
- runtime: argument_table's dropped_store_buffers and its refresh,
  Buffer::drops_writes (now unused), the two variable-pointer enables,
  and SetZeroChoice.store_sinks (now the layout's set-0 bindings);
- tests: engine_dropped_stores, engine_dropped_store_sink, the sink
  cases of neutral_zeros_shared, and dynamic_multi_variable's two
  encoders_plain tests, whose only binding of several variables was the
  sink. The narrow-unit kernel now runs at its buffers' starts and at
  moving offsets: the moved run checks that a dynamic offset reaches
  every variable of its three-variable binding, and no dispatch at a
  moved offset reuses its predecessor's set in either form, since a slot
  read to its buffer's end has a range that moves with its offset;
- the Apple M3 Max known-gaps row for
  host-page-writes-kernel-store-read-only at
  case/bytes-in-the-same-command-buffer-bytes, which this fixes.

Removed public items:
- metal2vulkan::bind::StageTable::dropped_store_buffers (field)
- metal2vulkan::bind::StageShape::dropped_store_buffers (field)
- metal2vulkan::pipeline::SpecKey::DroppedStoreSlots(Stage)
- metal2vulkan::pipeline::SyntheticBinding::StoreSink
- metal2vulkan::device::VkFeature::VariablePointers
- metal2vulkan::device::VkFeature::VariablePointersStorageBuffer
(the two features were asked for only by the sink's pointer select)

Why. The mask was set only from Buffer::drops_writes, which is true only
for host pages imported through a read-only view, and only macOS makes
one (VIEWS_DROP_WRITES; ReadOnlyView::of is None elsewhere, and
no_copy_options keeps the private bit off it). No other path set it:
Linux writable imports, dma-buf imports (excluded where writes drop),
heaps (the same import) and argument buffers (which name no slot). On
that memory the view already takes the GPU's writes nowhere, so the
shader-side drop was redundant there. It was also wrong: a later
command of the same command buffer reads the stored words back from
the GPU's caches on Metal (8 runs of 8 on the M3 Max), and the
shader-side drop made it read the pages' own bytes.

Versions, placeholders for the landing to renumber: SEMANTICS_VERSION
2000, ARTIFACT_FORMAT_VERSION 500 (the codec loses four tags),
RUNTIME_VERSION 1840. api_signatures.tsv re-blessed, docs/REFUSALS.md
and docs/CONFORMANCE-COVERAGE.md regenerated, the runtime sources
re-pinned. FAST-PATHS: the read-only-memory known gap now says what is
true (writes reach the pages off macOS), and the dynamic multi-variable
row is scoped to bindings whose range stays as their offset moves.

Verified:
- metal2vulkan suite: 3329 of 3330 pass. golden_hashes moves 3391
  cells (every module with a device store loses its guard); the table
  is re-blessed on development.
- clippy -D warnings clean, plain and with --cfg m2v_gpu; rustdoc
  -D warnings clean for the four touched crates.
- MoltenVK 1.4.2 on the M3 Max: conformance replay of the four
  host-page-writes cases exits 0, both kernel-store cases exact (the
  visibility pair "announced", the fast-math notice, as before). The
  host-page, read-only and private-bit lanes and argument_table,
  neutral_zeros_shared and dynamic_multi_variable pass.
- lavapipe (arm64, linux-gate): full conformance replay exits 0, its
  891 gap rows exactly the ones the ledger expects on the venue (none
  unlisted, none stale); the same lanes pass.

* Lane: a kernel's stores into private-bit memory reach only its own command buffer

What. runtime_lane::degrade_notices gains
a_kernel_s_stores_into_private_bit_memory_reach_only_its_own_command_buffer.
It dispatches a4_index_word into no-copy memory of an anonymous
mapping, filled with 0xab and made with Metal's private option bit 24,
bound 512 bytes in, then copies the first 1024 bytes in the same
command buffer and in a later one, and reads them from the CPU.

Why. It holds Metal's measured answer where the runtime gives it: the
same command buffer's copy reads the stored words, everywhere; on
macOS, where the pages come through a read-only view, the later command
buffer and the CPU read the pages' own bytes and nothing is announced;
elsewhere they read the stores, announced once as the private-option
notice. Every byte the stores do not name keeps 0xab at every site.

Verified: MoltenVK 1.4.2 on the M3 Max prints "drops writes true; same
command buffer stored true, later command buffer stored false, CPU
stored false" and passes; lavapipe (arm64) prints "drops writes false;
... true, true, true" and passes.

* Number SEMANTICS_VERSION 1907, ARTIFACT_FORMAT_VERSION 475 and RUNTIME_VERSION 1681, past development's

The dropped-store mask's deletion took the placeholders 2000, 500 and
1840; development is at 1906, 474 and 1680.

* Re-bless the golden tables after the dropped-store mask's deletion

Every module with a device store loses its read-only guard (a31d02e99a),
so bless_golden_hashes moves 1330 rows of golden_hashes.tsv;
bless_engine_inventory, bless_engine_goldens and tests::air_input wrote
nothing new.

Verified: the three bless runs and air_input exit 0 at 623f8d2170.

* Re-bless the authored compile census after the dropped-store mask's deletion

corpus-triage --audit authored-compile --bless over 2253 cases and 21
profiles: 0 differences, 0 regressions, 0 failed, 20159 artifacts moved
by hash alone (the store guard's words). Slowest compile 586 ms,
slowest case across all profiles 18.5 s, peak worker RSS 231 MB.

Verified: the census run above at 623f8d2170.
2026-10-28 17:24:23 +02:00