Skip to content

Commit

Permalink
[Doc] update ZB-VPP 编排代码解读
Browse files Browse the repository at this point in the history
  • Loading branch information
AndSonder committed Apr 3, 2024
1 parent 35e19d8 commit 32806b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/high_performance/分布式/6-zero-bubble-vpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ megatron 在做编排的时候是多卡的视角,对所有卡的任务进行

:::

这里需要注意一个问题就是为什么任务的索引是 `cat * 2 + chunk`,这是因为 Zero Bubble VPP 中每个任务有俩个 chunk,所以需要乘以 2。如果后续需要适配 vpp_degree > 2 的逻辑,需要修改为 `cat * vpp_degree + chunk`
这里需要注意一个问题就是为什么任务的索引是 `cat \* 2 + chunk`,这是因为 Zero Bubble VPP 中每个任务有俩个 chunk,所以需要乘以 2。如果后续需要适配 vpp_degree > 2 的逻辑,需要修改为 `cat \* vpp_degree + chunk`

下一步就是更新当前任务的结束时间,这里需要考虑依赖任务是否完成。如果任务不是前向传播的第一个 chunk(即不是 F0_1),则需要检查依赖任务是否完成。计算依赖任务的标识,如果是前向或反向传播任务,确认其依赖的前一个任务已完成。对于权重更新任务,确认其依赖的反向传播任务已完成。

Expand Down Expand Up @@ -220,7 +220,7 @@ megatron 在做编排的时候是多卡的视角,对所有卡的任务进行
iter_chunk_ = 1 - iter_chunk_
```

逐步插入B和W任务,尽量填充泡沫。为什么这里是 2 * self.n_micro 呢?因为每个stage有两个 chunk,每个 chunk 最多有 n_micro 个任务。这里后续如果需要适配 vpp_degree > 2 的逻辑,就会变成 vpp_degree * self.n_micro
逐步插入B和W任务,尽量填充泡沫。为什么这里是 2 \* self.n_micro 呢?因为每个stage有两个 chunk,每个 chunk 最多有 n_micro 个任务。这里后续如果需要适配 vpp_degree > 2 的逻辑,就会变成 vpp_degree \* self.n_micro

```
for _ in range(2 * self.n_micro):
Expand Down

0 comments on commit 32806b8

Please sign in to comment.