-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of multiple available target ops in UnitarySynthesis (#7795
) * Fix handling of multiple available target ops in UnitarySynthesis We recently added support for working natively with a Target to the UnitarySynthesis pass in #7775. However, in that PR we took a naive approach to dealing with the KAK gate for decomposition which would result in the pass not correctly generating an output circuit. Previously, it would just pick the first KAK gate that was present in the target whether or not it was the best choice available. There was also a bug in #7775 where it would only look at the cx error rate instead of the error rate for the selected kak gate. This bug could result in cases of the output of the unitary synthesis would be considered invalid by later passes because it didn't properly respect the constraints of the backend. This commit fixes these issues by instead considering all combinations of 1q and kak gate in the target and picking the combination with the lowest error rate available on the selected qubits. Then the unit testing for the pass is expanded to cover the use of the target to ensure we're testing the full path with a target specified. * Fix test assertions The test assertions in the new tests were previously flawed and would evaluate as True if there were no gates for the in the circuit we were checking. This commit fixes the tests so we're actually asserting things correctly. * Reorganize helper function split This commit reorganizes the internal helper functions to split the target and non-target paths to be completely separate. Then the target path adds a cache for the 2q decomposer to use for the specified qubits so we don't have to do the lookup more than once on subsequent runs. * Fix reverse decomposer selection and add a test * Improve test assertions * Apply suggestions from code review Co-authored-by: Jake Lishman <jake@binhbar.com> * Update test with new fake mumbai backend name * Update docstring to explain basis_gates or target are required Co-authored-by: Jake Lishman <jake@binhbar.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
9d671e5
commit 25be8a2
Showing
2 changed files
with
277 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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
Oops, something went wrong.