core.tensor_parallel.gtp_parallel_layout#
Rank layouts for GTP weight sharding and replication, and sequence and batch partitioning.
Layouts are computed without initializing distributed process groups. TP is the innermost axis, followed by GTP_remat weight shards, with PP as the outermost axis. A contiguous TP x GTP_remat tile can therefore be placed within one NVLink domain by the launcher. Context parallelism may span several such tiles without enlarging weight gathers.
Module Contents#
Classes#
Describe two views of the same ranks, keeping actual weight shards fixed. |
|
Bootstrap adapter for RankGenerator’s rank-list interface. |
Functions#
Return sequence-shard counts including and excluding TP/SP, respectively. |
|
Return independent batch partitions: DP x GTP_remat batch shards. |
API#
- core.tensor_parallel.gtp_parallel_layout.resolve_tensor_parallel_sequence_shards(
- tensor_model_parallel_size: int,
- tensor_parallel_num_sequence_shards: Optional[int],
- gtp_weight_remat_size: int,
- sequence_parallel: bool,
Return sequence-shard counts including and excluding TP/SP, respectively.
- core.tensor_parallel.gtp_parallel_layout.get_batch_parallel_size(args) int#
Return independent batch partitions: DP x GTP_remat batch shards.
This replaces DP x GTP_remat when some GTP_remat ranks partition sequences. The fallback supports manually built launch args without a resolved batch size.
- class core.tensor_parallel.gtp_parallel_layout.GTPParallelLayout#
Describe two views of the same ranks, keeping actual weight shards fixed.
cpis independent of GTP_remat.num_sequence_shardspartitions sequences within each weight group, excluding TP/SP.weight_sizeexcludes TP.dpis the residual independent-data axis; callers should usebatch_parallel_sizefor batch accounting andnum_weight_replicasfor dense optimizer sharding.- world_size: int#
None
- tp: int#
None
- pp: int#
None
- cp: int#
None
- weight_size: int#
None
- num_sequence_shards: int#
1
- rank_offset: int#
0
- __post_init__() None#
- property minimum_world_size: int#
Smallest world that can hold both layouts.
- property dp: int#
Residual independent-data degree, excluding batch shards inside GTP_remat.
- property batch_parallel_size: int#
Number of independently assigned microbatches per pipeline.
- property num_weight_replicas: int#
Number of copies of each TP-local weight shard.
- _groups(axes: set[str]) list[list[int]]#
- property data: core.tensor_parallel.gtp_parallel_layout._RankView#
CP x GTP_remat sequence shards split sequences; extra_data x DP assigns samples.
- property weights: core.tensor_parallel.gtp_parallel_layout._RankView#
Weight layout: TP x GTP_remat shards, DP replicates those shards.