Skip to content

Conversation

mtreinish
Copy link
Member

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).

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).
@qiskit-bot
Copy link
Collaborator

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:

  • @Qiskit/terra-core

@coveralls
Copy link

coveralls commented Feb 28, 2023

Pull Request Test Coverage Report for Build 4320490339

  • 11 of 11 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 85.357%

Totals Coverage Status
Change from base Build 4320490075: 0.002%
Covered Lines: 67985
Relevant Lines: 79648

💛 - Coveralls

@mtreinish mtreinish added the Changelog: None Do not include in changelog label Mar 1, 2023
@jakelishman jakelishman added the stable backport potential The bug might be minimal and/or import enough to be port to stable label Mar 2, 2023
@jakelishman jakelishman added this to the 0.23.3 milestone Mar 2, 2023
@jakelishman jakelishman removed the stable backport potential The bug might be minimal and/or import enough to be port to stable label Mar 2, 2023
@jakelishman jakelishman removed this from the 0.23.3 milestone Mar 2, 2023
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.
@jakelishman
Copy link
Member

@Mergifyio requeue

@mergify
Copy link
Contributor

mergify bot commented Mar 3, 2023

requeue

☑️ This pull request is already queued

@jakelishman
Copy link
Member

@Mergifyio refresh

@mergify
Copy link
Contributor

mergify bot commented Mar 3, 2023

refresh

✅ Pull request refreshed

@mergify mergify bot merged commit 258b4b5 into Qiskit:main Mar 3, 2023
@mtreinish mtreinish deleted the opaque-gate-unitary-synth branch March 3, 2023 13:15
king-p3nguin pushed a commit to king-p3nguin/qiskit-terra that referenced this pull request May 22, 2023
)

* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants