Fix CSPLayout to detect 3-or-more-qubit gates (fix #7155)#15921
Fix CSPLayout to detect 3-or-more-qubit gates (fix #7155)#15921hijirii wants to merge 1 commit intoQiskit:mainfrom
Conversation
CSPLayout was only checking 2-qubit gates (via dag.two_qubit_ops()) and ignoring gates with 3+ qubits like CCX. This caused the pass to incorrectly report 'solution found' for circuits with multi-qubit gates that cannot be mapped to a linear coupling. Now the pass checks for any gate with more than 2 qubits and fails gracefully with '3-or-more-qubit gate found' instead. Fixes Qiskit#7155
|
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the following people are relevant to this code:
|
|
|
|
|
Summary
CSPLayout was only checking 2-qubit gates (via
dag.two_qubit_ops()) and ignoring gates with 3+ qubits like CCX. This caused the pass to incorrectly report 'solution found' for circuits with multi-qubit gates that cannot be mapped to a linear coupling map.Fix
Added a check for any gate with more than 2 qubits before running the CSP solver. If such a gate is found, the pass now fails gracefully with
CSPLayout_stop_reason = "3-or-more-qubit gate found".Changes
Reproduction (before fix)
Checklist
Closes #7155