Commit Graph
194 Commits
Author SHA1 Message Date
Anees Iqbal 977c9da12f RUNTIME 2246: setTriangleFillMode: 2 (MTLTriangleFillModePoints, Apple-private) draws a triangle's vertices as points
Apple's GL renderer sends setTriangleFillMode:2 for glPolygonMode(GL_POINT) under its Intel and
Apple-silicon caps tables. The value is not in the public headers. Our TriangleFillMode had only
Fill and Lines, so the consumer's raw-value conversion failed and its host died. Measured on
Metal: an M3 Max and an Intel UHD 630 draw only a triangle's 3 vertex pixels (a Radeon Pro 5300M
fills it); our own probe on the M3 (m3-max-26811) draws 1-px points whether point_size is 4, 1 or
unwritten, culls them with CullMode Front, and draws them with Back.

Now TriangleFillMode::Points (2) exists. The generator (scripts/regen-metal-enums) takes a
PRIVATE line for it, with its evidence, and a PRIVATE_DOCS doc comment (metal_enum! accepts
variant attributes); generated.rs stays generated and `--check` passes. The runtime draws it as
VK_POLYGON_MODE_POINT. It needs fillModeNonSolid (refused otherwise:
Feature::TriangleFillPoints) and, on a portability-subset device, pointPolygons
(VkFeature::PointPolygons; MoltenVK withholds it, so it refuses Points). New degradation
TrianglePointSize ("triangle-point-size"): Vulkan sizes the points by the PointSize the vertex
function writes, where Metal draws 1 px. An ICB command still refuses set_triangle_fill_mode, as
before. New lane module runtime_lane::triangle_points.

Verified (fillpoints, 6b9927c402 on 25be73dddf):
- lavapipe lane 30/30: points light {(3,3),(3,12),(12,3)} (Metal's 3 vertex pixels); culled
  front none, back the same 3; fill 45 px (the M3 lit 45); lines 27; fill/lines unchanged.
- msi: clippy plain, m2v_gpu and m2v_cpu_icd 0; rustdoc 0; touched tests 102/102.
- Owed: the XTX leg (m3-max-26943).

ARTIFACT_FORMAT_VERSION 519 -> 520 (VkFeature appended to the codec), RUNTIME_VERSION 2245 -> 2246.
2026-11-13 15:26:44 -08:00
Anees Iqbal 7b27d0b63e Re-derive the generated documents at the landing tip
They are generated from the whole case set, and the set grew on `development`
while this branch was in flight, so the copy committed here counted a smaller
one.

Verified: regenerating at this tip leaves no change beyond the `Generated at`
stamp.
2026-11-12 12:53:37 -08:00
Anees Iqbal 0a4f4e87f2 Labels: command buffers and encoders take Metal's label, and a lost device's notice names the hang by them
A lost VkDevice's recovery notice named its hang only as "a command buffer (of queue `Q`)",
so an Iris boot's GpuHang (46 victims) left nothing to tell which work hung. The runtime had
no label for a command buffer or an encoder at all.

CommandBuffer::label/set_label (MTLCommandBuffer.label) and label/set_label on the blit,
compute, render and resource state encoders (MTLCommandEncoder.label) now keep what the
program sets. A command buffer has one encoder open at a time, so the open encoder's label
lives on the command buffer's state, and the encoder's record takes it as it ends: each
EndedEncoder reports its label, in its place, a render encoder that ends on the lowering
thread included. The recovery names its culprit from the command buffer's state as it fails
the pending batches: its label and its queue's, then its first 32 ended encoders' places,
kinds and labels, counting the rest, e.g. "command buffer `busy` of queue `relayed` (its 1
encoder: 0 blit `copies`) failed as the hang (`GpuHang`)".

set_label and label are no calls in EncoderCall's numbering. The API table, the Metal and
conformance coverage maps, docs/API.md's DeviceRecovered entry and the runtime README say so.
The table's WorkCounts::spare_command_buffers_freed_past_recorded line moves to where the
script sorts it.

Verified: fmt only on this machine; tests::labels (both lowering policies) and
tests::device_recovery's relayed-loss test, which asserts the named notice, run on lavapipe next.
2026-11-12 12:12:54 -08:00
Anees Iqbal 2b0b59061a Runtime sampler descriptor: lod_bias, read as an Apple9 GPU reads it
SamplerDescriptor gains `lod_bias: f32` (MTLSamplerDescriptor.lodBias,
default 0, serde default), so a guest's bias is carried rather than
having no field to land in.

What Metal does with it, measured on the M3 Max (Apple9, macOS 27.0.1
26A434) with a throwaway Swift probe of runtime-compiled MSL (jobs
m3-max-19665/19666): level L of a 7-level texture held L, so every
sample read its own level of detail. Across 136 row groups no sample
changed with the sampler's bias: fragment implicit, shader bias(),
level(), gradient2d(), min_lod_clamp() and bias+min_lod_clamp; kernel
default, level, gradient and bias; linear and nearest mip filters on
float textures, both on uint ones; a NotMipmapped sampler's min/mag
choice; clamps [1,3], [1.5,MAX], [0,2]; biases -1000 to 1000, 15.99,
16, 16.5, 17, NaN, +-inf. The probe saw levels move with the shader
bias, the clamps, explicit levels and the NotMipmapped filter switch.
With MTL_DEBUG_LAYER=1 every value made a sampler with no assertion and
read back as set. Apple's tables list the bias under Apple10, which no
runtime device claims.

