Skip to content

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

Merged
mergify[bot] merged 27 commits into
Qiskit:mainfrom
vadebayo49:issue-6576/general-cancellation-pass
Aug 26, 2021
Merged

Generalize CXCancellation optimization pass to generic gate-inverse pairs#6855
mergify[bot] merged 27 commits into
Qiskit:mainfrom
vadebayo49:issue-6576/general-cancellation-pass

Conversation

@vadebayo49
Copy link
Copy Markdown
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
Copy Markdown

CLAassistant commented Aug 2, 2021

CLA assistant check
All committers have signed the CLA.

Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread test/python/transpiler/test_inverse_cancellation.py Outdated
@lcapelluto
Copy link
Copy Markdown
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
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread test/python/transpiler/test_inverse_cancellation.py Outdated
Comment thread releasenotes/notes/cx-cancellation-pass-generalization-538fb7cfe49b3fd5.yaml Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread test/python/transpiler/test_inverse_cancellation.py Outdated
lcapelluto
lcapelluto previously approved these changes Aug 19, 2021
@lcapelluto lcapelluto marked this pull request as ready for review August 19, 2021 16:18
Comment thread qiskit/transpiler/passes/__init__.py Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread test/python/transpiler/test_inverse_cancellation.py Outdated
Comment thread qiskit/transpiler/passes/optimization/inverse_cancellation.py Outdated
Comment thread test/python/transpiler/test_inverse_cancellation.py Outdated
@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 <mtreinish@kortar.org>
@kdk kdk added this to the 0.19 milestone Nov 15, 2021
@kdk kdk added the Changelog: Added Add an "Added" entry in the GitHub Release 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 <mtreinish@kortar.org>
SameerD-phys pushed a commit to SameerD-phys/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 <mtreinish@kortar.org>
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: Added Add an "Added" entry in the GitHub Release changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants