ContextAwareDynamicalDecoupling
class qiskit.transpiler.passes.ContextAwareDynamicalDecoupling(*args, **kwargs)
Bases: TransformationPass
Implement an X-sequence dynamical decoupling considering the gate- and qubit-context.
This pass implements a context-aware dynamical decoupling (DD) [1], which ensures that
- simultaneously occurring DD sequences on device-adjacent qubits are mutually orthogonal, and
- DD sequences on spectator qubits of ECR and CX gates are orthogonal to the echo pulses on the neighboring target/control qubits.
The mutually orthogonal DD sequences are currently Walsh-Hadamard sequences, consisting of only X gates. In some cases it might therefore be beneficial to use PadDynamicalDecoupling
with more generic sequences, such as XY4.
This pass performs best if the two-qubit interactions have the same durations on the device, as it allows to align delay sequences and take into account potential control and target operations on neighboring qubits. However, it is still valid if this is not the case.
If this pass is run within a pass manager (as in the example below), it will automatically run PadDelay
to allocate the delays. If instead it is run as standalone (not inside a PassManager
), the delays must already be inserted.
Example:
from qiskit.circuit import QuantumCircuit
from qiskit.circuit.library import QFTGate
from qiskit.transpiler import PassManager
from qiskit.transpiler.passes import ALAPScheduleAnalysis, ContextAwareDynamicalDecoupling
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit_ibm_runtime.fake_provider import FakeSherbrooke
num_qubits = 10
circuit = QuantumCircuit(num_qubits)
circuit.append(QFTGate(num_qubits), circuit.qubits)
circuit.measure_all()
target = FakeSherbrooke().target
pm = generate_preset_pass_manager(optimization_level=2, target=target)
dd = PassManager([
ALAPScheduleAnalysis(target=target),
ContextAwareDynamicalDecoupling(target=target),
])
transpiled = pm.run(circuit)
with_dd = dd.run(transpiled)
print(with_dd.draw(idle_wires=False))
References
[1] A. Seif et al. (2024). Suppressing Correlated Noise in Quantum Computers via
Context-Aware Compiling, arXiv:2403.06852.
Parameters
- target – The
Target
of the device to run the circuit. - min_duration – Minimal delay duration (in
dt
) to insert a DD sequence. This can be useful, e.g. if a big delay block would be interrupted and split into smaller blocks due to a very short, adjacent delay. IfNone
, this is set to be at least twice the difference of the longest/shortest CX or ECR gate. - skip_reset_qubits – Skip initial delays and delays after a reset.
- skip_dd_threshold – Skip dynamical decoupling on an idle qubit, if the duration of the decoupling sequence exceeds this fraction of the idle window. For example, to skip a DD sequence if it would take up more than 95% of the idle time, set this value to 0.95. A value of 1. means that the DD sequence is applied if it fits into the window.
- pulse_alignment – The hardware constraints (in
dt
) for gate timing allocation. If provided, the inserted gates will only be executed on integer multiples of this value. This is usually provided onbackend.configuration().timing_constraints
. IfNone
, this is extracted from thetarget
. - coloring_strategy – The coloring strategy used for
rx.greedy_graph_color
. Defaults to a saturation strategy, which is optimal on bipartite graphs, see Section 1.2.2.8 of [2].
References
[2] A. Kosowski, and K. Manuszewski, Classical Coloring of Graphs, Graph Colorings,
2-19, 2004. ISBN 0-8218-3458-4.
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
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]
get_orthogonal_sequence
get_orthogonal_sequence(order)
Return a DD sequence of given order, where different orders are orthogonal.
Parameters
order (int) –
Return type
name
run
run(dag)
Run a pass on the DAGCircuit. This is implemented by the pass developer.
Parameters
dag (DAGCircuit) – the dag on which the pass is run.
Raises
NotImplementedError – when this is left unimplemented for a pass.
Return type
update_status
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