Simplify UnitarySynthesis pass test test_qv_natural #9359
Merged
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
The test_qv_natural UnitarySynthesis test is designed to test that when the pulse efficient flag is set on the default unitary synthesis plugin for the UnitarySynthesis pass the output from synthesis is only emitting entangling gates in the natural direction implemented on the target. However, when running on Windows with Python 3.11 and numpy 1.24 we're seeing a non-zero failure rate (in CI it's ~5% across all jobs) of this test likely do to fp precision. When this failure occurs it appears as the failure from detailed in issues #5832, #9177, and others as the test was creating a pass manager that mirrors the optimization loop used in the preset pass managers. The optimization loop is failing to converge on a fixed depth as the unitary synthesis is oscillating between multiple equivalent outputs. However, in this case the test doesn't need the full complexity of the optimization loop as we're just trying to verify the output of unitary synthesis is equivalent with different options and that the output is valid given different options. This can be done with a single iteration of the loop and doesn't require trying to fully optimize the circuit. This commit reduces the complexity of the test to remove the loop from the optimization stage in the custom pass manager so the test is now just running a single iteration of UnitarySynthesis and comparing the output. This will hopefully make the test stable in CI moving forward avoiding this failure mode.
Details and comments