Fix VF2PostLayout with uncoupled qubits in strict_direction=True#14998
Fix VF2PostLayout with uncoupled qubits in strict_direction=True#14998mtreinish merged 1 commit intoQiskit:mainfrom
VF2PostLayout with uncoupled qubits in strict_direction=True#14998Conversation
|
One or more of the following people are relevant to this code:
|
When `VF2PostLayout` is set in strict mode, we have to include even active but uncoupled qubits in the interaction graph, because of the semantic constraints. We need to limit the number of these uncoupled qubits we'll consider, though, because there's a factorial overhead to handling them. A previous commit[^1] added this skip to `strict_direction=False`, but didn't correctly handle the continuation case where we're within the limit. This commit correctly clears out the uncoupled-qubit metadata that was causing problems in later layout reconstruction. [^1]: b4094dd: Fix calls to `VF2PostLayout` after optimization loop at O3
632525f to
90b2665
Compare
Pull Request Test Coverage Report for Build 17548526532Details
💛 - Coveralls |
mtreinish
left a comment
There was a problem hiding this comment.
LGTM, thanks for catching this and the quick fix.
| if len(free_nodes) > 1: | ||
| self.property_set["VF2PostLayout_stop_reason"] = ( | ||
| VF2PostLayoutStopReason.NO_BETTER_SOLUTION_FOUND | ||
| ) | ||
| return | ||
| free_nodes.clear() |
There was a problem hiding this comment.
It took me a sec to remember that I had an if not strict_direction for the free node removal in the vf2_utils code that generated the free_nodes. With that this does the correct thing as described in the comment. But I was initially worried that the case of a single free node would be missing from the interaction graph.
There was a problem hiding this comment.
That logic in build_interaction_graph is why it took me ~30 minutes to actually produce this patch too haha.
I wasn't too worried about changing the code much because it all disappears in #14863 and becomes Rust.
…14998) When `VF2PostLayout` is set in strict mode, we have to include even active but uncoupled qubits in the interaction graph, because of the semantic constraints. We need to limit the number of these uncoupled qubits we'll consider, though, because there's a factorial overhead to handling them. A previous commit[^1] added this skip to `strict_direction=False`, but didn't correctly handle the continuation case where we're within the limit. This commit correctly clears out the uncoupled-qubit metadata that was causing problems in later layout reconstruction. [^1]: b4094dd: Fix calls to `VF2PostLayout` after optimization loop at O3 (cherry picked from commit 2d73e5d)
…14998) (#15001) When `VF2PostLayout` is set in strict mode, we have to include even active but uncoupled qubits in the interaction graph, because of the semantic constraints. We need to limit the number of these uncoupled qubits we'll consider, though, because there's a factorial overhead to handling them. A previous commit[^1] added this skip to `strict_direction=False`, but didn't correctly handle the continuation case where we're within the limit. This commit correctly clears out the uncoupled-qubit metadata that was causing problems in later layout reconstruction. [^1]: b4094dd: Fix calls to `VF2PostLayout` after optimization loop at O3 (cherry picked from commit 2d73e5d) Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
…iskit#14998) When `VF2PostLayout` is set in strict mode, we have to include even active but uncoupled qubits in the interaction graph, because of the semantic constraints. We need to limit the number of these uncoupled qubits we'll consider, though, because there's a factorial overhead to handling them. A previous commit[^1] added this skip to `strict_direction=False`, but didn't correctly handle the continuation case where we're within the limit. This commit correctly clears out the uncoupled-qubit metadata that was causing problems in later layout reconstruction. [^1]: b4094dd: Fix calls to `VF2PostLayout` after optimization loop at O3
…iskit#14998) When `VF2PostLayout` is set in strict mode, we have to include even active but uncoupled qubits in the interaction graph, because of the semantic constraints. We need to limit the number of these uncoupled qubits we'll consider, though, because there's a factorial overhead to handling them. A previous commit[^1] added this skip to `strict_direction=False`, but didn't correctly handle the continuation case where we're within the limit. This commit correctly clears out the uncoupled-qubit metadata that was causing problems in later layout reconstruction. [^1]: b4094dd: Fix calls to `VF2PostLayout` after optimization loop at O3
When
VF2PostLayoutis set in strict mode, we have to include even active but uncoupled qubits in the interaction graph, because of the semantic constraints. We need to limit the number of these uncoupled qubits we'll consider, though, because there's a factorial overhead to handling them.A previous commit1 added this skip to
strict_direction=False, but didn't correctly handle the continuation case where we're within the limit. This commitups the limit to 3 uncoupled qubits (a potential 6x overhead) andcorrectly clears out the uncoupled-qubit metadata that was causing problems in later layout reconstruction.Summary
Details and comments
No release note because the bug isn't released.
Fix #14997
Footnotes
b4094dd: Fix calls to
VF2PostLayoutafter optimization loop at O3 ↩