Slightly relax tolerance in a test case of Apply1InteriorArbitrary#671
Merged
Merged
Conversation
The test case in third_party/qsim/tests/mps_simulator_test.cc on line 262 fails if the Eigen linear algebra library is updated to a recent version available from https://gitlab.com/libeigen/eigen. Specifically, commit 59498c96 in the Eigen repo (which can be seen at https://gitlab.com/libeigen/eigen/-/merge_requests/1663) changed the code in Eigen/src/Core/arch/Complex.h for pmul() to use a fused multiply-add-subtract (FMA) instruction (fmaddsub) instead of the previous separate multiply and add-subtract instructions. The new code improved accuracy for many of the tests in mps_simulator_test.cc, slightly worsened accuracy for some of the tests, and in the case of the one on line 262, made it cross the absolute tolerance value of 1e-5 by a very small amount. After considering various alternatives, the least-worst option seems to be to increase the tolerance for this one case. The qsim repository on GitHub has its own vendored copy of Eigen, so this change is not strictly necessary; however, if we ever update qsim's internal copy of Eigen, then this change will become relevant. Note: the original debugging & solution are the work of @pavoljuhas.
Collaborator
|
The CI errors show on the master branch too and are unrelated to this change. Perhaps this can be merged as is for the sake of consistency with downstream fix? |
Collaborator
Author
|
That sounds reasonable to me. It currently needs reviewer approval from @sergeisakov. (Sergei, this is the same tiny change as was made in the internal code base recently for the same problem, so hopefully will take next to no time to review.) |
pavoljuhas
approved these changes
Sep 5, 2024
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.
The test case in
third_party/qsim/tests/mps_simulator_test.ccon line 262 fails if the Eigen linear algebra library is updated to a recent version available from https://gitlab.com/libeigen/eigen. Specifically, commit 59498c96 in the Eigen repo (which can be seen at https://gitlab.com/libeigen/eigen/-/merge_requests/1663) changed the code inEigen/src/Core/arch/Complex.hforpmul()to use a fused multiply-add-subtract (FMA) instruction (fmaddsub) instead of the previous separate multiply and add-subtract instructions. The new code improved accuracy for many of the tests inmps_simulator_test.cc, slightly worsened accuracy for some of the tests, and in the case of the one on line 262, made it cross the absolute tolerance value of1e-5by a very small amount. After considering various alternatives, the least-worst option seems to be to increase the tolerance for this one case.Note: the qsim repository on GitHub has its own vendored copy of Eigen, so this change is not strictly necessary; however, if we ever update qsim's internal copy of Eigen, then this change will become relevant.
The original debugging & solution are the work of @pavoljuhas.