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.