Commit Graph
435 Commits
Author SHA1 Message Date
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 0a1851164d Copy a no-copy buffer, heap or rebind whose import the caller's gate refuses or that fails, announced
A new HostMemory::with_import_gate(ImportGate) asks the caller once,
holding no lock of the runtime's, just before a no-copy buffer, a
no-copy heap or a buffer rebind imports its pages, passing an
ImportRequest with the pages the import would map. If the gate answers
false, or an import the device and the gate admitted then fails
(OutOfMemory, another Vulkan error), the object is made over a copy of
the pages instead of failing. The default stays import-first. The copy
is host-visible memory owned by the runtime; `contents` stays the
caller's pointer. Each commit copies in the bytes the CPU changed since
the last sync, and each batch's completion merges back the bytes the GPU
changed (CPU wins where both wrote), byte by byte, before events,
waiters and handlers see it. Every copy is announced
(`copied-host-pages`) and counted. Pages the process cannot read are
never copied (the first copy reads through the kernel:
process_vm_readv / mach_vm_read_overwrite). A copied heap's buffers lie
in the copy and its textures are shadows. A rebind's copy is laid out as
its import would be. A rebind over an in-place image is refused
(NotImplemented(RebindTextures)) and a heap's rebind still imports
without asking. A caller's DirtyPages log stays attached to the copy as
to an import. The in-place check's pointer class skips copied buffers.

Ports dev-perf's fff961b7e5, 630d1b0174, 33d7aa5e98 and 9b4d4190f5 onto
a smaller coherence design: every live copy is compared in full at each
commit and completion, instead of dev-perf's log-driven,
encoder-collected copies (dev-perf's copied.rs, 79301a2515 and its
fixes, sat on a page log development has replaced). Also brings
789fa3d294's unreadable-page rule, 5190983470's lane site, and
1c7d49f788's copied-buffer skip. A driver that refuses the pointer
still fails the call (dev-perf copied there too; not taken). Known gaps
in FAST-PATHS: the compare costs O(size) per commit and completion, a
byte both sides wrote keeps the CPU's value, and a shared event's value
can be seen before the merge (c5db2d1b8a not ported). RUNTIME_VERSION
1690. Runtime-sources pin recomputed.

Public API: ImportGate, ImportRequest { start, length }
(#[non_exhaustive]), HostMemory::with_import_gate,
Degradation::CopiedHostPages, Device::fail_next_host_imports (test
hook), and the WorkCounts fields host_imports_refused_by_host,
copied_host_buffers_{made,refused,degraded}, copied_copy_in_bytes,
copied_merge_back_bytes, copied_rebind_pages_made, copied_heaps_made.

Verified on the M3 Max (MoltenVK, m2v_gpu): 11 new device tests
(tests::copied_device: buffer, rebind and heap, gate refusal and failed
admitted import, unreadable pages, a heap texture round trip) and 167
tests in the touched device filters pass; the counters move as
expected ([1,1,1,0,0] for a refusal, [0,1,0,1,0] for a failed import)
and the announcement is heard; on a 64 KiB copy 4079 bytes copied in and
4080 merged back for a 4 KiB CPU write and a 4 KiB fill, checked
exactly. Sabotage: ignoring the gate and removing the merge fails the 3
buffer tests; ignoring the rebind gate fails both rebind tests (no heap
sabotage). 249 host tests pass. Workspace clippy plain and
--cfg m2v_gpu, and rustdoc, clean; clippy re-run clean on the landing
merge. Not run on Linux.
2026-10-28 23:36:31 +02:00
Anees Iqbal 8c09b7c2c0 Link a warm render creation from its recorded stages, and key the shader cache by its translator
A warm render state creation spent most of its own time in
Device::render_variant_key, decoding and specializing every Function
stage's AIR to learn its stages' compile keys, because the directory's
variant record named only the pipeline's key and a sweep stores no
pipeline artifact where the directory holds its stages. The record (v2:
new tag and magic) now also names the stages' function compile keys
(VariantStages); a creation that finds the record but not the pipeline
finds the functions by those keys alone (Sources::found_function: memo,
archives, disk, no translation) and links them (RenderVariant::link),
decoding nothing. Every creation writes its record. The keys are valid
exactly as long as the pipeline key beside them. (Ports dev-perf
f4d864d160; development's lookup has no warm-pass Prior/Found and no
fit_render_variant, and the bench it extended is gone.)

The shader cache's build directory was named by the runtime's version,
both artifact versions, the translator's SOURCE_DIGEST and the runtime's
own source digest (its build.rs over every file under src/, tests
included), so any runtime edit started the cache cold. Every translated
entry is the translator's answer for the inputs its key and profile
hash, so the runtime's digest goes (with build.rs, its sha2
build-dependency and the validation fingerprint's reference to it). The
translator's SOURCE_DIGEST stays, as its doc promises: an unbumped
translator change still starts afresh. The runtime's own creation
records (linked-use answers, reflection, variant record) are runtime
logic, so their names now hash RUNTIME_VERSION with their tag and key
(creation.rs record_name): a runtime change that bumps it reads none of
an earlier runtime's records. (Ports the idea of dev-perf db5f5baa73,
narrowed: no per-entry stamp, no other_build_hits, no public API
change.)

Not ported from the same area: dev-perf's pipeline-record hook and
Device::warm from an earlier process's records (14df1fb5fe, 66fe0ada29;
~3,200 lines on per-entry stamps this packet does not take).

Verified on the M3 Max (MoltenVK): 84 device tests of the shader cache,
creation, render-stage, sibling-work, archive and pipeline areas pass;
the guard a_second_device_links_a_recorded_sweep_with_no_stage_decoded
fails with the recorded-stage link disabled ((decoded, translated) =
(2, 0)) and passes with it; a_creation_record_of_another_runtime_version
_is_not_found passes. Release render-pipeline-split,
integer-vertex-attributes, one run: warm processes decode 2 stages
before and 0 after; cold counts identical; wall within run-to-run spread
on this case's small shaders. Clippy (plain and --cfg m2v_gpu) and
rustdoc -D warnings clean; 43 + 241 plain runtime/translator tests pass.
No version bumps. Runtime-sources pin recomputed.
2026-10-28 23:18:09 +02:00
Anees Iqbal d7d4870598 Wait a bound for a pipeline still being made, then drop its draws and dispatches
A cold MoltenVK compile inside one guest command buffer ran 11.59 s and
tripped the guest's own 10 s FIFO watchdog, which tore the task down;
development had no bound. New runtime choice DevicePolicy::pipeline_waits
(PipelineWaitPolicy::Bounded, the default, or Exact, which
exact_answers() selects), with bounds pipeline_creation_wait and
pipeline_commit_wait (4.5 s each, so one FIFO step waits 9 s at most).

Under Bounded:
- A render or compute state's creation hands its predicted making to the
  pool and waits for it up to the creation bound
  (WorkCounts::creations_left_making).
- A committed command buffer waits until its commit plus the commit
  bound for its draws', dispatches', tile dispatches' and execution
  replays' pipelines, then records each late one as nothing and runs on.
  CommandBuffer::dropped_draw names the first with VK_TIMEOUT. Counted in
  draws_dropped_still_making and dispatches_dropped_still_making, and
  announced as draw-dropped-still-making and dispatch-dropped-still-making.
- An execution's settle hands its makings to the pool.

A draw whose driver making failed now runs nothing and its command
buffer runs on, where it used to fail it: counted in
draws_dropped_unmade, named by dropped_draw(), and announced
draw-dropped-unmade (Degradation::DrawDroppedUnmade: the draw, its
state, a hash of the variant and specialization, and the driver's
error; once per device, or each time where announce_each asks). A
dispatch's failed making still fails its command buffer.

Docs: FAST-PATHS.md row, API.md policy bullet and catalogue entries,
runtime README Errors. RUNTIME_VERSION 1689. api_signatures.tsv
re-blessed. Runtime-sources pin recomputed.

Ports dev-perf 6f499ff764, 8c91a6e254, 33fc25b531, 5963fd6831 and
4ee316c55a, and the notice of aa7e78f23c in its minimal form (no per-key
set, no driver-message relay). The general-form predicted key
(7028c0d92a, ce02b68f23) is left out: on development it changed the
pipeline makings three M3 device tests count
(made_at_creation, pipeline_creation pooled making, its own
general_form_drawn), cause not found.

Verified on an M3 Max (MoltenVK 1.4.2), under maclock: the six bound and
drop device tests under both policies (the unmade one also asserts the
notice is heard once and names the driver's error), fast_paths,
degradation, degradation_catalogue, pipeline_wait_order,
inline_continues, dispatch_pending, api_signatures, api_surface and 169
profile tests: 218/218. Lanes on the M3: 42/44; the two failures are
ycbcr_textures::a_ycbcr_sample_through_an_unmeasured_filter_is_announced
(recorded failing on development before this change) and
pipeline_creation::draws_made_on_the_pool_draw_as_made_ones (1 pooled
making vs 2; fails the same under Exact; not yet run on development
without this change). Clippy plain and --cfg m2v_gpu and rustdoc
-D warnings clean. No sabotage run of the bound.
2026-10-28 23:15:01 +02:00
Anees Iqbal b25f89d0af Zero new buffers by a fill on a discrete GPU, and cut a tiled heap texture's merge work
- A new buffer whose bytes the host cannot write (Private, a Managed
  buffer's device copy, the neutral buffers) is zeroed by one
  vkCmdFillBuffer in the submission's first work on a device without
  unified memory whose fills are not transfers, in place of copies of the
  device's host-visible zeros, which such a GPU reads over the bus. Range
  ends must be multiples of 4. Counted: WorkCounts::new_buffer_zero_fills.
  Same bytes; no FAST-PATHS row.
- A heap's tiled texture's merge in place takes a kept scratch, unzeroed:
  its keep and changed copy write the texture's bytes whole, the bytes its
  kernel reads.
- A one-sample colour tiled texture kept right after its copy in
  (ungated, with no copy of its shadow between) copies the staging buffer
  that copy filled, in place of a move out of the image, tight buffer and
  dispatch. Counted: WorkCounts::shadow_keeps_from_staging. development's
  dirty-page gate stays as it is; a gated copy in keeps the move out.

Ports dev-perf b77843da73, c302c71029 and 01f17bde29
(archive/development-performance-2026-10-27); their measurements (RX
7900 XTX, RTX 5080) are dev-perf's, not re-measured here. RUNTIME_VERSION
1688. api_signatures.tsv: two additive WorkCounts fields. REFUSALS.md
unchanged. Runtime-sources pin recomputed.

Verified on the M3 (MoltenVK, under maclock): first_use, blits fills,
heap_layouts, shadow/merge, dirty-pages and tiled device tests (58 + 34
passed); the tiled merge took no zeroed scratch and every keep came from
the staging buffer (counters asserted); undoing each change fails its
test (3 scratches zeroed vs 0; 6 and 2 bytes differing). The new-buffer
fill path does not run on the M3 (unified memory); a forced local probe
zeroed all 5 MiB through the fill, and failed with the fill word set to
0xdeadbeef. Its unforced run needs a discrete GPU (the round's RTX 5080
run). Clippy plain and --cfg m2v_gpu, rustdoc, touched non-device tests
(338 passed).
2026-10-28 23:09:30 +02:00
Anees Iqbal 7a6818deda Take NVIDIA's stall in every 1024th signalling submit while idle
dev-perf measured on an RTX 5080 Laptop GPU (NVIDIA 615.71.09, Linux)
that one vkQueueSubmit in every 1024 that signals a fence or semaphore
on a VkQueue spends 2.2-3.7 ms in the driver, counted per queue, and
the batch it lands on, with everything committed behind it, waits that
long. Every batch signals, so the stall can only be moved.
device/submit_stalls.rs keeps each queue's place in the driver's period
under the queue's lock (Period): every signalling call the runtime times
is counted (batches via submit_logged, the device's own submission via
use_queue(Uses::OneSignalling), the plan's empty ones); a use it cannot
count (the program's, sparse binds, wait-idle, relay marks) or a due
stall that did not come forgets it. Once the scheduler's thread has had
nothing to submit for 1 ms and a queue's next stall is due within its
next burst plus 32 calls (at most 128), it submits the calls left as
empty submissions signalling a timeline semaphore of the queue's own,
outside its lock, stopping where a commit or waker came. WorkCounts
gains idle_submits, submit_stalls_idle, submit_stalls_on_work,
submits_behind_idle_stalls, wait_behind_idle_stall_longest_nanos;
host_ab prints them. FAST-PATHS records the stall among device gaps.

Ports dev-perf 76bf5a3189, 28c42746a5, b76d910450, 1ef8316ecf,
9d2f46431e. Adapted: keyed as development keys driver facts, a cost
fact DriverFact::SignallingSubmitsStallEvery1024 on NVIDIA's driver on
the RTX 5080 Laptop GPU (0x2c19, the GPU measured) at every release
(dev-perf's release-keyed DriverTrait table, fd2ddc8faa, not ported);
the scheduler's short idle sleep bounds WAIT_SLICE (development has no
head bound).

Public API: DriverFact::SignallingSubmitsStallEvery1024 (translator and
runtime re-export), five WorkCounts fields. RUNTIME_VERSION 1687.
Runtime-sources pin recomputed.

Tests: tests::submit_stalls (planner vs a model driver),
device::tests::driver_facts (the fact's GPU scope, the 5080 profile's
facts), device test tests::submit_stalls_idle (new: on a driver with the
fact, at least one stall taken idle over 5000 command buffers; elsewhere
no empty submission).

Verified on an M3 Max (MoltenVK 1.4.2): touched-module tests 268
passed; api_signatures/api_surface 15 passed; the planner tests fail
with due_idle forced to 0 (4 of 9) and pass restored; device tests 45
passed, the idle-stall test printing idle_submits 0 on MoltenVK; with
the gating forced on, a run made 106 empty submissions without driver
errors and the test failed as it should. Clippy plain and
--cfg m2v_gpu, rustdoc -D warnings clean. The stall path itself needs
the RTX 5080: see the round's 5080 run.
2026-10-28 23:05:15 +02:00
Anees Iqbal 2f033d3002 Take the device's Y'CbCr conversion for 4:2:2 twins and for YCbCr planes read in place
4:2:2 twins hold the device's own conversion where it has Metal's reconstruction; planes read
in place are sampled through the device's Y'CbCr sampler where the driver lays them out as the
surface does; RADV's 10-bit conversion recorded as reading codes as words. With development's
golden re-bless after the native landings. SEMANTICS 1911, ARTIFACT 477, RUNTIME 1683.

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

* Hold a 4:2:2 texture's twin as the device's own conversion where it converts the format

A GBGR422 or BGRG422 texture reads a decoded twin of 8-bit codes on every device: Vulkan views
G8B8G8R8_422_UNORM and B8G8R8G8_422_UNORM only through a sampler Y'CbCr conversion, which no
pipeline's layout bakes. Until now the twin always held Metal's decode, (3c + n + 2) >> 2, computed
by the runtime's own kernel or on the CPU, even where the device converts the format itself.

Now, where the device converts the pairs' format with Metal's reconstruction (its optimal tiling
reports SAMPLED_IMAGE, TRANSFER_DST, MIDPOINT_CHROMA_SAMPLES and a linear chroma filter, and the
width is even), the twin holds the device's conversion:
- each decode pass copies the written rows' pairs out of the carrier into the scratch, then into
  a per-texture image of the 4:2:2 format, and samples it through the device's conversion (the
  identity model at full range) into the band's texels, which go into the twin;
- the kernel is the new bind::chroma_sample_module (ChromaSampleModule), a sample at each luma
  texel's centre at level 0, each channel stored as roundEven(clamp(c, 0, 1) * 255);
- such a carrier takes no host or staging copies, so every write's decode is a GPU pass and no
  texel of the twin is the CPU's decode;
- counted in WorkCounts::chroma_device_twins and chroma_device_decodes, and announced
  decoded-texel-precision (the catalogue's cost text says so).
Elsewhere the twin keeps Metal's decode, as capability. The FAST-PATHS device-gaps table has the
row.

Venues (from the formats' features): MoltenVK 1.4.2 converts both formats (its single-plane 4:2:2
reconstruction is Vulkan's); lavapipe filters their chroma nearest only; RADV (Mesa 26.2.4, 780M)
reports neither format.

Verified:
- clippy -D warnings, plain and --cfg m2v_gpu, for metal2vulkan and metal2vulkan-runtime;
- chroma_decode unit tests (the sample module is valid on every committed profile), fast_paths,
  the degradation catalogue tests, api_surface and api_signatures (table blessed: the new module,
  ChromaDecode::format and the two WorkCounts fields);
- M3 Max (MoltenVK 1.4.2): tests::ycbcr_device::a_four_two_two_twin_holds_the_devices_conversion...
  took the device route for both formats (twins 1, passes >= 2, no CPU decode, announced once);
  chroma within 0.5000 codes of Vulkan's (3c + n) / 4 on 40 x 24 random pairs (the test also
  prints how many chroma codes differ from Metal's; that line is compiled and clippy-clean, not
  yet run);
  runtime_lane::chroma_pairs (5 tests) pass, the read lane checking green exactly and red and
  blue within 1/255 of Metal's on the device route;
- lavapipe (arm64 linux-gate, m2v_cpu_icd): the same runtime test and the five chroma_pairs lane
  tests pass; no 4:2:2 texture took the device route (twins hold Metal's decode, exactly);
- RADV 780M: not run (host away).

docs/REFUSALS.md regenerated: unchanged. runtime-sources.sha256 updated; the RUNTIME_VERSION
bump is in the versions commit.

* Record that RADV's 10-bit Y'CbCr conversion reads codes as words

RADV has the same defect lavapipe has (RuntimeDriverDefect::TenBitCodesReadAsWords): a sampler
Y'CbCr conversion of G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 reads each code's 16-bit word as a
16-bit UNORM value, its six unused low bits included, where Vulkan converts the 10-bit code as
c / 1023.

Evidence: a bare Vulkan probe on the Radeon 780M (RADV, Mesa 26.2.4) read luma code 1023 (low bits
0) through the identity model of a LINEAR image of the format as 0.999039, which is 65472 / 65535
and not 1.0. The optimal tiling's conversion of the format was not measured; the row is per
driver, as the defect table's rows are.

What changes: the AFFECTED table gains a MESA_RADV row, with no clean GPU. Nothing is refused.
- A 10-bit two-plane texture on RADV now converts through Metal's arithmetic. Before, RADV's
  optimal-tiling device conversion (ycbcr_device.rs) took it, and that path was never measured on
  RADV.
- The planes image of the next commit is not taken for 10-bit codes there.
The driver_defects test expectations (every committed RADV profile, Hawk Point's 780M) and the
docs that name the defect's drivers (ycbcr.rs, ycbcr_device.rs, docs/API.md) say RADV too.

Verified: clippy -D warnings (plain and --cfg m2v_gpu) for metal2vulkan, metal2vulkan-runtime and
metal2vulkan-validation; tests::driver_defects on the host. The RADV device itself was not run: the
host is away.

* Sample YCbCr planes read in place through the device's own Y'CbCr sampler where it has Metal's reconstruction

On an integrated GPU or a CPU device, a function that only samples a YCBCR8_420_2P or
YCBCR10_420_2P texture reads the planes in place through a uniform texel buffer. It converts and
filters them with Metal's fixed-point arithmetic in the shader. Where the device converts the
planes' 4:2:0 format as a linear image with Metal's reconstruction (midpoint chroma through a
linear chroma filter), rule 1 makes the device's own conversion the only form. So such a slot now
samples the planes through the device's sampler Y'CbCr conversion. Elsewhere the texel buffer
read stays, as capability.

Translator (metal2vulkan):
- bind::YCbCrPlanesSampler (new, non-exhaustive) holds the conversion: the codes' bits and the
  surface's range and matrix. It also gives the image's format: G8_B8R8_2PLANE_420_UNORM, or
  G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16.
- YCbCrInPlace::with_planes_image, ::sampler and ::planes_sampler. TextureShape::Texture gains
  ycbcr_planes_sampler.
- RuntimeFact::YCbCrInPlace gains `device`: the device's sampler takes every sample of the slot.
  It does not where a constexpr sampler has a border address mode, or a texel offset is placed by a
  parent's size.
- VariantKey and LoweringInputs gain ycbcr_planes_sampled. The binder fills it from slots with
  `device`, bound to a texture that holds the image, whose runtime sampler words have no border
  mode on s or t.
- Such a slot is declared as a combined image sampler: ResourceKind::YCbCrPlanes and
  BindingSource::YCbCrPlanes, written from WriteSource::YCbCrPlanesImage. Its immutable sampler is
  the new vk::SamplerDesc::ycbcr: linear, clamp to edge, lod 0, and a new `ycbcr` field.
- Each sample (lower/sampler/in_place.rs device_sample) is OpImageSampleExplicitLod at level 0:
  - a linear sample takes Metal's coordinate, with its texel offset moved in texels;
  - a nearest one takes the centre of the luma texel Metal reads, clamped to the edge;
  - pixel coordinates and the filter are known when the module is made (constexpr) or read from
    the runtime word;
  - a half result is rounded to a half, as every sampled texel's is.
- The texel buffer stays the slot's resource otherwise. The planes read use is tracked as before.

Runtime (metal2vulkan-runtime):
- YCbCrFormats queries the two 4:2:0 formats' LINEAR tiling: SAMPLED_IMAGE,
  MIDPOINT_CHROMA_SAMPLES, a linear chroma filter, and the limits and
  combinedImageSamplerDescriptorCount.
- YCbCrSampler::planes gives the conversion. It is None under TwoPlaneChromaMisplaced, and for
  10-bit codes under TenBitCodesReadAsWords. holds_planes checks for an even size within the
  limits.
- texture/ycbcr_planes.rs (new) makes a PREINITIALIZED linear image of the format over the planes'
  bytes, and only in memory the runtime allocated. It is made only where:
  - the luma plane comes first;
  - the driver's PLANE_0 and PLANE_1 subresource layouts are the surface's offsets and pitches;
  - the alignment, the type and the room within the buffer fit.
  Its view and every immutable sampler of it share one VkSamplerYcbcrConversion
  (Device::made_ycbcr_conversion, kept in the owned kernels' map), so the two are identically
  defined (VUID-VkWriteDescriptorSet-descriptorType-02738). Its first move rides the next
  submission (Fresh, never rebindable), and it is announced ycbcr-filter-not-exact.
- Fresh pages, no-copy pages and the caller's VkBuffer keep the texel buffer. An image bound to
  imported memory starts UNDEFINED, and the in-place check covers that first move for single-plane
  images only.
- The texture's facts state the image (with_planes_image). binding.rs writes the view in GENERAL
  under the layout's immutable sampler.
- sampler_set chains the conversion into each SamplerDesc::ycbcr sampler. A non-pushed set 0
  reserves combinedImageSamplerDescriptorCount descriptors per such binding.
- WorkCounts gains ycbcr_planes_images, ycbcr_planes_images_kept_{conversion,memory,layout} and
  ycbcr_planes_images_bound.

Venues (from the formats' linear features):
- Radeon 780M (RADV, Mesa 26.2.4): reports the 8-bit route for rows 256 bytes apart. Its 10-bit
  codes carry TenBitCodesReadAsWords (previous commit).
- MoltenVK 1.4.2: TwoPlaneChromaMisplaced.
- lavapipe: its 4:2:0 conversion is cosited only.

Measured before building, through a bare Vulkan probe on the 780M with 8-bit codes:
- luma centres within 0.0003 codes of Vulkan's model, and points between texels within 0.66
  codes;
- Metal's conversion-then-filter differs by up to 54/255 between texels of random planes;
- GPU time, 3840x2160 composited into 1680x1050: 248 us against the texel buffer's 340 (1 pass),
  741 against 1027 (3 passes).
The runtime's path itself is not measured on a device that takes it: the 780M host is away.

Docs: a FAST-PATHS device-gaps row (the device's route, where the texel buffer stays, and why);
the in-place paragraph; docs/API.md (the pipeline interface paragraph, and the notice's catalogue
entry); module docs (ycbcr.rs, ycbcr_device.rs, ycbcr_image.rs); the api_surface table
(YCbCrPlanesSampler N); api_signatures blessed.

Tests:
- bind::ycbcr_in_place::the_planes_sampler_is_the_conversion_word.
- bind::plan::slots::the_planes_image_variant_takes_a_slot_the_device_s_sampler_reads.
- tests::engine_ycbcr_in_place::a_planes_image_slot_samples_through_the_device_s_conversion: the
  lavapipe and M3 profiles; linear, nearest, pixel, offset and runtime samplers, each half and
  float. Each case links and validates, with one OpImageSampleExplicitLod. Border and repeat-offset
  slots state device false.
- Lane runtime_lane::ycbcr_in_place::a_ycbcr_texture_s_planes_image_samples_through_the_device_s_conversion
  covers surfaces whose rows are 256 bytes apart. Each in-place texture is counted exactly once,
  as an image or by why not. Through the image, nearest samples are Vulkan's conversion within the
  device's bound, announced; without it, Metal's texels through the texel buffer, unannounced.

Verified:
- clippy -D warnings, plain and --cfg m2v_gpu, for metal2vulkan, metal2vulkan-runtime and
  metal2vulkan-validation.
- Host, plain target, the touched selection (ycbcr, fast_paths, api_surface, api_signatures,
  codec, slots, api_tests, the inputs encoding, sampler, ash_interop, driver_defects, degradation,
  vk tests): 408 run, 407 passed. The engine test's half cases failed, because a half result was
  an f16 where a sample holds it widened. They now take narrow::round_texel, and the in-place
  engine tests pass, 4 of 4.
- M3 Max (MoltenVK 1.4.2), runtime and validation, ycbcr|chroma|driver_defects|runtime_sources:
  66 run, 64 passed. The planes image test counted [0, 1, 0, 0] for both surfaces (kept for the
  conversion: TwoPlaneChromaMisplaced), bound the texel buffer and read Metal's texels. The two
  failures:
  - the runtime-sources pin, re-pinned in the versions commit;
  - runtime_lane::ycbcr_textures::a_ycbcr_sample_through_an_unmeasured_filter_is_announced
    (anisotropic through a constexpr sampler), which fails the same way at the base, as
    a1f1677174 recorded.
  The 4:2:2 test's new line: GBGR422 and BGRG422 chroma within 0.5000 codes of Vulkan's, and
  0 of 1920 chroma channels a code off Metal's.
- lavapipe (linux-gate arm64, --cfg m2v_cpu_icd), the same selection without the pin: 66 of 66.
  The planes image test counted [0, 1, 0, 0] for both surfaces (cosited only).
- Radeon 780M, the only venue whose features take the route: not run, the host is away. The
  device route's lane test, its notice and its GPU time against the texel buffer are unverified
  through the runtime.

* Bump the cache versions for the 4:2:2 device twins and the YCbCr planes images

- SEMANTICS_VERSION 1908 -> 1909: the translator emits something new under keys that existed
  before. A two-plane YCbCr in-place slot's RuntimeFact::YCbCrInPlace now states `device`, and
  ycbcr_planes_sampled lowers such a slot as a combined image sampler sampled through the device's
  Y'CbCr conversion.
- ARTIFACT_FORMAT_VERSION 475 -> 476: the encoding changed. RuntimeFact::YCbCrInPlace gains
  `device`, SamplerDesc gains `ycbcr`, ResourceKind and BindingSource gain YCbCrPlanes, and the
  YCbCrPlanesSampler struct is new.
- RUNTIME_VERSION 1681 -> 1682: a run of an unchanged artifact may now do something else.
  - A 4:2:2 texture's twin holds the device's conversion where the device converts the format.
  - RADV's 10-bit two-plane textures convert through Metal's arithmetic (TenBitCodesReadAsWords).
  - The runtime makes planes images where the device converts the 4:2:0 format as a linear image
    with Metal's reconstruction.
  - Pools reserve combinedImageSamplerDescriptorCount for planes samplers.

runtime-sources.sha256 is re-pinned over this branch's runtime inputs:
d520b4179f55291b57dc7ffd5182ea5f37790889c768b9d49914f174f428ce7c. This is the fingerprint the
validation build script computed at the tip's tree.

These are lane numbers. The orchestrator renumbers them at landing.

* 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.

* Re-bless the golden hashes on development after the native landings

Two rows of golden_hashes.tsv move: the RADV profile's cells, whose
16-bit-depth bias and tile-store answers the boundary-case commits made the
device's own (SEMANTICS_VERSION 1910, then 1911 with the YCbCr commits). The
engine inventory and the engine golden printouts blessed with no change.

The YCbCr versions commit (569d988e99) names SEMANTICS 1909, ARTIFACT 476
and RUNTIME 1682, the values it was written with on 8b7a8aa2d8. On
development they collided with the 16-bit half output's 1909/476 and the
boundary cases' 1682, so the landing set them to SEMANTICS 1911,
ARTIFACT_FORMAT_VERSION 477 and RUNTIME_VERSION 1683; the commit's text was
not rewritten.

Verified on macOS at 465e0eb538: bless_engine_inventory,
bless_golden_hashes and bless_engine_goldens pass; the conformance crate's
suite 1007/1007.
2026-10-28 21:19:28 +02:00
Anees Iqbal bd3c50d741 Take the device's own Depth16 bias and its store of an extended-range, padded or bfloat attachment's untouched texels
The device's depth bias unit on every format, and the device's store of untouched texels in
place of the unused-bits load pass (deleted with its capture machinery); the NaN depth
discard documented as capability. SEMANTICS 1910, RUNTIME 1682.

One work packet, landed as 7 commit(s) (88bcfeaea8..6aec9db4e9 on archive/development-linear-2026-10-28-evening), in order:

* Take the device's depth bias on a Depth16Unorm depth

Rule 1: the device's depth bias is its native form, so it is the only one. A
constant bias (or a slope alone) on a Depth16Unorm depth was recorded through
VK_EXT_depth_bias_control's depthBiasExact as Metal's own rule, c + 1 units of
1/65535 for c of 0 or more and c - 1 below (one unit for a slope alone), in
depth (floatRepresentation) or in 2^-16. Now `metal::state::depth_bias` hands
Metal's constant to vkCmdSetDepthBias in the device's own unit r on every depth
format; Vulkan leaves a fixed-point format's r to the implementation, at most
2 x 2^-16 ("Depth Bias", primsrast.adoc).

Deleted, nothing reading them any more: `depth16_units`, `DepthBiasUnit` and
`DepthBias::unit`, the `depth_format` parameter of `depth_bias` and of the
runtime's `vk_depth_bias`; the runtime's vkCmdSetDepthBias2EXT path
(`DepthBiasCommand`, `depth_bias_command`, the record's pinned representation,
the device's command, its priming and `DEPTH_BIAS_CALLS`, the exit guard's and
recorder's `CmdSetDepthBias2`, `Logged::SetDepthBias2` and its thunk, so
`CommandsReplayed::cmd_set_depth_bias2` goes). VK_EXT_depth_bias_control is
still described but no longer consumed, so the core recommends enabling neither
it nor its three features.

RADV on the 780M no longer takes DriverDeviation::MetalDepth16BiasedStores: it
was measured through the exact unit. MoltenVK keeps it (it hands Metal its
constant, by construction). Elsewhere `unorm-depth-bias` announces the device's
bias; its cost text, docs/API.md's entry, the deviation and property docs and a
new FAST-PATHS device-gap row state it.

Tests: `metal::state::a_unorm_depth_bias_is_metals_constant_in_the_devices_unit`
(the constant as given on lavapipe, NVIDIA and MoltenVK, which have
depthBiasExact or not); the recommendation test leaves the extension and its
features out; the driver-facts test drops RADV's row; the exit-guard tests lose
the priming group and render_state.rs as a keeper of the device's functions.
api_signatures blessed (DepthBiasUnit, DepthBias::unit, depth_bias's signature);
the refusal surface is unchanged. Not bumped here: RUNTIME_VERSION (the versions
commit) and the runtime-sources pin (landing).

Verified: cargo clippy -p metal2vulkan -p metal2vulkan-runtime
-p metal2vulkan-validation --all-targets --all-features -D warnings; nextest of
metal::state, device::tests::{enables,driver_facts,profile}, tests::fast_paths,
api_surface, api_signatures, exit_guard, render_state, degradation_catalogue,
draw_shape_notices and ash_interop: 159 passed.

* Cite the spec that leaves a NaN fragment depth undefined, which makes its discard capability

The native-arithmetic audit asked whether `clamp_depth`'s discard of a positive NaN
depth, on every profile, emulates Metal where the device has a native form. It does
not: Vulkan defines no answer for such a depth. "Depth Clamping and Range
Adjustment" (fragops.adoc, 35.10.1): "If zf is not in the range [zmin, zmax],
then zf is undefined following this step", with or without depthClampEnable, and a
NaN lies in no range; only depthClampZeroOne, which no profile enables, keeps a
float depth unchanged (and then the comparison of a NaN would still pass ALWAYS
and NOT_EQUAL, where Metal's fails every test). So the discard stays, as
capability, and the comment says why, so a later audit does not re-raise it.

Docs only (a doc comment); no behaviour changes.

Verified: cargo fmt --all.

* Drop the cube's unmeasured gradient route from the anisotropic tests' profile comment

The route was deleted with the native cube gradients; the comment still named it as a second
home of the anisotropic emulation. Only a profile without samplerAnisotropy emulates it now.

Verified: comment only; git grep finds no other mention of the unmeasured gradient route.

* Keep the device's store of an extended-range, padded or bfloat attachment's untouched texels

What: a render pass that loads and stores a color attachment of an extended-range, padded
10-bit or bfloat format now keeps the bytes its draws do not write, the device's own load and
store (VK_ATTACHMENT_STORE_OP_STORE of a loaded attachment), on every device. The runtime no
longer reproduces Metal's tile store: the load pass that rewrote the texels' unused bits before
the pass (render/unused_bits_load.rs, bind::unused_bits_module), the capture replay that found
the tiles a pass's draws reach for it (render/capture.rs, bind::capture_assembly_module,
capture_settle_module, tile_reach_module, the translator's capture form
LoweringInputs/VariantKey::captured_positions, CaptureForm, RuntimeFact::CapturedPositions,
PushField/PushHole::CaptureAddress, Feature::TileReach, StatusBits::CAPTURED_REACH_UNMEASURED,
StatusReport::captured_reach_unmeasured) and the pipeline states' capture forms are deleted, with
ExtendedRange::load_code, Degradation::UnreachedTilesRewritten and the WorkCounts fields
unused_bits_load_passes, unused_bits_load_texels and capture_reach_*. Every draw in such a pass
announces extended-range-bits-kept, naming the attachments (render/tile_store.rs, the renamed
module); its catalogue entry, the FAST-PATHS device-gap row and the format docs state what
differs: the unused bits, BGRA10_XR's alpha clamp, a padded sRGB twin's table and a bfloat code
through half, which Metal's pass rewrites in each tile a draw reaches. snorm-minimum-kept and
shared-exponent-kept are unchanged (TileStoreIsMetals still says where the device's store is
Metal's).

The de-indexed and private list forms keep the index read the capture form shared
(PushField::CaptureIndexAddress, CaptureLayout, CapturedIndex); the binder's de-indexed draw no
longer goes through the capture draw, and the vertex function's strip restart return, which only
the capture form's layout could take (a de-indexed strip is NotImplemented(PrimitiveId)), is
gone.

Why: the owner's rule 1. The device has a native load and store; reproducing Metal's tile store
emulated Metal's bits where the device has a native form. The difference is recorded and
announced (rule 2).

Verified: cargo clippy -D warnings, all targets and features, over metal2vulkan,
metal2vulkan-runtime, metal2vulkan-validation and metal2vulkan-conformance, plain and with
--cfg m2v_gpu: clean. api_signatures blessed, REFUSALS.md regenerated. The test runs (translator
and runtime suites, the touched validation lanes on lavapipe and on the M3 Max's MoltenVK) follow
this commit and are reported with the lane.

* Bump the semantics and runtime versions for the device's tile store and depth bias

What: SEMANTICS_VERSION 1907 -> 1908 and RUNTIME_VERSION 1681 -> 1682.

Why: SEMANTICS_VERSION, because the translator's output changes under unchanged keys: the
de-indexed and private list vertex forms no longer carry the strip restart return, and the
capture form, its runtime fact and its push field are gone. RUNTIME_VERSION, because runs of
unchanged artifacts now do something else: a Depth16Unorm depth takes the device's depth bias
(no depthBiasExact or unit rescale), and a pass that loads an extended-range, padded or bfloat
attachment keeps its untouched texels' bytes (no unused-bits load pass, no capture replay) and
announces extended-range-bits-kept. ARTIFACT_FORMAT_VERSION stays: the codec tags variants by
name, and the removed ones (CaptureForm, PushField::CaptureAddress,
RuntimeFact::CapturedPositions) leave their tags unused, so an old entry holding one is a miss.

Verified: the constants alone change; the golden tables and the runtime-sources pin are
re-blessed at landing.

* Hold the lanes and the fact census to the device's store of untouched texels

What: three runtime lanes still expected Metal's tile store after 5e710fb988 made the device's
store the only form, and the mechanism test still counted the deleted
RuntimeFact::CapturedPositions.
- extended_range_blends::a_pass_of_extended_range_and_padded_colors_names_each_loaded_color:
  the padded colors, which the function does not write, keep their bytes (all ones), where
  Metal's pass leaves each word 0xffc0.
- extended_range_blends::a_fetched_two_plane_attachment_written_unblended_stores_metals_write:
  color 2, loaded and unwritten, keeps its bytes, where Metal's pass zeroes its color words' top
  two bits.
- extended_range_blend_table::a_memoryless_color_2_blends_as_a_stored_color_does: the stored
  color 0's bands are compared with the unused bits as Metal's pass leaves them
  (as_metal_leaves), the codes exactly, as the table's other passes already are.
- device::tests::mechanism: the variant census is 0..89 (MergedDraws takes the freed index).

Why: the lanes held the deleted exact form; the device's store is now the contract and
extended-range-bits-kept announces the difference.

Verified: on the M3 Max (MoltenVK, --cfg m2v_gpu, under maclock and memcap) the three lanes and
the rest of extended_range_blends pass (11 of 11, with waiter_submits, which failed once under a
load of 40 and passed on its rerun); on plain, device::tests::mechanism and tests::fast_paths
pass (12 of 12); clippy -D warnings clean, plain and --cfg m2v_gpu, over the four crates.

* 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 21:19:28 +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 5f807517bd Make sampled textures over logged host pages device copies on a discrete GPU
On a discrete GPU a sampled, read-only, tracked texture over logged no-copy memory is a device
copy refreshed by the logged row bands, instead of an image read across the bus in place.

One work packet, landed as 3 commit(s) (7812de9edd..919557e82f on archive/development-linear-2026-10-28-evening), in order:

* Make sampled textures over logged host pages device copies on a discrete GPU

What: on a DeviceKind::Discrete device, a texture over host pages whose
policy and usage take the image in place (HostPageTexturePolicy::InPlace,
a usage that only samples or reads), tracked, over a no-copy buffer
whose memory carries a DirtyPages log (HostPages::dirty), one slice laid
out as one copy region straight from the buffer's VkBuffer (no staging,
no rows sharing bytes), is now a shadow instead of the image in place,
announced nowhere and counted as WorkCounts::device_copy_textures. Its
copies in are the shadow path's gated ones (dirty_pages.rs): each
command buffer's first copy in takes only the row bands the log reports
changed since the hold, nothing where none changed, every row where no
hold stands, the wait says false, or a GPU write of the bytes let go of
the hold. The in-place check's verdict is not asked: the copy binds no
image to the pages. Integrated GPUs, CPU devices and memory without a log
are placed as before.

This is ws/vramcopy's device copy (9c04997aa9..6f6d709ae9) resolved onto
ws/dirtypages' design: its own refresh (a per-batch entry preamble with
its own stamps, an encoder-entry hook and a carry write list), its
DirtyLog wrapper, its buffer-key log registry and GPU-write reports, its
replace_region report and its refresh counters are all dropped for the
shadow path's DirtyHook/DirtySource, per-shadow ShadowLog hold and
stamp, gated replay-time regions, note_dirty write tracking and
dirty_copies_in_* counters, which do the same job. What stays is the
placement, its fit check (Texels::device_copy) and its counter.

Tests: runtime_lane::device_copies (m2v_gpu), on the tally of the shadow
path: a 1920x1080 surface over logged pages follows six frames of CPU
writes, its gated copies in whole at the first frame and where the wait
could not say, skipped with no write, cut otherwise; a blit fill of the
buffer lets go of the hold and the next read finds the fill; without a
log no device copy; a cost report (DEVICE-COPY-COST) of in place against
the device copy for a 3840x2160 surface read whole each frame.

Docs: runtime README (textures over buffers) and docs/API.md (textures
over host pages). api_signatures.tsv: one field row
(signatures.py --check passes).

Verified (macOS): cargo fmt; cargo clippy -p metal2vulkan-runtime
--all-targets --all-features -D warnings; the same with -p
metal2vulkan-validation under --cfg m2v_gpu. Device runs follow.

* Run the device-copy lane under the product's in-place policy

What: runtime_lane::device_copies' devices take
HostPageTexturePolicy::InPlace (in_place_textures' in_place, now shared),
the product's default: the lane's devices otherwise take the exact
answers, under which no texture is a device copy, so on the RX 7900 XTX
the first test found none ("device copy false") and the cost test
compared two shadows rather than in place against the device copy.

Verified: cargo fmt; cargo clippy -p metal2vulkan-validation
--all-targets --all-features -D warnings under --cfg m2v_gpu; on the M3
Max (MoltenVK, integrated) the three device-copy tests pass, no device
copy made there. On gem10 at 134ac6eb18 (before this fix):
tests::dirty_pages_device 2/2 passed on the RX 7900 XTX; the lane's
content checks passed and its layer checks failed on a loader message
about gem10's NVIDIA ICD (libGLX_nvidia.so.0), not the runtime's.

READY 134ac6eb18 (product code; this commit changes tests alone)

* 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 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
Anees Iqbal 4c07cde4d2 Announce set-past-layout-support at every bind of a variant past its driver's support
One work packet, landed as 9 commits (332aebcc0c..c0ffb238b1 on archive/development-linear-2026-10-28), in order:

* Announce set-past-layout-support at every bind of a variant past its driver's support

What. A variant's kinds (`Kinds::of`), which a bind tests before it
announces anything at every occurrence, now hold `SetPastLayoutSupport`
where a set of the pipeline's layout is past the least
`maxPerSetDescriptors` (1024) on a driver that understates its layout
support (`RuntimeDriverDefect::SetLayoutSupportUnderstated`, MoltenVK):
`pipeline::objects::may_pass_support`, the same test `set_support` makes
before it asks the driver.

Why. The kinds held the stages' notes and the vertex-simdgroup property
alone, though `Device::degrade_pipeline` announces the layout notice too.
So a device announcing it at every occurrence (`announce_each`, which the
conformance suite's device sets) announced it only for a variant that
also recorded a precision note: the heap set of a kernel reaching a
texture through an argument buffer (65536 descriptors per array on the M3
Max, which MoltenVK's `getDescriptorSetLayoutSupport` refuses at a sum of
1212 or more) went unannounced until the native-arithmetic round gave 36
conformance cases' kernels a note (device-nan-encoding,
pixel-sampler-scaling), and then it surfaced in exactly those. The notice
is true of the driver: the layer reports VUID-09582 for each such layout.
Without announce_each nothing changes: the making announces it once.

RUNTIME_VERSION 1820 (placeholder, to be renumbered at landing): a bind
can announce what it did not.

Verified: tests::driver_defects::a_set_past_the_drivers_support_is_among_its_variants_kinds
(hsw_held compiled for the committed MoltenVK profile: sets of 4 and
65536 descriptors; the kind held where the driver understates, not where
it does not; the kinds' test agrees with set_support's Understated) passes,
and fails with the kind's addition disabled ("sets of [4, 65536]
descriptors, the driver understating its support: true"). A full MoltenVK
replay (M3 Max, 1.4.2) with the change reads the same 152 unlisted lines
as without it: the 36 cases that announce it already did.

* Declare set-past-layout-support where a case's kernel reads an argument buffer's texture

What. replay::set_past_layout_notice(), a declaration like
shared_memory_notice, and its use by the cases whose kernels reach a
texture or a sampler through an argument buffer: every pixel-samplers and
pixel-downscales case (the arg source), every norm-storage case (the held
route), the three half-storage-writes held rows, read-write-tier-held, and
the two argument-encoder cases that dispatch.

Why. Such a kernel takes the handle heap, set 1, of 65536 descriptors an
array on the M3 Max. MoltenVK 1.4.2 answers vkGetDescriptorSetLayoutSupport
by the sum of the counts against maxPerSetDescriptors (1212), so it refuses
the set though it makes and runs it; the runtime makes it and announces
set-past-layout-support, and the layer reports VUID-09582 for it. That is
a notice of what the driver lacks, which NATIVE_NOTES leaves to each case
to declare. The query is a true one, asked of the create info the layout
is made from, so the runtime keeps announcing it. The 36 cases' MoltenVK
replay read it as undeclared (42 sites, the argument-encoder cases' four
each, since their shared-memory declaration loosened the notices site with
nothing announced to justify it).

Verified: the MoltenVK replay of the 36 cases on the M3 Max (1.4.2) exits
0, 27 announced and the 9 divergent at their ledger rows, nothing
unlisted.

* Ledger the M3 Max's own NaN bits at 37 half-NaN sites

What. Apple M3 Max rows for the sites where this venue answers the
canonical quiet NaN 0x7E00 for a `half` NaN Metal keeps the bits of:
attribute-format-fetches' 29 attribute3 sites (a Half or Half2 attribute
fetched through stage_in into a half2 and reinterpreted), the three
half-write-nans 16-bit float stores, the three half-texel-nans `read`
sites, and math-frexp-ilogb-half's two frexp mantissa sites.

Why. Read off every element of each site (both sides' bytes dumped from
the replay): every differing element is a NaN on Metal's side -- 0x7E01
and 0xFE01 for the attributes, the stored halves' own codes, the texels'
own codes, frexp's 0x7E01, 0xFE55 and 0x7C01 -- and 0x7E00 on ours; no
other code differs. This M3 widens a half NaN to the canonical one, so
the bits are gone at the device's widening (the attribute's and texel's
reads, the store's widened conversion) or at the device's NaN result
(frexp). Each is announced and recorded: native-nan-encoding (a module
reading a half from its bits; an operand's bits where Metal answers
them) and device-nan-encoding (a half texel's write; a half texel's
read), both native notes whose bound is the device's sign and payload,
validation deriving no tolerance from them. The `read` rows carry the
words of the M3 rows at the family's two other sites, now that the read
also goes through the device's decode. So the 32769 the attribute rows
show is the negative NaN's sign and payload, not wrong data.

Verified: MoltenVK replay of the 8 cases on the M3 Max (1.4.2) exits 0
with nothing unlisted.

* Ledger the M3 Max's sRGB pack and unpack at the device-pack-conversion bound

What. Apple M3 Max rows for pass-bytes-srgb-decode-all-bytes and
pass-bytes-srgb-encode-sweep, at their one site each.

Why. The module decodes and encodes sRGB by the MSL transfer function
through the device's Pow (device-pack-conversion, a native note, recorded
on every device for the sRGB forms), where Metal goes through its
twelve-bit table. Read element by element off the replay's bytes against
the committed recordings: every decoded float is within 1.2205e-4 of
Metal's step (under half a twelve-bit step, 1/8190), every decoded half
within that and one half ulp (at most 0.97 of the sum), the alpha lanes
exact; every encoded colour channel that differs (1,821 of them) is one
code from Metal's, no alpha. That is the note's recorded bound. The
largest raw differences (0x00F90001, 0x00010101) are a small half 249
ulps off beside a one-ulp half, and one code in each colour byte.

Verified on the M3 Max (MoltenVK 1.4.2) by the replay of the two cases,
after the rows' rebuild (see the next commit's run).

* Ledger the M3 Max's own half-output blend at the fast-math-blend bound

What. The 18 Apple M3 Max half-output-blends rows go and 52 come: every
site the three 16-bit float formats now differ at, none for the 32-bit
float formats. The family's module docs say what each side does now.

Why. The exact shader blend of a half output is gone (the
native-arithmetic ruling), so the device blends. Read word by word off
the replay's bytes against the committed recordings and the case's own
source sweep and destination generator: this M3 blends the half widened
to float in float and converts into a 16-bit float format toward zero
(every word of the 43 divergent sites whose sum adds no blend-colour
product, 97 to 99.6 per cent of the other nine's), where Metal's compiler
folds the blend into the function (round(round(Sf*S) + Df*D) at the sites
the case's tests measure). Every differing word, 52 sites of 6 to 559
words, is within 2 half ulps of Metal's at the operands' magnitude (the
largest of the source, the destination, a factor and the two products'
magnitudes summed; the worst exactly 2), which is
half-output-fast-math-blend's recorded bound; the case declares that
note and it fired. Raw-code distances up to 1,582 are results near zero.
The 32-bit float formats now store Metal's codes at every word, so their
8 rows are stale, and the 10 old 16-bit rows' counts no longer hold.

Verified: MoltenVK replay of the six blend cases and the two sRGB cases
on the M3 Max (1.4.2) exits 0, nothing unlisted and nothing stale; the
32-bit float cases read announced.

* Ledger the M3 Max's same-command-buffer read of a dropped kernel store

What. One Apple M3 Max row for host-page-writes-kernel-store-read-only
at case/bytes-in-the-same-command-buffer-bytes, an open bug of ours.

Why. Metal drops a kernel's stores into read-only backing, and a later
command of the same command buffer reads them back from the GPU's caches
(every one of the 8 recorded runs); ours reads the pages' own bytes.
Measured cause: the shader drops its own stores through a slot bound to
such a buffer (StageTable::dropped_store_buffers, SpecKey::DroppedStoreSlots),
so the store never reaches the caches, though on macOS the read-only view
the pages are imported through already drops the write. With that word
forced to zero (a local probe, not committed) the case is exact on this
M3, 3 runs of 3, its later-command-buffer and CPU sites still the dropped
write. The gap predates the native-arithmetic round: the same divergence
replays at f6a96b7da8. The mask is set only for memory imported through a
view, which only macOS makes, so leaving it clear there makes it inert
everywhere today; that is the owner's call, so the row waits on it.

Verified: MoltenVK replay of the case on the M3 Max (1.4.2) exits 0.

* Regenerate the conformance coverage after the M3 Max ledger rows

What. docs/CONFORMANCE-COVERAGE.md from scripts/conformance-coverage/coverage.py.

Why. The ledger gained 37 NaN, 2 sRGB, 52 half-output-blend and 1
read-only rows on the M3 Max and lost its 18 stale blend rows (1056 to
1130 rows), which the generated table lists.

Verified: the generator wrote the file from this tree's ledger.

* Number RUNTIME_VERSION 1680, past development's

The set-past-layout-support announcement fix took the placeholder 1820;
development is at 1679.

* 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:23 +02:00
Anees Iqbal 524c2f7346 Record the device's own alpha to coverage as a native precision note
One work packet, landed as 4 commits (f6834405b7..7ec539ceb2 on archive/development-linear-2026-10-28), in order:

* Record the device's own alpha to coverage as a native precision note

What: a render pipeline that keeps alpha to coverage now records
`PrecisionNote::DeviceAlphaCoverage` on its fragment stage, which the
runtime announces as `device-alpha-coverage`, on every profile not
measured to cover as Metal does. `link::graphics::coverage_notes` decides
it from the graphics state alone and hands it through `Linked`'s new
`fragment_notes` and `fragment_properties`, as the vertex stage's
fixed-function notes already go. A profile that takes the new measured
driver fact `DriverDeviation::MetalAlphaCoverage` (MoltenVK on Apple's
GPUs of the M3 Max's macOS 27 identity, the APPLE9 row) records no note and
requires `VkProperty::MetalAlphaCoverage` instead.

Why: Vulkan specifies no algorithm for turning an alpha into a coverage
mask, and Metal's is not the floor rule we assumed. Measured on the M3 Max
(macOS 27.0.1) over 639 alphas a sample count with our own probe
(probes/alpha_coverage_sweep.m): one sample covers above an alpha of 1/2;
two and four samples cover ceil(alpha * n - t), t a 2x2 ordered dither.
Under rule 1 the device's answer is the contract, so the note records it
and nothing in the shader or the sample mask imitates Metal's.

Bound, pixel by pixel against Metal's committed reading
(runtime_lane::alpha_coverage, 10,224 pixels a count): lavapipe (Mesa on
LLVM 21.1.8, arm64) dithers at one sample too, 2,560 pixels apart (a whole
fragment stored or dropped), and at four samples 96 pixels one sample
apart, all within an f32 ulp of a threshold; every pixel within
floor..ceil of alpha * n. MoltenVK 1.4.2 on the M3 Max: 0 apart at 1, 2
and 4 samples (its reading is byte-identical to plain Metal's). NVIDIA is
unmeasured beyond its known-gaps row. Stated in the note, the runtime
kind, docs/API.md's catalogue and docs/FAST-PATHS.md's device gaps;
`CoverageReadsRoundedAlpha`'s docs now say its bound is the rounding's
alone. Validation derives no tolerance from it (`Allowance::Unbounded`).

Versions: SEMANTICS_VERSION 1980, ARTIFACT_FORMAT_VERSION 490 (the codec
gains a note and a property), RUNTIME_VERSION 1790.

Verified: tests::engine_alpha_coverage (five profiles, 1 and 4 samples,
coverage on and off) passes and fails with the note's recording removed;
the lane passes on lavapipe (linux-gate arm64) and on MoltenVK (maclock),
printing the counts above and asserting the announcement iff the note;
nextest of metal2vulkan, -runtime, -conformance and -validation pass but
for the golden table (stale at this base; against development's re-blessed
table only the moltenvk-m3 profile fingerprint moves) and the runtime
sources pin, both re-blessed on development; clippy (all features, and
--cfg m2v_gpu) and rustdoc clean; api_signatures.tsv re-blessed.

* Declare device-alpha-coverage native in the suite and fix Metal's coverage rule

What: `replay::NATIVE_NOTES` gains `DeviceAlphaCoverage` (the coverage
class), so no a2c case must declare the notice the device announces at
its own coverage; values still compare field by field. The two
`a2c-on-1-alpha-50` known-gaps rows (llvmpipe, RTX 5080 Laptop) keep
their identity and now name the note and its bound: on llvmpipe the
measured dither and counts; on NVIDIA the bound is open until the
coverage lane's sweep runs there. `alpha_coverage_pairs`' model and docs,
and `render.rs`'s field doc, said Metal covers floor(alpha * n) samples;
they now state the measured rule (above 1/2 at one sample; ceil(alpha * n
- t) under a 2x2 ordered dither at two and four), and the model's test
holds the cases' recordings to it. docs/CONFORMANCE-COVERAGE.md
regenerated.

Why: the suite's standing declarations name every note that is the
device's native answer, and the rows must say what differs and whose
answer it is.

Verified: the conformance suite passes (nextest); coverage.py and
refusal_surface.py regenerated (REFUSALS.md unchanged).

* Number SEMANTICS_VERSION 1906, ARTIFACT_FORMAT_VERSION 474 and RUNTIME_VERSION 1679, past development's

The alpha-coverage note took the placeholders 1980, 490 and 1790;
development is at 1905, 473 and 1678.

* 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:23 +02:00
Anees Iqbal 12e64034b3 Hold back the clear's conversion note where MoltenVK's load operation clears as Metal's
One work packet, landed as 5 commits (36c1f6d2ed..bad631efa8 on archive/development-linear-2026-10-28), in order:

* Hold back the clear's conversion note where MoltenVK's load operation clears as Metal's

A render pass's CLEAR load operation of a colour attachment its render area
covers is, on MoltenVK, Metal's own Clear load action, so the texel it stores
is Metal's. The new DriverFact::ColorClearIsMetals records that for MoltenVK on
the Apple9 GPUs under macOS 27, and the pass layout withholds
device-color-conversion for such a clear there. A clear that is not that load
operation still announces the note on every device: a clear over a smaller
render area (vkCmdClearAttachments, a quad draw on MoltenVK), a clear made
before the pass of an attachment its first instance leaves out, and a
memoryless attachment's backing.

Measured with the renders lane's clear case set
(clears_are_the_device_s_conversion_of_the_clear_value) under MoltenVK 1.4.2
on the M3 Max, macOS 27.0.1, before the change: 71 colour clears, 11 depth and
4 stencil, all 86 texels Metal's bytes, none a code apart. The lane now also
asserts the note stays unannounced where the fact holds; the dont-care and
colour-reformat lanes expect it only where their clears are not a covering
load operation (tie_cleared's new flag).

RUNTIME_VERSION 1760; api_signatures re-blessed for the new variant.

Verified on MoltenVK (M3 Max, --cfg m2v_gpu): the renders clear lane (86
checked, 0 apart, no device-color-conversion), runtime_lane::dont_care_stores
(4) and runtime_lane::color_reformat (6) pass; device::tests::driver_facts
passes.

* Resolve into an sRGB twin by the device's own sRGB decode and encode

A multisampled 8-bit UNORM attachment resolving into its sRGB twin is the
crate-owned resolve on every device, and it applied Metal's 12-bit sRGB
tables. Under the native-arithmetic rule the device's conversions are the
only form where the device has them, so where the device renders the sRGB
format the resolve now reads the samples through a view in the sRGB format
(the device decodes each sample), averages the decoded values (their f32 sum
times 1/n) and writes the average through the resolve attachment's own sRGB
view (the device encodes it); the alpha keeps the unorm rule. An attachment
read from a copy gets a scratch image mutable to the sRGB view. A device
without the sRGB format keeps the tables through the raw UNORM views.

bind: ColorResolveFormat::device_srgb / decodes_on_device, the device_mean
lowering, and the tables only for the table form. runtime: of_resolve picks
the form (color_resolve::decodes), the plan reads through the sRGB view and
skips the raw write, twin_read_view makes a stand-in mutable to the sRGB
view, resolve::scratch_viewed. device-rounded-resolve is announced for such a
resolve on every device; docs (degradation, API.md, FAST-PATHS sRGB row, the
module docs) say so.

Measured with the new lane
resolve_rounding::a_twin_resolve_into_srgb_rounds_as_announced (every pair
of codes at 2 samples, the lane's pattern at 4, RGBA8 and BGRA8): MoltenVK
1.4.2 on the M3 Max 696 of 262,144 channels one code below Metal's at 2
samples, 880 of 524,288 at 4; lavapipe (Mesa 26.0.8, 4 samples only) 57,865
of 524,288, above and below; none past one code. The model in the bind tests
gives 1,758 of 65,536 pairs one code apart with correctly rounded
conversions. The resolves lane's twin texels now hold each colour channel to
the note's two codes (lavapipe writes 0xbb where Metal's is 0xbc).

Verified: the twin lane, runtime_lane::resolves (19),
runtime_lane::resolve_rounding (4) and the dont-care twin case pass on
MoltenVK (--cfg m2v_gpu) and on lavapipe (--cfg m2v_cpu_icd); the bind
color_resolve tests (20) and the runtime color_resolve, image_plan and
stand-in unit tests pass; clippy clean plain and with --cfg m2v_gpu.
api_signatures re-blessed for the two new methods.

* Make a plain colour fill the device's clear where the device renders the format

fillTexture:level:slice:region:color: (Apple SPI) packed the colour on the
host by Metal's fill rules in every format. Under the native-arithmetic rule
the device's own colour conversion is the only form where it has one, so a
plain fill (no pixelFormat:) of a texture whose format's fill converts a
float (normalized, sRGB, half, float, small float, shared exponent;
fill_value::device_converts), whose image holds Metal's bytes of the format,
and which the device renders and copies both ways, is now the device's clear:
a scratch image of the region in the texture's image format, samples and
dimension, cleared whole by vkCmdClearColorImage, copied into the region of
each image the fill writes through the blit copy path, placed as the fill.
Integer formats (no conversion), the extended-range and bfloat formats,
texture buffers and every format the device does not render keep the host
packing; the pixelFormat: variant keeps it everywhere (capability).

The clear's note is recorded where it applies against Metal's fill packing,
not its clear: device-color-conversion where fill_value::device_apart holds
(a normalized value within 1/1024 of a tie, widened by the fill's float
product and, for the packed 16-bit formats, a step through half; an sRGB
value inside (0, 1); a value a half, small float or shared exponent does not
hold), device-nan-encoding for a half or small-float NaN. The fill slot
still takes the packed texel. The call is logged as itself
(BlitCall::FillTextureColor) so a re-encode clears again.

Lanes: color_fills::plain_color_fills_are_the_device_s_clear fills the
probes' 762 colours into each of the 70 formats plain and packed, notices
asked for at each fill, and holds every texel to Metal's or, where that fill
announced, to a code (a NaN for a NaN); it asserts an RGBA8Unorm_sRGB fill
announced device-color-conversion, which the host packing never does.
color_fills::plain_color_fills_land_where_packed_ones_land checks the 31
placement cases byte for byte. The Metal-hash test now packs by
pixelFormat:, texture_fills runs its plain colour cases packed (Metal's
bytes), and the RGBX fill test accepts an announced code. Unit test for the
predicates in tests::fill_value.

Measured (plain against packed, 762 colours a format): lavapipe (Mesa
26.0.8) rounds a half toward zero (RGBA16Float 420 texels a code apart), an
8-bit tie down (RGBA8Unorm 20), and writes its own RG11B10 NaNs (275);
MoltenVK 1.4.2 on the M3 Max keeps RGBA8Unorm exact, stands RG11B10Float 186
and RGB9E5Float 150 texels a code apart, and writes 0x7e00 for Metal's
0xfe00 half NaN; every one announced.

Verified on MoltenVK (--cfg m2v_gpu) and lavapipe (--cfg m2v_cpu_icd):
runtime_lane color_fills, texture_fills, rgbx_textures, sample_fills,
surface_fills, texture_buffer_fills and two_plane_copies pass; runtime unit
tests (fill, replay, blit) pass; clippy clean plain and with --cfg m2v_gpu;
rustdoc clean.

* List lavapipe's own clear at seven plain texture fills

A plain colour fill of a format the device renders to is now the
device's clear (6cdfe023d9), so the texture-fills conformance case's
digest moves on the gate container's arm64 lavapipe at seven formats:
ABGR4Unorm, RGBA8Unorm, RGBA8Unorm_sRGB, BGRA8Unorm, BGRA8Unorm_sRGB,
RGBA16Unorm and RGBA16Float. The site is digest-only, so the same fills
were run per texel through the color_fills lane's helper on that venue
(a throwaway probe, not committed). Of the case's four plain colours
only c5's (2, -1, 0.5, 0.3) differs, in its alpha alone, one code below
Metal's: 0.3 is a tie in 4, 8 and 16 bits (4.5, 76.5, 19660.5 codes)
that lavapipe rounds to even, and lavapipe truncates the half (0x34cc
for Metal's nearest 0x34cd). device-color-conversion records it at
every such fill and its one-code bound covers it, so each row is the
device's native answer, scoped to the measured build, with nothing
open.

Verified: conformance replay --cpu on lavapipe (llvmpipe LLVM 21.1.8,
128 bits) exits 0, the 825 rows exactly the ledger's (no unlisted, no
stale); the ledger's unit tests pass; replay --gpu of the 54
texture-fills cases on MoltenVK 1.4.2 / M3 Max: 37 announced, 17
exact, none divergent.

* 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:22 +02:00
Anees Iqbal 44910ecabd Hand pixel samplers' scaled coordinate to the device; test the unflushed subnormal coordinate
One work packet, landed as 2 commits (255f93b252..aba772e24d on archive/development-linear-2026-10-28), in order:

* Hand pixel samplers' scaled coordinate to the device; test the unflushed subnormal coordinate

Rule 1: the device's sampler is the contract. A pixel-coordinate sampler keeps its capability
(the shader divides the coordinate by the level-0 size, since Vulkan's unnormalized samplers take
no gather, offset, comparison, array, 3D image or level of detail) and drops the correction that
reproduced Metal's position at texel edges.

Deleted: `AxisSnap`, `SnapKind`, `Snap` and the snap plan (`snapped_axis`, `gathered_by_word`,
`celled_by_word` and their word estimates), the texel centring of nearest pixel samples
(`centred`, `centre_word`, `pixel_centre`, `PIXEL_CENTRE_WORDS`), the snapped census names, the
shared switch's sampled-image arms (it is bicubic only now), `SamplerWord::PIXEL_GATED` and
`PIXEL_NEAREST`, the binder's gated keying and `lower::select::pixel_gated`. A runtime slot now
specializes on its word's coordinates bit alone.

Kept: the division by the size, `SampleOp::PixelFetch` (a constexpr nearest clamp-to-edge
sampler's exact fetch) and the argument buffer's flagged exact fetch, and Metal's position, wrap
and offset rules the emulated filters still use.

`PixelSamplerScaling` is now recorded on every device, MoltenVK included: always for a constexpr
pixel sampler but its exact fetch, and for a runtime slot under the clause that the bound word
states pixel coordinates. `ArgumentPixelSamplerScaling` is recorded for every heap access and
announced at a dispatch while any pixel state lives (not only a filtering one). The notes, the
API.md catalogue and a new FAST-PATHS device-gap row state the measured bound: the device's
normalized sampler at a coordinate within one f32 ulp of x/N on MoltenVK and at x/N on lavapipe;
a linear downscale by 8 within 1/255 of Metal's on MoltenVK, 2/255 on lavapipe.

Lanes: pixel_samplers holds each pixel configuration to its normalized control within REACH ulps
of the quotient and asserts both notes on every device; pixel_downscales holds every set within
2/255 of the snapped control; mirror_clamp counts a pixel lane that reads Metal's normalized answer
within REACH ulps apart; resource_ids expects the argument note where a pixel state lives at the
dispatch; the argument-note test waits for any pixel state. The pixel conformance cases declare
`pixel-sampler-scaling`; known-gaps rows for their llvmpipe sites are replaced (38 stale, 40 new,
at the end) and 22 Apple M3 Max rows appended, each naming the note.

Subnormal coordinates (e7775e4c82 removed the flush): `a_subnormal_coordinate_reaches_the_device_unflushed`
traces every sample and gather coordinate of constexpr border samplers (1D, 2D, 3D, gather; nearest
and linear; zero and white borders) back to the loaded value through bit moves alone, on every
committed profile, and holds a kernel whose AIR flushes the coordinate as not passing through.

SEMANTICS_VERSION 1960; RUNTIME_VERSION 1676 (the argument note's announcement and the binder's
sampler key changed).

Verified:
- cargo clippy --workspace --all-targets --all-features -D warnings, plain and --cfg m2v_gpu;
  RUSTDOCFLAGS=-D warnings cargo doc --workspace --all-features --no-deps.
- Core suites (4953 tests): all pass but golden_hashes (3776 cells move, left for the re-bless);
  api_signatures fixed here.
- Negative controls: on development's code, 7 of the new or changed sampler tests fail; with the
  removed flush put back in plane_coord, the subnormal test fails (border 1d zero).
- Words (lavapipe; MoltenVK and NVIDIA alike in step): px_sample_argument 2869 -> 2641,
  xr_sample_runtime 1175 -> 967, px_const_linear_* 1078 -> 943, pix_gather_edge 1089 -> 920,
  runtime_gather 1165 -> 944; constexpr nearest-edge and the normalized control unchanged;
  spirv-val PASS on each.
- Lanes on lavapipe (linux-gate arm64) and MoltenVK (M3 Max): pixel_samplers, pixel_downscales,
  resource_ids, mirror_clamp pass; on MoltenVK argument_linear_samples' half RGBA32Float heap
  groups, driver_deviations and one degrade_notices test fail, none through a pixel path.
- conformance replay --cpu (whole set, lavapipe): exit 0, nothing unlisted, no stale row. The
  pixel cases on MoltenVK: every value site as listed; each case's set-past-layout-support notice
  is unlisted there, as in the untouched argument-encoder-texture-sampler.

* 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:22 +02:00
Anees Iqbal 8fb8b51f4e Hold the kept compressed-blit encodings to the ledger on the M3 Max
One work packet, landed as 2 commits (4a74bd7248..aa6286b711 on archive/development-linear-2026-10-28), in order:

* Hold the kept compressed-blit encodings to the ledger on the M3 Max

Since 62c7d7a9f5 a blit through a texture Metal keeps losslessly
compressed is the device's copy, which keeps the bytes Metal's
compression rewrites into its canonical encoding. dbd18ad126 held the
lavapipe replay to that; the MoltenVK replay on this M3 Max read 24
value sites the ledger did not list. Each is now a known-gaps.tsv row
(venue Apple M3 Max) naming the note that records it:

- compressed-blits-bgra10xr and -srgb, all seven sites: the runtime
  holds the format in an R16G16B16A16_UINT image, whose blits under
  MoltenVK keep the bytes. extended-range-bits-kept.
- compressed-blits-rg11b10f and -rgb9e5f, the five sites through the
  Shared texture (blit-in-cpu-out, cpu-in-blit-out, out-of-compressed,
  into-compressed, over-a-buffer): MoltenVK makes that texture's image
  of PixelFormatView usage, which Metal keeps uncompressed, so its
  copies keep the bytes. device-nan-encoding and shared-exponent-kept.
  The Private compressed sites (tall, level-3-padded) are MoltenVK's
  own blit through Metal's compression and match Metal there.

This is the same value in another encoding, not wrong data. The bytes
the case feeds, set against Metal's recorded words site by site, give
exactly the replay's counts and largest differences at all 24 sites
(for example tall 8191 words, largest 1610547199: Metal's alpha code
clamped up to 384 from below). Every texel of those bytes decodes to
Metal's value: the top ten bits of each field with alpha read clamped
for BGRA10_XR, NaN for NaN for RG11B10Float, the exact value for
RGB9E5Float. Nothing is open: rule 1 rules out a pass that writes
Metal's encoding.

docs/CONFORMANCE-COVERAGE.md regenerated (the ledger's row count).

Verified on the Apple M3 Max, MoltenVK 1.4.2:
- conformance replay of the four cases at 46bd06ec2f (the parent of
  62c7d7a9f5): all four announced, every value exact.
- the same replay at 19b0dafb5a: 24 unlisted divergent sites, exit 1;
  with these rows: exit 0, the 24 rows exactly the ledger's.
- runtime_lane::compressed_blits under --cfg m2v_gpu: passed; every
  kept site held byte for byte, ExtendedRangeBitsKept,
  DeviceNanEncoding and SharedExponentKept each announced, MoltenVK's
  own copy of the Private compressed images rewrote 374 (RG11B10Float)
  and 507 (RGB9E5Float) words.
- cargo nextest -p metal2vulkan-conformance known_gaps, compressed_blits
  and coverage tests (19 passed); clippy -D warnings; coverage.py --check.

* Say in the notice catalogue that a compressed RG11B10Float blit announces device-nan-encoding

The catalogue's device-nan-encoding entry named only float arithmetic's
NaN results, while PrecisionNote::DeviceNanEncoding's doc and the
runtime also announce it for a GPU blit through an RG11B10Float texture
Metal keeps losslessly compressed, as the extended-range-bits-kept and
shared-exponent-kept entries already say for their formats.

Docs only.
2026-10-28 17:24:22 +02:00
Anees Iqbal e656074087 Name no native note in any conformance case, at the notices site or at a value
One work packet, landed as 5 commits (647aeae138..19b0dafb5a on archive/development-linear-2026-10-28), in order:

* Name no native note in any conformance case, at the notices site or at a value

The suite declares every note of the device's native answers for every case
(replay::NATIVE_NOTES), so a case's own declaration of one stated the suite's rule a
second time, and a value tolerance justified by one was the suite deriving a tolerance
the note's own documentation says validation derives from none.

What changed:
- 237 notices-site declarations of native notes, over 180 cases from 28 case modules
  (depth-denormals 76, device-color-conversion 33, float-sample-filter 31,
  device-nan-encoding 27, srgb-texel-decode 25, signed-depth-test 17,
  device-arithmetic 10, device-sampling 8, device-texel-conversion 8, one each of
  device-transcendentals and unorm-depth-rounding), are gone. The shapes that existed only
  to choose them go too: fresh_contents' per-row notices, half_write_nans' `packed`,
  render_chains' and compute_render_chains' `divides_a_float`, alpha_coverage_pairs'
  separate on/off and single-sample sets, and sampler_filtering's name-keyed branch.
- Four value tolerances justified by native notes are removed: border_swizzles'
  one-word `Absolute` and compressed_decode's and etc_textures' one-ulp `Ulps`
  (device-texel-conversion, whose note says validation derives no tolerance from it), and
  pass_bytes' `Unchecked` tanh column (device-transcendentals, device-arithmetic). Those
  sites compare exactly; where a venue's device answers otherwise the site is a
  known-gaps.tsv row, which the ledger commits that follow carry. border_swizzles'
  word-range test, which existed only to make its tolerance mean one ulp, goes with it.
- tests::no_case_names_a_native_note holds it: it failed listing 765 allowances before
  this change and passes after.
- docs/CONFORMANCE-COVERAGE.md regenerated (tolerances 12 to 8, `Ulps` no longer used).

Verified: cargo nextest run -p metal2vulkan-conformance --all-features, 1007 passed;
clippy -p metal2vulkan-conformance --all-targets --all-features -D warnings clean.

* Count no native note in the cost and times halves' degraded-set rule

The rule is there because a notice can say the device lacked the exact form and the
runtime did something cheaper, so a count or a time taken with it is of a different amount
of work. A native note (replay::NATIVE_NOTES) never says that: the native form is the only
one the runtime builds, under either policy. Counting them made a cost record incomparable
with the same work whenever a run did or did not provoke one (the MoltenVK replay before
this change read 45 cases `unmeasured` for native notes alone: device-color-conversion,
device-filtered-mipmaps, device-nan-encoding, native-nan-encoding, native-half-conversion,
fast-math-rewrites), and withheld a times verdict from every case that computes, converts
or samples.

replay::degrading filters them out, sorted and once each. run.rs takes it for the replay's
cost row, the cost measurement and the times round; cost::judge and times::classify apply
it to the stored side as well, since records and figures taken before still hold native
codes (fast-math-rewrites in 56, device-nan-encoding in 33 of the committed ones), so no
re-bless is needed for the rule itself.

Tests: tests::the_degraded_set_rule_counts_no_native_note (a record holding a native note
judges `within` against a run that announced none, and the other way, while a non-native
difference stays `unmeasured`) and times::tests::a_leg_that_announced_only_native_notes_is_judged.
README's two statements of the rule say so.

Verified: cargo nextest run -p metal2vulkan-conformance --all-features, 1007 passed;
clippy -p metal2vulkan-conformance --all-targets --all-features -D warnings clean.

* State the measured bounds of the device's texel and colour conversions

device-texel-conversion's recorded bound named 8- and 16-bit codes and said a
4-bit channel's widening is exact, so two lavapipe ledger families had no
stated bound: a 10-bit BGR10A2Unorm code read one f32 ulp low, and ABGR4Unorm
codes read one ulp high (the device converts by the reciprocal product, where
it does not replicate bits). The bound now covers 8-, 10- and 16-bit codes and
a 4-, 5- or 6-bit channel converted by the reciprocal, within one f32 ulp.

device-color-conversion stated only that near a tie the device may store the
other code. On lavapipe it stores past one code in three shapes, which the
note now states: a blend into an 8-bit unorm attachment within 2 codes, a
fetched-and-rewritten 8-bit sRGB attachment within 2 codes once a later draw
reads an earlier one's code, and a blend into an 8-bit sRGB attachment within
4 codes. Another device is not bounded past one code; the NVIDIA RTX 5080
Laptop GPU ledger rows record up to 11 codes at an sRGB blend.

The same text goes into the translator's PrecisionNote docs, the runtime's
Degradation docs (DeviceColorConversion gains one) and docs/API.md's
catalogue. Docs only; no behaviour changes.

Verified: the lavapipe replay (scripts/linux-gate, arm64, LLVM 21.1.8) shows
every row of those families within the stated figures (the ledger's answers);
rustdoc -D warnings for metal2vulkan and the runtime; the runtime's
degradation and catalogue tests.

* Reword the ledger rows that proposed emulating Metal's bits, and list lavapipe's exact rows

Under the native-arithmetic contract, the device's blend, conversion and
sampler are the answer. Some known-gaps.tsv rows still proposed reproducing
Metal's bits: folding the blend into the fragment function, encoding through
Metal's table, or emulating an argument buffer's sampler. Those rows now name
the note that covers the difference and its stated bound, or the open work
where there is some. Only field 6 changes, and no row moves.

- Apple M3 Max half-output-blends (18 rows) and NVIDIA half-output-blends
  (39): half-output-fast-math-blend and its stated bound, with no fold. The
  sign-bit sentence is kept only where an NVIDIA bound is the sign bit.
- NVIDIA a2one (2) and argb8-targets (23): device-color-conversion. The
  llvmpipe argb8 rows at 2 codes (9) now cite the bound the note states.
- blend-interaction-format-srgb8 (14, both venues): device-color-conversion.
  lavapipe's sites are within its 4 codes. NVIDIA's 11- and 5-code sites are
  past it and need an element-by-element read.
- fetch-ordered sRGB (8), ABGR4Unorm swizzles (26) and the BGR10A2Unorm
  round trip (1) cite the bounds the notes now state.
- RADV sample-fills (3): depth-denormals is a native note the suite declares
  for every case, not one the case declares.
- NVIDIA pixel-samplers nearest norm (6): device-sampling's nearest-boundary
  bound. Open: an element-by-element read.
- a2c-on-1-alpha-50 (2): no note covers the device's coverage mapping. Open:
  the owner's call between recording it and computing Metal's floor rule.
- format-footprints-plain-stragglers: the raw sRGB path and
  `texel_format::srgb_raw` are gone. The row names the UNORM twin path that
  is there today (`srgb_raw_twin`, `srgb_twin_on`, `RuntimeFact::SrgbTexture`)
  and drops the todo-list wording.

Removing the old one-ulp and as-words tolerances showed lavapipe's own
conversion at exact sites. That adds 64 rows beside their families
(border-swizzles rgba8/bgra8 30 each, ETC2/EAC 8-bit 3, pass-bytes
fast-float-tanh 1) and updates 35 BC rows' answers, their counts now
including the one-ulp elements.

Verified: the lavapipe replay through scripts/linux-gate (arm64, 4 CPUs)
went from 99 unlisted and 35 stale before these rows to 0 unlisted and 0
stale ("the 882 row(s) above are exactly the open gaps known-gaps.tsv
expects"; 818 before the tolerance removal). The conformance host suite
passes (1007 tests), and docs/CONFORMANCE-COVERAGE.md is regenerated.

* 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:22 +02:00
Anees Iqbal 9afdb1e150 Take the device's instruction for pack, dot, mix, sqrt, exp, log, sign, fract, median3, fneg and fabs
One work packet, landed as 6 commits (3d6b2488ea..f1693ce8c4 on archive/development-linear-2026-10-28), in order:

* Take the device's instruction for pack, dot, mix, sqrt, exp, log, sign, fract, median3, fneg and fabs

Rule 1: where the device has a native form it is the only form. The
translator still computed Metal's own bits for several functions the
device has an instruction for. Each now takes the instruction, its
difference from Metal recorded as a note:

- air.pack/air.unpack: GLSL.std.450 Pack/Unpack Unorm4x8, Snorm4x8,
  Unorm2x16 and Snorm2x16; rgb10a2 and rgb565 by the device's NClamp,
  multiply, RoundEven, and multiply by the reciprocal; unorm4x8_srgb by
  the MSL transfer functions with the device's Pow around the 8-bit
  instruction (no table read, no NaN select). New note
  DevicePackConversion (device-pack-conversion), not recorded for a
  float conversion of the four named formats on MoltenVK.
- dot, mix, fast::sqrt: OpDot, FMix and Sqrt on every device, MoltenVK
  included (the Mix/Dot/ChunkedChain strategies, Metal's fma chains and
  x * rsqrt(x) are deleted). NativeDot/NativeMix everywhere but a float
  one on MoltenVK; a chunked dot sums each chunk's OpDot.
- precise exp/log and half exp/log/pow/powr/sinh/cosh/tanh: GLSL Exp,
  Log, Pow, Sinh, Cosh, Tanh (Metal's compositions, half_tanh and the
  half remaps deleted); half Fun kinds keep the notes honest on MoltenVK.
- fract, sign, median3: Fract (bounded below one, the definition),
  FSign, NMin/NMax; their special-value fixes are deleted. median3 is
  NativeMinMax on every device (two NaNs, f32 denormals).
- round keeps half-away-from-zero from Trunc without the +0 fix: C99's
  -0, NativeTranscendentals on every device.
- float fneg/fabs: OpFNegate and FAbs, the NaN payload NativeNanEncoding
  and fneg's denormal DeviceDenormals.

Kept: exp10/log10 compositions, fmod's routine, ldexp on bits,
sinpi/cospi/tanpi, the fast_ formulas, pow/atan2 C99 specials, the
saturating convert, round_integer. math::pack/unpack stay for the tile,
attachment, fetch and texture callers.

The interpreter models the normalized packs. SEMANTICS_VERSION 1920,
ARTIFACT_FORMAT_VERSION 469 (a PrecisionNote variant).

Verified so far: clippy -p metal2vulkan --all-targets --all-features -D
warnings; rustdoc; nextest lower::arith (244 tests) and the engine_arith,
engine_float_call_notes, engine_native_maths, engine_spirv_cross_forms,
engine_native_half modules.

* Delete the measured half quantize deviation; hold dot and median3 lanes to the device

After the half follow-ups, no module requires VkProperty::MetalHalfQuantize: a module that
rounds to half through OpQuantizeToF16 records NativeHalfQuantize on every profile, and nothing
decides on DriverDeviation::MetalHalfQuantize. Delete it with its property, its derive and
profile arms, its codec entry, its four measured rows (MoltenVK on Apple9, RADV on the 780M, ANV
on the UHD 770 and the Iris Xe), the driver-facts test rows, and the lane assertions that it
required nothing (engine_native_half, engine_arith, driver_deviations' half quantize and owned
half edge lanes, native_maths' half rounding lane). Docs that named it (NativeHalfQuantize,
narrow::quantizes, driver_facts) now say Vulkan leaves the quantize's rounding to the device.

The lanes follow the previous commit's native forms:
- driver_deviations' dot lane: dot is the device's OpDot on every device, so the half words (a
  dot of half lanes held as float) are no longer checked against Metal's fused 16-bit chain;
  the float words stay checked where the profile takes MetalFloatFunctions (MoltenVK, whose
  OpDot is MSL's own dot), and every kernel must record NativeDot.
- driver_deviations' min/max lane: median3 is NMin/NMax on every device and records
  NativeMinMax, so its word (the seventh of each lane) is printed, not checked; every kernel must
  record NativeMinMax.
- the denormal probe and native_maths docs name the device's OpDot and FMix.

api_signatures re-blessed (DevicePackConversion added on both crates; the two MetalHalfQuantize
variants removed). REFUSALS.md regenerated, unchanged.

Verified: see the branch report.

* Hold the sRGB pack bound and round's zero to what the devices answer

The conformance replay on lavapipe and the MoltenVK lanes read the previous two commits' native
forms against Metal:

- sRGB unpack and pack: Metal decodes through its twelve-bit table (the step k / 4095 nearest
  the transfer) and encodes by that table's byte, where the module takes the MSL transfer by the
  device's Pow. DevicePackConversion's bound (artifact, runtime, API.md, FAST-PATHS.md) now says
  so: a decoded colour within half a twelve-bit step (1/8190) of Metal's step, beyond Pow's
  bound. Measured on the authored cases (lavapipe and MoltenVK): every float decode within
  1.2205e-4 of Metal's, every half within that and one half ulp, every encoded channel within one
  code, no alpha differing; normalized packs a code apart at ties, a NaN channel the device's.
- known-gaps.tsv: pass-bytes-srgb-decode-all-bytes's row takes the new answer (1153 elements,
  largest 0x00F90000) and names device-pack-conversion; a new row for pass-bytes-srgb-encode-sweep
  (772 elements, largest 0x00010101); pass-bytes-half-tanh-regimes's answer moves to 1257 elements
  (half tanh is the device's Tanh). CONFORMANCE-COVERAGE.md regenerated.
- driver_deviations' denormal probe: round is C99's on every device (NativeTranscendentals), whose
  zero below zero is -0 where Metal answers +0, so its word (15) is printed, not checked. On
  MoltenVK it was the lane's only failing word (48 of 4096).

Verified: conformance replay on lavapipe (arm64 gate container) exit 0, nothing unlisted or
stale; driver_deviations' float_denormals, owned_dot and minimums lanes pass on lavapipe and on
MoltenVK (M3 Max); conformance and degradation tests pass.

* Hold the engine maths tests to the device's instructions

engine_metal_math and engine_native_maths still asserted Metal's forms that the native change
replaced; they skip without llvm-as, so the earlier focused runs missed them.

- engine_metal_math: a half fast_tanh is Metal's half tanh (Metal's half functions are the same
  in both math modes, and MSL's fast-math formulas are its float ones), so it is the device's
  Tanh, no Exp2 and no division, as the code already lowers it; the float fast_tanh keeps the MSL
  formula and its assertions. sign is the device's FSign with and without fast math. Both record
  NativeTranscendentals wherever the device's functions are not Metal's own; on MoltenVK sign is
  MSL's own (no note) and a half tanh is MSL's float tanh rounded to half
  (DeviceTranscendentals). The sRGB fixtures now assert Pow beside UnpackUnorm4x8 /
  PackUnorm4x8, no table, and DevicePackConversion; the interpreter models no Pow, so the table
  reference values and the interpreter run go (their values are the device lanes'). The test is
  renamed metal_math_variants_select_their_forms.
- engine_native_maths: dot, mix and fast::sqrt are OpDot, FMix and Sqrt with no Fma on lavapipe
  and on MoltenVK, a float dot and mix noting nothing on MoltenVK and a half mix NativeMix; the
  values hold their notes' bounds on both profiles' interpreter runs, where the test used to
  claim Metal's fused chains word for word on MoltenVK.
- refine_float's doc: air.fast_sqrt is the device's Sqrt; engine_tiny_products' doc: the
  module's dot is the device's OpDot.

Verified: with llvm-as set, every engine_ and lower::arith test passes (1610); clippy clean.

* Number ARTIFACT_FORMAT_VERSION 473 and SEMANTICS_VERSION 1904, past development's

The fast-math landing took ARTIFACT_FORMAT_VERSION 470 and the sampler-details landing 472 and
SEMANTICS_VERSION 1903, so this series' encoding (the new DevicePackConversion note and the
removed MetalHalfQuantize property in the codec) takes 473, and its translation changes 1904 (set
in the series' first commit at the rebase onto 322dc6354d).

* 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:22 +02:00
Anees Iqbal ae70850097 Take the device's native texel rounding, residency, level clamp and stores
One work packet, landed as 7 commits (d1161d6b38..322dc6354d on archive/development-linear-2026-10-28), in order:

* Take the device's native texel rounding, residency, level clamp and stores

Rule 1: where the device has a native form it is the only form, noted where it can differ.

- Half texels on MoltenVK: a `half` read, sample or gather is the device's `float` texel (Metal's
  there) rounded to nearest even. The routine keeps only the YCbCr 8192 grid's ties away (the
  YCbCr work's), so the Metal-sampler families (32-bit float sample toward zero, the 16-bit
  normalized grids' exact half, the unmeasured class) go, with `HalfFamilies`, `HalfForm`, the
  grid constants and `texel_round::ones_ratio_*`. `HalfTexelConversion` is recorded under the
  bound format for a 32-bit float sample, a 16-bit normalized texel and an unmeasured format.
- Subnormal coordinates: the clamp-to-zero flush is gone; the device reads the coordinate
  (`DeviceSampling`).
- Residency: on a device with `shaderResourceResidency` a sample's or gather's word is the
  device's sparse residency (`SparseResidency`); Metal's footprint rule and the tile map stay only
  where the device has no residency of its own. `Probe`, the named footprint taps and the
  zeroing of them go.
- Level clamps: a sampler's `lodMinClamp`/`lodMaxClamp` reach the device as given, not snapped to
  Metal's 1/64 grid; MoltenVK's Metal sampler snaps itself. Level queries are noted
  `DeviceSampling` off MoltenVK.
- Stores: an integer texel written into a half-float or `RG11B10Float` storage texture of the
  float class is the store's to convert (noted `DeviceColorConversion`), and a `float` blend
  into a 16-bit float attachment through the pixel interlock is the store's to round (Metal's
  where the profile takes `MetalHalfStorageWrites`, else noted). Only
  `TextureWriteRoundingMode::NearestEven` keeps the shader's rounding (no store gives it).
- color_writes.rs docs: drivers round small floats toward zero as measured.

Docs: FAST-PATHS rows 60/61 and the subnormal gap removed; API.md catalogue entries;
`PrecisionNote` and `DriverDeviation` docs. SEMANTICS_VERSION 1950, RUNTIME_VERSION 1750 (the
runtime's sampler cache docs and test).

Verified: cargo clippy --workspace --all-targets --all-features -D warnings clean; the
metal2vulkan suite (3370 tests) with every failure fixed or updated to the native answer
(half_texel, texture_interp's 16-bit grid, srgb_decode, the sparse binder tests, cross-class
writes on the interpreter, fetch_blend16_narrow); golden_hashes moves and is left for
development's re-bless; api-signatures and refusal-surface checks unchanged.

* Take Vulkan's cube-gradient rule on a driver whose route is not measured

A MoltenVK release or GPU whose cube-gradient route no measurement covers took Metal's anisotropic
level and taps in the shader (`CubeGradientRoute::Unmeasured`), and elsewhere an isotropic sampler
made for the use. Rule 1: the device has a native gradient sample, so it is the only form. Such a
driver now takes `CubeGradientRoute::Vulkan` (the form Vulkan's derivative rule reads), the
device's reading recorded as `CubeGradientFootprint`; the emulation stays only for a device
without `samplerAnisotropy`.

With the variant gone nothing sets the isotropic-sampler use, so it is deleted throughout:
`SamplerUse::cube_gradient` and `with_cube_gradient`, `CombinedSampler::cube_gradient` and its
index bit, `HandleClass::Sampler`'s `cube_gradient` (four heap sampler classes, not eight), the
binding keys, the plan's `WriteSource::Sampler`/`ArgumentSampler` and `SamplerSource::Slot`
fields, the codec, the runtime's and the validation executor's binders. The anisotropic emulation
loses its isotropic one-tap form and the `answered` input.

Consumer-visible: `SamplerUse`, `CombinedSampler`, `HandleClass::Sampler`, `WriteSource` and
`SamplerSource` lose the field; `CubeGradientRoute::Unmeasured` is gone (api_signatures blessed).
ARTIFACT_FORMAT_VERSION 470 (the encoded classes and symbols changed).

Docs: profile.rs and error/mod.rs route docs, the AnisotropicFilter and CubeGradientFootprint
notes, API.md's catalogue, FAST-PATHS's unmeasured-route gap removed.

Verified: workspace clippy (all targets, all features) clean; nextest of the touched families
(engine_sampler_unk, engine_heap_binder, engine_handles, anisotropic, driver_facts, cache, bind
heap/plan, sym, metal::sampler, link, runtime sampler_cache, validation argument_buffer_members,
api_signatures/api_surface/fast_paths): 429 run, all pass after updating the tests to the Vulkan
route.

* Ledger lavapipe's halfway nearest-mip level under a descriptor clamp

With the level clamp handed to the device as given, lavapipe rounds a nearest mip filter's level
at `lodMinClamp` 1.5 up to level 2 where Metal reads level 1; Vulkan allows either rounding at a
half. The five `sampler-mip-*` sites are the device's native level selection: `DeviceSampling`'s
docs (and API.md's entry) now state the shape, and known-gaps.tsv holds the five llvmpipe rows.

Verified: `conformance replay --cpu` on lavapipe (linux-gate, arm64) listed exactly these five
sites as unlisted and nothing stale; the conformance ledger tests pass.

* Ledger the two filter-pair sites at their measured difference

The two mixed-filter sites of sampler-mip-filter-pairs-nearest differ by 1000, as the other three
do; the rows copied a truncated figure. Verified by conformance replay --cpu on lavapipe, whose
rerun named these two rows both unlisted and stale.

* Number ARTIFACT_FORMAT_VERSION 472 past the fast-math change's 470

Both the fast-math change and this series moved the artifact format to 470, so the
rebase merged them silently; 471 is held for the maths-functions series.

* Drop the YCbCr sample module's cube_gradient field, gone from CombinedSampler

This series removed CombinedSampler::cube_gradient with the isotropic sampler use;
the YCbCr sample module landed meanwhile still set it. Verified: clippy
--workspace --all-targets --all-features -D warnings clean.

* 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:22 +02:00
Anees Iqbal cdc09276f3 Emit fast-math arithmetic in the AIR's order and let the device group and fuse it
One work packet, landed as 4 commits (c81ea84c14..41bbe0f1c2 on archive/development-linear-2026-10-28), in order:

* Emit fast-math arithmetic in the AIR's order and let the device group and fuse it

What. The translator no longer reproduces Metal's compiler's grouping, pairing and fusion of
fast-math arithmetic. Each float operation is emitted in the AIR's order, decorated by its own
fast-math flags: an operation whose flags hold `contract` and `reassoc` is undecorated, so the
device's compiler may group and fuse it; every other one is `NoContraction` (an undecorated
SPIR-V operation would also allow reassociation, which a `contract`-only operation does not), and
a precise module's operations keep their order. `llvm.fmuladd` keeps its fused route: one AIR
operation, answered by the device's fused instruction.

Deleted: lower/arith/regroup.rs (648 lines), reassoc.rs (1469), contract.rs (585) and
contract/chain.rs (1204); the Folded and Fused strategies, ArithPlan's `contract` and `unrounded`
fields and select.rs's CONTRACTED read bit; output_precision's `plan` (the `unrounded` marking of
half output chains, Metal's choice of where not to round) and the plumbing that existed only for
it: LoweringInputs::half_output_lanes, the public HalfOutputLane, StageIo::half_output_lanes,
color_writes' half_output_lanes check, its cache-key hashing and codec entry; Fma::on (tests
only). Tests engine_reassoc (318), engine_regroup (134), engine_settled_sums (572), three
engine_arith tests, three half-output-lane engine_stage_io tests and the fused_sync lockstep case,
whose premises were Metal's grouping. Fixtures regroup_chain, sum_regroup, sum_regroup_precise,
fmx2_contract_fast, fmx2_contract_precise and unm_contract_chain (.metal, .ll, .air.ll, their
TOOLCHAIN lines and air_input printouts). Validation lanes sum_regroup (308) and settled_sums
(394), and the three authored cases whose expected values were Metal's fusions
(multiply-add-contraction-shapes-under-fast-math, multiply-add-contraction-flags-without-fast-math,
multiply-add-chains-under-fast-math) with their observations.

Kept: the contraction rule itself (AIR semantics); output_precision's notes (half_output_note,
note_half_output, note_extended_range_sources), which state where Metal may differ rather than
reproduce it; the F16 strategy's per-operation rounding.

The note. The existing FastMathRewrites covers it: it is now recorded where an operation's
operand comes from an operation the two operations' flags let a compiler regroup (both `reassoc`)
or fuse (a product into a sum, both `contract`), looking through negation, widening, shuffles and
element moves. No new kind. It moves from the ledger's elsewhere class to a device gap
(docs/FAST-PATHS.md row; tests::fast_paths), joins the conformance replay's NATIVE_NOTES, and the
cases' own declarations of it are gone (depth_texel_reads, half_read_nans, host_page_writes,
mesh_draws, sample_positions, snorm_tile_store, visibility, topology_classes).

New tests. tests::engine_fast_math_order: a fast `((d+c)+b)+a`, its precise twin, fast and
contract-only `a*a+c`, and a fast vector product, on every committed profile: spirv-val, no fused
instruction, one instruction per AIR operation, NoContraction exactly where the flags forbid
contraction, the interpreter's answer in the AIR's order, and the note on every form but the
precise sum. runtime_lane::kept_apart (reworks settled_sums): strict and contract-only mul-adds
store two roundings, a precise sum stores the AIR's order, a fast mul-add stores either rounding,
and the layer reports nothing.

Versions: SEMANTICS_VERSION 1900; ARTIFACT_FORMAT_VERSION 469 (StageIo lost a field).
Docs: FAST-PATHS.md, API.md (catalogue entry and policy), ARCHITECTURE.md (module map),
artifact.rs's FastMathRewrites doc. api_signatures.tsv re-blessed.

Verified (this machine unless named):
- Negative control: on the parent tree both new core tests fail (a fast sum regrouped to
  0x34000000 where the AIR order stores 0, the mul-adds fused, the product paired, no note);
  with the change they pass.
- cargo check, clippy --workspace --all-targets --all-features -D warnings, plain and with
  --cfg m2v_gpu; rustdoc -D warnings; refusal_surface --check; conformance and metal coverage
  current.
- Core tests: engine_fast_math_order, engine_arith, arith::tests, engine_stage_io,
  engine_simd*, engine_native_*, engine_metal_math, engine_fetch_*blend, engine_bicubic,
  engine_rotated_weights, engine_extended_range, engine_float_call_notes, color_write,
  api_tests, compile tests, fast_paths: 469 + 83 passed.
- The engine inventory bless (not committed) compiled every public fixture on all 19 profiles:
  43593 ok cells, each through spirv-val; only the deleted fixtures' 28 rows went.
- Conformance replay on lavapipe (linux-gate arm64): exit 0, the 723 rows are exactly
  known-gaps.tsv's, 0 unlisted.
- Validation lanes on lavapipe (linux-gate arm64, --cfg m2v_cpu_icd): kept_apart and the lanes
  that assert notice sets (blits, degrade_notices, gpu_times, half_slice_nans, heap_metal_sizes,
  heap_textures, provoking, provoking_mesh, sparse_textures, ycbcr_passes): 93 passed. llvmpipe
  kept all 4096 fast mul-adds as written and all 4096 fast sums in the AIR's order.
- kept_apart on MoltenVK (Apple M3 Max, --cfg m2v_gpu, under maclock): passed; the device's
  compiler fused 2370 of 4096 fast mul-adds and kept all 4096 fast sums in the AIR's order.
- Release CLI before and after, back to back, on the deleted and most affected fixtures over
  moltenvk-m3, gate-lavapipe, nvidia-rtx5080-laptop and intel-irisxe-anv: wall within noise
  (about 8 ms of process start, +-3 ms on a loaded host). Words: hfb_filter_bank 148284 ->
  162420 on moltenvk-m3 (half chains feeding a half output now round at each operation as the
  AIR says: +1408 OpFConvert, +1408 NoContraction; 289 OpFmaKHR became a multiply and an add),
  unm_contract_chain 33666 -> 35167, fmx2_contract_fast 18557 -> 18908, the rest within +-200.

Not in this commit: the golden tables (6028 cells move in 347 subjects, 5707 of them under an
unchanged key, 28 subjects go with the fixtures) and the engine inventory (28 rows go, none
moves) are re-blessed on development; corpus/authored-compile.tsv keeps three lines for the
deleted cases until its re-bless.

* Read 16-bit operands directly and hold half chains at float without float16

What. Two forms of `half` arithmetic that were neither the device's native one nor the fast one:

- Where a profile takes the device's 16-bit `+ - *` and `fma` (moltenvk-m3 on the measured fact,
  RADV and ANV under the 16-bit float controls), every `half` is held widened in an `f32`, so each
  16-bit operation narrowed both operands and widened its result: three conversions an operation,
  the next operation narrowing what the last had just widened. `FunctionBuilder::convert` now
  answers a narrowing of a value it widened from a 16-bit float with that float (exact), and a
  narrowing of a plain constant whose lanes are zeros, infinities or normal halves with the 16-bit
  constant; the widenings nothing else reads leave with the dead code. A rounding's own pair (a
  narrowing widened back) is never taken apart, so `narrow::rounds_by_conversion`, which decides
  `NativeHalfConversion` and the controlled modes, still sees every rounding. A chain of 16-bit
  operations is now 16-bit instructions on 16-bit values, converted only where a value enters or
  leaves it.
- Without `shaderFloat16` (vk12-floor, SwiftShader, Pascal) the module emulates `half` arithmetic
  in `float`, rounding each result by the device's quantize. New `DevicePolicy::half_chains`:
  `HalfChainPolicy::AtExits` (the default, the fast form) holds a `half` `+ - *` whose flags hold
  `contract` and `reassoc` and whose result only such operations read at `float` precision
  (`lower::arith::half_chain`), so a chain rounds where a value leaves it, one quantize per exit;
  `HalfChainPolicy::EachOperation`, which `exact_answers()` selects, rounds every operation. The
  profile carries it, so its fingerprint covers it. Recorded as `FastMathRewrites` (its doc and
  API.md's catalogue entry extended); a FAST-PATHS.md fast-default row; API.md's policy list.

The forms by profile (unchanged, for the record): moltenvk-m3 takes the measured 16-bit
arithmetic; RADV and ANV the controlled one; NVIDIA (the conversion pair folded,
`HalfConversionPairFolded`) and lavapipe (no `DenormPreserve` for 16 bits) have `shaderFloat16`
but compute `half` in `float` and round by the device's conversion pair, which this commit leaves
as it is; the profiles without `shaderFloat16` quantize.

Tests: tests::engine_fast_math_order::half_operations_read_their_16_bit_operands_directly (no
narrowing of a widened half or a constant on any profile, the rounded chain stored, some profile
takes 16-bit arithmetic) and ::half_chains_without_float16_round_at_their_exits_by_default (one
quantize against two, the held and rounded answers, both policies on every profile, distinct
fingerprints); runtime_lane::kept_apart::half_chains_without_float16_round_at_their_exits on the
device. Updated, as the conversions they counted are gone (the half agent's files, minimal):
lower::arith::tests::narrow::half_arithmetic_on_the_device_is_one_16_bit_instruction (at most two
operand narrowings), tests::engine_arith::half_rounding_follows_the_operation (the chain's
conversion count), tests::engine_arith::a_measured_half_sum_requires_the_arithmetic_fact_alone (a
kernel whose halves only the 16-bit `fma` reads widens nothing, so needs no measured widening).

Versions: SEMANTICS_VERSION 1901. ARTIFACT_FORMAT_VERSION unchanged (no encoded type changed).
api_signatures.tsv re-blessed (the enum and the field).

Words, release CLI, every module spirv-val'd (before = development 7b5cf8328d, then 622b388830,
then this commit):
- moltenvk-m3: hfb_filter_bank 148284, 162420, 140672; grd_half_many_samples 99039, 99330, 96710;
  nan_half_fast 10042, 10057, 9961.
- nvidia-rtx5080-laptop: hfb 147962, 155474, 155474; grd 110944, 111163, 111163; nan 9888, 9882,
  9882.
- gate-lavapipe: hfb 148530, 155470, 155470; grd 111018, 111163, 111163; nan 9888, 9882, 9882.
- vk12-floor: hfb 124826, 131766, 121270; grd 84482, 84627, 82019; nan 9838, 9832, 9808
  (EachOperation reproduces 622b388830's: 131766, 84627, 9832).

Verified:
- Negative controls: with the narrowing fold off, the 16-bit test fails (amd-780m-hawkpoint-radv
  narrows a widened half); with the plan off, the chain test fails (two quantizes on
  lunarg-desktop-baseline-2023). Both pass with them on.
- Core tests on this Mac: 1133 passed (arith, engine_arith, engine_native*, engine_stage_io,
  engine_fetch*, engine_simd*, spirv::*, device::*, cache::*, compile tests, api_tests,
  air_input, fast_paths, engine_fast_math_order, api_signatures, api_surface); conformance
  filtered tests 26 passed; clippy --workspace --all-targets --all-features -D warnings, plain and
  with --cfg m2v_gpu; rustdoc -D warnings; refusal_surface --check.
- The engine inventory bless (not committed) over every public fixture on all 19 profiles: only
  the deleted fixtures' 28 rows go, every other cell as before (spirv-val on each `ok`).
- runtime_lane::kept_apart on SwiftShader (linux-gate arm64, --icd swiftshader): the `fast` chain
  4096 of 4096 held under AtExits and 4096 rounded under EachOperation, the strict chain rounded
  under both; on lavapipe (whose compiler drops the undecorated conversion pairs: the `fast` chain
  4096 held under both, the strict one rounded) and on MoltenVK (Apple M3 Max, under maclock:
  every chain rounded at each sum, the 16-bit arithmetic) both tests pass.
- Lavapipe (linux-gate arm64): the conformance replay exits 0, its 763 rows exactly
  known-gaps.tsv's, 0 unlisted, the verdicts as at 622b388830; runtime_lane kept_apart,
  native_maths, half_* and degrade_notices: 28 passed. MoltenVK: the half_* lanes and
  native_maths' half rounding pass; native_maths_answers_within_its_recorded_bounds fails on
  NativeDivision (`divide::precise` records it everywhere; code this commit does not touch).

Not in this commit: the golden tables (with 622b388830, 7652 cells move in 672 subjects; 28
subjects go) and the engine inventory (28 rows go) are re-blessed on development.

* Number ARTIFACT_FORMAT_VERSION 470, after development's 469

What. development's own commit took 469 for its encoding change while this branch's first commit
took 469 for StageIo losing half_output_lanes; the rebase merged the two equal lines silently, so
two layouts shared one value. 470 keeps an artifact of either from decoding as the other.

Verified: cargo check -p metal2vulkan --all-features --all-targets on the rebased tree.

* 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:22 +02:00
Anees Iqbal 12cd1535a8 Keep the device's copy for blits through a texture Metal compresses
One work packet, landed as 9 commits (62c7d7a9f5..378d636d2f on archive/development-linear-2026-10-28), in order:

* Keep the device's copy for blits through a texture Metal compresses

Metal's GPU blit into or out of a texture it keeps losslessly compressed
writes three families' texels in its compressor's canonical encoding:
BGRA10_XR (and its sRGB twin) with each field's low six bits cleared and
the alpha code clamped, RG11B10Float with a NaN made the quiet NaN, and
RGB9E5Float with the shared exponent lowered. The runtime reproduced that
with a crate-owned compute rewrite of the copied rows (bind::CompressedBlit
and its module) after every such blit.

That is Metal's compressor's encoding, not the format's: Metal's own
uncompressed texture of the format keeps the bytes through the same blit,
and every rewritten texel reads the same value either way. The device's
copy, which keeps the bytes, is now the only form. A blit through such a
texture announces the note of the encoding it keeps, once per device:
extended-range-bits-kept (BGRA10_XR), device-nan-encoding (RG11B10Float)
and shared-exponent-kept (RGB9E5Float), each existing kinds; no new kind.
Where the device's own copy already writes Metal's encoding (MoltenVK,
RuntimeDriverDefect::CompressedImageCopiesRewriteTexels) nothing is
announced; the defect's PixelFormatView usage, which keeps CPU copies
byte-exact there, stays.

Removed public items: bind::CompressedBlit, bind::CompressedBlitModule,
bind::compressed_blit_module, WorkCounts::compressed_rows_rewritten.
RUNTIME_VERSION 1740. The conformance recordings' runtime cost records
that count compressed_rows_rewritten (compressed-blits-*, fresh-pattern-*,
xr-clear-routes-*, xr-draw-*) move at the next re-bless.

The compressed-blits lane now asserts the bytes are kept and each format's
note is announced; the conformance case declares the note where it is not
one of the suite's native notes.

Verified: cargo clippy --workspace --all-targets --all-features -D warnings;
RUSTFLAGS='--cfg m2v_gpu' cargo check of runtime and validation; nextest
of blit_plan, degradation, degradation_catalogue, conformance
compressed_blits, unused_bits, fast_paths, owned_divisions, api_surface,
api_signatures and refusal_surface (77 passed). Device lanes and replay
run after the whole series.

* Resolve a fetching pass's sample planes by the device's average

A color attachment whose sample planes held its samples as the pass ended
(framebuffer fetch in the pixel interlock on a device without multisampled
storage images: ANV, MoltenVK) was resolved from the planes by the
crate-owned resolve, which computes Metal's closed rules for every unorm,
snorm, sRGB, 32-bit float, half, packed 16-bit, RG11B10Float and
RGB9E5Float format. Every other color attachment resolves by the device's
AVERAGE. The average is the device's native answer, so it is now the only
form here too: the planes merge back and one more instance of no draws
resolves the attachment, announced device-rounded-resolve where the
driver's average is not measured to be Metal's (on MoltenVK it is,
DriverFact::ColorResolveAverageIsMetals, so nothing is announced there).

The crate-owned resolve keeps the two resolves no device's average writes:
into the attachment's format's sRGB twin (the 8-bit unorm and sRGB rules)
and of an extended-range attachment. Its rules for every other format, and
their tests, are deleted. ColorResolveFormat::of names the twin's eight
formats; sample planes are read only for an extended-range form, and a
module of a twin format from planes is refused.

Removed public items: ResolveRule::{HalfUnorm, Snorm, Float32, Float16,
SmallFloat, SharedExponent}, ResolveRule::bits, ResolveRule::resolves,
ColorResolveFormat::resolves; ResolveRule::Unorm loses its bits field.

Cost: such a pass now merges its planes back and resolves in one more
render pass instance, where it drew one resolve pass from the planes; a
memoryless attachment the pass only fetches and resolves needs a backing.

The ColorResolveAverageIsMetals docs, the shader-resolve and
device-rounded-resolve entries (degradation.rs, docs/API.md) now say what
resolves where. The fetch lanes expect no shader-resolve for a fetched
attachment.

Verified: cargo check --workspace --all-targets --all-features; the GPU
cfg check of runtime and validation; nextest of color_resolve,
sample_planes, degradation, driver_facts, fast_paths, api_surface,
api_signatures, refusal_surface (84 passed). Device lanes run after the
series.

* Clear a float attachment to the clear color as the device converts it

A render pass's Clear of a normalized, sRGB, packed 16-bit, half, float or
small-float color attachment computed Metal's texel on the CPU (its
rounding, its trip through half for the packed 16-bit formats, its
truncated small-float and shared-exponent mantissas) and handed the device
a value that converts back to it; a Depth16Unorm clear took a quarter step
above Metal's truncated code. The conversion is the device's native
answer, so the clear value is now the color (or depth) as a float, which
the device converts.

Where the device's conversion can stand a code from Metal's it is
announced, once per device: device-color-conversion where a normalized
channel's scaled value lies within 1/1024 of a midpoint between two codes
(a packed 16-bit channel's within Metal's half step too), an sRGB channel
lies inside (0, 1), or a half, small float or shared exponent does not
hold the value exactly; unorm-depth-rounding where a Depth16Unorm depth's
scaled value lies at or above a midpoint, which Metal truncates and a
device rounding to nearest takes up. Vulkan asks for rounding to nearest
and leaves ties, sRGB encodes and float rounding to the device. A NaN in a
normalized or RGB9E5Float channel still clears as 0 (Vulkan states no such
conversion); integer, extended-range, word and YCbCr attachments keep
Metal's conversion, which no device makes for them.

Metal's measured conversion moves into the tests as the model they compare
with. The renders lane accepts a device texel a code from Metal's where
the note is announced and prints it; the cleared sRGB resolve lane
compares the resolve with the device's own 1x clear.

UnormDepthRounding's docs and cost, PrecisionNote::DeviceColorConversion's
docs and both docs/API.md entries say so.

Verified: cargo clippy --workspace --all-targets --all-features -D
warnings; the GPU cfg check of validation; nextest of clear_value,
heap_tiled, fresh, nan_clear and degradation (55 passed). Device lanes and
replay run after the series.

* Expect the device's clear conversion in the lanes that clear at a tie

Since 5925c303f8 a clear converts the clear color (and a 16-bit depth)
the device's way, announcing device-color-conversion where a channel
lies at a rounding question (0.5 on an 8-bit unorm channel is 127.5
codes, a tie; any sRGB channel's encode) and unorm-depth-rounding where
a Depth16Unorm clear's fraction reaches the midpoint (Metal truncates).
Lanes that hold exact notice sets or Metal's truncated depth codes now
expect them:

- dont_care_stores: every pass clears through color_pass or earlier()
  at 0.5; clear_tie() adds the note to each expected set (MoltenVK's
  pipelines record no color-conversion note, so it showed there first).
- resolves: the depth stand-in clears Depth16Unorm to 0.5 (32767.5
  codes): Metal's 0x7fff or the device's 0x8000, and the note announced
  exactly for that format.
- buffer_depth_samples: the 16-bit clear to 0.25 (16383.75 codes)
  announces unorm-depth-rounding.
- buffer_texture_blits: the planar depth clears (0.375, 0.625, 0.875)
  hold Metal's truncated code or the one above it, the note's bound.

Verified: the four lanes' failing tests on lavapipe (linux-gate
halfnative) failed before these edits; on MoltenVK (Apple M3 Max,
maclock) dont_care_stores, resolves' depth stand-in,
buffer_depth_samples and the planar depth lane pass with them.

* Merge a fetched attachment's sample planes back before its twin resolve

A pass whose last draws fetch a multisampled attachment through sample
planes (the pixel interlock without multisampled storage images: ANV,
MoltenVK) left the planes unmerged after it under MultisampleResolve
wherever the crate-owned resolve drew the attachment's resolve, on the
reading that that resolve reads the planes. A resolve into the
attachment's sRGB twin is crate-owned but reads the attachment itself
(color_resolve.rs filters its planes out), so it resolved samples the
pass never wrote: on MoltenVK a 4x RGBA8Unorm attachment cleared to 0,
fetched once and resolved into RGBA8Unorm_sRGB read all zeros, where
the same pass stored too resolves (255, 225, 0, 0).

The planes steps now skip the merge only for a resolve that reads the
planes, an extended-range attachment's (the flag is renamed
planes_resolve to say so); a twin resolve merges first, as a stored
attachment does.

Test: runtime_lane::framebuffer_fetch::planes::
a_twin_resolve_of_a_fetched_attachment_reads_its_samples holds the
MultisampleResolve answer to the StoreAndMultisampleResolve one.

Verified on MoltenVK (Apple M3 Max, maclock): the test failed without
the fix (zeros) and passes with it, beside the planes, memoryless,
kept_resolves and twin-resolve lanes (18 passed); the runtime's
sample_planes unit tests pass.

* Expect the clear note in color_reformat's passes, through one helper

color_reformat's passes clear to (0.5, 0.25, 0.75, 1.0), whose red is a
tie in an 8-bit unorm channel, so the device's conversion of the clear
announces device-color-conversion at the device's first such pass.
Lavapipe's pipelines record the note already; MoltenVK's record none
(VkProperty::MetalColorWrites), so its exact notice sets failed there.

degrade_notices::tie_cleared() names that note for every lane whose
passes clear at a tie; dont_care_stores' local helper moves there.

Verified on MoltenVK (Apple M3 Max, maclock): color_reformat and
dont_care_stores pass (they failed in the full runtime_lane run before
this change).

* Hold the kept compressed-blit encodings to the ledger, and declare their notes

Since 01f733c6f0 a blit through a texture Metal keeps losslessly
compressed is the device's copy, which keeps the bytes Metal's
compression rewrites into the canonical encoding. The lavapipe replay
then read 46 rows the ledger did not expect:

- 28 value sites of compressed-blits-{bgra10xr,bgra10xr-srgb,rg11b10f,
  rgb9e5f}: the device's bytes against Metal's canonical encoding. Each
  is now a known-gaps.tsv row (venue llvmpipe) naming the note that
  records it: extended-range-bits-kept, device-nan-encoding,
  shared-exponent-kept, whose bound (the same value, another encoding)
  covers it. Nothing is open: rule 1 rules out writing Metal's encoding.
- 18 notice sites of fresh-pattern-{552,553,93}, xr-draw-bgra10xr*
  and xr-clear-routes-bgra10xr*: their read-backs blit out of such a
  texture and announce the note, every value exact. They now declare
  it through compressed_blits::kept_encoding_notice, the one table of
  which format announces which note (device-nan-encoding is native and
  declared for every case already). fresh_contents' row-notice test
  counts the three pattern rows' second allowance.

docs/CONFORMANCE-COVERAGE.md regenerated (the ledger's row count).

Verified: conformance replay --cpu on lavapipe (linux-gate halfnative,
arm64): exit 0, 751 rows, exactly the ledger's (723 before the series
plus these 28), 0 unlisted and 0 stale; cargo nextest -p
metal2vulkan-conformance (1005 passed); clippy -D warnings.

* Format owned_divisions' bind import after the rebase

The rebase onto development dropped both CompressedBlit (this series)
and BlockDecode (development's BC twin removal) from the import, which
rustfmt now joins onto one line. No behaviour changes.

Verified: cargo fmt --all --check.

* 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:22 +02:00
Anees Iqbal a1f1677174 Convert a two-plane YCbCr texture through the device's own Y′CbCr sampler where it has Metal's reconstruction
One work packet, landed as 3 commits (d38741a041..46bd06ec2f on archive/development-linear-2026-10-28), in order:

* Convert a two-plane YCbCr texture through the device's own Y′CbCr sampler where it has Metal's reconstruction

The owner's 10-28 decision: a YCbCr texture's texels are the GPU's own sampler Y′CbCr
conversion where the GPU converts the format and the planes form one image; elsewhere
Metal's fixed-point conversion stays as capability.

Route. The texture's conversion pass (ycbcr.rs's refresh) copies the planes from its staging
copy into an optimal image of the multi-planar format and samples it once per texel through
a combined image sampler whose layout bakes an immutable sampler of the
VkSamplerYcbcrConversion, writing the texture's image in the layout Metal's kernel writes
(bind::ycbcr_sample_module). User pipelines are unchanged: no pipeline variant per
conversion, no immutable sampler in a user layout, no combinedImageSamplerDescriptorCount in
a user pool. The staging-to-image copy runs at every refresh (two regions); the sample
dispatch takes the refresh's indirect arguments, so unchanged planes sample no workgroup.

Which textures. Unpacked 8- or 10-bit codes of a 4:2:0, 4:2:2 or 4:4:4 layout over plane 0
whose planes form one image: no chroma codes 0, no rows past the buffer, each plane at a
multiple of its texel's bytes with rows of whole texels that do not overlap
(VUID-VkBufferImageCopy-bufferRowLength-09101, VUID-vkCmdCopyBufferToImage-dstImage-07976);
on a device that enables samplerYcbcrConversion (enabled wherever present), whose optimal
tiling has SAMPLED_IMAGE and TRANSFER_DST; a 4:4:4 format also needs Vulkan 1.3 or
VK_EXT_ycbcr_2plane_444_formats (VUID-VkImageCreateInfo-None-12279), which the device now
enables below 1.3 where listed.

Metal's reconstruction required. Vulkan's implicit reconstruction of a subsampled format at
MIDPOINT through a LINEAR chroma filter weighs the chroma 3 and 1 along a halved axis, as
Metal does. Cosited it lies half a luma texel off (up to 1340/2048 of random planes on
lavapipe), and nearest it takes one pair: that is what the codes mean, not a precision step,
so a device without MIDPOINT_CHROMA_SAMPLES and a linear chroma filter for the format keeps
Metal's arithmetic for it (a capability the device lacks). The brief allowed cosited; the
measured distance is why I held it back, raised with the orchestrator.

Left on ours, on purpose:
- A 4:4:4 format read as codes (RGB8_444_2P, RGB10_444_2P): the identity model ignores the
  range and there is no chroma to reconstruct, so the device's answer is the codes ours reads,
  and the planes' image would only cost a copy.
- A render pass's load: MTLLoadActionLoad keeps the attachment's contents and our store
  inverts Metal's read, not the device's; the device's load moved untouched codes by one on
  lavapipe (ycbcr_passes' loaded-pass lane), so the load stays Metal's arithmetic.

Conversion. The surface's matrix (601/709/2020 model) and range (narrow/full); chroma filter
linear where the format has YCBCR_CONVERSION_LINEAR_FILTER and (SEPARATE_RECONSTRUCTION or
FILTER_LINEAR); the sampler's own filter nearest with SEPARATE_RECONSTRUCTION, else the
chroma's (VUID-VkSamplerCreateInfo-minFilter-01645); each sample at a luma centre. No clamp
of our own: "An implementation may clamp the R′G′B′ results of these conversions to the
range [0,1]."

Defects (measured, spec-forbidden; a RuntimeDriverDefect row keeps Metal's conversion):
- TwoPlaneChromaMisplaced (MoltenVK 1.4.2): 4:2:0 and 4:2:2 chroma one luma texel up and
  left of the midpoint's and filtered twice.
- TenBitCodesReadAsWords (lavapipe, Mesa 26.0.8): a 10-bit code's 16-bit word read as a
  16-bit UNORM (1023 as 0.999039) where Vulkan converts c/(2^10-1).

Paths measured: lavapipe converts its 8-bit 4:4:4 layout (its 4:2:0 and 4:2:2 ones are
cosited only, its 10-bit ones carry the defect); MoltenVK converts none.

Note and bound. ycbcr-filter-not-exact now also covers the device's conversion, announced
where such a texture is made. Each channel within 0.04/2048 of Vulkan's conversion past the
half the texture's image stores (0.038 measured at most), of Metal's read within 6/2048
inside [0, 1], unclamped outside it (lavapipe). FAST-PATHS gains its row; API.md matches.

Plumbing: OwnedModule::YCbCrSample with a baked combined sampler; conversions and samplers
held in OwnedKernels and released with it; priming makes and releases a conversion (the exit
guard's 128th call, vkDestroySamplerYcbcrConversion); WorkCounts::ycbcr_device_conversions
and ycbcr_device_samples count the path. RUNTIME_VERSION 1730.

Lanes: the YCbCr lanes hold a texture the device converts (counted as it is made) to
Vulkan's conversion within the bound instead of Metal's steps, and expect its notice
(validation runtime_lane/ycbcr_device_reads.rs).

Consumers: RuntimeDriverDefect gains TwoPlaneChromaMisplaced and TenBitCodesReadAsWords
(an exhaustive match breaks); WorkCounts gains two public fields (a struct literal breaks);
bind gains ycbcr_sample_module and YCbCrSampleModule.

In place on an integrated or CPU device (not changed, not decided): a throwaway probe on the
M3 Max under MoltenVK 1.4.2, 3840x2160 4:2:0 planes in host-visible memory composited into
1680x1050, best of 3x40: the device's Y′CbCr sampler over a LINEAR two-plane image of the
planes in place 72.2 us (8-bit) and 81.2 us (10-bit), against 121.1 and 122.6 us for Metal's
arithmetic over texel buffers (today's in-place form). MoltenVK's 4:2:0 conversion carries
TwoPlaneChromaMisplaced and lavapipe's is cosited only, so neither venue could take it.

Verified: build and clippy (plain and --cfg m2v_gpu); the touched host tests (catalogue,
defect lists, exit guard, api_surface, api_signatures, fast_paths, the sample module on every
committed profile). lavapipe (linux-gate arm64, --cfg m2v_cpu_icd): the runtime and validation
YCbCr, chroma, two-plane, defect, exit-guard and degradation tests, 166 of 166, the device
test counting 3 device-converted textures and the lanes 16; conformance replay --cpu exits 0,
its 723 rows exactly known-gaps.tsv's (no YCbCr conformance case reaches the device path:
they are 4:2:0). MoltenVK (M3 Max): the same selection 123 of 124, 0 textures device-converted;
the one failure (a_ycbcr_sample_through_an_unmeasured_filter_is_announced, anisotropic through
a constexpr sampler) fails identically at the base d736af8d66. Golden hashes: 2757 stale cells
at the base and at this tip alike (key changes), none from this change.

* Drop the YCbCr sample module's raw field, gone from CombinedSampler

The sRGB change (9835965499) removed CombinedSampler::raw with the raw-view
mechanism; the rebased YCbCr sample module still set it. Verified: clippy
--workspace --all-targets --all-features -D warnings clean.

* 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:22 +02:00
Anees Iqbal 2ec1f9fdc8 Read an sRGB texel through the device's own decode wherever the device samples its format
One work packet, landed as 2 commits (9835965499..1a930f5dc1 on archive/development-linear-2026-10-28), in order:

* Read an sRGB texel through the device's own decode wherever the device samples its format

Rule 1 makes the device's texel conversion the answer wherever it has a native form. A texture
bound in an 8-bit sRGB format (and the sRGB forms of BC1 to BC3, BC7, PVRTC, ETC2, EAC and ASTC)
was read through a second UNORM "raw" view and decoded through Metal's twelve-bit table on every
device; that emulated Metal's bits where the device decodes sRGB itself.

What changed:
- Every read, nearest and filtered sample, pixel fetch, gather and bicubic tap of a sampled sRGB
  texture now reads the device's decode through the slot's sRGB view (a decoded twin's
  R8G8B8A8_SRGB view where the device lacks the compressed format). An input-attachment read of
  an sRGB color attachment reads the device's decode too (the snap-to-byte and table decode in
  lower/fragment/color.rs is gone).
- The note is the existing PrecisionNote::SrgbTexelDecode: specialized on the bound format's
  class (BicubicTexels::SRGB, SpecKey::BoundTexelFormat, announced at the draw or dispatch),
  outright for a heap element, and at link for a float input attachment over an sRGB attachment
  (StageIo::decoded_fetches). On MoltenVK the module requires VkProperty::MetalSampler instead.
- The capability fallback stays: a format the device cannot sample, held as its UNORM twin
  (R8Unorm_sRGB and RG8Unorm_sRGB on lavapipe, RG8Unorm_sRGB on ANV and NVIDIA among the committed
  profiles), joins the SrgbTexture variant (srgb_twin_on) and decodes the twin's codes through
  Metal's table through the slot's own binding: exact for one texel's codes, the device's filter
  of the codes otherwise (noted). The storage alias, tile, word-attachment and pack/unpack table
  uses are untouched.
- Deleted: the raw view and its plumbing (ResourceKind::RawTexture, BindingSource::RawTexture,
  CombinedSampler::raw/with_raw/sampler_binding_use, TextureDecls::raw, SlotPlan::raw,
  BindingKey::raw), texel_format::srgb_raw_view and srgb_raw_on, RuntimeFact::SrgbDeviceDecode,
  VariantKey/LoweringInputs::srgb_twins (merged into srgb_textures), LoweringInputs::srgb_fetches
  and the input attachment's snap, the runtime image plan's extra UNORM view of sampled sRGB
  images, and the ASTC-native bicubic refusal. srgb_raw is renamed srgb_coded.
- Versions: SEMANTICS_VERSION 1891, RUNTIME_VERSION 1672 (the image plan lists no raw view; a
  notice text changed), ARTIFACT_FORMAT_VERSION 469 (CombinedSampler::raw removed, StageIo field
  renamed). The runtime-sources pin is left for the landing.
- Docs: FAST-PATHS rows (sampling, texel conversion with the measured bound, ASTC twin), the
  stale "runtime sampler's nearest sRGB sample" known gap removed, SrgbTexelDecode moved to the
  device-gap class in tests::fast_paths; PrecisionNote docs, DriverDeviation::MetalSampler,
  docs/API.md's catalogue, decode module docs, runtime notice texts.
- Lanes: a new runtime_lane::srgb_decode reads every code of RGBA8Unorm_sRGB; the ASTC, ETC,
  PVRTC, BC, cross-class and fetch lanes hold an sRGB color channel to the device's decode of its
  own code (srgb_decode_holds: bit for bit through Metal's own texture unit) and assert where the
  note is announced. The BC lane keeps development's no-twin structure: an sRGB color channel off
  a measured driver holds as the device's sRGB decode of a code within compressed-texel-decode's
  bound; the ASTC CPU-write lane's check takes the device's exactness.
- known-gaps.tsv: 21 new llvmpipe rows (ETC2, EAC, ASTC sRGB reads, the read-write tier's sRGB
  round trip), the 12 BC1 to BC3 sRGB rows' answers and words (the device's BC decode, then its
  sRGB decode: both notes), the 8 sRGB fetch rows' answers updated; CONFORMANCE-COVERAGE.md
  regenerated.

Measured: llvmpipe (LLVM 21.1.8, arm64) decodes every color code within 5.25 table steps
(0.00128) of Metal's value; MoltenVK on the M3 Max equals Metal at all 1024 lanes, read and
sampled, and in the cross-class gathers (0 of 240 words differ through each class).

Words (lavapipe, one-access kernels, a slot bound in RGBA8Unorm_sRGB): read half 2941 -> 1131,
read float 2513 -> 836, fetch half 3062 -> 1264, nearest float 2580 -> 915, gather alpha half
2934 -> 1191, gather red float 2571 -> 896; linear and runtime samples unchanged (1210, 1163);
a bicubic sample grows, 10524 -> 13254 half and 10318 -> 13048 float (the emulated sum of the
device's decoded taps). The twin variant loses its raw binding (read half 2941 -> 2929).

Verified, on this tree (rebased onto 7b5cf8328d): cargo fmt; clippy --workspace --all-targets
--all-features -D warnings, plain and under --cfg m2v_gpu; rustdoc -D warnings; scripts/api-docs;
api_signatures re-blessed (the 9 removals listed above); REFUSALS.md unchanged; 700 of 701 focused
metal2vulkan tests (lower::texture/sampler/fragment/select, pipeline, metal, spirv::requirements,
the texture/sampler/fragment/srgb engine tests, fast_paths, surfaces) pass, the golden table
failing as it does on 7b5cf8328d itself (1608 cells changed under unchanged keys): blessed on both
trees, this change moves 0 cells; the conformance suite's 1007 tests pass. On lavapipe
(scripts/linux-gate, arm64): 168 touched runtime-lane tests pass; the runtime crate passes 1368 of
1369, the one failure deferred_calls::a_commit_after_an_end_in_flight_returns_and_keeps_its_order
(status Scheduled where Committed is expected, no texture involved) failing again in 1 of 5
reruns, a timing flake; `conformance replay --cpu` exits 0 with no unlisted or stale row. MoltenVK
lanes were not rerun after the rebase.

* 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:22 +02:00
Anees Iqbal 3f3c972b8a Decode a pulled Int1010102Normalized 10-bit field as Metal's product
One work packet, landed as 2 commits (23c75d6d34..7b5cf8328d on archive/development-linear-2026-10-28), in order:

* Decode a pulled Int1010102Normalized 10-bit field as Metal's product

Metal's vertex fetch reads an Int1010102Normalized 10-bit field as its clamped
magnitude times float(1/511) in float, one rounding, not the correctly rounded
quotient c / 511: an ulp toward zero at 96 of the 1,024 codes (measured at every
code on the Apple M3 Max, macOS 27.0.1, by runtime_lane::normalized_vertex_fetch).
The shader's pulled decode (lower::stage_io::fetch::normalized) divided exactly, so
Metal's constant step on MoltenVK, a device without buffer robustness, the indexed
capture form and a kernel's stage input read those codes an ulp off, unannounced.
It now multiplies (an OpConvertUToF and an OpFMul in place of the exact division's
integer sequence); every other normalized field keeps the quotient. The FAST-PATHS
known gap goes. The device-vertex-conversion entries in docs/API.md and the
runtime's degradation.rs now state the 1/511 rule, the MoltenVK exemption and
lavapipe's unclamped per-instance signed minimum, as the note's doc and the ledger
row already do. SEMANTICS_VERSION 1890.

Verified: nextest of lower::stage_io::fetch, fast_paths and the vertex tests, 116
passed; every_ten_and_two_bit_code_decodes_as_metals fails with the multiply
disabled (negative control) and holds the 96-code count.

* 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:22 +02:00
Anees Iqbal 8acf6ae154 Sample a BC texture's own image through the device's decode, keeping no twin
One work packet, landed as 3 commits (d8bb73078f..862d4c13a1 on archive/development-linear-2026-10-28), in order:

* Sample a BC texture's own image through the device's decode, keeping no twin

Under the native-arithmetic rule a device that has a BC format decodes it itself: its decode is
the answer, recorded where it can differ from Metal's. The BC1 to BC5 decoded twin emulated
Metal's 6-bit-weight decode on drivers not measured to make it (lavapipe, NVIDIA, ANV, RADV's
BC4/BC5), at the cost of a second image 4 to 8 times the blocks and a decode after every write.
It goes, and with it every piece only it used:

- the translator's `bind::BlockDecode` and `bind::block_decode_module` (Metal's fitted BC1 to
  BC5 decode, its kernel and its tests); `bind/block_decode.rs` keeps only what the carriers'
  decode modules share (`BlockDecodeModule`, the bindings, `table`, `decode_module`);
- the runtime's `TwinDecode::Block`, `Device::twin_decode`, the twin's announcement
  `decoded-block-twin` (`Degradation::DecodedBlockTwin`, removed), the view-decode notice for a
  view of another decode (`degrade_view_decode`, `degrade_device_decode`), and the
  device-test-only `Scheduler::decodes_pending`, which only the BC twin's CPU decodes needed.

A BC texture (BC1 to BC7, the sRGB forms too) is now its own BC image on every device, and on a
device whose driver lacks the format's fact (`ColorBlockDecodeIsMetals`,
`ChannelBlockDecodeIsMetals`, `Bc6hBlockDecodeIsMetals`, `Bc7BlockDecodeIsMetals`) announces
`compressed-texel-decode`, now also for a sparse texture and a texture over the caller's
`VkImage`, which announced nothing before. The facts still decide the note. The carriers'
twins (ASTC, PVRTC, ETC2/EAC, 4:2:2) and their CPU decode thread are unchanged; a carrier whose
twin's format the device cannot sample is now refused typed instead of read as its carrier (no
conformant device lacks those formats). The sRGB forms' read through Metal's table is unchanged
here (another change replaces it).

Lanes and suite:
- `runtime_lane::compressed_decode` reads the device's decode: exact where the driver has the
  fact (within `device-texel-conversion`'s ulp off Metal's sampler), else within the note's
  stated per-format bound, with the note announced; no write makes a decode pass or CPU decode.
- `cpu-block-decode` keeps a lane site in `astc_textures` (`astc_cpu_writes_decode_on_the_cpu`,
  the CPU decode thread's ordering behind work in flight), and `chroma_pairs` holds its notice
  to the CPU decodes on every device.
- conformance: `compressed-texel-decode` joins `replay::NATIVE_NOTES`; the BC cases declare no
  twin notices; 40 llvmpipe rows in known-gaps.tsv, one per BC1 to BC5 round, each within the
  note's lavapipe bound. The cross-check `every_recorded_texel_is_the_lanes_fitted_rule` still
  holds the M3 Max's recorded texels to the case's own model of Metal's decode.
- new device test `tests::bc_own_image`: every BC format, `Shared` by `replaceRegion`, `Private`
  by a blit and a heap's, has no twin, keeps its blocks, makes no decode, and announces the note
  exactly where the fact is missing.

Docs: API.md's `compressed-texel-decode` entry and cost (lavapipe's BC4/BC5 bound widened to
2.4/255, signed 0.022, as measured below), `decoded-block-twin` removed; a FAST-PATHS.md
device-gap row; REFUSALS.md, api_signatures.tsv, api_surface and CONFORMANCE-COVERAGE.md
regenerated. RUNTIME_VERSION 1669 -> 1710 (renumbered at landing). SEMANTICS_VERSION stays: no
translation changes, so the golden hashes do not move. The runtime-sources pin is not re-pinned
here.

Verified:
- clippy `--workspace --all-targets --all-features -D warnings`, plain and `--cfg m2v_gpu`;
  rustdoc with `-D warnings`; the refusal, signature, Metal and conformance coverage checks.
- macOS, no device: metal2vulkan-runtime + metal2vulkan-conformance 2139 passed; metal2vulkan's
  fast_paths, owned_divisions, bind, api_surface, api_signatures, driver_facts and cache tests
  568 passed; conformance again after the ledger rows, 1007 passed.
- lavapipe (linux-gate arm64, `--cfg m2v_cpu_icd`): 145 tests of the touched families passed
  (bc_own_image, compressed_decode, astc_textures, chroma_pairs, pvrtc/etc textures,
  degrade_notices, texture_blits/fills, cpu_copy_layouts, image_plan, first_moves, the
  degradation tests). Largest differences from Metal: BC1/BC2 2/255, BC3 3/255, BC4 2.28/255
  (signed 0.0172), BC5 2.31/255 (signed 0.0212); BC6H has its fact there, BC7 announces.
  `conformance replay --cpu`: the only unlisted gaps were these 40 BC rounds, no stale row.
- MoltenVK on the M3 Max (maclock, memcap): 43 tests passed, every BC1 to BC5 channel exactly
  Metal's, no `compressed-texel-decode`; the replay of 105 touched cases left all 41 BC cases
  exact (one unrelated divergence, `read-write-tier-held`'s `set-past-layout-support` notice).

* Count the ASTC CPU-write lane's behind-work decodes from before the making

`astc_cpu_writes_decode_on_the_cpu` failed once on lavapipe after the rebase onto cb759a4c4a:
"ASTC4x4LDR Event: 2 CPU decodes, not 1". The cause is the test's window, not a second decode.
`WorkCounts::cpu_block_decodes` counts a write's decode when the device's decode thread finishes
it (`Image::finish_twin_decode`). The case writes the old blocks, commits the reader, and only
then took `before`. In the Busy case `scheduled(&reads)` waits for the reader's batch, which the
scheduler holds until the old blocks' decode finished, so `before` already holds it. In the Event
case nothing waits, so the old blocks' decode could land after `before` and be counted with the
new ones'. Each write queues exactly one job, and the thread takes them in order, so 2 is the old
write plus the new.

Now the case counts from before the texture's making and expects exactly two CPU decodes (its two
writes) where the copies go on the host or the staging queue, and none elsewhere. The count is
read after the later reader completed. That reader's batch waits for the new write's decode, the
thread finished every earlier job by then, and it counts each job before it releases the batches
that wait for it. Every earlier case's decodes landed before its own later reader completed too.
No sleep, and no looser bound.

Verified: clippy of the validation crate under `--cfg m2v_gpu`; on lavapipe (linux-gate arm64,
`--cfg m2v_cpu_icd`), the test 20 times and the families
bc_own_image|cpu_copy_layouts|compressed_decode|degrade_notices|astc|etc_textures|chroma_pairs|
event_round_trips|grouped_submissions|waiter_submits|scheduler. The 20 runs all passed: each of
the 80 behind-work cases (two formats, Busy and Event) counted exactly 2 CPU decodes, 0 cases
wrong; 13 Busy cases were void (the reader ran before the write) and 2 to 4 cases a run held.
The families: 86 tests passed.

* 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:22 +02:00
Anees Iqbal 04f6fb57b8 Read a half by UnpackHalf2x16 and narrow one by the bare quantize without float16
One work packet, landed as 4 commits (91d9e38f75..80ca8d6abd on archive/development-linear-2026-10-28), in order:

* Read a half by UnpackHalf2x16 and narrow one by the bare quantize without float16

On a device with 16-bit storage but no shaderFloat16 (QuantizeForm::Device: Pascal, the
lunarg-2023 baseline, vk12-floor, SwiftShader), the GPU's native arithmetic is the contract
(AGENTS.md rule 1), so neither the read nor the narrowing of a `half` emulates Metal's bits any
more:

- A `half` read from its bits (a load, a reinterpretation, a texel's or snapshot's bits, a
  vertex fetch) is GLSL.std.450 UnpackHalf2x16 of the bits as the low half of a 32-bit word
  (component 0), or of both halves for a pair (`narrow::from_bits`, `from_word_halves`). The
  exact integer decode (`half_bits_to_f32_bits`) is deleted: UnpackHalf2x16 is core and needs no
  capability, so no device lacks a native form. The module records NativeNanEncoding (a NaN's
  bits) and NativeHalfConversion (the widening is neither under DenormPreserve 16 nor measured,
  so a denormal may flush), by the rules 860ad1489f set for the float16 widening;
  `narrow::widens_bits` counts the unpack.
- Every narrowing to `half` through `narrow::round` (fptrunc, every `half` operation, function,
  sum, multiply-add, mix step, division, square root, dot, simd and matrix reductions, stage I/O,
  color and fetch narrowing, texel rounding through `round_texel`) is the bare OpQuantizeToF16,
  recorded NativeHalfQuantize on every such device, measured or not. The denormal arm (quantize,
  compare, RoundEven of x * 2^24, select) and `device_round`, `scaled` and
  `flushes_below_normal` are deleted; `native_rounding(form)` now depends on the form alone, so
  `native_half` holds on every Device-form module. `round_integer` stays exact: it is the
  workaround for NVIDIA 615.71.09 keeping an integer conversion unrounded under the quantize.
- No module requires VkProperty::MetalHalfQuantize any more (compile.rs drops the requirement);
  DriverDeviation::MetalHalfQuantize and the property are kept and documented as measuring only.

Devices with shaderFloat16 are unchanged.

Integer roundings to `half` that never took `narrow::round` are unchanged: the extended-range
blend's `half_of` (every form but the controlled one), the extended-range color encodes, the
sampler's level and the bicubic routines (Metal's directed roundings among them), and the texture
routine's grid families, which round an integer code's ratio.

Docs: PrecisionNote's NativeHalfConversion, NativeHalfQuantize and NativeNanEncoding, the
runtime's declarations of the three, docs/API.md section 9 and docs/HOWTO.md state the new reach;
`fetch.rs`'s `half()` no longer says "exactly". SEMANTICS_VERSION 1886 -> 1887. The runtime
sources change in doc comments only, so RUNTIME_VERSION stays; the runtime-sources pin moves.

Tests (the arith interpreter harness now builds in QuantizeForm::Controlled unless a body sets a
form, so routine references stay Metal's; a half NaN through the device's widening is accepted as
a NaN, the interpreter's widening being canonical):
- `narrow::device_half_rounding_is_the_quantize_alone`, `engine_native_half::
  a_half_below_the_smallest_normal_takes_the_devices_quantize` and `engine_arith::
  a_half_rounding_without_float16_is_the_quantize_alone`: no RoundEven or compare after the
  quantize, NativeHalfQuantize on every Device profile, sums and narrowings below 2^-14 answer
  the signed zero on the interpreter. Negative control (the denormal arm restored in `round`):
  all three fail, and `half_rounding_follows_the_operation`.
- `narrow::a_half_decode_is_the_devices_widening_in_every_form` and `engine_native_half::
  a_half_read_from_memory_is_the_devices_widening_on_every_profile` and the loop decode test: one
  UnpackHalf2x16 per word, no 16-bit type, no integer decode, NaN and conversion notes. Negative
  control (the integer decode restored in `from_bits` and `from_word_halves`): all three fail.
- The texel tests accept the quantize's signed zero for a half denormal in the Device form; the
  16-bit grid comparison runs the Device form under native rounding only (its one production
  setting); the wide tests validate on vk12-floor in its own form.

Verified on this Mac (no GPU): cargo nextest -p metal2vulkan -p metal2vulkan-runtime
-p metal2vulkan-air -p metal2vulkan-devtools --all-features: 5014 run, 5013 passed, the one
failure golden_hashes_match_the_table (hashes moved; not re-blessed here). cargo clippy
--workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; cargo doc
-D warnings for metal2vulkan and metal2vulkan-runtime. Every fixture below translated with
spirv-val (vulkan1.2, vulkan1.4) passing.

Words (instructions), the CLI on the public engine fixtures, before -> after:
  hfb_filter_bank (fragment)  Pascal 198141 -> 147460 (38283 -> 28981)
                              lunarg-2023 176378 -> 124545 (34510 -> 24920), same on
                              swiftshader and vk12-floor
  unm_contract_chain          Pascal 46258 -> 34491 (9333 -> 6952)
                              lunarg-2023 48303 -> 36536 (9699 -> 7318)
                              swiftshader, vk12-floor 48364 -> 36597 (9928 -> 7547)
  fmx2_contract_fast          Pascal 24177 -> 18912; lunarg-2023 25107 -> 19842
  a1_half_denormals           Pascal 4230 -> 3071; lunarg-2023 4353 -> 3194
  hwd_half_reads              Pascal 2647 -> 2194; lunarg-2023 2688 -> 2235
  dsm_half_live_built         Pascal 6782 -> 5988; lunarg-2023 6799 -> 6005
  sum_regroup                 unchanged (Pascal 1047, the others 879)

* Hold the native half lanes to each rounding's bound, and bound the quantize's flush by its input

On SwiftShader (no shaderFloat16, so every half narrowing is the bare OpQuantizeToF16) two
native_maths lanes broke the note they check:

- half_rounding_answers_within_its_recorded_bound held half(a) + half(b) to one ulp of Metal's
  sum, but the note bounds each rounding: SwiftShader's quantize rounds toward zero, so two
  roundings land two ulps off (thread 30: -45.0625 for Metal's -45.125; failing on development
  too), and a flushed denormal operand moves the sum by itself. The sum is now held to the bound
  of the sum of operands each rounded within it (half_within_sum).
- native_maths_answers_within_its_recorded_bounds held a half fma below 2^-14 to one ulp; where
  the stage records NativeHalfQuantize or NativeHalfConversion, the zero of its sign is the
  note's bound.

The quantize tests the value it rounds, not the rounded result: SwiftShader answers -0 for
-6.1005354e-5, which Metal rounds to -2^-14. PrecisionNote::NativeHalfQuantize, the runtime's
declaration, docs/API.md (its section 9 entry and the device-answers paragraph, which still said
the widening was the device's only with shaderFloat16) and docs/HOWTO.md now bound a value below
2^-14, not a result, and the lane tests the input.

Verified: scripts/linux-gate --icd swiftshader, runtime_lane::(driver_deviations|half_|
native_maths|sum_regroup|math_routines): 26 run, 22 passed. The four failures fail identically
on development 60fe70fb12 without this branch (sum_regroup 3863 of 4096 pixels, RG11B10 small
floats 2005 of 71505 fields, the slice NaN lane's 17 stored halves, 86 and 484 float NaN words),
so they are SwiftShader's, not this change's; development there fails six, among them
half_loads_the_device_widens_answer_as_metal, which passes here. The same lanes on lavapipe:
26 of 26. clippy -p metal2vulkan-validation --all-targets --all-features --cfg m2v_gpu
-D warnings; the runtime's degradation catalogue tests.

* Number SEMANTICS_VERSION 1889, after development's 1888

The half read and narrowing change (91d9e38f75) bumped SEMANTICS_VERSION, and each rebase onto
development took development's own bump for it (1887 for the MoltenVK vertex fetch, 1888 for the
blend sweep's one compile), so this change shared a number with another. 1889 keys its modules
apart: Device-form modules read a half by UnpackHalf2x16 and narrow one by the bare
OpQuantizeToF16, with their precision notes.

Verified on the rebased tree: the core suites, clippy plain and --cfg m2v_gpu (see the change).

* 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:22 +02:00
Anees Iqbal bd1861cf3d Keep the samples a resolve after the pass reads on a framebuffer-fetch-by-input device
One work packet, landed as 5 commits (8ec20af606..60fe70fb12 on archive/development-linear-2026-10-28), in order:

* Keep the samples a resolve after the pass reads on a framebuffer-fetch-by-input device

A multisampled color attachment resolved by the crate-owned resolve after the pass
(the sRGB twin, an extended-range format) under `MultisampleResolve` is meant to
render through an image its texture keeps, so the texture keeps the samples it held
before the pass, as Metal's does (`resolve::keep_samples`). The pass asked it whether
a draw took a view of the attachment with the linear rule's `taken`, which on a device
whose framebuffer fetch reads input attachments (`PassLayout::fetch_inputs`:
rasterizationOrderColorAttachmentAccess, lavapipe's) counts every color of every pass.
So on such a device no pass ever kept its samples: the attachment held the resolving
pass's clear and draw (lavapipe: `80808080` where Metal keeps `bf4080ff`; BGRA10_XR
`c09f...` where Metal keeps its earlier clear).

keep_samples now takes `viewed`, the colors a draw actually read (input attachment,
pixel interlock, sample planes, another format's view, the extended-range shadow), as
`kept_bytes::settle` asks it of the attachment it renders apart. The subpass's input
references name the framebuffer's attachments, which take the kept image's view, and a
stand-in takes input attachment usage on such a device (`attachment_stand_in.rs`), so
nothing a draw recorded refers to the attachment's own image. The linear rule keeps
`taken`.

RUNTIME_VERSION 1700 (to be renumbered at landing).

Verified: runtime_lane::resolves::samples_a_twin_resolve_reads_are_kept_as_metal_keeps_them
and ::samples_an_extended_range_resolve_reads_are_kept_as_metal_keeps_them failed on
arm64 lavapipe at 742b94ac06 (diagnostic print: every pass's color counted taken,
`fetch_inputs` true, including a pass with no draw) and pass with this change; both pass
on MoltenVK (M3 Max), where `fetch_inputs` is false and nothing changes.

* Wait on the GPU for the signal a checked head's shared-event wait is held for

Since 0f374bc9ec a shared event's wait is held on the host until its value is reached
and never handed to a VkQueue: `EventTimeline::wait` answers `None` for a settable
event's unreached value even where a submitted GPU signal reaches it. The scheduler
found the indices it may wait for on the GPU through that same answer (`check_heads`'s
`event_waits`, `gpu_waits`'s `WaitFor::Index`), so a checked head waiting for a shared
event recorded nothing to wait for, and the scheduler's thread slept on its condition
variable for the completion turns on every driver but MoltenVK's alike, where its
contract (scheduler/mod.rs, "Waits for a signal to land itself") is to wait in one
vkWaitSemaphores for the signal itself.

`EventTimeline::landing` answers how the host waits for a value: reached, or the index
of the submitted signal that reaches it, whether or not the host may set it; `wait` is
`landing` less a settable event's index. The scheduler's head checks
(`landing_waits`) and its GPU wait take `landing`, so the thread waits on the GPU for a
held wait's signal as for a plain event's; a host set still wakes it through the nudge.
No batch is handed a held index: submissions still go by `wait`.

The runtime behaviour change rides RUNTIME_VERSION 1700 with the resolve change before it.

Verified: runtime_lane::event_round_trips::a_checked_head_waits_for_another_queue_s_signal_on_the_gpu
and ::a_host_signal_wakes_the_scheduler_from_its_wait_on_the_gpu failed on arm64
lavapipe at 742b94ac06 (diagnostic print: the checked head's event wait `None` after the
signalling batch was submitted, then reached; no GPU wait; the second test timed out at
60 s) and pass with this change (WorkCounts::scheduler_gpu_waits above zero, the host
signal waking it; the second in 5 s); both pass on MoltenVK, which keeps its condition
variable (`WaitForAnyObjectLosesASignal`). New device-free test
host_settable_event_waits::a_held_wait_lands_where_a_plain_event_s_wait_chains.

* Ask the layer whether it sees a kernel's write before a sync lane needs one

Four runtime_lane::sync_coverage controls and parity::sequences::lane's hazard control
expected the validation layer's synchronization checks to report a hazard whose earlier
access is a kernel's write of a bound buffer. Since ca74ea24d4 every store through a
descriptor view on a device with variable pointers is an `OpSelect` of the slot's place
and the stage's store sink (`lower::access::sink`), and the layer does not trace a store
through a selected pointer to its descriptor: it takes the kernel's every bound buffer as
read alone. Measured with a dispatch of hand-assembled modules on the runtime's device,
then a copy with no barrier: the store through an access chain is reported
(SYNC-HAZARD-READ-AFTER-WRITE), the same store through the select is not, with Ubuntu
26.04's layer 1.4.341 on arm64 lavapipe and with Homebrew's 1.4.363 on MoltenVK (M3 Max)
alike. So the layer's version is not the cause, and the runtime's recording is not
either: it orders nothing between the two accesses, as Metal leaves them to the program.

As the owner decided for a layer blind to kernel writes: the lanes ask the layer first,
by capability, never by its version. The positive control is
`a_shader_write_then_a_copy_of_one_untracked_buffer`'s run (one dispatch writing an
untracked buffer through the runtime's recording, then a copy, nothing else), done once a
process (`layer_sees_kernel_writes`). Where it finds the layer blind, each test whose
hazard needs a kernel's write prints one `LAYER-BLIND-KERNEL-WRITES <test>: ...` line
naming what it did not check, and requires the layer to have reported nothing of the rest
of its run (`blind_to_kernel_writes`; disjoint_words still checks its bytes). Where the
layer sees the write, every assertion stands as before. docs/VALIDATION.md and the lane's
LaneChecks docs say so.

Verified: the five failed on arm64 lavapipe at 742b94ac06 and pass with this change, each
printing its marker; on MoltenVK (layer 1.4.363) they pass and print the marker as well,
the control there reporting no hazard either.

* Number RUNTIME_VERSION 1670, after development's 1669

The branch's placeholder 1700 left a gap; the resolve and shared-event GPU-wait fixes
take the next number after development's.

* 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
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
Anees Iqbal 3501e41448 Expect the served blit out of a plane whose GPU rows share bytes
One work packet, landed as 8 commits (8f359821ba..742b94ac06 on archive/development-linear-2026-10-28), in order:

* Expect the served blit out of a plane whose GPU rows share bytes

b31e26710b serves copyFromTexture:toBuffer: out of an IOSurface plane whose
GPU rows share bytes (a read settles no row order; Metal's own copy reads each
row at its GPU pitch, probes/overlapping_plane_row_reads.m), and keeps the
copy into such a plane refused. Its commit and docs/REFUSALS.md dropped the
read's OverlappingSurfaceRows site, but the announcement lane
an_iosurface_plane_whose_gpu_rows_share_bytes_is_announced still expected
the read to be refused, so it failed on every device since.

The lane now holds the served read (each buffer row at its own GPU row, the
bytes a_blit_out_of_a_plane_whose_gpu_rows_share_bytes_reads_each_row_at_its_own_pitch
holds over more shapes), that it announces nothing of its own, and that the
copy into the plane stays refused OverlappingSurfaceRows.

Verified: the test passes on MoltenVK 1.4.2 (Apple M3 Max, --cfg m2v_gpu,
under maclock and memcap); clippy -D warnings clean, plain and --cfg m2v_gpu.

* Count the packed 10-bit pair among the heap footprints answered with no image

8016e80f42 moved R10Unorm_PACKED and RG10Unorm_PACKED from Metal's nil to
this crate's own NotImplemented(Format) gap for a placement heap's
new_texture_at_offset (plain Metal's placement heap makes a texture of either),
and their 0 bytes at 16 joined the "no image" arm of
shared_heap_textures_are_made_or_refused_for_linear_tiling. The arm pushes
every format it takes, but the closing count still left the NoTexture shape
out, so the lane counted 128 answers against 120 on every device: a stale
count, not a product regression.

The count now takes every format whose footprint the product's table decides,
the NoTexture pair included.

Verified: the test passes on MoltenVK 1.4.2 (Apple M3 Max, --cfg m2v_gpu,
under maclock and memcap; 128 answered a footprint with no image); clippy
-D warnings clean, plain and --cfg m2v_gpu.

* Hand a refused self-check's driver errors to the sink as one informational line

The device's self-check of a set-0 buffer binding of several variables as a
dynamic descriptor (20b73503c0, takes_multi_variable_dynamic) creates one
pipeline the driver may refuse: that refusal is the answer the runtime asked
for. MoltenVK 1.4.2 refuses it and reports two errors through the debug
messenger inside the creation (the Metal SPIRV-Cross wrote that does not
compile, and the failed pipeline), and those reached the device's message
sink as errors of the program's work. Every validation lane whose kernel has
such a binding then failed its layer claim on MoltenVK:
kept_variants::the_least_recently_released_variants_go_first failed on them
after spse_write_barrier (a-thread-reads-its-own-write-after-a-texture-
barrier-without-sparseness) made the device ask.

Now the self-check holds what the driver reports inside its creation
(device::compiles::holding, nestable, and keeping what a relay thread held for
a holding asking thread). A creation that succeeds hands those messages on as
before; one that fails hands the sink one Info line,
metal2vulkan-self-check-refused, with the driver's result and each message's
id name and text, in place of them. A creation that reported nothing says
nothing. RUNTIME_VERSION 1668 (what a device's sink hears changed); the
runtime sources re-pinned. docs/API.md names the line.

The lane now also prints why it skipped each selected case (KEPT skipped):
it skipped them silently, so a run without llvm-as or with any other mapping
failure read "0 against 64" with no cause.

Verified on MoltenVK 1.4.2 (Apple M3 Max, --cfg m2v_gpu, under maclock and
memcap): before, the lane failed on the two mvk-error messages; after, it
passes, and the new runtime test
tests::dynamic_multi_variable::a_refused_self_check_reaches_the_sink_as_one_informational_line
passes with its DYNMULTI line showing the device answered no and its sink heard
one metal2vulkan-self-check-refused line carrying 2 messages and no error; the
other four dynamic_multi_variable tests pass. clippy -D warnings clean, plain
and --cfg m2v_gpu; rustdoc -D warnings clean for the runtime; the runtime pin
guard passes.

* Hold the ASTC heap lanes to the size query that answers Metal's model

f7d857ec55 made a heap texture the device holds in an ASTC carrier with a
decoded twin answer heapTextureSizeAndAlignWithDescriptor: with Metal's model
of its blocks while its making stays refused NotImplemented(DecodedHeapTexture)
(the twin would decode what the heap's bytes held). Three lanes still expected
the query refused too, and failed on every device without ASTC (lavapipe)
since:

- astc_textures_the_runtime_does_not_hold_are_refused asserted the query's
  refusal, where its own doc already said the device answers the size; it now
  holds the answer to Metal's model (metal_heap_texture_size_and_align) and the
  making's refusal;
- a_host_heap_s_block_compressed_texture_lies_as_metal_lays_it_out took the
  refusal at the query only; it now takes it from the making, the query having
  answered;
- shared_heap_textures_are_made_or_refused_for_linear_tiling panicked on a
  query that answers and a making refused; it now takes that pair for a
  format the device holds decoded (astc_textures::decodes_astc), holds the
  answer to Metal's model, and prints a HEAPTEX shared decoded line for each.

Verified on lavapipe (Mesa 26.0.8, the gate container, --cfg m2v_cpu_icd): the
three pass, the lines naming each refused ASTC texture; on MoltenVK 1.4.2
(Apple M3 Max, --cfg m2v_gpu, maclock and memcap), where the device holds ASTC,
the three pass. clippy -D warnings clean under --cfg m2v_gpu.

* Say where a directory's mode bits do not bind the cache refusal lane

an_entry_that_cannot_be_written_is_announced_and_ends_nothing makes the
shader cache's build directory unwritable with mode 0o500 and expects the
entries refused. The Linux gate's container runs as root, which the mode bits
do not bind, so every entry was written and the lane failed there on every
run (writes 2, write_failures 0).

The lane now writes a file of its own into the directory first; where that
goes through it prints CACHE-UNWRITABLE and holds nothing, instead of failing
on an environment where nothing can be refused, and elsewhere it runs as
before.

Verified: on lavapipe in the container it prints CACHE-UNWRITABLE and passes;
on MoltenVK 1.4.2 (Apple M3 Max, not root) it runs the whole check and passes.
clippy -D warnings clean under --cfg m2v_gpu.

* Expect a heap texture's tiled shadow where the device makes one

Two resource_ids lanes expected heap-texture-untiled-layout for a Private
heap's texture on any driver without ColorImagesLieAsMetalHeapTextures. On
lavapipe the runtime makes that texture a shadow of its elements in Metal's
tiles in the heap's bytes (AliasRoute::Tiled, texture/heap.rs): it lies as
Metal lays it out, announces shadowed-texture (and unnamed-shadowed-texture
where a command reaches it through its ID alone) and no untiled layout. So
a_texture_made_in_a_used_heap_after_a_dispatch_is_reached and
a_heap_s_token_drops_at_its_release_whatever_keeps_its_textures_images failed
there (not announced: HeapTextureUntiledLayout).

heap_texture_kinds now takes whether the making moved
WorkCounts::heap_textures_tiled; where it did it expects that shadow (and the
larger-than-Metal kind as before), else the route and layout kinds as before.

Verified on lavapipe (the gate container, --cfg m2v_cpu_icd) and on MoltenVK
1.4.2 (Apple M3 Max, --cfg m2v_gpu, maclock and memcap): both pass. clippy
-D warnings clean under --cfg m2v_gpu.

* Bump RUNTIME_VERSION past the mipmap change's 1668

The refused self-check's sink line (3c840cbc3a) changes the runtime, and the mipmap change took
1668 on development first; both branches set 1668, which merged silently.

* 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
Anees Iqbal a3c550ca33 Read a half from memory by the device's widening, and sum one by its quantize
One work packet, landed as 3 commits (860ad1489f..46ec3ad81f on archive/development-linear-2026-10-28), in order:

* Read a half from memory by the device's widening, and sum one by its quantize

The owner's ruling on native half arithmetic, applied to the reads and sums
that still emulated Metal's bits.

A half read from memory or from its bits is the device's widening wherever
the module holds 16-bit floats (every QuantizeForm but Device, i.e. every
profile with shaderFloat16): the bits read as f16 (an OpBitcast of the word
or words, a 16-bit storage unit read as a half itself) and one OpFConvert,
with no use analysis. The module records NativeNanEncoding (the widening's
NaN bits are the device's; a half stored unchanged keeps its bits through
the noted bits). Its denormals are kept under the 16-bit float controls
(ANV, RADV: DenormPreserve), read as Metal's by the measured
MetalHalfArithmetic on MoltenVK (the module then requires the property), and
elsewhere (NVIDIA, lavapipe) may flush, recorded as NativeHalfConversion.
Without shaderFloat16 the integer decode stays: no 16-bit float type exists
to read the bits as. The use analysis (lower/arith/widening.rs),
ModuleBuilder::set_widens_halves, the loop-free offers it fed and the
UnpackHalf2x16 decode are deleted.

A half sum or difference (and the mix, muladd, fract and sqrt results that
round the same way) takes the device's rounding alone (narrow::device_round):
on a device without shaderFloat16 the bare OpQuantizeToF16, whose result
below the smallest normal half may be a zero, noted NativeHalfQuantize
whether or not the quantize is measured (narrow::flushes_below_normal).
round_exact_below_normal is deleted. An integer's half stays exact
(round_integer), documented as the workaround for NVIDIA 615.71.09 keeping
an integer conversion unrounded under OpQuantizeToF16.

SEMANTICS_VERSION 1883 -> 1884. The runtime-sources pin moves for doc
comments only (device/driver_facts.rs, device/requirements.rs), so
RUNTIME_VERSION stays. The golden hash table moves (2704 cells) and is
re-blessed on development, not here. API signatures and REFUSALS.md are
unchanged.

Words (instructions) of the release command line's output, before -> after:
hfb_filter_bank NVIDIA 5080 159876 -> 147962 (31488 -> 29438), lavapipe
160444 -> 148530, MoltenVK 153283 -> 148284, ANV 164906 -> 159903;
unm_contract_chain NVIDIA 34516 -> 33048 (6985 -> 6769), MoltenVK
35366 -> 33666; fmx2_contract_fast NVIDIA 18983 -> 18272; sum_regroup
pascal 3356 -> 3286, vk12-floor 2506 -> 2436. Every module passes spirv-val.

Verified: the core suites (metal2vulkan, -air, -runtime, -devtools): 5056 of
5057 pass, golden_hashes_match_the_table the one failure (moved hashes, as
above); a touched-test pass of 318 in metal2vulkan and the validation crate,
the runtime pin included; clippy -D warnings with all features, plain and
with --cfg m2v_gpu. New tests fail without the change (checked for the
16-bit unit read by disabling its note). Device lanes on lavapipe follow.

* 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.

* Re-bless the golden table after the half reads' native widening

860ad1489f reads a half by the device's widening on every shaderFloat16 profile and sums one by
the bare quantize elsewhere, so 288 rows' cells moved. bless_engine_inventory,
bless_golden_hashes and bless_engine_goldens at 9ac9892868; public_fixtures_engine, air_input and
golden_hashes: 28 passed.
2026-10-28 17:24:21 +02:00
Anees Iqbal ce0ffcb27a Ledger the llvmpipe mipmap chain's one-code bytes under device-filtered-mipmaps
blit-generated-mipmaps now takes the device's blit chain on llvmpipe and announces
device-filtered-mipmaps (a native note); two bytes of its levels are one code from Metal's. The
note states no bound against Metal's answer, so the row says the open item is that bound.
CONFORMANCE-COVERAGE.md regenerated.

Verified: conformance replay --cpu on lavapipe (linux-gate arm64, LLVM 21.1.8) at 1af72fc0d8 plus
this row: the 723 rows are exactly the open gaps known-gaps.tsv expects (exit 0); before the row,
the one unlisted divergence was this site. coverage.py --check: as derived.

Originally f3ff805eb4 (archive/development-linear-2026-10-28).
2026-10-28 17:24:21 +02:00
Anees Iqbal 5d09f454b4 Make the mipmap compute filter a plain bilinear filter in float
One work packet, landed as 4 commits (87ed7f903a..1af72fc0d8 on archive/development-linear-2026-10-28), in order:

* Make the mipmap compute filter a plain bilinear filter in float

The owner's decision for generate_mipmaps: the device's blit chain is the
answer wherever the device blit-filters the format, and a compute filter
runs only where it cannot (extended-range formats, formats without blits
or linear filtering). That filter is a plain bilinear (trilinear in 3D)
filter at texel centres in float, not a model of Apple's datapath.

bind::mipmap_filter keeps its planning, scratch layout and first-level
fetch, and drops the exact machinery: the measured answer tables, the
reciprocal and tail models, the soft-float arithmetic and MipmapRule.
The kernel decodes each field to float (Metal's 8-bit sRGB and
extended-range sRGB tables, the packed floats and RGB9E5 exactly), sums
the taps a linear sampler takes at the texel centres in tap order with no
contraction, and encodes to nearest even. It needs no 64-bit integers.
cpu.rs is the same filter on the CPU, the kernel's reference.

The runtime still names the removed items; it follows in the next commit.

Verified: cargo nextest run -p metal2vulkan --all-features --lib -E
'test(/mipmap_filter/) | test(/owned_divisions/)', 9 passed: every kernel
validates on every committed profile, and the kernel run in the SPIR-V
interpreter equals the CPU filter byte for byte over 38 formats and 9
shapes (arrays, cube, 3D, strips) and over 39 fetched first levels.

* Make generate_mipmaps the device's filter: its blits, else the compute filter

The owner's decision for generate_mipmaps: the device's blit chain
(vkCmdBlitImage, VK_FILTER_LINEAR) is the answer for every format its blits
filter, and the compute filter only where they cannot. No refusal for
accuracy; refusals stay for what cannot run or what Metal refuses.

mipmap_plan::plan_mipmaps now plans Blits, Picks or Filter. A filtered
format takes the blit chain where the image's format has BLIT_SRC, BLIT_DST
and SAMPLED_IMAGE_FILTER_LINEAR and the image takes transfers; it takes
the compute filter where they lack (an extended-range format, an 8-bit
sRGB texture held as its UNORM twin, a format without blits or linear
filtering) and the filter computes the format in an image of its bytes.
Otherwise the refusal names what the blits lack. The 1D refusal is gone
(Metal makes 1D textures of one level, which are left as they are).

Removed: the per-format first-use check against mipmap_answers.txt
(mipmap.rs keeps only the blit recorder), mipmap_answers.txt, MipmapVerdict
and Device::mipmap_generation, metal_release::MIPMAP_RULE, the texture
facts' check cache, new_runtime_texture (only the check used it), and the
degradation kinds mipmaps-within-spread and mipmap-tie-rounding. One kind
replaces them: device-filtered-mipmaps (precision), announced once per
device on both paths. WorkCounts::mipmaps_filtered counts compute-filter
chains; image_blits_recorded counts the chain's blits.

The filter kernel now decodes normalized, sRGB-step and extended-range
codes by a product with a reciprocal rounded once to f32 instead of a
division, so every operation is one Vulkan has a device round correctly
and the CPU model is the device's answer on a device keeping f32
subnormals.

The validation lane mipmaps_exact becomes mipmap_chains: the blit chain
(work counts, each halving level within a code of the float filter,
announced), every format the filter computes (the device's blits or the
filter, the filter's levels byte for byte the CPU's), an extended-range
texture announced as the filter, the picks, and the in-place fetch.
texture_blits' every-format lane prints each format's way. Docs: API.md's
catalogue, FAST-PATHS.md (a device-gaps row; the BGRA4Unorm gap's text),
the runtime README, REFUSALS.md regenerated, api_signatures blessed,
api_surface's table. RUNTIME_VERSION 1665 -> 1666 (mipmap behaviour
changed) and the runtime-sources pin.

Verified: cargo clippy --workspace --all-targets --all-features -D warnings,
plain and with --cfg m2v_gpu; rustdoc -D warnings for metal2vulkan and the
runtime; the runtime's whole suite plus the translator's surface, fast
paths, refusal and mipmap tests (1180 passed); the runtime-sources guard.
On lavapipe (scripts/linux-gate, arm64, --cfg m2v_cpu_icd), 13 passed:
mipmap_chains (5), texture_blits' every-format lane, read_through_views'
mipmaps, memoryless_uses (4), rgbx_textures' refusals and degrade_notices'
site list. There the blits made 29 of the 38 formats the filter computes
(87 chains), the compute filter made R8Unorm_sRGB, RG8Unorm_sRGB,
RG11B10Float, RGB9E5Float, BGR10A2Unorm and the four XR formats (27 chains),
each the CPU's byte for byte, and device-filtered-mipmaps was announced once.

* Hold the device's filtered mipmaps among the conformance suite's native notes

generate_mipmaps is now the device's filter (its blit chain, else the compute filter) and
announces device-filtered-mipmaps: the device's own filtering, which rule 1 names, so it joins
replay::NATIVE_NOTES beside device-sampling. Values still compare field by field.

Verified on the merged tree (5a1a62bb0e + the mipmap commits): clippy --workspace --all-targets
--all-features clean; nextest -p metal2vulkan-conformance -p metal2vulkan-runtime: 2140 passed.

* 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
Anees Iqbal 041cdad847 Declare the device's native answers at the notices site for every case
One work packet, landed as 7 commits (8c74f645e2..5a1a62bb0e on archive/development-linear-2026-10-28), in order:

* Declare the device's native answers at the notices site for every case

Under the owner's native-arithmetic ruling the device's own answer is the
contract wherever it has a native form, and the note that says so fires in
almost every case that computes, converts or samples: on llvmpipe 270 cases
differed only by announcing such notes (2,123 unlisted gaps in all, against 62
before the exact paths' deletion).

The suite now holds a fixed set of those notes declared for every case
(replay::NATIVE_NOTES), chosen from the PrecisionNote and Degradation docs:
the native maths, half and sampling classes, the device's denormals, NaN bits,
functions and precision bounds, tiny-product rounding, depth conversion and
depth test, texel and colour conversions, sampling level and filters, and the
device's resolve. compare_run holds them beside a case's own allowances under
the same rules (the notices site alone, justified only where the code was
announced), and they never count among a case's named or unfired allowances.
They declare nothing about a value: every value still compares field by field,
and the README says a value the device's answer moves is a known-gaps row where
the note derives no tolerance. Notes of what the device lacks, of an emulation's
own precision, or of a Metal form not measured or not built stay each case's.

Also: Policy::Exact and the replay docs now say what
DevicePolicy::exact_answers() selects (the five runtime switches) and that no
switch touches arithmetic.

Tests: a native note is declared for every case and counted nowhere; it
declares no value and excuses no other notice; every native-* kind is in the
set, each once, each a precision kind. The first two fail with the set emptied
(checked by chaining an empty iterator). The undeclared-notice test moves off
two kinds that are now native. Verified: cargo nextest run -p
metal2vulkan-conformance --all-features (1006 passed); on lavapipe in
linux-gate (arm64) the replay's unlisted gaps fall from 2,123 to 584.

* Drop the shader-color-conversion declarations that can no longer fire

Since color writes were left to the device's own conversion, the runtime
announces shader-color-conversion only for a half-float attachment of a
pipeline under TextureWriteRoundingMode::NearestEven (StageModule's
rounded_colors), whatever the device. No case of the suite sets that rounding
mode, so the 18 case files that declared the notice for normalized
attachments declared something no venue can announce: the lavapipe replay
reported 81 such declarations as never fired. The normalized store is now the
device's colour conversion, a native note the suite declares for every case.

The declarations, the comments that explained them, the one helper only they
used (blend_interactions' converts_in_the_shader) and the tests' allowance
counts go; rotated_targets also drops its per-state choice, since blended and
unblended states both store through the device's conversion.

Verified: cargo nextest run -p metal2vulkan-conformance --all-features (1006
passed) and clippy on the crate clean.

* Declare three cases' own notices; keep unannounced native declarations out of loosening reports

read-write-tier-descriptors now names carried-decoded-twin and decoded-block-twin,
read-write-tier-held names unnamed-texture-unviewable beside the shared-memory
notice, and texture-pairs-usage-crossings' usage row names decoded-texel-precision.
Each fired on llvmpipe (LLVM 21.1.8) at the notices site and nowhere else; they are
not the device's arithmetic, so they stay per case.

The walk tried every covering allowance and, where none held, reported the first
unjustified one as "the case loosens this site". With the native-note declarations
covering case/notices/* for every case, a case that named nothing read as loosening
its notices site with native-transcendentals. Only the case's own allowances can be
such a loosening now; a native declaration the run did not announce is as if absent.

Verified: cargo nextest run -p metal2vulkan-conformance --all-features, 1007 passed;
the new test an_unannounced_native_note_is_no_unjustified_loosening fails with the
guard removed. The arm64 lavapipe replay (linux-gate) before the guard and after the
declarations shows no notice-site row left: 576 unlisted, 573 divergent values and 3
refusals, all in value sites.

* Hold the device's vertex conversion among the suite's native notes

device-vertex-conversion, which landed on development, is the device's
fixed-function conversion of a normalized vertex attribute's codes: a conversion
the device answers natively, as the texel and colour conversions are. The suite
now declares it at the notices site for every case with the rest of the set.

Verified: the native-note tests of the conformance crate pass (the set test holds
every member a precision kind, once).

* Bring the llvmpipe known-gaps rows to the device's native answers

With the native notes declared for every case, the arm64 lavapipe replay left
576 unlisted sites (573 divergent values, 3 refusals) and 14 rows that looked
fixed. Each is now a row that says what differs, which note records the
device's answer, whether that note's recorded bound covers the site, and what
is open; the header gains a paragraph on such rows, the one kind that is not a
bug of ours in itself under the owner's rule 1.

- 13 rows take their new answers: half-texel-nans r16f/rg16f/rgba16f at three
  sites each (472/940/1874 elements, bound 511), the RGB9E5 rows of
  vertex-format-float4 and -half4 (32, 65407), and blend-interaction-format-srgb8
  one-one-add (55) and one-one-reverse-subtract (90).
- sampler-mip-linear's clamp-float-max row is dropped: the site is exact now.
- 19 rows scoped to the CI venue (LLVM 23.1.1) whose answer the arm64 venue
  matches exactly are widened to every llvmpipe; blend srgb8 one-one-subtract,
  which differs (78 on CI, 81 here), gets a row scoped to the arm64 venue.
- 543 new rows, venue llvmpipe, in families: texel and storage NaN encodings,
  half and vertex conversions, 8-bit one-ulp texel conversions, colour
  conversions at ties, the device's linear filter, 3D and border addressing
  (open: unmeasured against the note), digests (open: an element read), and
  read-write-tier-held's three refusals of a held read-write texture
  (open: runtime and translator work).
- Rows asking for an exact fix the ruling rules out are reworded: the fast-math
  blend families (half-output-blends, argb8-targets, blend srgb8,
  blend-sweep-operations), half-texel-nans, and the nine 8-bit normalized vertex
  rows, which device-vertex-conversion now records within its stated bound.
  The RGB9E5 rows keep their fix: a missing component's default and a vertex
  format the device need not offer are capability, not arithmetic.

Verified: scripts/linux-gate --platform arm64 replay --cpu on lavapipe
(llvmpipe LLVM 21.1.8, 128 bits) exits 0: 0 unlisted, 0 looking fixed; verdicts
announced 419, divergent 130, exact 522, lacks-feature 36, never-returned 4,
refused 11. The ledger tests of the conformance crate pass. The CI venue's
(amd64, LLVM 23.1.1) answers for the new llvmpipe rows are not verified here.

* Regenerate CONFORMANCE-COVERAGE.md for the llvmpipe ledger rows

The coverage document lists the known-gaps ledger's rows, which the previous
commit brought to the device's native answers (298 ledger rows before, 841 now).

Verified: python3 -I scripts/conformance-coverage/coverage.py --check passes, and
so does the conformance crate's conformance_coverage test.

* Say that sampler-border-colours' rows sample a 3D texture

The case samples an RGBA 3D texture (sampler_filtering.rs, Family::Border), and
device-sampling's probe measured 2D textures only; the six rows now say so.

Text only, the waiting-on field, which the replay does not match. Verified: the
ledger and coverage tests of the conformance crate pass, and coverage.py --check
reads the regenerated document as derived.
2026-10-28 17:24:21 +02:00
Anees Iqbal c5978ed3d6 Delete LinearTilingFeaturesUninitialized: MoltenVK 1.4.2 reports linear tiling consistently
One work packet, landed as 3 commits (5522085593..cc22d95bf9 on archive/development-linear-2026-10-28), in order:

* Delete LinearTilingFeaturesUninitialized: MoltenVK 1.4.2 reports linear tiling consistently

MoltenVK 1.4.1 built its format table before it set renderLinearTextures,
so a format's linear-tiling attachment and blit-destination features
differed between instances of one process (2 of 40 on the M3 Max). The
driver fact made every description leave those features out, so on
MoltenVK a texture over a buffer that renders or that blits write was a
shadow. Homebrew's MoltenVK 1.4.2, the only release we track, reads
gpuCaps.supportsRenderLinearTextures in setFormatProperties: 500 of 500
instances made one after another in one process, with the freed heap
poisoned between them, reported 0x8000dd83 for R8G8B8A8_UNORM,
B8G8R8A8_UNORM, R16G16B16A16_SFLOAT and R32_SFLOAT on the M3 Max
(driver 0x28a2). The owner's decision: delete the fact.

Deleted: the variant and its MEASURED row and docs,
DriverFact::unreliable_linear_tiling, DeviceDescription::
unreliable_linear_tiling, the stripping in DeviceDescription::query,
the capture supplement's stripping and the venue test's MoltenVK
branch, the core test of the stripped features, the regeneration
script's UNRELIABLE_LINEAR_FEATURES and its unit test, and the
FAST-PATHS bullet on MoltenVK buffer textures keeping a shadow.

Recaptured moltenvk-m3 on the M3 Max (macOS 27.0.1, Homebrew molten-vk
1.4.2, vulkan-tools 1.4.363.0) by the documented flow, each capture
under the Mac GPU lock: vulkaninfo --json and corpus-vulkan
--capture-formats, pinned in the script's SOURCES. The profile's format
diff is the linear tiling alone: COLOR_ATTACHMENT and BLIT_DST added on
56 formats, COLOR_ATTACHMENT_BLEND on 34 of them, in VkFormatProperties
and VkFormatProperties3; no linear depth/stencil attachment; the
sample counts unchanged. Also moved since the 1.4.1 capture: the driver
(10401 -> 10402, "1.4.2"), API 1.4.334 -> 1.4.357, VK_KHR_shader_quad_
control and shaderQuadControl gone (1.4.2 stops advertising them, as
driver_facts.rs records), and shaderRoundingModeRTEFloat64 and
shaderSignedZeroInfNanPreserveFloat64 now false (the device has no
shaderFloat64). The venue's declared identity follows (c3-venues.json,
the profiles README), so MoltenVK venue rows of 1.4.1 read stale until
re-recorded.

The tests that removed the quad-control feature from the 1.4.1 profile
to stand for 1.4.2 now read the capture as it is: simd_after_discard and
fragment_group_operations_run_full_quads take a profile whose driver
runs Metal's helpers (MetalFullQuads) as one that compiles without the
mode. opened_chains.txt is re-blessed for moltenvk-m3's four contexts
(one member and one extension fewer each).

RUNTIME_VERSION 1665 -> 1666: on MoltenVK a texture over an ordinary
buffer that renders or that blits write is now its own linear image,
not a shadow, which changes announcements and submissions. The runtime
sources pin moves with driver_facts.rs and query.rs. The translator reads
no linear tiling, so SEMANTICS_VERSION stays; moltenvk-m3's keys move
with its fingerprint. golden_hashes.tsv is stale for 2757 moltenvk-m3
cells (fingerprint bea6f0f2c6d5374f -> e69acb7b2f990adb), to re-bless on
development.

Verified: clippy --workspace --all-targets --all-features -D warnings,
plain and --cfg m2v_gpu; rustdoc of metal2vulkan and validation;
check_device_profiles.py (0 findings) and the script's 40 unit tests;
the core, air, runtime and devtools suites (5057 tests: fails only the
four quad tests fixed here, then passing, and golden_hashes); the
validation suite (1362, fails only opened_chains, re-blessed and
passing). On MoltenVK 1.4.2 under the GPU lock and memcap, --cfg
m2v_gpu, debug: 158 validation device tests (buffer_texture_renders,
_blits, _order, buffer_textures, linear_attachments, host_memory,
tile_shadows, kept_buffer_bytes, view_attachments, no_copy_textures,
surface_aliases, in_place_textures, degrade_notices, detach_textures and
the_formats_capture_is_the_product_queried_formats_of_the_venue_device),
157 passed; 135 more texture lanes, 133 passed; 90 runtime device
tests, all passed. The three failures fail identically at a527df636f.
Against a527df636f on the same device, linear_attachments printed
"over a Shared buffer ... aliased false" and 10 shadowed-texture notices
"the linear tiling of VK_FORMAT_B8G8R8A8_UNORM lacks COLOR_ATTACHMENT |
COLOR_ATTACHMENT_BLEND"; now "aliased true" and no notice of a missing
linear feature in any of the 383 tests.

* 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.

* Re-bless the golden table after moltenvk-m3's recapture from MoltenVK 1.4.2

The profile's linear tiling now holds MoltenVK 1.4.2's attachment and blit features, and the
capture's version and extension moves (quad control gone), so its fingerprint and cells moved.
bless_engine_inventory, bless_golden_hashes and bless_engine_goldens at 69e9622aff;
public_fixtures_engine, air_input and golden_hashes: 28 passed.
2026-10-28 17:24:21 +02:00
Anees Iqbal 96b6f3d12b Note the device's fixed-function vertex conversions where the pipeline links
One work packet, landed as 4 commits (0e348c4f85..2fc5327329 on archive/development-linear-2026-10-28), in order:

* Note the device's fixed-function vertex conversions where the pipeline links

A normalized vertex attribute has been the device's fixed-function UNORM or
SNORM conversion since the exact division went (9c0bdbe0d2), but nothing
recorded it: llvmpipe reads 127/255 one f32 ulp high (0x3EFEFF00 against
Metal's 0x3EFEFEFF) and the run announced nothing, against rule 2. And the
narrow-float NaN note rode in the vertex compile key
(VertexFetch::FixedFunction { narrow_float }), so one function used with a
half format and any other format translated twice for one module.

The design: the module of a fixed-function attribute names no part of its
format, so neither note belongs to the module. Link knows the vertex
descriptor and which attributes the stage reads as float, so
link::vertex::fixed_function_notes decides both there, from the stage's
fixed-function attributes and the descriptor's formats, and the compile API
adds them to the vertex StageModule's precision_notes (as color_writes'
pipeline notes are added). The runtime announces stage notes already, so
it needs only the new kind. A StageSource::Compiled stage gets the same
notes, since link recomputes them.

- PrecisionNote::DeviceVertexConversion (device-vertex-conversion): a
  normalized format fixed-function input fetches, whatever width the
  function reads it at. Recorded on every device; MoltenVK measured
  Metal's, but no measured property says so yet.
- PrecisionNote::DeviceNanEncoding for a narrow float read as float now
  comes from link too; lowering records nothing for a fixed-function
  attribute.
- VertexFetch::FixedFunction is a unit variant; IoRole::Attribute loses
  narrow_float; narrow_float_of_f32_reads goes; declared_attributes keeps
  only the numeric class. Encoding::is_normalized names the formats.
- Runtime Degradation::DeviceVertexConversion, the codec tag, docs/API.md's
  catalogue entry, a FAST-PATHS device-gap row (no switch), validation's
  comparison class (unbounded, as DeviceTexelConversion).
- Versions: SEMANTICS_VERSION 1884 (notes and vertex keys move),
  ARTIFACT_FORMAT_VERSION 467 (VertexFetch, IoRole, the new tag),
  RUNTIME_VERSION 1666 (a new announced kind); runtime-sources.sha256
  re-pinned for degradation.rs. api_signatures re-blessed.

Tests: engine_vertex_variants' new
a_pipeline_notes_what_the_device_converts_from_one_translation compiles
the float4 and half4 sweeps as render pipelines on moltenvk-m3, lavapipe
and amd-780m-radv: each normalized format's vertex stage notes the
conversion, each narrow float read as float the NaN, others neither, and
every fixed-function creation of an entry has one vertex compile key and
one module (two keys before). The float4 sweep is now 1 projection and 1
module (was 2 and 1); the constant-step counts follow.

Verified: cargo clippy --workspace --all-targets --all-features -D
warnings, plain and with --cfg m2v_gpu; RUSTDOCFLAGS='-D warnings' cargo
doc -p metal2vulkan -p metal2vulkan-runtime; nextest of the touched
metal2vulkan modules (343 passed), api_surface, api_signatures,
refusal_surface, golden_hashes and the public fixture tables (pass, no
hash moved); runtime degradation tests (17), validation
observation_contract, c3 and the runtime-sources guard. No device test.

* Hold a render state's vertex conversion notices and its one translation on a device

A device test (m2v_gpu, m2v_cpu_icd) of the runtime side of the link-time
vertex notes: four states of dsx_int_attributes' int_attribute_to_float4
whose vertex descriptors differ only in attribute 0's format
(UChar4Normalized, Half4, Float4, Short2Normalized). The three after the
first must translate nothing (WorkCounts::functions_translated, the
function shared once each), and each draw of one point over a record of
0x7f bytes must announce exactly its format's kinds: device-vertex-conversion
for the normalized formats, device-nan-encoding for Half4 (whose 0x7F7F is a
NaN read as float), neither for Float4. The stored words are printed, so a
run shows the device's own conversion of 127/255 and of the NaN.

Verified: clippy -p metal2vulkan-runtime --all-targets --all-features -D
warnings under --cfg m2v_gpu; the runtime-sources guard still passes (test
modules are not runtime inputs). Not run here: it needs a device.

* Say that a pipeline's stage adds its state's notes to its function's

CompiledFunction::precision_notes said its notes were the linked stage's,
which a fragment stage's attachment-write notes already broke and the
vertex stage's link-time conversion notes break too. The doc and
docs/API.md's compile-API paragraph now say the stage adds those of the
pipeline's own state. Docs only.

* Drop a known-gaps clause that points at a ledger row no longer there

The conformance-replay paragraph said its runs were at a tip before "the narrow-float widening
above" was canonicalized; that row is gone and the clause was history. Docs only.
2026-10-28 17:24:21 +02:00
Anees Iqbal d72fd04a73 Drop half_texels' arm parameter, which every caller passes as none
One work packet, landed as 3 commits (8cc765ebea..22aadfdd31 on archive/development-linear-2026-10-28), in order:

* Drop half_texels' arm parameter, which every caller passes as none

The clauses an access's note took from the sampler arm that converts the device's texel went
with the device-sampling deletion; both callers (`lower::sampler::select` and the texture read)
pass `None`, so the parameter and its intersection go.

Verified: clippy (workspace, all targets, all features) clean; 78 texture, half-texel, sampler
and fast_paths tests pass.

* Say in the ledger that a precise division is the device's on every device

The maths-library row said divisions are the device's on every device but MoltenVK. A precise
division (an `fdiv` without `arcp`, or on `half`) is the device's `OpFDiv` on every device,
MoltenVK included (`float_binop_notes` records `NativeDivision` everywhere for it, as the note's
doc states); only the fast division is Metal's own in a MoltenVK fast-math entry.

Verified: tests::fast_paths passes.

* Re-bless the golden table after the half-bits write paths' removal

Blessed on development at f4dd7f6bb6: the half-float slots and heap writes that took the
unsigned-integer alias or the half-bits twin now write through the format's own view, which moves
34 rows. The inventory and the fixture expectations re-derive unchanged; the bless named no cell
changed under an unchanged key.

Verified: bless_engine_inventory, bless_golden_hashes and bless_engine_goldens each passed
(exit 0).
2026-10-28 17:24:21 +02:00
Anees Iqbal 7e86900912 Leave half-float texel writes to the device: drop the half-bits paths
One work packet, landed as 4 commits (a6e81074ae..77a585c009 on archive/development-linear-2026-10-28), in order:

* Leave half-float texel writes to the device: drop the half-bits paths

Under the native-arithmetic ruling the device's own write is the
answer for a half-float texture's stored NaN, recorded as
DeviceNanEncoding (or MetalHalfTexelWrites / MetalHalfStorageNans
where measured). Two paths existed only to store Metal's half NaN bits:

- the half-texel write route through the texture's unsigned integer
  alias (StorageImageClass::HalfBits), which a slot that writes a
  half-float texture took on a device without MetalHalfTexelWrites,
  with its alias view (metal::format::half_bits_view), its read and
  write conversions, its imageblock-slice bits leaf, the read note it
  recorded, and the own-format-views fact a wrapped image without
  MUTABLE_FORMAT needed to opt out of it (TextureFacts::own_format_views,
  TextureShape's field, storage_choice_viewed);
- the heap twin: StorageFormatClass::HalfBits and its neutral and heap
  class, the twin's element view, the own-view heap class indices
  (heap_own_view_index, HALF_BITS_FORMATS, heap_half_bits_indices),
  the twin write and its class test, RuntimeFact::HeapHalfTexelWrites,
  bind::heap_write_nans_converted, metal::format::half_write_nans_converted,
  and the runtime's NanResidue and its draw-time announcement.

What a device needs to write such a texture at all is unchanged: a
half-float slot is the format's own Identity choice on every profile.
The heap write path now records its notes statically: a float write's
rounding and NaN as MetalHalfStorageWrites/MetalHalfStorageNans or
DeviceColorConversion/DeviceNanEncoding, a half write's NaN as
DeviceNanEncoding.

Tests follow the behaviour: the format test asserts Identity for every
use, the heap texel write test asserts one storage class and the note,
the half-slice test asserts the device's widened halves, the half moves
and half texel write tests drop the alias case (the latter now checks a
declared RGBA16Float on every profile), and the twin-only tests go.
Docs the deletion made false are fixed; REFUSALS.md and
api_signatures.tsv are regenerated.

SEMANTICS_VERSION 1883, ARTIFACT_FORMAT_VERSION 466, RUNTIME_VERSION 1665.

Verified so far: cargo check --workspace --all-targets --all-features
is clean; conformance-coverage --check and refusal_surface pass.

* Drop the half-bits exact form from the llvmpipe half-texel rows

The llvmpipe half-texel-nans rows named the read side of the
StorageImageClass::HalfBits aliasing as the exact form behind a policy
switch; that aliasing is gone under the native-arithmetic ruling, so
the sentence describing it is false. The rows' verdicts and the
device-nan-encoding sentence stay.

Verified: scripts/conformance-coverage/coverage.py --check passes.

* Fix the two tests the half-bits deletion left stale

device::tests::mechanism numbers every RuntimeFact densely; with
HeapHalfTexelWrites gone the last tag moves into its place.

merged_argument_buffer_textures_share_one_heap_class bounded the module
at 1,600 words (2,300 with word ids) plus the twin's write words where
the profile took the twin. Without the twin the bound shows what that
allowance covered: on a device that holds an A8Unorm texture's alpha in
red (metal::format::alpha_in_red), the heap write's class-index read
and conversion, 87 words on RADV RDNA2/RDNA3, ANV ARL/Iris Xe,
lavapipe and NVIDIA, 1,591 words elsewhere. The bound now names that
allowance.

Verified: both tests pass under cargo nextest; clippy -p metal2vulkan
--all-targets --all-features -D warnings is clean.

* 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
Anees Iqbal adef203530 Describe each driver deviation's route as the code takes it now
One work packet, landed as 10 commits (262093ec48..8e4bfa28b4 on archive/development-linear-2026-10-28), in order:

* Describe each driver deviation's route as the code takes it now

The DriverDeviation, VkProperty and driver-table docs still named the
exact emulations the native-arithmetic change sets deleted (Metal's
libm, division, denormal flushing, NaN selection, min/max picks, the
emulated sampler, the color, storage and Depth16 write roundings, the
depth stand-in). Each variant's doc now says what a profile that takes
it gets and what one without it gets: the device's own answer with the
precision note recorded, or, where a capability hangs on the answer, its
emulation or refusal.

- error/mod.rs: DriverDeviation's header and the float-function, NaN,
  sampler, color-write, FMA, denormal, quantize, min/max, half
  arithmetic, storage-write, texel-write and Depth16 variants.
- device/requirements.rs: the matching VkProperty docs; MetalColorWrites
  says no module requires it (compile.rs never adds it), and
  MetalHalfQuantize drops the clamp claim the code does not make.
- device/driver_facts.rs: the table preambles and measurement paragraphs
  (docs and citations only, no row or variant changed); the deleted
  resolve_rounding::color_resolves_against_metals_rules citation now
  names the_device_resolve_rounds_as_announced, which holds the row.
- runtime_lane/heap_textures.rs: heap_depth_textures_keep_their_bytes,
  renamed from ..._with_their_twins (no twin exists), with the two
  driver_facts.rs citations updated.
- lower/texture/mod.rs and pipeline/compile.rs: the storage_properties
  doc and comment list the four properties select_write relies on,
  dropping the 0x7fc00000 store.

Verified by reading each route in lower/ (narrow, fma, denormal, nan,
arith, sampler, stage_io/color_write, texture) and pipeline/compile.rs,
and by git grep for every cited test and item.

* Describe the pixel samplers, routines and color-write inputs as they run now

Translator docs that still described the deleted emulated sampler, the
cube face fold routine, the compiler-word-bound fit and the shader's own
color-write rounding:

- pipeline/artifact.rs: PixelSamplerScaling no longer names a linear
  sample's emulation or a MetalSampler condition; a runtime word's linear
  pixel sample snaps onto its footprint cell on every device
  (position::plan plans SnapKind::WordCell with no device test), a word of
  mixed filters is the device's. ArgumentPixelSamplerScaling says it is
  recorded on every device for any access but a 2D gather and a sample
  without a comparison, as select.rs pixel_note does.
- lower/sampler/select.rs (pixel_note) and lower/sampler/mod.rs
  (RuntimeSlot::cells, ::texels): the cell snap holds on every device; the
  slot's word filter fields are read for a half texel's conversion alone,
  on a MetalSampler device (half_converts requires !device_texels).
- device/profile.rs: FunctionsInlinedAtEveryCall lists the routines that
  exist (wide-integer divisions, precise fmod, texel conversions, filter
  sums, sampling routines; no face fold); takes_driver_deviation names the
  route a deviation's docs give for a driver without it.
- error/mod.rs: RuntimeInput::ColorWrites says what the color-write map
  decides (the conversion that records a note, and NearestEven's half
  rounding), not a rounding of every output.
- bind/color_resolve.rs and its tests: drop the citation of
  resolve_rounding's cost test, which is deleted.
- device/mechanism.rs: drop the trailing comment on the deleted
  ExactFormsOverCompilerLimit fact.

Verified by reading position::plan, select.rs pixel_note and the
half_converts branch, spirv/builder/module.rs's routine kinds and every
mb.routine site, pipeline/color_writes.rs, and git grep for each cited
item.

* Describe texel conversion, YCbCr filtering and depth comparison as the device's

Translator docs still named the deleted linear-filter emulation, the
shader's own depth comparison and the depth twin:

- lower/texture/half.rs: off MetalSampler devices the device's sampler
  filters and the half is its float texel rounded to nearest even
  (device_texels), not this routine's; the only fetch-computed filter that
  skips the routine is the in-place YCbCr one.
- lower/texture/mod.rs (half_texels): drop the example of a runtime
  sampler's sRGB raw-code emulation for the `arm` clauses.
- metal/format/mod.rs: a two-plane YCbCr texture's linear sample is the
  device's filter, noted, but where its planes are read in place.
- pipeline/artifact.rs (RestrictedDepthRange) and lower/texture/slot.rs
  (depth_comparison): every comparison is the device's; no shader-made
  comparison is left to exclude.
- lower/sampler/select.rs: a depth comparison reads the texture's own
  depth image (no twin).
- lower/sampler/mod.rs (Sampling::words): list the terms plain_words
  sums; no linear emulation, level grid or shader comparison term exists.

Verified by reading device_texels, half_texels and both its callers,
linear.rs filter_note and metal_filtered_ycbcr, depth_comparison's one
caller, in_place.rs, and plain_words.

* Describe the runtime's YCbCr filter notice and variant kinds as they fire now

- degradation.rs: YCbCrFilterNotExact fires on a device that samples
  through Metal's own sampler alone (linear.rs metal_filtered_ycbcr is
  None elsewhere), where the stage records HalfSampleFilter or
  FloatSampleFilter for any two-plane YCbCr format bound; a native sampler
  announces device-sampling. The module doc drops the exact forms dropped
  to fit a compiler word bound, whose kind and fit are deleted.
- ycbcr.rs: linear filtering of the converted texels is the device
  sampler's (Metal's own on MoltenVK, announced ycbcr-filter-not-exact);
  only planes read in place are Metal's filter exactly.

Verified by reading lower/sampler/linear.rs, in_place.rs and the runtime's
Kinds::of and degrade_bound_formats.

* Describe the lanes' and cases' native forms where they named deleted emulations

Docs and comments only; no expectation changed.

- validation runtime_lane/driver_deviations.rs: the half quantize,
  min/max, half arithmetic and half widening bullets say what the module
  does off the deviation (the device's own conversion or quantize, the
  same NMin/NMax/NClamp noted native-min-max, narrow::from_bits' decode),
  not the deleted integer rounding, operand picks and exact_answers
  decode.
- validation observation_contract/comparison.rs: HalfSampleFilter and
  FloatSampleFilter are a YCbCr texture through Metal's own sampler.
- validation runtime_lane/pixel_samplers.rs, conformance
  cases/pixel_samplers.rs: the pixel coordinates reach Metal's texels
  through the translator's snaps, filtered by the device's sampler.
- conformance cases/snorm_tile_store.rs: no exact tile store and no
  FAST-PATHS row; only extended-range, padded and bfloat attachments take
  a load pass.

Verified by reading the lanes' assertions, select.rs pixel_note,
position::plan and narrow.rs.

* State the native forms in the doc pages where they promised exact switches

- README.md: the promise that every speed-for-accuracy choice has an
  opt-in exact switch was false for the device's maths, rounding,
  conversions and sampler, which have none; it now says those are the
  device's, recorded, and the runtime's choices keep their switches.
- docs/API.md: exact_answers selects the runtime's five switches (as
  policy.rs's exact_answers sets them), not exact forms of the native
  arithmetic; an unmeasured driver takes each deviation's documented
  route, not a conservative one; half widening's NaN and denormal are the
  device's under its own conversion or the float controls; Depth32Float
  texels are the depth image's, announced where it clamps or flushes; the
  catalogue intro names the native forms.
- docs/ARCHITECTURE.md: the native forms are the device's on every device
  with no policy choice; the policy's accuracy switches are the runtime's.
- docs/FAST-PATHS.md (after the opening section): a YCbCr texture's image
  form holds Metal's texels exactly and its linear sample is the device's
  filter; only the in-place form is Metal's filter.

Verified against device/policy.rs, lower/arith/narrow.rs, the depth twin's
deletion (c11e653acd) and lower/sampler/linear.rs.

* Drop the exact golden table from VALIDATION.md's emitter-stability contract

4bf2c22aad deleted golden_hashes_exact.tsv and its table in
golden_hashes.rs; VALIDATION.md still described a second table of every
sampling fixture under exact_answers. The contract now names the one table.

Verified: crates/metal2vulkan/tests/ holds golden_hashes.tsv alone, and
golden_hashes.rs names no exact table.

* Re-pin the runtime sources after the doc audit

The audit's commits edit doc comments and comments only in files the
runtime guard hashes (degradation.rs, ycbcr.rs, and translator files the
build lists); no run's behaviour changes, so RUNTIME_VERSION stays.

Verified: the_runtime_sources_are_the_committed_ones failed with 81ebd500
committed against 8bc0e06b computed, and passes after this pin.

* Drop the 0x7fc00000 hand-off from half_write_nans_converted's doc

a6e97e7f93 deleted the NaN canonicalization before storage writes
(StorageImageClass::SmallFloatQuietNan among it): a half write to a
packed small float hands the device the half widened, as to a 16-bit
float channel. The doc still said such a write hands it 0x7fc00000, and
tied MetalHalfTexelWrites to both kinds, where it states the 16-bit
float store alone (lower/texture/mod.rs half_write_nans).

Verified by reading half_write_nans and the write emission
(lower/texture/emit.rs), which canonicalizes no small-float NaN.

* Re-pin the runtime sources after the half-write NaN doc fix

metal/format/mod.rs is a runtime guard input; the preceding commit edits a
doc comment there alone, so no run's behaviour changes and RUNTIME_VERSION
stays.

Verified: the_runtime_sources_are_the_committed_ones failed with 8bc0e06b
committed against 279b25d4 computed, and passes after this pin.
2026-10-28 17:24:21 +02:00
Anees Iqbal 6fba488835 Drop the exact golden table, a duplicate of the default one
One work packet, landed as 2 commits (4bf2c22aad..9090d9a1b1 on archive/development-linear-2026-10-28), in order:

* Drop the exact golden table, a duplicate of the default one

`DevicePolicy::exact_answers()` now sets only the runtime's switches (heap compression,
completion, batch order, render lowering, host-page textures), none of which a translation reads:
the table's own structural test held its profiles' fingerprints equal to the default table's, so
`golden_hashes_exact.tsv` pinned a subset of `golden_hashes.tsv` cell for cell. The table, its
comparison test, its structural test and the `samples` filter go; the bless writes the one table.

Verified: clippy (workspace, all targets, all features) clean; the golden module's structural
tests, fast_paths and published_crates pass (14 tests).

* State the native-arithmetic rule in AGENTS.md and the ledger

The owner ruled on 2026-10-27: "Just promise the GPU's native arithmetics, no more 'exact'
emulation." Rule 1 now says so: arithmetic and value answers are the device's own native form,
recorded as a precision note where they can differ from Metal's, and no path or switch emulates
Metal's bits where the device has a native form; capability emulation stays; the remaining
speed-for-accuracy switches (outside arithmetic) keep both forms, the fast one the default. The
"Scope is the device's" honesty rule names the native answer as a recorded near-equivalent.
docs/FAST-PATHS.md's opening says the same and what its tables hold.

Verified: tests::fast_paths passes.
2026-10-28 17:24:20 +02:00
Anees Iqbal 4a8edc7bef Ledger the device's sampler, conversion and compact twin as device gaps
The sampling, texel conversion, two-plane YCbCr filter and decoded-twin rows left the first
table with their switches, and their notes went to fast_paths' Elsewhere class: a reader of
docs/FAST-PATHS.md no longer found the device's sampler at all. They come back as device-gap
rows (the device's sampler and conversion are the contract; the device lacks the compressed
format), with the bounds the rows stated, and DeviceSampling, DeviceTexelConversion and
HalfTexelConversion are classed DeviceGap, so tests::fast_paths holds the rows to them. The "All
at once" paragraph's costs measured the deleted exact forms; it now points at each row's.

exact_answers() now sets only the runtime's switches, which no profile carries, so two tests
stated a difference that no longer exists: profiles_that_differ_carry_their_own_fingerprints
contrasts an uncontained policy instead, and the exact golden table's structural test states
that its profiles' fingerprints are the default table's.

Verified: nextest of metal2vulkan's fast_paths, profile_fingerprint_derived and the exact
table's structural test (12 passed).

Originally 7891bcc04c (archive/development-linear-2026-10-28).
2026-10-28 17:24:20 +02:00
Anees Iqbal 3c129f4d6f Delete the half gather's fetch and the compiler-word-bound fit, which have nothing left to drop
With the NaN lane landed beside this one, two exact-only paths lost their last use.

The half gather's fetch (lower::sampler::fetched) read a half-float texel's NaN through
TexelNanRoute, which the NaN lane removed: no selection reaches it. Deleted with the Sampling
field, the RuntimeSlot word fields it set (filters, fetched, fetched_depth), the shared
switch's fetched emulation and its lane constants, the heap fetch in emit, and the helpers only
it used (LinearImage, HEAP_WORDS, footprint_from, texel_format_spec, texel_format_const,
constant_lanes_by folded into constant_lanes).

The compiler-word-bound fit (pipeline::compile::fit) retranslated a pipeline past ANV's
400,000-word bound with its exact forms dropped. No exact form is left to drop, so the fit,
fit_render_variant / fit_mesh_variant / fit_compute_pipeline / fit_tile_pipeline,
DeviceProfile::module_word_bound, RuntimeFact::ExactFormsOverCompilerLimit, the runtime's
Degradation::ExactFormsOverCompilerLimit and its notice, the runtime and validation tests of
it, its FAST-PATHS row and its API.md passages go. DriverWorkaround::RegisterAllocatorOverflowsLargeModules
stays, recorded on the profile alone. fast_paths loses its FastDefault class, now empty.

Verified: cargo clippy --workspace --all-targets --all-features -D warnings, plain and with
--cfg m2v_gpu; RUSTDOCFLAGS='-D warnings' cargo doc --workspace --all-features --no-deps;
refusal_surface.py leaves docs/REFUSALS.md unchanged.

Originally 50fcff8a4e (archive/development-linear-2026-10-28).
2026-10-28 17:24:20 +02:00
Anees Iqbal 78ed264c90 Drop the normalized vertex attribute's exact division (vertex_normalized)
One work packet, landed as 9 commits (9c0bdbe0d2..41066d87d0 on archive/development-linear-2026-10-28), in order:

* Drop the normalized vertex attribute's exact division (vertex_normalized)

The owner's ruling of 2026-10-27: the GPU's native arithmetic is the contract, no exact
emulation. A normalized vertex attribute is now always the device's fixed-function UNORM or
SNORM conversion; the policy-forced pull that divided its codes in the shader goes with
DevicePolicy::vertex_normalized, VertexNormalizedPolicy, its profile field, its ledger row and
its tests. A format pulled for any other reason (a format the device cannot fetch, alignment,
limits, containment, the capture form) still decodes in the shader as before.

Verified: cargo clippy --workspace --all-targets --all-features -D warnings clean; nextest of
engine_vertex_variants, device::tests::profile, fast_paths, catalogue, degradation and
api_surface: 71 passed. api_signatures is re-blessed at the end of the lane.

* Keep the compact decoded twin only (decoded_texels)

The owner's ruling of 2026-10-27: no exact emulation. A carried ASTC LDR texture's decoded
twin now always holds 8-bit codes, and an EAC 11-bit texture's 16-bit normalized codes (its
values in floats only where the device does not take those codes' format, a capability
fallback). DevicePolicy::decoded_texels and DecodedTexelsPolicy go, with their ledger row,
their mentions in the degrade catalogue and the runtime's docs, the policy-keyed fingerprint
test, and the validation lanes' exact twins. decoded-texel-precision is announced as before.
bind::AstcTexels::Float stays: the conformance suite's cross-check decodes Metal's values with
it. RUNTIME_VERSION 1654.

Verified: clippy --workspace --all-targets --all-features -D warnings clean, plain and with
--cfg m2v_gpu; nextest of fast_paths, device profile, degradation and catalogue, image_plan's
decode bands, the conformance ASTC and ETC cases, api_surface: 112 passed.

* Take the device's texel conversion only (texel_conversion)

The owner's ruling of 2026-10-27: no exact emulation. A read, sample or gather with a float
or half result off Apple's GPUs is now always the device's conversion of the texel's codes,
recorded as DeviceTexelConversion or HalfTexelConversion. DevicePolicy::texel_conversion and
TexelConversionPolicy go, with Metal's conversion by the bound format's class:
lower::texture::float_texel (its routine, census entry and tests), the float_texel plan flags of
reads and samples, the slots' float_format and the heap's float class, and the field of
RuntimeFact::ExactFormsOverCompilerLimit that named it (encoded, so ARTIFACT_FORMAT_VERSION
456; SEMANTICS_VERSION 1873). The ledger row goes; DeviceTexelConversion is now documented in
docs/API.md section 9 alone (fast_paths classes it Elsewhere), and the conformance cases cite
the note's bound in place of the row. The half routine on Apple's GPUs is untouched.

Verified: clippy --workspace --all-targets --all-features -D warnings clean, plain and with
--cfg m2v_gpu; nextest of fast_paths, device profile, catalogue, degradation, the fit, mechanism,
codec, the snapshot variant, engine_handles, the extended-range heap tests, the texel-conversion
test (rewritten for the device's form alone), the conformance ETC, BC and border cases and the
runtime's fitted-variant notice: passed (one exact-conversion test deleted).

* Take the device's filter of a two-plane YCbCr texture only (ycbcr_filter)

The owner's ruling: promise the GPU's native arithmetic, no exact emulation.
YCbCrFilterPolicy and its Exact form go: no slot takes a YCbCr variant
(RuntimeFact::YCbCrTexture, VariantKey and LoweringInputs::ycbcr_textures,
ProfileFields::ycbcr_variant, Linear::exact_only and the binder's
ycbcr_variant are gone). A natively sampling device filters such a texture's
texels (device-sampling); on MoltenVK Metal's own sampler filters them,
noted where the bound format is two-plane YCbCr (ycbcr-filter-not-exact).
The planes read in place on a device whose memory is the host's are kept:
that is a capability path, Metal's filter exactly.

The FAST-PATHS row goes; HalfTexelConversion, which only that row named, is
classed Elsewhere (API.md's catalogue states it). The YCbCr tests keep the
default's selection and drop the variant's; the uniform-branch test runs at
the default policy; the validation lane's Exact draw test goes.

Verified: cargo clippy --workspace --all-targets --all-features -D warnings,
plain and with --cfg m2v_gpu, clean. nextest over fast_paths, device::tests,
bind::plan, compile::fit, compile::tests, engine_linear_half, catalogue,
degradation, api_surface, codec, cache: 372 passed, 5 failed. The five are
engine_linear_half tests of the emulated sampler on lavapipe and MoltenVK
under EXACT_SAMPLING (the_emulation_reaches_what_metal_measured,
the_linear_sums_run_one_by_a_branch_and_stay_calls,
swizzled_packed_texels_are_the_unswizzled_swizzled,
a_pipelines_texture_notes_follow_its_bound_format_and_sampler,
a_depth_comparison_through_a_filter_is_a_filtered_float_sample); they go with
the emulated sampler in the next step. api_signatures is re-blessed at the
end of the lane.

* Take the device's sampler only (sampling, unorm8_linear_filter)

The owner's ruling of 2026-10-27: promise the GPU's native arithmetic, no
exact emulation. Metal's sampler emulated by fetches (SamplingPolicy::Exact,
a pipeline per bound sampler state) and the device's 8-bit unorm filter at
Metal's footprint step (Unorm8LinearFilterPolicy) are gone with their
switches: every sample, gather and comparison goes to the device's sampler,
Metal's own on MoltenVK (VkProperty::MetalSampler) and the device's
elsewhere (VkProperty::DeviceSampling, PrecisionNote::DeviceSampling).

Deleted: lower/sampler/compared.rs, native.rs, linear/compare.rs,
linear/cube.rs, the nearest and level snaps, the cube face position and
fold (face::snapped, FaceWrap), the span and cube bicubic routines, the heap
depth class (FLAG_DEPTH_*, HANDLE_DEPTH_*, Lookup::Flagged's depth), the
normalized gather snap and the runtime sampler's anisotropic bias route.
Notes nothing records any more are deleted with their catalogue and codec
entries and the runtime's Degradation kinds: DeviceGatherFootprint,
CubeFaceReciprocal, DeviceDepthComparison, DeviceTexelDenormals,
DeviceUnorm8LinearFilter. The fit drops the sampling field of
ExactFormsOverCompilerLimit and makes every module-growing form native in
one reduction.

Kept as capability: bicubic, extended range, heap raw reads, YCbCr planes
read in place (its tests move to engine_ycbcr_in_place), constexpr pixel
samplers' snaps and fetches, the runtime pixel word's gather and footprint
cell, Metal's cube face at a tie, the anisotropic emulation without
samplerAnisotropy and for an unmeasured cube-gradient route, the
VkSampler level clamp on Metal's grid.

Validation and conformance follow: the lanes judge the device's filter
within two codes where it samples natively, the anisotropic lane runs with
samplerAnisotropy withheld, and the conformance cases drop their
device-texel-denormals declarations. docs/API.md, FAST-PATHS.md,
ARCHITECTURE.md, CONTRIBUTING.md and VALIDATION.md updated.

Verified so far: cargo check of the workspace, all targets and features,
plain and --cfg m2v_gpu; 1000 of 3664 translator lib tests passed before
the run was stopped for the rebase.

* Join the device-sampler deletions with development's half and write removals

The rebase onto development left two joins only a build shows:

- `packed_scales` and `PackedField::small` lost their last readers (the
  float texel conversion this branch deleted and the normalized write
  development deleted): both go.
- `engine_srgb_raw` takes `DevicePolicy::default()` where development's
  side named `EXACT_SAMPLING`, so it imports `DevicePolicy` again.

Also formats the conflict resolutions (`cargo fmt --all`).

Verified: `cargo check --workspace --all-targets --all-features` passes.

* Drop the sampler word's snap and level-rule fields with their last readers

With every sample the device's own, no function reads a runtime sampler's
nearest snap (`SamplerWord::NEAREST_BASE`, `NEAREST_SNAP`, `NEAREST_LEVEL`,
`LEVELED_SNAP`) or its level rule (`LEVEL_RULE`); only tests named them.
The constants go, with the word test of the base-level mask; the
`VkSampler` clamp on Metal's level grid (`clamps_on_grid`) stays, and its
docs no longer say the shader reads the rule.

The runtime-sampler tests of `engine_sampler` asked, off MoltenVK, for the
emulation's linear state, leveled snap and level rule: they now state the
device's sample on every committed profile (the pixel fields alone, gated;
`MetalSampler` on MoltenVK, `DeviceSampling` elsewhere; no level field).

Also matches `SnapKind::WordGather` as the unit variant it is (clippy).

Verified: clippy (all targets, all features, -D warnings) passes.

* Test the anisotropic, bias and position paths as the device's sampler runs them

The tests of these paths compiled under the exact sampling policy, which
is gone; under the default each now states what the translation does:

- Metal's anisotropic filter is emulated only without `samplerAnisotropy`
  (and on MoltenVK's unmeasured cube-gradient route), so the emulation's
  shape tests compile on committed profiles with the feature withheld,
  and their MoltenVK arms on the profile as described. An isotropic cube
  keeps the device's gradient sample except on the unmeasured route.
- A bias through a sampler without its own is the `Bias` operand on every
  profile (one test over MoltenVK, RADV, lavapipe and the floor); the
  compile-time and anisotropic axis-gradient tests take a constexpr
  sampler with its own bias, the only one that reaches them. The runtime
  slot's word-chosen axis gradients have no reader left: its test goes,
  with the helpers only it used.
- The position kernel writes three words a lane: its record stride is 12
  bytes, not 16, and the by-word gather test's lane floor matches its
  single pass.

Verified: `cargo check -p metal2vulkan --tests --all-features` clean; the
tests run after the rebase onto development.

* Rewrite the sampling tests and notes for the device's sampler

The sampling, texel-conversion and YCbCr-filter emulations are gone, so
the tests that pinned them now pin the device's answer, and the note
docs that described them describe what the module records today.

Tests: the sampler-unk, anisotropic cube, depth-range, bicubic,
dynamic-offset, heap half-texel, shared-switch, sRGB raw view,
swizzled packed and texture-interpreter families. Deleted the tests of
the emulated linear filter over raw sRGB codes (constexpr and runtime),
the runtime sampler's one-texel raw sample and its switch, the shader's
linear depth comparison, the bicubic small-level comparison against the
linear emulation and the depth read's class conversion; the shared
switch keeps the bicubic emulation alone. A NaN texel's half read only
needs to read a NaN under the default policy.

Docs: HalfSampleFilter, FloatSampleFilter, SrgbTexelDecode,
AnisotropicFilter, DeviceAnisotropicFilter, ViewBaseTexelOffset and
HalfTexelConversion in artifact.rs, RuntimeFact::TexelFormat, the heap
class flag, texel_format_spec and a few comments that still named the
emulated linear filter, snapped gathers or the shader's comparisons.

Verified: plain clippy over the workspace with all targets and
features; the touched families under nextest (see the next commits for
the full runs).
2026-10-28 17:24:20 +02:00
Anees Iqbal 79166a74b1 Leave NaN bits and min/max picks to the device
One work packet, landed as 6 commits (a6e97e7f93..3919c8c94a on archive/development-linear-2026-10-28), in order:

* Leave NaN bits and min/max picks to the device

On the owner's ruling to promise the GPU's native arithmetic with no exact
emulation, delete the NaN and minimum/maximum switch and every form that
only it, or Metal's NaN bits, kept.

What goes:
- DevicePolicy::nan_and_min_max and NanMinMaxPolicy (exact_answers line,
  serde, ExactFormsOverCompilerLimit::nan_and_min_max, the fit leg).
- The module's selects of Metal's NaN: NanEncoding::Device,
  ArithStrategy::Nan and lower/arith/nan.rs down to its answer classes.
  A NaN Metal answers that the device is not measured to answer records
  NativeNanEncoding.
- Metal's operand pick in fmin, fmax, min3, max3, clamp and saturate
  (metal_min_max, metal_saturate, MinMaxRoute): NMin, NMax and NClamp on
  every profile, NativeMinMax where MetalMinMax is not taken.
- Metal's texel NaN rule (TexelNanRoute, the 0x7e00 keeps, the half texel
  NaN keep, the NaN classes of reads, samples and gathers).
- NaN canonicalization before colour and storage writes:
  StorageImageClass::HalfQuietNan and SmallFloatQuietNan, the half write
  NaN classes (HalfNans), the quieted heap small floats, the colour lanes
  that chose 0x7fc00000, the 16-bit colour outputs (StageIo and
  StageModule half_bit_colors, IoType::bits, Degradation::
  ShaderHalfColorBits), PushField::TextureHalfChannels,
  RuntimeFact::StorageTextureHalfChannels and the slot word behind it.
  Such writes record DeviceNanEncoding where the stored NaN may not be
  Metal's (heap and formatless writes, 32-bit and packed float channels).
- The narrow-float vertex fetch's canonical NaN: noted instead.
- The runtime's colour NaN clears (nan_clear::NanClears and its texel
  computation, the inline-first NaN clear refusal, WorkCounts::
  passes_not_inline_actions_nan_clear): the device's clear, announced as
  DeviceNanEncoding. The depth NaN clear and the bit-exact copies stay.
- FAST-PATHS rows for the switch, the half texel keep and the half from
  bits under float controls; the known gap of RADV's sampler NaN; the
  API.md passages and catalogue entries.

Kept: the notes that describe the native answer (NativeNanEncoding,
NativeMinMax, DeviceNanEncoding), the measured deviations they read, the
copy and depth paths, keeps_nan_sign, the heap half-bits twin, the half
rounding and the blended snorm NaN of other lanes.

Versions: SEMANTICS_VERSION 1871, ARTIFACT_FORMAT_VERSION 454,
RUNTIME_VERSION 1652. docs/REFUSALS.md regenerated.

Verified: cargo clippy --workspace --all-targets --all-features -D
warnings, plain and with --cfg m2v_gpu; RUSTDOCFLAGS='-D warnings' cargo
doc --workspace --all-features --no-deps; nextest of metal2vulkan
filtered to the touched modules, fast_paths, catalogue, degradation,
api_surface and profile (see the report for counts), and of the runtime,
validation and conformance unit tests touched. No device test was run.

* Re-bless the API signatures after the NaN and min/max deletion

The table loses the public items the previous commit removed:
NanMinMaxPolicy and its variants, DevicePolicy::nan_and_min_max,
ExactFormsOverCompilerLimit::nan_and_min_max, PushField::
TextureHalfChannels, RuntimeFact::StorageTextureHalfChannels,
StorageImageClass::HalfQuietNan and SmallFloatQuietNan,
StageModule::half_bit_colors, Degradation::ShaderHalfColorBits and
WorkCounts::passes_not_inline_actions_nan_clear.

Verified: python3 scripts/api-signatures/signatures.py --bless; nextest
of the api_signatures, api_surface, refusal_surface and
feature_vocabulary binaries (21 passed); the previous commit's filtered
metal2vulkan run, 1056 passed, plus runtime (53), validation (83 of 84;
the failing c3 venue-identity test names the Apple M4 and touches no
file of this change) and conformance (38) filtered runs.

* Fix the tests the rebase onto development left broken

The rebase of the NaN and min/max deletion onto development left two test
compile errors: the extended-range samples still round through
`half_toward_zero`, which the resolution had dropped with the storage-slot
test that used it, and the RGBX storage cases named `HalfQuietNan`, which
both sides' deletions removed (a half-float twin is `Identity` now).

Verified: cargo clippy --workspace --all-targets --all-features -D warnings,
plain and with --cfg m2v_gpu; RUSTDOCFLAGS='-D warnings' cargo doc.

* Drop a dead dot form and let formatless half slots note conversion twice

select_float_fn still computed dot's scalar result form, which only the
removed NaN canonicalization read. The half-float storage test asserted
that a formatless slot notes DeviceColorConversion exactly when the
profile does not round Metal's way; a formatless slot may also reach a
normalized image, whose conversion is the device's on every profile, so
the note is only required one way there.

Verified: cargo check --workspace --all-targets --all-features is clean.

* Leave the fast division's NaN to the device in its test

The float-maths lane's a_fast_division_answers_metals_nans_on_every_profile
asserted Metal's canonical NaN after the device's OpFDiv where the
profile does not take MetalCanonicalNans. Under the native-arithmetic
ruling the module selects no NaN: the fast division is the device's
OpFDiv on every profile, noted NativeNanEncoding where the device is not
measured to answer Metal's. The test, now
a_fast_division_leaves_its_nans_to_the_device, checks that the module
is the same on both sides of the fact, the note where the fact is absent,
the device's arithmetic, division and denormal notes on every committed
profile, never DeviceNanEncoding, a NaN for each NaN case and 6 / 3
exactly.

Verified: cargo nextest -E 'test(/engine_arith::a_fast_division/)'
passes (2 tests); the previous form failed on amd-780m-hawkpoint-radv
for fast_one_by_negative_nan (0xffc00000, the device's).

* 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:20 +02:00
Anees Iqbal 4817f3bdfe Take the device's float maths, rounding order and denormals on every device
One work packet, landed as 3 commits (9fd799bdbb..43bdc4ac17 on archive/development-linear-2026-10-28), in order:

* Take the device's float maths, rounding order and denormals on every device

The owner's ruling: promise the GPU's native arithmetic, no exact emulation.
The translation's own Metal-answer forms for float maths go, and the
device's native form is the only form.

What goes:
- DevicePolicy::float_maths (FloatMathsPolicy) and
  DevicePolicy::rounding_order (RoundingOrderPolicy), their exact_answers()
  lines, serde, docs, and the profile state that carried them
  (FloatFunctions::Device, ProfileFields::rounding_order and
  RoundingOrderRoute); RuntimeFact::ExactFormsOverCompilerLimit loses its
  float_maths and rounding_order fields.
- The maths routines of Metal's answers in lower/arith/libm (atan, exp,
  hyper, log, pair, pi, quarter, rcp, root, rsqrt, sincos, tan, trig) and
  their paths in math.rs: off MoltenVK every call takes the device's
  GLSL.std.450 instruction (or Metal's composition of the device's
  instructions), noted NativeTranscendentals; on MoltenVK the device's
  instruction, Metal's own in the module's mode, with its old notes.
- Metal's precise division routine and its fast reciprocal: a precise and a
  fast division are the device's OpFDiv (NativeDivision), and an frem
  without every flag the device's OpFRem.
- The checked OpFmaKHR, the double, integer and half fused multiply-add
  routines, and the tiny-product check (arith.float.tiny): a fused
  multiply-add is OpFmaKHR, the measured 16-bit Fma, OpFmaKHR under the
  16-bit float controls, or the device's Fma (NativeFma).
- Metal's fused chain for dot, mix and fast::sqrt off MoltenVK: OpDot, FMix
  and Sqrt (NativeDot, NativeMix, NativeTranscendentals). MoltenVK, whose
  float functions are Metal's, keeps Metal's chains.
- The f32 denormal flush taken where the device is not measured to read
  denormals as Metal does (no DriverDeviation::MetalFloatDenormals), and the
  floor and ceil flush: those denormals are the device's, noted
  DeviceDenormals.
- FloatTininessAfterRounding is announced on every device off MoltenVK.

What stays: precise fmod's routine (OpFRem is not the exact remainder past a
quotient of 2^24), ldexp on the bits (GLSL Ldexp is undefined past the
exponent range), double support, and every precision note that describes the
native answer. FloatFn::words charges each function a call takes as before
(the device's instruction where a routine's call was counted).

Tests of the deleted forms are deleted; the tests of the native forms now
check the device's instruction, its note and the interpreter's IEEE answer
(the division, remainder, fmod, fused multiply-add, dot, mix, denormal and
tanh tests), and the roll fixture grows to 13,000 operations so two bodies
stay above the roll size without the flushes. The c3 bound and sign-off
tests expect a subnormal product or quotient on lavapipe to stay open
(its multiply and divisions now record DeviceDenormals) and a product on
MoltenVK, measured to flush as Metal does, to keep Apple's verdict.

Docs: FAST-PATHS.md's two rows become device gaps (the maths library and
divisions; dot, mix and fast::sqrt; the tininess; the denormals), API.md's
policy bullet and catalogue entries, ARCHITECTURE.md's decisions bullet.

Versions: SEMANTICS_VERSION 1878, ARTIFACT_FORMAT_VERSION 461,
RUNTIME_VERSION 1660. REFUSALS.md regenerated unchanged; api_signatures.tsv
is re-blessed in a later commit, after the rebase onto development.

Verified on b1ae235a12, before the rebase onto development 4df472aea2
(whose conflicts the commits after this one check): cargo clippy
--workspace --all-targets --all-features -D warnings with --cfg m2v_gpu;
cargo nextest (--test-threads 4) on the touched modules' tests
(lower::arith, lower::sampler face, position and linear, device::tests,
compile::fit, cache, the engine_* suites touched, engine_roll, fast_paths,
api_surface, api_signatures), the runtime's degradation, catalogue, device
and fitted_variant_notice tests, and the whole metal2vulkan-validation
suite but the runtime-sources pin (left to the landing) and
c3::tests::each_moltenvk_device_compares_with_its_own_gpus_metal (a venue
identity check outside the arithmetic). No device tests ran: the device
lanes compile under --cfg m2v_gpu and were adapted, not run.

* Re-bless the public signatures after the float maths switches' removal

The commit before this one was rebased onto development 4df472aea2. This
commit holds what the rebase left to do:

- api_signatures.tsv re-blessed: against development it drops
  FloatMathsPolicy and RoundingOrderPolicy (their records, fields and
  variants) and ExactFormsOverCompilerLimit's float_maths and
  rounding_order fields. docs/REFUSALS.md regenerated, unchanged.
- corpus-draw-ab's --policy error message: the conflict resolution lost the
  string's line continuation and left a run of spaces in it.
- The DeviceDenormals docs (PrecisionNote and the API.md catalogue entry)
  no longer say the minimum and maximum functions and saturate answer
  Metal at a denormal on every device: under the default policy, and on
  every device once Metal's picks go, they are the device's NMin, NMax and
  NClamp, whose pick of a denormal NativeMinMax records.
- Doc comments this lane wrote past 100 columns refilled.

Verified on this tree: cargo clippy --workspace --all-targets
--all-features -- -D warnings, plain and with --cfg m2v_gpu, clean;
RUSTDOCFLAGS='-D warnings' cargo doc --workspace --all-features --no-deps,
clean; cargo nextest (--test-threads 4) of metal2vulkan filtered to the
touched modules (lower::arith, lower::sampler, device::tests, compile::fit,
cache, the touched engine_* suites) and fast_paths, catalogue,
degradation, profile, mechanism, api_surface and api_signatures: 818 run,
817 passed; of the runtime's degradation, catalogue, device and
fitted_variant_notice tests and the whole metal2vulkan-validation suite:
1402 run, 1400 passed. The three failures fail identically on development
4df472aea2 (run there): engine_float_call_notes::
exported_float_notes_are_the_ones_a_compile_records (fabs_f16 on
moltenvk-m3 records NativeHalfConversion, the half decode's note) and
c3::tests::each_moltenvk_device_compares_with_its_own_gpus_metal (a venue
identity check); and the runtime-sources pin, left to the landing. No
device tests ran.

* 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:20 +02:00
Anees Iqbal 70068f7cc0 Leave color writes to the device's own conversion
One work packet, landed as 6 commits (886b08c25a..4df472aea2 on archive/development-linear-2026-10-28), in order:

* Leave color writes to the device's own conversion

The owner ruled that the GPU's native arithmetic is the contract and
the exact emulation goes. The fragment stage no longer rounds a float
output to Metal's codes before a color write where the device is not
measured to convert as Metal does: every lane is written as computed
and the device converts it.

Removed: the shader's unorm, snorm, sRGB, packed 16-bit (through half)
and small-float roundings at Metal's default rounding mode, the
draw-selected rule (ChannelWrite::Selected, PushField::ColorWriteRule,
GraphicsState::color_write_rules, StageIo::selected_colors and the
rule words), and the sRGB color-write table
(SyntheticBinding::ColorWriteTable, WriteSource::ColorWriteTable,
bind::color_write_table) with its runtime and validation binders.

Kept: the rounding to nearest even under TextureWriteRoundingMode::
NearestEven (an explicit Metal API mode no device's conversion makes),
word attachments the function encodes, the storage-form blends of
framebuffer fetch, the 16-bit output route, and the notes. A channel
the device converts unmeasured records DeviceColorConversion; a float
NaN to a half-float channel records DeviceNanEncoding where the device
is not measured to store Metal's. A blend of one and zero is dropped
from an attachment whose channels convert by a rule, as before, so a
device without the blend still draws it.

Bumps SEMANTICS_VERSION to 1874, ARTIFACT_FORMAT_VERSION to 457 (codec
lists lose fields and variants) and RUNTIME_VERSION to 1655 (the
binder no longer binds the table).

Verified: cargo clippy --workspace --all-targets --all-features -D
warnings, plain and with --cfg m2v_gpu, clean; cargo nextest (color
writes, link, stage io, fragment, binder, blend8, api_surface, srgb,
extended range, word, fetch, fast_paths, catalogue, degradation,
profile, codec, compile, push): 694 of 694 passed. Device lanes not
run (no device tests in this lane).

* Leave storage-texture writes to the device's own conversion

On the owner's ruling that the GPU's native arithmetic is the contract,
a kernel's (or any stage's) float or half write to a storage texture
no longer rounds to Metal's codes in the shader where the device is
not measured to store them.

Removed: the normalized write's rounding by the bound format's class
(lower/texture/norm_write.rs, NormWrite, the slot's norm_write flag,
the heap's norm routine and its census entry), the 1-bit alpha's
rounding on a device that stores every other normalized channel as
Metal does (StorageImageClass::OneBitAlpha, the heap's one-bit class
test, texel_format::heap_one_bit_indices), ARGB8Unorm's code rounding
(RotateArgb now only rotates), and the half-float write's rounding
toward zero (StorageImageClass::HalfTowardZero): a half-float write
takes Identity where the device stores Metal's NaN, else HalfQuietNan.

Recorded instead: PrecisionNote::DeviceColorConversion for a write
that may reach a normalized format (ARGB8Unorm included) on a device
without MetalNormStorageWrites, or a 1-bit alpha on one with it, and
for a half-float write on a device without MetalHalfStorageWrites;
where measured, the module requires the property. Imageblock slice
writes record the same.

Kept: the HalfBits route (a half-float texture written through its
unsigned integer alias where the device does not keep a half's NaN
bits) as it is, its float texels still rounded toward zero, since the
alias has no conversion of the device's; the NaN quieting classes;
sRGB encodes; extended-range encodes; RGB9E5's word.

The device lanes for normalized and half storage writes, and the
extended-range planes lane's ARGB8 alpha, now hold a channel to
Metal's only where the device is measured to store it, and print the
rest.

Verified: cargo clippy --workspace --all-targets --all-features -D
warnings, plain and with --cfg m2v_gpu, clean; cargo nextest
(engine_handles, engine_extended_range, engine_link, engine_rgbx,
engine_texture, metal::format, texel_format, bind::heap, engine_access,
engine_heap, engine_texel_nans, storage, lower::texture,
lower::arith::tests, fast_paths, catalogue, degradation, profile,
api_surface): 1028 run, 1 failure fixed, then engine_link 26 of 26.
Device lanes not run.

* Leave Depth16Unorm depth stores to the device's own conversion

The owner's ruling ("Just promise the GPU's native arithmetics, no more
'exact' emulation") makes the device's own conversion of a fragment's
depth to a Depth16Unorm code, and its own depth bias, the contract.
The fragment stage no longer rounds its depth to Metal's 16-bit code,
nor adds Metal's bias in the shader, where MetalDepth16Stores or
MetalDepth16BiasedStores is absent: the depth is written as computed
and the attachment's fixed-function bias applies on every device.

Deleted with it: lower/stage_io/depth16.rs and its arith tests, the
engine_depth16_codes tests, the pipeline's depth16 stage form and its
variant key fields, the Depth16 runtime facts and their codec entries,
the DepthBias push field, the binder's depth16 selection and state, the
runtime's sided-bias push and its work count.

Removed public items: Degradation::ShaderUnormDepth and
Degradation::UnormDepthSlope (nothing can record them any more; their
API.md catalogue entries go too), WorkCounts::depth16_sided_draws,
metal::state::depth16_bias and depth16_bias_side, the four RuntimeFact
Depth16 variants, PushField::DepthBias, and the depth16 fields of
VariantKey, BindState and BindShape. UnormDepthBias and
UnormDepthRounding stay: they describe the native answer and are still
announced where the drivers are not measured to give Metal's codes.

The FAST-PATHS "Costs of matching Metal" bullet for Depth16 goes; the
API.md bias and rounding entries now describe the native answer. The
device lane unorm_depth_bias holds Metal's codes only where measured.
The cache versions were already taken for this lane (1874/457/1655).

Verified: cargo clippy --workspace --all-targets --all-features -D
warnings, plain and with --cfg m2v_gpu; rustdoc with -D warnings;
cargo nextest over mechanism, api_tests, bind_shape, pipeline::compile,
link tests, engine_stage_io, engine_fragment, metal::state,
bind::graphics, cache tests, engine_graphics_binder, depth, fast_paths,
catalogue, degradation, profile, api_surface, notice, work_counts,
draw_shape, render_state and codec across metal2vulkan,
metal2vulkan-runtime and metal2vulkan-conformance: 750 passed. Device
lanes not run; refusals regenerate unchanged.

* Drop two doc references to removed colour and depth16 machinery

The runtime's stage digest doc still listed a synthesized depth16
fragment stage among the link's stages, and the sRGB storage lane's
module doc still named bind::color_write_table, both removed on this
branch. The stage list now names only the stages the link still
synthesizes, and the lane's doc names bind::SRGB_RESOLVE_THRESHOLDS,
the table it reads.

Doc comments only; verified by cargo fmt and the rustdoc build below.

* Re-bless the public signatures after the write conversions' removal

The branch removed the Metal colour-write rule selection, the shader's
storage-texture rounding and the shader's Depth16Unorm codes; the
table now drops their 30 public records (ChannelWrite::Selected,
PushField::ColorWriteRule and DepthBias, the ColorWriteTable binding
and write source, bind::color_write_table, GraphicsState's
color_write_rules, the four RuntimeFact Depth16 variants,
StorageImageClass::HalfTowardZero and OneBitAlpha, the depth16 fields
of LoweringInputs, VariantKey, BindState and BindShape,
metal::state::depth16_bias and depth16_bias_side,
Degradation::ShaderUnormDepth and UnormDepthSlope, and
WorkCounts::depth16_sided_draws). Removals only; nothing added or
changed.

Verified: python3 scripts/api-signatures/signatures.py --bless, the
diff read line by line, and cargo nextest over api_signatures and
fast_paths: 17 passed.

* 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:20 +02:00
Anees Iqbal b7a62be64b Drop the exact tile store: a loaded snorm or RGB9E5Float attachment keeps the device's load and store
One work packet, landed as 7 commits (c18e40911e..53fcb867b4 on archive/development-linear-2026-10-28), in order:

* Drop the exact tile store: a loaded snorm or RGB9E5Float attachment keeps the device's load and store

The owner's ruling (2026-10-27): the GPU's native answers are the contract,
with no exact emulation. TileStorePolicy and DevicePolicy::tile_store go,
with the load pass's rewrite of a signed normalized attachment's minimum
codes and an RGB9E5Float attachment's unnormalized words, and the
unused-bits module's two rules that served only it. The load pass keeps the
extended-range, padded and bfloat attachments, whose raw codes no device
holds as Metal's (capability). snorm-minimum-kept and shared-exponent-kept
still announce the native answer at each such draw; DriverFact::TileStoreIsMetals
still keeps them quiet on MoltenVK.

Docs: the ledger row and docs/API.md's policy bullet go; the catalogue
entries and the notices' docs drop the switch. The validation lane tests the
one form.

Verified: cargo clippy --workspace --all-targets --all-features -D warnings;
nextest of bind::unused_bits, tests::fast_paths, tests::owned_divisions,
api_surface and the runtime's degradation and catalogue tests (49 passed).

* Drop the exact color resolve: the device's average resolves every attachment it can

The owner's ruling (2026-10-27): the GPU's native answers are the contract.
ResolvePolicy and DevicePolicy::resolve go, with the crate-owned resolve
drawn after the pass for a format of Metal's rules on a device whose average
is not measured to be Metal's. The device's AVERAGE in the pass is the one
form there, announced device-rounded-resolve as before. The crate-owned
resolve keeps the resolves no device's average can write: an extended-range
attachment's raw codes, a resolve into the attachment's format's sRGB twin
(VUID-VkSubpassDescription-pResolveAttachments-00850), and a fetching pass's
sample planes, read in place of merging them back.

Docs: the ledger row and docs/API.md's policy bullet go; the shader-resolve,
device-rounded-resolve and unmeasured-resolve entries describe what remains
(unmeasured-resolve's cost text with them).

Validation: the lanes ran under exact_answers, so their expectations follow
the device's resolve: resolve_kind is device-rounded-resolve wherever the
average is not measured to be Metal's; the exact form's tests
(color_resolves_against_metals_rules, the caller's-image copy path, its cost
scout) go; the Maps-form and probe-6 resolves hold Metal's texels where the
fact holds and the announced bound elsewhere; shader-resolve's lane site
moves to the extended-range resolve lane.

Verified: cargo clippy --workspace --all-targets --all-features -D warnings,
plain and under --cfg m2v_gpu; nextest of fast_paths, the degradation and
catalogue tests, the runtime's resolve, sample-plane, framebuffer-fetch and
stand-in tests, and api_surface (129 passed). The device lanes were not run.

* Drop the depth twin: every Depth32Float texture is its D32_SFLOAT depth image

The owner's ruling: promise the GPU's native arithmetic, no exact emulation.
A Depth32Float texture the program only reads was held in an R32_SFLOAT
image with a D32_SFLOAT twin for comparisons, on a driver not measured to
keep every float in a depth image (plan_depth_twin), and a multisampled one
in R32_SFLOAT under MultisampleDepthTwinPolicy::Exact. Both forms exist only
to keep Metal's texel bits; the native form is the depth image, whose
possible clamp or denormal flush the existing notices already announce at
the write (restricted-depth-upload, depth-denormals).

Removed:
- MultisampleDepthTwinPolicy and DevicePolicy::multisample_depth_twin, its
  FAST-PATHS row, its known-gap paragraph and its fast_paths choice.
- image_plan::plan_images, plan_depth_twin, holds_depth_in_colour,
  holds_multisample_depth_in_colour, ImageFacts::depth_loss and
  ImageFacts::multisample_depth_twin.
- The twin image of a texture (Image::twin), its copies in replace_region,
  blits and host copies, Owner::HeapTwin and the heap plan's twin (heap_extent
  now takes the image alone; check_heap_base the route alone; Mine is gone).
- The depth-twin degrade kind (Degradation::DepthTwin) and its docs/API.md
  catalogue entry.
- The bind side: TextureFacts::depth_twin, TextureShape::Texture::depth_twin,
  ImageViewDesc::twin and sampled_view's twin argument.
- A sparse Depth32Float texture is no longer refused for needing a twin.
- copy_unit refuses any depth format held in colour (none is now).

Tests: the twin tests are replaced by one that holds a Depth32Float texture
in its D32_SFLOAT image on every committed profile (single-sampled,
array, cube, render target, 2 and 4 samples); the heap and copy-plan unit
tests follow the one-image forms. The validation lanes that expected a twin
(texture_blits' upload lane, clear_reach, resolves' read-only depth pass,
texture_fills, heap_textures) now expect the depth image and its notices;
conformance's fill cases allow Depth32Float's digest unchecked where
restricted-depth-upload fires, as Depth32Float_Stencil8's already is.

RUNTIME_VERSION 1656: what a run of an unchanged pipeline does with such a
texture changes.

Verified: cargo clippy --workspace --all-targets --all-features -D warnings,
plain and with --cfg m2v_gpu; nextest of the translator and runtime
image_plan, heap, copy_plan, texture_facts, families, texture, degradation,
catalogue, fast_paths, profile, api_surface, bind and driver_facts tests
(973 passed). Device lanes not run.

* Drop the magnitude stand-in and the sign strip: a stored signed depth is tested natively

On the owner's ruling to promise the GPU's native arithmetic, a render target's
32-bit float depth that may hold a negative value or a NaN is no longer
switched on to render over a magnitude stand-in, and no pass strips the signs
of the words it did not write. The device's depth test compares the stored
value as it is and its pass keeps every bit; the runtime announces that
answer.

What goes:
- texture/signed_depth.rs, with the switch-on flags, the stand-in plans, the
  write-backs and the sign strips in render.rs and render_pass.rs;
- Cause::Magnitude in attachment_stand_in.rs;
- the translator's DepthMagnitudeModule (bind/depth_magnitude.rs) and the
  DepthStencilCopy::{DepthMagnitude, MagnitudeBits} draws;
- OwnedModule::DepthMagnitude;
- copy_plan's holds_unlike_its_stand_in;
- WorkCounts' signed_depth_switch_ons, magnitude_stand_in_passes,
  magnitude_write_backs and sign_strips (and their counters).

What stays, describing the native answer:
- signed-depth-test is announced where a write (a host upload, a blit, a copy,
  a written NaN clear, a new target's pattern loaded) may store such a value in
  a render target's Depth32Float or Depth32Float_Stencil8 depth on a device
  that keeps it and whose test is not Metal's (no
  DriverFact::DepthTestComparesMagnitudes);
- where the device's test is Metal's own (MoltenVK), signed-depth-test is
  announced only at a pass that loads and stores the depth and sets a state
  with depth writes but draws under none, which keeps the signs.

The denormal notice no longer mentions the stand-in.

Docs:
- FAST-PATHS drops "A stored negative or NaN depth is tested by its magnitude"
  and the matching known gap;
- FAST-PATHS also drops "A Depth16Unorm depth whose code the fragment stage
  writes is tested after the stage" (the shader write is the translator's to
  remove);
- API.md's depth-denormals and signed-depth-test entries now state the native
  answer;
- doc comments the earlier steps left past 100 columns are reflowed, and the
  remaining depth-twin mentions (bind docs, fast_paths' comment, three
  conformance known-gap todos) are dropped.

Validation:
- depth_denormals' lanes check every read, sample and comparison against
  Metal's, the depth tests only where the device's test is Metal's own, and
  the notices where they now fall;
- the sign-strip lane is deleted;
- texture_blits expects signed-depth-test at the render-target upload.

Verified: clippy with all targets and all features, plain and with
--cfg m2v_gpu, across the workspace; rustdoc with -D warnings; the runtime's
nextest suite (1150 passed); the translator's touched tests (fast_paths,
catalogue, degradation, api_surface, depth_stencil_copy, owned_divisions,
profile, driver_facts, bind, policy: 671 passed); validation and conformance
non-device tests in the touched areas (230 passed). Device lanes were not run.

* Re-bless the API signatures and regenerate the refusal surface

The lane's removals leave the public surface without:
- MultisampleDepthTwinPolicy, TileStorePolicy and ResolvePolicy, with their
  DevicePolicy fields;
- TextureFacts::depth_twin, TextureShape::Texture's depth_twin and
  ImageViewDesc::twin;
- DepthMagnitudeModule and depth_magnitude_module;
- DepthStencilCopy::{DepthMagnitude, MagnitudeBits};
- Degradation::DepthTwin;
- WorkCounts' signed_depth_switch_ons, magnitude_stand_in_passes,
  magnitude_write_backs and sign_strips.

The refusal surface loses four sites:
- the sparse depth-twin refusal (SparseHeaps, texture.rs plan_sparse_texture);
- the host heap's twin refusal (HeapTextureMemory, heap.rs host_heap_plan);
- the heap twin's DetachTextures site (heap.rs heap_texture_at);
- the sign strip's SeparateMultisampledDepthStencil site
  (signed_depth.rs sample_strip).

Verified: python3 scripts/api-signatures/signatures.py --bless and
python3 scripts/refusal-surface/refusal_surface.py, then the api_signatures,
refusal, api_surface, published_crates, fast_paths and degradation_catalogue
tests (81 passed).

* Format the policy import lists after the half switches' removal

The rebase onto development (where the half-precision lane removed three policies) kept both lanes' removals; cargo fmt re-flows the shortened lists.

Verified: clippy (workspace, all targets, all features) clean; 709 touched tests (fast_paths, api_surface, api_signatures, catalogue, degradation, profile, bind, image_plan, published_crates, policy) pass.

* 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:20 +02:00
Anees Iqbal e87d6e558f Drop the exact read of a 16-bit float texel's own bits
One work packet, landed as 6 commits (b07aaeec71..ffa0751e77 on archive/development-linear-2026-10-28), in order:

* Drop the exact read of a 16-bit float texel's own bits

The owner's ruling of 2026-10-27 ("just promise the GPU's native
arithmetics, no more 'exact' emulation") makes the device's decode of a
16-bit float texel the only answer a `half` or `float` read gives. So
`DevicePolicy::half_texel_bits` and `HalfTexelBitsPolicy` go, with
everything only its `Exact` value reached:

- the slot's second binding of the texture's unsigned-integer alias
  (`RuntimeFact::HalfBitsTexture`, `metal::format::half_bits_read_view`,
  `DeviceProfile::reads_half_texel_bits`), its declaration, the read's
  branch on the bound class and its integer widening;
- the snapshot copy's alias arm and the read's codes beside the value;
  `snapshot_copies_alone` now expects the copy's one fetch a slot;
- the binder's alias view and its in-shader swizzle for it, and the
  runtime's alias view format on a sampled image;
- the fit's `half_texel_bits` field of `ExactFormsOverCompilerLimit`
  and the runtime's name for it.

The read keeps the device's decode and its `DeviceNanEncoding` note.
The `StorageImageClass::HalfBits` storage path is untouched. Tests of
the deleted form go (`engine_half_texel_bits`, the snapshot alias and
swizzle tests, the golden check of the copy's arm); the ledger row goes,
and the conformance gap rows' reasons no longer cite the switch.

SEMANTICS_VERSION 1872, ARTIFACT_FORMAT_VERSION 455 (a RuntimeFact
variant and a field gone), RUNTIME_VERSION 1653.

Verified: cargo clippy --workspace --all-targets --all-features
-D warnings clean; nextest over fast_paths, catalogue, degradation,
profile, mechanism, compile::fit, engine_snapshot_exact,
engine_srgb_raw, engine_swizzled_storage, snapshot_codes, codec and
image_plan (276 tests) passed. api_signatures is re-blessed at the
lane's end.

* Drop the shader's exact 16-bit float blend of a half output

The owner's ruling is to promise the GPU's native arithmetic, so the
`half_blend` switch (`HalfBlendPolicy`) goes. Under its exact value the
pipeline named a blended 16-bit float attachment of a `half` output, and a
32-bit float one of a four-lane output under fast math, for the interlocked
storage form alone (`FramebufferFetchInputs::half_blends`), so the shader
computed Metal's blend where the device would otherwise blend. That path
is gone: `compile::blended_in_shader`, the `half_blends` set and its
"optional" handling in the fetch lowering, `fetch::blends_half_in_shader`,
`half_output` and `half_blend_attachment`, the policy field, the profile
field and the fit's `half_blend` flag in
`RuntimeFact::ExactFormsOverCompilerLimit`.

Kept: a fetched attachment's blend (the function reads it, so no Vulkan
blend applies) and an attachment a draw moves into the storage form
(`VariantKey::interlocked_colors`), both capability. `HalfOutputPrecision`
still describes the device's blend and is recorded as before; with no
switch it is no fast-default row, so the ledger test classes it with the
notes docs/API.md section 9 states. The ledger's `half_blend` row goes,
and the device-gap rows no longer cite it.

Tests of the exact form go (`engine_fetch_float32_reach`, two
`engine_stage_io` tests); the validation lane `half_output_blends` runs
under the device's blend alone, and `corpus-draw-ab --policy` no longer
takes `half_blend`.

Verified: cargo clippy --workspace --all-targets --all-features -D
warnings clean; nextest of engine_stage_io, compile::fit, fast_paths,
device::tests, pipeline::api_tests, lower::fragment, catalogue,
degradation, fitted_variant_notice, api_surface and link render tests
(246 passed), and of every fetch, blend, interlock and half_output test
(199 passed). Golden tables not run (re-blessed on development).

* Round half by the device's own conversion or quantize

The owner's ruling is that the GPU's native arithmetic is promised, with
no exact emulation. This deletes the half_rounding switch
(HalfRoundingPolicy, ProfileFields::half_rounding, HalfRoundingRoute)
and everything that only its Metal value reached:

- QuantizeForm::Integer: Metal's rounding to half by integer arithmetic,
  its texel routine arms (grid16_by_integers), round_texel_plain and
  texel_round's f32_to_half_by.
- The NoContraction barrier on the conversion pair, and the
  MetalHalfConversion requirement it carried.

A half now rounds by the device's form:

- Controlled: the float-controls route (ANV, RADV), unchanged.
- Converted: the device's conversion pair, wherever the profile has
  shaderFloat16. It records NativeHalfConversion, MoltenVK included.
- Device: OpQuantizeToF16 with its denormal arm, which becomes the
  QuantizeForm default. It records NativeHalfQuantize unless the driver
  is measured as Metal's (MetalHalfQuantize).

A Converted module reads a half from its bits by the device's widening,
MoltenVK now included. The tests that held a NaN's bits there now accept
any NaN where the module records NativeHalfConversion: engine_access,
engine_half_moves, engine_typed_threadgroup and engine_texel_nans.

The integer conversion of an int to half, and the integer decode inside
loops and on profiles without shaderFloat16, stay: they have no native
form with a recorded bound.

Docs:
- FAST-PATHS.md: the three half_rounding rows are deleted.
- API.md: the degrade catalogue entries are rewritten without the
  switch.
- HOWTO.md: the half paragraph is rewritten.

Tests: deleted the integer-form tests, and rewrote the engine_native_half
and engine_arith half-rounding tests to the device's forms.

SEMANTICS, ARTIFACT_FORMAT and RUNTIME versions were already bumped to
this lane's reserved numbers.

Verified:
- cargo clippy --workspace --all-targets --all-features -D warnings,
  plain and with --cfg m2v_gpu: clean.
- cargo nextest over half, narrow, texel_round, lower::arith,
  engine_arith, engine_sampler, engine_link, fast_paths, device::tests,
  compile::fit, catalogue, degradation, fitted_variant_notice,
  api_surface, engine_texture, lower::texture and engine_snapshot
  (939 tests): the 11 failures were fixed, and the 161 tests they touch
  re-run green.

* Take the device's float Fma for a half fused multiply-add

The owner's ruling is that the GPU's native arithmetic is promised, with
no exact emulation. Where neither MetalHalfFma (the device's 16-bit Fma
measured as Metal's) nor a 16-bit OpFmaKHR under the float controls is
offered, a half fused multiply-add used to call Route::HalfOdd. That is
the translation's round-to-odd routine of Metal's once-rounded answer;
off MoltenVK it was taken only under FloatMathsPolicy::Exact. It now
takes Route::Native under every policy: the device's float Fma, its
result rounded to half, noted NativeFma.

Removed: Route::HalfOdd, its census name (arith.fma.half), its define,
emit, words and routine arms, and half_form. Routine::words,
Routine::words_among and complete no longer take the quantize form, now
that no routine holds a half rounding. half_sum stays, since the
extended-range blend uses it.

Docs: the fma module docs, the narrow docs, NativeFma's and
DeviceSignedZeroInfNan's docs, their API.md catalogue entries, the
runtime NativeFma declaration, and the FAST-PATHS float-maths row's
mention of the half routine.

Tests:
- The HalfOdd rounding test becomes a test of the two 16-bit routes.
- The mix and dot half tests run through F16Khr.
- The route, words and lane-count tests drop HalfOdd.
- The engine_arith fma, zero-sign, chain and denormal-rounding tests
  expect the inline device Fma, and NativeFma within one half ulp.

Verified:
- cargo clippy --workspace --all-targets --all-features -D warnings,
  plain and with --cfg m2v_gpu: clean.
- RUSTDOCFLAGS='-D warnings' cargo doc --workspace --all-features
  --no-deps: clean.
- cargo nextest over lower::arith, engine_arith, engine_simd, engine_agx,
  lower::sampler::face, fast_paths, catalogue, degradation, api_surface,
  engine_native_half, engine_extended_range, fused and fma (938 tests):
  935 passed. The three engine_arith failures were fixed, and
  engine_arith re-ran 43 of 43 green.

* Bless the public signatures after the half switches' removal

These are the public items lane C's commits removed:
- HalfRoundingPolicy, HalfBlendPolicy and HalfTexelBitsPolicy, and
  their variants;
- FramebufferFetchInputs::half_blends;
- metal::format::half_bits_read_view;
- DeviceProfile::reads_half_texel_bits;
- RuntimeFact::HalfBitsTexture.

RuntimeFact::ExactFormsOverCompilerLimit also loses its half_rounding,
half_blend and half_texel_bits flags.

docs/REFUSALS.md re-derives unchanged: no refusal changed.

Verified:
- signatures.py --check: clean.
- cargo nextest of api_signatures, api_surface, fast_paths, catalogue,
  degradation, device::tests, compile::fit, fitted_variant_notice and
  published_crates: 171 of 171 passed.
- scripts/api-docs: clean.

* 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:20 +02:00
Anees Iqbal d4412c9c95 Key the driver tables by driver and GPU, never by release
One work packet, landed as 3 commits (a1f70a4962..ae43dbc9b3 on archive/development-linear-2026-10-28), in order:

* Key the driver tables by driver and GPU, never by release

The owner's ruling: the driver-release table goes. A driver's measured deviations, defects and
runtime facts were keyed on `driverVersion` windows, and a device whose exact identity (driver,
vendor, deviceID and release) was not measured fell off every measured answer onto the exact
paths, with an informational `metal2vulkan-unmeasured-driver` message, and a release past the last
measured recorded `PrecisionNote::BeyondMeasuredDeviation` in every module.

Now every row of `device::driver_facts` (DEVIATIONS, DEFECTS, MEASURED) and of the runtime's
`driver_defects` names a driver and, where it was measured on some alone, a vendor and a GPU
(`deviceID`, read by `canonical_device_id`), and holds at every release of that driver.

Removed:
- `Measured::{first, last}`, `Standing`, `NAMED_RELEASES`, `MeasuredDevice`, `MEASURED_DEVICES`,
  the `mesa`/`nvidia`/`moltenvk` release encoders;
- `DeviceDescription::{measured_identity, driver_facts_withheld, measured_gpu,
  assumed_unmeasured}` and `DriverFact::assumed_where_unmeasured`;
- the runtime's `DeviceOptions::assume_unmeasured_identity`, `DeviceProperties::driver_facts_withheld`,
  `unmeasured_driver_message` and the `metal2vulkan-unmeasured-driver` message;
- `PrecisionNote::BeyondMeasuredDeviation`, its degrade code `beyond-measured-deviation`,
  `ProfileFields::deviations_beyond` and `DeviceProfile::driver_deviations`;
- the runtime defects' clean list is GPUs alone (the RTX 5080 Laptop GPU, the Radeon 780M).

Rows the release windows made redundant were merged (MoltenVK 1.4.1's and 1.4.2's: 112 deviation
rows to 86, 98 runtime fact rows to 80). Two MoltenVK defects measured on Apple's GPUs now name
MoltenVK on every GPU (`TimestampPoolsAreCounterSampleBuffers`,
`DepthStencilImagesStayGpuOptimized`), keeping the reach the unmeasured-identity rule gave them.

What changes on the committed profiles: RADV's RDNA2 and RDNA3 captures take RADV's
`RobustIndexFetchReadsZero` and `InterpolationNeedsTheWholeQuad`; ANV's Arrow Lake and Tiger Lake
captures take ANV's driver-wide rows (hidden aliased writes, host-transfer bytes, the first sparse
resource's wait, the dispatched copies) and `VertexGroupingNotApples`; NVIDIA's Pascal and RTX 50
desktop captures take `DepthImageKeepsDenormals`; lavapipe takes its 26.2.4 rows
(`SubmissionsWithoutSignalsMerge`, the 8-bit linear filter's bound); MoltenVK's capture takes the
rows measured at 1.4.2 on its deviceID (`MetalFullQuads`, `FragmentDepthKeepsDepth16Codes`,
`BlendlessColorAttachmentsWarn`, the heap colour layouts). A defect fixed in a later release (the
780M's implicit preprocessing, broken at 26.0.8 and clean at 26.2.4) is now the GPU's at every
release.

SEMANTICS_VERSION 1869, ARTIFACT_FORMAT_VERSION 452 (a `PrecisionNote` member removed),
RUNTIME_VERSION 1650.

Verified: clippy clean (workspace, all targets, all features; plain and `--cfg m2v_gpu`); the core
suites (metal2vulkan, -runtime, -air, -devtools) pass but the golden and fixture tables, whose M4
columns and changed outputs are re-blessed on development after this lands.

* 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.

* Re-bless the engine inventory and the golden tables

Blessed on development at b1ae235a12, after the Apple M4 profile left (its columns go) and the
driver tables stopped naming releases (the committed RADV, ANV, NVIDIA, lavapipe and MoltenVK
captures take the rows their drivers and GPUs were measured with, which changes their modules).

Verified: bless_engine_inventory, bless_golden_hashes and bless_engine_goldens each passed
(exit 0) in a tree at b1ae235a12.
2026-10-28 17:24:20 +02:00
Anees Iqbal 6063e66a7c Drop the retired degrade codes
The owner asked for the retired notice codes to go. A kind that no longer
fires is now removed with its code, as any removed public item is; nothing
keeps the history of codes.

- Degradation::RETIRED_CODES (18 codes) is gone, with its rows in
  api_signatures.tsv (re-blessed).
- tests/degradation_codes.txt, the list of every code ever issued, and
  every_code_ever_issued_is_live_or_retired, which held it equal to the
  live and retired codes, are gone.
- codes_are_distinct_and_decode no longer checks retired codes, and
  the_catalogue_lists_every_kind_and_only_them no longer reads retired
  lines.
- docs/API.md's catalogue loses its 18 retired entries; the contract line
  and the runtime's module docs say a code is never renamed, and a kind
  that no longer fires goes with its code. CONTRIBUTING.md drops the
  ever-issued list's rule.
- Validation's C3 test drops the retired code from the announced list it
  judges.

Verified: metal2vulkan-runtime's degradation, catalogue and degradation-site
tests (17 of 17) and validation's
an_announced_deferred_near_equivalent_stays_open_with_its_reason pass;
signatures.py --bless leaves two fewer records.

Originally 3f7ced85af (archive/development-linear-2026-10-28).
2026-10-28 17:24:20 +02:00
Anees Iqbal ec72c052dd Answer as one macOS release, 27.0.1, on every host
The owner's ruling: the runtime imitates the latest measured release
only, not the history of releases. Capabilities (GPU family, features,
limits) still follow the GPU; every answer that differs by release is
macOS 27.0.1's (build 26A434, measured on an Apple M3 Max), on every
host, whatever release it runs.

What changed:
- metal_level.rs becomes metal_release.rs: the public const
  MACOS_RELEASE ("27.0.1") and the release's answers in one place
  (heap block placement per family, the nil-texture stack alignment,
  the mipmap rule, a depth/stencil state's resource ID below Apple10).
  The pixel-format table and the private properties hold 27.0.1's
  answers alone.
- Removed the MetalLevel enum and its 26.7 row, the host-release read
  and the level choice, DeviceOptions::metal_level,
  RawDevice::metal_level and DeviceProperties::metal_level.
- Removed what existed only for 26.7: the indirect-dispatch-of-another-
  type refusal and its predication tracking, the depth/stencil resource
  ID refusal, the M3 Max GPU row counting for heap blocks, PVRTC's
  unmeasured heap placement, and the M4 mipmap stand-in emission.
- Problem::HostReleaseUnmeasured (the Unproven site),
  Problem::IndirectDispatchOfAnotherType and
  Problem::DepthStencilResourceId are gone. The Unproven type is
  untouched.
- Degradations metal-level-below-host, metal-level-not-macos and
  mipmaps-as-apple-m4 are retired (RETIRED_CODES, the retired section
  of docs/API.md); mipmap-tie-rounding's trigger and cost drop the 26.7
  clauses.
- Conformance: the recordings keep their "metal_level": "27.0.1" key as
  a fact about the recording; record and replay compare it with
  MACOS_RELEASE. Venue no longer carries a level.
- Validation's runtime_lane tests run on the default device, with the
  26.7-only tests and level loops removed.
- A runtime unit test now holds the block-compressed kind on ASTC 4x2,
  its one remaining trigger, in place of PVRTC at 26.7.

Docs: docs/API.md, docs/FAST-PATHS.md, docs/RUNTIME-PORTING.md and the
runtime README; docs/REFUSALS.md and docs/METAL-COVERAGE.md
regenerated (CONFORMANCE-COVERAGE.md regenerated, unchanged); the
signature table re-blessed with scripts/api-signatures/signatures.py.

Carried onto development from the parked development-performance branch
(a23f8181d9 there). The three conflicts were that branch's pipeline-record
hook (RawDevice and DeviceOptions fields and their Debug impls), which
development lacks: development's side is kept, without the release field.

Verified: cargo check --workspace --all-targets --all-features, plain and
with --cfg m2v_gpu; refusal_surface.py, signatures.py --check and the two
coverage generators leave the committed files unchanged.

Originally 79bb9749d3 (archive/development-linear-2026-10-28).
2026-10-28 17:24:20 +02:00