bloqade.lanes.rewrite.stack_move2move.RewriteStackMoveToMove
← Module overview
class
method
source
classRewriteStackMoveToMove¶source
bloqade.lanes.rewrite.stack_move2move.RewriteStackMoveToMove
Bases: RewriteRule
Rewrite a stack_move block into a multi-dialect block in place.
Signature
class RewriteStackMoveToMove(arch_spec: ArchSpec, ssa_to_attr: dict[ir.SSAValue, Any] = dict(), state: ir.SSAValue | None = None)Constructor args:
- arch_spec: required. AwaitMeasure lowering iterates
arch_spec.yield_zone_locations(zone)for each zone on the originating move.Measure to emit the GetFutureResult chain that materialises the 1-D measurement-result array (element order is defined by the ArchSpec).
Mutable state on the rule instance, carried across the walk:
- ssa_to_attr: stack_move SSA → raw Python attribute value (float, int, LocationAddress, LaneAddress, ZoneAddress) for operands that need to be lifted into target-dialect attributes (addresses, rotation angles). SSA-to-attribute can’t be expressed through SSA rewiring because attributes aren’t SSA values, so we carry an explicit mapping. The value type is Any because the lifted values span heterogeneous scalar and address types.
- state: the current StateType SSA value in the target IR.
For SSA-valued outputs (arrays, futures, detectors, observables,
constants that emit py.Constant), we use the Kirin idiom
old_ssa.replace_by(new_ssa) to redirect all uses in place — no
second mapping needed. This matches state.RewriteLoadStore’s
next_use.replace_by(current_use) pattern.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
arch_spec | ArchSpec | required | |
ssa_to_attr | dict[ir.SSAValue, Any] | dict() | |
state | ir.SSAValue | None | None |
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
arch_spec | ArchSpec | required | |
ssa_to_attr | dict[ir.SSAValue, Any] | field(default_factory=dict) | |
state | ir.SSAValue | None | None |
methodrewrite_Block¶source
bloqade.lanes.rewrite.stack_move2move.RewriteStackMoveToMove.rewrite_Block
def rewrite_Block(node: ir.Block) -> RewriteResultParameters
| Name | Type | Description |
|---|---|---|
node | ir.Block |
Returns
RewriteResult