-
Notifications
You must be signed in to change notification settings - Fork 73
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
Replace Tweedledum classical (permutation) gate synthesis routines with native Lisp routines. #740
Conversation
nice |
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 can't believe my only comment is to use NRECONC
.
This is a great addition!
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.
Overall this looks great. I think in a particular as a drop in replacement for Tweedledum it is super exciting. Essentially all of my comments are documentation or style related. Re: documentation, I think we should be liberal about citing references for specific synthesis techniques that we use. Also I have a strong preference for docstrings, at least in the context of cl-quil
where they are the standard. I mentioned this in one specific spot, but as a suggestion I would consider it more broadly.
@karlosz You can clean up commit history if you want. I'll merge this afternoon. |
@stylewarning I just need to address the tests issue raised by Erik and then it should be ready for merge. I'll finish that later today. |
Whoops, missed that. I agree with @kilimanjaro's comment about test style, too. |
All comments have been addressed now. |
This change reimplements the Tweedledum permutation gate synthesis algorithm using decomposition with a native Lisp one.
The specialized native Lisp routine offers the same 30x speedup in compilation time that Tweedledum gives over our generic routines on the Bernstein-Vazirani test program, incurring only a 5%-10% instruction increase over Tweedledum's synthesis code. This is due to lack of specialized synthesis routines for multiple control Toffoli gates. I believe that once specialized MCT synthesis algorithms are written (as Tweedledum has), we should be able to generate better code as well, since native quilc routines have access to more information, such as target chip architecture and more knowledge about the rest of the compilation pipeline.
A big plus is that we have one less external (foreign!) dependency, also notorious for constantly being rewritten.