fix issue I3EAB6: exception while using unique ops

This commit is contained in:
zhangzhaoju 2021-03-31 10:01:46 +08:00 committed by chujinjin
parent 9263c4d63b
commit b82529e26f
2 changed files with 21 additions and 11 deletions

View File

@ -94,13 +94,21 @@ void PrimBpropOptGraphLevel2Info::AnalysisNodeUsingInfo(
arg_info.using_flg_ = true; arg_info.using_flg_ = true;
MS_LOG(DEBUG) << "param:" << param->ToString() << " used by node:" << user_node->ToString(); MS_LOG(DEBUG) << "param:" << param->ToString() << " used by node:" << user_node->ToString();
if (!IsPrimitiveCNode(user_node, prim::kPrimTupleGetItem)) { if (!IsPrimitiveCNode(user_node, prim::kPrimTupleGetItem)) {
MS_LOG(EXCEPTION) << "tuple param:" << param->ToString() << " of bp_graph:" << opt_func_graph_->ToString() for (auto &sub_info : arg_info.sub_using_info_) {
<< " unexpect used by node:" << user_node->ToString(); sub_info.using_flg_ = true;
} }
} else {
AalysisForTupleGetItem(node_users, param, arg_info, user_node);
}
}
}
void PrimBpropOptGraphLevel2Info::AalysisForTupleGetItem(const NodeUsersMap &node_users,
const std::shared_ptr<AnfNode> &param,
ParamUsingInfo &arg_info,
const AnfNodePtr &user_node) const {
auto cnode = user_node->cast<CNodePtr>(); auto cnode = user_node->cast<CNodePtr>();
if (cnode->size() != 3) { if (cnode->size() != 3) {
MS_LOG(EXCEPTION) << "TupleGetItem Node:" << user_node->ToString() << " of bp_graph:" MS_LOG(EXCEPTION) << "TupleGetItem Node:" << user_node->ToString() << " of bp_graph:" << opt_func_graph_->ToString()
<< opt_func_graph_->ToString()
<< "input size is:" << cnode->size(); << "input size is:" << cnode->size();
} }
auto idx_node = cnode->input(2); auto idx_node = cnode->input(2);
@ -125,7 +133,6 @@ void PrimBpropOptGraphLevel2Info::AnalysisNodeUsingInfo(
if (arg_info.tuple_flg_) { if (arg_info.tuple_flg_) {
AnalysisNodeUsingInfo(node_users, cnode, arg_info.sub_using_info_[idx]); AnalysisNodeUsingInfo(node_users, cnode, arg_info.sub_using_info_[idx]);
} }
}
} }
void PrimBpropOptGraphLevel2Info::ArgInfoRefresh( void PrimBpropOptGraphLevel2Info::ArgInfoRefresh(

View File

@ -119,7 +119,10 @@ private:
void TryFreeOneValue(const ValuePtrList &op_args, const std::vector<ParamUsingInfo> &param_info_vec); void TryFreeOneValue(const ValuePtrList &op_args, const std::vector<ParamUsingInfo> &param_info_vec);
private: void AalysisForTupleGetItem(const NodeUsersMap &node_users, const std::shared_ptr<AnfNode> &param,
ParamUsingInfo &arg_info, const AnfNodePtr &user_node) const;
private:
// the level2 opt func_graph // the level2 opt func_graph
FuncGraphPtr opt_func_graph_; FuncGraphPtr opt_func_graph_;
// to indicate arguments value using or not, if not using should free device memory // to indicate arguments value using or not, if not using should free device memory