Repository navigation
Model L reconstruction oracle: steps 4-6 in float32 (the gap #135 found) - #137
Merged
Merged
Conversation
…rms (table blend: float32) The spec side's order is float32 round-to-nearest unless stated. The oracle ran the candidates, combination and blend in float64; where a large fallback colour is cancelled in the blend, that lands many FP16 steps from the model. l_post_check gains special-colour cases (NaN, 1e3..1e6, negatives, +inf) with ill-conditioned pixels reported apart. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #89
Settles the gap #135 found between
l_post_reconand its oracle on frames with special input values.Which side is wrong: the oracle. The spec side's order for Model L's reconstruction is float32 round-to-nearest
unless stated, with fused multiply-adds where it says so. The kernel follows that order. The oracle (
recon.py) ransteps 4 to 6 in float64:
Where a large fallback colour (about 1e3 and up, the special values' 1e3 ... 1e6) is cancelled in the blend,
H^ = fused((C - Hl) beta' + Hl) rounds C - Hl to float32 first. A small H^ then carries the rounding of a large Hl, and
the float64 form lands many FP16 steps away. Reset frames have the most of these, since every sample is the fallback.
This matches what #135 sees: clusters, about twice as many on reset frames. The other special values behave the same
in both forms:
What changes
clean/l/reference/recon.py: with the table's new"blend": "float32", steps 4 to 6 run in float32, one roundingper operation:
Model M's entry keeps
"blend": "float64", so the byte-exact reduction to Model M's oracle still holds.clean/l/reference/table.py: theblendentries.clean/l/tests/test_l_recon.py: the linear-combination, reset and offset-0.05 checks now recompute the float32order exactly (they compared float64 at 1e-12). New: the blend's float32 form holds exactly with large fallback
colours, and the float64 form is more than 1 FP16 step away there.
clean/l/runner/l_post_check.py: three special-colour cases with the encoder's special values. The pixels wherethe blend cancels a large Hl (amplification of 256 or more) are reported apart. The criteria still cover every
pixel.
clean/l/FORMATS.md: the blend precision.The kernel does not change.
Tested
python -m unittest discover -s clean/l/tests -t .: 49 tests OK.clean.tests.test_post_referenceOK.pixels have a fallback colour of 1e3 or more.
GPU record
RX 9070 XT, locked GPU slot
model-l-blend-1, head c23653e, 2 seeds, synthetic data,clean/l/runner/l_post_check.py(kernel unchanged, oracle with the float32 blend).
case.
against the 0.01 % allowed.
next FP16 value. The kernel's hardware log2 (
v_log_f32, not correctly rounded) lands on the other side. Forcingthat one feature to the next FP16 value in the oracle gives 0 steps at all 4 values (0 over 1 step anywhere,
4 values differ in all). The step grows to 2 because the window's green also holds a clamped negative colour
(E = -1.44), so the half accumulators cancel.
Not tested
was set for a float32 gather. With half accumulators, a single input-feature rounding flip (hardware log2) can
move an output by 2 steps.