Skip to content
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

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open

Conversation

smite
Copy link
Member

@smite smite commented Dec 18, 2024

  • Star architecture transpilation code is rewritten, and should now handle correctly any number of resonators.
  • Adds the delay operation.

@smite smite requested a review from Aerylia December 18, 2024 02:27
Copy link
Contributor

@Aerylia Aerylia left a 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

src/iqm/iqm_client/transpile.py Outdated Show resolved Hide resolved
src/iqm/iqm_client/transpile.py Outdated Show resolved Hide resolved
Returns:
equivalent simplified quantum architecture
"""
# NOTE: assumes all qubit-resonator gates have the locus order (q, r)
Copy link
Contributor

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.

Comment on lines +183 to +185
# 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
Copy link
Member Author

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!).

Comment on lines +60 to +61
TRANSPILER_FIX: bool = True
# TRANSPILER_FIX: bool = False
Copy link
Member Author

@smite smite Jan 29, 2025

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.
Copy link
Member Author

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
Copy link
Member Author

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?
Copy link
Member Author

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?

@smite smite changed the title Simplify the transpilation code. Draft: Simplify the transpilation code. Jan 29, 2025
@smite smite self-assigned this Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants