From 7ff9f80c68ffc949d85c8b479076b0c6413ef926 Mon Sep 17 00:00:00 2001 From: Ilya Churaev Date: Sat, 21 Jan 2023 04:30:38 +0400 Subject: [PATCH] Remove plugin.hpp (#15229) --- src/core/include/openvino/core/any.hpp | 2 - src/inference/src/core.cpp | 1 - src/inference/src/cpp/ie_plugin.hpp | 139 ------------------ src/inference/src/dev/converter_utils.cpp | 1 - src/inference/src/dev/core_impl.cpp | 1 - src/inference/src/dev/iplugin_wrapper.hpp | 2 +- src/inference/src/ie_core.cpp | 1 - .../tests/functional/caching_test.cpp | 1 - .../functional/ov_shared_object_test.cpp | 3 +- .../functional/shared_object_loader_test.cpp | 3 +- .../ie_infer_async_request_base_test.cpp | 13 +- .../ie_memory_state_internal_test.cpp | 9 +- .../unit/cpp_interfaces/ie_plugin_test.cpp | 26 ---- .../tests/unit/ie_executable_network_test.cpp | 9 +- src/tests/unit/auto/auto_ctput_test.cpp | 13 +- .../unit/auto/auto_default_perf_hint_test.cpp | 15 +- .../auto_load_network_properties_test.cpp | 13 +- .../unit/auto/auto_release_helper_test.cpp | 1 - .../auto/auto_select_device_failed_test.cpp | 8 +- .../unit/auto/exec_network_get_metrics.cpp | 18 ++- src/tests/unit/auto/get_device_list.cpp | 1 - .../unit/auto/key_network_priority_test.cpp | 1 - .../unit/auto/parse_meta_device_test.cpp | 1 - src/tests/unit/auto/select_device_test.cpp | 1 - 24 files changed, 55 insertions(+), 228 deletions(-) delete mode 100644 src/inference/src/cpp/ie_plugin.hpp diff --git a/src/core/include/openvino/core/any.hpp b/src/core/include/openvino/core/any.hpp index e93eb05537c..17a07ed9c10 100644 --- a/src/core/include/openvino/core/any.hpp +++ b/src/core/include/openvino/core/any.hpp @@ -21,7 +21,6 @@ #include "openvino/core/runtime_attribute.hpp" namespace InferenceEngine { -struct InferencePlugin; class ExecutableNetwork; } // namespace InferenceEngine @@ -627,7 +626,6 @@ class OPENVINO_API Any { }; friend class ::ov::RuntimeAttribute; - friend struct ::InferenceEngine::InferencePlugin; friend class ::InferenceEngine::ExecutableNetwork; friend class ::ov::CompiledModel; friend class ::ov::RemoteContext; diff --git a/src/inference/src/core.cpp b/src/inference/src/core.cpp index 4463addfc7f..72f2a84cea8 100644 --- a/src/inference/src/core.cpp +++ b/src/inference/src/core.cpp @@ -6,7 +6,6 @@ #include "any_copy.hpp" #include "cnn_network_ngraph_impl.hpp" -#include "cpp/ie_plugin.hpp" #include "dev/converter_utils.hpp" #include "dev/core_impl.hpp" #include "ie_itt.hpp" diff --git a/src/inference/src/cpp/ie_plugin.hpp b/src/inference/src/cpp/ie_plugin.hpp deleted file mode 100644 index ca6991102f1..00000000000 --- a/src/inference/src/cpp/ie_plugin.hpp +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -/** - * @brief This is a header file for the Inference Engine plugin C++ API - * - * @file ie_plugin_cpp.hpp - */ -#pragma once - -#include -#include -#include - -#include "any_copy.hpp" -#include "cpp/exception2status.hpp" -#include "cpp/ie_cnn_network.h" -#include "cpp_interfaces/interface/ie_iplugin_internal.hpp" -#include "file_utils.h" -#include "ie_plugin_config.hpp" -#include "openvino/runtime/common.hpp" -#include "so_ptr.hpp" - -#if defined __GNUC__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wreturn-type" -#endif - -#define PLUGIN_CALL_STATEMENT(...) \ - if (!_ptr) \ - IE_THROW() << "Wrapper used in the PLUGIN_CALL_STATEMENT was not initialized."; \ - try { \ - __VA_ARGS__; \ - } catch (...) { \ - ::InferenceEngine::details::Rethrow(); \ - } - -namespace InferenceEngine { -/** - * @brief This class is a C++ API wrapper for IInferencePlugin. - * - * It can throw exceptions safely for the application, where it is properly handled. - */ -struct InferencePlugin { - std::shared_ptr _ptr; - std::shared_ptr _so; - - ~InferencePlugin() { - _ptr = {}; - } - - void SetName(const std::string& deviceName) { - PLUGIN_CALL_STATEMENT(_ptr->SetName(deviceName)); - } - - void SetCore(std::weak_ptr core) { - PLUGIN_CALL_STATEMENT(_ptr->SetCore(core)); - } - - const Version GetVersion() const { - PLUGIN_CALL_STATEMENT(return _ptr->GetVersion()); - } - - void AddExtension(const InferenceEngine::IExtensionPtr& extension) { - PLUGIN_CALL_STATEMENT(_ptr->AddExtension(extension)); - } - - void SetConfig(const std::map& config) { - PLUGIN_CALL_STATEMENT(_ptr->SetConfig(config)); - } - - ov::SoPtr LoadNetwork(const CNNNetwork& network, - const std::map& config) { - PLUGIN_CALL_STATEMENT(return {_ptr->LoadNetwork(network, config), _so}); - } - - ov::SoPtr LoadNetwork(const CNNNetwork& network, - const std::shared_ptr& context, - const std::map& config) { - PLUGIN_CALL_STATEMENT(return {_ptr->LoadNetwork(network, config, context), _so}); - } - - ov::SoPtr LoadNetwork(const std::string& modelPath, - const std::map& config) { - ov::SoPtr res; - PLUGIN_CALL_STATEMENT(res = _ptr->LoadNetwork(modelPath, config)); - if (!res._so) - res._so = _so; - return res; - } - - QueryNetworkResult QueryNetwork(const CNNNetwork& network, const std::map& config) const { - QueryNetworkResult res; - PLUGIN_CALL_STATEMENT(res = _ptr->QueryNetwork(network, config)); - if (res.rc != OK) - IE_THROW() << res.resp.msg; - return res; - } - - ov::SoPtr ImportNetwork(const std::string& modelFileName, - const std::map& config) { - PLUGIN_CALL_STATEMENT(return {_ptr->ImportNetwork(modelFileName, config), _so}); - } - - ov::SoPtr ImportNetwork(std::istream& networkModel, - const std::map& config) { - PLUGIN_CALL_STATEMENT(return {_ptr->ImportNetwork(networkModel, config), _so}); - } - - ov::SoPtr ImportNetwork(std::istream& networkModel, - const std::shared_ptr& context, - const std::map& config) { - PLUGIN_CALL_STATEMENT(return {_ptr->ImportNetwork(networkModel, context, config), _so}); - } - - Parameter GetMetric(const std::string& name, const std::map& options) const { - PLUGIN_CALL_STATEMENT(return {_ptr->GetMetric(name, options), {_so}}); - } - - ov::SoPtr CreateContext(const ParamMap& params) { - PLUGIN_CALL_STATEMENT(return {_ptr->CreateContext(params), {_so}}); - } - - ov::SoPtr GetDefaultContext(const ParamMap& params) { - PLUGIN_CALL_STATEMENT(return {_ptr->GetDefaultContext(params), {_so}}); - } - - Parameter GetConfig(const std::string& name, const std::map& options) const { - PLUGIN_CALL_STATEMENT(return {_ptr->GetConfig(name, options), {_so}}); - } -}; -} // namespace InferenceEngine - -#if defined __GNUC__ -# pragma GCC diagnostic pop -#endif - -#undef PLUGIN_CALL_STATEMENT diff --git a/src/inference/src/dev/converter_utils.cpp b/src/inference/src/dev/converter_utils.cpp index cc884a8e43d..dce19714d08 100644 --- a/src/inference/src/dev/converter_utils.cpp +++ b/src/inference/src/dev/converter_utils.cpp @@ -21,7 +21,6 @@ #include "any_copy.hpp" #include "cnn_network_ngraph_impl.hpp" -#include "cpp/ie_plugin.hpp" #include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp" #include "cpp_interfaces/interface/ie_iplugin_internal.hpp" #include "ie_icore.hpp" diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp index 0a0142155b9..bb958e7823b 100644 --- a/src/inference/src/dev/core_impl.cpp +++ b/src/inference/src/dev/core_impl.cpp @@ -9,7 +9,6 @@ #include "any_copy.hpp" #include "check_network_batchable.hpp" #include "compilation_context.hpp" -#include "cpp/ie_plugin.hpp" #include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp" #include "cpp_interfaces/interface/ie_internal_plugin_config.hpp" #include "cpp_interfaces/interface/ie_iplugin_internal.hpp" diff --git a/src/inference/src/dev/iplugin_wrapper.hpp b/src/inference/src/dev/iplugin_wrapper.hpp index 106ea3f6a7e..bb5d57e0569 100644 --- a/src/inference/src/dev/iplugin_wrapper.hpp +++ b/src/inference/src/dev/iplugin_wrapper.hpp @@ -139,7 +139,7 @@ public: /** * @brief Returns the instance of the legacy plugin * - * @return Legacy InferenceEngine::InferencePlugin object + * @return Legacy InferenceEngine::IInferencePlugin object */ const std::shared_ptr& get_plugin() const; diff --git a/src/inference/src/ie_core.cpp b/src/inference/src/ie_core.cpp index c4f728ee89e..1bb9b6e35f1 100644 --- a/src/inference/src/ie_core.cpp +++ b/src/inference/src/ie_core.cpp @@ -18,7 +18,6 @@ #include "cnn_network_ngraph_impl.hpp" #include "compilation_context.hpp" #include "cpp/ie_cnn_network.h" -#include "cpp/ie_plugin.hpp" #include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp" #include "cpp_interfaces/interface/ie_internal_plugin_config.hpp" #include "dev/core_impl.hpp" diff --git a/src/inference/tests/functional/caching_test.cpp b/src/inference/tests/functional/caching_test.cpp index aadfb4b239a..35decd50052 100644 --- a/src/inference/tests/functional/caching_test.cpp +++ b/src/inference/tests/functional/caching_test.cpp @@ -16,7 +16,6 @@ #include "common_test_utils/file_utils.hpp" #include "common_test_utils/test_constants.hpp" #include "common_test_utils/unicode_utils.hpp" -#include "cpp/ie_plugin.hpp" #include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp" #include "cpp_interfaces/interface/ie_internal_plugin_config.hpp" #include "cpp_interfaces/interface/ie_iplugin_internal.hpp" diff --git a/src/inference/tests/functional/ov_shared_object_test.cpp b/src/inference/tests/functional/ov_shared_object_test.cpp index b75245d2deb..4bad10d10a4 100644 --- a/src/inference/tests/functional/ov_shared_object_test.cpp +++ b/src/inference/tests/functional/ov_shared_object_test.cpp @@ -5,9 +5,8 @@ #include #include -#include - #include "common_test_utils/file_utils.hpp" +#include "cpp_interfaces/interface/ie_iplugin_internal.hpp" #include "openvino/util/shared_object.hpp" using namespace ::testing; diff --git a/src/inference/tests/functional/shared_object_loader_test.cpp b/src/inference/tests/functional/shared_object_loader_test.cpp index 2713fcf244f..9e586d10124 100644 --- a/src/inference/tests/functional/shared_object_loader_test.cpp +++ b/src/inference/tests/functional/shared_object_loader_test.cpp @@ -5,9 +5,8 @@ #include #include -#include - #include "common_test_utils/file_utils.hpp" +#include "cpp_interfaces/interface/ie_iplugin_internal.hpp" #include "openvino/util/shared_object.hpp" using namespace std; diff --git a/src/inference/tests/unit/cpp_interfaces/ie_infer_async_request_base_test.cpp b/src/inference/tests/unit/cpp_interfaces/ie_infer_async_request_base_test.cpp index 23fd175d3a4..613124cf040 100644 --- a/src/inference/tests/unit/cpp_interfaces/ie_infer_async_request_base_test.cpp +++ b/src/inference/tests/unit/cpp_interfaces/ie_infer_async_request_base_test.cpp @@ -8,8 +8,9 @@ #include #include #include -#include +#include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp" +#include "so_ptr.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iexecutable_network_internal.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iinfer_request_internal.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iinference_plugin.hpp" @@ -175,7 +176,7 @@ protected: std::shared_ptr mockIExeNet; InferenceEngine::SoExecutableNetworkInternal exeNetwork; MockIInferencePlugin* mockIPlugin; - InferencePlugin plugin; + std::shared_ptr plugin; shared_ptr mockInferRequestInternal; MockNotEmptyICNNNetwork mockNotEmptyNet; std::string _incorrectName; @@ -196,8 +197,8 @@ protected: ON_CALL(*mockIExeNet, CreateInferRequest()).WillByDefault(Return(mock_request)); auto mockIPluginPtr = std::make_shared(); ON_CALL(*mockIPluginPtr, LoadNetwork(MatcherCast(_), _)).WillByDefault(Return(mockIExeNet)); - plugin = InferenceEngine::InferencePlugin{mockIPluginPtr, {}}; - exeNetwork = plugin.LoadNetwork(CNNNetwork{}, {}); + plugin = mockIPluginPtr; + exeNetwork = ov::SoPtr(plugin->LoadNetwork(CNNNetwork{}, {}), {}); request = exeNetwork->CreateInferRequest(); _incorrectName = "incorrect_name"; _inputName = MockNotEmptyICNNNetwork::INPUT_BLOB_NAME; @@ -218,8 +219,8 @@ protected: ON_CALL(*mockIExeNet, CreateInferRequest()).WillByDefault(Return(mockInferRequestInternal)); auto mockIPluginPtr = std::make_shared(); ON_CALL(*mockIPluginPtr, LoadNetwork(MatcherCast(_), _)).WillByDefault(Return(mockIExeNet)); - auto plugin = InferenceEngine::InferencePlugin{mockIPluginPtr, {}}; - auto exeNetwork = plugin.LoadNetwork(CNNNetwork{}, {}); + plugin = mockIPluginPtr; + exeNetwork = ov::SoPtr(plugin->LoadNetwork(CNNNetwork{}, {}), {}); return exeNetwork->CreateInferRequest(); } diff --git a/src/inference/tests/unit/cpp_interfaces/ie_memory_state_internal_test.cpp b/src/inference/tests/unit/cpp_interfaces/ie_memory_state_internal_test.cpp index e73d27ea893..1a9c846deaa 100644 --- a/src/inference/tests/unit/cpp_interfaces/ie_memory_state_internal_test.cpp +++ b/src/inference/tests/unit/cpp_interfaces/ie_memory_state_internal_test.cpp @@ -9,7 +9,8 @@ #include #include -#include "cpp/ie_plugin.hpp" +#include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp" +#include "cpp_interfaces/interface/ie_iplugin_internal.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iexecutable_network_internal.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iinference_plugin.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_ivariable_state_internal.hpp" @@ -25,7 +26,7 @@ protected: shared_ptr mockInferRequestInternal; shared_ptr mockVariableStateInternal; MockIInferencePlugin* mockIPlugin; - InferencePlugin plugin; + std::shared_ptr plugin; ov::SoPtr net; IInferRequestInternal::Ptr req; @@ -37,8 +38,8 @@ protected: auto mockIPluginPtr = std::make_shared(); ON_CALL(*mockIPluginPtr, LoadNetwork(MatcherCast(_), _)) .WillByDefault(Return(mockExeNetworkInternal)); - plugin = InferenceEngine::InferencePlugin{mockIPluginPtr, {}}; - net = plugin.LoadNetwork(CNNNetwork{}, {}); + plugin = mockIPluginPtr; + net = ov::SoPtr(plugin->LoadNetwork(CNNNetwork{}, {}), {}); req = net->CreateInferRequest(); } }; diff --git a/src/inference/tests/unit/cpp_interfaces/ie_plugin_test.cpp b/src/inference/tests/unit/cpp_interfaces/ie_plugin_test.cpp index 59e26079dfc..6b96b8d7647 100644 --- a/src/inference/tests/unit/cpp_interfaces/ie_plugin_test.cpp +++ b/src/inference/tests/unit/cpp_interfaces/ie_plugin_test.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include @@ -144,28 +143,3 @@ TEST_F(InferenceEnginePluginInternalTest, failToSetNotAllocatedBlob) { << "\tExpected: " << refError << "\n\tActual: " << ex.what(); } } - -TEST(InferencePluginTests, throwsOnUninitializedGetVersion) { - InferencePlugin plg; - ASSERT_THROW(plg.GetVersion(), Exception); -} - -TEST(InferencePluginTests, throwsOnUninitializedLoadNetwork) { - InferencePlugin plg; - ASSERT_THROW(plg.LoadNetwork(CNNNetwork(), {}), Exception); -} - -TEST(InferencePluginTests, throwsOnUninitializedImportNetwork) { - InferencePlugin plg; - ASSERT_THROW(plg.ImportNetwork({}, {}), Exception); -} - -TEST(InferencePluginTests, throwsOnUninitializedAddExtension) { - InferencePlugin plg; - ASSERT_THROW(plg.AddExtension(IExtensionPtr()), Exception); -} - -TEST(InferencePluginTests, throwsOnUninitializedSetConfig) { - InferencePlugin plg; - ASSERT_THROW(plg.SetConfig({{}}), Exception); -} diff --git a/src/inference/tests/unit/ie_executable_network_test.cpp b/src/inference/tests/unit/ie_executable_network_test.cpp index cda77620a62..3db791e60a9 100644 --- a/src/inference/tests/unit/ie_executable_network_test.cpp +++ b/src/inference/tests/unit/ie_executable_network_test.cpp @@ -11,7 +11,8 @@ #include #include "cpp/ie_executable_network_base.hpp" -#include "cpp/ie_plugin.hpp" +#include "openvino/runtime/compiled_model.hpp" +#include "so_ptr.hpp" #include "unit_test_utils/mocks/cpp_interfaces/impl/mock_inference_plugin_internal.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iexecutable_network_internal.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iinference_plugin.hpp" @@ -40,7 +41,7 @@ protected: std::shared_ptr mockIExeNet; ov::SoPtr exeNetwork; MockIInferencePlugin* mockIPlugin; - InferencePlugin plugin; + std::shared_ptr plugin; void TearDown() override { mockIExeNet.reset(); @@ -52,8 +53,8 @@ protected: mockIExeNet = std::make_shared(); auto mockIPluginPtr = std::make_shared(); ON_CALL(*mockIPluginPtr, LoadNetwork(MatcherCast(_), _)).WillByDefault(Return(mockIExeNet)); - plugin = InferenceEngine::InferencePlugin{mockIPluginPtr, {}}; - exeNetwork = plugin.LoadNetwork(CNNNetwork{}, {}); + plugin = mockIPluginPtr; + exeNetwork = ov::SoPtr(plugin->LoadNetwork(CNNNetwork{}, {}), {}); } }; diff --git a/src/tests/unit/auto/auto_ctput_test.cpp b/src/tests/unit/auto/auto_ctput_test.cpp index e76502b9830..8b2027e5383 100644 --- a/src/tests/unit/auto/auto_ctput_test.cpp +++ b/src/tests/unit/auto/auto_ctput_test.cpp @@ -8,7 +8,6 @@ #include #include -#include "cpp/ie_plugin.hpp" #include "plugin/mock_load_network_properties.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_icore.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iexecutable_network_internal.hpp" @@ -44,13 +43,13 @@ public: std::shared_ptr> cpuMockIExeNet; ov::SoPtr cpuMockExeNetwork; NiceMock* cpuMockIPlugin; - InferenceEngine::InferencePlugin cpuMockPlugin; + std::shared_ptr cpuMockPlugin; // mock gpu exeNetwork std::shared_ptr> gpuMockIExeNet; ov::SoPtr gpuMockExeNetwork; NiceMock* gpuMockIPlugin; - InferenceEngine::InferencePlugin gpuMockPlugin; + std::shared_ptr gpuMockPlugin; std::shared_ptr> inferReqInternal; public: @@ -80,20 +79,20 @@ public: auto cpuMockIPluginPtr = std::make_shared>(); ON_CALL(*cpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)) .WillByDefault(Return(cpuMockIExeNet)); - cpuMockPlugin = InferenceEngine::InferencePlugin{cpuMockIPluginPtr, {}}; + cpuMockPlugin = cpuMockIPluginPtr; // remove annoying ON CALL message EXPECT_CALL(*cpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)).Times(1); - cpuMockExeNetwork = cpuMockPlugin.LoadNetwork(CNNNetwork{}, {}); + cpuMockExeNetwork = ov::SoPtr(cpuMockPlugin->LoadNetwork(CNNNetwork{}, {}), {}); // prepare gpuMockExeNetwork gpuMockIExeNet = std::make_shared>(); auto gpuMockIPluginPtr = std::make_shared>(); ON_CALL(*gpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)) .WillByDefault(Return(gpuMockIExeNet)); - gpuMockPlugin = InferenceEngine::InferencePlugin{gpuMockIPluginPtr, {}}; + gpuMockPlugin = gpuMockIPluginPtr; // remove annoying ON CALL message EXPECT_CALL(*gpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)).Times(1); - gpuMockExeNetwork = gpuMockPlugin.LoadNetwork(CNNNetwork{}, {}); + gpuMockExeNetwork = ov::SoPtr(gpuMockPlugin->LoadNetwork(CNNNetwork{}, {}), {}); // prepare mockicore and cnnNetwork for loading core = std::shared_ptr>(new NiceMock()); diff --git a/src/tests/unit/auto/auto_default_perf_hint_test.cpp b/src/tests/unit/auto/auto_default_perf_hint_test.cpp index 7db2b34724e..36fea0d6acf 100644 --- a/src/tests/unit/auto/auto_default_perf_hint_test.cpp +++ b/src/tests/unit/auto/auto_default_perf_hint_test.cpp @@ -12,9 +12,10 @@ #include #include -#include "cpp/ie_plugin.hpp" #include "mock_common.hpp" +#include "openvino/runtime/compiled_model.hpp" #include "plugin/mock_load_network_properties.hpp" +#include "so_ptr.hpp" #include "unit_test_utils/mocks/cpp_interfaces/impl/mock_inference_plugin_internal.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_icore.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iexecutable_network_internal.hpp" @@ -59,13 +60,13 @@ public: std::shared_ptr> cpuMockIExeNet; ov::SoPtr cpuMockExeNetwork; NiceMock* cpuMockIPlugin; - InferenceEngine::InferencePlugin cpuMockPlugin; + std::shared_ptr cpuMockPlugin; // mock gpu exeNetwork std::shared_ptr> gpuMockIExeNet; ov::SoPtr gpuMockExeNetwork; NiceMock* gpuMockIPlugin; - InferenceEngine::InferencePlugin gpuMockPlugin; + std::shared_ptr gpuMockPlugin; std::shared_ptr> inferReqInternal; public: @@ -255,20 +256,20 @@ public: auto cpuMockIPluginPtr = std::make_shared>(); ON_CALL(*cpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)) .WillByDefault(Return(cpuMockIExeNet)); - cpuMockPlugin = InferenceEngine::InferencePlugin{cpuMockIPluginPtr, {}}; + cpuMockPlugin = cpuMockIPluginPtr; // remove annoying ON CALL message EXPECT_CALL(*cpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)).Times(1); - cpuMockExeNetwork = cpuMockPlugin.LoadNetwork(CNNNetwork{}, {}); + cpuMockExeNetwork = ov::SoPtr(cpuMockPlugin->LoadNetwork(CNNNetwork{}, {}), {}); // prepare gpuMockExeNetwork gpuMockIExeNet = std::make_shared>(); auto gpuMockIPluginPtr = std::make_shared>(); ON_CALL(*gpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)) .WillByDefault(Return(gpuMockIExeNet)); - gpuMockPlugin = InferenceEngine::InferencePlugin{gpuMockIPluginPtr, {}}; + gpuMockPlugin = gpuMockIPluginPtr; // remove annoying ON CALL message EXPECT_CALL(*gpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)).Times(1); - gpuMockExeNetwork = gpuMockPlugin.LoadNetwork(CNNNetwork{}, {}); + gpuMockExeNetwork = ov::SoPtr(gpuMockPlugin->LoadNetwork(CNNNetwork{}, {}), {}); // prepare mockicore and cnnNetwork for loading core = std::shared_ptr>(new NiceMock()); diff --git a/src/tests/unit/auto/auto_load_network_properties_test.cpp b/src/tests/unit/auto/auto_load_network_properties_test.cpp index 14e2245fd25..a846d3f96d1 100644 --- a/src/tests/unit/auto/auto_load_network_properties_test.cpp +++ b/src/tests/unit/auto/auto_load_network_properties_test.cpp @@ -12,7 +12,6 @@ #include #include -#include "cpp/ie_plugin.hpp" #include "mock_common.hpp" #include "plugin/mock_load_network_properties.hpp" #include "unit_test_utils/mocks/cpp_interfaces/impl/mock_inference_plugin_internal.hpp" @@ -65,13 +64,13 @@ public: std::shared_ptr> cpuMockIExeNet; ov::SoPtr cpuMockExeNetwork; NiceMock* cpuMockIPlugin; - InferenceEngine::InferencePlugin cpuMockPlugin; + std::shared_ptr cpuMockPlugin; // mock gpu exeNetwork std::shared_ptr> gpuMockIExeNet; ov::SoPtr gpuMockExeNetwork; NiceMock* gpuMockIPlugin; - InferenceEngine::InferencePlugin gpuMockPlugin; + std::shared_ptr gpuMockPlugin; std::shared_ptr> inferReqInternal; public: @@ -136,20 +135,20 @@ public: auto cpuMockIPluginPtr = std::make_shared>(); ON_CALL(*cpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)) .WillByDefault(Return(cpuMockIExeNet)); - cpuMockPlugin = InferenceEngine::InferencePlugin{cpuMockIPluginPtr, {}}; + cpuMockPlugin = cpuMockIPluginPtr; // remove annoying ON CALL message EXPECT_CALL(*cpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)).Times(1); - cpuMockExeNetwork = cpuMockPlugin.LoadNetwork(CNNNetwork{}, {}); + cpuMockExeNetwork = ov::SoPtr(cpuMockPlugin->LoadNetwork(CNNNetwork{}, {}), {}); // prepare gpuMockExeNetwork gpuMockIExeNet = std::make_shared>(); auto gpuMockIPluginPtr = std::make_shared>(); ON_CALL(*gpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)) .WillByDefault(Return(gpuMockIExeNet)); - gpuMockPlugin = InferenceEngine::InferencePlugin{gpuMockIPluginPtr, {}}; + gpuMockPlugin = gpuMockIPluginPtr; // remove annoying ON CALL message EXPECT_CALL(*gpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)).Times(1); - gpuMockExeNetwork = gpuMockPlugin.LoadNetwork(CNNNetwork{}, {}); + gpuMockExeNetwork = ov::SoPtr(gpuMockPlugin->LoadNetwork(CNNNetwork{}, {}), {}); // prepare mockicore and cnnNetwork for loading core = std::shared_ptr>(new NiceMock()); diff --git a/src/tests/unit/auto/auto_release_helper_test.cpp b/src/tests/unit/auto/auto_release_helper_test.cpp index e0ef935ee28..35535eb7b73 100644 --- a/src/tests/unit/auto/auto_release_helper_test.cpp +++ b/src/tests/unit/auto/auto_release_helper_test.cpp @@ -16,7 +16,6 @@ #include #include #include "plugin/mock_auto_device_plugin.hpp" -#include "cpp/ie_plugin.hpp" #include "mock_common.hpp" #include diff --git a/src/tests/unit/auto/auto_select_device_failed_test.cpp b/src/tests/unit/auto/auto_select_device_failed_test.cpp index 56a7350ac5a..159ba703982 100644 --- a/src/tests/unit/auto/auto_select_device_failed_test.cpp +++ b/src/tests/unit/auto/auto_select_device_failed_test.cpp @@ -4,6 +4,7 @@ #include #include +#include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_icore.hpp" #include "unit_test_utils/mocks/mock_iinfer_request.hpp" #include "unit_test_utils/mocks/cpp_interfaces/impl/mock_inference_plugin_internal.hpp" @@ -16,7 +17,6 @@ #include #include #include "plugin/mock_auto_device_plugin.hpp" -#include "cpp/ie_plugin.hpp" #include "mock_common.hpp" using ::testing::MatcherCast; @@ -63,7 +63,7 @@ public: std::shared_ptr mockIExeNet; ov::SoPtr mockExeNetwork; MockIInferencePlugin* mockIPlugin; - InferenceEngine::InferencePlugin mockPlugin; + std::shared_ptr mockPlugin; // config for Auto device std::map config; std::vector metaDevices; @@ -130,10 +130,10 @@ public: mockIExeNet = std::make_shared(); auto mockIPluginPtr = std::make_shared(); ON_CALL(*mockIPluginPtr, LoadNetwork(MatcherCast(_), _)).WillByDefault(Return(mockIExeNet)); - mockPlugin = InferenceEngine::InferencePlugin{mockIPluginPtr, {}}; + mockPlugin = mockIPluginPtr; // remove annoying ON CALL message EXPECT_CALL(*mockIPluginPtr, LoadNetwork(MatcherCast(_), _)).Times(1); - mockExeNetwork = mockPlugin.LoadNetwork(CNNNetwork{}, {}); + mockExeNetwork = ov::SoPtr(mockPlugin->LoadNetwork(CNNNetwork{}, {}), {}); // prepare mockicore and cnnNetwork for loading core = std::shared_ptr(new MockICore()); diff --git a/src/tests/unit/auto/exec_network_get_metrics.cpp b/src/tests/unit/auto/exec_network_get_metrics.cpp index 8c832322f8d..86d4dffaa4c 100644 --- a/src/tests/unit/auto/exec_network_get_metrics.cpp +++ b/src/tests/unit/auto/exec_network_get_metrics.cpp @@ -4,6 +4,10 @@ #include #include +#include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp" +#include "cpp_interfaces/interface/ie_iplugin_internal.hpp" +#include "openvino/runtime/compiled_model.hpp" +#include "so_ptr.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_icore.hpp" #include "unit_test_utils/mocks/mock_iinfer_request.hpp" #include "unit_test_utils/mocks/cpp_interfaces/impl/mock_inference_plugin_internal.hpp" @@ -11,12 +15,12 @@ #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_ivariable_state_internal.hpp" #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iinference_plugin.hpp" #include +#include #include #include #include #include #include "plugin/mock_auto_device_plugin.hpp" -#include "cpp/ie_plugin.hpp" #include #include #include "mock_common.hpp" @@ -61,13 +65,13 @@ public: std::shared_ptr cpuMockIExeNet; ov::SoPtr cpuMockExeNetwork; MockIInferencePlugin* cpuMockIPlugin; - InferenceEngine::InferencePlugin cpuMockPlugin; + std::shared_ptr cpuMockPlugin; //mock actual exeNetwork std::shared_ptr actualMockIExeNet; ov::SoPtr actualMockExeNetwork; MockIInferencePlugin* actualMockIPlugin; - InferenceEngine::InferencePlugin actualMockPlugin; + std::shared_ptr actualMockPlugin; // config for Auto device std::map config; @@ -132,19 +136,19 @@ public: cpuMockIExeNet = std::make_shared(); auto cpuMockIPluginPtr = std::make_shared(); ON_CALL(*cpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)).WillByDefault(Return(cpuMockIExeNet)); - cpuMockPlugin = InferenceEngine::InferencePlugin{cpuMockIPluginPtr, {}}; + cpuMockPlugin = cpuMockIPluginPtr; // remove annoying ON CALL message EXPECT_CALL(*cpuMockIPluginPtr, LoadNetwork(MatcherCast(_), _)).Times(1); - cpuMockExeNetwork = cpuMockPlugin.LoadNetwork(CNNNetwork{}, {}); + cpuMockExeNetwork = ov::SoPtr(cpuMockPlugin->LoadNetwork(CNNNetwork{}, {}), {}); // prepare actualMockExeNetwork actualMockIExeNet = std::make_shared(); auto actualMockIPluginPtr = std::make_shared(); ON_CALL(*actualMockIPluginPtr, LoadNetwork(MatcherCast(_), _)).WillByDefault(Return(actualMockIExeNet)); - actualMockPlugin = InferenceEngine::InferencePlugin{actualMockIPluginPtr, {}}; + actualMockPlugin = actualMockIPluginPtr; // remove annoying ON CALL message EXPECT_CALL(*actualMockIPluginPtr, LoadNetwork(MatcherCast(_), _)).Times(1); - actualMockExeNetwork = actualMockPlugin.LoadNetwork(CNNNetwork{}, {}); + actualMockExeNetwork = ov::SoPtr(actualMockPlugin->LoadNetwork(CNNNetwork{}, {}), {}); // prepare mockicore and cnnNetwork for loading core = std::shared_ptr(new MockICore()); diff --git a/src/tests/unit/auto/get_device_list.cpp b/src/tests/unit/auto/get_device_list.cpp index 8d0e460caa0..6445e9fcba7 100644 --- a/src/tests/unit/auto/get_device_list.cpp +++ b/src/tests/unit/auto/get_device_list.cpp @@ -16,7 +16,6 @@ #include #include #include "plugin/mock_auto_device_plugin.hpp" -#include "cpp/ie_plugin.hpp" #include "mock_common.hpp" using ::testing::Return; diff --git a/src/tests/unit/auto/key_network_priority_test.cpp b/src/tests/unit/auto/key_network_priority_test.cpp index ccb9a86e0d4..eccec915d5b 100644 --- a/src/tests/unit/auto/key_network_priority_test.cpp +++ b/src/tests/unit/auto/key_network_priority_test.cpp @@ -16,7 +16,6 @@ #include #include #include "plugin/mock_auto_device_plugin.hpp" -#include "cpp/ie_plugin.hpp" #include "mock_common.hpp" using ::testing::MatcherCast; diff --git a/src/tests/unit/auto/parse_meta_device_test.cpp b/src/tests/unit/auto/parse_meta_device_test.cpp index 79ffa757917..557205ee2a5 100644 --- a/src/tests/unit/auto/parse_meta_device_test.cpp +++ b/src/tests/unit/auto/parse_meta_device_test.cpp @@ -16,7 +16,6 @@ #include #include #include "plugin/mock_auto_device_plugin.hpp" -#include "cpp/ie_plugin.hpp" #include "mock_common.hpp" using ::testing::MatcherCast; diff --git a/src/tests/unit/auto/select_device_test.cpp b/src/tests/unit/auto/select_device_test.cpp index 43be5f910e5..5be666b4dbf 100644 --- a/src/tests/unit/auto/select_device_test.cpp +++ b/src/tests/unit/auto/select_device_test.cpp @@ -16,7 +16,6 @@ #include #include #include "plugin/mock_auto_device_plugin.hpp" -#include "cpp/ie_plugin.hpp" #include "mock_common.hpp" using ::testing::MatcherCast;