-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix UnitarySynthesis with target that contains custom gates #9677
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
Conversation
Since Qiskit#9175 merged the UnitarySynthesis pass has been updated to consider multiple different potential target bases and select the best performing synthesis output found. When UnitarySynthesis is provided a Target object this involves querying the target for the error rates and duration of the instructions used and determining which bases are valid. As part of this lookup the Operator for the 2q gates in the target is needed to determine the characteristics of the 2q gates. However, the code for doing this wasn't considering that some operations in the target might not have sufficient information to build a unitary representation of the operation. This could come up with the use of custom opaque gates in the target that don't have a definition defined or a matrix defined. This commit fixes this oversight and handles the case where building an Operator for the gate fails. Related to #9675 (the underlying issue is in the qiskit-ibm-runtime package for not mapping the "ecr" string to the "ECRGate" object, so this won't close that issue).
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 4320490339
💛 - Coveralls |
The error we're trying to catch and handle is if a gate object doesn't have sufficient information to get it's matrix. This commit updates the try block to only run on the Operator construction so we don't potentially mas errors in the TwoQubitWeylDecomposition construction.
@Mergifyio requeue |
☑️ This pull request is already queued |
@Mergifyio refresh |
✅ Pull request refreshed |
) * Fix UnitarySynthesis with target that contains custom gates Since Qiskit#9175 merged the UnitarySynthesis pass has been updated to consider multiple different potential target bases and select the best performing synthesis output found. When UnitarySynthesis is provided a Target object this involves querying the target for the error rates and duration of the instructions used and determining which bases are valid. As part of this lookup the Operator for the 2q gates in the target is needed to determine the characteristics of the 2q gates. However, the code for doing this wasn't considering that some operations in the target might not have sufficient information to build a unitary representation of the operation. This could come up with the use of custom opaque gates in the target that don't have a definition defined or a matrix defined. This commit fixes this oversight and handles the case where building an Operator for the gate fails. Related to #9675 (the underlying issue is in the qiskit-ibm-runtime package for not mapping the "ecr" string to the "ECRGate" object, so this won't close that issue). * Fix lint * Only run Operator construction under try block The error we're trying to catch and handle is if a gate object doesn't have sufficient information to get it's matrix. This commit updates the try block to only run on the Operator construction so we don't potentially mas errors in the TwoQubitWeylDecomposition construction. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Summary
Since #9175 merged the UnitarySynthesis pass has been updated to consider multiple different potential target bases and select the best performing synthesis output found. When UnitarySynthesis is provided a Target object this involves querying the target for the error rates and duration of the instructions used and determining which bases are valid. As part of this lookup the Operator for the 2q gates in the target is needed to determine the characteristics of the 2q gates. However, the code for doing this wasn't considering that some operations in the target might not have sufficient information to build a unitary representation of the operation. This could come up with the use of custom opaque gates in the target that don't have a definition defined or a matrix defined. This commit fixes this oversight and handles the case where building an Operator for the gate fails.
Details and comments
Related to Qiskit/qiskit-ibm-runtime#726 (the underlying issue is in the qiskit-ibm-runtime package for not mapping the "ecr" string to the "ECRGate" object, so this won't close that issue).