-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Improve MCMT synthesis for XGate
base gate
#14754
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
base: main
Are you sure you want to change the base?
Conversation
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:
|
Pull Request Test Coverage Report for Build 16501202274Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @patelvyom for another high-quality and important contribution to qiskit!
I wonder if there is some specific use-case of MCMT-X gate?
I also have a few comments on the docs and the tests. Release notes are also needed.
Re: Uses of MCMTX gate:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I think that there are only some lint and indentation errors to fix.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few minor comments on the docs. Other than that, I think it's ready to go :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@patelvyom - thanks for another nice contribution to qiskit! I hope that it will also be useful for other arithmetic circuits.
@Cryoris - do you have any further comments?
This PR optimises the synthesis of multi-controlled multi-target (MCMT) gates when the
base_gate
isXGate()
. The current implementation uses a generic V-chain construction, which is suboptimal for this case. We replace it with a more efficient decomposition:n_target = 1
, it reduces to a standardMCX
gate.n_target > 1
, it uses a singleMCX
gate and2*(t-1)
CX gates, with at least one dirty ancilla available.A comparison plot is included below, showing that the proposed method achieves savings of hundreds to thousands of CX gates, depending on the circuit size. Here,
MCMTX
is the proposed decomposition.Tagging @ShellyGarion and @alexanderivrii based on past discussions around MCX gates.