From dd9334c2f786f632a55259d3eebed96c5cc794e9 Mon Sep 17 00:00:00 2001 From: ranzheng Date: Thu, 7 Aug 2025 23:13:16 +0800 Subject: [PATCH] opp_so_manager.cc etc. for opp open source --- base/common/plugin/plugin_manager.cc | 86 +++++++++++++++ base/registry/opp_so_manager.cc | 102 ++++++++++++++++++ graph/opsproto/opsproto_manager.cc | 22 ++-- inc/common/plugin/plugin_manager.h | 10 +- inc/register/opp_so_manager.h | 2 + .../graph/testcase/plugin_manager_unittest.cc | 82 ++++++++++++++ .../testcase/opp_so_manager_unittest.cc | 94 ++++++++++++++++ 7 files changed, 386 insertions(+), 12 deletions(-) diff --git a/base/common/plugin/plugin_manager.cc b/base/common/plugin/plugin_manager.cc index 2c33e6f677..78a383a66c 100644 --- a/base/common/plugin/plugin_manager.cc +++ b/base/common/plugin/plugin_manager.cc @@ -604,6 +604,34 @@ Status PluginManager::GetOpsProtoPath(std::string &opsproto_path) { } } +Status PluginManager::GetOpGraphPath(std::string &opgraph_path) { + GELOGI("Enter GetOpGraphPath schedule"); + std::string opp_path; + GE_ASSERT_TRUE(GetOppPath(opp_path) == SUCCESS, "Failed to get opp path!"); + if (!IsNewOppPathStruct(opp_path)) { + GELOGI("Opp plugin path structure is old version!"); + return GetOppPluginPathOld(opp_path, "opgraph/%s/", opgraph_path); + } else { + GELOGI("Opp plugin path structure is new version!"); + GetPluginPathFromCustomOppPath("opgraph/", opgraph_path); + return GetOppPluginPathNew(opp_path, "%s/opgraph/", opgraph_path, "op_proto/custom/"); + } +} + +Status PluginManager::GetOpHostPath(std::string &ophost_path) { + GELOGI("Enter GetOpHostPath schedule"); + std::string opp_path; + GE_ASSERT_TRUE(GetOppPath(opp_path) == SUCCESS, "Failed to get opp path!"); + if (!IsNewOppPathStruct(opp_path)) { + GELOGI("Opp plugin path structure is old version!"); + return GetOppPluginPathOld(opp_path, "ophost/%s/", ophost_path); + } else { + GELOGI("Opp plugin path structure is new version!"); + GetPluginPathFromCustomOppPath("ophost/", ophost_path); + return GetOppPluginPathNew(opp_path, "%s/ophost/", ophost_path, "op_proto/custom/"); + } +} + Status PluginManager::GetUpgradedOpsProtoPath(std::string &opsproto_path) { GELOGI("Start to get upgraded ops proto path"); std::string upgraded_opp_path; @@ -1127,6 +1155,64 @@ bool PluginManager::ParseVersion(std::string &line, std::string &version, const return true; } +bool PluginManager::IsMatchPatten(const std::string &path, const std::string& prefix, const std::string &suffix) { + const auto size = prefix.size() + suffix.size(); + return (path.size() >= size) && \ + (path.compare(0, prefix.size(), prefix) == 0) && \ + (path.compare(path.size() - suffix.size(), suffix.size(), suffix) == 0); +} + +void PluginManager::GetFileListWithPatten(const std::string &path, const std::string& prefix, const std::string &suffix, + std::vector &file_list) { + if (path.empty()) { + GELOGI("realPath is empty"); + return; + } + if (path.size() >= static_cast(MMPA_MAX_PATH)) { + REPORT_INNER_ERROR("E18888", "param path size:%zu >= max path:%d", path.size(), MMPA_MAX_PATH); + GELOGE(FAILED, "param path size:%zu >= max path:%d", path.size(), MMPA_MAX_PATH); + return; + } + + char_t resolved_path[MMPA_MAX_PATH] = {}; + + // Nullptr is returned when the path does not exist or there is no permission + // Return absolute path when path is accessible + if (mmRealPath(path.c_str(), &(resolved_path[0U]), MMPA_MAX_PATH) != EN_OK) { + GELOGW("[FindSo][Check] Get real_path for file %s failed, reason:%s", path.c_str(), strerror(errno)); + return; + } + + const INT32 is_dir = mmIsDir(&(resolved_path[0U])); + if (is_dir != EN_OK) { + GELOGW("[FindSo][Check] Open directory %s failed, maybe it is not exit or not a dir, errmsg:%s", + &(resolved_path[0U]), strerror(errno)); + return; + } + + mmDirent **entries = nullptr; + const auto file_num = mmScandir(&(resolved_path[0U]), &entries, nullptr, nullptr); + if ((file_num < 0) || (entries == nullptr)) { + GELOGW("[FindSo][Scan] Scan directory %s failed, ret:%d, reason:%s", + &(resolved_path[0U]), file_num, strerror(errno)); + return; + } + for (int32_t i = 0; i < file_num; ++i) { + const mmDirent *const dir_ent = entries[static_cast(i)]; + const std::string name = std::string(dir_ent->d_name); + if ((strcmp(name.c_str(), ".") == 0) || (strcmp(name.c_str(), "..") == 0)) { + continue; + } + if ((static_cast(dir_ent->d_type) != DT_DIR) && IsMatchPatten(name, prefix, suffix)) { + const std::string full_name = path + "/" + name; + file_list.push_back(full_name); + GELOGI("PluginManager Parse full name = %s.", full_name.c_str()); + } + } + mmScandirFree(entries, file_num); + GELOGI("Found %d libs.", file_list.size()); +} + bool PluginManager::IsEndWith(const std::string &path, const std::string &suff) { return (path.size() >= suff.size()) && (path.compare(path.size() - suff.size(), suff.size(), suff) == 0); } diff --git a/base/registry/opp_so_manager.cc b/base/registry/opp_so_manager.cc index c90fb0f819..0689cd46ea 100644 --- a/base/registry/opp_so_manager.cc +++ b/base/registry/opp_so_manager.cc @@ -23,6 +23,34 @@ constexpr const char_t *const kSoSuffix = ".so"; constexpr const char_t *const kRt2SoSuffix = "rt2.0.so"; constexpr const char_t *const kCtSoSuffix = "ct.so"; constexpr const char_t *const kRtSoSuffix = "rt.so"; +constexpr const char_t *const kHostPrefix = "libophost_"; +constexpr const char_t *const kGraphPrefix = "libopgraph_"; + +/* sample + * master dir : opp/built-in/op_impl/ai_core/tbe/op_tiling/lib/linux/aarch64/ + * --> : opp/built-in/ophost/lib/linux/aarch64/ + * file : {liboptiling.so | libopmaster_rt2.0.so | libopmaster_ct.so} + * --> : {libhost_math.so | libhost_nn.so | libhost_cv.so | libhost_transformer.so | libhost_legacy.so} + * + * proto dir : opp/built-in/op_proto/lib/linux/aarch64/ + * --> : opp/built-in/opgraph/lib/aarch64/{aarch64 | minios | x86_64}/ + * file : {libopsproto.so | libopsproto_rt2.0.so} + * --> : {libgraph_math.so | libgraph_nn.so | libgraph_cv.so | libgraph_transformer.so | libgraph_legacy.so} + */ +void GetOppHostSoList(const std::string &opp_so_path, std::vector &so_list) { + PluginManager::GetFileListWithPatten(opp_so_path, kHostPrefix, kSoSuffix, so_list); + for (const auto &so_name : so_list) { + GELOGD("GetOppSoList from path %s, so_name is %s", opp_so_path.c_str(), so_name.c_str()); + } +} + +void GetOppGraphSoList(const std::string &opp_so_path, std::vector &so_list) { + PluginManager::GetFileListWithPatten(opp_so_path, kGraphPrefix, kSoSuffix, so_list); + for (const auto &so_name : so_list) { + GELOGD("GetOppSoList from path %s, so_name is %s", opp_so_path.c_str(), so_name.c_str()); + } +} + void GetOppSoList(const std::string &opp_so_path, std::vector &so_list, bool is_split) { if (opp_so_path.find(kBuiltIn) != std::string::npos) { // *_ct.so all need to be loaded @@ -48,6 +76,12 @@ void LoadSoAndInitDefault(const std::vector &so_list, OppImplVersio } // namespace void OppSoManager::LoadOpsProtoPackage() const { + // if libopgraph_xxx.so exist, load the now opp proto so + if (LoadOpGraphSo() > 0) { + return; + } + + // if libopgraph_xxx.so not exist, load the legacy opp proto so (libopsproto.so) const bool is_split = PluginManager::IsSplitOpp(); GELOGI("Start load ops proto package, is_split:[%d].", is_split); LoadOpsProtoSo(is_split); @@ -58,6 +92,12 @@ void OppSoManager::LoadOpsProtoPackage() const { } void OppSoManager::LoadOpMasterPackage() const { + // if libophost_xxx.so exist, load the now opp proto so + if (LoadOpHostSo() > 0) { + return; + } + + // if libophost_xxx.so not exist, load the legacy opp proto so (libopmaster_xxx.so) const auto is_split = PluginManager::IsSplitOpp(); GELOGI("Start load op master package, is_split:[%d].", is_split); LoadOpMasterSo(is_split); @@ -72,6 +112,37 @@ void OppSoManager::LoadOppPackage() const { LoadOpMasterPackage(); } +int OppSoManager::LoadOpGraphSo() const { + int so_num = 0; + + std::string ops_proto_path; + const Status ret = PluginManager::GetOpGraphPath(ops_proto_path); + if (ret != SUCCESS) { + return -1; + } + + std::string os_type; + std::string cpu_type; + PluginManager::GetCurEnvPackageOsAndCpuType(os_type, cpu_type); + + std::vector v_path; + PluginManager::SplitPath(ops_proto_path, v_path); + for (size_t i = 0UL; i < v_path.size(); ++i) { + std::string path = v_path[i] + "lib/" + os_type + "/" + cpu_type + "/"; + char_t resolved_path[MMPA_MAX_PATH] = {}; + const INT32 result = mmRealPath(path.c_str(), &(resolved_path[0U]), MMPA_MAX_PATH); + if (result != EN_OK) { + GELOGW("[FindSo][Check] Get path with os&cpu type [%s] failed, reason:%s", path.c_str(), strerror(errno)); + continue; + } + std::vector so_list; + GetOppGraphSoList(path, so_list); + so_num += static_cast(so_list.size()); + LoadSoAndInitDefault(so_list, OppImplVersion::kOpp); + } + return so_num; +} + void OppSoManager::LoadOpsProtoSo(bool is_split) const { std::string ops_proto_path; const Status ret = PluginManager::GetOpsProtoPath(ops_proto_path); @@ -99,6 +170,37 @@ void OppSoManager::LoadOpsProtoSo(bool is_split) const { } } +int OppSoManager::LoadOpHostSo() const { + int so_num = 0; + + std::string ops_proto_path; + const Status ret = PluginManager::GetOpHostPath(ops_proto_path); + if (ret != SUCCESS) { + return -1; + } + + std::string os_type; + std::string cpu_type; + PluginManager::GetCurEnvPackageOsAndCpuType(os_type, cpu_type); + + std::vector v_path; + PluginManager::SplitPath(ops_proto_path, v_path); + for (size_t i = 0UL; i < v_path.size(); ++i) { + std::string path = v_path[i] + "lib/" + os_type + "/" + cpu_type + "/"; + char_t resolved_path[MMPA_MAX_PATH] = {}; + const INT32 result = mmRealPath(path.c_str(), &(resolved_path[0U]), MMPA_MAX_PATH); + if (result != EN_OK) { + GELOGW("[FindSo][Check] Get path with os&cpu type [%s] failed, reason:%s", path.c_str(), strerror(errno)); + continue; + } + std::vector so_list; + GetOppHostSoList(path, so_list); + so_num += static_cast(so_list.size()); + LoadSoAndInitDefault(so_list, OppImplVersion::kOpp); + } + return so_num; +} + void OppSoManager::LoadOpMasterSo(bool is_split) const { std::string op_tiling_path; const Status ret = PluginManager::GetOpTilingForwardOrderPath(op_tiling_path); diff --git a/graph/opsproto/opsproto_manager.cc b/graph/opsproto/opsproto_manager.cc index 77044e2051..b8fc8ad54b 100644 --- a/graph/opsproto/opsproto_manager.cc +++ b/graph/opsproto/opsproto_manager.cc @@ -108,20 +108,20 @@ void GetOpsProtoSoFileList(const std::string &path, std::vector &fi PluginManager::GetCurEnvPackageOsAndCpuType(os_type, cpu_type); for (size_t i = 0UL; i < v_path.size(); ++i) { - const std::string new_path = v_path[i] + "lib/" + os_type + "/" + cpu_type + "/"; + std::string file_path; + + std::string s_path = v_path[i] + "lib/" + os_type + "/" + cpu_type + "/"; char_t resolved_path[MMPA_MAX_PATH] = {}; - const INT32 result = mmRealPath(new_path.c_str(), &(resolved_path[0U]), MMPA_MAX_PATH); + const INT32 result = mmRealPath(s_path.c_str(), &(resolved_path[0U]), MMPA_MAX_PATH); if (result == EN_OK) { - std::vector file_list_unfiltered; - PluginManager::GetFileListWithSuffix(new_path, ".so", file_list_unfiltered); - std::for_each(file_list_unfiltered.begin(), file_list_unfiltered.end(), [&file_list](const std::string &file) { - if (!PluginManager::IsEndWith(file, "rt2.0.so") && !PluginManager::IsEndWith(file, "rt.so")) { - file_list.emplace_back(file); - } - }); + file_path = s_path + "libopsproto.so"; } else { - GELOGW("[FindSo][Check] Get path with os&cpu type [%s] unsuccessful, reason:%s", new_path.c_str(), strerror(errno)); - PluginManager::GetFileListWithSuffix(v_path[i], ".so", file_list); + GELOGW("[FindSo][Check] Get path with os&cpu type [%s] unsuccessful, reason:%s", s_path.c_str(), strerror(errno)); + file_path = v_path[i] + "opsproto.so"; + } + + if (mmAccess(file_path.c_str()) == EN_OK) { + file_list.emplace_back(file_path); } } } diff --git a/inc/common/plugin/plugin_manager.h b/inc/common/plugin/plugin_manager.h index fb5f6926e2..9033b2e166 100644 --- a/inc/common/plugin/plugin_manager.h +++ b/inc/common/plugin/plugin_manager.h @@ -77,7 +77,11 @@ class PluginManager { const std::string &path_fmt_custom = ""); static bool IsSplitOpp(); - + + static Status GetOpHostPath(std::string &ophost_path); + + static Status GetOpGraphPath(std::string &opgraph_path); + static Status GetOpsProtoPath(std::string &opsproto_path); static Status GetUpgradedOpsProtoPath(std::string &opsproto_path); @@ -112,6 +116,9 @@ class PluginManager { static bool GetVersionFromPath(const std::string &file_path, std::string &version); + static void GetFileListWithPatten(const std::string &path, const std::string& prefix, const std::string &suffix, + std::vector &file_list); + static void GetFileListWithSuffix(const std::string &path, const std::string &so_suff, std::vector &file_list); @@ -127,6 +134,7 @@ class PluginManager { std::vector &so_files); static bool IsEndWith(const std::string &path, const std::string &suff); + static bool IsMatchPatten(const std::string &path, const std::string& prefix, const std::string &suffix); static Status GetOpMasterDeviceSoPath(std::string &op_master_device_path); diff --git a/inc/register/opp_so_manager.h b/inc/register/opp_so_manager.h index 8d4eac8dab..2a48c19e1b 100644 --- a/inc/register/opp_so_manager.h +++ b/inc/register/opp_so_manager.h @@ -25,6 +25,8 @@ class OppSoManager { private: void LoadOpsProtoSo(bool is_split = true) const; void LoadOpMasterSo(bool is_split = true) const; + int LoadOpGraphSo() const; + int LoadOpHostSo() const; void LoadUpgradedOpsProtoSo() const; void LoadUpgradedOpMasterSo() const; diff --git a/tests/ut/graph/testcase/plugin_manager_unittest.cc b/tests/ut/graph/testcase/plugin_manager_unittest.cc index 70c0805473..1d79a0d4c6 100644 --- a/tests/ut/graph/testcase/plugin_manager_unittest.cc +++ b/tests/ut/graph/testcase/plugin_manager_unittest.cc @@ -556,6 +556,88 @@ TEST_F(UtestPluginManager, test_plugin_manager_GetOpsProtoPath_09) { system(("rm -rf " + opp_path).c_str()); } +TEST_F(UtestPluginManager, GetFileListWithPatten_Fail) { + std::string path; + std::vector file_list; + PluginManager::GetFileListWithPatten(path, "", "", file_list); + ASSERT_EQ(file_list.size(), 0); + + path = "a_long_long_file_name_"; + for (int i = 0; i < 1024; i++) { + path += "a_long_long_file_name_"; + } + PluginManager::GetFileListWithPatten(path, "", "", file_list); + ASSERT_EQ(file_list.size(), 0); + + path = "not a real path"; + PluginManager::GetFileListWithPatten(path, "", "", file_list); + ASSERT_EQ(file_list.size(), 0); + + path = "./opp"; + system(("mkdir -p " + path).c_str()); + system(("touch " + path).c_str()); + PluginManager::GetFileListWithPatten(path, "", "", file_list); + ASSERT_EQ(file_list.size(), 0); + + system(("rm -rf " + path).c_str()); +} + +TEST_F(UtestPluginManager, test_plugin_manager_GetOpGraphPath) { + std::string opp_path = __FILE__; + opp_path = opp_path.substr(0, opp_path.rfind("/") + 1) + "opp_path/"; + std::string custom_opp_path = opp_path + "custom_opp_path"; + mmSetEnv(kEnvName, opp_path.c_str(), 1); + PluginManager::SetCustomOpLibPath(""); + + std::string path_builtin = opp_path + "built-in"; + std::string path_vendors = opp_path + "vendors"; + std::string path_config = path_vendors + "/config.ini"; + system(("mkdir -p " + path_builtin).c_str()); + system(("mkdir -p " + path_vendors).c_str()); + system(("echo 'load_priority=customize,mdc,lhisi' > " + path_config).c_str()); + system(("mkdir -p " + custom_opp_path + "/opgraph").c_str()); + + std::string opgraph_path; + Status ret = PluginManager::GetOpGraphPath(opgraph_path); + EXPECT_EQ(ret, SUCCESS); + EXPECT_EQ(opgraph_path, + path_vendors + "/customize/opgraph/:" + + path_vendors + "/mdc/opgraph/:" + + path_vendors + "/lhisi/opgraph/:" + + opp_path + "built-in/opgraph/" + ); + system(("rm -rf " + opp_path).c_str()); +} + +TEST_F(UtestPluginManager, test_plugin_manager_GetOpHostPath) { + std::string opp_path = __FILE__; + opp_path = opp_path.substr(0, opp_path.rfind("/") + 1) + "opp_path/"; + std::string custom_opp_path = opp_path + "custom_opp_path"; + mmSetEnv(kEnvName, opp_path.c_str(), 1); + PluginManager::SetCustomOpLibPath(custom_opp_path); + + std::string path_builtin = opp_path + "built-in"; + std::string path_vendors = opp_path + "vendors"; + std::string path_config = path_vendors + "/config.ini"; + system(("mkdir -p " + path_builtin).c_str()); + system(("mkdir -p " + path_vendors).c_str()); + system(("echo 'load_priority=customize,mdc,lhisi' > " + path_config).c_str()); + system(("mkdir -p " + custom_opp_path + "/ophost").c_str()); + + std::string ophost_path; + Status ret = PluginManager::GetOpHostPath(ophost_path); + EXPECT_EQ(ret, SUCCESS); + + EXPECT_EQ(ophost_path, + custom_opp_path + "/ophost/:" + + path_vendors + "/customize/ophost/:" + + path_vendors + "/mdc/ophost/:" + + path_vendors + "/lhisi/ophost/:" + + opp_path + "built-in/ophost/" + ); + system(("rm -rf " + opp_path).c_str()); +} + TEST_F(UtestPluginManager, test_plugin_manager_GetOpTilingPath_01) { std::string opp_path = __FILE__; opp_path = opp_path.substr(0, opp_path.rfind("/") + 1) + "opp_path/"; diff --git a/tests/ut/register/testcase/opp_so_manager_unittest.cc b/tests/ut/register/testcase/opp_so_manager_unittest.cc index 9e59b5bf42..cd94c373a9 100644 --- a/tests/ut/register/testcase/opp_so_manager_unittest.cc +++ b/tests/ut/register/testcase/opp_so_manager_unittest.cc @@ -25,6 +25,77 @@ const char *const kAscendHomePath = "ASCEND_HOME_PATH"; const string kInner = "built-in"; const string kx86OpsProtoPath = "/op_impl/ai_core/tbe/op_tiling/lib/linux/x86_64/"; +const string kx86OpHostPath = "/ophost/lib/linux/x86_64/"; +const string kx86OpGraphPath = "/opgraph/lib/linux/x86_64/"; + +void SetHostOpImplSo(std::set &temp_paths) { + std::string opp_path = "./"; + mmSetEnv(kEnvName, opp_path.c_str(), 1); + + std::string path ="./opp"; + system(("mkdir -p " + path).c_str()); + path += "/scene.info"; + system(("touch " + path).c_str()); + system(("echo 'os=linux' > " + path).c_str()); + system(("echo 'arch=x86_64' >> " + path).c_str()); + + std::string path1 = "./../../opp"; + temp_paths.insert(path1); + system(("mkdir -p " + path1).c_str()); + path1 += "/scene.info"; + system(("touch " + path1).c_str()); + system(("echo 'os=linux' > " + path1).c_str()); + system(("echo 'arch=x86_64' >> " + path1).c_str()); + + system("pwd"); + system(("realpath " + path).c_str()); + system(("realpath " + path1).c_str()); + + std::string path_vendors = opp_path + "vendors"; + temp_paths.insert(path_vendors); + std::string path_config = path_vendors + "/config.ini"; + system(("mkdir -p " + path_vendors).c_str()); + system(("echo 'load_priority=customize' > " + path_config).c_str()); + + std::string ophost_path = opp_path + kInner + kx86OpHostPath; + temp_paths.insert(opp_path + kInner); + std::string command = "mkdir -p " + ophost_path; + system(command.c_str()); + GELOGD("command: %s", command.c_str()); + system(("realpath " + ophost_path).c_str()); + + std::string libophost_math = ophost_path + "libophost_math.so"; + command = "touch " + libophost_math; + GELOGD("command: %s", command.c_str()); + system(("realpath " + libophost_math).c_str()); + system(command.c_str()); + + std::string libophost_nn = ophost_path + "libophost_nn.so"; + command = "touch " + libophost_nn; + GELOGD("command: %s", command.c_str()); + system(("realpath " + libophost_nn).c_str()); + system(command.c_str()); + + std::string opgraph_path = opp_path + kInner + kx86OpGraphPath; + temp_paths.insert(opp_path + kInner); + command = "mkdir -p " + opgraph_path; + system(command.c_str()); + GELOGD("command: %s", command.c_str()); + system(("realpath " + opgraph_path).c_str()); + + std::string libopgraph_math = opgraph_path + "libopgraph_math.so"; + command = "touch " + libopgraph_math; + GELOGD("command: %s", command.c_str()); + system(("realpath " + libopgraph_math).c_str()); + system(command.c_str()); + + std::string libopgraph_nn = opgraph_path + "libopgraph_nn.so"; + command = "touch " + libopgraph_nn; + GELOGD("command: %s", command.c_str()); + system(("realpath " + libopgraph_nn).c_str()); + system(command.c_str()); +} + void SetRt2OpImplSo(std::set &temp_paths, bool flag = true) { std::string opp_path = "./"; mmSetEnv(kEnvName, opp_path.c_str(), 1); @@ -186,6 +257,16 @@ TEST_F(OppSoManagerUT, LoadOppSo_fail) { RemoveTempPaths(temp_paths); } +TEST_F(OppSoManagerUT, LoadOppSoHost_fail) { + std::set temp_paths; + SetHostOpImplSo(temp_paths); + OppSoManager::GetInstance().LoadOppPackage(); + + auto space_registry = gert::DefaultOpImplSpaceRegistry::GetInstance().GetDefaultSpaceRegistry(); + EXPECT_EQ(space_registry, nullptr); + RemoveTempPaths(temp_paths); +} + TEST_F(OppSoManagerUT, LoadOppSo) { mock_handle = (void *) 0xffffffff; g_impl_num = 1; @@ -213,4 +294,17 @@ TEST_F(OppSoManagerUT, LoadSplitAndUpgradedOppSo_suc) { EXPECT_NE(space_registry, nullptr); RemoveTempPaths({opp_path}); } + +TEST_F(OppSoManagerUT, LoadOppSoHost) { + mock_handle = (void *) 0xffffffff; + g_impl_num = 1; + ge::MmpaStub::GetInstance().SetImpl(std::make_shared()); + std::set temp_paths; + SetHostOpImplSo(temp_paths); + OppSoManager::GetInstance().LoadOppPackage(); + + auto space_registry = gert::DefaultOpImplSpaceRegistry::GetInstance().GetDefaultSpaceRegistry(); + EXPECT_NE(space_registry, nullptr); + RemoveTempPaths(temp_paths); +} } // namespace ge -- Gitee