So the Vulkan sampler's mipLodBias stays 0 whatever the descriptor
holds: no bias is past maxSamplerLodBias, and none needs a portability
subset's samplerMipLodBias. The binding shape and the sampler word do
not carry it either. The runtime's state key does: on the M3 (job
m3-max-19683, with and without validation) biases 0 and 1, 1 and
1.0001, and 20 and 30 gave two states each, while 0 and -0, and two
NaNs of one encoding, gave one. The key takes the bits of `bias + 0.0`.

The Apple10 family row stays a gap, its reason now that the biased
level of Apple10 is not built. The conformance suite's SamplerSpec
states the bias too (tag 8, a word only where it is not 0, so no
recording's fingerprint moves), and both legs set it. METAL-COVERAGE
lists lodBias as implemented; CONFORMANCE-COVERAGE and the API
signature table are regenerated.

Tests: metal::sampler::a_lod_bias_makes_the_unbiased_sampler covers
every committed profile, every mip filter, three filter pairs and four
uses plus the unnormalized one, and 15 biases: the Vulkan sampler and
the binding shape are the zero bias's. That includes MoltenVK, which
withholds samplerMipLodBias, and biases past every device's limit.
runtime_lane::lod_bias::a_sampler_s_lod_bias_reads_the_unbiased_level
runs a kernel's biased samples through runtime sampler states of ten
biases, under linear and nearest mip filters, and compares them bit for
bit with the unbiased state's. It also checks the state-sharing rule.
2026-11-12 00:51:28 -08:00
Anees Iqbal 834b663634 Runtime: pull a far vertex layout on a driver whose fixed-function fetch wraps at 4 GiB
lavapipe's fixed-function vertex input takes an element's displacement modulo 2^32: the
conformance case vertex-fetch-past-4gib-small-buffer reads the wrapped words in 24 elements
where Metal reads zero. Vulkan places the attribute at the whole displacement (28.4 Vertex Input
Address Calculation) and robustBufferAccess2 makes a read past the bound range zero, so the
wrap is the driver's defect: a new RuntimeDriverDefect::VertexFetchWrapsPast4GiB, listed for
MESA_LLVMPIPE alone.

On a listed driver the render lowering names the fixed-function layouts a draw may fetch past
2^32 bytes of their bind offset in a new BindState/BindShape field, far_vertex_buffers, and the
binder pulls them (the existing pulled-vertex-buffer variant, whose fetch reads past 2^32 as
zero). The reach is the existing furthest_element: a draw's last vertex, 65535 plus the base
vertex for ushort indices, the base instance plus the last instance over the rate. Those are
pulled by default. A per-vertex layout of a uint-indexed draw, and an indirect draw's, has its
reach stated by GPU memory; pulling it costs a variant for every such draw, so it is behind a
new runtime-only DevicePolicy switch, vertex_reach (VertexReachPolicy::Bounded by default,
Exact in exact_answers()). Under Bounded such a draw keeps fixed function and is announced
vertex-fetch-may-wrap (Precision). The draw-again paths (rebound, restated) compare the pulled
set; the host-step precompile names none; the GPU replay derives it from its indirect draw.
WorkCounts::far_vertex_fetch_pulled_draws counts the pulled draws.

The conformance case's known-gaps row is removed: replay runs under Exact. FAST-PATHS gets the
switch's row (its lavapipe cost is measured next, in a later commit). New tests: the binder
pulls a named layout; far_layouts under both policies; runtime_lane::far_vertex_fetches
measures the defect on every device under both values, and far_reach_costs (ignored) measures
the exact form's cost.

SEMANTICS_VERSION is unchanged: an empty far_vertex_buffers, every existing shape's, plans as
before, so no output changes under an unchanged key.

Verified so far: api_signatures blessed (signatures.py), refusal_surface --check, the
conformance and Metal coverage checks; builds and tests follow as potluck jobs.
2026-11-11 10:54:47 -08:00
Anees Iqbal b4cd0f9f91 Regenerate docs/CONFORMANCE-COVERAGE.md for the XTX's ledger rows and read_through's notice
The coverage document counts the ledger's rows and lists each one's gap, and counts the modules
that declare a notice: the 27 RADV NAVI31 rows, the corrected text of the extended-range mipmap
rows, and read_through's `shared_memory_notice` (a module that declares a notice outright now)
move it. Written by `python3 -I scripts/conformance-coverage/coverage.py`; `--check` passes.

Found by the conformance suite's run at 0ef30d74db (potluck m3-max-14873, lavapipe on um790):
`the_conformance_coverage_document_is_what_the_sources_derive` failed, the only failure of 1043.
2026-11-11 04:10:13 -08:00
Anees Iqbal 9b046a7cf8 Conformance: lavapipe's row for vertex-fetch-past-4gib-small-buffer, its fixed-function fetch wrapping at 2^32
Replayed on lavapipe (llvmpipe, LLVM 23.1.4, homelab-um790-xtx-1, job
m3-max-13976), both policies: case/out differs in 24 elements, the largest
difference 27, and nothing else in the case. The 24 are the four slots of the
six far draws at strides 4 and 12, the layouts the runtime leaves to the
device's fixed-function vertex input. The first differs at byte 32 (Metal 0,
ours 0x10, word 0: element 2^30 at stride 4, displacement 2^32 read mod 2^32),
and 27 is word 11 (0x1b), element WRAP_12 + 3 at 2^32 + 44 read at byte 44. The
pulled stride-6 draws read zero as Metal does. llvmpipe reports
robustBufferAccess2 (vulkaninfo in job m3-max-14015), under which a vertex input
past the bound range reads zero, so the wrapped word is lavapipe's own fetch.

