Skip to content

bloqade.lanes.utils.raise_if_statements_outside_dialect_group

← Module overview

functionraise_if_statements_outside_dialect_groupsource

bloqade.lanes.utils.raise_if_statements_outside_dialect_group

Signature
def raise_if_statements_outside_dialect_group(method: ir.Method, stage: str, hint: str | None = None) -> None

Raise if method contains statements outside its own dialect group.

Thin wrapper around statements_outside_dialect_group that turns the offending statements into a single, precise error naming the statement kinds involved.

Call it at the end of a lowering stage under no_raise=False, alongside verify(). It serves two purposes there:

  • a real guard for a stage that drops a source dialect via dialects.discard(...) and so must leave none of its statements behind — NativeToPlace*, MoveToSquin*, MoveToStackMove;
  • a cheap invariant for a stage that discards nothing, such as PlaceToMove, which only adds the move dialect.

The composite PhysicalPipeline/LogicalPipeline entry points do not call it themselves — they inherit the checks from the stages they compose.

Parameters

NameTypeDefaultDescription
methodir.MethodrequiredThe kernel to scan.
stagestrrequiredName of the stage that produced ``method``, used in the message.
hintstr | NoneNoneOptional extra clause appended to the message, e.g. naming the rewrite rule that was expected to lower the statements.

Raises

TypeDescription
ValueErrorIf any statement's dialect is not a member of ``method.dialects``.
source