-
Notifications
You must be signed in to change notification settings - Fork 48
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
Update auto_rebase_pass
to take optional allow_swaps
argument
#947
Conversation
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.
Nice, just a few comments.
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.
A couple of pytket tests failing?
I forgot to update the n_gates value for Sycamore for ZZPhase and ZZMax, have fixed now |
Just the one still failing... |
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!
If
allow_swaps
is true, then when targetingCX
orZZMax
gates,auto_rebase_pass
will decomposeTK2
gates with wire swaps added if it will reduce the number ofCX
/ZZMax
gates in the decomposition.To do this I've added two new methods to CircPool.hpp and the library.cpp binders:
TK2_using_CX_and_SWAP
andTK2_using_ZZMax_and_SWAP
.These methods construct circuits via a new method in CircPool.cpp
TK2_Swap_replacement
, which finds cases where wire swaps improve gate count.To cleanup remaining single qubit gates, I've also updated
standard_rebase_via_tk2
to move theTK2
gate decomposition into the for loop that replaces all gates withTK2
operations. This makes it easier apply single qubit cleanup to just the gates as part of that decomposition, shouldn't effect performance of the overall method, and seemed to be necessary to make gates such asSWAP
return only a wire swap and not any further single qubit gates.