Skip to content

Move synthesis

Shared two-word move synthesis: layout transition to move layers.

Given an architecture spec and two concrete states (before/after layouts), computes the sequence of move layers for the 2-word logical architecture. Used by the fixed-home placement strategy and (in the future) by non-fixed strategies for both right-to-left and left-to-right phases.

move_to_entangle

move_to_entangle(
    arch_spec: ArchSpec,
    state_before: ConcreteState,
    state_after: ConcreteState,
) -> tuple[
    ConcreteState,
    tuple[tuple[layout.LaneAddress, ...], ...],
]

Synthesize move layers from current layout to CZ entangling layout.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/heuristics/move_synthesis.py
142
143
144
145
146
147
148
def move_to_entangle(
    arch_spec: layout.ArchSpec,
    state_before: ConcreteState,
    state_after: ConcreteState,
) -> tuple[ConcreteState, tuple[tuple[layout.LaneAddress, ...], ...]]:
    """Synthesize move layers from current layout to CZ entangling layout."""
    return state_after, compute_move_layers(arch_spec, state_before, state_after)

move_to_left

move_to_left(
    arch_spec: ArchSpec,
    state_before: ConcreteState,
    state_after: ConcreteState,
) -> tuple[
    ConcreteState,
    tuple[tuple[layout.LaneAddress, ...], ...],
]

Synthesize move layers from CZ layout to post-CZ return layout.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/heuristics/move_synthesis.py
151
152
153
154
155
156
157
158
159
160
161
162
163
def move_to_left(
    arch_spec: layout.ArchSpec,
    state_before: ConcreteState,
    state_after: ConcreteState,
) -> tuple[ConcreteState, tuple[tuple[layout.LaneAddress, ...], ...]]:
    """Synthesize move layers from CZ layout to post-CZ return layout."""
    # This uses reverse lanes for a non-existent CZ to derive the return moves.
    forward_layers = compute_move_layers(arch_spec, state_after, state_before)
    reverse_layers = tuple(
        tuple(lane.reverse() for lane in move_lanes[::-1])
        for move_lanes in forward_layers[::-1]
    )
    return state_after, reverse_layers