Skip to content

bloqade.stim.passes.constprop_override.StimConstProp

← Module overview

classStimConstPropsource

bloqade.stim.passes.constprop_override.StimConstProp

Bases: ForwardExtra[const.Frame, const.Result]

Constant propagation with early-termination for scf.For loops.

class StimConstProp

Like kirin’s Propagate, but uses the “stim.constprop” key to pick up the early-termination handler for scf.For, falling back to “constprop” for everything else.

NOTE: This duplicates Propagate’s logic because Propagate is @final. Once the early termination is upstreamed into kirin, this class and the “stim.constprop” registration can be removed entirely.

Attributes

NameTypeDefaultDescription
keys—('stim.constprop', 'constprop')
lattice—const.Result

methodinitializesource

bloqade.stim.passes.constprop_override.StimConstProp.initialize

def initialize()
source

methodinitialize_framesource

bloqade.stim.passes.constprop_override.StimConstProp.initialize_frame

Signature
def initialize_frame(node: ir.Statement, *, has_parent_access: bool = False) -> const.Frame

Parameters

NameTypeDefaultDescription
nodeir.Statementrequired
has_parent_accessboolFalse

Returns

const.Frame

source

methodmethod_selfsource

bloqade.stim.passes.constprop_override.StimConstProp.method_self

def method_self(method: ir.Method) -> const.Result

Parameters

NameTypeDescription
methodir.Method

Returns

const.Result

source

methodframe_evalsource

bloqade.stim.passes.constprop_override.StimConstProp.frame_eval

Signature
def frame_eval(frame: const.Frame, node: ir.Statement) -> interp.StatementResult[const.Result]

Parameters

NameTypeDescription
frameconst.Frame
nodeir.Statement

Returns

interp.StatementResult[const.Result]

source

methodtry_eval_const_puresource

bloqade.stim.passes.constprop_override.StimConstProp.try_eval_const_pure

Signature
def try_eval_const_pure(frame: const.Frame, stmt: ir.Statement, values: tuple[const.Value, ...]) -> interp.StatementResult[const.Result]

Parameters

NameTypeDescription
frameconst.Frame
stmtir.Statement
valuestuple[const.Value, ...]

Returns

interp.StatementResult[const.Result]

source