Skip to content

Add PhasedXZ Gate to Squin#722

Open
Jason-Ludmir wants to merge 6 commits intomainfrom
jason/721-update-bloqade-circuit-standard-lib-to-have-a-native-gate-operation-so-it-dispatches-directly-to-the-native-dialect
Open

Add PhasedXZ Gate to Squin#722
Jason-Ludmir wants to merge 6 commits intomainfrom
jason/721-update-bloqade-circuit-standard-lib-to-have-a-native-gate-operation-so-it-dispatches-directly-to-the-native-dialect

Conversation

@Jason-Ludmir
Copy link

@Jason-Ludmir Jason-Ludmir commented Mar 5, 2026

See issue #403

@Jason-Ludmir Jason-Ludmir requested a review from weinbe58 March 5, 2026 18:54
@Jason-Ludmir Jason-Ludmir self-assigned this Mar 5, 2026
@weinbe58 weinbe58 changed the title Jason/721 update bloqade circuit standard lib to have a native gate operation so it dispatches directly to the native dialect Add PhasedXZ Gate to Squin Mar 5, 2026
"IX",
"IY",
"IZ",
"IS",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Damn it, this happened to me a bunch of times: the typos hook does this.

Revert that change and please also add an exception for "IX", "IY", "IZ" in the tool config (in the pyproject.toml, I think).

Copy link
Author

Choose a reason for hiding this comment

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

That's hilarious, thank you for letting me know! Will do.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
11243 9918 88% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/bloqade/cirq_utils/emit/gate.py 99% 🟢
src/bloqade/cirq_utils/lowering.py 92% 🟢
src/bloqade/native/_init_.py 100% 🟢
src/bloqade/native/stdlib/broadcast.py 63% 🟢
src/bloqade/native/stdlib/simple.py 69% 🟢
src/bloqade/native/upstream/squin2native.py 100% 🟢
src/bloqade/pyqrack/squin/gate/gate.py 97% 🟢
src/bloqade/squin/_init_.py 100% 🟢
src/bloqade/squin/gate/_interface.py 100% 🟢
src/bloqade/squin/gate/stmts.py 100% 🟢
src/bloqade/squin/stdlib/broadcast/_init_.py 100% 🟢
src/bloqade/squin/stdlib/broadcast/gate.py 70% 🟢
src/bloqade/squin/stdlib/simple/_init_.py 100% 🟢
src/bloqade/squin/stdlib/simple/gate.py 68% 🟢
TOTAL 90% 🟢

updated for commit: d639bad by action🐍

@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 73.80952% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/bloqade/cirq_utils/emit/gate.py 22.22% 7 Missing ⚠️
src/bloqade/native/stdlib/broadcast.py 40.00% 3 Missing ⚠️
src/bloqade/pyqrack/squin/gate/gate.py 93.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Member

@weinbe58 weinbe58 left a comment

Choose a reason for hiding this comment

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

I think we should have some kind of integration test that runs a cirq circuit round trip through just to validate that things make sense.

Comment on lines +48 to +49
# optimizee to use a phaes x gate (r gate, rz gate)
#
Copy link
Member

Choose a reason for hiding this comment

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

could you do this before we merge the PR?

Comment on lines +132 to +134
x_exponent: ir.SSAValue = info.argument(types.Float)
z_exponent: ir.SSAValue = info.argument(types.Float)
axis_phase_exponent: ir.SSAValue = info.argument(types.Float)
Copy link
Member

Choose a reason for hiding this comment

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

Just to be clear Cirq uses half turns for the angles not full turns.

Comment on lines +111 to +113
x_exponent = frame.get(stmt.x_exponent)
z_exponent = frame.get(stmt.z_exponent)
axis_phase_exponent = frame.get(stmt.axis_phase_exponent)
Copy link
Member

Choose a reason for hiding this comment

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

You should probably divide these by 2.

Jason Ludmir and others added 2 commits March 9, 2026 13:31
…t to ensure the phased xz preserves the state vector
…b-to-have-a-native-gate-operation-so-it-dispatches-directly-to-the-native-dialect
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.

Update bloqade-circuit standard lib to have a Native Gate Operation so it dispatches directly to the Native dialect

3 participants