-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependence analysis #37231
Dependence analysis #37231
Conversation
Thanks for your contribution! |
void InterpreterCore::BuildOperatorDependences() { | ||
// set the dependecy_count_ and Call Schedule | ||
// refer to http://agroup.baidu.com/share/md/92946214aa4c4785a2cc4c1f361a023c | ||
// for pesudo code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不要在代码里添加百度内部的文档链接,可以参看graph.h那样,在这里添加整体的方案思路描述
std::set<int> remove_duplicate; | ||
|
||
// reserve | ||
for (size_t op = 0; op < vec_instruction_.size(); ++op) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (size_t op = 0; op < vec_instruction_.size(); ++op) { | |
for (size_t i = 0; i < op_nums; ++i) { |
} | ||
dependecy_count_.resize(op_nums); | ||
|
||
for (size_t op = 0; op < vec_instruction_.size(); ++op) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (size_t op = 0; op < vec_instruction_.size(); ++op) { | |
for (size_t op_idx = 0; op_idx < op_nums; ++op_idx) { |
} | ||
} | ||
|
||
auto op2downstream = get_downstream_map(op2dependences); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议把上述逻辑单独放到utils.ccl里
@@ -289,7 +282,7 @@ void InterpreterCore::BuildSkipShareLoDInfo() { | |||
void InterpreterCore::RunInstruction(const Instruction& instr_node) { | |||
auto* op = instr_node.OpBase(); | |||
auto place = instr_node.DeviceContext().GetPlace(); | |||
VLOG(4) << place << " " << op->DebugStringEx(global_scope_); | |||
VLOG(4) << "Start run" << place << " " << op->DebugStringEx(global_scope_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VLOG(4) << "Start run" << place << " " << op->DebugStringEx(global_scope_); | |
VLOG(4) << "Start run " << place << " " << op->DebugStringEx(global_scope_); |
@@ -320,7 +313,7 @@ void InterpreterCore::RunInstruction(const Instruction& instr_node) { | |||
instr_node.KernelFunc()(*instr_node.InnerExecutionContext().get()); | |||
} | |||
|
|||
VLOG(3) << place << " " << op->DebugStringEx(global_scope_); | |||
VLOG(4) << "End run" << place << " " << op->DebugStringEx(global_scope_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VLOG(4) << "End run" << place << " " << op->DebugStringEx(global_scope_); | |
VLOG(4) << "End run " << place << " " << op->DebugStringEx(global_scope_); |
@@ -77,6 +77,23 @@ paddle::framework::FetchList InterpreterCore::Run( | |||
return *(fetch_var->GetMutable<framework::FetchList>()); | |||
} | |||
|
|||
void InterpreterCore::BuildOperatorDependences() { | |||
// analysis the dependences between ops, set the dependecy_count_ and Call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call -> call
PR types
Others
PR changes
Others
Describe
这个PR修复了新执行器的依赖分析算法。之前的新执行器对于多次write和read write的依赖关系分析有漏洞,现在的PR重写了Op依赖分析逻辑。具体算法和问题来源可以参考文档: http://agroup.baidu.com/share/md/839f7c5eb0d543cc9245084d9eecab22 [执行器控制流静态分析存在的一类问题【已定位】] 。上面列举了分析算法伪代码和实现逻辑。应该比代码容易理解。