The same case replays exact on RADV (AMD Radeon 780M, RADV PHOENIX, job
m3-max-14015) and on MoltenVK on the M3 Max (m3-max-13932), under both policies.

The row is scoped to llvmpipe and names what is open on our side: pulling an
attribute whose draw may fetch past 2^32 bytes of its bind offset on a device
whose fixed-function input wraps, which no device check finds today.
docs/CONFORMANCE-COVERAGE.md counts the row (3584 ledger rows).

Verified: coverage.py --check "as derived" locally; the Linux conformance suite
and the lavapipe replay of the case at this tip.
2026-11-11 00:34:10 -08:00
Anees Iqbal c92dcb77fc CONFORMANCE-COVERAGE: count vertex-fetch-past-4gib-small-buffer's recording
scripts/conformance-coverage/coverage.py over the tree with the case's
recording: 1277 committed recordings, 853 cases running a committed shader
fixture, 1193 metal_run answers, and vertex_fetch_reach's row reads one case,
one recording, 110 compared fields. The other rows move only where the
module joins the lists of families that call an item.

Verified: coverage.py --check reads "as derived" at this commit (locally);
the_case_set_is_the_recordings_the_document_counted in the Linux
conformance suite at this tip.
2026-11-11 00:34:10 -08:00
Anees Iqbal 555b13d57e RUNTIME_VERSION 2016, the runtime-sources pin and the coverage doc for the triage-c and 720 branches, merged as-is
What: on the owner's word (11-10 ~06:35, "stop tests, merge as-is into development"), with no further check:
- steelbrain/triage-c (8): the vertex_fetch_reach fixture, its AIR and the conformance case
  vertex-fetch-past-4gib-small-buffer (no Metal recording or cost record yet); InstanceShadows::holds by binary
  search; the GPU-fault lane prints its notices; the color-groups lane's four-color option
  (DeviceOptions::color_attachment_limit, doc-hidden) in place of the profiles layer, and the dropped re-exports.
- steelbrain/triage-a-720 (2, marked WIP/UNVERIFIED by their author): merge verdicts recorded only clear of load
  and repeated (CHECK_VERSION 6); the paths test's relay condition.
