diff --git a/paddle/fluid/framework/parallel_executor.cc b/paddle/fluid/framework/parallel_executor.cc index 930be7fab3ff7f94ddbd1d91f84cec725a60181f..40de26bdd08dab610e98a7fde340c6543cf1e85e 100644 --- a/paddle/fluid/framework/parallel_executor.cc +++ b/paddle/fluid/framework/parallel_executor.cc @@ -379,17 +379,21 @@ void ParallelExecutor::ConstructDependencyGraph( } } - /** - * Dependency graph has been constructed. However, there are still data - * harzaeds need to be handled. - * - * 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 - * prune them. - * - * https://en.wikipedia.org/wiki/Hazard_(computer_architecture)#Write_after_read_(WAR) + /* + Dependency graph has been constructed. However, there are still data + harzaeds need to be handled. */ + PolishGraphToSupportDataHarzaeds(); +} +/** + * 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 + * prune them. + * + * https://en.wikipedia.org/wiki/Hazard_(computer_architecture)#Write_after_read_(WAR) + */ +void ParallelExecutor::PolishGraphToSupportDataHarzaeds() const { for (auto &place_pair : member_->vars_) { for (auto &name_pair : place_pair.second) { if (name_pair.second.size() <= 1) { diff --git a/paddle/fluid/framework/parallel_executor.h b/paddle/fluid/framework/parallel_executor.h index 1e4c5c48f2bec51df6a900fde5190e8cc9350898..30416563f824cc94c62b1a7787c08c8361592bcd 100644 --- a/paddle/fluid/framework/parallel_executor.h +++ b/paddle/fluid/framework/parallel_executor.h @@ -61,6 +61,8 @@ class ParallelExecutor { void RunOp(std::unordered_map& pending_vars, OpHandle* op) const; + + void PolishGraphToSupportDataHarzaeds() const; }; } // namespace framework