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

Fix incorrect graph construction in VF2PostLayout #9058

Merged
merged 1 commit into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions qiskit/transpiler/passes/layout/vf2_post_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,14 @@ def run(self, dag):
global_ops[num_qubits].append(op)
op_names = []
for i in range(self.target.num_qubits):
entry = set()
try:
entry = set(self.target.operation_names_for_qargs((i,)))
except KeyError:
pass
entry = set()
if global_ops is not None:
entry.update(global_ops[1])
op_names.append(entry)

cm_graph.add_nodes_from(op_names)
cm_graph.add_nodes_from(op_names)
for qargs in self.target.qargs:
len_args = len(qargs)
# If qargs == 1 we already populated it and if qargs > 2 there are no instructions
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
fixes:
- |
Fixed a bug in the :class:`.VF2PostLayout` pass when transpiling for backends
with a defined :class:`.Target`, where the interaction graph would be built
incorrectly. This could result in excessive runtimes due to the graph being
far more complex than necessary.