已合并
refactor: 清理 dflow 中废弃函数和未使用常量 #3891
lining23666创建于 7月6日
refactor: 清理 dflow 中废弃函数和未使用常量 #3891
已合并
共 14 个文件变更+0-105
| @@ -316,13 +316,6 @@ Status FlowModelOmSaver::SaveFlowModelToFile(const std::string &output_file) { | |||
| 316 | return SUCCESS; | 316 | return SUCCESS; |
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | -Status FlowModelOmSaver::SaveFlowModelToDataBuffer(ModelBufferData &model_buff) { | ||
| 320 | - const std::string output_file; | ||
| 321 | - const auto ret = om_file_save_helper_.SaveModel(output_file.c_str(), model_buff, false); | ||
| 322 | - GE_ASSERT_SUCCESS(ret, "save model to model buffer failed."); | ||
| 323 | - return SUCCESS; | ||
| 324 | -} | ||
| 325 | - | ||
| 326 | Status FlowModelOmSaver::AddPartition(const google::protobuf::Message &partition_msg, | 319 | Status FlowModelOmSaver::AddPartition(const google::protobuf::Message &partition_msg, |
| 327 | ModelPartitionType partition_type) { | 320 | ModelPartitionType partition_type) { |
| 328 | Buffer buffer(partition_msg.ByteSizeLong()); | 321 | Buffer buffer(partition_msg.ByteSizeLong()); |
| @@ -33,7 +33,6 @@ class FlowModelOmSaver { | |||
| 33 | Status AddPartition(const google::protobuf::Message &partition_msg, ModelPartitionType partition_type); | 33 | Status AddPartition(const google::protobuf::Message &partition_msg, ModelPartitionType partition_type); |
| 34 | Status AddPartition(Buffer &buffer, ModelPartitionType partition_type); | 34 | Status AddPartition(Buffer &buffer, ModelPartitionType partition_type); |
| 35 | Status SaveFlowModelToFile(const std::string &output_file); | 35 | Status SaveFlowModelToFile(const std::string &output_file); |
| 36 | - Status SaveFlowModelToDataBuffer(ModelBufferData &model_buff); | ||
| 37 | 36 | ||
| 38 | /** | 37 | /** |
| 39 | * @brief fix non standard graph load failed. | 38 | * @brief fix non standard graph load failed. |
| @@ -45,7 +45,6 @@ constexpr const char *kSuspendGraphOriginalName = "_suspend_graph_original_name" | |||
| 45 | constexpr const char *kAttrNameDataFlowCompilerResult = "_dflow_compiler_result"; | 45 | constexpr const char *kAttrNameDataFlowCompilerResult = "_dflow_compiler_result"; |
| 46 | constexpr const char *kAttrNameDataFlowRunningResourceInfo = "_dflow_running_resource_info"; | 46 | constexpr const char *kAttrNameDataFlowRunningResourceInfo = "_dflow_running_resource_info"; |
| 47 | constexpr const char *kAttrNameDataFlowRunnableResource = "_dflow_runnable_resource"; | 47 | constexpr const char *kAttrNameDataFlowRunnableResource = "_dflow_runnable_resource"; |
| 48 | -constexpr size_t kMaxUpdateCacheThreadPoolSize = 8U; | ||
| 49 | 48 | ||
| 50 | Status TryLockFile(const std::string &lock_file, int32_t &fd) { | 49 | Status TryLockFile(const std::string &lock_file, int32_t &fd) { |
| 51 | fd = mmOpen2(lock_file.c_str(), M_CREAT | M_WRONLY, M_IRUSR | M_IWUSR); | 50 | fd = mmOpen2(lock_file.c_str(), M_CREAT | M_WRONLY, M_IRUSR | M_IWUSR); |
| @@ -302,41 +301,6 @@ bool FlowModelCache::TryLoadCompileResultFromCache(CacheCompileResult &cache_com | |||
| 302 | return match_cache; | 301 | return match_cache; |
| 303 | } | 302 | } |
| 304 | 303 | ||
| 305 | -Status FlowModelCache::UpdateFlowModelCache(const std::set<PneModelPtr> &refreshed_models) { | ||
| 306 | - if (refreshed_models.empty()) { | ||
| 307 | - return SUCCESS; | ||
| 308 | - } | ||
| 309 | - GE_TRACE_START(UpdateFlowModelCache); | ||
| 310 | - size_t pool_size = | ||
| 311 | - refreshed_models.size() > kMaxUpdateCacheThreadPoolSize ? kMaxUpdateCacheThreadPoolSize : refreshed_models.size(); | ||
| 312 | - ThreadPool pool("ge_upd_cch", static_cast<uint32_t>(pool_size), true); | ||
| 313 | - std::vector<std::future<Status>> fut_rets; | ||
| 314 | - for (const auto &model : refreshed_models) { | ||
| 315 | - if (model->GetSavedModelPath().empty()) { | ||
| 316 | - continue; | ||
| 317 | - } | ||
| 318 | - auto fut = pool.commit([model]() -> Status { | ||
| 319 | - ModelBufferData serialize_buff{}; | ||
| 320 | - GE_CHK_STATUS_RET(model->SerializeModel(serialize_buff), "Failed to serialize model, model_name = %s", | ||
| 321 | - model->GetModelName().c_str()); | ||
| 322 | - const auto &saved_model_path = model->GetSavedModelPath(); | ||
| 323 | - GE_ASSERT_GRAPH_SUCCESS( | ||
| 324 | - SaveBinToFile(reinterpret_cast<char_t *>(serialize_buff.data.get()), serialize_buff.length, saved_model_path), | ||
| 325 | - "Failed to save model data to file %s.", saved_model_path.c_str()); | ||
| 326 | - GEEVENT("Update model cache success, model_name = %s, path = %s", model->GetModelName().c_str(), | ||
| 327 | - saved_model_path.c_str()); | ||
| 328 | - return SUCCESS; | ||
| 329 | - }); | ||
| 330 | - fut_rets.emplace_back(std::move(fut)); | ||
| 331 | - } | ||
| 332 | - | ||
| 333 | - for (auto &fut : fut_rets) { | ||
| 334 | - GE_CHK_STATUS_RET(fut.get(), "Failed to update model cache"); | ||
| 335 | - } | ||
| 336 | - GE_COMPILE_TRACE_TIMESTAMP_END(UpdateFlowModelCache, "Update flow model cache cost"); | ||
| 337 | - return SUCCESS; | ||
| 338 | -} | ||
| 339 | - | ||
| 340 | Status FlowModelCache::TryLoadFlowModelFromCache(const ComputeGraphPtr &root_graph, FlowModelPtr &flow_model) { | 304 | Status FlowModelCache::TryLoadFlowModelFromCache(const ComputeGraphPtr &root_graph, FlowModelPtr &flow_model) { |
| 341 | if (!cache_enable_) { | 305 | if (!cache_enable_) { |
| 342 | GELOGD("cache is disable, no need load cache."); | 306 | GELOGD("cache is disable, no need load cache."); |
| @@ -113,7 +113,6 @@ class FlowModelCache { | |||
| 113 | static Status ReadCacheConfig(const std::string &config_file, CacheConfig &cache_config); | 113 | static Status ReadCacheConfig(const std::string &config_file, CacheConfig &cache_config); |
| 114 | static Status FormatCacheCompilerResult(const ge::NamedAttrs &compile_results, CacheCompileResult &result); | 114 | static Status FormatCacheCompilerResult(const ge::NamedAttrs &compile_results, CacheCompileResult &result); |
| 115 | Status GetSplitOmDataBaseDir(std::string &split_om_data_base_dir) const; | 115 | Status GetSplitOmDataBaseDir(std::string &split_om_data_base_dir) const; |
| 116 | - static Status UpdateFlowModelCache(const std::set<PneModelPtr> &refreshed_models); | ||
| 117 | bool cache_enable_ = false; | 116 | bool cache_enable_ = false; |
| 118 | std::string cache_dir_; | 117 | std::string cache_dir_; |
| 119 | CacheFileIndex cache_index_; | 118 | CacheFileIndex cache_index_; |
| @@ -41,7 +41,6 @@ const std::string kUdfAttrNameReleaseLib = "_dflow_process_point_release_pkg"; | |||
| 41 | const std::string kUdfAttrNameFinalLocation = "_dflow_final_location"; | 41 | const std::string kUdfAttrNameFinalLocation = "_dflow_final_location"; |
| 42 | const std::set<std::string> kUdfBaseAttrNames = {kUdfAttrNameBinPath, kUdfAttrNameFuncName, kUdfAttrNameProcessorType, | 42 | const std::set<std::string> kUdfBaseAttrNames = {kUdfAttrNameBinPath, kUdfAttrNameFuncName, kUdfAttrNameProcessorType, |
| 43 | kUdfAttrNameOsVersion}; | 43 | kUdfAttrNameOsVersion}; |
| 44 | -const std::string kUdfOpTypeFlowFunc = "FlowFunc"; | ||
| 45 | const std::string kUdfBuildInBinName = "libbuilt_in_flowfunc.so"; | 44 | const std::string kUdfBuildInBinName = "libbuilt_in_flowfunc.so"; |
| 46 | const std::string kUdfBuildInFuncNamePrefix = "_BuiltIn_"; | 45 | const std::string kUdfBuildInFuncNamePrefix = "_BuiltIn_"; |
| 47 | constexpr const char *kAttrNameDataFlowHeavyLoad = "_dflow_heavy_load"; | 46 | constexpr const char *kAttrNameDataFlowHeavyLoad = "_dflow_heavy_load"; |
| @@ -20,8 +20,6 @@ | |||
| 20 | 20 | ||
| 21 | namespace ge { | 21 | namespace ge { |
| 22 | namespace { | 22 | namespace { |
| 23 | -const char_t *const kConfigFileName = "/resource.json"; | ||
| 24 | -const char_t *const kHelperResFilePath = "HELPER_RES_FILE_PATH"; | ||
| 25 | const char_t *const kResourceConfigPath = "RESOURCE_CONFIG_PATH"; | 23 | const char_t *const kResourceConfigPath = "RESOURCE_CONFIG_PATH"; |
| 26 | const char_t *const kHomeEnvName = "HOME"; | 24 | const char_t *const kHomeEnvName = "HOME"; |
| 27 | } // namespace | 25 | } // namespace |
| @@ -31,10 +31,8 @@ | |||
| 31 | namespace ge { | 31 | namespace ge { |
| 32 | namespace { | 32 | namespace { |
| 33 | constexpr int32_t kQueueOpTimeout = 10 * 60 * 1000; // 10 min | 33 | constexpr int32_t kQueueOpTimeout = 10 * 60 * 1000; // 10 min |
| 34 | -constexpr uint32_t kBufferCount = 1U; | ||
| 35 | constexpr size_t kContextLen = 0U; | 34 | constexpr size_t kContextLen = 0U; |
| 36 | constexpr size_t kAlignmentVal64 = 64U; | 35 | constexpr size_t kAlignmentVal64 = 64U; |
| 37 | -constexpr uint32_t kMbufHeadMaxSize = 256U; | ||
| 38 | constexpr uint32_t kMbufHeadEndOfSequencePos = 128U; | 36 | constexpr uint32_t kMbufHeadEndOfSequencePos = 128U; |
| 39 | constexpr uint8_t kEndOfSequenceFlag = 0x5A; | 37 | constexpr uint8_t kEndOfSequenceFlag = 0x5A; |
| 40 | constexpr uint32_t kEventGroupId = 3U; | 38 | constexpr uint32_t kEventGroupId = 3U; |
| @@ -22,7 +22,6 @@ | |||
| 22 | namespace ge { | 22 | namespace ge { |
| 23 | namespace { | 23 | namespace { |
| 24 | constexpr int32_t kTimeout = 3000; | 24 | constexpr int32_t kTimeout = 3000; |
| 25 | -constexpr uint64_t kNpuMaxGroupMemSize = 35337011UL; // 33.7 * 1024 * 1024 KB | ||
| 26 | constexpr uint64_t kDefaultRemoteGroupCacheAllocSize = 10 * 1024 * 1024UL; // 10 * 1024 * 1024 KB | 25 | constexpr uint64_t kDefaultRemoteGroupCacheAllocSize = 10 * 1024 * 1024UL; // 10 * 1024 * 1024 KB |
| 27 | constexpr uint32_t kAddGroupTimeout = 10000; | 26 | constexpr uint32_t kAddGroupTimeout = 10000; |
| 28 | } // namespace | 27 | } // namespace |
| @@ -95,54 +95,6 @@ Status AbnormalStatusHandler::FindAbnormalDeviceOnServer(DeployPlan::DeviceState | |||
| 95 | return SUCCESS; | 95 | return SUCCESS; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | -Status AbnormalStatusHandler::FindAbnormalDevice(DeployPlan::DeviceStateList &device_state_list, | ||
| 99 | - DeployerConfig information_new, DeployerConfig information_old) const { | ||
| 100 | - auto &node_config_old = information_old.node_config; | ||
| 101 | - auto &node_config_new = information_new.node_config; | ||
| 102 | - if (node_config_old.ipaddr.compare(node_config_new.ipaddr) == 0) { // host对比 | ||
| 103 | - DeployPlan::DeviceInfo device_info = DeployPlan::DeviceInfo(CPU, node_config_old.node_id, 0); | ||
| 104 | - device_state_list.emplace(device_info, true); | ||
| 105 | - GELOGI("AbnormalStatusMonitor, device is normal, node_id=%d, device_id=%u, device_type=%u, ipaddr=%s", | ||
| 106 | - device_info.GetNodeId(), device_info.GetDeviceId(), device_info.GetType(), node_config_old.ipaddr.c_str()); | ||
| 107 | - } else { | ||
| 108 | - DeployPlan::DeviceInfo device_info = DeployPlan::DeviceInfo(CPU, node_config_old.node_id, 0); | ||
| 109 | - device_state_list.emplace(device_info, false); | ||
| 110 | - GEEVENT("AbnormalStatusMonitor, device is abnormal, node_id=%d, device_id=%u, device_type=%u, ipaddr=%s", | ||
| 111 | - device_info.GetNodeId(), device_info.GetDeviceId(), device_info.GetType(), | ||
| 112 | - information_old.node_config.ipaddr.c_str()); | ||
| 113 | - } | ||
| 114 | - for (auto &iter_old : information_old.remote_node_config_list) { // device对比 | ||
| 115 | - bool find_old_in_new = false; | ||
| 116 | - for (auto &iter_new : information_new.remote_node_config_list) { | ||
| 117 | - // 新devices里面找老的device(51上device信息存在node中),找不到说明老的device损坏 | ||
| 118 | - if (iter_old.ipaddr.compare(iter_new.ipaddr) == 0) { | ||
| 119 | - DeployPlan::DeviceInfo device_info0 = DeployPlan::DeviceInfo(NPU, iter_old.node_id, 0); | ||
| 120 | - DeployPlan::DeviceInfo device_info1 = DeployPlan::DeviceInfo(NPU, iter_old.node_id, 1); | ||
| 121 | - device_state_list.emplace(device_info0, true); | ||
| 122 | - device_state_list.emplace(device_info1, true); | ||
| 123 | - GELOGI( | ||
| 124 | - "AbnormalStatusMonitor, device is normal ipaddr=%s, node_id=%d, device_id=%u, device_type=%u," | ||
| 125 | - " node_id=%d, device_id=%u, device_type=%u", | ||
| 126 | - iter_old.ipaddr.c_str(), device_info0.GetNodeId(), device_info0.GetDeviceId(), device_info0.GetType(), | ||
| 127 | - device_info1.GetNodeId(), device_info1.GetDeviceId(), device_info1.GetType()); | ||
| 128 | - find_old_in_new = true; | ||
| 129 | - } | ||
| 130 | - } | ||
| 131 | - if (!find_old_in_new) { // 51上面一个device损坏两个卡都异常 | ||
| 132 | - DeployPlan::DeviceInfo device_info0 = DeployPlan::DeviceInfo(NPU, iter_old.node_id, 0); | ||
| 133 | - DeployPlan::DeviceInfo device_info1 = DeployPlan::DeviceInfo(NPU, iter_old.node_id, 1); | ||
| 134 | - device_state_list.emplace(device_info0, false); | ||
| 135 | - device_state_list.emplace(device_info1, false); | ||
| 136 | - GELOGI( | ||
| 137 | - "AbnormalStatusMonitor, device is abnormal ipaddr=%s, node_id=%d, device_id=%u, device_type=%u," | ||
| 138 | - " node_id=%d, device_id=%u, device_type=%u", | ||
| 139 | - iter_old.ipaddr.c_str(), device_info0.GetNodeId(), device_info0.GetDeviceId(), device_info0.GetType(), | ||
| 140 | - device_info1.GetNodeId(), device_info1.GetDeviceId(), device_info1.GetType()); | ||
| 141 | - } | ||
| 142 | - } | ||
| 143 | - return SUCCESS; | ||
| 144 | -} | ||
| 145 | - | ||
| 146 | Status AbnormalStatusHandler::ParseDeviceStateList(const std::string &file_path, | 98 | Status AbnormalStatusHandler::ParseDeviceStateList(const std::string &file_path, |
| 147 | DeployPlan::DeviceStateList &device_state_list) { | 99 | DeployPlan::DeviceStateList &device_state_list) { |
| 148 | // 解析异常设备信息 | 100 | // 解析异常设备信息 |
| @@ -50,8 +50,6 @@ class AbnormalStatusHandler { | |||
| 50 | void FindOldDevice(DeployPlan::DeviceStateList &device_state_list, NodeConfig node_new, NodeConfig node_old) const; | 50 | void FindOldDevice(DeployPlan::DeviceStateList &device_state_list, NodeConfig node_new, NodeConfig node_old) const; |
| 51 | Status FindAbnormalDeviceOnServer(DeployPlan::DeviceStateList &device_state_list, DeployerConfig information_new, | 51 | Status FindAbnormalDeviceOnServer(DeployPlan::DeviceStateList &device_state_list, DeployerConfig information_new, |
| 52 | DeployerConfig information_old) const; | 52 | DeployerConfig information_old) const; |
| 53 | - Status FindAbnormalDevice(DeployPlan::DeviceStateList &device_state_list, DeployerConfig information_new, | ||
| 54 | - DeployerConfig information_old) const; | ||
| 55 | Status ParseDeviceStateList(const std::string &file_path, DeployPlan::DeviceStateList &device_state_list); | 53 | Status ParseDeviceStateList(const std::string &file_path, DeployPlan::DeviceStateList &device_state_list); |
| 56 | bool IsModelMulInstance(std::map<const std::string, bool> &abnormal_submodel_instances_name, | 54 | bool IsModelMulInstance(std::map<const std::string, bool> &abnormal_submodel_instances_name, |
| 57 | DeployPlan::ModelDeployInfo model_deploy_infos) const; | 55 | DeployPlan::ModelDeployInfo model_deploy_infos) const; |
| @@ -26,7 +26,6 @@ constexpr int32_t kHeartbeatInterval = 5000; // millisconds | |||
| 26 | constexpr int32_t kDataGwPortBase = 16666; | 26 | constexpr int32_t kDataGwPortBase = 16666; |
| 27 | constexpr int32_t kDataGwPortMaxOffset = 256; | 27 | constexpr int32_t kDataGwPortMaxOffset = 256; |
| 28 | constexpr int32_t kHeartbeatTryMaxNum = 10; | 28 | constexpr int32_t kHeartbeatTryMaxNum = 10; |
| 29 | -constexpr int32_t kInvalidRankId = -1; | ||
| 30 | constexpr uint32_t kInitTryWaitInterval = 1000; // millisconds | 29 | constexpr uint32_t kInitTryWaitInterval = 1000; // millisconds |
| 31 | } // namespace | 30 | } // namespace |
| 32 | 31 | ||
| @@ -24,7 +24,6 @@ | |||
| 24 | 24 | ||
| 25 | namespace ge { | 25 | namespace ge { |
| 26 | namespace { | 26 | namespace { |
| 27 | -constexpr int32_t kCoreNumPerDevice = 8; | ||
| 28 | constexpr size_t kMaxSharedContentSize = 1024 * 1024U; | 27 | constexpr size_t kMaxSharedContentSize = 1024 * 1024U; |
| 29 | constexpr size_t kAlignSize = 512U; | 28 | constexpr size_t kAlignSize = 512U; |
| 30 | constexpr size_t kAlignUnit = 2U; | 29 | constexpr size_t kAlignUnit = 2U; |
| @@ -20,7 +20,6 @@ | |||
| 20 | 20 | ||
| 21 | namespace FlowFunc { | 21 | namespace FlowFunc { |
| 22 | namespace { | 22 | namespace { |
| 23 | -const uint64_t kDumpSliceSize = 128UL << 20U; // 分片大小 | ||
| 24 | // DATA_DUMP_GRUOP_ID, EVENT_CCPU_CTRL_MSG, AICPU_SUB_EVENT_REPORT_UDF_DUMPDATA固定,与aicpu保持一致 | 23 | // DATA_DUMP_GRUOP_ID, EVENT_CCPU_CTRL_MSG, AICPU_SUB_EVENT_REPORT_UDF_DUMPDATA固定,与aicpu保持一致 |
| 25 | constexpr uint32_t kDataDumpGroupId = 31U; | 24 | constexpr uint32_t kDataDumpGroupId = 31U; |
| 26 | 25 | ||
| @@ -22,7 +22,6 @@ namespace FlowFunc { | |||
| 22 | namespace { | 22 | namespace { |
| 23 | constexpr char kOsSplitChar = '/'; | 23 | constexpr char kOsSplitChar = '/'; |
| 24 | constexpr uint32_t kDefaultPathMode = 0700; | 24 | constexpr uint32_t kDefaultPathMode = 0700; |
| 25 | -constexpr size_t kMaxErrstrLen = 128U; | ||
| 26 | 25 | ||
| 27 | std::string GetFileDir(const std::string &path) { | 26 | std::string GetFileDir(const std::string &path) { |
| 28 | std::string dir; | 27 | std::string dir; |