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

Contiguous element ranges and intersection helpers.

Module Contents#

Classes#

Range

Contiguous element range in a caller-defined coordinate system.

Functions#

intersect_ranges

Intersect two element ranges in the same coordinate system.

API#

class core.distributed.fsdp.src.megatron_fsdp.experimental.range.Range#

Contiguous element range in a caller-defined coordinate system.

start: int#

None

numel: int#

None

property end: int#

Exclusive end of the range.

core.distributed.fsdp.src.megatron_fsdp.experimental.range.intersect_ranges(
first: core.distributed.fsdp.src.megatron_fsdp.experimental.range.Range,
second: core.distributed.fsdp.src.megatron_fsdp.experimental.range.Range,
) → core.distributed.fsdp.src.megatron_fsdp.experimental.range.Range#

Intersect two element ranges in the same coordinate system.

Return the later starting offset and the overlap length, or zero length when the ranges do not overlap.