-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[WIP] Pulse-efficient Transpiler Passes #6653
base: main
Are you sure you want to change the base?
Conversation
Implemented Daniel's suggestions Co-authored-by: Daniel Egger <[email protected]>
…the RZZ and the SWAP Gate to the StandardEquivalenceLibrary
…-terra into CalibrationBuilderNoEcho
…woQubitWeylEchoRZX
Co-authored-by: Daniel Egger <[email protected]>
Co-authored-by: Daniel Egger <[email protected]>
Co-authored-by: Daniel Egger <[email protected]>
…ion.py Co-authored-by: Daniel Egger <[email protected]>
…ion.py Co-authored-by: Daniel Egger <[email protected]>
Co-authored-by: Luciano Bello <[email protected]>
Co-authored-by: Luciano Bello <[email protected]>
Co-authored-by: Luciano Bello <[email protected]>
Co-authored-by: Luciano Bello <[email protected]>
Co-authored-by: Luciano Bello <[email protected]>
Co-authored-by: Luciano Bello <[email protected]>
Co-authored-by: Luciano Bello <[email protected]>
Co-authored-by: Luciano Bello <[email protected]>
Co-authored-by: Luciano Bello <[email protected]>
Co-authored-by: Luciano Bello <[email protected]>
…ion.py Co-authored-by: Luciano Bello <[email protected]>
Co-authored-by: Daniel Egger <[email protected]>
Co-authored-by: Daniel Egger <[email protected]>
Co-authored-by: Daniel Egger <[email protected]>
Co-authored-by: Daniel Egger <[email protected]>
@@ -58,7 +59,8 @@ def transpile( | |||
dt: Optional[float] = None, | |||
approximation_degree: Optional[float] = None, | |||
seed_transpiler: Optional[int] = None, | |||
optimization_level: Optional[int] = None, | |||
inst_map: Dict[str, Dict[Tuple[int], Schedule]] = None, | |||
optimization_level: Union[Optional[int], Optional[str]] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the algorithms, that create circuits and execute them, this is presently done via a QuantumInstance that wraps a backend and has common circuit support for the algorithms, that also allows an end user to set circuit aspects such as transpiler options. See here https://github.com/Qiskit/qiskit-terra/blob/3bb72d340fcf9552d4a6bd54b675399578c726db/qiskit/utils/quantum_instance.py#L71
So if this is introduced as a string I think the above should follow suit and be changed likewise. As the code just stores and passes this on I think its a minor change there just for the typehint.
As a very minor comment I think the typehint can be written more simply as Optional[Union[int, str]] = None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think a better interface for this is the FullPassManager
being introduced in: #6403 with for the extra passes the user just builds a post-optimization pass manager that runs these additional passes and sets that on level 3. I don't think we want to use optimization level like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@catornow Lets align this with #6403. With the changes suggested below you probably don't need to make any changes to transpile.py
and passmanager_config.py
.
@mtreinish Do you think it makes sense to add methods to preset_passmanagers/pulse_efficient.py
to return instance of FullPassManager
with the different optimization levels? This would save users some work from having to assemble these themselves.
from qiskit.transpiler.preset_passmanagers.level0 import level_0_pass_manager | ||
|
||
|
||
def pulse_efficient_pass_manager(pass_manager_config: PassManagerConfig) -> PassManager: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def pulse_efficient_pass_manager(pass_manager_config: PassManagerConfig) -> PassManager: | |
def generate_pulse_efficient_post_opt(backend) -> PassManager: |
inst_map = pass_manager_config.inst_map | ||
basis_gates = pass_manager_config.basis_gates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could look something like
inst_map = pass_manager_config.inst_map | |
basis_gates = pass_manager_config.basis_gates | |
inst_map = backend.defaults().instruction_schedule_map | |
basis_gates = backend.basis_gates |
# pm = PassManager() | ||
pm = level_3_pass_manager(pass_manager_config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# pm = PassManager() | |
pm = level_3_pass_manager(pass_manager_config) | |
pm = PassManager() |
…-terra into CalibrationBuilderNoEcho
There's been no activity on this PR for several years now, but the synthesis code in it still looks potentially useful. If so, this probably ought to be re-targetted to become a |
Summary
This PR implements a new pass manager called
pulse-efficient
that allows users to transpile circuits to RZX gate-based and pulse-efficient circuits. The circuits typically have shorter pulse schedule durations and higher fidelities in comparison to the standard digital CNOT-based transpired circuits (see Reference https://arxiv.org/pdf/2105.01063.pdf).First, all consecutive two-qubit operations in a circuit are consolidated. The main component of the pass manager is a new transpiler pass
EchoRZXWeylDecomposition
. This transpiler pass leverages Cartan's decomposition of arbitrary two-quit gates and decomposes the two-quit gates in terms of echoed RZX gates.Lastly, calibrations are added to the RZX gates by leveraging the
RZXCalibrationBuilderNoEcho
, see PR #6300. Most importantly, no additional calibration is needed.Details and comments
The output of this self-contained code should illustrate the transpilation of a randomly chosen circuit to an RZX gate-based, pulse-efficient circuit.
Output (I removed the ancilla qubits for better readability):