core.distributed.fsdp.src.megatron_fsdp.experimental.execution_order#

Weak, phase-tagged execution sequences with a sequential cursor.

Module Contents#

Classes#

ExecutionEvent

A module and its compute phase.

ExecutionOrder

Store an execution trace with one sequential cursor across all phases.

API#

class core.distributed.fsdp.src.megatron_fsdp.experimental.execution_order.ExecutionEvent#

Bases: typing.NamedTuple

A module and its compute phase.

module: torch.nn.Module#

None

phase: core.distributed.fsdp.src.megatron_fsdp.experimental.phase.Phase#

None

class core.distributed.fsdp.src.megatron_fsdp.experimental.execution_order.ExecutionOrder(
items: collections.abc.Iterable[core.distributed.fsdp.src.megatron_fsdp.experimental.execution_order.ExecutionEvent] = (),
)#

Store an execution trace with one sequential cursor across all phases.

Initialization

Create a weak sequence, preserving every repeated occurrence.

property position: int#

Index of the next event to consume.

append(
item: core.distributed.fsdp.src.megatron_fsdp.experimental.execution_order.ExecutionEvent,
) → None#

Append an event without consuming it.

__iter__() → collections.abc.Iterator[core.distributed.fsdp.src.megatron_fsdp.experimental.execution_order.ExecutionEvent]#

Iterate over live occurrences without retaining their modules.

peek(
offset: int = 0,
) → core.distributed.fsdp.src.megatron_fsdp.experimental.execution_order.ExecutionEvent | None#

Read an event relative to the cursor without wrapping or advancing.

successors() → collections.abc.Iterator[core.distributed.fsdp.src.megatron_fsdp.experimental.execution_order.ExecutionEvent]#

Look ahead from the current occurrence without wrapping or advancing.

advance() → None#

Consume one occurrence and automatically wrap at the end of the trace.