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.
This commit is contained in:
1 parent
2a14a4a363
commit
79166a74b1
123 files changed
+1409
-5787
No files matched your search
+17
-22
@@ -85,13 +85,15 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
|
||||
`robustBufferAccess`, buffer accesses and vertex input are left to it. (MoltenVK advertises the
|
||||
feature without implementing it; there such accesses are not contained, as on native Metal.)
|
||||
- **The device's arithmetic.** The device's own maths library, divisions, fused multiply-adds,
|
||||
`float` denormals, and rounding order of `dot`/`mix`/`fast::sqrt`, on every device and with no
|
||||
exact form. Each records a precision note with its bound; on MoltenVK on an Apple GPU, whose
|
||||
`float` functions are Metal's own, they are Metal's answers.
|
||||
`float` denormals, rounding order of `dot`/`mix`/`fast::sqrt`, NaN bits, and the operand of
|
||||
`fmin`, `fmax`, `min3`, `max3`, `clamp` and `saturate`, on every device and with no exact form.
|
||||
Each records a precision note with its bound; on MoltenVK on an Apple GPU, whose `float`
|
||||
functions are Metal's own, they are Metal's answers, but for a NaN's bits where the device is
|
||||
not measured to answer Metal's.
|
||||
- **Fast native forms off Apple's GPUs.** The device's own sampler (its filter of a two-plane
|
||||
YCbCr texture among them), texel conversions, NaN bits and min/max. Each records a precision
|
||||
note with its bound, and each has an exact switch. The device's own `half` rounding and its
|
||||
blend of a `half` color have none: each records its note.
|
||||
YCbCr texture among them) and texel conversions. Each records a precision note with its bound,
|
||||
and each has an exact switch. The device's own `half` rounding and its blend of a `half` color
|
||||
have none: each records its note.
|
||||
`DevicePolicy::exact_answers()` turns on every exact form but sampling's, Metal's filter of a
|
||||
two-plane YCbCr texture (`YCbCrFilterPolicy::Exact`) included; `sampling =
|
||||
SamplingPolicy::Exact` emulates Metal's sampler too.
|
||||
@@ -202,9 +204,9 @@ measured takes the conservative route.
|
||||
|
||||
Metal semantics the translation keeps on every device, beyond Vulkan's: Metal's 32-lane
|
||||
simdgroups (including lockstep races on threadgroup memory within a barrier interval), and the
|
||||
bit-exact `fneg`, `fabs` and `half`-to-`float` widening of NaNs and denormals. Under the exact
|
||||
switches it also keeps Metal's canonical NaNs and Metal's operand choice in `fmin`, `fmax`,
|
||||
`min3`, `max3` and `clamp`.
|
||||
bit-exact `fneg`, `fabs` and `half`-to-`float` widening of NaNs and denormals. A NaN's bits and
|
||||
the operand `fmin`, `fmax`, `min3`, `max3`, `clamp` and `saturate` pick beside a NaN or between
|
||||
two zeros are the device's.
|
||||
|
||||
What the runtime enables for itself outside the vocabulary enters no enable set, compile profile
|
||||
or fingerprint: among it the extensions of its dma-buf fallback for no-copy memory whose pointer
|
||||
@@ -1477,12 +1479,6 @@ fast forms record, and each `PrecisionNote`'s rustdoc states its bound.
|
||||
`TextureWriteRoundingMode::NearestEven`, whose rounding no device's conversion gives
|
||||
(`StageModule::rounded_colors`). Cost: the fragment function rounds each such channel to nearest
|
||||
even before it writes it: about 35 more instructions per channel.
|
||||
- `metal2vulkan-degrade-shader-half-color-bits` (performance). `ShaderHalfColorBits`: A fragment
|
||||
function writes a `half` to a half-float color attachment as the bits of the half Metal stores,
|
||||
through a 16-bit output, on a device that does not store a 32-bit output's NaN as Metal does
|
||||
(`StageModule::half_bit_colors`). Cost: the fragment function writes each such output as its
|
||||
half's bits through a 16-bit output: about 20 more instructions per output, and the attachment
|
||||
takes no Vulkan blend of one and zero.
|
||||
- `metal2vulkan-degrade-render-pass-split` (performance). `RenderPassSplit`: A Metal render pass
|
||||
runs as several Vulkan render pass instances: a framebuffer fetch through the pixel interlock
|
||||
keeps its attachment out of its draws' subpass, and the pass's draws leave different attachments
|
||||
@@ -3018,15 +3014,14 @@ fast forms record, and each `PrecisionNote`'s rustdoc states its bound.
|
||||
round as Metal's conversion does.
|
||||
- `metal2vulkan-degrade-native-nan-encoding` (precision). `PrecisionNote::NativeNanEncoding`: Native
|
||||
device maths: a `float` or `half` operation's NaN result is the device's, its sign and payload
|
||||
unselected, on a device whose arithmetic is not measured to answer Metal's canonical NaN, under
|
||||
`NanMinMaxPolicy::Native`. Also recorded where a `half` read from its bits is the device's
|
||||
widening under the float controls (ANV, RADV): a NaN's bits the device's, where Metal widens
|
||||
every `half` NaN to `0x7fc00000`.
|
||||
unselected, where Metal answers a NaN the device is not measured to answer (every NaN but
|
||||
Metal's canonical one on a device measured to answer that, MoltenVK on an Apple GPU). Also
|
||||
recorded where a `half` read from its bits is the device's widening under the float controls
|
||||
(ANV, RADV): a NaN's bits the device's, where Metal widens every `half` NaN to `0x7fc00000`.
|
||||
- `metal2vulkan-degrade-native-min-max` (precision). `PrecisionNote::NativeMinMax`: Native device
|
||||
maths: Metal's `fmin`, `fmax`, `min3`, `max3`, `clamp` or `saturate` (its `clamp(x, +0, 1)`) on
|
||||
`float` or `half` is the device's `GLSL.std.450` `NMin`, `NMax` or `NClamp`, not the translation's
|
||||
selects of Metal's operand, on a device not measured to answer Metal's, under
|
||||
`NanMinMaxPolicy::Native`.
|
||||
`float` or `half` is the device's `GLSL.std.450` `NMin`, `NMax` or `NClamp`, on a device not
|
||||
measured to answer Metal's operand.
|
||||
- `metal2vulkan-degrade-native-dot` (precision). `PrecisionNote::NativeDot`: Native device maths:
|
||||
Metal's `dot` on `float`, or on `half` where its fused multiply-add is not the measured 16-bit
|
||||
one, is the device's `OpDot` (a `half` one summed in `float` and rounded once to `half`), not
|
||||
|
||||
Reference in new issue
Block a user