Files
metal2vulkan/docs
Anees Iqbal 1bcc8324c3 Take MoltenVK's normalized vertex fetch as Metal's on the M3 Max's identity
One work packet, landed as 4 commits (15658d8c9b..d736af8d66 on archive/development-linear-2026-10-28), in order:

* Take MoltenVK's normalized vertex fetch as Metal's on the M3 Max's identity

A measured driver deviation, DriverDeviation::MetalNormalizedVertexFetch with its
VkProperty, row and lane: the device's fixed-function UNORM/SNORM vertex conversion is
Metal's float at every code. The row is MoltenVK on Apple's GPUs of the APPLE9 identity
(the Apple M3 Max under macOS 27). Where the profile takes it, link's
fixed_function_notes records no DeviceVertexConversion for a normalized attribute and
returns VkProperty::MetalNormalizedVertexFetch, which Linked carries
(vertex_properties) and graphics_requirements adds to the render pipeline's
requirements: the format is pipeline state no module names, so the pipeline, not a
module, requires it, as its sample counts are required. Rule 1: a note only where the
device's answer can differ from Metal's.

What Metal answers, measured first (a scratch MSL probe on the M3 Max, macOS 27.0.1,
every code of every component of the 19 normalized formats, per vertex and per
instance, float4 and half4 attributes):
- float: the code over its maximum correctly rounded, but Int1010102Normalized's
  10-bit fields, which Metal reads as c * float(1/511) rounded to float: 96 of the
  1,024 codes (48 of each sign) one f32 ulp toward zero of the quotient. The deviation,
  the note's doc and the ledger say so; they said "correctly rounded" before.
- half: the exact quotient rounded once to half. The translation reads a half
  attribute as the device's float rounded to half, which differs at codes 65455 and
  65519 unsigned and 32759 and -32759 signed of every 16-bit component (one half ulp).
  So a 16-bit format read as half keeps the note on every profile, the deviation's
  included; an 8- or 10-bit format's float rounds to Metal's half at every code
  (checked exhaustively on the CPU), so it takes the property there too.

The lane runtime_lane::normalized_vertex_fetch reads every code of every component of
the 19 formats through the device, per vertex (one draw) and per instance (a draw per
element at its base instance), float4 and half4, against that rule computed exactly on
the CPU, and checks the notes, the requirement and the announcements. On MoltenVK
1.4.2, Apple M3 Max, macOS 27.0.1 (under maclock, --cfg m2v_gpu): 8,458,240 words of 76
fixed-function pipelines; every float4 word Metal's; 80 half4 words differ, exactly the
16-bit double-rounding codes, each one half ulp, under the note. Its CPU rule matches
all 1,872 normalized components of the committed recordings of vertex-format-float4,
-half4 and -instance-step (metal_s_recorded_rows_are_the_lane_s_rule).

Also: the runtime's vertex_conversion_notices expects no notice on a profile that takes
the deviation; engine_vertex_variants holds moltenvk-m3 to no note and the property
required (but the eight 16-bit half reads), lavapipe and amd-780m-radv to the note;
driver_facts' tables list the deviation. FAST-PATHS' device-gap row names the exempt
devices, and a known gap records that the pulled decode (fetch.rs's normalized) divides
Int1010102Normalized's 10-bit fields exactly where Metal multiplies by float(1/511).

SEMANTICS_VERSION 1887 (notes and requirements of MoltenVK's render pipelines), and
ARTIFACT_FORMAT_VERSION 468 (a VkProperty variant in the codec). api_signatures
blessed (two variants added). REFUSALS.md regenerated: unchanged.

Verified: cargo clippy --workspace --all-targets --all-features -D warnings, plain and
with --cfg m2v_gpu; RUSTDOCFLAGS=-D warnings cargo doc -p metal2vulkan; nextest of
engine_vertex_variants, driver_facts, device::tests, fast_paths, codec, cache,
api_signatures, api_surface, link: 371 of 372 passed, the one golden_hashes, whose
table is stale at the base too (2,724 changed cells with or without this change's
version bumps) and is re-blessed on development; the lane and
vertex_conversion_notices on MoltenVK under maclock.

* Draw the normalized-fetch lane's instance step over every field, and record lavapipe's every code

The lane drew every element of every format per instance into both attributes: about a
million single-point draws, 100 s on MoltenVK and 47 s on lavapipe in the container,
for a step that adds an index path and no conversion. Now each format draws both entries
per vertex over every element (every code in every component, as before), and the
float4 entry per instance over every element of an 8-bit or packed format and the first
n/4 + 1 elements of a four-component 16-bit format, which put every 16-bit code in one
of its components (Coding::legs); the 16-bit formats of fewer components are drawn per
vertex alone. 2.8 s on MoltenVK.

The first form's lavapipe run (Mesa 26.0.8 on LLVM 21.1.8, arm64, the linux-gate
container) is the first every-code reading of a device without the deviation, and the
note's recorded bound did not hold there: per vertex every normalized format is within
one f32 ulp of Metal's (Int1010102Normalized exactly Metal's, lavapipe multiplying by
the reciprocal too), but per instance a signed format's most negative code reads
unclamped, -128/127 and -32768/32767, where Metal (and Vulkan's SNORM rule) reads -1.
DeviceVertexConversion's recorded bound, the FAST-PATHS row and driver_facts' paragraph
say so; the signed formats stay unaudited on RADV, ANV and NVIDIA.

Verified: cargo clippy --workspace --all-targets --all-features -D warnings, plain and
(validation) with --cfg m2v_gpu; cargo doc -p metal2vulkan with -D warnings; the lane's
three tests on MoltenVK 1.4.2, Apple M3 Max, macOS 27.0.1, under maclock: 4,377,608
words of 51 fixed-function pipelines, every float4 word Metal's, 40 half4 words at the
16-bit double-rounding codes under the note.

* Name the 8- and 16-bit signed formats as lavapipe's unclamped instance fetch

lavapipe's per-instance fetch reads the most negative code unclamped for the 8- and
16-bit signed normalized formats alone: Int1010102Normalized's fields read Metal's at
every code per instance as well (0 of 4,096 words differ). The note's recorded bound,
the FAST-PATHS row and driver_facts' paragraph said "a signed format".

Verified: the lane's run on lavapipe in the linux-gate container (Mesa 26.0.8 on LLVM
21.1.8, arm64, --cfg m2v_cpu_icd): Int1010102Normalized per instance 0 of 4,096 words
off; CharNormalized to Char4Normalized and Short4Normalized one word a component past
the per-vertex count, 66,052 and 256 f32 ulps. Docs only.

* Re-pin the runtime sources at the landing tip

The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-10-28 17:24:21 +02:00
..