Validation: a precision note excuses only the words its operations feed, within its bound
What: a candidate's output is judged against Metal's one 32-bit word at a time
(observation_contract::words). An equal word matches. A differing word is excused only by a
recorded note that reaches it: a note with a bound makes a word within it a match, a note with
no bound makes it a noted word, and a word no reaching note excuses is a mismatch.
- Reach is read from the case's AIR (check::output_words): for each output word, the float
lanes it holds and the operation families whose results feed it, followed byte by byte
through bitcasts, lane moves and the zext/shl/or that pack two halves. A store placed at
A * thread_position_in_grid + B bytes gives each thread's words their own facts. A note of the
module that writes the output reaches the words its operations feed; a note of another module
reaches every word, and so does every note of a word the scan cannot follow (a load of memory
the entry writes, a call outside the intrinsic families).
- Bounds a word can carry are checked there, and a word within one matches: DeviceDenormals
only where Metal's and the device's lanes both lie at or below the smallest normal (2^-126,
2^-14 for half), of one sign unless one is a zero; NativeNanEncoding only two NaNs of the
lane's format (it reaches every float lane: a half read from its bits is no operation);
HalfTexelConversion its recorded one half ulp, or +-65504 beside the infinity; the lane
tables and the reassociation bound as before.
- NativeFma, NativeDot, NativeMix and NativeDivision keep no value bound (each states its bound
over the operands, which a word does not carry) and reach only the words their operations
feed. The fixture knows its inputs, so a per-case bound from the operands is a later form.
- SimdgroupAccessOrder reaches only a word another thread of the kernel may write: one a store
the scan cannot place in its own thread's bytes writes.
- Rows record the output's word facts (census output_words). The batch report prints, per case
and in total, the words matched exactly, within each note's bound and only noted, by note,
the unexcused words, and the cases with a word on the fall-back.
- DeviceDenormals's rustdoc states Metal's measured answer per operation: it flushes before
rounding on some (a product, fma, dot and mix just below 2^-126 answer a zero) and keeps a
denormal on others (sin, tan, asin, sinh, asinh, atanh of a denormal), from the public cases
float-products-flushed-before-rounding and nan-model-float-denormals-per-operation. Its
recording rule already covers plain multiplies; no rule changed.
ENGINE_EXECUTOR_ABI is v215: how a match is decided changed and rows record word facts.
Why: a noted difference was excused whole by any recorded note, so a note that could not cause
a word's difference (a division's note beside a product, an access-order note on a kernel whose
threads write disjoint words) hid it, and a bounded note never matched.
Verified on lavapipe (Mesa 26.2.4, the lavapipe image), the 1,168 public cases, job
m3-max-82854 (this tree with the next commit's doc text) against m3-max-82667 at b3d7464945: match 746 -> 773, noted_difference
188 -> 161, mismatch 5 -> 5 (each held open by clipped_primitive_split, as before); words
2,859,015 exact, 30,212 within a bound, 352,820 noted, 0 unexcused. Of the 188 cases noted
before, 34 have an output word on the fall-back (26 every word) and 32 a differing one.
Tests: the validation suite at an earlier tree, m3-max-82839 (1,331 passed, 3 failed; the three
are fixed here), and the touched modules at the same tree as m3-max-82854, m3-max-82855 (136
passed).
This commit is contained in:
1 parent
1c68dd10f4
commit
e31bc61172
27 files changed
+3226
-387
No files matched your search
+7
-4
@@ -1805,10 +1805,13 @@ category, and says what makes an operation carry the note and what may differ. E
|
||||
`float` sum rounded once per lane, a lane-order chain of `half` additions, or a Hillis-Steele
|
||||
scan of them.
|
||||
- `metal2vulkan-degrade-device-denormals` (precision). `PrecisionNote::DeviceDenormals`: `float`
|
||||
denormals follow the device: Metal reads an `f32` denormal operand of its float arithmetic,
|
||||
comparisons, and functions as the zero of its sign and flushes a denormal result to one, where a
|
||||
Vulkan device keeps or flushes them by its own float controls (this translation declares no
|
||||
`DenormFlushToZero`). Recorded where the module leaves an operation's denormals to the device,
|
||||
denormals follow the device. Metal's answer at the denormal boundary is per operation (an Apple
|
||||
M3 Max): it flushes before rounding on some (a product, a fused multiply-add, `dot` and `mix`
|
||||
whose exact result lies just below `2^-126` answer a zero, where a device that rounds first
|
||||
answers `2^-126`) and keeps a denormal on others (`sin`, `tan`, `asin`, `sinh`, `asinh` and
|
||||
`atanh` of a denormal operand answer a denormal), where a Vulkan device keeps or flushes
|
||||
denormals by its own float controls (this translation declares no `DenormFlushToZero`): the
|
||||
device may answer either. Recorded where the module leaves an operation's denormals to the device,
|
||||
on every device: `+ - *`, the comparisons, `fma`, `dot`, `sqrt`, `rsqrt`, `trunc`, `rint` and
|
||||
`ldexp` on `float` (by the device's products); `fneg`, `fabs`, `floor` and `ceil` on `float`;
|
||||
the divisions and the remainder, the device's maths functions (`fast::fmod`'s fused
|
||||
|
||||
Reference in new issue
Block a user