Skip to content

Commit

Permalink
[Remove 1.0 API] remove add_extension with 1.0 (openvinotoolkit#22273)
Browse files Browse the repository at this point in the history
* [Remove 1.0 API] remove add_extension with 1.0

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

* Fix format issue

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

---------

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>
Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
  • Loading branch information
zhaixuejun1993 and ilya-lavrenov authored Jan 22, 2024
1 parent 0ccfb6c commit 7946e43
Show file tree
Hide file tree
Showing 15 changed files with 7 additions and 236 deletions.
11 changes: 0 additions & 11 deletions src/inference/dev_api/openvino/runtime/iplugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,6 @@ class OPENVINO_RUNTIME_API IPlugin : public std::enable_shared_from_this<IPlugin
virtual ov::SupportedOpsMap query_model(const std::shared_ptr<const ov::Model>& model,
const ov::AnyMap& properties) const = 0;

OPENVINO_SUPPRESS_DEPRECATED_START
/**
* @deprecated This method allows to load legacy Inference Engine Extensions and will be removed in 2024.0 release
* @brief Registers legacy extension within plugin
* @param extension - pointer to already loaded legacy extension
*/
OPENVINO_DEPRECATED(
"This method allows to load legacy Inference Engine Extensions and will be removed in 2024.0 release")
virtual void add_extension(const std::shared_ptr<InferenceEngine::IExtension>& extension);
OPENVINO_SUPPRESS_DEPRECATED_END

/**
* @brief Sets pointer to ICore interface
* @param core Pointer to Core interface
Expand Down
14 changes: 0 additions & 14 deletions src/inference/include/ie/ie_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,6 @@ class INFERENCE_ENGINE_1_0_DEPRECATED INFERENCE_ENGINE_API_CLASS(Core) {
const std::string& deviceName,
const std::map<std::string, std::string>& config = {});

/**
* @brief Registers extension
* @param extension Pointer to already loaded extension
*/
void AddExtension(const IExtensionPtr& extension);

/**
* @brief Registers extension for the specified plugin
*
* @param extension Pointer to already loaded extension
* @param deviceName Device name to identify plugin to add an executable extension
*/
void AddExtension(IExtensionPtr extension, const std::string& deviceName);

/**
* @brief Creates an executable network from a previously exported network
*
Expand Down
10 changes: 0 additions & 10 deletions src/inference/include/openvino/runtime/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,16 +359,6 @@ class OPENVINO_RUNTIME_API Core {
return compile_model(model, context, AnyMap{std::forward<Properties>(properties)...});
}

OPENVINO_SUPPRESS_DEPRECATED_START
/**
* @deprecated This method is deprecated. Please use other Core::add_extension methods.
* @brief Registers OpenVINO 1.0 extension to a Core object.
* @param extension Pointer to the already loaded extension.
*/
OPENVINO_DEPRECATED("Please use add_extension(ov::Extension) or add_extension(path_to_library) instead.")
void add_extension(const std::shared_ptr<InferenceEngine::IExtension>& extension);
OPENVINO_SUPPRESS_DEPRECATED_END

/**
* @brief Registers an extension to a Core object.
* @param library_path Path to the library with ov::Extension.
Expand Down
33 changes: 7 additions & 26 deletions src/inference/src/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,42 +146,23 @@ CompiledModel Core::compile_model(const std::shared_ptr<const ov::Model>& model,
});
}

void Core::add_extension(const InferenceEngine::IExtensionPtr& extension) {
OV_CORE_CALL_STATEMENT(_impl->AddExtension(extension););
}

void Core::add_extension(const std::string& library_path) {
try {
add_extension(ov::detail::load_extensions(library_path));
} catch (const std::runtime_error&) {
try {
// Try to load legacy extension
const auto extension_ptr = std::make_shared<InferenceEngine::Extension>(library_path);
OPENVINO_SUPPRESS_DEPRECATED_START
add_extension(extension_ptr);
OPENVINO_SUPPRESS_DEPRECATED_END
} catch (const std::runtime_error& e) {
OPENVINO_THROW(
std::string(
"Cannot add extension. Cannot find entry point to the extension library. This error happened: ") +
e.what());
}
} catch (const std::runtime_error& e) {
OPENVINO_THROW(
std::string(
"Cannot add extension. Cannot find entry point to the extension library. This error happened: ") +
e.what());
}
}

#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
void Core::add_extension(const std::wstring& library_path) {
try {
add_extension(ov::detail::load_extensions(library_path));
} catch (const std::runtime_error&) {
try {
// Try to load legacy extension
const auto extension_ptr = std::make_shared<InferenceEngine::Extension>(library_path);
OPENVINO_SUPPRESS_DEPRECATED_START
add_extension(extension_ptr);
OPENVINO_SUPPRESS_DEPRECATED_END
} catch (const std::runtime_error&) {
OPENVINO_THROW("Cannot add extension. Cannot find entry point to the extension library");
}
OPENVINO_THROW("Cannot add extension. Cannot find entry point to the extension library");
}
}
#endif
Expand Down
4 changes: 0 additions & 4 deletions src/inference/src/dev/converter_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,6 @@ class IInferencePluginWrapper : public InferenceEngine::IInferencePlugin {
m_plugin._so);
}

void AddExtension(const std::shared_ptr<InferenceEngine::IExtension>& extension) override {
m_plugin->add_extension(extension);
}

void SetConfig(const std::map<std::string, std::string>& config) override {
m_plugin->set_property(ov::any_copy(config));
}
Expand Down
33 changes: 0 additions & 33 deletions src/inference/src/dev/core_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,14 +601,6 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {
plugin.set_core(mutableCore);
}

// Add registered extensions to new plugin
allowNotImplemented([&]() {
auto old_extensions = ov::legacy_convert::convert_extension(extensions);
for (const auto& ext : old_extensions) {
plugin.add_extension(ext);
}
});

// configuring
{
#ifdef PROXY_PLUGIN_ENABLED
Expand Down Expand Up @@ -691,12 +683,6 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {
// set global device-id independent settings to plugin
plugin.set_property(desc.defaultConfig);
});

allowNotImplemented([&]() {
for (auto&& extensionLocation : desc.listOfExtentions) {
plugin.add_extension(std::make_shared<InferenceEngine::Extension>(extensionLocation));
}
});
}

// add plugin as extension itself
Expand All @@ -711,7 +697,6 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {
// the same extension can be registered multiple times - ignore it!
}
} else {
TryToRegisterLibraryAsExtensionUnsafe(desc.libraryLocation);
try_to_register_plugin_extensions(desc.libraryLocation);
}

Expand Down Expand Up @@ -1558,24 +1543,6 @@ ov::AnyMap ov::CoreImpl::create_compile_config(const ov::Plugin& plugin, const o
return compile_config;
}

void ov::CoreImpl::AddExtensionUnsafe(const InferenceEngine::IExtensionPtr& extension) const {
std::map<std::string, ngraph::OpSet> opsets = extension->getOpSets();
for (const auto& it : opsets) {
if (opsetNames.find(it.first) != opsetNames.end())
IE_THROW() << "Cannot add opset with name: " << it.first << ". Opset with the same name already exists.";
opsetNames.insert(it.first);
}

// add extensions for already created plugins
for (auto& plugin : plugins) {
allowNotImplemented([&]() {
plugin.second.add_extension(extension);
});
}
for (const auto& ext : ov::legacy_convert::convert_extension({extension}))
extensions.emplace_back(ext);
}

void ov::CoreImpl::CoreConfig::set_and_update(ov::AnyMap& config) {
auto it = config.find(ov::cache_dir.name());
if (it != config.end()) {
Expand Down
16 changes: 0 additions & 16 deletions src/inference/src/dev/core_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,6 @@ class CoreImpl : public InferenceEngine::ICore, public std::enable_shared_from_t
void add_extensions_unsafe(const std::vector<ov::Extension::Ptr>& extensions) const;

// Legacy API
void AddExtensionUnsafe(const InferenceEngine::IExtensionPtr& extension) const;
template <typename C, typename = FileUtils::enableIfSupportedChar<C>>
void TryToRegisterLibraryAsExtensionUnsafe(const std::basic_string<C>& path) const {
try {
const auto extension_ptr = std::make_shared<InferenceEngine::Extension>(path);
AddExtensionUnsafe(extension_ptr);
} catch (const InferenceEngine::GeneralError&) {
// in case of shared library is not opened
}
}
ov::SoPtr<InferenceEngine::IExecutableNetworkInternal> LoadNetworkImpl(
const InferenceEngine::CNNNetwork& model,
ov::Plugin& plugin,
Expand Down Expand Up @@ -286,12 +276,6 @@ class CoreImpl : public InferenceEngine::ICore, public std::enable_shared_from_t
std::map<std::string, std::string> GetSupportedConfig(const std::string& deviceName,
const std::map<std::string, std::string>& configs) override;

/**
* @brief Registers the extension in a Core object
* Such extensions can be used for both CNNNetwork readers and device plugins
*/
void AddExtension(const InferenceEngine::IExtensionPtr& extension);

bool DeviceSupportsModelCaching(const std::string& deviceName) const override;

std::map<std::string, InferenceEngine::Version> GetVersions(const std::string& deviceName) const;
Expand Down
9 changes: 0 additions & 9 deletions src/inference/src/dev/core_impl_ie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,6 @@ std::vector<std::string> ov::CoreImpl::GetAvailableDevices() const {
return get_available_devices();
}

/**
* @brief Registers the extension in a Core object
* Such extensions can be used for both CNNNetwork readers and device plugins
*/
void ov::CoreImpl::AddExtension(const InferenceEngine::IExtensionPtr& extension) {
std::lock_guard<std::mutex> lock(get_mutex());
AddExtensionUnsafe(extension);
}

bool ov::CoreImpl::DeviceSupportsModelCaching(const std::string& deviceName) const {
return device_supports_model_caching(deviceName);
}
Expand Down
4 changes: 0 additions & 4 deletions src/inference/src/dev/iplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ const std::string& ov::IPlugin::get_device_name() const {
return m_plugin_name;
}

void ov::IPlugin::add_extension(const std::shared_ptr<InferenceEngine::IExtension>& extension) {
OPENVINO_NOT_IMPLEMENTED;
}

void ov::IPlugin::set_core(const std::weak_ptr<ov::ICore>& core) {
OPENVINO_ASSERT(!core.expired());
m_core = core;
Expand Down
4 changes: 0 additions & 4 deletions src/inference/src/dev/iplugin_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ ov::SupportedOpsMap IPluginWrapper::query_model(const std::shared_ptr<const ov::
return res.supportedLayersMap;
}

void IPluginWrapper::add_extension(const std::shared_ptr<InferenceEngine::IExtension>& extension) {
m_old_plugin->AddExtension(extension);
}

const std::shared_ptr<InferenceEngine::IInferencePlugin>& IPluginWrapper::get_plugin() const {
return m_old_plugin;
}
Expand Down
7 changes: 0 additions & 7 deletions src/inference/src/dev/iplugin_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,6 @@ class IPluginWrapper : public ov::IPlugin {
ov::SupportedOpsMap query_model(const std::shared_ptr<const ov::Model>& model,
const ov::AnyMap& properties) const override;

/**
* @brief Register legacy Inference Engine Extension for the plugin
*
* @param extension legacy Inference Engine Extension
*/
void add_extension(const std::shared_ptr<InferenceEngine::IExtension>& extension) override;

/**
* @brief Returns the instance of the legacy plugin
*
Expand Down
6 changes: 0 additions & 6 deletions src/inference/src/dev/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ const ov::Version ov::Plugin::get_version() const {
OV_PLUGIN_CALL_STATEMENT(return m_ptr->get_version());
}

void ov::Plugin::add_extension(const InferenceEngine::IExtensionPtr& extension) {
OPENVINO_SUPPRESS_DEPRECATED_START
OV_PLUGIN_CALL_STATEMENT(m_ptr->add_extension(extension));
OPENVINO_SUPPRESS_DEPRECATED_END
}

void ov::Plugin::set_property(const ov::AnyMap& config) {
OV_PLUGIN_CALL_STATEMENT(m_ptr->set_property(config));
}
Expand Down
2 changes: 0 additions & 2 deletions src/inference/src/dev/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class Plugin {

const ov::Version get_version() const;

void add_extension(const InferenceEngine::IExtensionPtr& extension);

void set_property(const ov::AnyMap& config);

SoPtr<ov::ICompiledModel> compile_model(const std::shared_ptr<const ov::Model>& model,
Expand Down
26 changes: 0 additions & 26 deletions src/inference/src/ie_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,32 +174,6 @@ ExecutableNetwork Core::LoadNetwork(const std::string& modelPath, const std::map
}
}

void Core::AddExtension(IExtensionPtr extension, const std::string& deviceName_) {
if (deviceName_.find("HETERO") == 0) {
IE_THROW() << "HETERO device does not support extensions. Please, set extensions directly to fallback devices";
}
if (deviceName_.find("MULTI") == 0) {
IE_THROW() << "MULTI device does not support extensions. Please, set extensions directly to fallback devices";
}
if (deviceName_.find("AUTO") == 0) {
IE_THROW() << "AUTO device does not support extensions. Please, set extensions directly to fallback devices";
}

try {
_impl->AddExtension(extension);
} catch (const ov::Exception& ex) {
IE_THROW() << ex.what();
}
}

void Core::AddExtension(const IExtensionPtr& extension) {
try {
_impl->AddExtension(extension);
} catch (const ov::Exception& ex) {
IE_THROW() << ex.what();
}
}

ExecutableNetwork Core::ImportNetwork(const std::string& modelFileName,
const std::string& deviceName,
const std::map<std::string, std::string>& config) {
Expand Down
64 changes: 0 additions & 64 deletions src/inference/tests/functional/legacy/ov_extension_test.cpp

This file was deleted.

0 comments on commit 7946e43

Please sign in to comment.