-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[Oxidize BasisTranslator]: Move the rest of the BasisTranslator
to Rust.
#13237
base: main
Are you sure you want to change the base?
Conversation
- Add rust counterpart for `basis_search`. - Consolidated the `BasisSearchVisitor` into the function due to differences in rust behavior.
- Due to the nature of `hashbrown` we must use owned Strings instead of `&str`.
- Remove import of `random` in `basis_translator`.
Fixes Port `BasisTranslator` to Rust Qiskit#12246 This is the final act of the efforts to move the `BasisTranslator` transpiler pass into Rust. With many of the parts of this pass already living in Rust, the following commits attempt to bring in the final changes to allow complete operation of this pass in the Rust space (with of course some interaction with Python.) Methodology: The way this works is by keeping the original `BasisTranslator` python class, and have it store the rust-space counterpart (now called `CoreBasisTranslator`) which will perform all of the operations leveraging the existent Rust API's available for the `Target` (Qiskit#12292), `EquivalenceLibrary`(Qiskit#12585) and the `BasisTranslator` methods `basis_search` (Qiskit#12811) and `compose_transforms`(Qiskit#13137). All of the inner methods will have private visibility and will not be accessible to `Python` as they're intended to be internal by design. By removing the extra layers of conversion we should be seeing a considerable speed-up, alongside all of the other incremental improvements we have made. Changes: - Add the pyo3 class/struct `BasisTranslator` that will contain allof the main data used by the transpiler pass to perform its operation. - Convert the `target_basis` into a set manually from python before sending it into the Rust space. - Remove the exposure of `basis_search` and `compose_transforms` to python. - Change `basis_search` so that it accepts references to `HashSet` instances instead of accepting a `HashSet<&str>` instance. - Change inner method's visibility for `basis_search` and `compose_transform` modules in rust. - Expose the exception imports from `Target` to the `accelerate` crate. - Expose `DAGCircuit::copy_empty_like` to the rest of the crates. - Remove all of the unused imports in the Python-side `BasisTranslator`. Blockers: - [ ] Qiskit#12811
One or more of the following people are relevant to this code:
|
Pull Request Test Coverage Report for Build 11079003500Details
💛 - Coveralls |
Here's what the benchmarks look like across the board. I'd like to have better ones to show so if you'd like to suggest one I should run please leave it in a comment: basis_translator
SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY. utility scale
SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY. randomized benchmarking
SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY. |
Fixes #12246
This is the final act of the efforts to move the
BasisTranslator
transpiler pass into Rust. With many of the parts of this pass already living in Rust, the following commits attempt to bring in the final changes to allow complete operation of this pass in the Rust space (with of course some interaction with Python.)Summary
This is the final act of the efforts to move the
BasisTranslator
transpiler pass into Rust. With many of the parts of this pass already living in Rust, the following commits attempt to bring in the final changes to allow complete operation of this pass in the Rust space (with of course some interaction with Python.)Details and comments
The way this works is by keeping the original
BasisTranslator
python class, and have it store the rust-space counterpart (now calledCoreBasisTranslator
) which will perform all of the operations leveraging the existent Rust API's available for theTarget
(#12292),EquivalenceLibrary
(#12585) and theBasisTranslator
methodsbasis_search
(#12811) andcompose_transforms
(#13137).All of the inner methods will have private visibility and will not be accessible to
Python
as they're intended to be internal by design.By removing the extra layers of conversion we should be seeing a considerable speed-up, alongside all of the other incremental improvements we have made.
Changes:
BasisTranslator
that will contain all of the main data used by the transpiler pass to perform its operation.target_basis
into a set manually from python before sending it into the Rust space.basis_search
andcompose_transforms
to python.basis_search
so that it accepts references toHashSet
instances instead of accepting aHashSet<&str>
instance.basis_search
andcompose_transform
modules in rust.Target
to theaccelerate
crate.DAGCircuit::copy_empty_like
to the rest of the crates.BasisTranslator
.Blockers:
Once these changes have merged this branch will be properly rebased.
basis_search
andBasisSearchVisitor
to rust. #12811