From e7171d12146b7dc22e779a677eea32c7d5b0ea8a Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 30 Mar 2021 17:46:09 +0800 Subject: [PATCH] The switch of step profile switches to model_load. --- ge/graph/load/model_manager/davinci_model.cc | 7 ++++--- ge/hybrid/executor/hybrid_model_executor.cc | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 6b347a9d..f4aa311d 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -3864,6 +3864,7 @@ Status DavinciModel::NnExecute(rtStream_t stream, bool async_mode, const InputDa is_dynamic_ = input_data.is_dynamic_batch; bool profiling_model_execute_on = ProfilingManager::Instance().ProfilingModelExecuteOn(); + bool profiling_model_load_on = ProfilingManager::Instance().ProfilingModelLoadOn(); GE_IF_BOOL_EXEC(profiling_model_execute_on, SetProfileTime(MODEL_PRE_PROC_START)); Status ret = CopyModelData(input_data, output_data, is_dynamic_); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ret != SUCCESS, return ret, "Copy input data to model failed. model id: %u", @@ -3877,11 +3878,11 @@ Status DavinciModel::NnExecute(rtStream_t stream, bool async_mode, const InputDa uint64_t model_id = static_cast(model_id_); int32_t device_id = static_cast(device_id_); // tag_id 0 means step begin, 1 meas step end. - if (profiling_model_execute_on) { + if (profiling_model_load_on) { GE_CHK_STATUS_RET_NOLOG( ProfilingManager::Instance().ProfileStepInfo(index_id, model_id, 0, rt_model_stream_, device_id)); } - + GELOGD("rtModelExecute do"); GE_IF_BOOL_EXEC(profiling_model_execute_on, SetProfileTime(MODEL_INFER_START)); rtError_t rt_ret = rtModelExecute(rt_model_handle_, rt_model_stream_, 0); @@ -3889,7 +3890,7 @@ Status DavinciModel::NnExecute(rtStream_t stream, bool async_mode, const InputDa GE_IF_BOOL_EXEC(profiling_model_execute_on, SetProfileTime(MODEL_INFER_END)); GELOGD("rtModelExecute end"); - if (profiling_model_execute_on) { + if (profiling_model_load_on) { GE_CHK_STATUS_RET_NOLOG( ProfilingManager::Instance().ProfileStepInfo(index_id, model_id, 1, rt_model_stream_, device_id)); } diff --git a/ge/hybrid/executor/hybrid_model_executor.cc b/ge/hybrid/executor/hybrid_model_executor.cc index 2efa120f..6585677e 100755 --- a/ge/hybrid/executor/hybrid_model_executor.cc +++ b/ge/hybrid/executor/hybrid_model_executor.cc @@ -83,7 +83,7 @@ Status HybridModelExecutor::ExecuteGraphInternal(SubgraphExecutor &executor, int32_t device_id = static_cast(device_id_); auto &prof_mgr = ProfilingManager::Instance(); // tag_id 0 means step begin, 1 meas step end. - if (prof_mgr.ProfilingModelExecuteOn()) { + if (!model_->IsSingleOp() && prof_mgr.ProfilingModelLoadOn()) { GE_CHK_STATUS_RET_NOLOG(prof_mgr.ProfileStepInfo(index_id, model_id, 0, stream_, device_id)); } @@ -91,7 +91,7 @@ Status HybridModelExecutor::ExecuteGraphInternal(SubgraphExecutor &executor, "Failed to execute partitioned call."); RECORD_MODEL_EXECUTION_EVENT(&context_, "[ExecuteAsync] End"); - if (prof_mgr.ProfilingModelExecuteOn()) { + if (!model_->IsSingleOp() && prof_mgr.ProfilingModelLoadOn()) { GE_CHK_STATUS_RET_NOLOG(prof_mgr.ProfileStepInfo(index_id, model_id, 1, stream_, device_id)); }