From 957b435f163602395a9ab492cb1a162e03855d4f Mon Sep 17 00:00:00 2001 From: l00444296 Date: Thu, 19 Nov 2020 22:02:11 +0800 Subject: [PATCH 1/3] Feature: handle model_exit bug --- .../load/new_model_manager/davinci_model.cc | 18 ++++++++++++++---- ge/graph/passes/flow_ctrl_pass.cc | 6 +++--- third_party/fwkacllib/inc/runtime/base.h | 1 + 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ge/graph/load/new_model_manager/davinci_model.cc b/ge/graph/load/new_model_manager/davinci_model.cc index 13ffbaf0..86bfaef1 100755 --- a/ge/graph/load/new_model_manager/davinci_model.cc +++ b/ge/graph/load/new_model_manager/davinci_model.cc @@ -2804,9 +2804,14 @@ void *DavinciModel::Run(DavinciModel *model) { GELOGI("rtStreamSynchronize start."); rt_ret = rtStreamSynchronize(model->rt_model_stream_); - GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, rslt_flg = false; - (void)model->ReturnResult(current_data.index, false, seq_end_flag, data_wrapper->GetOutput()); - continue); // [No need to check value] + if (rt_ret == RT_ERROR_MODEL_ABORT_NORMAL) { + GELOGW("rtStreamSynchronize get result : RT_ERROR_MODEL_ABORT_NORMAL, abort model normal"); + } else { + GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, rslt_flg = false; + (void)model->ReturnResult(current_data.index, false, seq_end_flag, data_wrapper->GetOutput()); + continue); // [No need to check value] + } + GELOGI("rtStreamSynchronize end."); (void)ProfilingManager::Instance().StopProfiling(); // just profiling, no need to check value } @@ -2827,12 +2832,17 @@ void *DavinciModel::Run(DavinciModel *model) { if (rt_ret == kEndOfSequence || rt_ret == kEndOfSequenceNew) { seq_end_flag = true; } - GE_IF_BOOL_EXEC( + if (rt_ret == RT_ERROR_MODEL_ABORT_NORMAL) { + GELOGW("rtStreamSynchronize get result : RT_ERROR_MODEL_ABORT_NORMAL, abort model normal"); + } else { + GE_IF_BOOL_EXEC( rt_ret != RT_ERROR_NONE, rslt_flg = false; GELOGI("seq_end_flg: %d", seq_end_flag); (void)model->ReturnResult(current_data.index, false, seq_end_flag, data_wrapper->GetOutput()); // [No need to check value] CsaInteract::GetInstance().StoreInternalErrorCode(rt_ret, ERROR_MODULE_RUNTIME, JOBSUBSTATE_GRAPH_EXEC); continue); + } + GELOGI("rtStreamSynchronize end."); GE_IF_BOOL_EXEC(model->is_first_execute_, GE_TIMESTAMP_EVENT_END(rtStreamSynchronize, "GraphExcute::Wait for rtStreamSynchronize")); diff --git a/ge/graph/passes/flow_ctrl_pass.cc b/ge/graph/passes/flow_ctrl_pass.cc index ce114d86..5a294aa2 100755 --- a/ge/graph/passes/flow_ctrl_pass.cc +++ b/ge/graph/passes/flow_ctrl_pass.cc @@ -357,9 +357,9 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c return FAILED; } GE_CHK_STATUS_RET(SetStreamLabel(active_node, switch_node->GetName()), "set stream label failed"); - GE_IF_BOOL_EXEC(!AttrUtils::SetBool(active_node->GetOpDesc(), ATTR_NAME_IS_LOOP_ACTIVE, true), - DOMI_LOGE("set ATTR_NAME_IS_LOOP_ACTIVE failed"); return FAILED); - + GE_CHK_STATUS_RET(SetSwitchBranchNodeLabel(active_node, switch_node->GetName()), + "set switch branch node label failed"); + string model_exit_name = switch_node->GetName() + "_ModelExit"; GE_CHK_STATUS_RET(SetActiveLabelList(active_node, { model_exit_name }), "set active label list failed"); diff --git a/third_party/fwkacllib/inc/runtime/base.h b/third_party/fwkacllib/inc/runtime/base.h index a8341e32..fcb7a627 100644 --- a/third_party/fwkacllib/inc/runtime/base.h +++ b/third_party/fwkacllib/inc/runtime/base.h @@ -103,6 +103,7 @@ typedef enum tagRtError { RT_ERROR_MODEL_EXIT, RT_ERROR_MODEL_EXIT_STREAM_UNBIND, RT_ERROR_MODEL_EXIT_ID, + RT_ERROR_MODEL_ABORT_NORMAL, RT_ERROR_EVENT_BASE = 0x07050000, RT_ERROR_EVENT_NULL, From da55a1f199a8063766b9f04e1325f54b050eac0d Mon Sep 17 00:00:00 2001 From: l00444296 Date: Fri, 20 Nov 2020 11:48:58 +0800 Subject: [PATCH 2/3] Feature: handle model_exit bug --- ge/graph/load/new_model_manager/davinci_model.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ge/graph/load/new_model_manager/davinci_model.cc b/ge/graph/load/new_model_manager/davinci_model.cc index 86bfaef1..e23a71ad 100755 --- a/ge/graph/load/new_model_manager/davinci_model.cc +++ b/ge/graph/load/new_model_manager/davinci_model.cc @@ -2805,7 +2805,7 @@ void *DavinciModel::Run(DavinciModel *model) { GELOGI("rtStreamSynchronize start."); rt_ret = rtStreamSynchronize(model->rt_model_stream_); if (rt_ret == RT_ERROR_MODEL_ABORT_NORMAL) { - GELOGW("rtStreamSynchronize get result : RT_ERROR_MODEL_ABORT_NORMAL, abort model normal"); + GELOGI("Stream Synchronize get result to abort model normal"); } else { GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, rslt_flg = false; (void)model->ReturnResult(current_data.index, false, seq_end_flag, data_wrapper->GetOutput()); @@ -2833,7 +2833,7 @@ void *DavinciModel::Run(DavinciModel *model) { seq_end_flag = true; } if (rt_ret == RT_ERROR_MODEL_ABORT_NORMAL) { - GELOGW("rtStreamSynchronize get result : RT_ERROR_MODEL_ABORT_NORMAL, abort model normal"); + GELOGI("Stream Synchronize get result to abort model normal"); } else { GE_IF_BOOL_EXEC( rt_ret != RT_ERROR_NONE, rslt_flg = false; GELOGI("seq_end_flg: %d", seq_end_flag); From d6c515e572d4bb15378438e04fa4cc52a973b741 Mon Sep 17 00:00:00 2001 From: l00444296 Date: Mon, 23 Nov 2020 10:01:43 +0800 Subject: [PATCH 3/3] Feature: handle model_exit bug --- ge/graph/load/new_model_manager/davinci_model.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ge/graph/load/new_model_manager/davinci_model.cc b/ge/graph/load/new_model_manager/davinci_model.cc index e23a71ad..02b16158 100755 --- a/ge/graph/load/new_model_manager/davinci_model.cc +++ b/ge/graph/load/new_model_manager/davinci_model.cc @@ -2805,7 +2805,7 @@ void *DavinciModel::Run(DavinciModel *model) { GELOGI("rtStreamSynchronize start."); rt_ret = rtStreamSynchronize(model->rt_model_stream_); if (rt_ret == RT_ERROR_MODEL_ABORT_NORMAL) { - GELOGI("Stream Synchronize get result to abort model normal"); + GELOGI("The model with multiple datasets aborts normally."); } else { GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, rslt_flg = false; (void)model->ReturnResult(current_data.index, false, seq_end_flag, data_wrapper->GetOutput()); @@ -2833,7 +2833,7 @@ void *DavinciModel::Run(DavinciModel *model) { seq_end_flag = true; } if (rt_ret == RT_ERROR_MODEL_ABORT_NORMAL) { - GELOGI("Stream Synchronize get result to abort model normal"); + GELOGI("The model with multiple datasets aborts normally."); } else { GE_IF_BOOL_EXEC( rt_ret != RT_ERROR_NONE, rslt_flg = false; GELOGI("seq_end_flg: %d", seq_end_flag);