Skip to content

Implement pyqrack interpreter methods for squin dialect #207

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

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

Conversation

david-pl
Copy link
Contributor

@david-pl david-pl commented Apr 25, 2025

Closes #185

Copy link
Contributor

github-actions bot commented Apr 25, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
6644 5706 86% 0% 🟢

New Files

File Coverage Status
src/bloqade/pyqrack/squin/_init_.py 100% 🟢
src/bloqade/pyqrack/squin/op.py 100% 🟢
src/bloqade/pyqrack/squin/qubit.py 81% 🟢
src/bloqade/pyqrack/squin/runtime.py 75% 🟢
TOTAL 89% 🟢

Modified Files

File Coverage Status
src/bloqade/pyqrack/_init_.py 100% 🟢
src/bloqade/pyqrack/reg.py 95% 🟢
src/bloqade/squin/op/_init_.py 90% 🟢
src/bloqade/squin/op/stmts.py 99% 🟢
src/bloqade/squin/qubit.py 92% 🟢
src/bloqade/squin/wire.py 100% 🟢
TOTAL 96% 🟢

updated for commit: b559f84 by action🐍

Copy link

codecov bot commented Apr 25, 2025

Codecov Report

Attention: Patch coverage is 82.63158% with 66 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/bloqade/pyqrack/squin/runtime.py 74.51% 53 Missing ⚠️
src/bloqade/pyqrack/squin/qubit.py 81.15% 13 Missing ⚠️

📢 Thoughts on this report? Let us know!

@david-pl
Copy link
Contributor Author

So, the implementation here is somewhat complete. However, I'm still struggling with the wire dialect.

@weinbe58 @johnzl-777 how do you even create a Wire right now? I tried this:

@squin.wired
def main():
    q = squin.qubit.new(1)
    w = squin.wire.unwrap(q[0])
    x = squin.op.x()
    squin.wire.apply(x, w)
    return w

But, of course, squin.qubit.new isn't supported by the wired dialect. Is there something like a NewWire statement that is missing?

@david-pl david-pl force-pushed the david/185-pyqrack-squin branch from e6d79f4 to 0cf3d39 Compare April 29, 2025 11:13
if qbit.is_active():
result.append(qbit.sim_reg.m(qbit.addr))
else:
result.append(None)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weinbe58 not sure about this one. We don't have a concept of a classical register in squin.

@david-pl david-pl force-pushed the david/185-pyqrack-squin branch from bb8900c to fc6e9f8 Compare April 30, 2025 07:30
@david-pl
Copy link
Contributor Author

@weinbe58 two more things:

  • I'm not sure about the impl for MeasureAny, please have a look.
  • I could also simplify the OperatorRuntime by simply assuming that whenever len(qubits) > 1 we are looking at a controlled gate. That would mean I could remove the control_apply method from all runtime classes, but I'm not sure how safe that assumption is. What do you think?

@david-pl david-pl marked this pull request as ready for review April 30, 2025 08:21
@david-pl david-pl requested review from johnzl-777 and weinbe58 April 30, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PyQrack support for squin
1 participant