| @@ -830,6 +830,13 @@ Status DataDumper::UnloadDumpInfo() { | |||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| void DataDumper::DumpShrink() { | |||||
| compute_graph_.reset(); | |||||
| input_map_.clear(); | |||||
| ref_info_.clear(); | |||||
| op_list_.clear(); | |||||
| } | |||||
| void DataDumper::PrintCheckLog(string &dump_list_key) { | void DataDumper::PrintCheckLog(string &dump_list_key) { | ||||
| std::set<std::string> model_list = dump_properties_.GetAllDumpModel(); | std::set<std::string> model_list = dump_properties_.GetAllDumpModel(); | ||||
| if (model_list.empty()) { | if (model_list.empty()) { | ||||
| @@ -83,6 +83,8 @@ class DataDumper { | |||||
| Status UnloadDumpInfo(); | Status UnloadDumpInfo(); | ||||
| void DumpShrink(); | |||||
| void SetDumpProperties(const DumpProperties &dump_properties) { dump_properties_ = dump_properties; } | void SetDumpProperties(const DumpProperties &dump_properties) { dump_properties_ = dump_properties; } | ||||
| const DumpProperties &GetDumpProperties() const { return dump_properties_; } | const DumpProperties &GetDumpProperties() const { return dump_properties_; } | ||||
| bool GetOpDescInfo(uint32_t stream_id, uint32_t task_id, OpDescInfo &op_desc_info) const; | bool GetOpDescInfo(uint32_t stream_id, uint32_t task_id, OpDescInfo &op_desc_info) const; | ||||
| @@ -112,18 +114,18 @@ class DataDumper { | |||||
| struct InnerInputMapping; | struct InnerInputMapping; | ||||
| std::vector<OpDescInfo> op_desc_info_; | std::vector<OpDescInfo> op_desc_info_; | ||||
| std::vector<InnerDumpInfo> op_list_; | |||||
| std::vector<InnerDumpInfo> op_list_; // release after DavinciModel::Init | |||||
| uint32_t end_graph_task_id_ = 0; | uint32_t end_graph_task_id_ = 0; | ||||
| uint32_t end_graph_stream_id_ = 0; | uint32_t end_graph_stream_id_ = 0; | ||||
| bool is_end_graph_ = false; | bool is_end_graph_ = false; | ||||
| std::multimap<std::string, InnerInputMapping> input_map_; | |||||
| std::multimap<std::string, InnerInputMapping> input_map_; // release after DavinciModel::Init | |||||
| bool load_flag_; | bool load_flag_; | ||||
| uint32_t device_id_; | uint32_t device_id_; | ||||
| uintptr_t global_step_; | uintptr_t global_step_; | ||||
| uintptr_t loop_per_iter_; | uintptr_t loop_per_iter_; | ||||
| uintptr_t loop_cond_; | uintptr_t loop_cond_; | ||||
| ComputeGraphPtr compute_graph_; | |||||
| std::map<OpDescPtr, void *> ref_info_; | |||||
| ComputeGraphPtr compute_graph_; // release after DavinciModel::Init | |||||
| std::map<OpDescPtr, void *> ref_info_; // release after DavinciModel::Init | |||||
| void *l1_fusion_addr_ = nullptr; | void *l1_fusion_addr_ = nullptr; | ||||
| @@ -148,14 +148,7 @@ DavinciModel::~DavinciModel() { | |||||
| GELOGW("UnloadDumpInfo failed, ret: %u.", ret); | GELOGW("UnloadDumpInfo failed, ret: %u.", ret); | ||||
| } | } | ||||
| for (const auto &op_and_addr : saved_task_addrs_) { | |||||
| auto addr = op_and_addr.second; | |||||
| if (addr != nullptr) { | |||||
| GE_CHK_RT(rtFree(addr)); | |||||
| } | |||||
| addr = nullptr; | |||||
| } | |||||
| saved_task_addrs_.clear(); | |||||
| ClearTaskAddrs(); | |||||
| GE_CHK_STATUS(ModelRunStop()); | GE_CHK_STATUS(ModelRunStop()); | ||||
| @@ -220,6 +213,17 @@ DavinciModel::~DavinciModel() { | |||||
| } | } | ||||
| } | } | ||||
| void DavinciModel::ClearTaskAddrs() { | |||||
| for (const auto &op_and_addr : saved_task_addrs_) { | |||||
| auto addr = op_and_addr.second; | |||||
| if (addr != nullptr) { | |||||
| GE_CHK_RT(rtFree(addr)); | |||||
| } | |||||
| addr = nullptr; | |||||
| } | |||||
| saved_task_addrs_.clear(); | |||||
| } | |||||
| void DavinciModel::UnbindHcomStream() { | void DavinciModel::UnbindHcomStream() { | ||||
| if (!all_hccl_stream_list_.empty()) { | if (!all_hccl_stream_list_.empty()) { | ||||
| for (size_t i = 0; i < all_hccl_stream_list_.size(); i++) { | for (size_t i = 0; i < all_hccl_stream_list_.size(); i++) { | ||||
| @@ -261,7 +265,10 @@ Status DavinciModel::Assign(const GeModelPtr &ge_model) { | |||||
| /// @return: void | /// @return: void | ||||
| /// | /// | ||||
| void DavinciModel::Shrink() { | void DavinciModel::Shrink() { | ||||
| //DumperShrink(); | |||||
| ge_model_.reset(); // delete object. | ge_model_.reset(); // delete object. | ||||
| //op_list_.clear(); | |||||
| //ClearTaskAddrs(); | |||||
| } | } | ||||
| Status DavinciModel::InitWeightMem(void *dev_ptr, void *weight_ptr, size_t weight_size) { | Status DavinciModel::InitWeightMem(void *dev_ptr, void *weight_ptr, size_t weight_size) { | ||||
| @@ -735,7 +742,6 @@ Status DavinciModel::ReportProfilingData() { | |||||
| } | } | ||||
| ProfilingManager::Instance().ReportProfilingData(model_id_, GetTaskDescInfo(), compute_graph_desc_info); | ProfilingManager::Instance().ReportProfilingData(model_id_, GetTaskDescInfo(), compute_graph_desc_info); | ||||
| GE_CHK_STATUS(SinkModelProfile(), "Sink model profiler failed."); | GE_CHK_STATUS(SinkModelProfile(), "Sink model profiler failed."); | ||||
| op_list_.clear(); | |||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| @@ -934,11 +940,15 @@ Status DavinciModel::InitInputOutputForDynamic(const ComputeGraphPtr &compute_gr | |||||
| } | } | ||||
| if (IsDataOp(op_desc->GetType())) { | if (IsDataOp(op_desc->GetType())) { | ||||
| GELOGD("init data op %s", op_desc->GetName().c_str()); | GELOGD("init data op %s", op_desc->GetName().c_str()); | ||||
| data_op_list_.push_back(op_desc); | |||||
| auto data_op = AttrUtils::CopyOpDesc(op_desc); | |||||
| GE_CHECK_NOTNULL(data_op); | |||||
| data_op_list_.push_back(data_op); | |||||
| } | } | ||||
| if (op_desc->GetType() == NETOUTPUT) { | if (op_desc->GetType() == NETOUTPUT) { | ||||
| GELOGD("init netouput op %s", op_desc->GetName().c_str()); | GELOGD("init netouput op %s", op_desc->GetName().c_str()); | ||||
| output_op_list_.push_back(op_desc); | |||||
| auto output_op = AttrUtils::CopyOpDesc(op_desc); | |||||
| GE_CHECK_NOTNULL(output_op); | |||||
| output_op_list_.push_back(output_op); | |||||
| } | } | ||||
| } | } | ||||
| return SUCCESS; | return SUCCESS; | ||||
| @@ -976,7 +986,9 @@ Status DavinciModel::InitDataOp(const NodePtr &node, uint32_t &data_op_index, ma | |||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| data_op_list_.push_back(op_desc); | |||||
| auto data_op = AttrUtils::CopyOpDesc(op_desc); | |||||
| GE_CHECK_NOTNULL(data_op); | |||||
| data_op_list_.push_back(data_op); | |||||
| // Make information for copy input data. | // Make information for copy input data. | ||||
| const vector<int64_t> output_size_list = ModelUtils::GetOutputSize(op_desc); | const vector<int64_t> output_size_list = ModelUtils::GetOutputSize(op_desc); | ||||
| @@ -1031,7 +1043,9 @@ void DavinciModel::AdjustDataOpList(const map<uint32_t, OpDescPtr> &data_by_inde | |||||
| data_op_list_.clear(); | data_op_list_.clear(); | ||||
| for (auto &item : data_by_index) { | for (auto &item : data_by_index) { | ||||
| data_op_list_.emplace_back(item.second); | |||||
| auto data_op = AttrUtils::CopyOpDesc(item.second); | |||||
| GE_CHECK_NOTNULL_EXEC(data_op, return); | |||||
| data_op_list_.emplace_back(data_op); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1063,7 +1077,9 @@ Status DavinciModel::InitNetOutput(const NodePtr &node) { | |||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| output_op_list_.push_back(op_desc); | |||||
| auto output_op = AttrUtils::CopyOpDesc(op_desc); | |||||
| GE_CHECK_NOTNULL(output_op); | |||||
| output_op_list_.push_back(output_op); | |||||
| // Make information for copy output data. | // Make information for copy output data. | ||||
| const vector<int64_t> input_size_list = ModelUtils::GetInputSize(op_desc); | const vector<int64_t> input_size_list = ModelUtils::GetInputSize(op_desc); | ||||
| const vector<void *> virtual_addr_list = ModelUtils::GetInputDataAddrs(runtime_param_, op_desc); | const vector<void *> virtual_addr_list = ModelUtils::GetInputDataAddrs(runtime_param_, op_desc); | ||||
| @@ -458,6 +458,10 @@ class DavinciModel { | |||||
| data_dumper_.SaveDumpTask(task_id, stream_id, op_desc, args); | data_dumper_.SaveDumpTask(task_id, stream_id, op_desc, args); | ||||
| } | } | ||||
| void DumperShrink() { | |||||
| data_dumper_.DumpShrink(); | |||||
| } | |||||
| void SetEndGraphId(uint32_t task_id, uint32_t stream_id); | void SetEndGraphId(uint32_t task_id, uint32_t stream_id); | ||||
| DavinciModel &operator=(const DavinciModel &model) = delete; | DavinciModel &operator=(const DavinciModel &model) = delete; | ||||
| @@ -620,6 +624,8 @@ class DavinciModel { | |||||
| void ReleaseTask(); | void ReleaseTask(); | ||||
| void ClearTaskAddrs(); | |||||
| void UnbindTaskSinkStream(); | void UnbindTaskSinkStream(); | ||||
| bool IsAicpuKernelConnectSpecifiedLayer(); | bool IsAicpuKernelConnectSpecifiedLayer(); | ||||
| @@ -842,12 +848,12 @@ class DavinciModel { | |||||
| string om_name_; | string om_name_; | ||||
| uint32_t version_; | uint32_t version_; | ||||
| GeModelPtr ge_model_; | |||||
| GeModelPtr ge_model_; // release after DavinciModel::Init | |||||
| bool need_destroy_aicpu_kernel_{false}; | bool need_destroy_aicpu_kernel_{false}; | ||||
| vector<std::string> out_node_name_; | vector<std::string> out_node_name_; | ||||
| map<uint32_t, OpDescPtr> op_list_; | |||||
| map<uint32_t, OpDescPtr> op_list_; // release after DavinciModel::Init | |||||
| // data op_desc | // data op_desc | ||||
| vector<OpDescPtr> data_op_list_; | vector<OpDescPtr> data_op_list_; | ||||
| @@ -944,7 +950,7 @@ class DavinciModel { | |||||
| DataDumper data_dumper_; | DataDumper data_dumper_; | ||||
| uint64_t iterator_count_; | uint64_t iterator_count_; | ||||
| bool is_l1_fusion_enable_; | bool is_l1_fusion_enable_; | ||||
| std::map<OpDescPtr, void *> saved_task_addrs_; | |||||
| std::map<OpDescPtr, void *> saved_task_addrs_; // release after DavinciModel::Init | |||||
| void *l1_fusion_addr_ = nullptr; | void *l1_fusion_addr_ = nullptr; | ||||
| bool known_node_ = false; | bool known_node_ = false; | ||||
| @@ -1 +1 @@ | |||||
| Subproject commit c14d2be38171eed63416e71178774103faf1f5cd | |||||
| Subproject commit 624d39ed2458ec90ea71afa07e226fe183d9b634 | |||||
| @@ -58,7 +58,7 @@ | |||||
| /// @param [in] value: vector parameter value | /// @param [in] value: vector parameter value | ||||
| /// | /// | ||||
| void ErrorManager::ATCReportErrMessage(std::string error_code, const std::vector<std::string> &key, | void ErrorManager::ATCReportErrMessage(std::string error_code, const std::vector<std::string> &key, | ||||
| const std::vector<std::string> &value) { | |||||
| const std::vector<std::string> &value) { | |||||
| } | } | ||||
| /// | /// | ||||
| @@ -66,13 +66,8 @@ | |||||
| /// @param [in] msg: failed message map, key is error code, value is op_name | /// @param [in] msg: failed message map, key is error code, value is op_name | ||||
| /// @return int 0(success) -1(fail) | /// @return int 0(success) -1(fail) | ||||
| /// | /// | ||||
| int ErrorManager::ReportMstuneCompileFailedMsg(const std::map<std::string, std::string> &msg) { return 0; } | |||||
| /// | |||||
| /// @brief save graph compile failed message from thread local map to global map | |||||
| /// @param [in] graph_name: graph name | |||||
| /// | |||||
| void ErrorManager::SaveMstuneCompileFailedMsg(const std::string &graph_name) {} | |||||
| int ErrorManager::ReportMstuneCompileFailedMsg(const std::string &root_graph_name, | |||||
| const std::map<std::string, std::string> &msg) { return 0; } | |||||
| /// | /// | ||||
| /// @brief get graph compile failed message in mstune case | /// @brief get graph compile failed message in mstune case | ||||