Constprop override
Early-termination scf.For constprop for the Stim pipeline.
Kirin's default scf.For constprop iterates the loop body N times for range(N). For loops where the body produces the same result each iteration (e.g. REPEAT-eligible loops in Stim), this is redundant -- the analysis converges after 1-2 iterations.
This module registers an early-termination handler under the "stim.constprop" key on the scf dialect. StimConstProp resolves "stim.constprop" first, falling back to "constprop" for everything else.
StimConstProp
dataclass
StimConstProp()
Bases: ForwardExtra[Frame, Result]
flowchart TD
bloqade.stim.passes.constprop_override.StimConstProp[StimConstProp]
click bloqade.stim.passes.constprop_override.StimConstProp href "" "bloqade.stim.passes.constprop_override.StimConstProp"
Constant propagation with early-termination for scf.For loops.
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.
StimHintConst
dataclass
StimHintConst()
Bases: Pass
flowchart TD
bloqade.stim.passes.constprop_override.StimHintConst[StimHintConst]
click bloqade.stim.passes.constprop_override.StimHintConst href "" "bloqade.stim.passes.constprop_override.StimHintConst"
HintConst with early-termination scf.For constprop.