Skip to content

Asap

ASAP (As-Soon-As-Possible) scheduling policy.

asap_reorder_policy

asap_reorder_policy(
    stmts: list[_SchedulableStmt],
) -> list[_SchedulableStmt]

ASAP scheduling policy. Hard barriers (Initialize, EndMeasure) divide the body into independent segments; each segment is scheduled separately.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/reorder_static_placement/asap.py
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
def asap_reorder_policy(
    stmts: list[_SchedulableStmt],
) -> list[_SchedulableStmt]:
    """ASAP scheduling policy. Hard barriers (Initialize, EndMeasure) divide
    the body into independent segments; each segment is scheduled separately."""
    result: list[_SchedulableStmt] = []
    segment: list[_SchedulableStmt] = []

    for stmt in stmts:
        if isinstance(stmt, _BARRIERS):
            result.extend(_asap_schedule(segment))
            result.append(stmt)
            segment = []
        else:
            segment.append(stmt)
    result.extend(_asap_schedule(segment))
    return result