Skip to content
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

Pad non-idle qubits in control flow blocks #1

Conversation

dieris
Copy link

@dieris dieris commented Sep 21, 2023

Summary

This PR proposes two changes:

  • Reenable padding in qubits within control flow blocks.
  • Omit idle qubits entirely from control flow blocks.

Details and comments

The first change is necessary to apply dynamical decoupling within the control flow blocks.
The second change is useful where a second padding / DD pass is required. This way, we would only keep the active qubits in the control blocks and prevent scheduling the idle ones.

Example

creg = ClassicalRegister(1)
qreg = QuantumRegister(3)
circ = QuantumCircuit(qreg,creg)
circ.sx(qreg[0])
circ.x(qreg[1])
circ.sx(qreg[2])
circ.barrier()
circ.measure(0,creg[0])
with circ.if_test((creg[0], 0)):
    circ.x(qreg[1])

pm = PassManager([ALAPScheduleAnalysis(durations), PadDynamicalDecoupling(durations, [XGate(), XGate()])])

control_flow_pad

@mtreinish mtreinish merged commit 454fb28 into mtreinish:pad-idle-qubits-at-your-own-risk Sep 21, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants