diff --git a/cmake/developer_package/plugins/create_plugins_hpp.cmake b/cmake/developer_package/plugins/create_plugins_hpp.cmake index cddcad73847..10adcac6c28 100644 --- a/cmake/developer_package/plugins/create_plugins_hpp.cmake +++ b/cmake/developer_package/plugins/create_plugins_hpp.cmake @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # -foreach(var IE_DEVICE_MAPPING IE_PLUGINS_HPP_HEADER IE_PLUGINS_HPP_HEADER_IN) +foreach(var IE_DEVICE_MAPPING OV_DYNAMIC IE_PLUGINS_HPP_HEADER IE_PLUGINS_HPP_HEADER_IN) if(NOT DEFINED ${var}) message(FATAL_ERROR "${var} is required, but not defined") endif() @@ -19,20 +19,6 @@ foreach(dev_map IN LISTS IE_DEVICE_MAPPING) list(GET dev_map 0 mapped_dev_name) list(GET dev_map 1 actual_dev_name) - # common - set(_IE_CREATE_PLUGIN_FUNC "CreatePluginEngine${actual_dev_name}") - set(_IE_CREATE_EXTENSION_FUNC "CreateExtensionShared${actual_dev_name}") - - # declarations - set(IE_PLUGINS_DECLARATIONS "${IE_PLUGINS_DECLARATIONS} -IE_DEFINE_PLUGIN_CREATE_FUNCTION_DECLARATION(${_IE_CREATE_PLUGIN_FUNC});") - if(${actual_dev_name}_AS_EXTENSION) - set(IE_PLUGINS_DECLARATIONS "${IE_PLUGINS_DECLARATIONS} -IE_DEFINE_EXTENSION_CREATE_FUNCTION_DECLARATION(${_IE_CREATE_EXTENSION_FUNC});") - else() - set(_IE_CREATE_EXTENSION_FUNC "nullptr") - endif() - # definitions set(dev_config "{") if(${mapped_dev_name}_CONFIG) @@ -48,8 +34,28 @@ IE_DEFINE_EXTENSION_CREATE_FUNCTION_DECLARATION(${_IE_CREATE_EXTENSION_FUNC});") endif() set(dev_config "${dev_config}}") - set(IE_PLUGINS_MAP_DEFINITION "${IE_PLUGINS_MAP_DEFINITION} + + if(NOT OV_DYNAMIC) + # common + set(_IE_CREATE_PLUGIN_FUNC "CreatePluginEngine${actual_dev_name}") + set(_IE_CREATE_EXTENSION_FUNC "CreateExtensionShared${actual_dev_name}") + + # declarations + set(IE_PLUGINS_DECLARATIONS "${IE_PLUGINS_DECLARATIONS} + IE_DEFINE_PLUGIN_CREATE_FUNCTION_DECLARATION(${_IE_CREATE_PLUGIN_FUNC});") + if(${actual_dev_name}_AS_EXTENSION) + set(IE_PLUGINS_DECLARATIONS "${IE_PLUGINS_DECLARATIONS} + IE_DEFINE_EXTENSION_CREATE_FUNCTION_DECLARATION(${_IE_CREATE_EXTENSION_FUNC});") + else() + set(_IE_CREATE_EXTENSION_FUNC "nullptr") + endif() + + set(IE_PLUGINS_MAP_DEFINITION "${IE_PLUGINS_MAP_DEFINITION} { \"${mapped_dev_name}\", Value { ${_IE_CREATE_PLUGIN_FUNC}, ${_IE_CREATE_EXTENSION_FUNC}, ${dev_config} } },") + else() + set(IE_PLUGINS_MAP_DEFINITION "${IE_PLUGINS_MAP_DEFINITION} + { \"${mapped_dev_name}\", Value { \"${actual_dev_name}\", ${dev_config} } },") + endif() endforeach() set(IE_PLUGINS_MAP_DEFINITION "${IE_PLUGINS_MAP_DEFINITION} diff --git a/cmake/developer_package/plugins/plugins.cmake b/cmake/developer_package/plugins/plugins.cmake index b4cfe20bd02..7f00cc70269 100644 --- a/cmake/developer_package/plugins/plugins.cmake +++ b/cmake/developer_package/plugins/plugins.cmake @@ -113,7 +113,7 @@ function(ie_add_plugin) if(IE_PLUGIN_PSEUDO_DEVICE) set(plugin_hidden HIDDEN) endif() - ie_cpack_add_component(${install_component} + ie_cpack_add_component(${install_component} DISPLAY_NAME "${IE_PLUGIN_DEVICE_NAME} runtime" DESCRIPTION "${IE_PLUGIN_DEVICE_NAME} runtime" ${plugin_hidden} @@ -227,16 +227,18 @@ macro(ie_register_plugins_dynamic) # Combine all .xml files into plugins.xml - add_custom_command(TARGET ${IE_REGISTER_MAIN_TARGET} POST_BUILD - COMMAND - "${CMAKE_COMMAND}" - -D "CMAKE_SHARED_MODULE_PREFIX=${CMAKE_SHARED_MODULE_PREFIX}" - -D "IE_CONFIG_OUTPUT_FILE=${config_output_file}" - -D "IE_CONFIGS_DIR=${CMAKE_BINARY_DIR}/plugins" - -P "${IEDevScripts_DIR}/plugins/register_plugin_cmake.cmake" - COMMENT - "Registering plugins to plugins.xml config file" - VERBATIM) + if(ENABLE_PLUGINS_XML) + add_custom_command(TARGET ${IE_REGISTER_MAIN_TARGET} POST_BUILD + COMMAND + "${CMAKE_COMMAND}" + -D "CMAKE_SHARED_MODULE_PREFIX=${CMAKE_SHARED_MODULE_PREFIX}" + -D "IE_CONFIG_OUTPUT_FILE=${config_output_file}" + -D "IE_CONFIGS_DIR=${CMAKE_BINARY_DIR}/plugins" + -P "${IEDevScripts_DIR}/plugins/register_plugin_cmake.cmake" + COMMENT + "Registering plugins to plugins.xml config file" + VERBATIM) + endif() endmacro() # @@ -282,10 +284,6 @@ endfunction() # ie_generate_plugins_hpp() # function(ie_generate_plugins_hpp) - if(BUILD_SHARED_LIBS) - return() - endif() - set(device_mapping) set(device_configs) set(as_extension) @@ -296,17 +294,23 @@ function(ie_generate_plugins_hpp) message(FATAL_ERROR "Unexpected error, please, contact developer of this script") endif() - # create device mapping: preudo device => actual device + # create device mapping: pseudo device => actual device list(GET name 0 device_name) - if(${device_name}_PSEUDO_PLUGIN_FOR) - list(APPEND device_mapping "${device_name}:${${device_name}_PSEUDO_PLUGIN_FOR}") + if(BUILD_SHARED_LIBS) + list(GET name 1 library_name) + ie_plugin_get_file_name(${library_name} library_name) + list(APPEND device_mapping "${device_name}:${library_name}") else() - list(APPEND device_mapping "${device_name}:${device_name}") - endif() + if(${device_name}_PSEUDO_PLUGIN_FOR) + list(APPEND device_mapping "${device_name}:${${device_name}_PSEUDO_PLUGIN_FOR}") + else() + list(APPEND device_mapping "${device_name}:${device_name}") + endif() - # register plugin as extension - if(${device_name}_AS_EXTENSION) - list(APPEND as_extension -D "${device_name}_AS_EXTENSION=ON") + # register plugin as extension + if(${device_name}_AS_EXTENSION) + list(APPEND as_extension -D "${device_name}_AS_EXTENSION=ON") + endif() endif() # add default plugin config options @@ -330,6 +334,7 @@ function(ie_generate_plugins_hpp) COMMAND "${CMAKE_COMMAND}" -D "IE_DEVICE_MAPPING=${device_mapping}" + -D "OV_DYNAMIC=${BUILD_SHARED_LIBS}" -D "IE_PLUGINS_HPP_HEADER_IN=${plugins_hpp_in}" -D "IE_PLUGINS_HPP_HEADER=${ie_plugins_hpp}" ${device_configs} @@ -339,7 +344,7 @@ function(ie_generate_plugins_hpp) "${plugins_hpp_in}" "${IEDevScripts_DIR}/plugins/create_plugins_hpp.cmake" COMMENT - "Generate ie_plugins.hpp for static build" + "Generate ie_plugins.hpp for build" VERBATIM) # for some reason dependency on source files does not work diff --git a/cmake/developer_package/plugins/plugins.hpp.in b/cmake/developer_package/plugins/plugins.hpp.in index fa8119756b8..d351bcfb76f 100644 --- a/cmake/developer_package/plugins/plugins.hpp.in +++ b/cmake/developer_package/plugins/plugins.hpp.in @@ -4,6 +4,11 @@ #pragma once +#include +#include + +#ifdef OPENVINO_STATIC_LIBRARY + #include "cpp_interfaces/interface/ie_iplugin_internal.hpp" @IE_PLUGINS_DECLARATIONS@ @@ -14,10 +19,20 @@ struct Value { std::map m_default_config; }; +#else + +struct Value { + std::string m_plugin_path; + std::map m_default_config; +}; + +#endif + using Key = std::string; using PluginsStaticRegistry = std::map; -inline const std::map getStaticPluginsRegistry() { + +inline const std::map getCompiledPluginsRegistry() { @IE_PLUGINS_MAP_DEFINITION@ return plugins_hpp; } diff --git a/cmake/features.cmake b/cmake/features.cmake index 17c5ccc1b3c..24dfaef46e8 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -94,6 +94,8 @@ ie_option (ENABLE_HETERO "Enables Hetero Device Plugin" ON) ie_option (ENABLE_TEMPLATE "Enable template plugin" ON) +ie_dependent_option (ENABLE_PLUGINS_XML "Generate plugins.xml configuration file or not" OFF "NOT BUILD_SHARED_LIBS" OFF) + ie_dependent_option (GAPI_TEST_PERF "if GAPI unit tests should examine performance" OFF "ENABLE_TESTS;ENABLE_GAPI_PREPROCESSING" OFF) ie_dependent_option (ENABLE_DATA "fetch models from testdata repo" ON "ENABLE_FUNCTIONAL_TESTS;NOT ANDROID" OFF) diff --git a/cmake/templates/OpenVINODeveloperPackageConfig.cmake.in b/cmake/templates/OpenVINODeveloperPackageConfig.cmake.in index 24238be0604..d530ea36d1d 100644 --- a/cmake/templates/OpenVINODeveloperPackageConfig.cmake.in +++ b/cmake/templates/OpenVINODeveloperPackageConfig.cmake.in @@ -28,6 +28,9 @@ foreach(option IN LISTS ov_options) endforeach() message(" ") +# activate generation of plugins.xml +set(ENABLE_PLUGINS_XML ON) + # for samples in 3rd party projects if(ENABLE_SAMPLES) set_and_check(gflags_DIR "@gflags_BINARY_DIR@") diff --git a/src/cmake/openvino.cmake b/src/cmake/openvino.cmake index 7870e2963e3..0a0b9f9d189 100644 --- a/src/cmake/openvino.cmake +++ b/src/cmake/openvino.cmake @@ -131,7 +131,7 @@ ie_cpack_add_component(${OV_CPACK_COMP_CORE_DEV} HIDDEN DEPENDS ${OV_CPACK_COMP_CORE} ${core_dev_components}) -if(BUILD_SHARED_LIBS) +if(ENABLE_PLUGINS_XML) install(FILES $/plugins.xml DESTINATION ${OV_CPACK_PLUGINSDIR} COMPONENT ${OV_CPACK_COMP_CORE}) diff --git a/src/common/util/CMakeLists.txt b/src/common/util/CMakeLists.txt index a589c283390..160be0259b8 100644 --- a/src/common/util/CMakeLists.txt +++ b/src/common/util/CMakeLists.txt @@ -24,6 +24,13 @@ endif() # Create named folders for the sources within the .vcproj # Empty name lists them directly under the .vcproj +set(MIXED_SRC + "${CMAKE_CURRENT_SOURCE_DIR}/src/file_util.cpp") + +set_property(SOURCE ${MIXED_SRC} + APPEND PROPERTY INCLUDE_DIRECTORIES + $) + source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) diff --git a/src/common/util/include/openvino/util/file_util.hpp b/src/common/util/include/openvino/util/file_util.hpp index 00d8dbe073c..ccf8ed4e46c 100644 --- a/src/common/util/include/openvino/util/file_util.hpp +++ b/src/common/util/include/openvino/util/file_util.hpp @@ -260,6 +260,14 @@ inline std::basic_string make_plugin_library_name(const std::basic_string& */ FilePath get_plugin_path(const std::string& plugin); +/** + * @brief Find the plugins which are located together with OV library + * @param plugin - Path (absolute or relative) or name of a plugin. Depending on platform, `plugin` is wrapped with + * shared library suffix and prefix to identify library full name + * @return absolute path or file name with extension (to be found in ENV) + */ +FilePath get_compiled_plugin_path(const std::string& plugin); + /** * @brief Format plugin path (canonicalize, complete to absolute or complete to file name) for further * dynamic loading by OS diff --git a/src/common/util/src/file_util.cpp b/src/common/util/src/file_util.cpp index bcbd3fe2f90..f39f2dd3c67 100644 --- a/src/common/util/src/file_util.cpp +++ b/src/common/util/src/file_util.cpp @@ -12,6 +12,7 @@ #include #include +#include "openvino/core/version.hpp" #include "openvino/util/common_util.hpp" #ifdef _WIN32 @@ -504,6 +505,37 @@ ov::util::FilePath ov::util::get_plugin_path(const std::string& plugin) { return ov::util::to_file_path(lib_name); } +ov::util::FilePath ov::util::get_compiled_plugin_path(const std::string& plugin) { + const auto ov_library_path = get_ov_lib_path(); + + // plugin can be found either: + + // 1. in openvino-X.Y.Z folder relative to libopenvino.so + std::ostringstream str; + str << "openvino-" << OPENVINO_VERSION_MAJOR << "." << OPENVINO_VERSION_MINOR << "." << OPENVINO_VERSION_PATCH; + const auto sub_folder = str.str(); + + std::string abs_file_path = ov::util::path_join({ov_library_path, sub_folder, plugin}); + if (ov::util::file_exists(abs_file_path)) + return ov::util::to_file_path(abs_file_path); + + // 2. in the openvino.so location + abs_file_path = ov::util::path_join({ov_library_path, plugin}); + if (ov::util::file_exists(abs_file_path)) + return ov::util::to_file_path(abs_file_path); + + auto lib_name = plugin; + // For 3rd case - convert to 4th case + if (!ov::util::ends_with(plugin, ov::util::FileTraits::library_ext())) + lib_name = ov::util::make_plugin_library_name({}, plugin); + + // For 4th case + auto lib_path = ov::util::to_file_path(ov::util::get_absolute_file_path(lib_name)); + if (ov::util::file_exists(lib_path)) + return lib_path; + return ov::util::to_file_path(lib_name); +} + ov::util::FilePath ov::util::get_plugin_path(const std::string& plugin, const std::string& xml_path, bool as_abs_only) { // Assume `plugin` (from XML "location" record) contains only: // 1. /path/to/libexample.so absolute path diff --git a/src/inference/src/core.cpp b/src/inference/src/core.cpp index 0a2fba9072b..fef2652b275 100644 --- a/src/inference/src/core.cpp +++ b/src/inference/src/core.cpp @@ -9,13 +9,10 @@ #include "dev/converter_utils.hpp" #include "dev/core_impl.hpp" #include "ie_itt.hpp" +#include "ie_plugins.hpp" #include "openvino/runtime/device_id_parser.hpp" #include "so_extension.hpp" -#ifdef OPENVINO_STATIC_LIBRARY -# include "ie_plugins.hpp" -#endif - namespace { std::string resolve_extension_path(const std::string& path) { std::string retvalue; @@ -32,8 +29,6 @@ std::string resolve_extension_path(const std::string& path) { namespace ov { -#ifndef OPENVINO_STATIC_LIBRARY - std::string findPluginXML(const std::string& xmlFile) { std::string xmlConfigFile_ = xmlFile; if (xmlConfigFile_.empty()) { @@ -56,14 +51,10 @@ std::string findPluginXML(const std::string& xmlFile) { xmlConfigFileDefault = FileUtils::makePath(ielibraryDir, ov::util::to_file_path("plugins.xml")); if (FileUtils::fileExist(xmlConfigFileDefault)) return xmlConfigFile_ = ov::util::from_file_path(xmlConfigFileDefault); - - OPENVINO_THROW("Failed to find plugins.xml file"); } return xmlConfigFile_; } -#endif // OPENVINO_STATIC_LIBRARY - #define OV_CORE_CALL_STATEMENT(...) \ try { \ __VA_ARGS__; \ @@ -81,13 +72,13 @@ public: Core::Core(const std::string& xml_config_file) { _impl = std::make_shared(); -#ifdef OPENVINO_STATIC_LIBRARY - OV_CORE_CALL_STATEMENT(_impl->register_plugins_in_registry(::getStaticPluginsRegistry());) -#else - OV_CORE_CALL_STATEMENT( - // If XML is default, load default plugins by absolute paths - _impl->register_plugins_in_registry(findPluginXML(xml_config_file), xml_config_file.empty());) -#endif + std::string xmlConfigFile = ov::findPluginXML(xml_config_file); + if (!xmlConfigFile.empty()) + OV_CORE_CALL_STATEMENT( + // If XML is default, load default plugins by absolute paths + _impl->register_plugins_in_registry(xmlConfigFile, xml_config_file.empty());) + // Load plugins from the pre-compiled list + OV_CORE_CALL_STATEMENT(_impl->register_compile_time_plugins();) } std::map Core::get_versions(const std::string& device_name) const { diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp index ed39bc67f1f..d97a89f8f79 100644 --- a/src/inference/src/dev/core_impl.cpp +++ b/src/inference/src/dev/core_impl.cpp @@ -34,6 +34,7 @@ #include "openvino/runtime/remote_context.hpp" #include "openvino/runtime/threading/executor_manager.hpp" #include "openvino/util/common_util.hpp" +#include "openvino/util/file_util.hpp" #include "openvino/util/shared_object.hpp" #include "preprocessing/preprocessing.hpp" #include "xml_parse_utils.h" @@ -311,6 +312,39 @@ ov::CoreImpl::CoreImpl(bool _newAPI) : m_new_api(_newAPI) { } } +void ov::CoreImpl::register_compile_time_plugins() { + std::lock_guard lock(get_mutex()); + + const decltype(::getCompiledPluginsRegistry())& plugins = getCompiledPluginsRegistry(); +#ifdef OPENVINO_STATIC_LIBRARY + for (const auto& plugin : plugins) { + const auto& deviceName = plugin.first; + if (deviceName.find('.') != std::string::npos) { + OPENVINO_THROW("Device name must not contain dot '.' symbol"); + } + if (pluginRegistry.find(deviceName) == pluginRegistry.end()) { + const auto& value = plugin.second; + ov::AnyMap config = any_copy(value.m_default_config); + PluginDescriptor desc{value.m_create_plugin_func, config, value.m_create_extension_func}; + pluginRegistry[deviceName] = desc; + add_mutex(deviceName); + } + } +#else + for (const auto& plugin : plugins) { + const auto& deviceName = plugin.first; + const auto& pluginPath = ov::util::get_compiled_plugin_path(plugin.second.m_plugin_path); + + if (pluginRegistry.find(deviceName) == pluginRegistry.end() && ov::util::file_exists(pluginPath)) { + ov::AnyMap config = any_copy(plugin.second.m_default_config); + PluginDescriptor desc{pluginPath, config}; + pluginRegistry[deviceName] = desc; + add_mutex(deviceName); + } + } +#endif +} + void ov::CoreImpl::register_plugins_in_registry(const std::string& xml_config_file, const bool& by_abs_path) { std::lock_guard lock(get_mutex()); diff --git a/src/inference/src/dev/core_impl.hpp b/src/inference/src/dev/core_impl.hpp index 2277d70b9d0..8fe7768dc6c 100644 --- a/src/inference/src/dev/core_impl.hpp +++ b/src/inference/src/dev/core_impl.hpp @@ -15,6 +15,7 @@ #include "ie_cache_manager.hpp" #include "ie_extension.h" #include "ie_icore.hpp" +#include "ie_plugins.hpp" #include "multi-device/multi_device_config.hpp" #include "openvino/core/any.hpp" #include "openvino/core/extension.hpp" @@ -22,10 +23,7 @@ #include "openvino/runtime/common.hpp" #include "openvino/runtime/icompiled_model.hpp" #include "openvino/runtime/threading/executor_manager.hpp" - -#ifdef OPENVINO_STATIC_LIBRARY -# include "ie_plugins.hpp" -#endif +#include "openvino/util/file_util.hpp" namespace ov { @@ -48,16 +46,13 @@ Parsed parseDeviceNameIntoConfig(const std::string& deviceName, const AnyMap& co * * @param device_name Target device * @param device_name_to_parse Device ID of property - * @return true if ov::device::properties(, ...) is applicable for device identified by 'device_name + * @return true if ov::device::properties(, ...) is applicable for device identified by + * 'device_name */ bool is_config_applicable(const std::string& device_name, const std::string& device_name_to_parse); -#ifndef OPENVINO_STATIC_LIBRARY - std::string findPluginXML(const std::string& xmlFile); -#endif - class CoreImpl : public InferenceEngine::ICore, public std::enable_shared_from_this { private: mutable std::map plugins; @@ -94,8 +89,7 @@ private: // Creating thread-safe copy of config including shared_ptr to ICacheManager // Passing empty or not-existing name will return global cache config - CacheConfig get_cache_config_for_device(const ov::Plugin& plugin, - ov::AnyMap& parsedConfig) const; + CacheConfig get_cache_config_for_device(const ov::Plugin& plugin, ov::AnyMap& parsedConfig) const; private: mutable std::mutex _cacheConfigMutex; @@ -158,16 +152,17 @@ private: const bool m_new_api; ov::SoPtr compile_model_and_cache(const std::shared_ptr& model, - ov::Plugin& plugin, - const ov::AnyMap& parsedConfig, - const ov::RemoteContext& context, - const CacheContent& cacheContent) const; + ov::Plugin& plugin, + const ov::AnyMap& parsedConfig, + const ov::RemoteContext& context, + const CacheContent& cacheContent) const; - static ov::SoPtr load_model_from_cache(const CacheContent& cacheContent, - ov::Plugin& plugin, - const ov::AnyMap& config, - const ov::RemoteContext& context, - std::function()> compile_model_lambda); + static ov::SoPtr load_model_from_cache( + const CacheContent& cacheContent, + ov::Plugin& plugin, + const ov::AnyMap& config, + const ov::RemoteContext& context, + std::function()> compile_model_lambda); bool device_supports_import_export(const ov::Plugin& plugin) const; @@ -177,12 +172,11 @@ private: bool device_supports_cache_dir(const ov::Plugin& plugin) const; ov::SoPtr compile_model_with_preprocess(ov::Plugin& plugin, - const std::shared_ptr& model, - const ov::RemoteContext& context, - const ov::AnyMap& config) const; + const std::shared_ptr& model, + const ov::RemoteContext& context, + const ov::AnyMap& config) const; - ov::AnyMap create_compile_config(const ov::Plugin& plugin, - const ov::AnyMap& origConfig) const; + ov::AnyMap create_compile_config(const ov::Plugin& plugin, const ov::AnyMap& origConfig) const; // Legacy API void AddExtensionUnsafe(const InferenceEngine::IExtensionPtr& extension) const; @@ -218,30 +212,10 @@ public: std::string& deviceName, ov::AnyMap& config) const; -#ifdef OPENVINO_STATIC_LIBRARY - - /** - * @brief Register plugins for devices using statically defined configuration - * @note The function supports UNICODE path - * @param static_registry a statically defined configuration with device / plugin information + /* + * @brief Register plugins according to the build configuration */ - void register_plugins_in_registry(const decltype(::getStaticPluginsRegistry())& static_registry) { - std::lock_guard lock(get_mutex()); - - for (const auto& plugin : static_registry) { - const auto& deviceName = plugin.first; - if (deviceName.find('.') != std::string::npos) { - IE_THROW() << "Device name must not contain dot '.' symbol"; - } - const auto& value = plugin.second; - ov::AnyMap config = any_copy(value.m_default_config); - PluginDescriptor desc{value.m_create_plugin_func, config, value.m_create_extension_func}; - pluginRegistry[deviceName] = desc; - add_mutex(deviceName); - } - } - -#endif + void register_compile_time_plugins(); // // ICore public API diff --git a/src/inference/src/ie_core.cpp b/src/inference/src/ie_core.cpp index cc138a0f13d..de604f6fab4 100644 --- a/src/inference/src/ie_core.cpp +++ b/src/inference/src/ie_core.cpp @@ -30,6 +30,7 @@ #include "ie_network_reader.hpp" #include "ie_ngraph_utils.hpp" #include "ie_plugin_config.hpp" +#include "ie_plugins.hpp" #include "ie_remote_context.hpp" #include "ngraph/graph_util.hpp" #include "ngraph/ngraph.hpp" @@ -47,10 +48,6 @@ #include "so_extension.hpp" #include "xml_parse_utils.h" -#ifdef OPENVINO_STATIC_LIBRARY -# include "ie_plugins.hpp" -#endif - using namespace InferenceEngine::PluginConfigParams; using namespace InferenceEngine; using namespace std::placeholders; @@ -91,13 +88,12 @@ public: Core::Core(const std::string& xmlConfigFile) { _impl = std::make_shared(); -#ifdef OPENVINO_STATIC_LIBRARY - _impl->register_plugins_in_registry(::getStaticPluginsRegistry()); -#else - // If XML is default, load default plugins by absolute paths - auto loadByAbsPath = xmlConfigFile.empty(); - _impl->register_plugins_in_registry(ov::findPluginXML(xmlConfigFile), loadByAbsPath); -#endif + std::string xmlConfigFile_ = ov::findPluginXML(xmlConfigFile); + if (!xmlConfigFile_.empty()) + // If XML is default, load default plugins by absolute paths + _impl->register_plugins_in_registry(xmlConfigFile_, xmlConfigFile.empty()); + // Load plugins from pre-compiled list + _impl->register_compile_time_plugins(); } std::map Core::GetVersions(const std::string& deviceName) const {