-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fully port Optimize1qGatesDecomposition to Rust (#12959)
* Fully port Optimize1qGatesDecomposition to Rust This commit builds off of #12550 and the other data model in Rust infrastructure and migrates the Optimize1qGatesDecomposition pass to operate fully in Rust. The full path of the transpiler pass now never leaves rust until it has finished modifying the DAGCircuit. There is still some python interaction necessary to handle parts of the data model that are still in Python, mainly calibrations and parameter expressions (for global phase). But otherwise the entirety of the pass operates in rust now. This is just a first pass at the migration here, it moves the pass to be a single for loop in rust. The next steps here are to look at operating the pass in parallel. There is no data dependency between the optimizations being done by the pass so we should be able to the throughput of the pass by leveraging multithreading to handle each run in parallel. This commit does not attempt this though, because of the Python dependency and also the data structures around gates and the dag aren't really setup for multithreading yet and there likely will need to be some work to support that (this pass is a good candidate to work through the bugs on that). Part of #12208 * Tweak control_flow_op_nodes() method to avoid dag traversal when not necessary * Store target basis set without heap allocation Since we only are storing 12 enum fields (which are a single byte) using any heap allocated collection is completely overkill and will have more overhead that storing a statically sized array for all 12 variants. This commit adds a new struct that wraps a `[bool; 12]` to track which basis are supported and an API for tracking this. This simplifies the tracking of which qubit supports which EulerBasis, it also means other internal users of the 1q decomposition have a simplified API for working with the euler basis. * Remove From trait for Qubit->PhysicalQubit conversion * Fix merge conflict * Use new DAGCircuit::has_control_flow() for control_flow_op_nodes() pymethod * Move _basis_gates set creation to __init__ * Update releasenotes/notes/optimize-1q-gates-decomposition-ce111961b6782ee0.yaml Co-authored-by: Elena Peña Tapia <[email protected]> --------- Co-authored-by: Elena Peña Tapia <[email protected]>
- Loading branch information
Showing
8 changed files
with
519 additions
and
191 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.