@@ -95,7 +95,6 @@ else () | |||||
#find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) | #find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) | ||||
else() | else() | ||||
find_module(slog libalog.so ${ASCEND_ATC_DIR}) | 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}) | find_module(static_mmpa libmmpa.a ${ASCEND_ATC_DIR}) | ||||
if(PLATFORM STREQUAL "train") | if(PLATFORM STREQUAL "train") | ||||
find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR}) | find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR}) | ||||
@@ -180,4 +179,4 @@ else () | |||||
add_subdirectory(ge) | add_subdirectory(ge) | ||||
endif () | |||||
endif () |
@@ -43,7 +43,6 @@ set(SRC_LIST | |||||
"op/ge_op_utils.cc" | "op/ge_op_utils.cc" | ||||
"thread_pool.cc" | "thread_pool.cc" | ||||
"ge/tbe_plugin_manager.cc" | "ge/tbe_plugin_manager.cc" | ||||
"ge_opt_info.cc" | |||||
) | ) | ||||
if (NOT ENABLE_D AND NOT ENABLE_ACL) | if (NOT ENABLE_D AND NOT ENABLE_ACL) | ||||
@@ -87,11 +86,9 @@ target_include_directories(ge_common PRIVATE | |||||
#### yellow zone #### | #### yellow zone #### | ||||
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc> | $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc> | ||||
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc/cce> | $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc/cce> | ||||
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/abl/licctrl> | |||||
#### blue zone #### | #### blue zone #### | ||||
$<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc> | $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc> | ||||
$<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> | $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> | ||||
$<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info> | |||||
) | ) | ||||
target_link_options(ge_common PRIVATE | target_link_options(ge_common PRIVATE | ||||
@@ -111,7 +108,6 @@ target_link_libraries(ge_common PRIVATE | |||||
c_sec | c_sec | ||||
error_manager | error_manager | ||||
slog | slog | ||||
opt_feature | |||||
-Wl,--as-needed | -Wl,--as-needed | ||||
json | json | ||||
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt> | $<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt> | ||||
@@ -159,11 +155,9 @@ target_include_directories(ge_common_static PRIVATE | |||||
#### yellow zone #### | #### yellow zone #### | ||||
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc> | $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc> | ||||
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc/cce> | $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc/cce> | ||||
$<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/abl/licctrl> | |||||
#### blue zone #### | #### blue zone #### | ||||
$<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc> | $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc> | ||||
$<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> | $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> | ||||
$<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info> | |||||
) | ) | ||||
target_link_libraries(ge_common_static PRIVATE | target_link_libraries(ge_common_static PRIVATE | ||||
@@ -219,7 +213,6 @@ target_include_directories(ge_common PRIVATE | |||||
${CMAKE_BINARY_DIR}/proto/graphengine_protos | ${CMAKE_BINARY_DIR}/proto/graphengine_protos | ||||
${GE_CODE_DIR}/third_party/fwkacllib/inc | ${GE_CODE_DIR}/third_party/fwkacllib/inc | ||||
${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain | ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain | ||||
${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info | |||||
) | ) | ||||
target_link_options(ge_common PRIVATE | target_link_options(ge_common PRIVATE | ||||
@@ -235,7 +228,6 @@ target_link_libraries(ge_common PRIVATE | |||||
c_sec | c_sec | ||||
error_manager | error_manager | ||||
slog | slog | ||||
opt_feature | |||||
static_mmpa | static_mmpa | ||||
-Wl,--as-needed | -Wl,--as-needed | ||||
json | json | ||||
@@ -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 "common/ge_opt_info.h" | |||||
#include <string> | |||||
#include <map> | |||||
#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<std::string, std::string> 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<std::string, std::string> 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 |
@@ -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_COMMON_GE_OPT_INFO_H_ | |||||
#define GE_COMMON_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_COMMON_GE_OPT_INFO_H_ |
@@ -27,7 +27,6 @@ | |||||
#include "common/math/math_util.h" | #include "common/math/math_util.h" | ||||
#include "common/thread_pool.h" | #include "common/thread_pool.h" | ||||
#include "common/dump/dump_manager.h" | #include "common/dump/dump_manager.h" | ||||
#include "common/ge_opt_info.h" | |||||
#include "analyzer/analyzer.h" | #include "analyzer/analyzer.h" | ||||
#include "graph/common/ge_call_wrapper.h" | #include "graph/common/ge_call_wrapper.h" | ||||
#include "graph/common/local_context.h" | #include "graph/common/local_context.h" | ||||
@@ -1002,12 +1001,6 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vector<Ge | |||||
return ret; | return ret; | ||||
} | } | ||||
ret = GeOptInfo::SetOptInfo(); | |||||
if (ret != SUCCESS) { | |||||
GELOGE(ret, "[Set][OptInfo] Set optional information failed."); | |||||
return ret; | |||||
} | |||||
/// 1. BUILD_MODE_TUNING with BUILD_STEP_AFTER_UB_MATCH no need PreRunOptimizeOriginalGraph; | /// 1. BUILD_MODE_TUNING with BUILD_STEP_AFTER_UB_MATCH no need PreRunOptimizeOriginalGraph; | ||||
/// 2. BUILD_MODE_TUNING with BUILD_STEP_AFTER_MERGE no need PreRunOptimizeOriginalGraph. | /// 2. BUILD_MODE_TUNING with BUILD_STEP_AFTER_MERGE no need PreRunOptimizeOriginalGraph. | ||||
/// 3. BUILD_MODE_TUNING with BUILD_STEP_AFTER_BUILDER_SUB no need PreRunOptimizeOriginalGraph. | /// 3. BUILD_MODE_TUNING with BUILD_STEP_AFTER_BUILDER_SUB no need PreRunOptimizeOriginalGraph. | ||||
@@ -22,7 +22,6 @@ add_subdirectory(depends/runtime) | |||||
add_subdirectory(depends/hccl) | add_subdirectory(depends/hccl) | ||||
add_subdirectory(depends/profiler) | add_subdirectory(depends/profiler) | ||||
add_subdirectory(depends/error_manager) | add_subdirectory(depends/error_manager) | ||||
add_subdirectory(depends/opt_info) | |||||
if (ENABLE_GE_COV OR ENABLE_GE_UT) | if (ENABLE_GE_COV OR ENABLE_GE_UT) | ||||
add_subdirectory(ut) | add_subdirectory(ut) | ||||
@@ -1,37 +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. | |||||
# ============================================================================ | |||||
#cmake_minimum_required(VERSION 2.8) | |||||
project(opt_feature_stub) | |||||
file(GLOB_RECURSE SRCS RELATIVE ${CMAKE_CURRENT_LIST_DIR} | |||||
"src/opt_info_stub.cc" | |||||
) | |||||
include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info) | |||||
add_library(opt_feature_stub SHARED ${SRCS}) | |||||
target_compile_options(opt_feature_stub PRIVATE | |||||
-g | |||||
) | |||||
target_link_libraries(opt_feature_stub PRIVATE | |||||
$<BUILD_INTERFACE:intf_pub> | |||||
c_sec | |||||
) | |||||
target_include_directories(opt_feature_stub INTERFACE ${CMAKE_CURRENT_LIST_DIR}/src) |
@@ -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 <string> | |||||
#include <map> | |||||
#include <vector> | |||||
#include <algorithm> | |||||
namespace gelc { | |||||
namespace { | |||||
const std::vector<std::string> kSocVersions = {"Ascend910"}; | |||||
} | |||||
void SetAllOptInfo(std::map<std::string, std::string> &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<std::string, std::string> &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 |
@@ -103,7 +103,6 @@ list(APPEND INCLUDE_DIRECTORIES | |||||
"${GE_CODE_DIR}/third_party/fwkacllib/inc/cce" | "${GE_CODE_DIR}/third_party/fwkacllib/inc/cce" | ||||
"${GE_CODE_DIR}/third_party/fwkacllib/inc/ops" | "${GE_CODE_DIR}/third_party/fwkacllib/inc/ops" | ||||
"${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain" | "${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/ge" | ||||
"${GE_CODE_DIR}/tests/ut/common" | "${GE_CODE_DIR}/tests/ut/common" | ||||
"${CMAKE_BINARY_DIR}" | "${CMAKE_BINARY_DIR}" | ||||
@@ -118,7 +117,6 @@ list(APPEND STUB_LIBS | |||||
runtime_stub | runtime_stub | ||||
profiler_stub | profiler_stub | ||||
hccl_stub | hccl_stub | ||||
opt_feature_stub | |||||
error_manager_stub | error_manager_stub | ||||
ascend_protobuf | ascend_protobuf | ||||
json | json | ||||
@@ -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 <gtest/gtest.h> | |||||
#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 "common/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<std::string, std::string> 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<InputTensorInfo> inputs; | |||||
// build_graph through session | |||||
ret = session.BuildGraph(1, inputs); | |||||
EXPECT_EQ(ret, SUCCESS); | |||||
std::map<std::string, std::string> 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<std::string, std::string> 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<InputTensorInfo> inputs; | |||||
// build_graph through session | |||||
ret = session.BuildGraph(1, inputs); | |||||
EXPECT_EQ(ret, SUCCESS); | |||||
std::map<std::string, std::string> 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 |
@@ -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/cce) | ||||
include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/ops) | 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/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/ge) | ||||
include_directories(${GE_CODE_DIR}/tests/ut/common) | include_directories(${GE_CODE_DIR}/tests/ut/common) | ||||
include_directories(${CMAKE_BINARY_DIR}) | include_directories(${CMAKE_BINARY_DIR}) | ||||
@@ -173,7 +172,6 @@ set(COMMON_SRC_FILES | |||||
"${GE_CODE_DIR}/ge/common/dump/exception_dumper.cc" | "${GE_CODE_DIR}/ge/common/dump/exception_dumper.cc" | ||||
"${GE_CODE_DIR}/ge/common/dump/opdebug_register.cc" | "${GE_CODE_DIR}/ge/common/dump/opdebug_register.cc" | ||||
"${GE_CODE_DIR}/ge/common/dump/dump_op.cc" | "${GE_CODE_DIR}/ge/common/dump/dump_op.cc" | ||||
"${GE_CODE_DIR}/ge/common/ge_opt_info.cc" | |||||
"${GE_CODE_DIR}/ge/common/helper/om_file_helper.cc" | "${GE_CODE_DIR}/ge/common/helper/om_file_helper.cc" | ||||
"${GE_CODE_DIR}/ge/model/ge_root_model.cc" | "${GE_CODE_DIR}/ge/model/ge_root_model.cc" | ||||
"${GE_CODE_DIR}/ge/common/model_parser/model_parser.cc" | "${GE_CODE_DIR}/ge/common/model_parser/model_parser.cc" | ||||
@@ -770,7 +768,6 @@ set(MULTI_PARTS_TEST_FILES | |||||
"common/dump_op_unittest.cc" | "common/dump_op_unittest.cc" | ||||
"common/dump_exception_unittest.cc" | "common/dump_exception_unittest.cc" | ||||
"common/opdebug_register_unittest.cc" | "common/opdebug_register_unittest.cc" | ||||
"common/ge_opt_info_unittest.cc" | |||||
"common/format_transfer_unittest.cc" | "common/format_transfer_unittest.cc" | ||||
"common/format_transfer_transpose_unittest.cc" | "common/format_transfer_transpose_unittest.cc" | ||||
"common/format_transfer_nchw_5d_unittest.cc" | "common/format_transfer_nchw_5d_unittest.cc" | ||||
@@ -864,7 +861,6 @@ list(APPEND COMMON_SHARED_LIBRARIES | |||||
mmpa_stub | mmpa_stub | ||||
hccl_stub | hccl_stub | ||||
error_manager_stub | error_manager_stub | ||||
opt_feature_stub | |||||
ascend_protobuf | ascend_protobuf | ||||
json | json | ||||
) | ) | ||||
@@ -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 <gtest/gtest.h> | |||||
#include <gmock/gmock.h> | |||||
#define protected public | |||||
#define private public | |||||
#include "common/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<std::string, std::string> options = {{ge::SOC_VERSION, "Ascend910"}}; | |||||
GetThreadLocalContext().SetGlobalOption(options); | |||||
auto ret = GeOptInfo::SetOptInfo(); | |||||
EXPECT_EQ(ret, ge::SUCCESS); | |||||
std::map<std::string, std::string> 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<std::string, std::string> global_options = {{ge::SOC_VERSION, "Ascend310"}}; | |||||
GetThreadLocalContext().SetGlobalOption(global_options); | |||||
auto ret = GeOptInfo::SetOptInfo(); | |||||
EXPECT_EQ(ret, ge::SUCCESS); | |||||
std::map<std::string, std::string> 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<std::string, std::string> options; | |||||
GetThreadLocalContext().SetGlobalOption(options); | |||||
auto ret = GeOptInfo::SetOptInfo(); | |||||
EXPECT_EQ(ret, ge::FAILED); | |||||
} | |||||
} // namespace ge |
@@ -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 <string> | |||||
#include <map> | |||||
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<std::string, std::string> &opt_info_map); | |||||
} | |||||
} // namespace gelc | |||||