SabrePreLayout
class qiskit.transpiler.passes.SabrePreLayout(*args, **kwargs)
Bases: AnalysisPass
Choose a starting layout to use for additional Sabre layout trials.
The pass works by augmenting the coupling map with more and more “extra” edges until VF2 succeeds to find a perfect graph isomorphism. More precisely, the augmented coupling map contains edges between nodes that are within a given distance d in the original coupling map. The original edges are noise-free while the additional edges have noise that scales exponentially with the distance. The value of d is increased until an isomorphism is found.
Intuitively, a better VF2 layout involves fewer and of shorter-distance extra edges.
Property Set Values Written
sabre_starting_layouts (list[Layout])
An optional list of Layout objects to use for additional Sabre layout trials.
References:
[1] Henry Zou and Matthew Treinish and Kevin Hartman and Alexander Ivrii and Jake Lishman. “LightSABRE: A Lightweight and Enhanced SABRE Algorithm” arXiv:2409.08368
param coupling_map
Directed graph representing the original coupling map or a target modelling the backend (including its connectivity).
param max_distance
The maximum distance for running VF2 with the augmented coupling map. In particular, this also specifies the maximum distance between the original nodes that become connected in the augmented coupling map.
param error_rate
The error rate to assign to the “extra” edges. A non-zero error rate prioritizes VF2 to choose original edges over extra edges.
param max_trials_vf2
Specifies the maximum number of VF2 trials. This option remains primarily for legacy reasons since the introduction of on-the-fly scoring in VF2, which was introduced in Qiskit 2.3. To bound the time for the pass, set parameters max_distance and call_limit_vf2 instead.
param call_limit_vf2
The maximum number of times that the inner VF2 isomorphism search will attempt to extend the mapping. If None, then no limit. If a 2-tuple, then the limit starts as the first item, and swaps to the second after the first match is found, without resetting the number of steps taken. This can be used to allow a long search for any mapping, but still terminate quickly with a small extension budget if one is found.
param improve_layout
Unused (the option became obsolete with the introduction of on-the-fly scoring in VF2).
param min_distance
The distance for the first VF2 run with the augmented coupling map. Setting min_distance > 1 skips all smaller-distance checks, and in particular skips the distance-1 check which corresponds to running the VF2Layout pass.
raises TranspilerError
At runtime, if the argument coupling_map is not provided.
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 called per execution of optimization task.
Returns
Optimized Qiskit IR and state of the workflow.
Return type
name
run
run(dag)
Run the SabrePreLayout pass on dag.
The discovered starting layout is written to the property set value sabre_starting_layouts.
Parameters
dag (DAGCircuit) – DAG to create starting layout for.
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