Skip to content

Conversation

rafaelha
Copy link
Contributor

Previously the adjoint of operators were lost in SquinToStimPass. For example,

from bloqade import squin
from bloqade.stim.passes import SquinToStimPass

@squin.kernel
def main():
    q = squin.qalloc(2)
    squin.s_adj(q[0])
    squin.sqrt_x_adj(q[1])

SquinToStimPass(main.dialects)(main)
main.print()

produced

func.func main() -> !py.NoneType {
  ^0(%main_self):
  │ %0 = stim.aux.constant.int 0 : !py.int
  │      stim.gate.S(targets=(%0)){dagger=False : !py.bool}
  │ %1 = stim.aux.constant.int 1 : !py.int
  │      stim.gate.SQRT_X(targets=(%1)){dagger=False : !py.bool}
  │ %2 = func.const.none() : !py.NoneType
  │      func.return %2
} // func.func main

This also lead to incorrect results for u3 gates.

@rafaelha rafaelha force-pushed the rafaelha/adjoint_gates_squin_to_sim branch from dd4f0e4 to c19c820 Compare October 21, 2025 14:44
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

github-actions bot commented Oct 21, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
9461 8359 88% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/bloqade/stim/rewrite/qubit_to_stim.py 86% 🟢
TOTAL 86% 🟢

updated for commit: cc7e9d1 by action🐍

@rafaelha rafaelha marked this pull request as draft October 21, 2025 14:52
@rafaelha rafaelha force-pushed the rafaelha/adjoint_gates_squin_to_sim branch from c19c820 to cc7e9d1 Compare October 21, 2025 15:02
@rafaelha rafaelha marked this pull request as ready for review October 21, 2025 15:10
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.

2 participants