Skip to content

Support cirq classical control when lowering a circuit to squin #315

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 4 commits into
base: main
Choose a base branch
from

Conversation

david-pl
Copy link
Collaborator

Still need to support classical control with measurements on multiple qubits resulting in an ilist.

@david-pl david-pl marked this pull request as ready for review June 12, 2025 15:38
@david-pl david-pl requested a review from Roger-luo June 12, 2025 15:38
Comment on lines +176 to +197
# NOTE: there is currently no convenient ilist.any method, so we need to use foldl
# with a simple function that just does an or

def bool_op_or(x: bool, y: bool) -> bool:
return x or y

f_code = state.current_frame.push(
lowering.Python(self.dialects).python_function(bool_op_or)
)
fn = ir.Method(
mod=None,
py_func=bool_op_or,
sym_name="bool_op_or",
arg_names=[],
dialects=self.dialects,
code=f_code,
)
f_const = state.current_frame.push(py.constant.Constant(fn))
init_val = state.current_frame.push(py.Constant(False)).result
condition = state.current_frame.push(
ilist.Foldl(f_const.result, measurement_outcome, init=init_val)
).result
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Roger-luo Please take a look at this part here specifically. I'm not sure if I'm adding the function here correctly.

Copy link
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
8487 7411 87% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/bloqade/squin/cirq/lowering.py 92% 🟢
TOTAL 92% 🟢

updated for commit: 5cdfd14 by action🐍

Copy link

codecov bot commented Jun 12, 2025

Codecov Report

Attention: Patch coverage is 91.66667% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/bloqade/squin/cirq/lowering.py 91.66% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

1 participant