-
Notifications
You must be signed in to change notification settings - Fork 8
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
Draft: Simplify the transpilation code. #156
base: main
Are you sure you want to change the base?
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 functionally alright. I can approve when tests pass
Returns: | ||
equivalent simplified quantum architecture | ||
""" | ||
# NOTE: assumes all qubit-resonator gates have the locus order (q, r) |
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.
Is that needed? We can just make it not assume the order, double check with arch.computational_resonators
and arch.qubits
and we don't need to bother when someone breaks convention.
# TODO currently not always optimal | ||
# assert len(c1.instructions) == 4 # prx(QB2), move(QB2, CR2), cz(QB3, CR2), cz(QB5, CR2) | ||
assert 4 <= len(c1.instructions) <= 6 |
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.
The transpilation is stochastic, and will not always produce the shortest sequence (yet!).
TRANSPILER_FIX: bool = True | ||
# TRANSPILER_FIX: bool = False |
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 now this module also contains the old transpilation code, for comparison. I will remove it before merging.
TRUST = 'trust' | ||
"""Transpiler will keep the MOVE instructions without checking if they are correct, and add more as needed.""" | ||
"""Keep existing MOVE instructions without checking if they are correct, and add more as needed.""" | ||
# TODO TRUST is essentially removed by the new transpiler, KEEP tries to fix any issues with existing MOVEs. |
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 think we could drop the TRUST option.
(g, m, r, badness). Badness is the number of gates in the sequence. | ||
Iff no sequence could be found, r is an empty string. | ||
""" | ||
# TODO use the lookahead to add fractional badness |
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.
Using the lookahead we could get a more optimal sequence.
# are some of the locus qubits' states currently in a resonator? | ||
if res_match := self.resonators_holding_qubits(locus): | ||
# Some locus qubits do not hold their states, which need to be restored before applying the gate. | ||
# FIXME As a consequence, a barrier closes a MOVE sandwich? |
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.
Is this behavior what we want?
delay
operation.