bloqade-circuit 0.4.2__py3-none-any.whl → 0.4.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bloqade-circuit might be problematic. Click here for more details.
- bloqade/squin/analysis/nsites/impls.py +7 -0
- bloqade/squin/cirq/__init__.py +112 -1
- bloqade/squin/cirq/emit/emit_circuit.py +109 -0
- bloqade/squin/cirq/emit/op.py +125 -0
- bloqade/squin/cirq/emit/qubit.py +60 -0
- bloqade/squin/cirq/emit/runtime.py +234 -0
- bloqade/squin/cirq/lowering.py +73 -4
- bloqade/squin/op/__init__.py +3 -0
- bloqade/squin/op/_wrapper.py +12 -0
- bloqade/squin/op/stmts.py +19 -1
- bloqade/squin/rewrite/U3_to_clifford.py +149 -0
- bloqade/squin/rewrite/__init__.py +3 -7
- bloqade/squin/rewrite/remove_dangling_qubits.py +19 -0
- bloqade/squin/rewrite/wrap_analysis.py +34 -19
- bloqade/stim/__init__.py +1 -1
- bloqade/stim/dialects/auxiliary/stmts/const.py +1 -1
- bloqade/stim/dialects/gate/stmts/__init__.py +6 -0
- bloqade/stim/passes/__init__.py +1 -0
- bloqade/stim/passes/squin_to_stim.py +86 -0
- bloqade/stim/rewrite/__init__.py +7 -0
- bloqade/stim/rewrite/py_constant_to_stim.py +42 -0
- bloqade/{squin → stim}/rewrite/qubit_to_stim.py +18 -3
- bloqade/{squin → stim}/rewrite/squin_measure.py +2 -2
- bloqade/{squin/rewrite/stim_rewrite_util.py → stim/rewrite/util.py} +36 -17
- bloqade/{squin → stim}/rewrite/wire_to_stim.py +1 -1
- {bloqade_circuit-0.4.2.dist-info → bloqade_circuit-0.4.4.dist-info}/METADATA +1 -1
- {bloqade_circuit-0.4.2.dist-info → bloqade_circuit-0.4.4.dist-info}/RECORD +30 -22
- bloqade/squin/passes/__init__.py +0 -1
- bloqade/squin/passes/stim.py +0 -68
- /bloqade/{squin → stim}/rewrite/wire_identity_elimination.py +0 -0
- {bloqade_circuit-0.4.2.dist-info → bloqade_circuit-0.4.4.dist-info}/WHEEL +0 -0
- {bloqade_circuit-0.4.2.dist-info → bloqade_circuit-0.4.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -3,9 +3,9 @@ from kirin.dialects import py
|
|
|
3
3
|
from kirin.rewrite.abc import RewriteResult
|
|
4
4
|
|
|
5
5
|
from bloqade.squin import op, wire, qubit
|
|
6
|
+
from bloqade.squin.rewrite import AddressAttribute
|
|
6
7
|
from bloqade.stim.dialects import gate, collapse
|
|
7
|
-
from bloqade.analysis.address import AddressWire, AddressQubit, AddressTuple
|
|
8
|
-
from bloqade.squin.rewrite.wrap_analysis import AddressAttribute
|
|
8
|
+
from bloqade.analysis.address import AddressReg, AddressWire, AddressQubit, AddressTuple
|
|
9
9
|
|
|
10
10
|
SQUIN_STIM_GATE_MAPPING = {
|
|
11
11
|
op.stmts.X: gate.X,
|
|
@@ -13,10 +13,28 @@ SQUIN_STIM_GATE_MAPPING = {
|
|
|
13
13
|
op.stmts.Z: gate.Z,
|
|
14
14
|
op.stmts.H: gate.H,
|
|
15
15
|
op.stmts.S: gate.S,
|
|
16
|
+
op.stmts.SqrtX: gate.SqrtX,
|
|
17
|
+
op.stmts.SqrtY: gate.SqrtY,
|
|
16
18
|
op.stmts.Identity: gate.Identity,
|
|
17
19
|
op.stmts.Reset: collapse.RZ,
|
|
18
20
|
}
|
|
19
21
|
|
|
22
|
+
# Squin allows creation of control gates where the gate can be any operator,
|
|
23
|
+
# but Stim only supports CX, CY, and CZ as control gates.
|
|
24
|
+
SQUIN_STIM_CONTROL_GATE_MAPPING = {
|
|
25
|
+
op.stmts.X: gate.CX,
|
|
26
|
+
op.stmts.Y: gate.CY,
|
|
27
|
+
op.stmts.Z: gate.CZ,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def create_and_insert_qubit_idx_stmt(
|
|
32
|
+
qubit_idx, stmt_to_insert_before: ir.Statement, qubit_idx_ssas: list
|
|
33
|
+
):
|
|
34
|
+
qubit_idx_stmt = py.Constant(qubit_idx)
|
|
35
|
+
qubit_idx_stmt.insert_before(stmt_to_insert_before)
|
|
36
|
+
qubit_idx_ssas.append(qubit_idx_stmt.result)
|
|
37
|
+
|
|
20
38
|
|
|
21
39
|
def insert_qubit_idx_from_address(
|
|
22
40
|
address: AddressAttribute, stmt_to_insert_before: ir.Statement
|
|
@@ -31,16 +49,23 @@ def insert_qubit_idx_from_address(
|
|
|
31
49
|
for address_qubit in address_data.data:
|
|
32
50
|
if not isinstance(address_qubit, AddressQubit):
|
|
33
51
|
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
52
|
+
create_and_insert_qubit_idx_stmt(
|
|
53
|
+
address_qubit.data, stmt_to_insert_before, qubit_idx_ssas
|
|
54
|
+
)
|
|
55
|
+
elif isinstance(address_data, AddressReg):
|
|
56
|
+
for qubit_idx in address_data.data:
|
|
57
|
+
create_and_insert_qubit_idx_stmt(
|
|
58
|
+
qubit_idx, stmt_to_insert_before, qubit_idx_ssas
|
|
59
|
+
)
|
|
60
|
+
elif isinstance(address_data, AddressQubit):
|
|
61
|
+
create_and_insert_qubit_idx_stmt(
|
|
62
|
+
address_data.data, stmt_to_insert_before, qubit_idx_ssas
|
|
63
|
+
)
|
|
38
64
|
elif isinstance(address_data, AddressWire):
|
|
39
65
|
address_qubit = address_data.origin_qubit
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
qubit_idx_ssas.append(qubit_idx_stmt.result)
|
|
66
|
+
create_and_insert_qubit_idx_stmt(
|
|
67
|
+
address_qubit.data, stmt_to_insert_before, qubit_idx_ssas
|
|
68
|
+
)
|
|
44
69
|
else:
|
|
45
70
|
return
|
|
46
71
|
|
|
@@ -119,13 +144,7 @@ def rewrite_Control(
|
|
|
119
144
|
target_qubits = tuple(target_qubits)
|
|
120
145
|
ctrl_qubits = tuple(ctrl_qubits)
|
|
121
146
|
|
|
122
|
-
|
|
123
|
-
op.stmts.X: gate.CX,
|
|
124
|
-
op.stmts.Y: gate.CY,
|
|
125
|
-
op.stmts.Z: gate.CZ,
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
stim_gate = supported_gate_mapping.get(type(ctrl_op_target_gate))
|
|
147
|
+
stim_gate = SQUIN_STIM_CONTROL_GATE_MAPPING.get(type(ctrl_op_target_gate))
|
|
129
148
|
if stim_gate is None:
|
|
130
149
|
return RewriteResult()
|
|
131
150
|
|
|
@@ -2,7 +2,7 @@ from kirin import ir
|
|
|
2
2
|
from kirin.rewrite.abc import RewriteRule, RewriteResult
|
|
3
3
|
|
|
4
4
|
from bloqade.squin import op, wire
|
|
5
|
-
from bloqade.
|
|
5
|
+
from bloqade.stim.rewrite.util import (
|
|
6
6
|
SQUIN_STIM_GATE_MAPPING,
|
|
7
7
|
rewrite_Control,
|
|
8
8
|
insert_qubit_idx_from_wire_ssa,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bloqade-circuit
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.4
|
|
4
4
|
Summary: The software development toolkit for neutral atom arrays.
|
|
5
5
|
Author-email: Roger-luo <rluo@quera.com>, kaihsin <khwu@quera.com>, weinbe58 <pweinberg@quera.com>, johnzl-777 <jlong@quera.com>
|
|
6
6
|
License-File: LICENSE
|
|
@@ -115,35 +115,34 @@ bloqade/squin/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
115
115
|
bloqade/squin/analysis/schedule.py,sha256=buuC4bFuLuaSDK2BZfkRkh8ZdNicz9HkEv3FAnsDViE,7880
|
|
116
116
|
bloqade/squin/analysis/nsites/__init__.py,sha256=RlQg7ivczXCXG5lMeL3ipYKj2oJKC4THu8orYf5PBYs,263
|
|
117
117
|
bloqade/squin/analysis/nsites/analysis.py,sha256=rIe1RU1MZRItcE2aB8DYahLrv73HfD3IHCX3E_EGQ1c,1773
|
|
118
|
-
bloqade/squin/analysis/nsites/impls.py,sha256=
|
|
118
|
+
bloqade/squin/analysis/nsites/impls.py,sha256=Q2buVBmUX1ghj48_SoMO-_0BASGkfnILZZOOFRnwzIQ,2772
|
|
119
119
|
bloqade/squin/analysis/nsites/lattice.py,sha256=ruh0808SHtj3ecuT-C3AZTsLY2j3DRhtezGiTZvcuVs,942
|
|
120
|
-
bloqade/squin/cirq/__init__.py,sha256=
|
|
121
|
-
bloqade/squin/cirq/lowering.py,sha256=
|
|
120
|
+
bloqade/squin/cirq/__init__.py,sha256=AptJlelH-KJoFKLnq6phq68SrV785zWzi2NOfLH62ms,5994
|
|
121
|
+
bloqade/squin/cirq/lowering.py,sha256=4-kZFH_qbBbV-c3-C9KhIB5o_cp_D8oxJrS8KicD_A8,14382
|
|
122
|
+
bloqade/squin/cirq/emit/emit_circuit.py,sha256=7puJ3eCFwE9VdPb9NAiSdyRNkoQPwo_uVykz9Yv7c14,3761
|
|
123
|
+
bloqade/squin/cirq/emit/op.py,sha256=z54NP5KqMxffXeFGWamEzvunpTNrxmYuluurk4j2-ps,4000
|
|
124
|
+
bloqade/squin/cirq/emit/qubit.py,sha256=Z2HUsZmJ5F2uHCPGru81ux2usoX77KwtS97_cgeJRMI,1910
|
|
125
|
+
bloqade/squin/cirq/emit/runtime.py,sha256=6_oHod-WK5yv0ae9xziQn-eh4Hn3MZNNqu4kJtOzPeY,6543
|
|
122
126
|
bloqade/squin/noise/__init__.py,sha256=HQl3FE0SZAGEX3qdveapCaMX391lgLvWeWnoE6Z2pYw,332
|
|
123
127
|
bloqade/squin/noise/_dialect.py,sha256=2IR98J-lXm5Y3srP9g-FD4JC-qTq2seureM6mKKq1xg,63
|
|
124
128
|
bloqade/squin/noise/_wrapper.py,sha256=0jD5va_go9jEW5rC6bZSWU30kjCha2-axFogPON3-V0,580
|
|
125
129
|
bloqade/squin/noise/rewrite.py,sha256=SxIHgMDqYJXepiZDyukHWpe5yaFDSTG-yJ4JONNVr0o,3917
|
|
126
130
|
bloqade/squin/noise/stmts.py,sha256=rktxkIdjdPUYek0MYh9uh83otkl-7UoADCoWHWf57J8,1678
|
|
127
|
-
bloqade/squin/op/__init__.py,sha256=
|
|
131
|
+
bloqade/squin/op/__init__.py,sha256=QLlvZlb2nDq-RTalRp7xe0v82YgXURsvyovvMA6j2mw,807
|
|
128
132
|
bloqade/squin/op/_dialect.py,sha256=66G1IYqmsqUEaCTyUqn2shSHmGYduiTU8GfDXcoMvw4,55
|
|
129
|
-
bloqade/squin/op/_wrapper.py,sha256=
|
|
133
|
+
bloqade/squin/op/_wrapper.py,sha256=rmQHXjRHFEr-bATbKEKL30w1wlDB7vmrQzDDRoLhRVw,1866
|
|
130
134
|
bloqade/squin/op/number.py,sha256=yujWUqLrOAr8i8OBDsiS5M882wV7t08u345NgNA6TUc,95
|
|
131
135
|
bloqade/squin/op/rewrite.py,sha256=Itxz_hTAPNLyLYeLS0PCVk143J1Z558UR7N9-urbnoU,1327
|
|
132
136
|
bloqade/squin/op/stdlib.py,sha256=4UFK3wKImpums2v5a9OFKuVvz2TLYbYwidg3JYYEi2o,1073
|
|
133
|
-
bloqade/squin/op/stmts.py,sha256=
|
|
137
|
+
bloqade/squin/op/stmts.py,sha256=atPrr12Bc7D5xu_xavVgME3FBNqHQXQSAtMuh7xL0Dw,5491
|
|
134
138
|
bloqade/squin/op/traits.py,sha256=jjsnzWtPtmQK7K3H_D2fvc8XiW1Y3EMBcgeyPax2sjc,1065
|
|
135
139
|
bloqade/squin/op/types.py,sha256=ozUT0Bv9NuUxPjB2vAeqJ9cpdvUaBfP9trB5mybYxgc,663
|
|
136
|
-
bloqade/squin/
|
|
137
|
-
bloqade/squin/
|
|
138
|
-
bloqade/squin/rewrite/__init__.py,sha256=0-9m1cbvFRgjZpQ700NEjW1uKvwZPPbrmUwylhgOjUw,457
|
|
140
|
+
bloqade/squin/rewrite/U3_to_clifford.py,sha256=HpkFTqe-J0macb_aNs1QNs8wJDoUsmwf9Mtb0I3ZepI,5377
|
|
141
|
+
bloqade/squin/rewrite/__init__.py,sha256=mxP01A2IeOT5HKHKBRRMCIPN4BPKfpYSlQkSjY78ugQ,282
|
|
139
142
|
bloqade/squin/rewrite/desugar.py,sha256=fnxchVHIbLx96cv-g_jK7NCVV8t8mo52rs00JaPG7FM,1846
|
|
140
|
-
bloqade/squin/rewrite/
|
|
141
|
-
bloqade/squin/rewrite/
|
|
142
|
-
bloqade/
|
|
143
|
-
bloqade/squin/rewrite/wire_identity_elimination.py,sha256=Cscu8yaSslPuW04HvbXx4HJ3JzdUZNUMyFqcvuc4sxY,795
|
|
144
|
-
bloqade/squin/rewrite/wire_to_stim.py,sha256=PbXjwaF-Z2JioXALKx76uGkYr6-xy20zZFotPeDX-lY,1699
|
|
145
|
-
bloqade/squin/rewrite/wrap_analysis.py,sha256=OoKoS0zFLjfCnn4_fK4bgpQ_ueAEiHl1UmfNWhruxMc,2069
|
|
146
|
-
bloqade/stim/__init__.py,sha256=BbMeLjeIW29xuD6JB0cWG_g0qaYIy4xXbloDqvqbT7A,887
|
|
143
|
+
bloqade/squin/rewrite/remove_dangling_qubits.py,sha256=iTuWV-03YW5wtYbSeKMlnnWjNzDj9SmflyqYPgoYGy8,469
|
|
144
|
+
bloqade/squin/rewrite/wrap_analysis.py,sha256=JUPS4OAYbDHOK0VIrdz1pprSizISUfN7osuoP_P-bIo,2256
|
|
145
|
+
bloqade/stim/__init__.py,sha256=-TkpVoISvZ-HERL2LJfIMHs3Y4k-WdrGWM-_Rwe9q0o,905
|
|
147
146
|
bloqade/stim/_wrappers.py,sha256=KBIIOaeYPnhR3SJSNHcEzihLMcph2tL2mRKhEH47Je8,3939
|
|
148
147
|
bloqade/stim/groups.py,sha256=Fx8G698BGO7hR8OwpPXGUEYdW4uCCPwbMp_3fJAqa8M,585
|
|
149
148
|
bloqade/stim/dialects/__init__.py,sha256=A1Sq0jg8wi6MjRkzmuSBnHmO3EraD0pDFWz-dO6c6v8,89
|
|
@@ -155,7 +154,7 @@ bloqade/stim/dialects/auxiliary/lowering.py,sha256=4dxRZHGp_18EMVlYuZQFSzg4MIOBr
|
|
|
155
154
|
bloqade/stim/dialects/auxiliary/types.py,sha256=1l2YdJ-u9y0wpBfxh4OAlvmRAUnrmcDjDagoW2GyVaQ,314
|
|
156
155
|
bloqade/stim/dialects/auxiliary/stmts/__init__.py,sha256=VxLBnqlZngabs5vn3PiRNRXBBDueTCTmJ2wgWEertrA,371
|
|
157
156
|
bloqade/stim/dialects/auxiliary/stmts/annotate.py,sha256=NZT4AAW0lmwyHR31cmZI8aQNRsp5soeE36s9nBrcOmU,1759
|
|
158
|
-
bloqade/stim/dialects/auxiliary/stmts/const.py,sha256=
|
|
157
|
+
bloqade/stim/dialects/auxiliary/stmts/const.py,sha256=nxcpVylgjfKt8pDkcMzVBMGLjON2bQb99WSLv7frvkI,3298
|
|
159
158
|
bloqade/stim/dialects/collapse/__init__.py,sha256=MhlEWJR_mJI3teoip1N8MlHk2C68seJELXwmyjyx_ns,305
|
|
160
159
|
bloqade/stim/dialects/collapse/_dialect.py,sha256=F5uplH7WL9ZQatEp0ZMvgLWX1k9moAWW879LTNwnHH0,60
|
|
161
160
|
bloqade/stim/dialects/collapse/emit_str.py,sha256=4Vlhtq8BKMMuZLQ-ayUGJTuOs4YJ1rGurPZBZxBQJcU,1879
|
|
@@ -166,7 +165,7 @@ bloqade/stim/dialects/collapse/stmts/reset.py,sha256=4fPSdM_ZiivuUn4uiZGiZQ9swol
|
|
|
166
165
|
bloqade/stim/dialects/gate/__init__.py,sha256=5Y0BTlLOuW-Ud4LwAC_CUuMwxa04LKj4CTKgQbiL8yg,347
|
|
167
166
|
bloqade/stim/dialects/gate/_dialect.py,sha256=78_dThliFZG9xSwYhTdibxP3vefHpEDUawtZqb9X3uA,56
|
|
168
167
|
bloqade/stim/dialects/gate/emit.py,sha256=HGnko9_nV6jl0kOI_dBWWNQDjySo14jAFBsg-2lTVOU,2869
|
|
169
|
-
bloqade/stim/dialects/gate/stmts/__init__.py,sha256=
|
|
168
|
+
bloqade/stim/dialects/gate/stmts/__init__.py,sha256=TbXjWYfCbZNuGEehvtF75LELLJJo_GzoXWRnuVZphv8,461
|
|
170
169
|
bloqade/stim/dialects/gate/stmts/base.py,sha256=MK7Zu-Kys_64O0nXAkPzlHEnWYevBGm3FRHhJw33rrE,748
|
|
171
170
|
bloqade/stim/dialects/gate/stmts/clifford_1q.py,sha256=Sj1Nf9AA_WWazGTg5kzFRTaLRIj3Edj657j0B8dybdI,896
|
|
172
171
|
bloqade/stim/dialects/gate/stmts/clifford_2q.py,sha256=cb3BVSkOt5SiRq4D4WkbuUbEouK3MwDxQIhAF0cvZbo,239
|
|
@@ -180,6 +179,15 @@ bloqade/stim/emit/__init__.py,sha256=N2dPQY7OyqPwHAStDeOgYg2yfxqxMOz-N7pD5Z4JwlI
|
|
|
180
179
|
bloqade/stim/emit/stim_str.py,sha256=JyEBoIhLQASogZcUWHI9tMD4JoXYrEqUr2qaZ30gZdc,1491
|
|
181
180
|
bloqade/stim/parse/__init__.py,sha256=l2DjReB2KkgrDjP_4nP6RnoziiOewoSeZfTno1sVYTw,59
|
|
182
181
|
bloqade/stim/parse/lowering.py,sha256=L-IcR_exlxsTVv4SQ0bhzIF4_L82P-GEdK6qRd6B86Y,23723
|
|
182
|
+
bloqade/stim/passes/__init__.py,sha256=KAWJPhZHf0cVDmr9o9LNRfZU8G9aS4adGC4EC7ci_E8,54
|
|
183
|
+
bloqade/stim/passes/squin_to_stim.py,sha256=4CSWAevECGxYgtojzlH92YwRUlz_lDtedWNEylXKd0A,2752
|
|
184
|
+
bloqade/stim/rewrite/__init__.py,sha256=S2sKUKtX4EGofhZRbewvyHN5s-CavPzseYufij3R5SQ,372
|
|
185
|
+
bloqade/stim/rewrite/py_constant_to_stim.py,sha256=PV8bHvn759-d_0JW4akaGSORW_oxigrlUBhAC51PJAU,1354
|
|
186
|
+
bloqade/stim/rewrite/qubit_to_stim.py,sha256=VggIAS6EQ4a01YplDGJUMDpQ_q-UYD8C4g1xMC_zbcY,2509
|
|
187
|
+
bloqade/stim/rewrite/squin_measure.py,sha256=1X3rcfGvVDSEXmvqlw4T0LQu2A8LFeNeqz1_zf_I8vA,2466
|
|
188
|
+
bloqade/stim/rewrite/util.py,sha256=vpBbTv00odpnnyHTMJZRStb1ZQYfcgbOW5PT5Frf4jw,5847
|
|
189
|
+
bloqade/stim/rewrite/wire_identity_elimination.py,sha256=Cscu8yaSslPuW04HvbXx4HJ3JzdUZNUMyFqcvuc4sxY,795
|
|
190
|
+
bloqade/stim/rewrite/wire_to_stim.py,sha256=vHtktd9pfjlEpInwN7pPhsIHCxTtHJJqJJhYpy0kIGg,1685
|
|
183
191
|
bloqade/visual/__init__.py,sha256=Y7d0YgovKhUFzjMeDvt0wGRUZ3re3SY6iO3e8xHXrr4,37
|
|
184
192
|
bloqade/visual/animation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
185
193
|
bloqade/visual/animation/animate.py,sha256=NSKs3YDWgTZH2-Tpx3cP1bBcIEWTEPqK5UFkY_IF_3k,8927
|
|
@@ -191,7 +199,7 @@ bloqade/visual/animation/runtime/atoms.py,sha256=EmjxhujLiHHPS_HtH_B-7TiqeHgvW5u
|
|
|
191
199
|
bloqade/visual/animation/runtime/ppoly.py,sha256=JB9IP53N1w6adBJEue6J5Nmj818Id9JvrlgrmiQTU1I,1385
|
|
192
200
|
bloqade/visual/animation/runtime/qpustate.py,sha256=rlmxQeJSvaohXrTpXQL5y-NJcpvfW33xPaYM1slv7cc,4270
|
|
193
201
|
bloqade/visual/animation/runtime/utils.py,sha256=ju9IzOWX-vKwfpqUjlUKu3Ssr_UFPFFq-tzH_Nqyo_c,1212
|
|
194
|
-
bloqade_circuit-0.4.
|
|
195
|
-
bloqade_circuit-0.4.
|
|
196
|
-
bloqade_circuit-0.4.
|
|
197
|
-
bloqade_circuit-0.4.
|
|
202
|
+
bloqade_circuit-0.4.4.dist-info/METADATA,sha256=WNmsRDnheZ4YMfpb6skDmZ3tTRy_8eh8OwdyYXtCSwY,3683
|
|
203
|
+
bloqade_circuit-0.4.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
204
|
+
bloqade_circuit-0.4.4.dist-info/licenses/LICENSE,sha256=S5GIJwR6QCixPA9wryYb44ZEek0Nz4rt_zLUqP05UbU,13160
|
|
205
|
+
bloqade_circuit-0.4.4.dist-info/RECORD,,
|
bloqade/squin/passes/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .stim import SquinToStim as SquinToStim
|
bloqade/squin/passes/stim.py
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
|
-
|
|
3
|
-
from kirin.passes import Fold
|
|
4
|
-
from kirin.rewrite import (
|
|
5
|
-
Walk,
|
|
6
|
-
Chain,
|
|
7
|
-
Fixpoint,
|
|
8
|
-
DeadCodeElimination,
|
|
9
|
-
CommonSubexpressionElimination,
|
|
10
|
-
)
|
|
11
|
-
from kirin.ir.method import Method
|
|
12
|
-
from kirin.passes.abc import Pass
|
|
13
|
-
from kirin.rewrite.abc import RewriteResult
|
|
14
|
-
|
|
15
|
-
from bloqade.squin.rewrite import (
|
|
16
|
-
SquinWireToStim,
|
|
17
|
-
SquinQubitToStim,
|
|
18
|
-
WrapSquinAnalysis,
|
|
19
|
-
SquinMeasureToStim,
|
|
20
|
-
SquinWireIdentityElimination,
|
|
21
|
-
)
|
|
22
|
-
from bloqade.analysis.address import AddressAnalysis
|
|
23
|
-
from bloqade.squin.analysis.nsites import (
|
|
24
|
-
NSitesAnalysis,
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@dataclass
|
|
29
|
-
class SquinToStim(Pass):
|
|
30
|
-
|
|
31
|
-
def unsafe_run(self, mt: Method) -> RewriteResult:
|
|
32
|
-
fold_pass = Fold(mt.dialects)
|
|
33
|
-
# propagate constants
|
|
34
|
-
rewrite_result = fold_pass(mt)
|
|
35
|
-
|
|
36
|
-
# Get necessary analysis results to plug into hints
|
|
37
|
-
address_analysis = AddressAnalysis(mt.dialects)
|
|
38
|
-
address_frame, _ = address_analysis.run_analysis(mt)
|
|
39
|
-
site_analysis = NSitesAnalysis(mt.dialects)
|
|
40
|
-
sites_frame, _ = site_analysis.run_analysis(mt)
|
|
41
|
-
|
|
42
|
-
# Wrap Rewrite + SquinToStim can happen w/ standard walk
|
|
43
|
-
rewrite_result = (
|
|
44
|
-
Walk(
|
|
45
|
-
Chain(
|
|
46
|
-
WrapSquinAnalysis(
|
|
47
|
-
address_analysis=address_frame.entries,
|
|
48
|
-
op_site_analysis=sites_frame.entries,
|
|
49
|
-
),
|
|
50
|
-
SquinQubitToStim(),
|
|
51
|
-
SquinWireToStim(),
|
|
52
|
-
SquinMeasureToStim(), # reduce duplicated logic, can split out even more rules later
|
|
53
|
-
SquinWireIdentityElimination(),
|
|
54
|
-
)
|
|
55
|
-
)
|
|
56
|
-
.rewrite(mt.code)
|
|
57
|
-
.join(rewrite_result)
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
rewrite_result = (
|
|
61
|
-
Fixpoint(
|
|
62
|
-
Walk(Chain(DeadCodeElimination(), CommonSubexpressionElimination()))
|
|
63
|
-
)
|
|
64
|
-
.rewrite(mt.code)
|
|
65
|
-
.join(rewrite_result)
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
return rewrite_result
|
|
File without changes
|
|
File without changes
|
|
File without changes
|