Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Oneflow-Inc
oneflow
提交
a5f1e505
O
oneflow
项目概览
Oneflow-Inc
/
oneflow
上一次同步 2 年多
通知
13
Star
2733
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oneflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a5f1e505
编写于
9月 03, 2018
作者:
L
Li Xinqi
提交者:
Jinhui Yuan
9月 03, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
split sources when infer shape (#1202)
Former-commit-id:
34fb73fe
上级
dd9be365
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
14 deletion
+19
-14
oneflow/core/graph/task_graph.cpp
oneflow/core/graph/task_graph.cpp
+12
-7
oneflow/core/graph/task_graph.h
oneflow/core/graph/task_graph.h
+3
-1
oneflow/core/job/compiler.cpp
oneflow/core/job/compiler.cpp
+4
-6
未找到文件。
oneflow/core/graph/task_graph.cpp
浏览文件 @
a5f1e505
...
...
@@ -73,25 +73,30 @@ void TaskGraph::GeneratePersistenceThrdId(
}
}
void
TaskGraph
::
AcyclicTopoForEachNode
(
std
::
function
<
void
(
TaskNode
*
node
)
>
handler
)
const
{
void
TaskGraph
::
AcyclicTopoForEachNode
(
std
::
function
<
bool
(
TaskNode
*
node
)
>
IsAllowedStartNode
,
std
::
function
<
void
(
TaskNode
*
node
)
>
Handler
)
const
{
std
::
list
<
TaskNode
*>
starts
;
ForEachNode
([
&
](
TaskNode
*
node
)
{
if
(
node
->
in_edges
().
empty
())
{
starts
.
push_back
(
node
);
}
if
(
node
->
in_edges
().
empty
()
&&
IsAllowedStartNode
(
node
)
)
{
starts
.
push_back
(
node
);
}
});
auto
ForEachInNode
=
[
&
](
TaskNode
*
node
,
const
std
::
function
<
void
(
TaskNode
*
)
>&
h
andler
)
{
auto
ForEachInNode
=
[
&
](
TaskNode
*
node
,
const
std
::
function
<
void
(
TaskNode
*
)
>&
H
andler
)
{
node
->
ForEachNodeOnInEdge
([
&
](
TaskNode
*
node_on_in_edge
)
{
if
(
IsBackEdge
(
node_on_in_edge
,
node
))
return
;
h
andler
(
const_cast
<
TaskNode
*>
(
node_on_in_edge
));
H
andler
(
const_cast
<
TaskNode
*>
(
node_on_in_edge
));
});
};
auto
ForEachOutNode
=
[
&
](
TaskNode
*
node
,
const
std
::
function
<
void
(
TaskNode
*
)
>&
h
andler
)
{
auto
ForEachOutNode
=
[
&
](
TaskNode
*
node
,
const
std
::
function
<
void
(
TaskNode
*
)
>&
H
andler
)
{
node
->
ForEachNodeOnOutEdge
([
&
](
TaskNode
*
node_on_out_edge
)
{
if
(
IsBackEdge
(
node
,
node_on_out_edge
))
return
;
h
andler
(
const_cast
<
TaskNode
*>
(
node_on_out_edge
));
H
andler
(
const_cast
<
TaskNode
*>
(
node_on_out_edge
));
});
};
// DfsTopo will cause inappropriate chain graph
TopoForEachNode
(
starts
,
ForEachInNode
,
ForEachOutNode
,
handler
);
TopoForEachNode
(
starts
,
ForEachInNode
,
ForEachOutNode
,
Handler
);
}
void
TaskGraph
::
AcyclicTopoForEachNode
(
std
::
function
<
void
(
TaskNode
*
node
)
>
Handler
)
const
{
return
AcyclicTopoForEachNode
([](
TaskNode
*
)
{
return
true
;
},
Handler
);
}
void
TaskGraph
::
RemoveEmptyRegsts
()
{
...
...
oneflow/core/graph/task_graph.h
浏览文件 @
a5f1e505
...
...
@@ -53,7 +53,9 @@ class TaskGraph final : public Graph<TaskNode, TaskEdge> {
void
AddMutexCtrlEdgeInSameChain
();
void
AddOrderCtrlEdgeBetweenCopyAndMdUpdt
();
void
RmUselessConsumeRelationshipBetweenFwBw
();
void
AcyclicTopoForEachNode
(
std
::
function
<
void
(
TaskNode
*
node
)
>
handler
)
const
;
void
AcyclicTopoForEachNode
(
std
::
function
<
void
(
TaskNode
*
node
)
>
Handler
)
const
;
void
AcyclicTopoForEachNode
(
std
::
function
<
bool
(
TaskNode
*
node
)
>
IsAllowedStartNode
,
std
::
function
<
void
(
TaskNode
*
node
)
>
Handler
)
const
;
#define DECLARE_BLD_SUB_TASK_GRAPH_METHOD(method_name) void method_name BLD_SUB_TSK_GPH_MTHD_ARGS();
...
...
oneflow/core/job/compiler.cpp
浏览文件 @
a5f1e505
...
...
@@ -101,12 +101,10 @@ Plan Compiler::DoCompile() {
task_gph
->
ForEachNode
(
std
::
bind
(
&
TaskNode
::
ProduceAllRegstsAndBindEdges
,
_1
));
task_gph
->
ForEachNode
(
std
::
bind
(
&
TaskNode
::
ConsumeAllRegsts
,
_1
));
task_gph
->
ForEachNode
(
std
::
bind
(
&
TaskNode
::
PinConsumedRegst
,
_1
));
task_gph
->
AcyclicTopoForEachNode
([](
TaskNode
*
node
)
{
if
(
node
->
GetTaskType
()
!=
kNormalMdUpdt
)
{
node
->
Build
();
}
});
task_gph
->
AcyclicTopoForEachNode
([](
TaskNode
*
node
)
{
if
(
node
->
GetTaskType
()
==
kNormalMdUpdt
)
{
node
->
Build
();
}
});
task_gph
->
AcyclicTopoForEachNode
(
[](
TaskNode
*
node
)
{
return
node
->
GetTaskType
()
!=
kNormalMdUpdt
;
},
&
TaskNode
::
Build
);
task_gph
->
AcyclicTopoForEachNode
(
[](
TaskNode
*
node
)
{
return
node
->
GetTaskType
()
==
kNormalMdUpdt
;
},
&
TaskNode
::
Build
);
task_gph
->
RemoveEmptyRegsts
();
task_gph
->
AddOrderingCtrlEdgeInSameChain
();
if
(
job_desc
->
IsTrain
()
&&
job_desc
->
enable_mem_sharing
())
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录