Repository navigation
upscale: state the accuracy contract on low-contrast input; test holds well-conditioned samples to ErrorBound - #152
Merged
Conversation
…st that holds the well-conditioned part to ErrorBound TestOracleLowContrast left 0.9 % of samples outside ErrorBound (up to 4.7e-3) with the cause "not established". It is the conditioning of EASU's edge analysis: lenX = sat(|d-b| * rcp(max(|d-c|, |c-b|))) is 0/0 where three different colours share a luma, and the reference defines no answer there. The oracle sees the float32 colours in float64 (a tie is 7e-9 from zero); the float32 path rounds the same luma to exactly 0 or 6e-8. Each reports an edge strength anywhere in [0,1] and the kernel reshapes. Present since v0.21.0, on the scalar and the vector paths alike. The test now classifies each sample: every well-conditioned sample (1.13 million, worst 3.4e-5) is within ErrorBound, and any sample is within ErrorBound of the range of its four nearest colours. Breaking the arithmetic (ln scale 0.5 to 0.49) fails the new test and passed the old one. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Nov 29, 2026
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 #141 (item 1 of "What is not established").
Cause
Not an arithmetic defect: the conditioning of EASU's edge analysis. For each bilinear corner,
lenX = sat(|d-b| * rcp(max(|d-c|, |c-b|)))on three neighbouring lumas. Where different colours share a luma (about 13 luma values on 3-level noise) the denominator and the numerator are both zero in exact arithmetic: 0/0, with no answer defined byffx_fsr1.h. A precision answers with rounding noise: the oracle sees the float32 colours in float64 (a tie is 7.45e-9 from zero), the float32 path rounds the same luma to exactly 0 or to 6e-8. Worst case found: edge strength 0 against 0.94, which reshapes the kernel; EASU's clamp bounds the output change by the range of the four nearest colours.Found by locating the divergence (dir identical to 6 digits,
ln1.05 against 1.88, then per corner), then confirming by classification: 42 228 of 1.17 M samples have such a neighbourhood and hold all 10 394 outliers; the other 1 130 097 are within 3.4e-5.Bisect
Same probe on v0.21.0, v0.22.0, v0.23.0, v0.24.0, v0.25.0, scalar and
GOEXPERIMENT=simd: worst 4.67e-3 and 11 208 to 11 211 samples outside on every one (10 394 at v0.25.0 after the integer phase fix). Present since the package began; not introduced by the vector kernels, the Scaler or the AVX-512 gather. Worker count does not enter (bytes identical across counts). The Vulkan/Metal module is not merged, so not probed.Change
No code change: the bound is restated, because removing the ambiguity would add a flush to every vector kernel (and shader) and deviate from the reference where it is itself undefined.
TestOracleLowContrastnow asserts: every well-conditioned sample withinErrorBound; any sample withinErrorBoundof the range of its four nearest colours; and that the corpus still exercises degenerate samples. Doc comment and README updated.Regression value: changing
ln *= 0.5to0.49passes the old test (worst 4.8e-3 under its 1.2e-2 local range, 1.4 % under 3 %) and fails the new one (6 810 well-conditioned samples outside, worst 6.0e-4).go test ./upscale/...green with and withoutGOEXPERIMENT=simd;gofmt -lempty.🤖 Generated with Claude Code