File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
src/bloqade/squin/analysis/shape Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ from kirin import ir , interp
2+ from kirin .analysis import Forward
3+ from kirin .analysis .forward import ForwardFrame
4+
5+ from bloqade .squin .op .types import OpType
6+
7+ from .lattice import Shape
8+
9+
10+ class ShapeAnalysis (Forward [Shape ]):
11+
12+ keys = ["op.shape" ]
13+ lattice = Shape
14+
15+ def initialize (self ):
16+ super ().initialize
17+ return self
18+
19+ def eval_stmt_fallback (
20+ self , frame : ForwardFrame [Shape ], stmt : ir .Statement
21+ ) -> tuple [Shape , ...] | interp .SpecialValue [Shape ]:
22+ return tuple (
23+ (
24+ self .lattice .top ()
25+ if result .type .is_subseteq (OpType )
26+ else self .lattice .bottom ()
27+ )
28+ for result in stmt .results
29+ )
30+
31+ def run_method (self , method : ir .Method , args : tuple [Shape , ...]):
32+ # NOTE: we do not support dynamic calls here, thus no need to propagate method object
33+ return self .run_callable (method .code , (self .lattice .bottom (),) + args )
Original file line number Diff line number Diff line change 1+ from kirin import interp
2+
3+ from bloqade import squin
4+
5+ """ from .lattice import (
6+ Shape,
7+ NoShape,
8+ OpShape,
9+ )
10+
11+ from .analysis import ShapeAnalysis """
12+
13+
14+ @squin .op .dialect .register (key = "op.shape" )
15+ class SquinOp (interp .MethodTable ):
16+
17+ # Should be using the Sized trait
18+ # that the statements have
19+ pass
You can’t perform that action at this time.
0 commit comments