Files
metal2vulkan/docs
Anees Iqbal 038bad9386 Take the device's conversions in the storage-form fetch and blend, imageblock tiles and snapshots
The storage form, implicit imageblocks and snapshot reads take the device's conversions, and
the MetalFloatStorageNans driver fact, which nothing reads once the blend keeps the device's
NaN, is deleted.

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

* Take the device's conversions in the storage-form fetch and blend, imageblock tiles and snapshots (a049fcd0ee)

Rule 1 (owner, 10-29): where the device has a native answer, it is the only
form. The interlocked storage form, implicit imageblocks and snapshot reads
are capability and stay; the arithmetic inside them still computed Metal's
own bits. Each now takes the device's form, its difference noted with an
existing note:

- lower/fragment/fetch.rs: an 8-bit sRGB attachment's read and write through
  its uint view decode and encode by arith::pack's unorm4x8_srgb forms (the
  8-bit instruction and the MSL transfer by the device's Pow) instead of
  Metal's twelve-bit table (math::unpack/pack with the table); the module no
  longer declares the table for it. DevicePackConversion.
- fetch.rs: an 8-bit unorm blend's result is stored as computed, the storage
  image's store converting it (unorm8_write's exact product with 255, the
  NaN select and the clamp are gone). DeviceColorConversion, recorded in the
  storage write's plan.
- fetch.rs: a 16-bit float blend no longer makes every NaN 0x7FC00000; the
  NaN is the device's arithmetic's, which the store converts.
  stage_io/color_write.rs records DeviceNanEncoding for every such blend and
  no longer relies on VkProperty::MetalFloatStorageNans (storage_nan
  deleted; the deviation stays as a measured fact, now required by no
  module).
- lower/stage_io/word_color.rs: an 8-bit sRGB word's encode is
  arith::pack::pack (srgb_table and encode's table parameter deleted; its
  two other callers updated). DevicePackConversion.
- lower/access/tile.rs: a normalized implicit imageblock access unpacks and
  packs by arith::pack (instruction or its definition), a half access rounding
  the unpacked float once more by narrow::round, instead of math::unpack/pack
  with Metal's table and the exact c/D-to-half grid (half_channels,
  Norm::grid deleted). DevicePackConversion, but for a float conversion of a
  format GLSL.std.450 names on a device whose float functions are Metal's
  (MoltenVK), as air.pack notes it.
- lower/fragment/snapshot.rs: a normalized form's read decodes c times the
  f32 nearest 1/D (signed: at least -1) instead of exact integer division.
  DevicePackConversion.
- lower/arith/color_write.rs: the unorm rule is gone from round and
  channel_words (normalized deleted); a unorm channel is the device's
  conversion's. FloatNearestEven stays (Metal's textureWriteRoundingMode, a
  capability), as does unorm8_code for the private alpha test.

Dead in this tree and deleted: extended_range::blend::unorm8_write,
texel_round::grid_step, srgb::STEP_WORDS. Word estimates follow
arith::pack::words.

Tests: blend8's two blend checks now hold the blend's result, stored by
Vulkan's conversion, to Metal's code (unorm8_write's test deleted with it);
color_write checks that round takes no unorm rule (fails on the old form)
and its scalar/half test uses the small-float rules; snapshot_codes checks
the device's product c * fl(1/D) (asserted to differ from the quotient at
some code; the old exact test failed on the new form, seen); the
engine_fetch_blend8 tests require DeviceColorConversion (unorm8) and
DevicePackConversion (sRGB), which fail on the old form;
engine_fetch_blend16 requires DeviceNanEncoding on every profile and no NaN
property; engine_tile's normalized tests hold reads, stores and the
read-back within DevicePackConversion's bound (3 f32 ulp, one half step
more, codes within one) on the formats the interpreter models (no Pow: the
sRGB formats, and NaN stores, are the device lane's). Validation lanes: framebuffer_fetch::blend8 asserts the native note
alone on an interlock device and unorm8 channels within one code;
framebuffer_fetch::srgb accepts device-pack-conversion as a conversion;
tile_normalized checks reads and stores within DevicePackConversion's
bound; blend16::nans docs.

Conformance: known-gaps.tsv gains eight Apple M3 Max rows for
fetch-ordered-{bgra8unorm,rgba8unorm}-srgb (x1: a code apart, within the
note's bound; x2/x3/x3-depth: two, compounded across draws), the device's
sRGB conversion in the interlocked storage form.

Docs: API.md catalogue (DevicePackConversion, DeviceColorConversion,
DeviceNanEncoding, the sRGB word paragraph, the fetched sRGB and unorm8
blends), FAST-PATHS.md's air.pack row and the fetched-blend gap, the note
and deviation doc comments.

SEMANTICS_VERSION 1916 (emitted modules change). No public API change.

* Delete the MetalFloatStorageNans driver fact, which no module reads (e3f82758cb)

After the storage form's 16-bit float blend stopped making every NaN
0x7FC00000 (the device's NaN, noted DeviceNanEncoding), nothing reads
DriverDeviation::MetalFloatStorageNans or VkProperty::MetalFloatStorageNans:
no module requires the property and no lowering asks the profile for the
deviation. AGENTS.md's no-dead-code rule, and the owner's approval of deleting
unread facts (the 10-27 unread-fact sweep, 7b4509b9c4's precedent), remove
them.

Removed: both public variants and their docs; the five measured rows
(MoltenVK on Apple9, RADV on the 780M, NVIDIA on the RTX 3090 and the RTX
5080 Laptop GPU, lavapipe) and their measurement paragraph in
device/driver_facts.rs; the derive and profile mappings; the codec's
VkProperty entry; the driver_facts test rows (the deviation-to-property
table, the Apple, NVIDIA, lavapipe and 780M expectations); the
engine_fetch_blend16 split of interlock profiles by the deviation and its
"no such property required" assertions there and in engine_extended_range.
engine_fetch_blend16 still requires DeviceNanEncoding on every interlock
profile.

Corpus observations name the deviation only inside environment.profile, a
free-text Debug string of the profile (format!("{profile:?}"), a
serde_json::Value field nothing parses into an enum), so no reader changes
and no observation file is rewritten: the established handling, as the
MetalHalfQuantize name removed on 10-28 still stands in 152 observation
files. The profiles that took the deviation (moltenvk-m3, the two 780M RADV
profiles, the three lavapipe profiles, nvidia-rtx5080-laptop) change
fingerprint, so their golden cells and evidence re-key.

ARTIFACT_FORMAT_VERSION 478 (the encoded VkProperty list changed; the
orchestrator renumbers). api_signatures re-blessed (two variant rows gone);
REFUSALS.md regenerated, unchanged.

Verified: cargo fmt; clippy --workspace --all-targets --all-features -D
warnings, plain and with --cfg m2v_gpu; rustdoc -D warnings; nextest by
exact module: device::tests::{driver_facts,profile}, cache::tests,
cache::codec::tests, tests::fast_paths, tests::engine_fetch_blend16,
engine_extended_range::half_float_storage_slots_leave_their_writes_to_the_device,
api_signatures, api_surface, refusal_surface (130/130); validation index,
observation, observation_contract, c3, requirement,
candidate::platform::device (118/118).
2026-10-29 15:43:49 +02:00
..