Skip to content
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

Test fixes for float precision issues (ie, on Linux aarch64) #2115

Conversation

pmolodo
Copy link
Contributor

@pmolodo pmolodo commented Nov 29, 2022

Description of Change(s)

A collection of float precision tolerance fixes, to resolve test failures on Linux aarch64 platforms (tested on an Arm Neoverse N1).

  • [gf] testGfMatrix: increase tolerance for float AssertDeterminant test
  • [gf] testGfRotation: add a small tolerance for associativity test
  • [examples] testUsdDancingCubeExample - only do diff if on x86_64 (not aarch64)

For more aarch64 related fixes, also see:

Fixes Issue(s)

  • testGfMatrix failure on Linux aarch64

  • testGfRotation failure on Linux aarch64

  • testUsdDancingCubesExample failure on Linux aarch64

  • I have verified that all unit tests pass with the proposed changes

  • I have submitted a signed Contributor License Agreement

pmolodo and others added 3 commits November 29, 2022 14:13
...and lower it for doubles.  Previously, we used the same tolerance
(1e-6) for both floats and doubles.  This sets the epsilon to 1e-5 for
floats, and 1e-10 for doubles.

Running on an ARM system (Arm Neoverse N1) yielded an
absolute error of 1.0259421223521911e-06 for one of the GetInverse
tests, which exceeded this tolerance.  Testing on a more "standard" AMD
cpu (AMD Ryzen Threadripper PRO 3975WX) yielded an error of
9.610960183499514e-07 for the same test - juuuuust below the threshold.

My guess is that the threshold was never meant to be so tight, and that
1e-6 was chosen arbitrarily, and it seemed to work.  1e-5 should provide
a bit more tolerance for float architecture differences.

At the same time, increasing the tolerance for double matrices gives us
increased safety for the code paths that will generally be used for
matrix math.  (In my tests, the maximum error for both ARM and AMD
architectures never got out of the e-15 range, so e-10 should still be
plenty of headroom.)
@pmolodo pmolodo changed the title [gf] testGfMatrix: increase tolerance for float AssertDeterminant test Test fixes for float precision issues (ie, on Linux aarch64) Nov 30, 2022
@sunyab
Copy link
Contributor

sunyab commented Dec 9, 2022

Filed as internal issue #USD-7816

@tallytalwar
Copy link
Contributor

We are fine with this change, but are curious if there are any specific compiler flags being used, like "-ffast-math" or others which break IEEE-754 compliance, as the differences with arm numbers seem a bit large than expected.

Thanks

@pmolodo
Copy link
Contributor Author

pmolodo commented Feb 17, 2023 via email

@pixar-oss pixar-oss merged commit 626b65f into PixarAnimationStudios:dev Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants