已合并
refactor: 移除 FunctionCompile 对 numa 配置的依赖,资源类型改为编译期固定生成 #4424
lining23666创建于 13 天前
refactor: 移除 FunctionCompile 对 numa 配置的依赖,资源类型改为编译期固定生成 #4424
已合并
共 16 个文件变更+26-188
| @@ -33,6 +33,14 @@ class ExecutionRuntime { | |||
| 33 | 33 | ||
| 34 | static void SetExecutionRuntime(const std::shared_ptr<ExecutionRuntime> &instance); | 34 | static void SetExecutionRuntime(const std::shared_ptr<ExecutionRuntime> &instance); |
| 35 | 35 | ||
| 36 | + static bool IsX86() { | ||
| 37 | + | ||
| 38 | + return true; | ||
| 39 | + | ||
| 40 | + return false; | ||
| 41 | + | ||
| 42 | + } | ||
| 43 | + | ||
| 36 | /// Initialize ExecutionRuntime | 44 | /// Initialize ExecutionRuntime |
| 37 | /// @param execution_runtime instance of execution runtime | 45 | /// @param execution_runtime instance of execution runtime |
| 38 | /// @param options options for initialization | 46 | /// @param options options for initialization |
| @@ -17,7 +17,7 @@ | |||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | -#include "common/utils/deploy_location.h" | 20 | +#include "dflow/base/exec_runtime/execution_runtime.h" |
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | 23 | ||
| @@ -128,7 +128,7 @@ static void from_json(const nlohmann::json &j, ItemConfig &item_config) { | |||
| 128 | 128 | ||
| 129 | static void from_json(const nlohmann::json &j, NodeDefConfig &node_def_config) { | 129 | static void from_json(const nlohmann::json &j, NodeDefConfig &node_def_config) { |
| 130 | AssignOptionalField(node_def_config.node_type, kConfigNodeType, j); | 130 | AssignOptionalField(node_def_config.node_type, kConfigNodeType, j); |
| 131 | - auto default_resource_type = DeployLocation::IsX86() ? kResoureTypeX86 : kResoureTypeAarch; | 131 | + auto default_resource_type = ExecutionRuntime::IsX86() ? kResoureTypeX86 : kResoureTypeAarch; |
| 132 | AssignOptionalField(node_def_config.resource_type, kConfigResourceType, j, default_resource_type); | 132 | AssignOptionalField(node_def_config.resource_type, kConfigResourceType, j, default_resource_type); |
| 133 | AssignOptionalField(node_def_config.item_config_list, kConfigItem, j); | 133 | AssignOptionalField(node_def_config.item_config_list, kConfigItem, j); |
| 134 | } | 134 | } |
| @@ -246,7 +246,7 @@ Status ConfigParser::InitNodeResourceType(const std::map<std::string, std::strin | |||
| 246 | const std::map<std::string, std::string> &node_type_to_item_resource_type, | 246 | const std::map<std::string, std::string> &node_type_to_item_resource_type, |
| 247 | NodeConfig &node_config) { | 247 | NodeConfig &node_config) { |
| 248 | const auto &node_it = node_type_to_node_resource_type.find(node_config.node_type); | 248 | const auto &node_it = node_type_to_node_resource_type.find(node_config.node_type); |
| 249 | - node_config.resource_type = DeployLocation::IsX86() ? kResoureTypeX86 : kResoureTypeAarch; | 249 | + node_config.resource_type = ExecutionRuntime::IsX86() ? kResoureTypeX86 : kResoureTypeAarch; |
| 250 | if (node_it != node_type_to_node_resource_type.cend()) { | 250 | if (node_it != node_type_to_node_resource_type.cend()) { |
| 251 | node_config.resource_type = node_it->second; | 251 | node_config.resource_type = node_it->second; |
| 252 | } | 252 | } |
| @@ -1,30 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | - * Copyright (c) 2025 Huawei Technologies Co., Ltd. | ||
| 3 | - * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | - * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | - * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | - * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | - * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | - * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | - */ | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | -namespace ge { | ||
| 15 | -class DeployLocation { | ||
| 16 | - public: | ||
| 17 | - DeployLocation() = delete; | ||
| 18 | - ~DeployLocation() = delete; | ||
| 19 | - | ||
| 20 | - static bool IsX86() { | ||
| 21 | - | ||
| 22 | - return true; | ||
| 23 | - | ||
| 24 | - return false; | ||
| 25 | - | ||
| 26 | - } | ||
| 27 | -}; | ||
| 28 | -} // namespace ge | ||
| 29 | - | ||
| 30 | - | ||
| @@ -11,8 +11,6 @@ | |||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | - | ||
| 15 | - | ||
| 16 | 14 | ||
| 17 | namespace { | 15 | namespace { |
| 18 | // FunctionPpConfig json key | 16 | // FunctionPpConfig json key |
| @@ -476,43 +474,4 @@ void from_json(const nlohmann::json &json_buff, CompileConfigJson::FlowNodeBatch | |||
| 476 | Assign(batch_deploy_info.invoke_deploy_infos, "invoke_list", json_buff); | 474 | Assign(batch_deploy_info.invoke_deploy_infos, "invoke_list", json_buff); |
| 477 | } | 475 | } |
| 478 | } | 476 | } |
| 479 | - | ||
| 480 | -Status CompileConfigJson::GetResourceTypeFromNumaConfig(std::set<std::string> &resource_types) { | ||
| 481 | - auto &global_options_mutex = GetGlobalOptionsMutex(); | ||
| 482 | - const std::lock_guard<std::mutex> lock(global_options_mutex); | ||
| 483 | - auto &global_options = GetMutableGlobalOptions(); | ||
| 484 | - const auto &numa_config_json_string = global_options[OPTION_NUMA_CONFIG]; | ||
| 485 | - GELOGD("Numa config json:%s", numa_config_json_string.c_str()); | ||
| 486 | - try { | ||
| 487 | - const nlohmann::json numa_config_json = nlohmann::json::parse(numa_config_json_string.c_str()); | ||
| 488 | - GE_CHK_BOOL_RET_STATUS(numa_config_json.contains("node_def"), FAILED, | ||
| 489 | - "Failed to get node_def, numa config json:%s.", numa_config_json_string.c_str()); | ||
| 490 | - for (auto &node_def : numa_config_json["node_def"]) { | ||
| 491 | - GE_CHK_BOOL_RET_STATUS(node_def.contains("resource_type"), FAILED, | ||
| 492 | - "Failed to get resource_type, numa config json:%s.", numa_config_json_string.c_str()); | ||
| 493 | - std::string resource_type; | ||
| 494 | - Assign(resource_type, "resource_type", node_def); | ||
| 495 | - GE_CHK_BOOL_RET_STATUS(!resource_type.empty(), FAILED, | ||
| 496 | - "Failed to get resource_type from node_def, numa config json:%s.", | ||
| 497 | - numa_config_json_string.c_str()); | ||
| 498 | - resource_types.insert(resource_type); | ||
| 499 | - } | ||
| 500 | - GE_CHK_BOOL_RET_STATUS(numa_config_json.contains("item_def"), FAILED, | ||
| 501 | - "Failed to get item_def, numa config json:%s.", numa_config_json_string.c_str()); | ||
| 502 | - for (auto &item_def : numa_config_json["item_def"]) { | ||
| 503 | - GE_CHK_BOOL_RET_STATUS(item_def.contains("resource_type"), FAILED, | ||
| 504 | - "Failed to get resource_type, numa config json:%s.", numa_config_json_string.c_str()); | ||
| 505 | - std::string resource_type; | ||
| 506 | - Assign(resource_type, "resource_type", item_def); | ||
| 507 | - GE_CHK_BOOL_RET_STATUS(!resource_type.empty(), FAILED, | ||
| 508 | - "Failed to get resource_type from item_def, numa config json:%s.", | ||
| 509 | - numa_config_json_string.c_str()); | ||
| 510 | - resource_types.insert(resource_type); | ||
| 511 | - } | ||
| 512 | - } catch (const nlohmann::json::exception &e) { | ||
| 513 | - GELOGE(FAILED, "Invalid numa config json string[%s], err msg: %s.", numa_config_json_string.c_str(), e.what()); | ||
| 514 | - return FAILED; | ||
| 515 | - } | ||
| 516 | - return SUCCESS; | ||
| 517 | -} | ||
| 518 | } // namespace ge | 477 | } // namespace ge |
| @@ -20,6 +20,8 @@ | |||
| 20 | 20 | ||
| 21 | namespace ge { | 21 | namespace ge { |
| 22 | constexpr const char *kResourceTypeAscend = "Ascend"; | 22 | constexpr const char *kResourceTypeAscend = "Ascend"; |
| 23 | +constexpr const char *kResourceTypeX86 = "X86"; | ||
| 24 | +constexpr const char *kResourceTypeAarch = "Aarch"; | ||
| 23 | class CompileConfigJson { | 25 | class CompileConfigJson { |
| 24 | public: | 26 | public: |
| 25 | struct FunctionDesc { | 27 | struct FunctionDesc { |
| @@ -103,7 +105,6 @@ class CompileConfigJson { | |||
| 103 | static Status ReadToolchainFromJsonFile(const std::string &file_path, | 105 | static Status ReadToolchainFromJsonFile(const std::string &file_path, |
| 104 | std::map<std::string, std::string> &toolchain_map); | 106 | std::map<std::string, std::string> &toolchain_map); |
| 105 | static Status ReadDeployInfoFromJsonFile(const std::string &file_path, DeployConfigInfo &deploy_conf); | 107 | static Status ReadDeployInfoFromJsonFile(const std::string &file_path, DeployConfigInfo &deploy_conf); |
| 106 | - static Status GetResourceTypeFromNumaConfig(std::set<std::string> &resource_types); | ||
| 107 | 108 | ||
| 108 | private: | 109 | private: |
| 109 | static Status ReadCompileConfigJsonFile(const std::string &file_path, nlohmann::json &json_buff); | 110 | static Status ReadCompileConfigJsonFile(const std::string &file_path, nlohmann::json &json_buff); |
| @@ -14,6 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + | ||
| 17 | 18 | ||
| 18 | 19 | ||
| 19 | 20 | ||
| @@ -164,9 +165,8 @@ Status FunctionCompile::GetToolchainByResourceType(const std::string &resource_t | |||
| 164 | } | 165 | } |
| 165 | 166 | ||
| 166 | Status FunctionCompile::CompileAllResourceType() { | 167 | Status FunctionCompile::CompileAllResourceType() { |
| 167 | - std::set<std::string> resource_types; | 168 | + const std::set<std::string> resource_types = {kResourceTypeAscend, |
| 168 | - GE_CHK_STATUS_RET(CompileConfigJson::GetResourceTypeFromNumaConfig(resource_types), | 169 | + ExecutionRuntime::IsX86() ? kResourceTypeX86 : kResourceTypeAarch}; |
| 169 | - "Failed to get resource types from numa config."); | ||
| 170 | 170 | ||
| 171 | const std::string &workspace = func_pp_cfg_.workspace; | 171 | const std::string &workspace = func_pp_cfg_.workspace; |
| 172 | std::regex workspace_pattern(R"([A-Za-z0-9./+\-_]+)"); | 172 | std::regex workspace_pattern(R"([A-Za-z0-9./+\-_]+)"); |
| @@ -241,9 +241,8 @@ Status FunctionCompile::GetBuiltInFuncCompileResult(CompileResult &compile_resul | |||
| 241 | resource_info.resource_num = kDefaultMemorySize; | 241 | resource_info.resource_num = kDefaultMemorySize; |
| 242 | built_in_func_compile_result.running_resources_info.emplace_back(resource_info); | 242 | built_in_func_compile_result.running_resources_info.emplace_back(resource_info); |
| 243 | // set default runnable resources info | 243 | // set default runnable resources info |
| 244 | - std::set<std::string> resource_types; | 244 | + const std::set<std::string> resource_types = {kResourceTypeAscend, |
| 245 | - GE_CHK_STATUS_RET(CompileConfigJson::GetResourceTypeFromNumaConfig(resource_types), | 245 | + ExecutionRuntime::IsX86() ? kResourceTypeX86 : kResourceTypeAarch}; |
| 246 | - "Failed to get resource types from numa config."); | ||
| 247 | for (const auto &resource_type : resource_types) { | 246 | for (const auto &resource_type : resource_types) { |
| 248 | // the internal udf supports all resource types, and not need to set bin | 247 | // the internal udf supports all resource types, and not need to set bin |
| 249 | built_in_func_compile_result.compile_bin_info[resource_type] = ""; | 248 | built_in_func_compile_result.compile_bin_info[resource_type] = ""; |
| @@ -550,7 +550,7 @@ The final UDF execution location is determined by the compilation-time attribute | |||
| 550 | 550 | ||
| 551 | | Attribute | Meaning | Setting Location | | 551 | | Attribute | Meaning | Setting Location | |
| 552 | |-----------|---------|-----------------| | 552 | |-----------|---------|-----------------| |
| 553 | -| `_dflow_runnable_resource` | Set of resource types UDF successfully compiled to (Ascend/Aarch/x86_64) | `SetCompileResultToNode` in `process_point_loader.cc` | | 553 | +| `_dflow_runnable_resource` | Set of resource types UDF successfully compiled to (Ascend/X86/Aarch) | `SetCompileResultToNode` in `process_point_loader.cc` | |
| 554 | | `_dflow_heavy_load` | Whether heavy-load (heavy-load must be host) | `SetUserFunctionProcessPointAttrs` in `process_point_loader.cc` | | 554 | | `_dflow_heavy_load` | Whether heavy-load (heavy-load must be host) | `SetUserFunctionProcessPointAttrs` in `process_point_loader.cc` | |
| 555 | | `_dflow_final_location` | Final resource type selected by auto deployer | `AutoDeployDataFlowGraph` in `data_flow_graph_auto_deployer.cc` | | 555 | | `_dflow_final_location` | Final resource type selected by auto deployer | `AutoDeployDataFlowGraph` in `data_flow_graph_auto_deployer.cc` | |
| 556 | 556 | ||
| @@ -550,7 +550,7 @@ UDF 的最终执行位置由编译期属性链路决定,核心逻辑在 `DataF | |||
| 550 | 550 | ||
| 551 | | 属性 | 含义 | 设置位置 | | 551 | | 属性 | 含义 | 设置位置 | |
| 552 | |------|------|----------| | 552 | |------|------|----------| |
| 553 | -| `_dflow_runnable_resource` | UDF 成功编译出的资源类型集合(Ascend/Aarch/x86_64) | `process_point_loader.cc` 的 `SetCompileResultToNode` | | 553 | +| `_dflow_runnable_resource` | UDF 成功编译出的资源类型集合(Ascend/X86/Aarch) | `process_point_loader.cc` 的 `SetCompileResultToNode` | |
| 554 | | `_dflow_heavy_load` | 是否重载(重载必须 host) | `process_point_loader.cc` 的 `SetUserFunctionProcessPointAttrs` | | 554 | | `_dflow_heavy_load` | 是否重载(重载必须 host) | `process_point_loader.cc` 的 `SetUserFunctionProcessPointAttrs` | |
| 555 | | `_dflow_final_location` | 自动部署器选定的最终资源类型 | `data_flow_graph_auto_deployer.cc` 的 `AutoDeployDataFlowGraph` | | 555 | | `_dflow_final_location` | 自动部署器选定的最终资源类型 | `data_flow_graph_auto_deployer.cc` 的 `AutoDeployDataFlowGraph` | |
| 556 | 556 | ||
| @@ -15,7 +15,6 @@ | |||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | - | ||
| 19 | 18 | ||
| 20 | 19 | ||
| 21 | 20 | ||
| @@ -148,13 +147,6 @@ ge::dflow::FlowGraph BuildFlowGraph() { | |||
| 148 | cmakefile << "unset(CMAKE_C_COMPILER_FORCED)\n"; | 147 | cmakefile << "unset(CMAKE_C_COMPILER_FORCED)\n"; |
| 149 | cmakefile << "unset(CMAKE_CXX_COMPILER_FORCED)\n"; | 148 | cmakefile << "unset(CMAKE_CXX_COMPILER_FORCED)\n"; |
| 150 | } | 149 | } |
| 151 | - { | ||
| 152 | - auto &global_options_mutex = ge::GetGlobalOptionsMutex(); | ||
| 153 | - const std::lock_guard<std::mutex> lock(global_options_mutex); | ||
| 154 | - auto &global_options = ge::GetMutableGlobalOptions(); | ||
| 155 | - global_options[ge::OPTION_NUMA_CONFIG] = | ||
| 156 | - R"({"cluster":[{"cluster_nodes":[{"is_local":true, "item_list":[{"item_id":0}], "node_id":0, "node_type":"TestNodeType1"}]}],"item_def":[{"aic_type":"[DAVINCI_V100:10]","item_type":"","memory":"[DDR:80GB]","resource_type":"Ascend"}],"node_def":[{"item_type":"","links_mode":"TCP:128Gb","node_type":"TestNodeType1","resource_type":"X86","support_links":"[ROCE]"}]})"; | ||
| 157 | - } | ||
| 158 | auto data0 = ge::dflow::FlowData("Data0", 0); | 150 | auto data0 = ge::dflow::FlowData("Data0", 0); |
| 159 | auto node0 = ge::dflow::FlowNode("node0", 1, 1).SetInput(0, data0); | 151 | auto node0 = ge::dflow::FlowNode("node0", 1, 1).SetInput(0, data0); |
| 160 | // function pp | 152 | // function pp |
| @@ -267,14 +259,6 @@ class UtestDflowApi : public testing::Test { | |||
| 267 | ge::OperatorFactoryImpl::operator_infershape_funcs_->erase("Add"); | 259 | ge::OperatorFactoryImpl::operator_infershape_funcs_->erase("Add"); |
| 268 | ge::OperatorFactoryImpl::operator_infershape_funcs_->erase("NetOutput"); | 260 | ge::OperatorFactoryImpl::operator_infershape_funcs_->erase("NetOutput"); |
| 269 | EXPECT_EQ(DFlowFinalize(), SUCCESS); | 261 | EXPECT_EQ(DFlowFinalize(), SUCCESS); |
| 270 | - { | ||
| 271 | - auto &global_options_mutex = ge::GetGlobalOptionsMutex(); | ||
| 272 | - const std::lock_guard<std::mutex> lock(global_options_mutex); | ||
| 273 | - auto &global_options = ge::GetMutableGlobalOptions(); | ||
| 274 | - if (global_options.find(ge::OPTION_NUMA_CONFIG) == global_options.end()) { | ||
| 275 | - global_options.erase(ge::OPTION_NUMA_CONFIG); | ||
| 276 | - } | ||
| 277 | - } | ||
| 278 | ge::ExecutionRuntime::SetExecutionRuntime(nullptr); | 262 | ge::ExecutionRuntime::SetExecutionRuntime(nullptr); |
| 279 | ge::OpsKernelBuilderRegistry::GetInstance().UnregisterAll(); | 263 | ge::OpsKernelBuilderRegistry::GetInstance().UnregisterAll(); |
| 280 | } | 264 | } |
| @@ -29,7 +29,6 @@ | |||
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | - | ||
| 33 | 32 | ||
| 34 | 33 | ||
| 35 | 34 | ||
| @@ -214,13 +213,6 @@ ge::dflow::FlowGraph BuildFlowGraph() { | |||
| 214 | cmakefile << "unset(CMAKE_C_COMPILER_FORCED)\n"; | 213 | cmakefile << "unset(CMAKE_C_COMPILER_FORCED)\n"; |
| 215 | cmakefile << "unset(CMAKE_CXX_COMPILER_FORCED)\n"; | 214 | cmakefile << "unset(CMAKE_CXX_COMPILER_FORCED)\n"; |
| 216 | } | 215 | } |
| 217 | - { | ||
| 218 | - auto &global_options_mutex = ge::GetGlobalOptionsMutex(); | ||
| 219 | - const std::lock_guard<std::mutex> lock(global_options_mutex); | ||
| 220 | - auto &global_options = ge::GetMutableGlobalOptions(); | ||
| 221 | - global_options[ge::OPTION_NUMA_CONFIG] = | ||
| 222 | - R"({"cluster":[{"cluster_nodes":[{"is_local":true, "item_list":[{"item_id":0}], "node_id":0, "node_type":"TestNodeType1"}]}],"item_def":[{"aic_type":"[DAVINCI_V100:10]","item_type":"","memory":"[DDR:80GB]","resource_type":"Ascend"}],"node_def":[{"item_type":"","links_mode":"TCP:128Gb","node_type":"TestNodeType1","resource_type":"X86","support_links":"[ROCE]"}]})"; | ||
| 223 | - } | ||
| 224 | auto data0 = ge::dflow::FlowData("Data0", 0); | 216 | auto data0 = ge::dflow::FlowData("Data0", 0); |
| 225 | auto node0 = ge::dflow::FlowNode("node0", 1, 1).SetInput(0, data0); | 217 | auto node0 = ge::dflow::FlowNode("node0", 1, 1).SetInput(0, data0); |
| 226 | // function pp | 218 | // function pp |
| @@ -12,8 +12,6 @@ | |||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | - | ||
| 16 | - | ||
| 17 | 15 | ||
| 18 | using namespace testing; | 16 | using namespace testing; |
| 19 | namespace ge { | 17 | namespace ge { |
| @@ -429,15 +427,4 @@ TEST_F(CompileConfigJsonTest, ReadGraphPpConfigFromJsonFile_InvalidFormat) { | |||
| 429 | EXPECT_EQ(CompileConfigJson::ReadGraphPpConfigFromJsonFile("./graph_pp_config.json", graph_pp_cfg), FAILED); | 427 | EXPECT_EQ(CompileConfigJson::ReadGraphPpConfigFromJsonFile("./graph_pp_config.json", graph_pp_cfg), FAILED); |
| 430 | remove("./graph_pp_config.json"); | 428 | remove("./graph_pp_config.json"); |
| 431 | } | 429 | } |
| 432 | - | ||
| 433 | -TEST_F(CompileConfigJsonTest, GetResourceTypeFromNumaConfig_Failed) { | ||
| 434 | - { | ||
| 435 | - auto &global_options_mutex = GetGlobalOptionsMutex(); | ||
| 436 | - const std::lock_guard<std::mutex> lock(global_options_mutex); | ||
| 437 | - auto &global_options = GetMutableGlobalOptions(); | ||
| 438 | - global_options[OPTION_NUMA_CONFIG] = "xxxxx"; | ||
| 439 | - } | ||
| 440 | - std::set<std::string> resource_types; | ||
| 441 | - EXPECT_EQ(CompileConfigJson::GetResourceTypeFromNumaConfig(resource_types), FAILED); | ||
| 442 | -} | ||
| 443 | } // namespace ge | 430 | } // namespace ge |
| @@ -19,8 +19,6 @@ | |||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | - | ||
| 23 | - | ||
| 24 | 22 | ||
| 25 | using namespace testing; | 23 | using namespace testing; |
| 26 | namespace ge { | 24 | namespace ge { |
| @@ -48,15 +46,7 @@ class DataFlowGraphTest : public Test { | |||
| 48 | std::string cmd = "rm -rf temp"; | 46 | std::string cmd = "rm -rf temp"; |
| 49 | (void)system(cmd.c_str()); | 47 | (void)system(cmd.c_str()); |
| 50 | } | 48 | } |
| 51 | - void SetUp() override { | 49 | + void SetUp() override {} |
| 52 | - { | ||
| 53 | - auto &global_options_mutex = GetGlobalOptionsMutex(); | ||
| 54 | - const std::lock_guard<std::mutex> lock(global_options_mutex); | ||
| 55 | - auto &global_options = GetMutableGlobalOptions(); | ||
| 56 | - global_options[OPTION_NUMA_CONFIG] = | ||
| 57 | - R"({"cluster":[{"cluster_nodes":[{"is_local":true, "item_list":[{"item_id":0}], "node_id":0, "node_type":"TestNodeType1"}]}],"item_def":[{"aic_type":"[DAVINCI_V100:10]","item_type":"","memory":"[DDR:80GB]","resource_type":"Ascend"}],"node_def":[{"item_type":"","links_mode":"TCP:128Gb","node_type":"TestNodeType1","resource_type":"X86","support_links":"[ROCE]"}]})"; | ||
| 58 | - } | ||
| 59 | - } | ||
| 60 | void TearDown() override {} | 50 | void TearDown() override {} |
| 61 | }; | 51 | }; |
| 62 | 52 | ||
| @@ -14,8 +14,6 @@ | |||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | - | ||
| 18 | - | ||
| 19 | 17 | ||
| 20 | using namespace testing; | 18 | using namespace testing; |
| 21 | namespace ge { | 19 | namespace ge { |
| @@ -41,13 +39,6 @@ class FunctionCompileTest : public Test { | |||
| 41 | cmakefile << "message(FATAL_ERROR \"error\")\n"; | 39 | cmakefile << "message(FATAL_ERROR \"error\")\n"; |
| 42 | cmakefile << "endif()\n"; | 40 | cmakefile << "endif()\n"; |
| 43 | } | 41 | } |
| 44 | - { | ||
| 45 | - auto &global_options_mutex = GetGlobalOptionsMutex(); | ||
| 46 | - const std::lock_guard<std::mutex> lock(global_options_mutex); | ||
| 47 | - auto &global_options = GetMutableGlobalOptions(); | ||
| 48 | - global_options[OPTION_NUMA_CONFIG] = | ||
| 49 | - R"({"cluster":[{"cluster_nodes":[{"is_local":true, "item_list":[{"item_id":0}], "node_id":0, "node_type":"TestNodeType1"}]}],"item_def":[{"aic_type":"[DAVINCI_V100:10]","item_type":"","memory":"[DDR:80GB]","resource_type":"Ascend"}],"node_def":[{"item_type":"","links_mode":"TCP:128Gb","node_type":"TestNodeType1","resource_type":"X86","support_links":"[ROCE]"}]})"; | ||
| 50 | - } | ||
| 51 | } | 42 | } |
| 52 | 43 | ||
| 53 | void TearDown() { | 44 | void TearDown() { |
| @@ -18,7 +18,6 @@ | |||
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | - | ||
| 22 | 21 | ||
| 23 | 22 | ||
| 24 | using namespace testing; | 23 | using namespace testing; |
| @@ -115,22 +114,9 @@ class InnerPpLoaderTest : public Test { | |||
| 115 | protected: | 114 | protected: |
| 116 | static void SetUpTestSuite() { | 115 | static void SetUpTestSuite() { |
| 117 | PrepareForUdf(); | 116 | PrepareForUdf(); |
| 118 | - { | ||
| 119 | - auto &global_options_mutex = GetGlobalOptionsMutex(); | ||
| 120 | - const std::lock_guard<std::mutex> lock(global_options_mutex); | ||
| 121 | - auto &global_options = GetMutableGlobalOptions(); | ||
| 122 | - global_options[OPTION_NUMA_CONFIG] = | ||
| 123 | - R"({"cluster":[{"cluster_nodes":[{"is_local":true, "item_list":[{"item_id":0}], "node_id":0, "node_type":"TestNodeType1"}]}],"item_def":[{"aic_type":"[DAVINCI_V100:10]","item_type":"","memory":"[DDR:80GB]","resource_type":"Ascend"}],"node_def":[{"item_type":"","links_mode":"TCP:128Gb","node_type":"TestNodeType1","resource_type":"X86","support_links":"[ROCE]"}]})"; | ||
| 124 | - } | ||
| 125 | } | 117 | } |
| 126 | static void TearDownTestSuite() { | 118 | static void TearDownTestSuite() { |
| 127 | system("rm -fr model_pp_udf"); | 119 | system("rm -fr model_pp_udf"); |
| 128 | - { | ||
| 129 | - auto &global_options_mutex = GetGlobalOptionsMutex(); | ||
| 130 | - const std::lock_guard<std::mutex> lock(global_options_mutex); | ||
| 131 | - auto &global_options = GetMutableGlobalOptions(); | ||
| 132 | - global_options[OPTION_NUMA_CONFIG] = ""; | ||
| 133 | - } | ||
| 134 | } | 120 | } |
| 135 | void SetUp() {} | 121 | void SetUp() {} |
| 136 | void TearDown() {} | 122 | void TearDown() {} |
| @@ -28,7 +28,6 @@ | |||
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | - | ||
| 32 | 31 | ||
| 33 | 32 | ||
| 34 | 33 | ||
| @@ -442,13 +441,6 @@ TEST_F(FlowModelBuilderTest, FlowModelBuild) { | |||
| 442 | } | 441 | } |
| 443 | 442 | ||
| 444 | TEST_F(FlowModelBuilderTest, BuildModel_DataFlowGraph_SUCCESS) { | 443 | TEST_F(FlowModelBuilderTest, BuildModel_DataFlowGraph_SUCCESS) { |
| 445 | - { | ||
| 446 | - auto &global_options_mutex = GetGlobalOptionsMutex(); | ||
| 447 | - const std::lock_guard<std::mutex> lock(global_options_mutex); | ||
| 448 | - auto &global_options = GetMutableGlobalOptions(); | ||
| 449 | - global_options[OPTION_NUMA_CONFIG] = | ||
| 450 | - R"({"cluster":[{"cluster_nodes":[{"is_local":true, "item_list":[{"item_id":0}], "node_id":0, "node_type":"TestNodeType1"}]}],"item_def":[{"aic_type":"[DAVINCI_V100:10]","item_type":"","memory":"[DDR:80GB]","resource_type":"Ascend"}],"node_def":[{"item_type":"","links_mode":"TCP:128Gb","node_type":"TestNodeType1","resource_type":"X86","support_links":"[ROCE]"}]})"; | ||
| 451 | - } | ||
| 452 | DEF_GRAPH(flow_graph) { | 444 | DEF_GRAPH(flow_graph) { |
| 453 | auto data0 = OP_CFG("Data").InCnt(1).OutCnt(1).Attr(ATTR_NAME_INDEX, 0).TensorDesc(FORMAT_ND, DT_INT32, {1, 2, 3}); | 445 | auto data0 = OP_CFG("Data").InCnt(1).OutCnt(1).Attr(ATTR_NAME_INDEX, 0).TensorDesc(FORMAT_ND, DT_INT32, {1, 2, 3}); |
| 454 | auto data1 = OP_CFG("Data").InCnt(1).OutCnt(1).Attr(ATTR_NAME_INDEX, 0).TensorDesc(FORMAT_ND, DT_INT32, {1, 2, 3}); | 446 | auto data1 = OP_CFG("Data").InCnt(1).OutCnt(1).Attr(ATTR_NAME_INDEX, 0).TensorDesc(FORMAT_ND, DT_INT32, {1, 2, 3}); |
| @@ -660,13 +652,6 @@ TEST_F(FlowModelBuilderTest, BuildModel_DataFlowGraph_SUCCESS) { | |||
| 660 | } | 652 | } |
| 661 | 653 | ||
| 662 | TEST_F(FlowModelBuilderTest, BuildModel_DataFlowGraph_FAILED) { | 654 | TEST_F(FlowModelBuilderTest, BuildModel_DataFlowGraph_FAILED) { |
| 663 | - { | ||
| 664 | - auto &global_options_mutex = GetGlobalOptionsMutex(); | ||
| 665 | - const std::lock_guard<std::mutex> lock(global_options_mutex); | ||
| 666 | - auto &global_options = GetMutableGlobalOptions(); | ||
| 667 | - global_options[OPTION_NUMA_CONFIG] = | ||
| 668 | - R"({"cluster":[{"cluster_nodes":[{"is_local":true, "item_list":[{"item_id":0}], "node_id":0, "node_type":"TestNodeType1"}]}],"item_def":[{"aic_type":"[DAVINCI_V100:10]","item_type":"","memory":"[DDR:80GB]","resource_type":"Ascend"}],"node_def":[{"item_type":"","links_mode":"TCP:128Gb","node_type":"TestNodeType1","resource_type":"X86","support_links":"[ROCE]"}]})"; | ||
| 669 | - } | ||
| 670 | DEF_GRAPH(flow_graph) { | 655 | DEF_GRAPH(flow_graph) { |
| 671 | auto data0 = OP_CFG("Data").InCnt(1).OutCnt(1).Attr(ATTR_NAME_INDEX, 0).TensorDesc(FORMAT_ND, DT_INT32, {1, 2, 3}); | 656 | auto data0 = OP_CFG("Data").InCnt(1).OutCnt(1).Attr(ATTR_NAME_INDEX, 0).TensorDesc(FORMAT_ND, DT_INT32, {1, 2, 3}); |
| 672 | auto node0 = OP_CFG("FlowNode").InCnt(1).OutCnt(1).TensorDesc(FORMAT_ND, DT_INT32, {1, 2, 3}); | 657 | auto node0 = OP_CFG("FlowNode").InCnt(1).OutCnt(1).TensorDesc(FORMAT_ND, DT_INT32, {1, 2, 3}); |
| @@ -784,13 +769,6 @@ TEST_F(FlowModelBuilderTest, BuildModel_DataFlowGraph_FAILED) { | |||
| 784 | } | 769 | } |
| 785 | 770 | ||
| 786 | TEST_F(FlowModelBuilderTest, BuildModel_Invoke_modelpp_SUCCESS) { | 771 | TEST_F(FlowModelBuilderTest, BuildModel_Invoke_modelpp_SUCCESS) { |
| 787 | - { | ||
| 788 | - auto &global_options_mutex = GetGlobalOptionsMutex(); | ||
| 789 | - const std::lock_guard<std::mutex> lock(global_options_mutex); | ||
| 790 | - auto &global_options = GetMutableGlobalOptions(); | ||
| 791 | - global_options[OPTION_NUMA_CONFIG] = | ||
| 792 | - R"({"cluster":[{"cluster_nodes":[{"is_local":true, "item_list":[{"item_id":0}], "node_id":0, "node_type":"TestNodeType1"}]}],"item_def":[{"aic_type":"[DAVINCI_V100:10]","item_type":"","memory":"[DDR:80GB]","resource_type":"Ascend"}],"node_def":[{"item_type":"","links_mode":"TCP:128Gb","node_type":"TestNodeType1","resource_type":"X86","support_links":"[ROCE]"}]})"; | ||
| 793 | - } | ||
| 794 | constexpr const char *compiler_config = "./temp/compiler_config.json"; | 772 | constexpr const char *compiler_config = "./temp/compiler_config.json"; |
| 795 | { | 773 | { |
| 796 | nlohmann::json cpu_compiler_json = { | 774 | nlohmann::json cpu_compiler_json = { |
| @@ -933,13 +911,6 @@ TEST_F(FlowModelBuilderTest, MakeInputTensors_by_inputshape_range_success) { | |||
| 933 | } | 911 | } |
| 934 | 912 | ||
| 935 | TEST_F(FlowModelBuilderTest, BuildModel_Failed) { | 913 | TEST_F(FlowModelBuilderTest, BuildModel_Failed) { |
| 936 | - { | ||
| 937 | - auto &global_options_mutex = GetGlobalOptionsMutex(); | ||
| 938 | - const std::lock_guard<std::mutex> lock(global_options_mutex); | ||
| 939 | - auto &global_options = GetMutableGlobalOptions(); | ||
| 940 | - global_options[OPTION_NUMA_CONFIG] = | ||
| 941 | - R"({"cluster":[{"cluster_nodes":[{"is_local":true, "item_list":[{"item_id":0}], "node_id":0, "node_type":"TestNodeType1"}]}],"item_def":[{"aic_type":"[DAVINCI_V100:10]","item_type":"","memory":"[DDR:80GB]","resource_type":"Ascend"}],"node_def":[{"item_type":"","links_mode":"TCP:128Gb","node_type":"TestNodeType1","resource_type":"X86","support_links":"[ROCE]"}]})"; | ||
| 942 | - } | ||
| 943 | class MockMmpaOpen : public MockMmpa { | 914 | class MockMmpaOpen : public MockMmpa { |
| 944 | public: | 915 | public: |
| 945 | MOCK_METHOD(INT32, Open2, (const CHAR *path_name, INT32 flags, MODE mode)); | 916 | MOCK_METHOD(INT32, Open2, (const CHAR *path_name, INT32 flags, MODE mode)); |
| @@ -20,7 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | -#include "dflow/deployer/common/utils/deploy_location.h" | 23 | +#include "dflow/base/exec_runtime/execution_runtime.h" |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | using namespace std; | 26 | using namespace std; |
| @@ -58,10 +58,10 @@ TEST_F(UtConfigParser, parse_server_info_success) { | |||
| 58 | ASSERT_EQ(information.remote_node_config_list.size(), 0); | 58 | ASSERT_EQ(information.remote_node_config_list.size(), 0); |
| 59 | ASSERT_EQ(information.node_config.device_list.size(), 9); | 59 | ASSERT_EQ(information.node_config.device_list.size(), 9); |
| 60 | ASSERT_EQ(information.node_config.node_type, "TestNodeType1"); | 60 | ASSERT_EQ(information.node_config.node_type, "TestNodeType1"); |
| 61 | - ASSERT_EQ(information.node_config.resource_type, DeployLocation::IsX86() ? "X86" : "Aarch"); | 61 | + ASSERT_EQ(information.node_config.resource_type, ExecutionRuntime::IsX86() ? "X86" : "Aarch"); |
| 62 | for (const auto &device_config : information.node_config.device_list) { | 62 | for (const auto &device_config : information.node_config.device_list) { |
| 63 | if (device_config.device_type == CPU) { | 63 | if (device_config.device_type == CPU) { |
| 64 | - ASSERT_EQ(device_config.resource_type, DeployLocation::IsX86() ? "X86" : "Aarch"); | 64 | + ASSERT_EQ(device_config.resource_type, ExecutionRuntime::IsX86() ? "X86" : "Aarch"); |
| 65 | } else { | 65 | } else { |
| 66 | ASSERT_EQ(device_config.resource_type, "Ascend"); | 66 | ASSERT_EQ(device_config.resource_type, "Ascend"); |
| 67 | } | 67 | } |
| @@ -88,10 +88,10 @@ TEST_F(UtConfigParser, parse_config_without_resource_success) { | |||
| 88 | ASSERT_EQ(information.remote_node_config_list.size(), 1); | 88 | ASSERT_EQ(information.remote_node_config_list.size(), 1); |
| 89 | ASSERT_EQ(information.node_config.device_list.size(), 3); | 89 | ASSERT_EQ(information.node_config.device_list.size(), 3); |
| 90 | ASSERT_EQ(information.node_config.node_type, "TestNodeType1"); | 90 | ASSERT_EQ(information.node_config.node_type, "TestNodeType1"); |
| 91 | - ASSERT_EQ(information.node_config.resource_type, DeployLocation::IsX86() ? "X86" : "Aarch"); | 91 | + ASSERT_EQ(information.node_config.resource_type, ExecutionRuntime::IsX86() ? "X86" : "Aarch"); |
| 92 | for (const auto &device_config : information.node_config.device_list) { | 92 | for (const auto &device_config : information.node_config.device_list) { |
| 93 | if (device_config.device_type == CPU) { | 93 | if (device_config.device_type == CPU) { |
| 94 | - ASSERT_EQ(device_config.resource_type, DeployLocation::IsX86() ? "X86" : "Aarch"); | 94 | + ASSERT_EQ(device_config.resource_type, ExecutionRuntime::IsX86() ? "X86" : "Aarch"); |
| 95 | } else { | 95 | } else { |
| 96 | ASSERT_EQ(device_config.resource_type, "Ascend"); | 96 | ASSERT_EQ(device_config.resource_type, "Ascend"); |
| 97 | } | 97 | } |