diff --git a/CMakeLists.txt b/CMakeLists.txt index 41520b14..e3cc1e32 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,6 @@ else () #find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) else() find_module(slog libalog.so ${ASCEND_ATC_DIR}) - find_module(opt_feature libopt_feature.so ${ASCEND_ATC_DIR}) find_module(static_mmpa libmmpa.a ${ASCEND_ATC_DIR}) if(PLATFORM STREQUAL "train") find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR}) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 5db2e7a9..2b9122da 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -434,7 +434,6 @@ set(TRAIN_SRC_LIST "graph/build/memory/max_block_mem_assigner.cc" "graph/build/memory/var_mem_assign_util.cc" "graph/build/memory/buffer_pool_mem_assigner.cc" - "ge_opt_info/ge_opt_info.cc" ) set(INFER_SRC_LIST @@ -712,7 +711,6 @@ set(INFER_SRC_LIST "graph/build/memory/max_block_mem_assigner.cc" "graph/build/memory/var_mem_assign_util.cc" "graph/build/memory/buffer_pool_mem_assigner.cc" - "ge_opt_info/ge_opt_info.cc" ) if (NOT ENABLE_D AND NOT ENABLE_ACL AND NOT ENABLE_MS_TESTCASES) @@ -767,13 +765,11 @@ target_include_directories(ge_runner SYSTEM PRIVATE ${GE_CODE_DIR}/../inc ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external - ${GE_CODE_DIR}/../abl/licctrl #### blue zone ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include ${GE_CODE_DIR}/third_party/fwkacllib/inc ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain - ${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info ) target_link_options(ge_runner PRIVATE @@ -796,7 +792,6 @@ target_link_libraries(ge_runner PRIVATE runtime error_manager ascend_hal_stub - opt_feature -Wl,--as-needed json -lrt @@ -844,13 +839,11 @@ target_include_directories(ge_compiler SYSTEM PRIVATE ${GE_CODE_DIR}/../inc ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external - ${GE_CODE_DIR}/../abl/licctrl #### blue zone #### ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include ${GE_CODE_DIR}/third_party/fwkacllib/inc ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain - ${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info ) target_link_options(ge_compiler PRIVATE @@ -870,7 +863,6 @@ target_link_libraries(ge_compiler PRIVATE error_manager slog runtime_compile - opt_feature -Wl,--as-needed json -lrt diff --git a/ge/ge_opt_info/ge_opt_info.cc b/ge/ge_opt_info/ge_opt_info.cc deleted file mode 100644 index 8c1b84ab..00000000 --- a/ge/ge_opt_info/ge_opt_info.cc +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ge_opt_info/ge_opt_info.h" - -#include -#include -#include "graph/ge_local_context.h" -#include "ge/ge_api_types.h" -#include "common/debug/ge_log.h" -#include "opt_info.h" - -namespace ge { -Status GeOptInfo::SetOptInfo() { - std::string soc_ver; - graphStatus ret = GetThreadLocalContext().GetOption(SOC_VERSION, soc_ver); - if (ret != GRAPH_SUCCESS) { - REPORT_CALL_ERROR("E19999", "Get soc version failed."); - GELOGE(FAILED, "[Get][SocVersion]Get soc version failed."); - return FAILED; - } - GELOGD("Soc version:%s.", soc_ver.c_str()); - std::map opt_info; - // the first arg does not work at present. - if (gelc::GetOptInfo(gelc::kOffline, soc_ver, opt_info) != gelc::SUCCESS) { - REPORT_CALL_ERROR("E19999", "Get optional information failed, is_offline:%d, soc version:%s", - gelc::kOffline, soc_ver.c_str()); - GELOGE(FAILED, "[Get][OptInfo]Get optional information failed, is_offline:%d, soc version:%s", - gelc::kOffline, soc_ver.c_str()); - return FAILED; - } - // do nothing if get empty information - if (opt_info.empty()) { - GELOGI("Optional information is empty."); - return SUCCESS; - } - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - for (const auto &itr : opt_info) { - graph_options.emplace(itr.first, itr.second); - GELOGI("Get optional information success, key:%s, value:%s.", itr.first.c_str(), itr.second.c_str()); - } - GetThreadLocalContext().SetGraphOption(graph_options); - return SUCCESS; -} -} // namespace ge diff --git a/ge/ge_opt_info/ge_opt_info.h b/ge/ge_opt_info/ge_opt_info.h deleted file mode 100644 index 935dff25..00000000 --- a/ge/ge_opt_info/ge_opt_info.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef GE_OPT_INFO_GE_OPT_INFO_H_ -#define GE_OPT_INFO_GE_OPT_INFO_H_ - -#include "ge/ge_api_error_codes.h" -#include "register/register_types.h" - -namespace ge { -class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY GeOptInfo { - public: - GeOptInfo() = default; - static Status SetOptInfo(); -}; -} // namespace ge - -#endif // GE_OPT_INFO_GE_OPT_INFO_H_ diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 0a4633ad..b862a7d6 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -27,7 +27,6 @@ #include "common/math/math_util.h" #include "common/thread_pool.h" #include "common/dump/dump_manager.h" -#include "ge_opt_info/ge_opt_info.h" #include "analyzer/analyzer.h" #include "graph/common/ge_call_wrapper.h" #include "graph/common/local_context.h" @@ -1002,12 +1001,6 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vector - c_sec -) - -target_include_directories(opt_feature_stub INTERFACE ${CMAKE_CURRENT_LIST_DIR}/src) diff --git a/tests/depends/opt_info/src/opt_info_stub.cc b/tests/depends/opt_info/src/opt_info_stub.cc deleted file mode 100644 index df518c4b..00000000 --- a/tests/depends/opt_info/src/opt_info_stub.cc +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "opt_info.h" -#include -#include -#include -#include - -namespace gelc { -namespace { -const std::vector kSocVersions = {"Ascend910"}; -} - -void SetAllOptInfo(std::map &opt_infos) { - opt_infos.emplace("opt_module.fe", "all"); - opt_infos.emplace("opt_module.pass", "all"); - opt_infos.emplace("opt_module.op_tune", "all"); - opt_infos.emplace("opt_module.rl_tune", "all"); - opt_infos.emplace("opt_module.aoe", "all"); -} - -Status GetOptInfo(WorkMode mode, const std::string &soc_ver, - std::map &opt_infos) { - if (std::find(kSocVersions.begin(), kSocVersions.end(), soc_ver)== kSocVersions.end()) { - SetAllOptInfo(opt_infos); - return SUCCESS; - } - opt_infos.emplace("opt_module.fe", "all"); - opt_infos.emplace("opt_module.pass", "all"); - opt_infos.emplace("opt_module.op_tune", "all"); - return SUCCESS; -} -} // namespace gelc diff --git a/tests/framework/cmake/graphengine.cmake b/tests/framework/cmake/graphengine.cmake index c4380016..81aa00cc 100644 --- a/tests/framework/cmake/graphengine.cmake +++ b/tests/framework/cmake/graphengine.cmake @@ -103,7 +103,6 @@ list(APPEND INCLUDE_DIRECTORIES "${GE_CODE_DIR}/third_party/fwkacllib/inc/cce" "${GE_CODE_DIR}/third_party/fwkacllib/inc/ops" "${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain" - "${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info" "${GE_CODE_DIR}/tests/ut/ge" "${GE_CODE_DIR}/tests/ut/common" "${CMAKE_BINARY_DIR}" @@ -118,7 +117,6 @@ list(APPEND STUB_LIBS runtime_stub profiler_stub hccl_stub - opt_feature_stub error_manager_stub ascend_protobuf json diff --git a/tests/st/testcase/test_ge_opt_info.cc b/tests/st/testcase/test_ge_opt_info.cc deleted file mode 100644 index 457473b1..00000000 --- a/tests/st/testcase/test_ge_opt_info.cc +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include "easy_graph/graph/box.h" -#include "easy_graph/graph/node.h" -#include "easy_graph/builder/graph_dsl.h" -#include "easy_graph/builder/box_builder.h" -#include "easy_graph/layout/graph_layout.h" -#include "easy_graph/layout/engines/graph_easy/graph_easy_option.h" -#include "easy_graph/layout/engines/graph_easy/graph_easy_executor.h" -#include "graph/graph.h" -#include "graph/compute_graph.h" -#include "framework/common/types.h" -#include "graph/debug/ge_attr_define.h" -#include "ge_graph_dsl/graph_dsl.h" -#include "ge_graph_dsl/op_desc/op_desc_cfg_box.h" -#define protected public -#define private public -#include "ge_opt_info/ge_opt_info.h" -#undef private -#undef protected - -namespace ge { -class STEST_opt_info : public testing::Test { - protected: - void SetUp() {} - void TearDown() {} -}; - -TEST_F(STEST_opt_info, get_opt_info_all) { - std::map options = {{ge::SOC_VERSION, "Ascend310"}}; - GetThreadLocalContext().SetGlobalOption(options); - - /// data1 data2 - /// \ / - /// add - // build graph - DEF_GRAPH(g1) { - CHAIN(NODE("data1", DATA)->NODE("add", ADD)); - CHAIN(NODE("data2", DATA)->NODE("add")); - }); - - auto graph = ToGeGraph(g1); - - // new session & add graph - Session session(options); - auto ret = session.AddGraph(1, graph, options); - EXPECT_EQ(ret, SUCCESS); - // build input tensor - std::vector inputs; - // build_graph through session - ret = session.BuildGraph(1, inputs); - EXPECT_EQ(ret, SUCCESS); - - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - auto itr = graph_options.find("opt_module.fe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.pass"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.op_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.rl_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.aoe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); -} - -TEST_F(STEST_opt_info, get_opt_info_success) { - std::map options = {{ge::SOC_VERSION, "Ascend910"}}; - GetThreadLocalContext().SetGlobalOption(options); - - /// data1 data2 - /// \ / - /// add - // build graph - DEF_GRAPH(g1) { - CHAIN(NODE("data1", DATA)->NODE("add", ADD)); - CHAIN(NODE("data2", DATA)->NODE("add")); - }); - - auto graph = ToGeGraph(g1); - - // new session & add graph - Session session(options); - auto ret = session.AddGraph(1, graph, options); - EXPECT_EQ(ret, SUCCESS); - // build input tensor - std::vector inputs; - // build_graph through session - ret = session.BuildGraph(1, inputs); - EXPECT_EQ(ret, SUCCESS); - - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - auto itr = graph_options.find("opt_module.fe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.pass"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.op_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); -} -} // namespace ge diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index cf573343..06b3e0f2 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -62,7 +62,6 @@ include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/cce) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/ops) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain) -include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info) include_directories(${GE_CODE_DIR}/tests/ut/ge) include_directories(${GE_CODE_DIR}/tests/ut/common) include_directories(${CMAKE_BINARY_DIR}) @@ -347,7 +346,6 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/common/ge/datatype_util.cc" "${GE_CODE_DIR}/ge/ge_local_engine/engine/host_cpu_engine.cc" "${GE_CODE_DIR}/ge/session/omg.cc" - "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" ) set(COMMON_FORMAT_SRC_FILES @@ -455,7 +453,6 @@ set(GRAPH_EXECUTE_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/manager/graph_manager.cc" "${GE_CODE_DIR}/ge/graph/manager/graph_context.cc" "${GE_CODE_DIR}/ge/graph/manager/util/rt_context_util.cc" - "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" "${GE_CODE_DIR}/ge/graph/manager/graph_context.h" ) @@ -631,10 +628,6 @@ set(SINGLE_OP_SRC_FILES "${GE_CODE_DIR}/ge/hybrid/hybrid_davinci_model.cc" ) -set(GE_OPT_INFO_SRC_FILES - "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" -) - # test files set(COMMON_TEST_FILES "graph/passes/graph_builder_utils.cc" @@ -820,10 +813,6 @@ set(MULTI_PARTS_TEST_FILES "common/host_cpu_engine_unittest.cc" ) -set(GE_OPT_INFO_TEST_FILES - "ge_opt_info/ge_opt_info_unittest.cc" -) - set(GENERATOR_TEST_FILES "generator/ge_generator_unittest.cc" ) @@ -875,7 +864,6 @@ list(APPEND COMMON_SHARED_LIBRARIES mmpa_stub hccl_stub error_manager_stub - opt_feature_stub ascend_protobuf json ) @@ -1121,12 +1109,10 @@ target_link_libraries(ut_libge_multiparts_utest # libge_others_utest add_executable(ut_libge_others_utest - ${GE_OPT_INFO_SRC_FILES} ${COMMON_TEST_FILES} ${PASS_TEST_FILES} ${EXECUTE_TEST_FILES} ${OTHERS_TEST_FILES} - ${GE_OPT_INFO_TEST_FILES} ) target_compile_options(ut_libge_others_utest PRIVATE diff --git a/tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc b/tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc deleted file mode 100644 index 20c123e9..00000000 --- a/tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -#define protected public -#define private public -#include "ge_opt_info/ge_opt_info.h" -#include "graph/ge_local_context.h" -#include "external/ge/ge_api_types.h" -#undef private -#undef protected - -namespace ge { -class UTEST_opt_info : public testing::Test { - protected: - void SetUp() {} - void TearDown() {} -}; - -TEST_F(UTEST_opt_info, get_opt_info_success) { - std::map options = {{ge::SOC_VERSION, "Ascend910"}}; - GetThreadLocalContext().SetGlobalOption(options); - auto ret = GeOptInfo::SetOptInfo(); - EXPECT_EQ(ret, ge::SUCCESS); - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - auto itr = graph_options.find("opt_module.fe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.pass"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.op_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); -} - -TEST_F(UTEST_opt_info, get_opt_info_all) { - std::map global_options = {{ge::SOC_VERSION, "Ascend310"}}; - GetThreadLocalContext().SetGlobalOption(global_options); - auto ret = GeOptInfo::SetOptInfo(); - EXPECT_EQ(ret, ge::SUCCESS); - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - auto itr = graph_options.find("opt_module.fe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.pass"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.op_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.rl_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.aoe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); -} - -TEST_F(UTEST_opt_info, get_opt_info_failed) { - std::map options; - GetThreadLocalContext().SetGlobalOption(options); - auto ret = GeOptInfo::SetOptInfo(); - EXPECT_EQ(ret, ge::FAILED); -} - -} // namespace ge diff --git a/third_party/fwkacllib/inc/opt_info/opt_info.h b/third_party/fwkacllib/inc/opt_info/opt_info.h deleted file mode 100644 index ea9bb529..00000000 --- a/third_party/fwkacllib/inc/opt_info/opt_info.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -namespace gelc { -using Status = uint32_t; -using WorkMode = uint32_t; -const Status SUCCESS = 0x0; -const Status FAILED = 0xFFFFFFFF; -const WorkMode kOffline = 0x0; -const WorkMode kInline = 0x01; - -extern "C" { -__attribute__((visibility ("default"))) -Status GetOptInfo(WorkMode mode, const std::string &soc_ver, - std::map &opt_info_map); -} -} // namespace gelc -