Skip to content
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

Generalize CXCancellation optimization pass to generic gate-inverse pairs #6855

Merged
merged 27 commits into from
Aug 26, 2021

Conversation

vadebayo49
Copy link
Contributor

@vadebayo49 vadebayo49 commented Aug 2, 2021

Summary

Preliminary work for 6576
A generic gate-inverse cancellation pass can result in shorter circuit operations. This can lessen device noise and error by reducing the number of operations needed to generate the desired output.

Details and comments

To-do

  • test
  • release notes

@CLAassistant
Copy link

CLAassistant commented Aug 2, 2021

CLA assistant check
All committers have signed the CLA.

@lcapelluto
Copy link
Contributor

Approximate order to attack these TODOs:

  • write lots of tests
    • especially good if we have failing tests for the below tasks
  • accept a pair of inverse gates (e.g. RXGate(-np.pi/4) and RXGate(np.pi/4))
    • make sure the self-inverse gates still work (["h", (^, ^)])
  • error checking: can we make sure that each single item is self inverse, and each item that is a pair is a gate-inverse pair

If you need a break, learn about the differences between lists and tuples (esp. the concept of mutability)

@lcapelluto lcapelluto self-assigned this Aug 9, 2021
lcapelluto
lcapelluto previously approved these changes Aug 19, 2021
@lcapelluto lcapelluto marked this pull request as ready for review August 19, 2021 16:18
@mergify mergify bot merged commit 2d8fe45 into Qiskit:main Aug 26, 2021
mtreinish added a commit to Qiskit/qiskit-metapackage that referenced this pull request Sep 9, 2021
mtreinish added a commit to Qiskit/qiskit-metapackage that referenced this pull request Sep 10, 2021
* Bump version for qiskit-aqua==0.9.5

Bump the meta repo version to include:

qiskit-aqua==0.9.5

* Bump optional dep min versions

It was requested that while we're preparing a new metapackage releases
that we bump the min versions of the application module optional
dependencies to the latest releases to ensure people get the newest
versions when upgrading. This commit bumps the lower bounds.

* Bump version for qiskit-terra==0.18.2

Bump the meta repo version to include:

qiskit-terra==0.18.2

* Add release notes

* Tweak docs config from Qiskit/qiskit#6855

* Exclude template from doc lint

Co-authored-by: Matthew Treinish <[email protected]>
@kdk kdk added this to the 0.19 milestone Nov 15, 2021
@kdk kdk added the Changelog: New Feature Include in the "Added" section of the changelog label Dec 6, 2021
jakelishman pushed a commit to jakelishman/qiskit-terra that referenced this pull request Aug 11, 2023
* Bump version for qiskit-aqua==0.9.5

Bump the meta repo version to include:

qiskit-aqua==0.9.5

* Bump optional dep min versions

It was requested that while we're preparing a new metapackage releases
that we bump the min versions of the application module optional
dependencies to the latest releases to ensure people get the newest
versions when upgrading. This commit bumps the lower bounds.

* Bump version for qiskit-terra==0.18.2

Bump the meta repo version to include:

qiskit-terra==0.18.2

* Add release notes

* Tweak docs config from Qiskit#6855

* Exclude template from doc lint

Co-authored-by: Matthew Treinish <[email protected]>
SamD-1998 pushed a commit to SamD-1998/qiskit-terra that referenced this pull request Sep 7, 2023
* Bump version for qiskit-aqua==0.9.5

Bump the meta repo version to include:

qiskit-aqua==0.9.5

* Bump optional dep min versions

It was requested that while we're preparing a new metapackage releases
that we bump the min versions of the application module optional
dependencies to the latest releases to ensure people get the newest
versions when upgrading. This commit bumps the lower bounds.

* Bump version for qiskit-terra==0.18.2

Bump the meta repo version to include:

qiskit-terra==0.18.2

* Add release notes

* Tweak docs config from Qiskit#6855

* Exclude template from doc lint

Co-authored-by: Matthew Treinish <[email protected]>
mtreinish added a commit to mtreinish/qiskit-core that referenced this pull request Nov 7, 2023
This commit updates the default optimization stage plugin to use the
InverseCancellation pass instead of CXCancellation for optimization
level 1. The CXCancellation pass was hard coded to only cancel runs of
CX gates on the same qubits. This was fine when CX is the target, but
for other targets which aren't using CX the pass had no value. An
alternative, more general, inverse cancellation pass was added in Qiskit#6855
that enables defining arbitrary inverse cancellation rules and
simplifying a dag based on it. This commit updates the default
optimization plugin at optimization level 1 to use this with some common
inverse rules for 2q gates from the standard gate library.

Closes: Qiskit#6576
Closes: Qiskit#7016
Related-to: Qiskit#7112
mtreinish added a commit to mtreinish/qiskit-core that referenced this pull request Nov 7, 2023
This commit updates the default optimization stage plugin to use the
InverseCancellation pass instead of CXCancellation for optimization
level 1. The CXCancellation pass was hard coded to only cancel runs of
CX gates on the same qubits. This was fine when CX is the target, but
for other targets which aren't using CX the pass had no value. An
alternative, more general, inverse cancellation pass was added in Qiskit#6855
that enables defining arbitrary inverse cancellation rules and
simplifying a dag based on it. This commit updates the default
optimization plugin at optimization level 1 to use this with some common
inverse rules for 2q gates from the standard gate library.

Closes: Qiskit#6576
Closes: Qiskit#7016
Related-to: Qiskit#7112
github-merge-queue bot pushed a commit that referenced this pull request Nov 8, 2023
)

* Use InverseCancellation in opt level 1 instead of CXCancellation

This commit updates the default optimization stage plugin to use the
InverseCancellation pass instead of CXCancellation for optimization
level 1. The CXCancellation pass was hard coded to only cancel runs of
CX gates on the same qubits. This was fine when CX is the target, but
for other targets which aren't using CX the pass had no value. An
alternative, more general, inverse cancellation pass was added in #6855
that enables defining arbitrary inverse cancellation rules and
simplifying a dag based on it. This commit updates the default
optimization plugin at optimization level 1 to use this with some common
inverse rules for 2q gates from the standard gate library.

Closes: #6576
Closes: #7016
Related-to: #7112

* Add sx sx dagger inverse pair to pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants