!1891 New control sink support resnet50

Merge pull request !1891 from zhoufeng/new-control-sink-resnet50
pull/1891/MERGE
mindspore-ci-bot 5 years ago committed by Gitee
commit ffb5339e87

@ -33,11 +33,9 @@ static void UpdateLabelGoto(NotNull<CNodePtr> node) {
if (node->size() <= kLabelGotoLabelId) {
MS_LOG(EXCEPTION) << "Node " << node->DebugString() << " has invalid input size " << node->size();
}
auto label_set = AnfAlgo::GetCNodePrimitive(node->input(kLabelGotoLabelId));
MS_EXCEPTION_IF_NULL(label_set);
auto value = label_set->GetAttr(kAttrLabelIndex);
MS_EXCEPTION_IF_NULL(value);
uint32_t goto_label_id = GetValue<uint32_t>(value);
auto input = node->input(kLabelGotoLabelId);
uint32_t goto_label_id = AnfAlgo::GetNodeAttr<uint32_t>(input, kAttrLabelIndex);
AnfAlgo::SetNodeAttr(kAttrLabelIndex, MakeValue<uint32_t>(goto_label_id), node.get());
MS_LOG(INFO) << "Node " << node->DebugString() << " goto label id " << goto_label_id;
node->set_inputs({node->input(0)});
@ -57,11 +55,7 @@ static void UpdateLabelSwitch(NotNull<CNodePtr> node) {
break;
}
auto label_set = AnfAlgo::GetCNodePrimitive(input);
MS_EXCEPTION_IF_NULL(label_set);
auto value = label_set->GetAttr(kAttrLabelIndex);
MS_EXCEPTION_IF_NULL(value);
uint32_t goto_label_id = GetValue<uint32_t>(value);
uint32_t goto_label_id = AnfAlgo::GetNodeAttr<uint32_t>(input, kAttrLabelIndex);
label_list.push_back(goto_label_id);
MS_LOG(INFO) << "Switch " << node->DebugString() << " case " << i - kLabelSwitchLabelId << ": id " << goto_label_id;
}
@ -154,7 +148,7 @@ uint32_t AscendLabelAssign::GetLabelNum(NotNull<const session::KernelGraph *> gr
std::lock_guard<std::mutex> lock(label_num_mutex_);
auto iter = label_num_.find(graph.get());
if (iter == label_num_.end()) {
MS_LOG(WARNING) << "Graph " << graph->ToString() << " has not assigned label.";
MS_LOG(DEBUG) << "Graph " << graph->ToString() << " has not assigned label, defalut is 1.";
return 1;
}
return iter->second;

File diff suppressed because it is too large Load Diff

@ -54,10 +54,7 @@ class AscendControlParser {
static void InsertAssignToGraph(NotNull<KernelGraphPtr> kg, NotNull<AnfNodePtr> from, NotNull<AnfNodePtr> to);
static CNodePtr GetNextRealKernel(const std::vector<CNodePtr> &list, size_t start);
// root graph order
static std::vector<uint32_t> GetLabelSwitchList(const CNodePtr &node);
static bool CheckLabelIndex(uint32_t order_index, uint32_t label_index, const CNodePtr &cnode,
NotNull<KernelGraphPtr> graph);
static std::vector<CNodePtr> RecurseGraph(NotNull<KernelGraphPtr> graph,

@ -377,8 +377,8 @@ void KernelGraph::FrontBackendlMapUpdate(const AnfNodePtr &old_backend_anf, cons
MS_EXCEPTION_IF_NULL(old_backend_anf);
MS_EXCEPTION_IF_NULL(new_backend_anf);
if (old_backend_anf == new_backend_anf) {
MS_LOG(INFO) << "old:" << old_backend_anf->DebugString() << ",new:" << new_backend_anf->DebugString();
MS_LOG(EXCEPTION) << "old can't be same with new";
MS_LOG(DEBUG) << "old same with new:" << old_backend_anf->DebugString();
return;
}
if (backend_front_anf_map_.find(old_backend_anf) == backend_front_anf_map_.end()) {
MS_LOG(DEBUG) << "old_backend_anf " << old_backend_anf->DebugString() << " is not exist in the map";

@ -620,12 +620,6 @@ std::shared_ptr<KernelGraph> SessionBasic::ConstructKernelGraph(const FuncGraphP
// if a graph jump back unconditionally, return op of this graph will never be executed, so output is null.
graph->set_output_null(is_trace_back);
AddParameterToGraphInputs(func_graph->parameters(), graph.get());
MS_EXCEPTION_IF_NULL(context_);
FuncGraphManagerPtr manager = MakeManager({graph});
if (manager) {
manager->AddFuncGraph(graph);
graph->set_manager(manager);
}
graph->SetExecOrderByDefault();
if (ExistSummaryNode(graph.get())) {
graph->set_summary_node_exist(true);

Loading…
Cancel
Save