Skip to content

Commit bf6ea8f

Browse files
committed
adding option to pass to apply native gate rewrite first
1 parent 91a220e commit bf6ea8f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/bloqade/qasm2/passes/parallel.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
RaiseRegisterRule,
2828
UOpToParallelRule,
2929
SimpleOptimalMergePolicy,
30+
RydbergGateSetRewriteRule,
3031
)
3132
from bloqade.squin.analysis import schedule
3233

@@ -135,6 +136,7 @@ def test():
135136
"""
136137

137138
merge_policy_type: Type[MergePolicyABC] = SimpleOptimalMergePolicy
139+
rewrite_to_native_first: bool = False
138140
constprop: const.Propagate = field(init=False)
139141

140142
def __post_init__(self):
@@ -147,6 +149,13 @@ def unsafe_run(self, mt: ir.Method) -> abc.RewriteResult:
147149
if not result.has_done_something:
148150
return result
149151

152+
if self.rewrite_to_native_first:
153+
result = (
154+
Fixpoint(Walk(RydbergGateSetRewriteRule(self.dialects)))
155+
.rewrite(mt.code)
156+
.join(result)
157+
)
158+
150159
frame, _ = self.constprop.run_analysis(mt)
151160
result = Walk(WrapConst(frame)).rewrite(mt.code).join(result)
152161

0 commit comments

Comments
 (0)