Skip to content

Strategy

PalindromePlacementStrategy

PalindromePlacementStrategy(*, inner: PlacementStrategyABC)

Bases: PlacementStrategyABC


              flowchart TD
              bloqade.lanes.analysis.placement.strategy.PalindromePlacementStrategy[PalindromePlacementStrategy]
              bloqade.lanes.analysis.placement.strategy.PlacementStrategyABC[PlacementStrategyABC]

                              bloqade.lanes.analysis.placement.strategy.PlacementStrategyABC --> bloqade.lanes.analysis.placement.strategy.PalindromePlacementStrategy
                


              click bloqade.lanes.analysis.placement.strategy.PalindromePlacementStrategy href "" "bloqade.lanes.analysis.placement.strategy.PalindromePlacementStrategy"
              click bloqade.lanes.analysis.placement.strategy.PlacementStrategyABC href "" "bloqade.lanes.analysis.placement.strategy.PlacementStrategyABC"
            

Wraps any PlacementStrategyABC to emit ExecuteCZReturn for every CZ.

On cz_placements: unwraps ExecuteCZReturn input to the home ConcreteState (via initial_layout), delegates to inner, then wraps the resulting ExecuteCZ in ExecuteCZReturn.

On sq_placements and measure_placements: unwraps ExecuteCZReturn to the home ConcreteState before delegating, so the inner strategy always sees a plain ConcreteState.

This replaces the insert_return_moves flag: choosing this strategy enables palindrome moves; using the bare inner strategy disables them.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/analysis/placement/strategy.py
165
166
def __init__(self, *, inner: PlacementStrategyABC) -> None:
    self.inner = inner

assert_single_cz_zone

assert_single_cz_zone(
    arch_spec: ArchSpec, strategy_name: str
) -> None

Validate that the arch has exactly one CZ-capable zone.

The current placement strategies emit CZ pulses in every zone with entangling_pairs (via ArchSpec.cz_zone_addresses), which is correct only when there is one such zone. Multi-zone CZ scheduling requires deriving the active zones from the specific (controls, targets) of each CZ layer and is not yet implemented; until then we fail loudly at construction time so callers don't silently get extra CZ pulses on unrelated zones.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/analysis/placement/strategy.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
def assert_single_cz_zone(arch_spec: ArchSpec, strategy_name: str) -> None:
    """Validate that the arch has exactly one CZ-capable zone.

    The current placement strategies emit CZ pulses in every zone with
    ``entangling_pairs`` (via ``ArchSpec.cz_zone_addresses``), which is
    correct only when there is one such zone. Multi-zone CZ scheduling
    requires deriving the active zones from the specific (controls,
    targets) of each CZ layer and is not yet implemented; until then we
    fail loudly at construction time so callers don't silently get extra
    CZ pulses on unrelated zones.
    """
    cz_zones = arch_spec.cz_zone_addresses
    if len(cz_zones) != 1:
        zone_ids = sorted(z.zone_id for z in cz_zones)
        raise ValueError(
            f"{strategy_name} requires exactly one CZ-capable zone, "
            f"found {len(cz_zones)} (zone ids: {zone_ids}). "
            "Multi-zone CZ scheduling is not yet supported by this strategy."
        )