Repository navigation
fix(color): snap sub-epsilon solver residue so the corpus revalidates anywhere (#4370) - #4385
Conversation
… anywhere (#4370) The golden corpus could only be revalidated on the machine that generated it. CI reported: stage physical_drive differs from reference for bt2020-rgbww-05: max abs error 1.58114e-08 exceeds 1e-12 Not libm noise. 1.58114e-08 is sqrt(2.5e-16) to every digit. That vector's white channels carry a residual that is numerically zero -- emitter_light[4] is 1e-15 -- and the inverse response takes a square root on odd indices. sqrt has a derivative of 5e7 at 1e-16, so a last-bit difference in a quantity that is already zero is amplified eight orders into drive space, where a 1e-12 absolute budget sees it. So the solve now zeroes residue below 1e-12. The threshold is not a judgement call: across the corpus's 7,436 nonzero entries, 102 fall below 1e-12 and the next real value is above 1e-9 -- a clean three-order gap, so any cut inside it partitions identically. This is the "deterministic tie-breaks" the contract asks P5/P7 to publish, and the "deterministic policy" its numerical-admission section requires of the inverse response. Blast radius, measured rather than predicted: 78 corpus entries change, all to 0.0, the largest by 5.48e-08 and every one of them an amplified residual. The exported C++ table changes three literals, 1e-15 and 4e-15 to 0.0. One assertion moved, and in the right direction. `below_floor` in tests/fl/gfx/pipeline.cpp was 8; it is now 5. Three of those eight were excluded from the dE budget only because their reference asked for 1e-15 of light -- nonzero, below one Q16 unit, so `sub_ulp` fired. Zero is representable, so those three are now measured like any other vector, and they meet the budget: worst dE2000 and worst luminance are unchanged, which is why nothing else below it moved. Corpus now recomputes bit-identically here as before -- max_stage_abs_error 0.0 -- and no longer depends on the last bit of the machine that produced it. Unblocks #4360. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe solver now snaps drives below ChangesDrive zero snapping
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #4370. Unblocks #4360.
The golden corpus could only be revalidated on the machine that generated it. CI:
It was never libm noise
1.58114e-08issqrt(2.5e-16)to every digit shown.bt2020-rgbww-05carries a residual that is numerically zero —emitter_light[4] = 1e-15— and the inverse response takes a square root on odd indices:sqrthas a derivative of5e7at 1e-16. A last-bit difference in a quantity that is already zero is amplified eight orders into drive space, where a 1e-12 absolute budget catches it. On the generating machine the recomputation is bit-identical, so the budget had never been exercised and the amplification never showed.The threshold is not a judgement call
The solve now zeroes residue below 1e-12. Across the corpus's 7,436 nonzero entries:
Nothing lies between 1e-12 and 1e-9, so any cut inside that gap partitions identically. The six entries in 1e-9..1e-8 are the
sqrtimages of the same residue and disappear with it.This is what the contract already asks for — P5/P7 must publish "deterministic tie-breaks", and the numerical-admission section requires "a deterministic policy" of the inverse response. A residual that is 0.0 on one machine and 1e-15 on another is exactly the non-determinism those clauses forbid.
Blast radius, measured
0.0; largest change5.48e-08, every one an amplified residual. No real value moves.1e-15and4e-15→0.0.One assertion moved, in the right direction
below_floorintests/fl/gfx/pipeline.cppwas 8, now 5. Three of those eight were excluded from the ΔE budget only because their reference asked for 1e-15 of light — nonzero, below one Q16 unit, sosub_ulpfired. Zero is representable, so those three are now measured like any other vector. They meet the budget, which is whyworst_de_above_floorandworst_luminanceare unchanged and nothing below that line moved. Fewer exclusions is the improvement, not lost coverage.Verification
max_stage_abs_erroris still0.0here — bit-identical as before — and no longer depends on the machine.bash lint,bash test --py --cleanandbash test --cpp --cleanall clean on exit code; 305/305 unit, 84/84 examples.🤖 Generated with Claude Code
https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9
Summary by CodeRabbit