-
-
Notifications
You must be signed in to change notification settings - Fork 46
✨ Add MLIR Swap Reconstruction and Elision #1207
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
✨ Add MLIR Swap Reconstruction and Elision #1207
Conversation
5010024 to
cf2463f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
burgholzer
left a comment
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.
Thanks @taminob for consolidating this! This looks really great already (no surprise after quite some iteration in the other PRs).
I still have a couple of comments which you will find inline.
Besides that, it would obviously be great to get the CI green by fixing all the open linter warnings.
Finally, as per the PR template, would you please add a changelog entry for this PR.
mlir/lib/Dialect/MQTOpt/Transforms/SwapReconstructionAndElisionPattern.cpp
Outdated
Show resolved
Hide resolved
mlir/lib/Dialect/MQTOpt/Transforms/SwapReconstructionAndElisionPattern.cpp
Show resolved
Hide resolved
mlir/lib/Dialect/MQTOpt/Transforms/SwapReconstructionAndElisionPattern.cpp
Outdated
Show resolved
Hide resolved
mlir/lib/Dialect/MQTOpt/Transforms/SwapReconstructionAndElisionPattern.cpp
Outdated
Show resolved
Hide resolved
mlir/lib/Dialect/MQTOpt/Transforms/SwapReconstructionAndElisionPattern.cpp
Outdated
Show resolved
Hide resolved
mlir/test/Dialect/MQTOpt/Transforms/swap-reconstruction-and-elision.mlir
Outdated
Show resolved
Hide resolved
mlir/test/Dialect/MQTOpt/Transforms/swap-reconstruction-and-elision.mlir
Outdated
Show resolved
Hide resolved
mlir/test/Dialect/MQTOpt/Transforms/swap-reconstruction-and-elision.mlir
Show resolved
Hide resolved
cf2463f to
47940e3
Compare
|
@burgholzer I added the three-CNOT matching logic again, feel free to have another look (no need to hold back on comments :) ). I looked a little bit into the greedy driver logic and also found some interesting paragraphs in its documentation. If you're interested, this paragraph is about the The reason why the benefit didn't work before was that it was actually doing a bottom-up traversal for the operations and thus the two CNOT operation will be matched first of course. Fortunately, the greedy pattern rewrite driver does have some configuration options which are useful. For more complex passes, we might want to actually look into multiple |
Signed-off-by: burgholzer <burgholzer@me.com>
e946c68 to
aeedaf4
Compare
54ead71 to
b42750d
Compare
…pass Signed-off-by: Lukas Burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
burgholzer
left a comment
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.
Thanks for all the work on this @taminob 🙏🏼
I played around with this a little more, tried a couple of things, and improved some of the code slightly.
This should do it for now. If CI is green, let's get this in!
Another PR with quite some lengthy discussion merged; I'll count that as a win ✨
Description
This PR introduces a new pattern and pass for swap reconstruction from two consecutive reversed CNOT gates and its immediate elision.
It replaces #1158 which implemented a more advanced, but also much more complex, variant of the pattern which can also re-construct controlled SWAP gates and replace full three CNOT patterns equivalent to a SWAP.
It is equivalent in functionality to #1194 which implemented the same pattern in PDLL.
Related to #1122
Checklist: