From ba1bbe8e9df3c1a20a9e771bb8c023754ff666c0 Mon Sep 17 00:00:00 2001 From: Ruibiao Chen Date: Tue, 27 Sep 2022 15:34:23 +0800 Subject: [PATCH] Fix op_happen_before_ update bug for AddDownstreamOp (#46486) --- .../interpreter/dependency_builder.cc | 21 ++++++++++--------- .../new_executor/interpretercore_util.cc | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/paddle/fluid/framework/new_executor/interpreter/dependency_builder.cc b/paddle/fluid/framework/new_executor/interpreter/dependency_builder.cc index 0c094917f6f..49e675a4730 100644 --- a/paddle/fluid/framework/new_executor/interpreter/dependency_builder.cc +++ b/paddle/fluid/framework/new_executor/interpreter/dependency_builder.cc @@ -70,15 +70,15 @@ const std::map>& DependencyBuilder::Build( BuildOpHappensBefore(); ShrinkDownstreamMap(); + if (is_sequential_run) { + AddDependencyForSequentialRun(); + } + AddDependencyForCoalesceTensorOp(); AddDependencyForCommunicationOp(); AddDependencyForRandomOp(); AddDependencyForReadOp(); - if (is_sequential_run) { - AddDependencyForSequentialRun(); - } - is_build_ = true; VLOG(8) << "Finish build dependency"; @@ -335,6 +335,10 @@ void DependencyBuilder::AddDownstreamOp(int prior_op_idx, if (op_happens_before_.size() != 0) { for (size_t op_idx = 0; op_idx < op_num_; ++op_idx) { + if (op_happens_before_[op_idx][prior_op_idx]) { + op_happens_before_[op_idx][posterior_op_idx] = true; + } + if (op_happens_before_[posterior_op_idx][op_idx]) { op_happens_before_[prior_op_idx][op_idx] = true; } @@ -461,10 +465,6 @@ void DependencyBuilder::BuildDownstreamMap() { AddDownstreamOp(dep_op, op); } } - - VLOG(6) << "downstream count: " << CountDownstreamMap(op_downstream_map_); - VLOG(6) << "downstream_map: " << std::endl - << StringizeDownstreamMap(op_downstream_map_); } void DependencyBuilder::BuildOpHappensBefore() { @@ -542,8 +542,9 @@ void DependencyBuilder::ShrinkDownstreamMap() { } op_downstream_map_.at(i) = minumum_nexts; } - VLOG(6) << "downstream count: " << CountDownstreamMap(op_downstream_map_); - VLOG(6) << "downstream_map: " << std::endl + VLOG(8) << "Finish shrink downstream map"; + VLOG(8) << "downstream count: " << CountDownstreamMap(op_downstream_map_); + VLOG(8) << "downstream_map: " << std::endl << StringizeDownstreamMap(op_downstream_map_); } diff --git a/paddle/fluid/framework/new_executor/interpretercore_util.cc b/paddle/fluid/framework/new_executor/interpretercore_util.cc index 934d29591d3..e5bd3c97b1f 100644 --- a/paddle/fluid/framework/new_executor/interpretercore_util.cc +++ b/paddle/fluid/framework/new_executor/interpretercore_util.cc @@ -268,7 +268,7 @@ void create_all_ops(const framework::BlockDesc& block, std::vector>* ops) { for (auto& op : block.AllOps()) { auto op_type = op->Type(); - VLOG(1) << "CreateOp from : " << op_type; + VLOG(8) << "CreateOp from : " << op_type; auto& info = OpInfoMap::Instance().Get(op_type); -- GitLab