Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
65b29d3a
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
65b29d3a
编写于
5月 31, 2023
作者:
Y
Yuang Liu
提交者:
GitHub
5月 31, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Hybrid Performance] Support VP DP comm overlap. (#54196)
上级
5f54a7fe
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
12 deletion
+34
-12
python/paddle/distributed/fleet/meta_parallel/parallel_layers/pp_layers.py
...tributed/fleet/meta_parallel/parallel_layers/pp_layers.py
+8
-0
python/paddle/distributed/fleet/meta_parallel/pipeline_parallel.py
...ddle/distributed/fleet/meta_parallel/pipeline_parallel.py
+26
-12
未找到文件。
python/paddle/distributed/fleet/meta_parallel/parallel_layers/pp_layers.py
浏览文件 @
65b29d3a
...
...
@@ -703,6 +703,14 @@ class PipelineLayer(nn.Layer):
self
.
shared_layers
[
layer
.
layer_name
],
)
)
# Note: the PipelineLayerChunk won't add the partial function to the sub layer,
# will introduce error when calling chunk.parameters(). Have to manually add
# this layer to the chunk's sub layer.
if
self
.
_num_virtual_pipeline_stages
>
1
:
run_function
.
add_sublayer
(
layer
.
layer_name
,
self
.
shared_layers
[
layer
.
layer_name
],
)
elif
isinstance
(
layer
,
LayerDesc
):
model
=
layer
.
build_layer
()
...
...
python/paddle/distributed/fleet/meta_parallel/pipeline_parallel.py
浏览文件 @
65b29d3a
...
...
@@ -71,6 +71,8 @@ class PipelineParallel(MetaParallelBase):
self
.
_delay_scale_loss
=
self
.
_strategy
.
hybrid_configs
[
"pp_configs"
].
delay_scale_loss
# TODO(PP Dev): support dp_comm_overlap without use_main_grad training.
# This combination will trigger inplace check error during `reshape_` in funct `_split_tensors`.
self
.
_dp_comm_overlap
=
self
.
_strategy
.
hybrid_configs
[
"pp_configs"
].
dp_comm_overlap
...
...
@@ -152,18 +154,30 @@ class PipelineParallel(MetaParallelBase):
return
fused_allreduce
def
register_allreduce_overlap_hook
(
self
,
model
,
comm_group
,
acc_steps
):
parameter_list
=
[
p
for
p
in
model
.
parameters
()
if
not
p
.
stop_gradient
]
if
len
(
parameter_list
)
<
1
:
return
var_groups
=
assign_group_by_size
(
parameter_list
)
for
group_idx
,
parameters
in
var_groups
.
items
():
buffer
=
FusedAllReduceBuffer
(
group_idx
,
parameters
,
comm_group
,
acc_steps
)
self
.
_dp_comm_buffers
.
append
(
buffer
)
for
param
in
parameters
:
param
.
_register_backward_hook
(
self
.
bw_hook_func
(
buffer
,
param
))
if
model
.
get_num_virtual_stages
()
>
1
:
models
=
model
.
get_model_chunks
()
else
:
models
=
[
model
]
for
model
in
models
:
# For virtual pipeline. Will separate parameters in different chunk into
# different groups to get the best performance.
parameter_list
=
[
p
for
p
in
model
.
parameters
()
if
not
p
.
stop_gradient
]
if
len
(
parameter_list
)
<
1
:
return
var_groups
=
assign_group_by_size
(
parameter_list
)
for
group_idx
,
parameters
in
var_groups
.
items
():
buffer
=
FusedAllReduceBuffer
(
group_idx
,
parameters
,
comm_group
,
acc_steps
)
self
.
_dp_comm_buffers
.
append
(
buffer
)
for
param
in
parameters
:
param
.
_register_backward_hook
(
self
.
bw_hook_func
(
buffer
,
param
)
)
def
timer_printer
(
self
):
if
not
self
.
_enable_timer
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录