Skip to content

bloqade.lanes.transform.native_to_place.NativeToPlaceBase

← Module overview

classNativeToPlaceBasesource

bloqade.lanes.transform.native_to_place.NativeToPlaceBase

Template-method base for the squin-native → place compilation stage.

class NativeToPlaceBase(arch_spec: ArchSpec | None = None)

Subclasses override up to four hooks; all other steps are shared:

  • _pre_native_rewrites(mt, out, no_raise) — called after out is created (dialect-extended copy of mt) but before SquinToNative. Default is a no-op. Logical subclass runs ValidationSuite on mt and applies callgraph rewrites to out.

  • _squin_clifford_rules() — squin→squin rules run over the call graph as the last step before SquinToNative. The base implementation decomposes composite Cliffords into the neutral-atom gate set; the logical subclass appends the Steane transversal adjoint swap.

  • _post_unroll_validation(out) — called after AggressiveUnroll, before ScfToCfRule. Default is a no-op. Physical subclass runs PhysicalTerminalMeasurementValidation.

  • _lower_qubits(out) — called after the optional address/duplicate validation block. Must be overridden: raises NotImplementedError. Physical subclass runs RewriteQubitsToPinnedQubits + RewritePhysicalMeasure; logical subclass runs the four initialize rewrites.

The arch_spec field controls whether post-unroll address and duplicate validation runs (the if self.arch_spec is not None block). Both PhysicalPipeline and LogicalPipeline always supply an arch_spec (defaulting to their respective Gemini arch specs), so this validation is unconditional for both pipelines. Set arch_spec=None only when constructing a NativeToPlaceBase subclass directly and you explicitly want to skip address validation.

Parameters

NameTypeDefaultDescription
arch_specArchSpec | NoneNone

Attributes

NameTypeDefaultDescription
arch_specArchSpec | Nonefield(default=None)

methodemitsource

bloqade.lanes.transform.native_to_place.NativeToPlaceBase.emit

def emit(mt: Method, no_raise: bool = True) -> Method

Parameters

NameTypeDefaultDescription
mtMethodrequired
no_raiseboolTrue

Returns

Method

source