Skip to content

bloqade.rewrite.passes.aggressive_unroll.AggressiveUnroll

← Module overview

classAggressiveUnrollsource

bloqade.rewrite.passes.aggressive_unroll.AggressiveUnroll

Bases: Pass

A pass to unroll structured control flow

Signature
class AggressiveUnroll(additional_inline_heuristic: Callable[[ir.Statement], bool] = lambda node: True)

Parameters

NameTypeDefaultDescription
additional_inline_heuristicCallable[[ir.Statement], bool]lambda node: True

Attributes

NameTypeDefaultDescription
additional_inline_heuristicCallable[[ir.Statement], bool]lambda node: True
foldFoldfield(init=False)
typeinferTypeInferfield(init=False)
scf_unrollUnrollScffield(init=False)
canonicalize_ilistCanonicalizeIListfield(init=False)

methodunsafe_runsource

bloqade.rewrite.passes.aggressive_unroll.AggressiveUnroll.unsafe_run

def unsafe_run(mt: Method) -> RewriteResult

Parameters

NameTypeDescription
mtMethod

Returns

RewriteResult

source

methodinline_heuristicsource

bloqade.rewrite.passes.aggressive_unroll.AggressiveUnroll.inline_heuristic

def inline_heuristic(node: ir.Statement) -> bool

The heuristic to decide whether to inline a function call or not. inside loops and if-else, only inline simple functions, i.e. functions with a single block

Parameters

NameTypeDescription
nodeir.Statement

Returns

bool

source