Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
da518775
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
da518775
编写于
8月 24, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 24, 2020
浏览文件
操作
浏览文件
下载
差异文件
!4813 parallel control stream
Merge pull request !4813 from gukecai/parallel-ctrl
上级
f536cd7c
6c22c8a0
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
440 addition
and
35 deletion
+440
-35
mindspore/ccsrc/backend/optimizer/pass/communication_op_fusion.cc
...e/ccsrc/backend/optimizer/pass/communication_op_fusion.cc
+3
-0
mindspore/ccsrc/runtime/device/ascend/ascend_stream_assign.cc
...spore/ccsrc/runtime/device/ascend/ascend_stream_assign.cc
+418
-32
mindspore/ccsrc/runtime/device/ascend/ascend_stream_assign.h
mindspore/ccsrc/runtime/device/ascend/ascend_stream_assign.h
+19
-3
未找到文件。
mindspore/ccsrc/backend/optimizer/pass/communication_op_fusion.cc
浏览文件 @
da518775
...
...
@@ -211,8 +211,11 @@ bool CommunicationOpFusion::DoFusion(const FuncGraphPtr &func_graph, const Commu
start_index
=
end_index
+
1
;
continue
;
}
auto
kernel_graph
=
func_graph
->
cast
<
KernelGraphPtr
>
();
auto
graph_id
=
kernel_graph
->
graph_id
();
AnfNodePtr
new_communication_op
=
CreateFusedCommunicationOp
(
func_graph
,
communication_op_info
,
start_index
,
end_index
);
AnfAlgo
::
SetGraphId
(
graph_id
,
new_communication_op
.
get
());
// replace old communication op with new communication op
for
(
auto
idx
=
start_index
;
idx
<=
end_index
;
++
idx
)
{
std
::
vector
<
AnfNodePtr
>
tuple_getitem_input
;
...
...
mindspore/ccsrc/runtime/device/ascend/ascend_stream_assign.cc
浏览文件 @
da518775
此差异已折叠。
点击以展开。
mindspore/ccsrc/runtime/device/ascend/ascend_stream_assign.h
浏览文件 @
da518775
...
...
@@ -123,11 +123,18 @@ class AscendStreamAssign {
void
CheckEventAssign
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
void
AssignAllNodesStream
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
void
AssignCommonStreamId
(
const
CNodePtr
&
cur_cnode_ptr
);
void
AssignHcomStreamId
(
const
CNodePtr
&
cur_cnode_ptr
);
void
AssignIndependentStreamId
(
const
CNodePtr
&
cur_cnode_ptr
);
uint32_t
AssignHcomStreamId
(
const
CNodePtr
&
cur_cnode_ptr
,
bool
new_graph
);
uint32_t
AssignIndependentStreamId
(
const
CNodePtr
&
cur_cnode_ptr
,
bool
new_graph
);
void
UpdateAtomicAddrCleanStreamId
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
void
FindHcomParallelStreams
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
void
InsertStreamActive
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
void
InsertStreamActiveForCommon
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
void
InsertStreamActiveForIndependent
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
void
InsertStreamActiveForParallel
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
void
ActiveRootGraphHcom
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
,
const
std
::
set
<
uint32_t
>
&
hcom_streams
);
void
ActiveRootGraphIndependent
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
,
std
::
set
<
uint32_t
>
independent_streams
);
void
ActiveOtherGraphParallel
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
,
std
::
map
<
uint32_t
,
std
::
set
<
uint32_t
>>
other_graph
);
void
UpdateStreamSwitch
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
,
const
CNodePtr
&
switch_ptr
,
vector
<
CNodePtr
>
*
orders
);
void
InsertEventForIndependentParallel
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
...
...
@@ -135,9 +142,11 @@ class AscendStreamAssign {
void
InsertEventForHcomParallel
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
void
InsertEventCommonDependHcom
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
void
InsertEventHcomDependCommon
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
void
InsertEventHcomDependCommonBak
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
void
InsertEventHcomDependHcom
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
void
InsertEventBetweenHcom
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
,
const
map
<
uint32_t
,
vector
<
size_t
>>
&
hcom_index
,
uint32_t
first_hcom_stream
,
uint32_t
last_hcom_stream
);
CNodePtr
GetLastInputCnode
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
,
const
CNodePtr
&
cur_cnode_ptr
);
bool
IsSatisfiedHcom
(
const
std
::
map
<
uint32_t
,
vector
<
size_t
>>
&
hcom_index
,
const
CNodePtr
&
node_ptr
,
size_t
index
);
void
GetProcessedStream
(
const
NotNull
<
KernelGraphPtr
>
&
graph_ptr
);
...
...
@@ -155,6 +164,7 @@ class AscendStreamAssign {
vector
<
CNodePtr
>::
iterator
FindTargetOp
(
vector
<
CNodePtr
>::
iterator
begin
,
vector
<
CNodePtr
>::
iterator
end
,
const
CNodePtr
&
node
);
void
GetParallelStream
(
uint32_t
cur_stream_id
,
uint32_t
stream_acitve_id
,
std
::
vector
<
uint32_t
>
*
parallel_streams
);
void
SetLoopSink
();
// function for memory resue
void
GetStreamRelations
();
...
...
@@ -172,17 +182,23 @@ class AscendStreamAssign {
bool
independent_stream_activated_
{
false
};
bool
hcom_stream_activated_
{
false
};
bool
loop_sink_
{
false
};
// key:stream id, value:task nums;
std
::
map
<
uint32_t
,
uint32_t
>
independent_stream_map_
{};
std
::
map
<
uint32_t
,
uint32_t
>
hcom_stream_map_
{};
std
::
map
<
uint32_t
,
uint32_t
>
common_stream_map_
{};
std
::
set
<
uint32_t
>
processed_streams_
{};
std
::
vector
<
uint32_t
>
need_first_active_streams_
{};
std
::
set
<
CNodeKey
>
independent_targets_
;
// key:graph id, value:stream set
std
::
map
<
uint32_t
,
std
::
set
<
uint32_t
>>
hcom_graph_map_
;
std
::
map
<
uint32_t
,
std
::
set
<
uint32_t
>>
independent_graph_map_
;
// attr for memory copy reuse
std
::
map
<
uint32_t
,
std
::
vector
<
uint32_t
>>
stream_relations_
{};
std
::
vector
<
std
::
vector
<
uint32_t
>>
stream_groups_
{};
std
::
map
<
CNodePtr
,
CNodePtr
>
event_map_
;
std
::
map
<
CNodePtr
,
CNodePtr
>
event_map_
{};
std
::
set
<
uint32_t
>
middle_active_streams_
{};
// new policy end
};
}
// namespace ascend
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录