Leave fneg, fabs, floor and ceil unnoted where the M3's Metal keeps their denormals

MoltenVK on the Apple M3 Max runs a SPIR-V `OpFNegate`, `FAbs`, `Floor` and
`Ceil` through Metal's own compiler, which keeps a denormal operand of
negation and absolute value and reads it as the zero of its sign in floor
and ceil, as plain Metal does. The translator noted `DeviceDenormals` on
every such operation, so a strict consumer died on a kernel that negates a
float though the answer is Metal's.

What: a new APPLE9-only `DriverDeviation::MetalUnaryDenormals` (and its
`VkProperty`) on the moltenvk-m3 profile. A function whose float negation,
fabs, floor or ceil the deviation covers records no `DeviceDenormals` for
them and requires the property instead; fabs keeps its Metal-own exemption
on every other profile, and trunc, round, rint, fract, sign and the rest
stay noted (the lane does not check them). `ARTIFACT_FORMAT_VERSION` 486
(the property's tag), `SEMANTICS_VERSION` 1961 (notes and requirements
change).

Evidence: the committed MoltenVK M3 observations of the four denormal
cases (nan_denormals, nan_denormals_fast, dfl, dfl_fast) hash equal to
Metal's on the same M3. The float_denormals gate lane now checks probe rows
-a, 0-a, -(a*b), fabs(a), floor and ceil where the deviation is taken, and
asserts the module requires the property exactly then; the
arith unit test covers each op under each fast and unary setting. Device
runs follow on the GPU job for this stack.

Docs: FAST-PATHS row on device denormals, API.md degrade catalogue,
driver_facts' measurement paragraph, api_signatures.tsv; refusal surface
and signatures checks pass.

(cherry picked from commit f3f65903a395b46b3a8001c4259bb1e4bb7bc203)
This commit is contained in:
Anees Iqbal committed 2026-11-05 02:08:27 -08:00
1 parent a139f39c89
commit 2e2c1ec056
19 files changed
+267 -54

No files matched your search

+5 -3
View File
@@ -3012,9 +3012,11 @@ bound.
measured to read them as Metal does: `+ - *`, the comparisons, `fma`, `dot`, `sqrt`, `rsqrt`,
`trunc`, `rint` and `ldexp` on `float` (by the device's products) but on a device that takes the
measured
`DriverDeviation::MetalFloatDenormals`; and on every device the divisions and the remainder,
`floor`, `ceil` and `fneg`, the device's maths functions (`fast::fmod`'s fused multiply-add,
`fabs`, `sign` and `fract` among them), `mix` by `FMix`, `fast::sqrt` by `Sqrt`, `dot` of
`DriverDeviation::MetalFloatDenormals`; `fneg`, `fabs`, `floor` and `ceil` on `float` but on a
device that takes the measured `DriverDeviation::MetalUnaryDenormals` (MoltenVK on the Apple M3
Max's macOS 27 identity, whose module then requires `VkProperty::MetalUnaryDenormals`); and on
every device the divisions and the remainder, the device's maths functions (`fast::fmod`'s fused
multiply-add, `sign` and `fract` among them), `mix` by `FMix`, `fast::sqrt` by `Sqrt`, `dot` of
vectors of other than two to four lanes, whose chunks' products the device sums where Metal
flushes each one below `2^-126`, and a conversion to or from `double`, where Metal's reading is
not measured. The operations that read a denormal on its bits answer Metal on every device: