bloqade-circuit 0.7.2__py3-none-any.whl → 0.7.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/qasm2/rewrite/register.py +2 -2
- bloqade/qasm2/rewrite/uop_to_parallel.py +3 -1
- bloqade/stim/passes/__init__.py +0 -1
- bloqade/stim/passes/squin_to_stim.py +14 -42
- {bloqade_circuit-0.7.2.dist-info → bloqade_circuit-0.7.4.dist-info}/METADATA +2 -2
- {bloqade_circuit-0.7.2.dist-info → bloqade_circuit-0.7.4.dist-info}/RECORD +8 -8
- {bloqade_circuit-0.7.2.dist-info → bloqade_circuit-0.7.4.dist-info}/WHEEL +0 -0
- {bloqade_circuit-0.7.2.dist-info → bloqade_circuit-0.7.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -2,7 +2,7 @@ from kirin import ir
|
|
|
2
2
|
from kirin.dialects import py
|
|
3
3
|
from kirin.rewrite.abc import RewriteRule, RewriteResult
|
|
4
4
|
|
|
5
|
-
from bloqade.qasm2.dialects import core
|
|
5
|
+
from bloqade.qasm2.dialects import core, expr
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class RaiseRegisterRule(RewriteRule):
|
|
@@ -26,7 +26,7 @@ class RaiseRegisterRule(RewriteRule):
|
|
|
26
26
|
n_qubits_ref = node.n_qubits
|
|
27
27
|
|
|
28
28
|
n_qubits = n_qubits_ref.owner
|
|
29
|
-
if isinstance(n_qubits, py.Constant):
|
|
29
|
+
if isinstance(n_qubits, py.Constant | expr.ConstInt):
|
|
30
30
|
# case where the n_qubits comes from a constant
|
|
31
31
|
new_n_qubits = n_qubits.from_stmt(n_qubits)
|
|
32
32
|
new_n_qubits.insert_before(first_stmt)
|
|
@@ -8,7 +8,7 @@ from kirin.rewrite.abc import RewriteRule, RewriteResult
|
|
|
8
8
|
from kirin.analysis.const import lattice
|
|
9
9
|
|
|
10
10
|
from bloqade.analysis import address
|
|
11
|
-
from bloqade.qasm2.dialects import uop, core, parallel
|
|
11
|
+
from bloqade.qasm2.dialects import uop, core, expr, parallel
|
|
12
12
|
from bloqade.squin.analysis.schedule import StmtDag
|
|
13
13
|
|
|
14
14
|
|
|
@@ -194,6 +194,8 @@ class SimpleMergePolicy(MergePolicyABC):
|
|
|
194
194
|
new_qubits.append(new_qubit.result)
|
|
195
195
|
case core.QRegGet(
|
|
196
196
|
reg=reg, idx=ir.ResultValue(stmt=py.Constant() as idx)
|
|
197
|
+
) | core.QRegGet(
|
|
198
|
+
reg=reg, idx=ir.ResultValue(stmt=expr.ConstInt() as idx)
|
|
197
199
|
):
|
|
198
200
|
(new_idx := idx.from_stmt(idx)).insert_before(node)
|
|
199
201
|
(
|
bloqade/stim/passes/__init__.py
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
|
|
3
|
-
from kirin.passes import Fold,
|
|
3
|
+
from kirin.passes import Fold, TypeInfer
|
|
4
4
|
from kirin.rewrite import (
|
|
5
5
|
Walk,
|
|
6
6
|
Chain,
|
|
7
7
|
Fixpoint,
|
|
8
8
|
CFGCompactify,
|
|
9
|
-
InlineGetItem,
|
|
10
|
-
InlineGetField,
|
|
11
9
|
DeadCodeElimination,
|
|
12
10
|
CommonSubexpressionElimination,
|
|
13
11
|
)
|
|
14
|
-
from kirin.dialects import
|
|
12
|
+
from kirin.dialects import ilist
|
|
15
13
|
from kirin.ir.method import Method
|
|
16
14
|
from kirin.passes.abc import Pass
|
|
17
15
|
from kirin.rewrite.abc import RewriteResult
|
|
18
16
|
from kirin.passes.inline import InlinePass
|
|
19
17
|
from kirin.rewrite.alias import InlineAlias
|
|
20
|
-
from kirin.
|
|
18
|
+
from kirin.passes.aggressive import UnrollScf
|
|
21
19
|
|
|
22
20
|
from bloqade.stim.rewrite import (
|
|
23
21
|
SquinWireToStim,
|
|
@@ -41,37 +39,6 @@ from .simplify_ifs import StimSimplifyIfs
|
|
|
41
39
|
from ..rewrite.ifs_to_stim import IfToStim
|
|
42
40
|
|
|
43
41
|
|
|
44
|
-
@dataclass
|
|
45
|
-
class AggressiveForLoopUnroll(Pass):
|
|
46
|
-
"""
|
|
47
|
-
Aggressive unrolling of for loops, addresses cases where unroll
|
|
48
|
-
does not successfully handle nested loops because of a lack of constprop.
|
|
49
|
-
|
|
50
|
-
This should be invoked via fixpoint to let this be repeatedly applied until
|
|
51
|
-
no further rewrites are possible.
|
|
52
|
-
"""
|
|
53
|
-
|
|
54
|
-
def unsafe_run(self, mt: Method) -> RewriteResult:
|
|
55
|
-
rule = Chain(
|
|
56
|
-
InlineGetField(),
|
|
57
|
-
InlineGetItem(),
|
|
58
|
-
scf.unroll.ForLoop(),
|
|
59
|
-
scf.trim.UnusedYield(),
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
# Intentionally only walk ONCE, let fixpoint happen with the WHOLE pass
|
|
63
|
-
# so that HintConst gets run right after, allowing subsequent unrolls to happen
|
|
64
|
-
rewrite_result = Walk(rule).rewrite(mt.code)
|
|
65
|
-
|
|
66
|
-
rewrite_result = (
|
|
67
|
-
HintConst(dialects=mt.dialects, no_raise=self.no_raise)
|
|
68
|
-
.unsafe_run(mt)
|
|
69
|
-
.join(rewrite_result)
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
return rewrite_result
|
|
73
|
-
|
|
74
|
-
|
|
75
42
|
@dataclass
|
|
76
43
|
class SquinToStimPass(Pass):
|
|
77
44
|
|
|
@@ -82,8 +49,11 @@ class SquinToStimPass(Pass):
|
|
|
82
49
|
dialects=mt.dialects, no_raise=self.no_raise
|
|
83
50
|
).unsafe_run(mt)
|
|
84
51
|
|
|
52
|
+
rewrite_result = Walk(ilist.rewrite.HintLen()).rewrite(mt.code)
|
|
53
|
+
rewrite_result = Fold(self.dialects).unsafe_run(mt).join(rewrite_result)
|
|
54
|
+
|
|
85
55
|
rewrite_result = (
|
|
86
|
-
|
|
56
|
+
UnrollScf(dialects=mt.dialects, no_raise=self.no_raise)
|
|
87
57
|
.fixpoint(mt)
|
|
88
58
|
.join(rewrite_result)
|
|
89
59
|
)
|
|
@@ -92,11 +62,7 @@ class SquinToStimPass(Pass):
|
|
|
92
62
|
Walk(Fixpoint(CFGCompactify())).rewrite(mt.code).join(rewrite_result)
|
|
93
63
|
)
|
|
94
64
|
|
|
95
|
-
rewrite_result = (
|
|
96
|
-
Walk(Chain(InlineAlias(), PickIfElse()))
|
|
97
|
-
.rewrite(mt.code)
|
|
98
|
-
.join(rewrite_result)
|
|
99
|
-
)
|
|
65
|
+
rewrite_result = Walk(InlineAlias()).rewrite(mt.code).join(rewrite_result)
|
|
100
66
|
|
|
101
67
|
rewrite_result = (
|
|
102
68
|
StimSimplifyIfs(mt.dialects, no_raise=self.no_raise)
|
|
@@ -111,6 +77,12 @@ class SquinToStimPass(Pass):
|
|
|
111
77
|
)
|
|
112
78
|
rewrite_result = Fold(mt.dialects, no_raise=self.no_raise)(mt)
|
|
113
79
|
|
|
80
|
+
rewrite_result = (
|
|
81
|
+
UnrollScf(mt.dialects, no_raise=self.no_raise)
|
|
82
|
+
.fixpoint(mt)
|
|
83
|
+
.join(rewrite_result)
|
|
84
|
+
)
|
|
85
|
+
|
|
114
86
|
rewrite_result = (
|
|
115
87
|
CanonicalizeIList(dialects=mt.dialects, no_raise=self.no_raise)
|
|
116
88
|
.unsafe_run(mt)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bloqade-circuit
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.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
|
|
7
7
|
Requires-Python: >=3.10
|
|
8
|
-
Requires-Dist: kirin-toolchain~=0.17.
|
|
8
|
+
Requires-Dist: kirin-toolchain~=0.17.23
|
|
9
9
|
Requires-Dist: numpy>=1.22.0
|
|
10
10
|
Requires-Dist: pandas>=2.2.3
|
|
11
11
|
Requires-Dist: pydantic<2.11.0,>=1.3.0
|
|
@@ -108,8 +108,8 @@ bloqade/qasm2/rewrite/insert_qubits.py,sha256=PpYNlJAl-TVtC1MJxIzOQWDetgW8OPXe6c
|
|
|
108
108
|
bloqade/qasm2/rewrite/native_gates.py,sha256=GVutT1jf_gv9qaR5fLqjcmxcqCfMZTiQyg4Fq-TlmFM,18684
|
|
109
109
|
bloqade/qasm2/rewrite/parallel_to_glob.py,sha256=TQ5EAYIx7pLpydSeeF2Ta0h5evaHHXaRtvtgz1X3Kfo,2750
|
|
110
110
|
bloqade/qasm2/rewrite/parallel_to_uop.py,sha256=_banEox20L_qU1GTvKjSSDBkFg49UlSE-POuTCKnrzY,2351
|
|
111
|
-
bloqade/qasm2/rewrite/register.py,sha256=
|
|
112
|
-
bloqade/qasm2/rewrite/uop_to_parallel.py,sha256=
|
|
111
|
+
bloqade/qasm2/rewrite/register.py,sha256=0q-zkSdZih3BbRUDGnig8fFVQA9y2fhn3wdsu4Kbdm4,1563
|
|
112
|
+
bloqade/qasm2/rewrite/uop_to_parallel.py,sha256=2_7SQh1SRQaCk6v0HbV0G2rSlUGscIHmmDQcaMIpTwE,13131
|
|
113
113
|
bloqade/qasm2/rewrite/noise/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
114
114
|
bloqade/qasm2/rewrite/noise/heuristic_noise.py,sha256=7C7yYC66HLZPlTynXwfZ5lKnJkLnDGLT7lVWxREozuc,7851
|
|
115
115
|
bloqade/qasm2/rewrite/noise/remove_noise.py,sha256=rnalZ1igiTpCFJ9Z3PRdzcx-qnkkALv6iQO-_yz39kM,1097
|
|
@@ -207,9 +207,9 @@ bloqade/stim/emit/__init__.py,sha256=N2dPQY7OyqPwHAStDeOgYg2yfxqxMOz-N7pD5Z4JwlI
|
|
|
207
207
|
bloqade/stim/emit/stim_str.py,sha256=JyEBoIhLQASogZcUWHI9tMD4JoXYrEqUr2qaZ30gZdc,1491
|
|
208
208
|
bloqade/stim/parse/__init__.py,sha256=l2DjReB2KkgrDjP_4nP6RnoziiOewoSeZfTno1sVYTw,59
|
|
209
209
|
bloqade/stim/parse/lowering.py,sha256=L-IcR_exlxsTVv4SQ0bhzIF4_L82P-GEdK6qRd6B86Y,23723
|
|
210
|
-
bloqade/stim/passes/__init__.py,sha256=
|
|
210
|
+
bloqade/stim/passes/__init__.py,sha256=hemzgyl_pwZi34secp1GqStAW0d09CEeKvLD0fXhbb8,111
|
|
211
211
|
bloqade/stim/passes/simplify_ifs.py,sha256=zicqggWu_yzfrf2a7uUCt-ZenbYSEnFsyGxDfKw72qQ,1084
|
|
212
|
-
bloqade/stim/passes/squin_to_stim.py,sha256=
|
|
212
|
+
bloqade/stim/passes/squin_to_stim.py,sha256=mqCspofBJ60YUU5dl7AdxmctmHygk1yeRr4ucgD9TbU,5620
|
|
213
213
|
bloqade/stim/rewrite/__init__.py,sha256=zL5G73JEsXkehN7gCtUgGnmC2BJ3vKihOd1ohVwM68E,480
|
|
214
214
|
bloqade/stim/rewrite/ifs_to_stim.py,sha256=A3SndoGinZHLul17zXWyQrK_1Hy5I4qvuOskLIeDRMU,6942
|
|
215
215
|
bloqade/stim/rewrite/py_constant_to_stim.py,sha256=PV8bHvn759-d_0JW4akaGSORW_oxigrlUBhAC51PJAU,1354
|
|
@@ -232,7 +232,7 @@ bloqade/visual/animation/runtime/atoms.py,sha256=EmjxhujLiHHPS_HtH_B-7TiqeHgvW5u
|
|
|
232
232
|
bloqade/visual/animation/runtime/ppoly.py,sha256=JB9IP53N1w6adBJEue6J5Nmj818Id9JvrlgrmiQTU1I,1385
|
|
233
233
|
bloqade/visual/animation/runtime/qpustate.py,sha256=rlmxQeJSvaohXrTpXQL5y-NJcpvfW33xPaYM1slv7cc,4270
|
|
234
234
|
bloqade/visual/animation/runtime/utils.py,sha256=ju9IzOWX-vKwfpqUjlUKu3Ssr_UFPFFq-tzH_Nqyo_c,1212
|
|
235
|
-
bloqade_circuit-0.7.
|
|
236
|
-
bloqade_circuit-0.7.
|
|
237
|
-
bloqade_circuit-0.7.
|
|
238
|
-
bloqade_circuit-0.7.
|
|
235
|
+
bloqade_circuit-0.7.4.dist-info/METADATA,sha256=pvbmLzuKl7jWDD9tjP6Z5VckwUv4sqUb00ArREsgXwo,3850
|
|
236
|
+
bloqade_circuit-0.7.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
237
|
+
bloqade_circuit-0.7.4.dist-info/licenses/LICENSE,sha256=S5GIJwR6QCixPA9wryYb44ZEek0Nz4rt_zLUqP05UbU,13160
|
|
238
|
+
bloqade_circuit-0.7.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|