From 6ae6d053c00029b4a5eb8a381e5306871bcfae25 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 27 Mar 2021 18:50:14 +0800 Subject: [PATCH 1/6] For step info. --- ge/CMakeLists.txt | 2 + ge/common/profiling/profiling_manager.cc | 54 +++++++++++++++++++ ge/common/profiling/profiling_manager.h | 1 + ge/executor/CMakeLists.txt | 2 + ge/graph/load/model_manager/davinci_model.cc | 13 +++++ ge/hybrid/executor/hybrid_model_executor.cc | 12 +++++ tests/ut/ge/CMakeLists.txt | 7 +++ .../ge_profiling_manager_unittest.cc | 6 +++ 8 files changed, 97 insertions(+) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index bd9edd86..7fbc79be 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -708,6 +708,7 @@ target_compile_definitions(ge_runner PRIVATE DAVINCI_CLOUD google=ascend_private FUNC_VISIBILITY + $<$:ONLY_COMPILE_OPEN_SRC> ) target_compile_options(ge_runner PRIVATE @@ -783,6 +784,7 @@ target_compile_definitions(ge_compiler PRIVATE COMPILE_OMG_PACKAGE google=ascend_private FUNC_VISIBILITY + $<$:ONLY_COMPILE_OPEN_SRC> ) target_compile_options(ge_compiler PRIVATE diff --git a/ge/common/profiling/profiling_manager.cc b/ge/common/profiling/profiling_manager.cc index e64f64a7..40dc8d89 100644 --- a/ge/common/profiling/profiling_manager.cc +++ b/ge/common/profiling/profiling_manager.cc @@ -24,6 +24,7 @@ #include "graph/types.h" #include "runtime/base.h" #include "graph/load/model_manager/davinci_model.h" +#include "mmpa/mmpa_api.h" namespace { const char *const kTrainingTrace = "training_trace"; @@ -46,6 +47,7 @@ const std::string kOptype = "op_type"; const std::string kBlockDim = "block_dims"; const std::string kTaskId = "task_id"; const std::string kStreamId = "stream_id"; +const std::string kThreadId = "thread_id"; const std::string kShapeType = "shape_type"; const std::string kCurIterNum = "cur_iter_num"; const std::string kTaskType = "task_type"; @@ -286,6 +288,58 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::Profilin #endif } +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfileStepInfo( + uint64_t index_id, uint64_t model_id, uint16_t tag_id, rtStream_t stream, int32_t device_id) { +#ifdef DAVINCI_SUPPORT_PROFILING + rtError_t rt_ret = RT_ERROR_NONE; +#ifndef ONLY_COMPILE_OPEN_SRC + GELOGD("Profiling Step Info TraceTask execute async start, index_id = %lu, model_id = %lu, tag_id = %u", + index_id, model_id, tag_id); + rt_ret = rtProfilerTraceEx(index_id, model_id, tag_id, stream); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(RT_FAILED, "[Call][rtProfilerTraceEx] failed, ret: 0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + GELOGD("Profiling Step Info TraceTask execute async success, index_id = %lu, model_id = %lu, tag_id = %u", + index_id, model_id, tag_id); +#endif + + mmTimespec timespec = mmGetTickCount(); + // 1000 ^ 3 converts second to nanosecond + int64_t time = timespec.tv_sec * 1000 * 1000 * 1000 + timespec.tv_nsec; + uint32_t task_id = 0; + uint32_t stream_id = 0; + rt_ret = rtGetTaskIdAndStreamID(&task_id, &stream_id); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(RT_FAILED, "[Get][RtsInfo] task_id and stream_id failed, ret: 0x%X.", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + GELOGD("Get profiling args, task_id[%u], stream_id[%u]", task_id, stream_id); + + Json step_info; + step_info[kIndexId] = index_id; + step_info[kModeleId] = model_id; + step_info[kTimeStamp] = time; + step_info[kTagId] = tag_id; + step_info[kTaskId] = task_id; + step_info[kStreamId] = stream_id; + step_info[kThreadId] = mmGetTid(); + + std::string reported_data; + try { + reported_data = step_info.dump(kInteval, ' ', false, Json::error_handler_t::ignore); + } catch (std::exception &e) { + GELOGE(FAILED, "Failed to convert JSON to string, reason: %s.", e.what()); + } catch (...) { + GELOGE(FAILED, "Failed to convert JSON to string."); + } + reported_data.append(",") + .append("\n"); + ProfilingManager::Instance().ReportData(device_id, reported_data, "step_info"); +#endif + return SUCCESS; +} + FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::ReportData( const int32_t &device_id, const string &data, const string &tag_name) { #ifdef DAVINCI_SUPPORT_PROFILING diff --git a/ge/common/profiling/profiling_manager.h b/ge/common/profiling/profiling_manager.h index b34c74c3..f3d47763 100755 --- a/ge/common/profiling/profiling_manager.h +++ b/ge/common/profiling/profiling_manager.h @@ -97,6 +97,7 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ProfilingManager { void GetFpBpPoint(std::string &fp_point, std::string &bp_point); void GetOpInputOutputInfo(const OpDescPtr &op, TaskDescInfo &task_desc_info) const; void ReportData(const int32_t &device_id, const std::string &data, const std::string &tag_name); + Status ProfileStepInfo(uint64_t index_id, uint64_t model_id, uint16_t tag_id, rtStream_t stream, int32_t device_id); private: Status InitFromOptions(const Options &options, MsprofGeOptions &prof_conf); Status ParseOptions(const std::string &options); diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index 363900d0..89fce8a0 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -179,6 +179,7 @@ target_compile_definitions(ge_executor PRIVATE google=ascend_private $,OS_TYPE=WIN,OS_TYPE=0> $<$:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX> + $<$:ONLY_COMPILE_OPEN_SRC> LOG_CPP ) @@ -225,6 +226,7 @@ target_compile_definitions(ge_executor_shared PRIVATE DAVINCI_SUPPORT_PROFILING google=ascend_private FUNC_VISIBILITY + $<$:ONLY_COMPILE_OPEN_SRC> ) target_include_directories(ge_executor_shared PRIVATE diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 52642086..dfe6f390 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -3693,12 +3693,25 @@ Status DavinciModel::NnExecute(rtStream_t stream, bool async_mode, const InputDa GE_IF_BOOL_EXEC(profiling_model_execute_on, SetProfileTime(MODEL_PRE_PROC_END)); if (!task_list_.empty()) { + uint64_t index_id = iterator_count_ + 1; + 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) { + 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); GE_CHK_RT_EXEC(rt_ret, return RT_ERROR_TO_GE_STATUS(rt_ret)); GE_IF_BOOL_EXEC(profiling_model_execute_on, SetProfileTime(MODEL_INFER_END)); GELOGD("rtModelExecute end"); + if (profiling_model_execute_on) { + GE_CHK_STATUS_RET_NOLOG( + ProfilingManager::Instance().ProfileStepInfo(index_id, model_id, 0, rt_model_stream_, device_id)); + } + iterator_count_++; } if (!is_async_mode_) { diff --git a/ge/hybrid/executor/hybrid_model_executor.cc b/ge/hybrid/executor/hybrid_model_executor.cc index 4b589a03..80dc4184 100755 --- a/ge/hybrid/executor/hybrid_model_executor.cc +++ b/ge/hybrid/executor/hybrid_model_executor.cc @@ -18,6 +18,7 @@ #include "graph/ge_context.h" #include "graph/runtime_inference_context.h" #include "common/dump/dump_manager.h" +#include "common/profiling/profiling_manager.h" namespace ge { namespace hybrid { @@ -77,9 +78,20 @@ Status HybridModelExecutor::ExecuteGraphInternal(SubgraphExecutor &executor, GE_CHK_STATUS_RET_NOLOG(ResetExecutionContext(context_)); RECORD_MODEL_EXECUTION_EVENT(&context_, "[InitContext] End"); + // tag_id 0 means step begin, 1 meas step end. + uint64_t index_id = context_.iteration + 1; + uint64_t model_id = static_cast(model_->GetModelId()); + int32_t device_id = static_cast(device_id_); + auto &prof_mgr = ProfilingManager::Instance(); + if (prof_mgr.ProfilingModelExecuteOn()) { + GE_CHK_STATUS_RET_NOLOG(prof_mgr.ProfileStepInfo(index_id, model_id, 0, stream_, device_id)); + } HYBRID_CHK_STATUS_RET(executor.ExecuteAsync(args.inputs, args.input_desc, args.outputs), "Failed to execute partitioned call."); RECORD_MODEL_EXECUTION_EVENT(&context_, "[ExecuteAsync] End"); + if (prof_mgr.ProfilingModelExecuteOn()) { + GE_CHK_STATUS_RET_NOLOG(prof_mgr.ProfileStepInfo(index_id, model_id, 1, stream_, device_id)); + } HYBRID_CHK_STATUS_RET(executor.Synchronize(), "Failed to sync root graph."); RECORD_MODEL_EXECUTION_EVENT(&context_, "[Synchronize] End"); diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index cf60d1aa..e8b76ca3 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -840,6 +840,8 @@ add_library(ge_ut_common STATIC ${COMMON_SRC_FILES} ${PROTO_HDRS}) target_compile_definitions(ge_ut_common PRIVATE google=ascend_private + DAVINCI_SUPPORT_PROFILING + $<$:ONLY_COMPILE_OPEN_SRC> ) target_compile_options(ge_ut_common PRIVATE @@ -860,6 +862,8 @@ add_library(ge_ut_common_format STATIC ${COMMON_SRC_FILES} ${COMMON_FORMAT_SRC_F target_compile_definitions(ge_ut_common_format PRIVATE google=ascend_private + DAVINCI_SUPPORT_PROFILING + $<$:ONLY_COMPILE_OPEN_SRC> ) target_compile_options(ge_ut_common_format PRIVATE @@ -1012,6 +1016,7 @@ add_library(ge_single_op STATIC ${SINGLE_OP_SRC_FILES} ${PROTO_HDRS}) target_compile_definitions(ge_single_op PRIVATE google=ascend_private + $<$:ONLY_COMPILE_OPEN_SRC> ) target_compile_options(ge_single_op PRIVATE @@ -1108,6 +1113,8 @@ target_compile_options(ut_libge_distinct_load_utest PRIVATE target_compile_definitions(ut_libge_distinct_load_utest PRIVATE google=ascend_private + DAVINCI_SUPPORT_PROFILING + $<$:ONLY_COMPILE_OPEN_SRC> ) target_link_libraries(ut_libge_distinct_load_utest diff --git a/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc b/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc index 3dfbff41..6bcb23d2 100644 --- a/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc +++ b/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc @@ -78,3 +78,9 @@ TEST_F(UtestGeProfilinganager, plungin_init_) { EXPECT_EQ(ret, INTERNAL_ERROR); ProfilingManager::Instance().prof_cb_.msprofReporterCallback = nullptr; } + +TEST_F(UtestGeProfilinganager, test_step_info) { + ProfilingManager::Instance().prof_cb_.msprofReporterCallback = ReporterCallback; + EXPECT_EQ(ProfilingManager::Instance().ProfileStepInfo(0, 0, 0, nullptr, 0), SUCCESS); + ProfilingManager::Instance().prof_cb_.msprofReporterCallback = nullptr; +} From f4c343d7dd9bdf02bc309d563e1faed55a2b3a42 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 27 Mar 2021 18:59:20 +0800 Subject: [PATCH 2/6] For step info. --- ge/common/profiling/profiling_manager.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ge/common/profiling/profiling_manager.cc b/ge/common/profiling/profiling_manager.cc index 40dc8d89..58148fe3 100644 --- a/ge/common/profiling/profiling_manager.cc +++ b/ge/common/profiling/profiling_manager.cc @@ -48,6 +48,9 @@ const std::string kBlockDim = "block_dims"; const std::string kTaskId = "task_id"; const std::string kStreamId = "stream_id"; const std::string kThreadId = "thread_id"; +const std::string kIndexId = "index_id"; +const std::string kTimeStamp = "time_stamp"; +const std::string kTagId = "tag_id"; const std::string kShapeType = "shape_type"; const std::string kCurIterNum = "cur_iter_num"; const std::string kTaskType = "task_type"; @@ -318,7 +321,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfileStepInfo( Json step_info; step_info[kIndexId] = index_id; - step_info[kModeleId] = model_id; + step_info[kModelId] = model_id; step_info[kTimeStamp] = time; step_info[kTagId] = tag_id; step_info[kTaskId] = task_id; From d47d7b378a79f11580eb38d6566a47d28b43cc53 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Sat, 27 Mar 2021 20:25:12 +0800 Subject: [PATCH 3/6] Fix bug. --- ge/common/profiling/profiling_manager.cc | 4 ++-- ge/common/profiling/profiling_manager.h | 1 + tests/ut/ge/CMakeLists.txt | 3 --- tests/ut/ge/profiling/ge_profiling_manager_unittest.cc | 6 ------ 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/ge/common/profiling/profiling_manager.cc b/ge/common/profiling/profiling_manager.cc index 58148fe3..fbbf1f04 100644 --- a/ge/common/profiling/profiling_manager.cc +++ b/ge/common/profiling/profiling_manager.cc @@ -291,7 +291,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::Profilin #endif } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfileStepInfo( +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfileStepInfo( uint64_t index_id, uint64_t model_id, uint16_t tag_id, rtStream_t stream, int32_t device_id) { #ifdef DAVINCI_SUPPORT_PROFILING rtError_t rt_ret = RT_ERROR_NONE; @@ -338,7 +338,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfileStepInfo( } reported_data.append(",") .append("\n"); - ProfilingManager::Instance().ReportData(device_id, reported_data, "step_info"); + ReportData(device_id, reported_data, "step_info"); #endif return SUCCESS; } diff --git a/ge/common/profiling/profiling_manager.h b/ge/common/profiling/profiling_manager.h index f3d47763..ab344204 100755 --- a/ge/common/profiling/profiling_manager.h +++ b/ge/common/profiling/profiling_manager.h @@ -27,6 +27,7 @@ #include "framework/common/ge_types.h" #include "external/register/register_types.h" #include "toolchain/prof_callback.h" +#include "runtime/stream.h" using std::map; using std::string; diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index e8b76ca3..02ff7fcc 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -840,7 +840,6 @@ add_library(ge_ut_common STATIC ${COMMON_SRC_FILES} ${PROTO_HDRS}) target_compile_definitions(ge_ut_common PRIVATE google=ascend_private - DAVINCI_SUPPORT_PROFILING $<$:ONLY_COMPILE_OPEN_SRC> ) @@ -862,7 +861,6 @@ add_library(ge_ut_common_format STATIC ${COMMON_SRC_FILES} ${COMMON_FORMAT_SRC_F target_compile_definitions(ge_ut_common_format PRIVATE google=ascend_private - DAVINCI_SUPPORT_PROFILING $<$:ONLY_COMPILE_OPEN_SRC> ) @@ -1113,7 +1111,6 @@ target_compile_options(ut_libge_distinct_load_utest PRIVATE target_compile_definitions(ut_libge_distinct_load_utest PRIVATE google=ascend_private - DAVINCI_SUPPORT_PROFILING $<$:ONLY_COMPILE_OPEN_SRC> ) diff --git a/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc b/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc index 6bcb23d2..3dfbff41 100644 --- a/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc +++ b/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc @@ -78,9 +78,3 @@ TEST_F(UtestGeProfilinganager, plungin_init_) { EXPECT_EQ(ret, INTERNAL_ERROR); ProfilingManager::Instance().prof_cb_.msprofReporterCallback = nullptr; } - -TEST_F(UtestGeProfilinganager, test_step_info) { - ProfilingManager::Instance().prof_cb_.msprofReporterCallback = ReporterCallback; - EXPECT_EQ(ProfilingManager::Instance().ProfileStepInfo(0, 0, 0, nullptr, 0), SUCCESS); - ProfilingManager::Instance().prof_cb_.msprofReporterCallback = nullptr; -} From e8eeace382f2b75ea87283657611d50d265cc503 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Sat, 27 Mar 2021 20:42:53 +0800 Subject: [PATCH 4/6] Add ut. --- tests/ut/ge/graph/load/davinci_model_unittest.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/ut/ge/graph/load/davinci_model_unittest.cc b/tests/ut/ge/graph/load/davinci_model_unittest.cc index 3487f8ed..c6f3da44 100644 --- a/tests/ut/ge/graph/load/davinci_model_unittest.cc +++ b/tests/ut/ge/graph/load/davinci_model_unittest.cc @@ -988,6 +988,10 @@ TEST_F(UtestDavinciModel, NnExecute) { EXPECT_EQ(outputs.size(), 1); input_data.blobs = output_data.blobs; EXPECT_EQ(input_data.blobs.size(), 1); + + ProfilingManager::Instance().prof_cb_.msprofReporterCallback = MsprofReport; + ProfilingManager::Instance().device_id_.emplace_back(0); + model.task_list_.resize(1); EXPECT_EQ(model.NnExecute(stream, false, input_data, output_data), SUCCESS); } } // namespace ge From e7df70fd4e86a3c4ca895fb41be8d8cc4e397702 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Sun, 28 Mar 2021 09:35:35 +0800 Subject: [PATCH 5/6] Add ut. --- ge/graph/load/model_manager/davinci_model.cc | 6 +++--- ge/hybrid/executor/hybrid_model_executor.cc | 2 +- tests/depends/runtime/src/runtime_stub.cc | 2 ++ tests/ut/ge/CMakeLists.txt | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index dfe6f390..74e2be9d 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -3700,7 +3700,7 @@ Status DavinciModel::NnExecute(rtStream_t stream, bool async_mode, const InputDa if (profiling_model_execute_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); @@ -3709,8 +3709,8 @@ Status DavinciModel::NnExecute(rtStream_t stream, bool async_mode, const InputDa GELOGD("rtModelExecute end"); if (profiling_model_execute_on) { GE_CHK_STATUS_RET_NOLOG( - ProfilingManager::Instance().ProfileStepInfo(index_id, model_id, 0, rt_model_stream_, device_id)); - } + ProfilingManager::Instance().ProfileStepInfo(index_id, model_id, 1, rt_model_stream_, device_id)); + } iterator_count_++; } diff --git a/ge/hybrid/executor/hybrid_model_executor.cc b/ge/hybrid/executor/hybrid_model_executor.cc index 80dc4184..f1251586 100755 --- a/ge/hybrid/executor/hybrid_model_executor.cc +++ b/ge/hybrid/executor/hybrid_model_executor.cc @@ -78,11 +78,11 @@ Status HybridModelExecutor::ExecuteGraphInternal(SubgraphExecutor &executor, GE_CHK_STATUS_RET_NOLOG(ResetExecutionContext(context_)); RECORD_MODEL_EXECUTION_EVENT(&context_, "[InitContext] End"); - // tag_id 0 means step begin, 1 meas step end. uint64_t index_id = context_.iteration + 1; uint64_t model_id = static_cast(model_->GetModelId()); 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()) { GE_CHK_STATUS_RET_NOLOG(prof_mgr.ProfileStepInfo(index_id, model_id, 0, stream_, device_id)); } diff --git a/tests/depends/runtime/src/runtime_stub.cc b/tests/depends/runtime/src/runtime_stub.cc index f8eedcbc..b062ec80 100644 --- a/tests/depends/runtime/src/runtime_stub.cc +++ b/tests/depends/runtime/src/runtime_stub.cc @@ -313,6 +313,8 @@ rtError_t rtFlushCache(uint64_t base, uint32_t len) { return RT_ERROR_NONE; } rtError_t rtProfilerTrace(uint64_t id, bool notify, uint32_t flags, rtStream_t stream_) { return RT_ERROR_NONE; } +rtError_t rtProfilerTraceEx(uint64_t id, uint64_t modelId, uint16_t tagId, rtStream_t stream) { return RT_ERROR_NONE; } + rtError_t rtMemSetRC(const void *dev_ptr, uint64_t size, uint32_t read_count) { return RT_ERROR_NONE; } rtError_t rtStreamSwitch(void *ptr, rtCondition_t condition, int64_t value, rtStream_t true_stream, rtStream_t stream) { diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 02ff7fcc..90b8b0ed 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -854,6 +854,7 @@ target_link_libraries(ge_ut_common PRIVATE ascend_protobuf json ge_ut_graph + runtime_stub ) # build common format From 06f291208c34f7726c9bd5e389e131e598708aa9 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Sun, 28 Mar 2021 14:59:28 +0800 Subject: [PATCH 6/6] Add ut. --- ge/graph/load/model_manager/davinci_model.cc | 2 ++ ge/hybrid/executor/hybrid_model_executor.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 74e2be9d..dc867d56 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -3701,12 +3701,14 @@ Status DavinciModel::NnExecute(rtStream_t stream, bool async_mode, const InputDa 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); GE_CHK_RT_EXEC(rt_ret, return RT_ERROR_TO_GE_STATUS(rt_ret)); GE_IF_BOOL_EXEC(profiling_model_execute_on, SetProfileTime(MODEL_INFER_END)); GELOGD("rtModelExecute end"); + if (profiling_model_execute_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 f1251586..2efa120f 100755 --- a/ge/hybrid/executor/hybrid_model_executor.cc +++ b/ge/hybrid/executor/hybrid_model_executor.cc @@ -86,9 +86,11 @@ Status HybridModelExecutor::ExecuteGraphInternal(SubgraphExecutor &executor, if (prof_mgr.ProfilingModelExecuteOn()) { GE_CHK_STATUS_RET_NOLOG(prof_mgr.ProfileStepInfo(index_id, model_id, 0, stream_, device_id)); } + HYBRID_CHK_STATUS_RET(executor.ExecuteAsync(args.inputs, args.input_desc, args.outputs), "Failed to execute partitioned call."); RECORD_MODEL_EXECUTION_EVENT(&context_, "[ExecuteAsync] End"); + if (prof_mgr.ProfilingModelExecuteOn()) { GE_CHK_STATUS_RET_NOLOG(prof_mgr.ProfileStepInfo(index_id, model_id, 1, stream_, device_id)); }