-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: math: interpolation: disable floating point contraction #81648
tests: math: interpolation: disable floating point contraction #81648
Conversation
1feb2b8
to
bed8f5c
Compare
Hi @JordanYates, could you please take a look and share your thoughts about the proposed solution and its alternatives? |
I believe I was assigned because I wrote the test, and while I have nothing against the change, this is not an option I have seen before (and it is not present elsewhere in the project). I'm not in a position to know whether options like these are fine by the project, or if we should instead be relaxing the constraints. I'll try again in discord to get someone with a better idea to review. |
Well, you wrote not just the test, but also the interpolation function itself, so at least you're in a position to know what its design requirements are, and what exactly should be tested. But yes, maybe we need a wider discussion about the solution. |
Taking a closer look at this, I find it hard to believe that any floating point operations are so inaccurate that Can you share reproduction steps for the test failure? |
It's the difference between contracted and non-contracted ways of calculating the values subjected to rounding. The The reproduction is as easy as running the test, but, unfortunately, it involves our Clang-based compiler for ARC. Although I think it should be reproducible with any other flavour of Clang, because this compiler behavior is not our addition, but a Clang default. |
That was the point I was making with the "even" fractions, none of them should result in a multiple near
I have tried running the test under my native clang and it passes without problems:
|
OK, that's what I have:
|
Can you add some manual prints in there to output the loop index, the value of |
I've found a previously recorded set of failing numbers: |
Sure, will do in half a hour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy with the solution, as long as a comment is added as a reference for why it is there (see suggestion).
For
For
|
This test cannot tolerate any loss of precision, including the one caused by the compiler contracting floating points operations together, like in fused multiply-add (FMA). Some toolchains enable FP contraction by default, so disable it for the specific test and let the user decide themselves whether precision or performance is needed for their specific application. Co-authored-by: Jordan Yates <[email protected]> Co-authored-by: Ilya Tagunov <[email protected]> Signed-off-by: Ilya Tagunov <[email protected]>
bed8f5c
to
e9e058b
Compare
This test cannot tolerate any loss of precision, including the one caused by the compiler contracting floating points operations together, like in fused multiply-add (FMA). Some toolchains enable FP contraction by default, so disable it for the specific test and let the user decide themselves whether precision or performance is needed for their specific application.
One alternative is to include the pragma into the interpolation function itself and make its behaviour more deterministic. Still, I think I should start with the less intrusive approach.
Another alternative would be to rework the interpolation function to remove the contraction site. For that we basically need to split the FMA expression into two.