Repository navigation
Conversation
test_bayer_sampler_bit_exact asserted that _sample_bayer_same_color() and _sample_cfa_same_color() return bit-identical floats. Both sum the same taps in the same order, but release builds use -ffast-math and -march=native, so the compiler is free to fuse or reorder the two loops differently, and whether it does depends on the CPU. With clang on an AVX-512 machine 11 of the 153456 samples differ, by at most 1.0e-07 relative; the test then fails, which is why the LLVM job of the Linux CI fails on some runners and passes on others. Compare within 1e-6 relative instead, and stop claiming bit-for-bit equality in the comments.
6 tasks done
Collaborator
|
I had Codex (GPT-6.1 Sol) investigate this before I saw the PR. It found the same issue, reproduced it locally by forcing different CPU optimisations with Clang 22: Skylake target failed 10/10, Haswell passed 10/10. It then found the PR, tried the proposed solution and verified that it is working. |
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.
Summary
test_hdr_alignment_internal/test_bayer_sampler_bit_exactasserts thatthe Bayer fast sampler and the general CFA sampler return bit-identical
floats. Both sum the same taps in the same order, but release builds use
-ffast-math -march=native, so the compiler can fuse or reorder the twoloops differently depending on the CPU. That is why
Linux_ubuntu:26.04_LLVM22_Release_testsfails intermittently sincectest was enabled in all Linux jobs (#22799): 3 of the last 5 master runs.
On an AVX-512 machine with clang 18, 11 of 153456 samples differ, by at
most 1.0e-07 relative. The test now compares within 1e-6 relative, and
the comments no longer claim bit-for-bit equality. No production code
changes.
Checklist
_()(none added).RELEASE_NOTES.mdentry was added: not needed, test-only change.Test instructions
Configure with
-DBUILD_TESTING=ONand OpenCV, Release build, thenctest -R test_hdr_alignment_internal. On master it fails on an AVX-512x86 box with clang 18; with this change it passes. Not tried with
clang 22 or GCC 16.
AI assistance
Written with Claude Code (Anthropic), which reproduced the failure and
wrote the change; I reviewed it.