已合并
refactor: 清理 dflow 中废弃函数和未使用常量 #3891
lining23666创建于 7月6日
refactor: 清理 dflow 中废弃函数和未使用常量 #3891
已合并
lining23666创建于 7月6日
14 个文件变更+0-105
Mdflow/base/model/flow_model_om_saver.cc+0-7
@@ -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- 
326Status FlowModelOmSaver::AddPartition(const google::protobuf::Message &partition_msg,319Status 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());
Mdflow/base/model/flow_model_om_saver.h+0-1
@@ -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.
Mdflow/compiler/model/flow_model_cache.cc+0-36
@@ -45,7 +45,6 @@ constexpr const char *kSuspendGraphOriginalName = "_suspend_graph_original_name"
45constexpr const char *kAttrNameDataFlowCompilerResult = "_dflow_compiler_result";45constexpr const char *kAttrNameDataFlowCompilerResult = "_dflow_compiler_result";
46constexpr const char *kAttrNameDataFlowRunningResourceInfo = "_dflow_running_resource_info";46constexpr const char *kAttrNameDataFlowRunningResourceInfo = "_dflow_running_resource_info";
47constexpr const char *kAttrNameDataFlowRunnableResource = "_dflow_runnable_resource";47constexpr const char *kAttrNameDataFlowRunnableResource = "_dflow_runnable_resource";
48-constexpr size_t kMaxUpdateCacheThreadPoolSize = 8U;
49 48 
50Status TryLockFile(const std::string &lock_file, int32_t &fd) {49Status 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- 
340Status FlowModelCache::TryLoadFlowModelFromCache(const ComputeGraphPtr &root_graph, FlowModelPtr &flow_model) {304Status 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.");
Mdflow/compiler/model/flow_model_cache.h+0-1
@@ -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_;
Mdflow/compiler/pne/udf/udf_model_builder.cc+0-1
@@ -41,7 +41,6 @@ const std::string kUdfAttrNameReleaseLib = "_dflow_process_point_release_pkg";
41const std::string kUdfAttrNameFinalLocation = "_dflow_final_location";41const std::string kUdfAttrNameFinalLocation = "_dflow_final_location";
42const std::set<std::string> kUdfBaseAttrNames = {kUdfAttrNameBinPath, kUdfAttrNameFuncName, kUdfAttrNameProcessorType,42const std::set<std::string> kUdfBaseAttrNames = {kUdfAttrNameBinPath, kUdfAttrNameFuncName, kUdfAttrNameProcessorType,
43 kUdfAttrNameOsVersion};43 kUdfAttrNameOsVersion};
44-const std::string kUdfOpTypeFlowFunc = "FlowFunc";
45const std::string kUdfBuildInBinName = "libbuilt_in_flowfunc.so";44const std::string kUdfBuildInBinName = "libbuilt_in_flowfunc.so";
46const std::string kUdfBuildInFuncNamePrefix = "_BuiltIn_";45const std::string kUdfBuildInFuncNamePrefix = "_BuiltIn_";
47constexpr const char *kAttrNameDataFlowHeavyLoad = "_dflow_heavy_load";46constexpr const char *kAttrNameDataFlowHeavyLoad = "_dflow_heavy_load";
Mdflow/deployer/common/config/configurations.cc+0-2
@@ -20,8 +20,6 @@
20 20 
21namespace ge {21namespace ge {
22namespace {22namespace {
23-const char_t *const kConfigFileName = "/resource.json";
24-const char_t *const kHelperResFilePath = "HELPER_RES_FILE_PATH";
25const char_t *const kResourceConfigPath = "RESOURCE_CONFIG_PATH";23const char_t *const kResourceConfigPath = "RESOURCE_CONFIG_PATH";
26const char_t *const kHomeEnvName = "HOME";24const char_t *const kHomeEnvName = "HOME";
27} // namespace25} // namespace
Mdflow/deployer/common/data_flow/queue/heterogeneous_exchange_service.cc+0-2
@@ -31,10 +31,8 @@
31namespace ge {31namespace ge {
32namespace {32namespace {
33constexpr int32_t kQueueOpTimeout = 10 * 60 * 1000; // 10 min33constexpr int32_t kQueueOpTimeout = 10 * 60 * 1000; // 10 min
34-constexpr uint32_t kBufferCount = 1U;
35constexpr size_t kContextLen = 0U;34constexpr size_t kContextLen = 0U;
36constexpr size_t kAlignmentVal64 = 64U;35constexpr size_t kAlignmentVal64 = 64U;
37-constexpr uint32_t kMbufHeadMaxSize = 256U;
38constexpr uint32_t kMbufHeadEndOfSequencePos = 128U;36constexpr uint32_t kMbufHeadEndOfSequencePos = 128U;
39constexpr uint8_t kEndOfSequenceFlag = 0x5A;37constexpr uint8_t kEndOfSequenceFlag = 0x5A;
40constexpr uint32_t kEventGroupId = 3U;38constexpr uint32_t kEventGroupId = 3U;
Mdflow/deployer/common/mem_grp/memory_group_manager.cc+0-1
@@ -22,7 +22,6 @@
22namespace ge {22namespace ge {
23namespace {23namespace {
24constexpr int32_t kTimeout = 3000;24constexpr int32_t kTimeout = 3000;
25-constexpr uint64_t kNpuMaxGroupMemSize = 35337011UL; // 33.7 * 1024 * 1024 KB
26constexpr uint64_t kDefaultRemoteGroupCacheAllocSize = 10 * 1024 * 1024UL; // 10 * 1024 * 1024 KB25constexpr uint64_t kDefaultRemoteGroupCacheAllocSize = 10 * 1024 * 1024UL; // 10 * 1024 * 1024 KB
27constexpr uint32_t kAddGroupTimeout = 10000;26constexpr uint32_t kAddGroupTimeout = 10000;
28} // namespace27} // namespace
Mdflow/deployer/deploy/abnormal_status_handler/abnormal_status_handler.cc+0-48
@@ -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- 
146Status AbnormalStatusHandler::ParseDeviceStateList(const std::string &file_path,98Status AbnormalStatusHandler::ParseDeviceStateList(const std::string &file_path,
147 DeployPlan::DeviceStateList &device_state_list) {99 DeployPlan::DeviceStateList &device_state_list) {
148 // 解析异常设备信息100 // 解析异常设备信息
Mdflow/deployer/deploy/abnormal_status_handler/abnormal_status_handler.h+0-2
@@ -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;
Mdflow/deployer/deploy/deployer/deployer.cc+0-1
@@ -26,7 +26,6 @@ constexpr int32_t kHeartbeatInterval = 5000; // millisconds
26constexpr int32_t kDataGwPortBase = 16666;26constexpr int32_t kDataGwPortBase = 16666;
27constexpr int32_t kDataGwPortMaxOffset = 256;27constexpr int32_t kDataGwPortMaxOffset = 256;
28constexpr int32_t kHeartbeatTryMaxNum = 10;28constexpr int32_t kHeartbeatTryMaxNum = 10;
29-constexpr int32_t kInvalidRankId = -1;
30constexpr uint32_t kInitTryWaitInterval = 1000; // millisconds29constexpr uint32_t kInitTryWaitInterval = 1000; // millisconds
31} // namespace30} // namespace
32 31 
Mdflow/deployer/deploy/deployer/deployer_var_manager.cc+0-1
@@ -24,7 +24,6 @@
24 24 
25namespace ge {25namespace ge {
26namespace {26namespace {
27-constexpr int32_t kCoreNumPerDevice = 8;
28constexpr size_t kMaxSharedContentSize = 1024 * 1024U;27constexpr size_t kMaxSharedContentSize = 1024 * 1024U;
29constexpr size_t kAlignSize = 512U;28constexpr size_t kAlignSize = 512U;
30constexpr size_t kAlignUnit = 2U;29constexpr size_t kAlignUnit = 2U;
Mdflow/udf/toolchain/dump/udf_dump_task_device.cpp+0-1
@@ -20,7 +20,6 @@
20 20 
21namespace FlowFunc {21namespace FlowFunc {
22namespace {22namespace {
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保持一致
25constexpr uint32_t kDataDumpGroupId = 31U;24constexpr uint32_t kDataDumpGroupId = 31U;
26#define EVENT_CCPU_CTRL_MSG 1925#define EVENT_CCPU_CTRL_MSG 19
Mdflow/udf/toolchain/dump/udf_dump_task_host.cpp+0-1
@@ -22,7 +22,6 @@ namespace FlowFunc {
22namespace {22namespace {
23constexpr char kOsSplitChar = '/';23constexpr char kOsSplitChar = '/';
24constexpr uint32_t kDefaultPathMode = 0700;24constexpr uint32_t kDefaultPathMode = 0700;
25-constexpr size_t kMaxErrstrLen = 128U;
26 25 
27std::string GetFileDir(const std::string &path) {26std::string GetFileDir(const std::string &path) {
28 std::string dir;27 std::string dir;