RUNTIME_VERSION 2015 -> 2016; the pin and docs/CONFORMANCE-COVERAGE.md follow.
Known state: the vertex-fetch case lacks its Metal recording and cost record; 720's after-fix counts never ran.
Not in pin 36 (ef7af82fe4). Verified here: pin-compute, generators, api-signatures --check clean only.
2026-11-10 06:57:53 -08:00
Anees Iqbal 24025b3866 Argument-buffer textures read through a sampler: border texels from the handle-table entry
What: a Metal 4.1 read(sampler, ...) of a texture held in an argument buffer now hands back
Metal's border texel of the resident texture, its pixel format's through its swizzle, for every
sampler: a constexpr one of any border colour, a runtime [[sampler(n)]] and an argument buffer's
sampler (the colour from the sampler's word).
- The binder writes each texture's border texels (metal::sampler::border_texels of its format
  and swizzle, the layout of a slot's BorderTexels specialization) in its handle-table entry's
  flags, bits 3 to 14 (memory::handles::FLAG_BORDER_TEXELS); handle_entry_flags carries them, so
  a consumer's own table of every ID gets them too.
- A module with such a read searches the table in a new indexed form (Lookup::Indexed): the
  handle is the element with the found entry's index in its top 16 bits (HANDLE_ENTRY). The read
  loads the entry's border texels by it (handles::border_texels); every use that reads another of
  the entry's flags (texel class, red-blue order, out-of-bounds alpha) loads them from the entry
  into the flagged handle's layout (handles::flagged_handle), through one typed value
  (texture::emit::HeapFlags) so no reader sees the entry index in those bits.
- through::finish selects the border texel for slots and heap elements alike; a heap member read
  by its raw texels (an extended-range form) takes its border and its zero past the level or
  layer from its own image's addressing inside the raw arm, not the float array's neutral's.
- The old heap path, which selected the out-of-bounds texel (transparent black, unswizzled) and
  refused every other border colour and runtime sampler NotImplemented(ArgumentBufferTextures),
  is gone, with ReadSampler::transparent and the forced alpha flag of such reads.

Why: the M3 runs all three (conformance cases read-through-heap-border, read-through-heap-sampler,
and read-through-rgba8-swizzled's rt_heap_zero, where (G, R, 1, 0) reads (0, 0, 1, 0) past the
edge and we read (0, 0, 0, 0)). A 32-bit heap handle had no room for 12 border bits beside the
element, class, red-blue and alpha fields; the entry does (bits 3 to 14 were unused).

SEMANTICS_VERSION 2017 (translation output changes). ARTIFACT_FORMAT_VERSION unchanged: no
encoded type changed. RUNTIME (for the orchestrator's bump): the runtime's handle tables
(heap_sets.rs, through bind::handle_entry_flags) now carry the border-texel bits.

Ledger: the three rows of these gaps go; llvmpipe's rt_heap_zero row of the swizzled case keeps
only llvmpipe's 8-bit unorm conversion. FAST-PATHS known gap removed; REFUSALS.md,
CONFORMANCE-COVERAGE.md regenerated (METAL-COVERAGE.md unchanged).

Verified: not yet built (next: Linux build, clippy and the touched tests).
(cherry picked from commit bc000fa475e572131248b908541dbe29f1f5996c)
2026-11-10 04:45:05 -08:00
Anees Iqbal 7b41681b7e Regenerate CONFORMANCE-COVERAGE.md after triage-a's ledger rows
The llvmpipe 3D mirror rows' text and the RADV row of pass-bytes-srgb-decode-all-bytes
(the two commits before this one) change what the coverage document derives.
Verified: scripts/conformance-coverage/coverage.py regenerated it.
2026-11-10 04:15:23 -08:00
Anees Iqbal e14253045b CONFORMANCE-COVERAGE.md regenerated for the extended-range mipmap cases and their ledger rows
Regenerated by scripts/conformance-coverage/coverage.py in job m3-max-13466 at 94a89c5273
(gem10, lavapipe cfg): two more recordings (1265), 23 more ledger rows (3484), and the
blit_encoder_commands family's case count (11). The conformance crate's tests passed against
it there (1050 of 1050).

(cherry picked from commit 0bbbd5f379db297f84df60b129b15a4e6e1222d5)
2026-11-10 03:00:00 -08:00
Anees Iqbal 95969121f1 Known gaps: the padded-fetch cases on the Iris Xe
From the replay of the 11 padded-fetch cases on the Iris Xe (job m3-max-13463): its linear loads
exact, an sRGB twin's colour a half step from Metal's table where the device's Pow decode rounds
apart (device-pack-conversion), and the clear and draw cases the announced stored-codes
difference; the same replay held every padded-blend row on the Iris Xe. CONFORMANCE-COVERAGE.md
regenerated.

(cherry picked from commit 51f7de510a25e696fbb83be145d73e6ee70be94f)
(cherry picked from commit 92f9642928970b8d8f19731a667f9af3572881df)
(cherry picked from commit 9dd440ac76a1bbb46b6d001e936d4693dbe1cd06)
2026-11-10 02:59:19 -08:00
Anees Iqbal 75b45c6493 Regenerate CONFORMANCE-COVERAGE.md after the padded-fetch rows
python3 -I scripts/conformance-coverage/coverage.py; the coverage test found the document stale
at 85edc61c8f (job m3-max-13469).

(cherry picked from commit 53c388806fad4a522aee606e4f8021e95cdabfdb)
(cherry picked from commit b90d930e487ed30c141f5d0e20e0d5c6496a07c6)
(cherry picked from commit 7b59616984a87356c649888200cca22fb52e00be)
2026-11-10 02:59:19 -08:00
Anees Iqbal 8ed67dfa17 Regenerate REFUSALS.md and CONFORMANCE-COVERAGE.md for the padded fetch and its cases
python3 scripts/refusal-surface/refusal_surface.py (the padded fetch's FramebufferFetch site
gone) and python3 -I scripts/conformance-coverage/coverage.py (the padded-fetch cases);
METAL-COVERAGE.md is current (coverage.py --check).

(cherry picked from commit 0c8ad6c47d76ff7436835fa5377ff17700151c21)
(cherry picked from commit f448ad63ca5d317526e923c2363c3f05a44a0068)
(cherry picked from commit 4037ac989aa2942bdde46538b8b9856a9bfd3d78)
2026-11-10 02:59:19 -08:00
Anees Iqbal af1dd85b66 Blend-source notes state their bound and the device compiler's regrouping; padded rows on the 5080 and the Iris Xe
ExtendedRangeBlendSource and ExtendedRangeFloatBlendSource (their docs, the API
catalogue entries and the FAST-PATHS device-gap row) now say what the suite
measured: the device's compiler may contract and regroup the in-shader blend
(MoltenVK on the M3 Max and NVIDIA's driver on the RTX 5080 compute
S·F + D·(1 - F) as D + F·(S - D)); a stored channel lands within two codes of
Metal's on a linear format and within six near zero on an sRGB twin; and where
the compiler regroups a padded format's blend, an infinite second source stores
an end code where Metal's sum is NaN, stored as 0. The FAST-PATHS row names the
padded formats, which it lacked, and no longer says 'not measured'.

known-gaps.tsv: the 168 extended-range rows (xr-blend, xr-gamut, xr-gradient,
xr-masked) whose Open item was the blend notes' documentation are closed (Open:
nothing, the recorded bound covering the difference); every one is within the
bound (survey of the rows' largest differences). The padded-blend rows are
regenerated for five venues: the M3 Max, RADV PHOENIX and llvmpipe as before,
and the RTX 5080 (b5080 entry xrblend2-padded-replay-5080) and the Iris Xe
(job m3-max-13386), 17 each. The 5080's second-source cases differ by the whole
code range as the M3's do, and its counts are exactly a model of
D + a·(S - D) over an unnarrowed float destination (971 on R10Unorm_X6, 1850 on
RG10Unorm_X12); the Iris's are exactly the sum as written over the half
destination (844, 1607), as RADV's; llvmpipe's the sum as written over a float
destination (962, 1831). No venue's largest difference exceeds the M3's, the
780M's or llvmpipe's.

engine_padded_blends: a fetch of a padded attachment makes the whole pipeline
on every committed profile that orders fetch (storage form or input
attachment) and names the device gap elsewhere; a bfloat fetch stays
NotImplemented(Format), the negative control. Not yet run.

(cherry picked from commit c923b6d49c36c8354f375f6dababfd5f81f1ffbc)
(cherry picked from commit e3a2b226d7f5938811d1d251172088baf05c15cb)
(cherry picked from commit 85a2473cc6ea6a2c9165e2614d1e87ca77c1627e)
2026-11-10 02:59:18 -08:00
Anees Iqbal e5fffbf611 Known gaps: the padded-blend cases on lavapipe
Seventeen rows for the 256-bit llvmpipe venue, the counts its replay printed at
31d3ac25a2 (job m3-max-13288). lavapipe computes the second-source blend as
written with a product fused into the sum (native-fma), so an infinite second
source's NaN stores code 0 as Metal's does and no linear element is more than two
codes from Metal's.

CONFORMANCE-COVERAGE.md regenerated for the ledger's row count.

(cherry picked from commit 37237c7c805a19a814c809d13a1b2c196fd148b2)
2026-11-10 01:36:16 -08:00
Anees Iqbal 54e0d91b2c Known gaps: the padded-blend cases on the M3 Max and RADV PHOENIX
Seventeen rows per venue, the counts the replays printed at 31d3ac25a2 (M3 under
MoltenVK, job m3-max-13278; the 780M under RADV, job m3-max-13289). Each blend runs
in the shader in the device's arithmetic, unclamped, and lands a code or two from
Metal's on a linear format, up to six near zero on an sRGB twin. The second-source
blends differ by venue: the M3's compiler computes S·a + D·(1 - a) as D + a·(S - D),
so an infinite second source stores an end code where Metal's IEEE sum is NaN,
stored as 0; RADV computes the sum as written and stores 0. A model of each form
reproduces the replay's count exactly on R10Unorm_X6 and RG10Unorm_X12.

CONFORMANCE-COVERAGE.md regenerated (the new case module, its recordings and rows).

(cherry picked from commit e117b085632700b586e56d043b91b16b2365a524)
2026-11-10 01:35:57 -08:00
Anees Iqbal 848c072b8f CONFORMANCE-COVERAGE.md with read_through's ledger rows
Regenerated by scripts/conformance-coverage/coverage.py after the 96 llvmpipe
rows and the three read_through gap rows: 3410 ledger rows.

Verified: the conformance suite on msi (job m3-max-13292) failed only
the_conformance_coverage_document_is_what_the_sources_derive before this.

(cherry picked from commit 3514ac3e7a91a8245325939db06bbec5e950a63a)
2026-11-10 01:30:12 -08:00
Anees Iqbal 0fcb724d2c CONFORMANCE-COVERAGE.md with the read_through family
Regenerated by scripts/conformance-coverage/coverage.py: 13 more recordings,
162 case modules, three ledger rows, and read_through among the families that
compare MTLSamplerState and the texture and buffer items it calls.

Verified: coverage.py --check reported the doc stale before and is the
generator's output now.

(cherry picked from commit b2b166a2d4b03ed957824bc8290b214d4c78c66b)
2026-11-10 01:30:11 -08:00
Anees Iqbal 733108b25d fresh_contents: the Depth32Float rows' zeroed-pattern declarations are held by the row test
The family's declaration test held every allowance to the notices site or
the fresh value declaration, so the two Depth32Float rows' unchecked fresh
site under fresh-pattern-zeroed (55df5fa64b) failed it. The test now names
that declaration, counts the texture row's three extra allowances and the
pattern row's two, and checks no other row carries it.
docs/CONFORMANCE-COVERAGE.md is regenerated
(python3 -I scripts/conformance-coverage/coverage.py): fresh_contents now
loosens one measured value.

Verified: both failed in the conformance suite on gem10 (job 10312); the
rerun follows.

(cherry picked from commit 184d622fa578658947c19dd19df29ff160a91b9b)
2026-11-08 18:15:24 -08:00
Anees Iqbal ee5d3cfab9 Regenerate the conformance coverage for lavapipe's linear texture alignment rows
d62b50b90e added 16 known-gaps rows for device-linear-texture-alignments (lavapipe's own
answer) without regenerating docs/CONFORMANCE-COVERAGE.md: ledger rows 3295 -> 3311 and the
case's rows listed. scripts/conformance-coverage/coverage.py, nothing else changed.
2026-11-07 21:10:16 -08:00
Anees Iqbal 803648acd8 Make a texture buffer over a buffer whose texels run past its length, those texels in a tail
What. Buffer::new_texture of a texture buffer whose texels run past
the buffer's length (inside Metal's allocation rule) is made instead
of returning NotImplemented(TexelsPastBufferLength), as a 2D texture
or array already is. Its texels inside the length are the buffer's
bytes; those past it lie in a tail of its own, a zeroed Shared buffer
the runtime owns, laid out from the functions' first byte (the offset
rounded down to 16, as Metal's kernels read a texture buffer).
- GPU: the texture buffer takes the staged form (StagedTextureBuffer,
  announced): its bindings view the tail as their staging buffer. The
  copy in takes the bytes inside the length from the buffer (none
  where the texels lie wholly past it), the copy back gives only those
  bytes back, and a Shared buffer's merge copies the current part from
  and to the buffer and the tail apart (staged_bytes, which now names
  a texture buffer's staging buffer as well as an image's, and
  record_out, which copies the staging buffer's every byte).
- CPU and blits: as for 2D, each row split at the length
  (Texels::past, whose rebase is now the tail's base, tail_base).
Only an IOSurface plane past its surface stays
NotImplemented(TexelsPastBufferLength); the gap's doc, its reach in
scripts/refusal-surface/reach.tsv, the StagedTextureBuffer catalogue
entry and docs/API.md's accepted difference say so.

Why. Plain Metal makes these: reims-vgpu's tbprobe on both x86 oracle
Macs (jobs m3-max-4019, 4046, 4152) and the M3 Max probe
(probes/texture_buffer_past_length.m, job m3-max-4617), whose paths
read and write the bytes past the length as one memory, as a 2D
texture's. The tail gives the 20000-byte buffer's answer for every
shape, as the 2D tail does.

Tests.
- tests/buffer_tail_device.rs: a texture buffer of 64 R32Uint texels
  from 3968 of a 4096-byte buffer (32 past) and from 4096 (all past):
  as made, after a kernel's write across the length (ob1_texel_buffer)
  and after replace_region past it, a kernel, get_bytes and a blit
  read alike; the buffer's words inside the length are written, every
  other word and 16 buffers around it keep theirs.
- linear_plan unit rows: texture buffers past the length made.
- runtime_lane::buffer_textures: the texture buffer at 3968 is made.
- Conformance: buffer-tails-texture-buffer, 1024 R32Uint texels from
  16384 of a 20000-byte buffer (904 inside): ob1_texel_buffer reads
  and writes, getBytes, replaceRegion, blits from and into it, the
  buffer's bytes; recorded on the M3 Max (3 runs, one outcome, every
  site the model's answer).

Verified:
- M3 Max, macOS 27.0.1: the probe (m3-max-4617) and the recording
  (m3-max-4640): buffer-tails-texture-buffer is made, announcing only
  the staged-texture-buffer notice, and the 2D tail cases still are.
- gem10 (m3-max-4635): clippy of the runtime (all targets, all
  features) and of runtime and validation under --cfg m2v_cpu_icd;
  the runtime's unit tests (70 of 70); the runtime lane on lavapipe
  (172 of 172, the new texture-buffer test among them); the
  buffer_textures, texel_swizzles and degrade_notices validation lanes
  (27 of 27).
- gem10 (m3-max-4662): rustdoc of runtime and conformance; the
  conformance unit tests over the tails, refusal, catalogue and
  accepted-difference rows (20 of 20); a lavapipe replay of the six
  buffer-texture cases, all six announced as the ledger expects.
  Clippy there named the shape test's two constant assertions, now
  const blocks; clippy of runtime and conformance and those unit
  tests again on this tree: m3-max-4688.
- Negative control (m3-max-4662): the runtime's sources at 5020e74ebb
  with these tests and cases fail the new device test with
  NotImplemented(TexelsPastBufferLength), and the replay refuses
  buffer-tails-texture-buffer at case/texture.

(cherry picked from commit f0a3390160064eabb820fbdc4f83822e0492fb5f)
2026-11-07 11:19:37 -08:00
Anees Iqbal 9ee7323e76 Make a 2D texture over a buffer whose texels run past its length, those texels in a tail
What. Buffer::new_texture and new_linear_texture of a 2D texture or a
2D array whose texels run past the buffer's length (inside Metal's
allocation rule, past which Metal answers nil and so does the plan)
are made instead of returning NotImplemented(TexelsPastBufferLength).
The texels inside the length are the buffer's bytes, exactly as
before; those past it lie in a tail of the texture's own: a zeroed
Shared buffer the runtime owns (Texels::tail), laid out from the
texels' first byte, and no other allocation's memory.
- GPU: such a texture is kept as a shadow image (ShadowedTexture is
  announced). The tail is the shadow's staging buffer; its copy in
  takes the bytes inside the length from the buffer, its copy back
  (staging rows clipped by inside_rows) writes only those bytes back
  to the buffer, and a Shared buffer's merge copies the current part
  from and to the buffer and the tail apart (shadow_merge.rs).
- CPU: getBytes and replaceRegion split each row at the length
  (past_runs, write_past).
- Blits: copies that name the texture's bytes split their rows at
  each side's length (RowsCopy::split) and copy the part past it
  from or to the tail; a copy with an ordinary texture goes through a
  scratch buffer of the encoder; synchronizeResource covers the bytes
  inside the length; the extended-range rewrite announces its note
  rather than binding the buffer's words past the length.
Texture buffers and IOSurface planes past the length stay
NotImplemented(TexelsPastBufferLength), whose doc now says so.

Why. Plain Metal makes these textures: reims-vgpu's oracle on the
AMD 5300M and the UHD 630 (4096-byte buffer, 64x16 and 64x17 at rows
of 256, offsets 0, 256 and 2048) and the M3 Max probe
(probes/texels_past_buffer_length.m, job m3-max-4337) for the same
shapes. Under Policy::Dies the refusal ended the consumer's host. The
M3 Max's paths agree that the bytes past the length are one memory:
the next allocation's over a 4096-byte buffer, the allocation's own
zeros over a 20000-byte one, read and written alike by every path.
The tail is the second answer for every shape; docs/API.md's accepted
differences records that the runtime never reads or writes another
allocation there.

Tests.
- tests/buffer_tail_device.rs (m2v_gpu / m2v_cpu_icd): 64x17 over
  4096 bytes, 64x16 at 2048, 64x80 over 20000 bytes (row 78 across
  the length), 64x1 wholly past, a Private buffer's, and a 2D array
  whose second slice is past the length; each path (kernel, blit,
  CPU) reads what each other path wrote, the buffer keeps its bytes,
  and 16 buffers around it keep theirs.
- Unit tests: linear_plan expectations (2D and array past the length
  made, texture buffers refused), RowsCopy::split, inside_rows.
- Conformance: buffer-tails-kernels (scout_read_u / scout_write_u,
  getBytes, replaceRegion, the buffer's bytes) and buffer-tails-blits
  (blits from a buffer across the length and from a texture past it,
  a copy out into a texture, blit and getBytes reads), RGBA8Uint
  16x256 at offset 4096 over 20000 bytes, recorded on the M3 Max
  (3 runs, one outcome, every value the model's).
- The runtime_lane assertion that a 2D array past the length is
  refused now asserts it is made.
REFUSALS.md and CONFORMANCE-COVERAGE.md regenerated.

Verified:
- M3 Max, macOS 27.0.1: probe m3-max-4337 (the shapes above); record
  m3-max-4492 (both cases, 3 runs, one outcome each, every site the
  model's answer); replay on MoltenVK m3-max-4508: buffer-tails-* and
  the four buffer-texture(s)-* cases announced (every value exact).
- gem10, lavapipe (LLVM 23.1.4, 256 bits), m3-max-4509: unit 71/71
  (linear_plan, buffer_texture, blit_plan, tail); device tests under
  m2v_cpu_icd 139/139 (the four buffer_tail_device tests and every
  buffer_texture, shadow and blit test); runtime_lane::buffer_textures
  7/7; conformance replay of the same six cases: all announced.
- Negative control, same job: the runtime's sources at 0e2c70f08f with
  these tests: the four device tests fail at Buffer::new_texture with
  NotImplemented(TexelsPastBufferLength), and both conformance cases
  are refused with it (case/texture, case/work).
- m3-max-4565: clippy -D warnings (runtime and conformance; runtime
  and validation under m2v_cpu_icd), rustdoc -D warnings, unit
  rows_split, buffer_tails, refusal and api_surface tests.

(cherry picked from commit e483e17c6c4d087a50a95cda297cf291934bee54)
2026-11-07 10:44:25 -08:00
Anees Iqbal 96482aadbf Re-derive the conformance coverage document for argb8-targets-destination-alpha's rows
6d7223a048 replaced the case's refused row with a lavapipe texel row and did
not re-derive the document. Verified: scripts/conformance-coverage/coverage.py
writes this; the ledger holds 3295 rows.
2026-11-07 10:41:21 -08:00
Anees Iqbal b5fa3a8067 Bless the API signatures and re-derive the coverage doc on the rebased tree
On development c0d0511d68 plus this branch, the signature bless rewrites one
record, metal2vulkan-runtime::commands! (macro-template), whose committed text
no longer matched the macro. The coverage doc is regenerated from the merged
case set and ledger.

Verified: m3-max-4172 on homelab-ms01-1 at f7a9747f90 ran
`scripts/api-signatures/signatures.py --bless` (one signature changed),
`scripts/conformance-coverage/coverage.py`, and
`scripts/refusal-surface/refusal_surface.py` (REFUSALS.md unchanged), then
clippy in all three configurations and rustdoc, all clean.

(cherry picked from commit 7644dfd59580037247e8236f5ed4a8f84bbcf282)
2026-11-07 09:37:29 -08:00
Anees Iqbal 4df5d48abe Ledger: drop the 8 RADV rows that rows3's two fixes settled
rows3 (e1ff50ac33) made two product fixes:
- GPU writes into read-only no-copy memory are now dropped off macOS.
- pass-sequence-color-actions' DontCare attachments are kept under the
  exact policy the replay runs.
The RADV rows for both families recorded the old answers, and the whole
RADV replays at development c418a1f55b read every one of the 8 as stale
("no longer diverges ... and the known-gaps ledger still lists it"), on
the Radeon 780M (m3-max-4236) and on the RX 7900 XTX (m3-max-4237) alike:
- host-page-writes-kernel-store-read-only and
  host-page-writes-visibility-read-only, each at
  case/bytes-in-a-later-command-buffer-bytes and
  case/bytes-the-cpu-reads-bytes;
- pass-sequence-color-actions at its four MTLStoreActionDontCare cells.
No venue's row is left for either family. docs/CONFORMANCE-COVERAGE.md
re-derived. Besides these, each replay held one unlisted line,
pass-bytes-srgb-decode-all-bytes, which amdperf owns.

(cherry picked from commit 0017a2c76ddad7a214127e4b700e5740fe3b6917)
2026-11-07 09:32:23 -08:00
Anees Iqbal 9ab152f477 Ledger: RADV's remaining families, 295 rule-1 rows (275 RADV, 20 NAVI31)
The rest of the RADV ledger round: every line the whole RADV replays
read as unlisted, on the RX 7900 XTX (m3-max-4102, 306 lines) and the
Radeon 780M (m3-max-4108, 281 lines, each identical to an XTX line),
except the 10 lines the case declarations of b5c45c23cf settle and
pass-bytes-srgb-decode-all-bytes' one line, which amdperf owns.

Each row names the native note the RADV run announced for its case at
that site (the case block's "the device's native notes this case
announced" line, or a case-declared notice that fired), and states the
device's own answer with RADV's first differing element and largest
difference:
- 275 rows read "RADV": the 780M holds each of them with the same
  answer, so a RADV row holds on both of the consumer's AMD GPUs.
- 20 rows read "NAVI31": ycbcr-gathers-* and ycbcr-minify-band-*,
  where the XTX's memory is not the host's and the slot binds a
  converted image. The 780M, which reads the planes in place, does not
  diverge there.

Families with a text of their own:
- sampler-r-address-modes and sampler-border-colours: one lane, r the
  negative smallest subnormal, which Metal reads as layer 0 and the
  device reads below it.
- sampler-axis-mode-triples: the device's weight in whole 1/256 steps.
- denormal-word-fetches: the device's nearest samples flush a denormal
  and its gathers keep it.
- BC1 to BC3 sRGB: the sRGB decode moves, since the 780M's block decode
  is measured to be Metal's. BC4 and BC5: the device's decode.
- a2c-*: the device's coverage at alpha 0.5 is samples 0 and 2, and its
  resolve rounds a tie down, as device-rounded-resolve records for RADV.
- texture-fills, nearest-sample-positions, sample-positions-default-*,
  math-frexp-ilogb-half, the pass-bytes tanh and encode sites, and
  blend-interaction-format-*.
The other rows take another venue's venue-neutral text, after the first
differing element and the largest difference were substituted and the
text was read against RADV's answer.

docs/CONFORMANCE-COVERAGE.md re-derived (scripts/conformance-coverage).
Proof: the whole RADV replay on both GPUs at this branch's tip.

(cherry picked from commit 2e0f7f2baf5f72200580b2092005e49645eca4be)
2026-11-07 09:14:32 -08:00
Anees Iqbal 231a7d86f7 Put a DontCare colour's kept texels behind DontCareColorPolicy::Kept
The owner's rule 1 keeps the fast form of every speed-for-accuracy choice the
default. A colour attachment of a texture's own image stored DontCare now
stores as the driver stores it by default (DONT_CARE where the driver is
measured to keep one of Metal's answers or to store as Metal's own, else
STORE), announced dont-care-store, and renders through the pooled backing
that keeps its earlier texels only under the new opt-in switch
DevicePolicy::dont_care_colors = DontCareColorPolicy::Kept, which
DevicePolicy::exact_answers() selects.

- metal2vulkan: the new public field DevicePolicy::dont_care_colors and enum
  DontCareColorPolicy { Driver (default), Kept }. Its docs give each form,
  its cost and Metal's documentation ("You need to assume that GPU discarded
  the texture's contents"). The runtime alone reads it, so no profile carries
  it (tests::fast_paths checks that no fingerprint moves).
- runtime: kept_bytes::settle takes the backing only under Kept. The docs of
  kept_bytes, render_target, attachment_stand_in, degradation and
  WorkCounts::kept_texels_passes, which counts only the Kept form's passes,
  now say which policy they describe.
- docs/FAST-PATHS.md: the choice moves from "Costs of matching Metal" into the
  table, as a row with its default, its switch, its bound and its measured
  cost. docs/API.md's dont-care-store entry and the Render passes accepted
  difference name the policy.
- Tests of both settings. dont_care_stores' default-policy tests are back to
  their earlier form (each texel one of Metal's two answers, announced where
  the driver does not store as Metal's own) and assert that no pass took a
  backing. The new exact_answers_keep_a_dont_care_color_s_earlier_texels_on_
  every_driver runs under Kept: the single-sample cases, both barriers and the
  two 4x colours keep their texels exactly and are counted.
  deferred_calls's refused-end test is back to its DontCare form.
  clear_reach gains lane_with.
- conformance: the Policy::Exact doc lists queue_sharing and dont_care_colors.
  The colour case's dont-care-store comment says what each policy gives.
- The known-gaps ledger keeps the eight pass-sequence-color-actions rows
  removed. It is held against `conformance replay`, which takes the exact
  policy, as the BGRA10_XR compressed-blit rows already are.
- The API signatures are blessed and docs/CONFORMANCE-COVERAGE.md is
  re-derived (its ledger table had kept the rows that both families removed).
  REFUSALS.md does not change.

Verified: cargo fmt only. The Linux clippy, rustdoc, suites and lavapipe
replays under both policies follow as potluck jobs.

(cherry picked from commit ec3479464c0f72ab5443223a28e23e84ec23e78d)
2026-11-07 09:05:59 -08:00
Anees Iqbal c0d0511d68 Ledger: RADV's half-output-blends, pixel-downscales, half NaN, pixel-samplers and vertex-format families, 201 rule-1 rows
From the same whole RADV replay (m3-max-4016 at 7470a49e6d). Each
family's notes are announced for its cases on RADV (the case's own
native-note line, or every declaration fired: none of these cases is
among those whose declarations did not all fire, save the MoltenVK-only
set-past-layout one), and each row states RADV's own answer:

- half-output-blends (63): the device's fixed-function blend where
  Metal's compiler folds blend and conversion under fast math, under
  half-output-fast-math-blend; the rows say whether a site is within
  that note's bound is not established, as llvmpipe's do.
- pixel-downscales (42): a normalized downscale differs by 0.031 of a
  code at most, inside device-sampling's RADV bound (0.548); a pixel
  sampler's by up to 0.876, inside pixel-sampler-scaling's 2/255; the
  digest sites point at the head and tail rows.
- half-texel-nans, half-read-nans, half-write-nans (38): each a NaN
  whose sign and payload are the device's, under native-nan-encoding
  and the case's announced conversion note, with RADV's first
  differing element.
- pixel-samplers (38): digests of the device's own sampler and
  conversion; the subnormal arg and slot sites hold the digest
  MoltenVK and lavapipe answer, the device's floor of a negative
  subnormal, under device-denormals.
- vertex-format (20): a narrow float attribute's NaN widened with its
  payload, under device-nan-encoding; a float read as half keeps the
  NaN's sign, under native-nan-encoding.

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

(cherry picked from commit 8e309cbacd31cdf61ecc74bbad8876225ae7a299)
2026-11-07 08:37:49 -08:00
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