Skip to content

Commit

Permalink
Add commutative cancellation to preset passmanagers level 2 and 3 (#1…
Browse files Browse the repository at this point in the history
…1929)

* added commutative cancellation to preset passmanagers

* exclude annotated and initialize from commutation checker

* Update commutation_checker.py

* Update releasenotes/notes/commutative-cancellation-preset-passmanager-c137ce516a10eae5.yaml

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Update releasenotes/notes/commutative-cancellation-preset-passmanager-c137ce516a10eae5.yaml

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
  • Loading branch information
sbrandhsn and mtreinish committed Mar 20, 2024
1 parent b7fcc76 commit dd2570b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions qiskit/transpiler/preset_passmanagers/builtin_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana
]
)
)
if optimization_level == 2:
init.append(CommutativeCancellation())

elif optimization_level == 3:
init = common.generate_unroll_3q(
Expand Down Expand Up @@ -153,6 +155,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana
]
)
)
init.append(CommutativeCancellation())

else:
return TranspilerError(f"Invalid optimization level {optimization_level}")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
features:
- |
Added the :class:`.CommutativeCancellation` pass to the ``init`` stage of the preset pass managers for
optimization levels 2 and 3. This enables the preset pass managers to cancel additional logical
operations at the beginning of the compilation pipeline.

0 comments on commit dd2570b

Please sign in to comment.