PadDelay¶
- class qiskit.transpiler.passes.PadDelay(*args, **kwargs)[source]¶
Bases:
BasePadding
Padding idle time with Delay instructions.
Consecutive delays will be merged in the output of this pass.
durations = InstructionDurations([("x", None, 160), ("cx", None, 800)]) qc = QuantumCircuit(2) qc.delay(100, 0) qc.x(1) qc.cx(0, 1)
The ASAP-scheduled circuit output may become
┌────────────────┐ q_0: ┤ Delay(160[dt]) ├──■── └─────┬───┬──────┘┌─┴─┐ q_1: ──────┤ X ├───────┤ X ├ └───┘ └───┘
Note that the additional idle time of 60dt on the
q_0
wire coming from the duration difference betweenDelay
of 100dt (q_0
) andXGate
of 160 dt (q_1
) is absorbed in the delay instruction on theq_0
wire, i.e. in total 160 dt.See
BasePadding
pass for details.Create new padding delay pass.
- Parameters:
fill_very_end – Set
True
to fill the end of circuit with delay.target – The
Target
representing the target backend. If it is supplied and does not support delay instruction on a qubit, padding passes do not pad any idle time of the qubit.
Attributes
- is_analysis_pass¶
Check if the pass is an analysis pass.
If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.
- is_transformation_pass¶
Check if the pass is a transformation pass.
If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).
Methods
- execute(passmanager_ir, state, callback=None)¶
Execute optimization task for input Qiskit IR.
- Parameters:
passmanager_ir (Any) – Qiskit IR to optimize.
state (PassManagerState) – State associated with workflow execution by the pass manager itself.
callback (Callable | None) – A callback function which is caller per execution of optimization task.
- Returns:
Optimized Qiskit IR and state of the workflow.
- Return type:
tuple[Any, qiskit.passmanager.compilation_status.PassManagerState]
- run(dag)¶
Run the padding pass on
dag
.- Parameters:
dag (DAGCircuit) – DAG to be checked.
- Returns:
DAG with idle time filled with instructions.
- Return type:
- Raises:
TranspilerError – When a particular node is not scheduled, likely some transform pass is inserted before this node is called.
- update_status(state, run_state)¶
Update workflow status.
- Parameters:
state (PassManagerState) – Pass manager state to update.
run_state (RunState) – Completion status of current task.
- Returns:
Updated pass manager state.
- Return type: