Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/api/paddle/distributed/utils/global_gather_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ global_gather 根据 global_count 将 x 的数据收集到 n_expert * world_size
如下图所示,world_size 是 2,n_expert 是 2,x 的 batch_size 是 4,local_count 是[2, 0, 2, 0],0 卡的 global_count 是[2, 0, , ],
1 卡的 global_count 是[2, 0, ,](因为篇幅问题,这里只展示在 0 卡运算的数据),在 global_gather 算子里,
global_count 和 local_count 的意义与其在 global_scatter 里正好相反,
global_count[i]代表向第 (i // n_expert)张卡的第 (i % n_expert)个 expert 发送 local_expert[i]个数据,
local_count[i]代表从第 (i // n_expert)张卡接收 global_count[i]个数据给本卡的 第(i % n_expert)个 expert。
global_count[i] 代表向第 (i // n_expert)张卡的第 (i % n_expert)个 expert 发送 local_expert[i]个数据,
local_count[i] 代表从第 (i // n_expert)张卡接收 global_count[i] 个数据给本卡的 第(i % n_expert)个 expert。
发送的数据会按照每张卡的每个 expert 排列。图中的 rank0 代表第 0 张卡,rank1 代表第 1 张卡。

global_gather 发送数据的流程如下:
Expand Down Expand Up @@ -43,8 +43,9 @@ global_gather 发送数据的流程如下:

返回
:::::::::
Tensor,从所有 expert 接收的数据。
Tensor,从所有 expert 接收的数据喵~

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这句不用改哈~

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不能留着嘛QAQ

Copy link
Contributor

@Echo-Nie Echo-Nie Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

呐,不能留着喵~ 只需要修改有误的地方,方便用户看懂 QAQ

代码示例
:::::::::

COPY-FROM: paddle.distributed.utils.global_gather
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里目前渲染结果如下:
image

正常的COPY-FROM应该是和英文api源码对齐,上面的渲染是一个bug;需要检索一下该api的路径位置可能是发生了改变,所以可能需要变更路径~
可以参考 #7472 的检索方法,如果无法检索该API的话就可以考虑删除~

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这边看了下,我最新的3.2版本的文档并没有这个api,旧版可以找到,估计是被移除了。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.