qiskit/releasenotes/notes/0.21/vf2-post-layout-f0213e2c7eb...

48 lines
2.9 KiB
YAML

---
features:
- |
Added a new transpiler pass, :class:`~.VF2PostLayout`. This pass is of a
new type to perform a new phase/function in the compilation pipeline,
post-layout or post optimization qubit selection. The idea behind this
pass is after we finish the optimization loop in transpiler we
know what the final gate counts will be on each qubit in the circuit so
we can potentially find a better-performing subset of qubits on a backend
to execute the circuit. The pass will search for an isomorphic subgraph in
the connectivity graph of the target backend and look at the full error
rate of the complete circuit on any subgraph found and return the
layout found with the lowest error rate for the circuit.
This pass is similar to the :class:`~.VF2Layout` pass and both internally
use the same VF2 implementation from
`retworkx <https://github.com/Qiskit/retworkx>`__. However,
:class:`~.VF2PostLayout` is designed to run after initial layout, routing,
basis translation, and any optimization passes run and will only work if
a layout has already been applied, the circuit has been routed, and all
gates are in the target basis. This is required so that when a new layout
is applied the circuit can still be run on the target device. :class:`~.VF2Layout`
on the other hand is designed to find a perfect initial layout and can
work with any circuit.
- |
The :class:`~.ApplyLayout` transpiler pass now has support for updating
a layout on a circuit after a layout has been applied once before. If
the ``post_layout`` field is present (in addition to the required
``layout`` field) the ``property_set`` when the :class:`~.ApplyLayout` pass
is run the pass will update the layout to apply the new layout. This will
return a :class:`~.DAGCircuit` with the qubits in the new physical order
and the ``layout`` property set will be updated so that it maps the
virtual qubits from the original layout to the physical qubits in the new
``post_layout`` field.
- |
The preset pass managers generated by :func:`~.level_1_pass_manager`,
:func:`~.level_2_pass_manager`, and :func:`~.level_3_pass_manager` which
correspond to ``optimization_level`` 1, 2, and 3 respectively on the
:func:`~.transpile` function now run the :class:`~.VF2PostLayout` pass
after running the routing pass. This enables the transpiler to
potentially find a different set of physical qubits on the target backend
to run the circuit on which have lower error rates. The
:class:`~.VF2PostLayout` pass will not be run if you manually specify a
``layout_method``, ``routing_method``, or ``initial_layout`` arguments
to :func:`~.transpile`. If the pass can find a better performing subset of
qubits on backend to run the physical circuit it will adjust the layout of
the circuit to use the alternative qubits instead.