提交 8c9cd369 编写于 作者: Y Yu Yang

Polish code style

上级 6f0dfd89
...@@ -379,17 +379,21 @@ void ParallelExecutor::ConstructDependencyGraph( ...@@ -379,17 +379,21 @@ void ParallelExecutor::ConstructDependencyGraph(
} }
} }
/** /*
* Dependency graph has been constructed. However, there are still data Dependency graph has been constructed. However, there are still data
* harzaeds need to be handled. harzaeds need to be handled.
* */
PolishGraphToSupportDataHarzaeds();
}
/**
* We only handle write after read(WAR), since it should not have a write * We only handle write after read(WAR), since it should not have a write
* after write in program. If there are write after write operators, we need * after write in program. If there are write after write operators, we need
* prune them. * prune them.
* *
* https://en.wikipedia.org/wiki/Hazard_(computer_architecture)#Write_after_read_(WAR) * https://en.wikipedia.org/wiki/Hazard_(computer_architecture)#Write_after_read_(WAR)
*/ */
void ParallelExecutor::PolishGraphToSupportDataHarzaeds() const {
for (auto &place_pair : member_->vars_) { for (auto &place_pair : member_->vars_) {
for (auto &name_pair : place_pair.second) { for (auto &name_pair : place_pair.second) {
if (name_pair.second.size() <= 1) { if (name_pair.second.size() <= 1) {
......
...@@ -61,6 +61,8 @@ class ParallelExecutor { ...@@ -61,6 +61,8 @@ class ParallelExecutor {
void RunOp(std::unordered_map<VarHandleBase*, bool>& pending_vars, void RunOp(std::unordered_map<VarHandleBase*, bool>& pending_vars,
OpHandle* op) const; OpHandle* op) const;
void PolishGraphToSupportDataHarzaeds() const;
}; };
} // namespace framework } // namespace framework
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册