-
Notifications
You must be signed in to change notification settings - Fork 0
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
First version of default UCC #10
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.
Looks good, thanks Sonika. Just a couple minor comments.
class UCCTranspiler: | ||
@staticmethod | ||
def transpile(qasm_code: str): | ||
def transpile(qasm_code: str, mode: str = 'qiskit', draw = False, get_gate_counts = False) -> str: | ||
""" | ||
transpiles the given QASM code using Qiskit's transpile function. |
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.
Please edit this docstring to reflect the current functionality.
def _error(self, circuit, qubit): | ||
""" | ||
Calculate a rough error for a `circuit` that runs on a specific | ||
`qubit` of `target` (`circuit` can either be an OneQubitGateSequence |
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.
You seem to be referring to target
as a variable, but I don't see it defined in this function.
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.
Not currently using this as it wasn't working well for the 1Q gates. I'll be editing this pass.
# obtain a copy of this license in the LICENSE.txt file in the root directory | ||
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Any modifications or derivative works of this code must retain this |
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.
For the licensing, please add a note to each file where the original Qiskit code has been modified.
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.
In the Qiskit files you added, you'll need to note at the top for any that you have modified, per the Apache license.
Is there standard text that Unitary Fund adds in this context? |
Yes, we will need to add it before launch. I would need to double check how the two licenses play together: Don't worry about all the licensing text for this PR, just note which files have been modified. |
…ited docstrings to reflect current functionality
Lgtm |
First version of default UCC
This version of the UCC compiler works for fully connected backends which support single qubit Pauli rotations and CX gates. Currently the runtimes are better than the default Qiskit transpiler, which is mainly achieved by compiling all operations in the beginning to a small, fixed gate set. This is then utilized to speed up commutation checking in various ways.
The number of 1 qubit gates is currently worse by a factor of 4 while the number of 2 qubit gates should be about similar for most circuits compared to the default Qiskit compiler. A new transpiler pass needs to be written to optimize the 1Q gates. Note that in terms of user experience, 1Q gates are typically fast and high-fidelity, and also hardware vendors will typically quickly optimize them, so this may be a lower priority than passes for mapping and reducing 2Q gates.
UCC relies on Qiskit for the DAG manipulation, but all code used from qiskit.transpiler.passes is now in the local transpiler_passes folder. Note there is currently a lot of unused code in these passes. After a mapping pass is added for finite connectivity backends, any overall unused code in transpiler_passes will be removed.
Next, to-do is to add an efficient mapping pass and CX gate pass.