Files
metal2vulkan/docs
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
..