Skip to content

squin to stim rewrite #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4e21ec1
initial steps for squin to stim rewrite
johnzl-777 Apr 14, 2025
89a17fd
Wrap rewrite pass
johnzl-777 Apr 14, 2025
f6105bb
confirm analysis wrapping works
johnzl-777 Apr 14, 2025
ad3a7dc
Merge branch 'main' into 19-rewrite-from-squin-to-stim
johnzl-777 Apr 14, 2025
7c70b5e
going to bed
johnzl-777 Apr 15, 2025
e55a8fb
preliminary handling of Apply
johnzl-777 Apr 15, 2025
e76b3f3
support for control gates confirmed
johnzl-777 Apr 15, 2025
7ba5670
finally put everything into a pass
johnzl-777 Apr 16, 2025
f3203da
partially working reset rewrite
johnzl-777 Apr 17, 2025
20d4214
account for MeasureAndReset
johnzl-777 Apr 17, 2025
300f9d7
account for MeasureAndReset, fix up address analysis
johnzl-777 Apr 17, 2025
c137221
Merge branch 'main' into 19-rewrite-from-squin-to-stim
johnzl-777 Apr 18, 2025
13ae8a5
more testing, verification implemented
johnzl-777 Apr 18, 2025
59f763d
remove test call
johnzl-777 Apr 18, 2025
9427571
simple site verification test
johnzl-777 Apr 18, 2025
e45c10c
saving remaining work before move to codegen
johnzl-777 Apr 22, 2025
1a67a03
Merge branch 'main' into 19-rewrite-from-squin-to-stim
johnzl-777 Apr 23, 2025
9b6562f
Merge branch 'main' into 19-rewrite-from-squin-to-stim
Roger-luo May 13, 2025
30b8a97
account for MeasureQubit, MeasureQubitIlist as well as Broadcast func…
johnzl-777 May 14, 2025
615a30b
revise tests
johnzl-777 May 14, 2025
47691e2
remove unnecessary comment
johnzl-777 May 14, 2025
c8c38ae
Move wrap analysis rewrite into its own file
johnzl-777 May 14, 2025
72e5f3f
split out reusable utility functions into a seperate file
johnzl-777 May 14, 2025
4731fe0
fix export problem
johnzl-777 May 14, 2025
410bcbc
split out rewrite rules, factor in feedback on rewriting wrap/unwrap …
johnzl-777 May 15, 2025
cab4ab6
get control statement logic to work in wire dialect, simplify stateme…
johnzl-777 May 15, 2025
c810544
use dict instead of match, just care about type comparison
johnzl-777 May 15, 2025
fb9ff37
use replace_by, fix analysis impl
johnzl-777 May 15, 2025
e6c92b7
first round of meeting feedback implemented
johnzl-777 May 15, 2025
9316a0e
split out Measure rewrite into its own rule
johnzl-777 May 15, 2025
e3b478a
add tests but codegen is acting weird
johnzl-777 May 15, 2025
0f759b8
remove site-target dimension check
johnzl-777 May 15, 2025
877755e
Merge branch 'main' into 19-rewrite-from-squin-to-stim
johnzl-777 May 15, 2025
4faf282
Merge branch 'main' into 19-rewrite-from-squin-to-stim
johnzl-777 May 16, 2025
dbc105c
implement second round review feedback
johnzl-777 May 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added src/bloqade/main.py
Empty file.
1 change: 1 addition & 0 deletions src/bloqade/squin/analysis/nsites/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Need this for impl registration to work properly!
from . import impls as impls
from .lattice import (
Sites as Sites,
NoSites as NoSites,
AnySites as AnySites,
NumberSites as NumberSites,
Expand Down
Empty file.
30 changes: 30 additions & 0 deletions src/bloqade/squin/analysis/rewrite/stim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from typing import Dict

Check failure on line 1 in src/bloqade/squin/analysis/rewrite/stim.py

View workflow job for this annotation

GitHub Actions / build

Imports are incorrectly sorted and/or formatted.
from dataclasses import dataclass

from bloqade.analysis.address import Address
from bloqade.squin.analysis.nsites import Sites

from kirin import ir
from kirin.rewrite.abc import RewriteResult, RewriteRule


@dataclass
class SquinToStim(RewriteRule):

# Somehow need to plug in Address and Sites
# into the SSAValue Hints field, which only accepts
# Attribute types

## Could literally just plug in `ir.Attribute` into
## the Address and Site lattices?
## Couldn't I just create my own attributes instead?

address_analysis: Dict[ir.SSAValue, Address]
op_site_analysis: Dict[ir.SSAValue, Sites]

# need to plug in data into the SSAValue
# for the rewrite from these passes,
# then something should look at those hints
# and generate the corresponding stim statements

pass
Loading