Skip to content

bloqade.lanes.transform.move_to_stack.MoveToStackMove

← Module overview

classMoveToStackMovesource

bloqade.lanes.transform.move_to_stack.MoveToStackMove

Lower a ``move``-dialect kernel to a canonicalized ``stack_move`` kernel.

class MoveToStackMove(arch_spec: ArchSpec)

emit runs the full move → stack_move lowering pipeline, producing an ir.Method that is stack-consistent and ready for bytecode emission:

  1. RewriteMoveToStackMove — in-place move → stack_move rewrite (strips Load/Store state threading, materialises address attributes as Const* SSA values, rebuilds Measure/AwaitMeasure/GetItem).
  2. DCE + CSE to a fixpoint — the cleanup the encoder pipeline expects before stackification (see stackify’s docstring).
  3. stackify — normalise into stack-consistent form (single block, each SSA value used at most once, defining statements in stack order).

RewriteMoveToStackMove only lowers the subset of move statements the bytecode path supports. When no_raise is False, emit runs raise_if_statements_outside_dialect_group right after dropping move from the group — before stackify, so an unlowered statement is reported precisely instead of garbled by a later stage. Kirin’s verify() does not check dialect-group membership, so such a statement would otherwise slip through and fail lazily inside dump_program.

emit_bytecode runs emit and encodes the result to a bytecode Program via dump_program.

Parameters

NameTypeDescription
arch_specArchSpec

Attributes

NameTypeDescription
arch_specArchSpec

methodemitsource

bloqade.lanes.transform.move_to_stack.MoveToStackMove.emit

def emit(main: ir.Method, no_raise: bool = True) -> ir.Method

Parameters

NameTypeDefaultDescription
mainir.Methodrequired
no_raiseboolTrue

Returns

ir.Method

source

methodemit_bytecodesource

bloqade.lanes.transform.move_to_stack.MoveToStackMove.emit_bytecode

Signature
def emit_bytecode(main: ir.Method, version: tuple[int, int] = (1, 0), no_raise: bool = True) -> Program

Parameters

NameTypeDefaultDescription
mainir.Methodrequired
versiontuple[int, int](1, 0)
no_raiseboolTrue

Returns

Program

source