Reverted to Remote Context (#7453)

This commit is contained in:
Anton Pankratv 2021-09-14 12:49:24 +03:00 committed by GitHub
parent 651f07b4ff
commit 5e6896d03a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 88 additions and 175 deletions

View File

@ -631,7 +631,7 @@ IExecutableNetworkInternal::Ptr clDNNEngine::LoadExeNetworkImpl(const InferenceE
}
IExecutableNetworkInternal::Ptr clDNNEngine::LoadExeNetworkImpl(const InferenceEngine::CNNNetwork &network,
const IRemoteContext::Ptr &context,
const RemoteContext::Ptr &context,
const std::map<std::string, std::string> &orig_config) {
InferenceEngine::InputsDataMap _networkInputs = network.getInputsInfo();
check_inputs(_networkInputs);
@ -649,7 +649,7 @@ IExecutableNetworkInternal::Ptr clDNNEngine::LoadExeNetworkImpl(const InferenceE
return std::make_shared<CLDNNExecNetwork>(transformedNetwork, casted, conf);
}
IRemoteContext::Ptr clDNNEngine::CreateContext(const ParamMap& params) {
RemoteContext::Ptr clDNNEngine::CreateContext(const ParamMap& params) {
// parameter map is non-empty
std::string contextTypeStr = _StrFromParams(params, GPU_PARAM_KEY(CONTEXT_TYPE));
@ -666,7 +666,7 @@ IRemoteContext::Ptr clDNNEngine::CreateContext(const ParamMap& params) {
}
}
IRemoteContext::Ptr clDNNEngine::GetDefaultContext(const ParamMap& params) {
RemoteContext::Ptr clDNNEngine::GetDefaultContext(const ParamMap& params) {
if (nullptr == m_defaultContext) {
m_defaultContext.reset(new CLDNNRemoteCLContext(shared_from_this(), params, _impl->m_config));
}

View File

@ -44,7 +44,7 @@ public:
const std::map<std::string, std::string> &config) override;
InferenceEngine::IExecutableNetworkInternal::Ptr LoadExeNetworkImpl(const InferenceEngine::CNNNetwork &network,
const std::shared_ptr<InferenceEngine::IRemoteContext> &context,
const std::shared_ptr<InferenceEngine::RemoteContext> &context,
const std::map<std::string, std::string> &config) override;
void SetConfig(const std::map<std::string, std::string> &config) override;
@ -53,8 +53,8 @@ public:
InferenceEngine::QueryNetworkResult QueryNetwork(const InferenceEngine::CNNNetwork& network,
const std::map<std::string, std::string>& config) const override;
std::shared_ptr<InferenceEngine::IRemoteContext> CreateContext(const InferenceEngine::ParamMap& params) override;
std::shared_ptr<InferenceEngine::IRemoteContext> GetDefaultContext(const InferenceEngine::ParamMap& params) override;
std::shared_ptr<InferenceEngine::RemoteContext> CreateContext(const InferenceEngine::ParamMap& params) override;
std::shared_ptr<InferenceEngine::RemoteContext> GetDefaultContext(const InferenceEngine::ParamMap& params) override;
};
}; // namespace CLDNNPlugin

View File

@ -32,7 +32,7 @@ using namespace InferenceEngine::details;
namespace CLDNNPlugin {
CLDNNExecNetwork::CLDNNExecNetwork(InferenceEngine::CNNNetwork &network, std::shared_ptr<IRemoteContext> context, Config config) :
CLDNNExecNetwork::CLDNNExecNetwork(InferenceEngine::CNNNetwork &network, std::shared_ptr<RemoteContext> context, Config config) :
InferenceEngine::ExecutableNetworkThreadSafeDefault{[&]()->InferenceEngine::ITaskExecutor::Ptr {
if (config.exclusiveAsyncRequests) {
//exclusiveAsyncRequests essentially disables the streams (and hence should be checked first) => aligned with the CPU behavior
@ -136,7 +136,7 @@ InferenceEngine::Parameter CLDNNExecNetwork::GetMetric(const std::string &name)
}
}
std::shared_ptr<IRemoteContext> CLDNNExecNetwork::GetContext() const {
std::shared_ptr<RemoteContext> CLDNNExecNetwork::GetContext() const {
return m_context;
}

View File

@ -23,7 +23,7 @@ class CLDNNExecNetwork : public InferenceEngine::ExecutableNetworkThreadSafeDefa
public:
typedef std::shared_ptr<CLDNNExecNetwork> Ptr;
CLDNNExecNetwork(InferenceEngine::CNNNetwork &network, std::shared_ptr<InferenceEngine::IRemoteContext> context, Config config);
CLDNNExecNetwork(InferenceEngine::CNNNetwork &network, std::shared_ptr<InferenceEngine::RemoteContext> context, Config config);
std::shared_ptr<ngraph::Function> GetExecGraphInfo() override;
InferenceEngine::IInferRequestInternal::Ptr CreateInferRequest() override;
@ -32,7 +32,7 @@ public:
InferenceEngine::Parameter GetMetric(const std::string &name) const override;
InferenceEngine::Parameter GetConfig(const std::string &name) const override;
std::shared_ptr<InferenceEngine::IRemoteContext> GetContext() const override;
std::shared_ptr<InferenceEngine::RemoteContext> GetContext() const override;
std::vector<std::shared_ptr<CLDNNGraph>> m_graphs;
InferenceEngine::gpu::ClContext::Ptr m_context;

View File

@ -134,7 +134,7 @@ std::string CLDNNRemoteBlobImpl::getDeviceName() const noexcept {
return getContextImpl(m_context.lock())->getDeviceName();
};
std::shared_ptr<IRemoteContext> CLDNNRemoteBlobImpl::getContext() const noexcept {
std::shared_ptr<RemoteContext> CLDNNRemoteBlobImpl::getContext() const noexcept {
return m_context.lock();
}

View File

@ -8,7 +8,7 @@
#include <cldnn/runtime/engine.hpp>
#include <ie_parameter.hpp>
#include <cpp_interfaces/interface/ie_iplugin_internal.hpp>
#include <cpp_interfaces/interface/ie_iremote_context.hpp>
#include <ie_remote_context.hpp>
#include "cldnn_config.h"
#include "cldnn_common_utils.h"
@ -54,7 +54,7 @@ public:
bool deallocate() noexcept;
InferenceEngine::ParamMap getParams() const;
std::string getDeviceName() const noexcept;
std::shared_ptr<InferenceEngine::IRemoteContext> getContext() const noexcept;
std::shared_ptr<InferenceEngine::RemoteContext> getContext() const noexcept;
InferenceEngine::LockedMemory<void> buffer() noexcept;
InferenceEngine::LockedMemory<const void> cbuffer() const noexcept;
InferenceEngine::LockedMemory<void> rwmap()noexcept;

View File

@ -114,10 +114,10 @@ class GNAPlugin : public InferenceEngine::IInferencePlugin {
const std::map<std::string, InferenceEngine::Parameter> & options) const override;
InferenceEngine::Parameter GetMetric(const std::string& name,
const std::map<std::string, InferenceEngine::Parameter> & options) const override;
std::shared_ptr<InferenceEngine::IRemoteContext> CreateContext(const InferenceEngine::ParamMap& params) override {
std::shared_ptr<InferenceEngine::RemoteContext> CreateContext(const InferenceEngine::ParamMap& params) override {
THROW_GNA_EXCEPTION << "Not implemented";
}
std::shared_ptr<InferenceEngine::IRemoteContext> GetDefaultContext(const InferenceEngine::ParamMap&) override {
std::shared_ptr<InferenceEngine::RemoteContext> GetDefaultContext(const InferenceEngine::ParamMap&) override {
THROW_GNA_EXCEPTION << "Not implemented";
}
@ -130,7 +130,7 @@ class GNAPlugin : public InferenceEngine::IInferencePlugin {
THROW_GNA_EXCEPTION << "Not implemented";
}
InferenceEngine::IExecutableNetworkInternal::Ptr ImportNetwork(std::istream& networkModel,
const std::shared_ptr<InferenceEngine::IRemoteContext>& context,
const std::shared_ptr<InferenceEngine::RemoteContext>& context,
const std::map<std::string, std::string> &config) override {
THROW_GNA_EXCEPTION << "Not implemented";
}

View File

@ -10,7 +10,7 @@
*/
#pragma once
#include <cpp_interfaces/interface/ie_iremote_context.hpp>
#include <ie_remote_context.hpp>
#include <memory>
#include <string>
@ -29,7 +29,7 @@ namespace gpu {
* The plugin object derived from this class can be obtained either with
* GetContext() method of Executable network or using CreateContext() Core call.
*/
class ClContext : public IRemoteContext, public details::param_map_obj_getter {
class ClContext : public RemoteContext, public details::param_map_obj_getter {
public:
/**
* @brief A smart pointer to the ClContext object

View File

@ -23,7 +23,7 @@ namespace InferenceEngine {
* Such context represents a scope on the device within which executable
* networks and remote memory blobs can exist, function and exchange data.
*/
class RemoteContext {
class RemoteContext : public std::enable_shared_from_this<RemoteContext> {
public:
/**
* @brief A smart pointer to the RemoteContext object

View File

@ -19,7 +19,6 @@
#include "ie_remote_context.hpp"
namespace InferenceEngine {
class IRemoteContext;
class RemoteBlob;
} // namespace InferenceEngine
@ -36,7 +35,7 @@ class Core;
*/
class INFERENCE_ENGINE_API_CLASS(RemoteContext) {
std::shared_ptr<void> _so;
std::shared_ptr<ie::IRemoteContext> _impl;
std::shared_ptr<ie::RemoteContext> _impl;
/**
* @brief Constructs RemoteContext from the initialized std::shared_ptr
@ -44,7 +43,7 @@ class INFERENCE_ENGINE_API_CLASS(RemoteContext) {
* object is destroyed.
* @param impl Initialized shared pointer
*/
RemoteContext(const std::shared_ptr<void>& so, const std::shared_ptr<ie::IRemoteContext>& impl);
RemoteContext(const std::shared_ptr<void>& so, const std::shared_ptr<ie::RemoteContext>& impl);
friend class Core;
public:

View File

@ -6,9 +6,9 @@
#include "cpp/exception2status.hpp"
#include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp"
#include "cpp_interfaces/interface/ie_iremote_context.hpp"
#include "ie_common.h"
#include "ie_executable_network_base.hpp"
#include "ie_remote_context.hpp"
#include "openvino/runtime/executable_network.hpp"
namespace InferenceEngine {

View File

@ -17,7 +17,7 @@
#include "cpp/exception2status.hpp"
#include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp"
#include "cpp_interfaces/interface/ie_ivariable_state_internal.hpp"
#include "cpp_interfaces/interface/ie_iremote_context.hpp"
#include "ie_remote_context.hpp"
#include "ie_iexecutable_network.hpp"
#include "ie_infer_async_request_base.hpp"

View File

@ -67,7 +67,7 @@ public:
}
details::SOPointer<IExecutableNetworkInternal> LoadNetwork(const CNNNetwork& network,
const std::shared_ptr<IRemoteContext>& context,
const std::shared_ptr<RemoteContext>& context,
const std::map<std::string, std::string>& config) {
PLUGIN_CALL_STATEMENT(return {_so, _ptr->LoadNetwork(network, config, context)});
}
@ -95,7 +95,7 @@ public:
}
details::SOPointer<IExecutableNetworkInternal> ImportNetwork(std::istream& networkModel,
const std::shared_ptr<IRemoteContext>& context,
const std::shared_ptr<RemoteContext>& context,
const std::map<std::string, std::string>& config) {
PLUGIN_CALL_STATEMENT(return {_so, _ptr->ImportNetwork(networkModel, context, config)});
}
@ -104,11 +104,11 @@ public:
PLUGIN_CALL_STATEMENT(return _ptr->GetMetric(name, options));
}
details::SOPointer<IRemoteContext> CreateContext(const ParamMap& params) {
details::SOPointer<RemoteContext> CreateContext(const ParamMap& params) {
PLUGIN_CALL_STATEMENT(return {_so, _ptr->CreateContext(params)});
}
details::SOPointer<IRemoteContext> GetDefaultContext(const ParamMap& params) {
details::SOPointer<RemoteContext> GetDefaultContext(const ParamMap& params) {
PLUGIN_CALL_STATEMENT(return {_so, _ptr->GetDefaultContext(params)});
}
@ -166,7 +166,7 @@ struct InferencePlugin {
}
SoPtr<ie::IExecutableNetworkInternal> load_model(const ie::CNNNetwork& network,
const std::shared_ptr<ie::IRemoteContext>& context,
const std::shared_ptr<ie::RemoteContext>& context,
const ConfigMap& config) {
PLUGIN_CALL_STATEMENT(return {_so, _ptr->LoadNetwork(network, config, context)});
}
@ -194,7 +194,7 @@ struct InferencePlugin {
}
SoPtr<ie::IExecutableNetworkInternal> import_model(std::istream& networkModel,
const std::shared_ptr<ie::IRemoteContext>& context,
const std::shared_ptr<ie::RemoteContext>& context,
const ConfigMap& config) {
PLUGIN_CALL_STATEMENT(return {_so, _ptr->ImportNetwork(networkModel, context, config)});
}
@ -203,11 +203,11 @@ struct InferencePlugin {
PLUGIN_CALL_STATEMENT(return _ptr->GetMetric(name, options));
}
SoPtr<ie::IRemoteContext> create_context(const ie::ParamMap& params) {
SoPtr<ie::RemoteContext> create_context(const ie::ParamMap& params) {
PLUGIN_CALL_STATEMENT(return {_so, _ptr->CreateContext(params)});
}
SoPtr<ie::IRemoteContext> get_default_context(const ie::ParamMap& params) {
SoPtr<ie::RemoteContext> get_default_context(const ie::ParamMap& params) {
PLUGIN_CALL_STATEMENT(return {_so, _ptr->GetDefaultContext(params)});
}

View File

@ -90,7 +90,7 @@ Parameter IExecutableNetworkInternal::GetMetric(const std::string&) const {
IE_THROW(NotImplemented);
}
std::shared_ptr<IRemoteContext> IExecutableNetworkInternal::GetContext() const {
std::shared_ptr<RemoteContext> IExecutableNetworkInternal::GetContext() const {
IE_THROW(NotImplemented);
}

View File

@ -118,7 +118,7 @@ std::map<std::string, std::shared_ptr<const T>> const_map_cast(const std::map<st
std::shared_ptr<IExecutableNetworkInternal> IInferencePlugin::LoadNetwork(
const CNNNetwork& network,
const std::map<std::string, std::string>& config,
const std::shared_ptr<IRemoteContext>& context) {
const std::shared_ptr<RemoteContext>& context) {
std::shared_ptr<IExecutableNetworkInternal> impl;
if (nullptr == context) {
impl = LoadExeNetworkImpl(network, config);
@ -158,11 +158,11 @@ Parameter IInferencePlugin::GetMetric(const std::string&, const std::map<std::st
IE_THROW(NotImplemented);
}
std::shared_ptr<IRemoteContext> IInferencePlugin::CreateContext(const ParamMap&) {
std::shared_ptr<RemoteContext> IInferencePlugin::CreateContext(const ParamMap&) {
IE_THROW(NotImplemented);
}
std::shared_ptr<IRemoteContext> IInferencePlugin::GetDefaultContext(const ParamMap&) {
std::shared_ptr<RemoteContext> IInferencePlugin::GetDefaultContext(const ParamMap&) {
IE_THROW(NotImplemented);
}
@ -186,7 +186,7 @@ std::shared_ptr<IExecutableNetworkInternal> IInferencePlugin::ImportNetwork(
std::shared_ptr<IExecutableNetworkInternal> IInferencePlugin::ImportNetwork(
std::istream& networkModel,
const std::shared_ptr<IRemoteContext>& context,
const std::shared_ptr<RemoteContext>& context,
const std::map<std::string, std::string>& config) {
IE_THROW(NotImplemented);
}
@ -213,7 +213,7 @@ std::shared_ptr<IExecutableNetworkInternal> IInferencePlugin::LoadExeNetworkImpl
std::shared_ptr<IExecutableNetworkInternal> IInferencePlugin::LoadExeNetworkImpl(
const CNNNetwork&,
const std::shared_ptr<IRemoteContext>&,
const std::shared_ptr<RemoteContext>&,
const std::map<std::string, std::string>&) {
IE_THROW(NotImplemented);
}

View File

@ -1,19 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <cpp_interfaces/interface/ie_iremote_context.hpp>
namespace InferenceEngine {
std::string IRemoteContext::getDeviceName() const noexcept {
return {};
}
RemoteBlob::Ptr IRemoteContext::CreateBlob(const TensorDesc&, const ParamMap&) {
IE_THROW(NotImplemented);
}
ParamMap IRemoteContext::getParams() const {
IE_THROW(NotImplemented);
}
} // namespace InferenceEngine

View File

@ -16,7 +16,6 @@
#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_iremote_context.hpp"
#include "file_utils.h"
#include "ie_cache_guard.hpp"
#include "ie_cache_manager.hpp"
@ -24,6 +23,7 @@
#include "ie_itt.hpp"
#include "ie_network_reader.hpp"
#include "ie_plugin_config.hpp"
#include "ie_remote_context.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/ngraph.hpp"
#include "ngraph/opsets/opset.hpp"
@ -209,15 +209,15 @@ class CoreImpl : public ie::ICore, public std::enable_shared_from_this<ie::ICore
return supported;
}
ov::runtime::SoPtr<ie::IExecutableNetworkInternal> LoadNetworkImpl(
const ie::CNNNetwork& network,
ov::runtime::InferencePlugin& plugin,
ov::runtime::SoPtr<ie::IExecutableNetworkInternal> load_model_impl(
const InferenceEngine::CNNNetwork& network,
InferencePlugin& plugin,
const std::map<std::string, std::string>& parsedConfig,
const ie::IRemoteContext::Ptr& context,
const ie::RemoteContext::Ptr& context,
const std::string& blobID,
const std::string& modelPath = std::string(),
bool forceDisableCache = false) {
OV_ITT_SCOPED_TASK(ov::itt::domains::IE, "CoreImpl::LoadNetworkImpl");
OV_ITT_SCOPED_TASK(ov::itt::domains::IE, "CoreImpl::load_model_impl");
ov::runtime::SoPtr<ie::IExecutableNetworkInternal> execNetwork;
execNetwork =
context ? plugin.load_model(network, context, parsedConfig) : plugin.load_model(network, parsedConfig);
@ -245,7 +245,7 @@ class CoreImpl : public ie::ICore, public std::enable_shared_from_this<ie::ICore
const std::string& blobId,
ov::runtime::InferencePlugin& plugin,
const std::map<std::string, std::string>& config,
const std::shared_ptr<ie::IRemoteContext>& context,
const std::shared_ptr<ie::RemoteContext>& context,
bool& networkIsImported,
const std::string& modelPath = std::string()) {
ov::runtime::SoPtr<ie::IExecutableNetworkInternal> execNetwork;
@ -443,7 +443,7 @@ public:
// TODO: In future this method can be added to ICore interface
ov::runtime::SoPtr<ie::IExecutableNetworkInternal> LoadNetwork(const ie::CNNNetwork& network,
const std::shared_ptr<ie::IRemoteContext>& context,
const std::shared_ptr<ie::RemoteContext>& context,
const std::map<std::string, std::string>& config) {
OV_ITT_SCOPE(FIRST_INFERENCE, ie::itt::domains::IE_LT, "Core::LoadNetwork::RemoteContext");
if (context == nullptr) {
@ -459,10 +459,10 @@ public:
auto lock = cacheGuard.getHashLock(hash);
res = LoadNetworkFromCache(cacheManager, hash, plugin, parsed._config, context, loadedFromCache);
if (!loadedFromCache) {
res = LoadNetworkImpl(network, plugin, parsed._config, context, hash);
res = load_model_impl(network, plugin, parsed._config, context, hash);
}
} else {
res = LoadNetworkImpl(network, plugin, parsed._config, context, {});
res = load_model_impl(network, plugin, parsed._config, context, {});
}
return res;
}
@ -486,10 +486,10 @@ public:
auto lock = cacheGuard.getHashLock(hash);
res = LoadNetworkFromCache(cacheManager, hash, plugin, parsed._config, nullptr, loadedFromCache);
if (!loadedFromCache) {
res = LoadNetworkImpl(network, plugin, parsed._config, nullptr, hash, {}, forceDisableCache);
res = load_model_impl(network, plugin, parsed._config, nullptr, hash, {}, forceDisableCache);
}
} else {
res = LoadNetworkImpl(network, plugin, parsed._config, nullptr, {}, {}, forceDisableCache);
res = load_model_impl(network, plugin, parsed._config, nullptr, {}, {}, forceDisableCache);
}
return {{res._so}, res._ptr};
}
@ -509,13 +509,13 @@ public:
res = LoadNetworkFromCache(cacheManager, hash, plugin, parsed._config, nullptr, loadedFromCache, modelPath);
if (!loadedFromCache) {
auto cnnNetwork = ReadNetwork(modelPath, std::string());
res = LoadNetworkImpl(cnnNetwork, plugin, parsed._config, nullptr, hash, modelPath);
res = load_model_impl(cnnNetwork, plugin, parsed._config, nullptr, hash, modelPath);
}
} else if (cacheManager) {
res = plugin.load_model(modelPath, parsed._config);
} else {
auto cnnNetwork = ReadNetwork(modelPath, std::string());
res = LoadNetworkImpl(cnnNetwork, plugin, parsed._config, nullptr, {}, modelPath);
res = load_model_impl(cnnNetwork, plugin, parsed._config, nullptr, {}, modelPath);
}
return {{res._so}, res._ptr};
}
@ -985,7 +985,7 @@ ExecutableNetwork Core::LoadNetwork(const CNNNetwork& network,
ExecutableNetwork Core::LoadNetwork(const CNNNetwork& network,
RemoteContext::Ptr context,
const std::map<std::string, std::string>& config) {
auto exec = _impl->LoadNetwork(network, std::dynamic_pointer_cast<IRemoteContext>(context), config);
auto exec = _impl->LoadNetwork(network, std::dynamic_pointer_cast<RemoteContext>(context), config);
return {{exec._so}, exec._ptr};
}
@ -1098,7 +1098,7 @@ ExecutableNetwork Core::ImportNetwork(std::istream& networkModel,
auto parsed = ov::runtime::parseDeviceNameIntoConfig(deviceName, config);
auto exec = _impl->GetCPPPluginByName(deviceName)
.import_model(networkModel, std::dynamic_pointer_cast<IRemoteContext>(context), parsed._config);
.import_model(networkModel, std::dynamic_pointer_cast<RemoteContext>(context), parsed._config);
return {{exec._so}, exec._ptr};
}

View File

@ -4,8 +4,8 @@
#include "openvino/runtime/remote_context.hpp"
#include "cpp_interfaces/interface/ie_iremote_context.hpp"
#include "ie_remote_blob.hpp"
#include "ie_remote_context.hpp"
#define REMOTE_CONTEXT_STATEMENT(...) \
if (_impl == nullptr) \
@ -19,7 +19,7 @@
namespace ov {
namespace runtime {
RemoteContext::RemoteContext(const std::shared_ptr<void>& so, const ie::IRemoteContext::Ptr& impl)
RemoteContext::RemoteContext(const std::shared_ptr<void>& so, const ie::RemoteContext::Ptr& impl)
: _so(so),
_impl(impl) {
if (_impl == nullptr)

View File

@ -154,7 +154,7 @@ MultiDeviceExecutableNetwork::~MultiDeviceExecutableNetwork() {
_workerRequests.clear();
}
std::shared_ptr<InferenceEngine::IRemoteContext> MultiDeviceExecutableNetwork::GetContext() const {
std::shared_ptr<InferenceEngine::RemoteContext> MultiDeviceExecutableNetwork::GetContext() const {
auto devices = [&] {
std::lock_guard<std::mutex> lock(_mutex);
return _devicePriorities;

View File

@ -117,7 +117,7 @@ public:
InferenceEngine::IInferRequestInternal::Ptr CreateInferRequest() override;
InferenceEngine::IInferRequestInternal::Ptr CreateInferRequestImpl(InferenceEngine::InputsDataMap networkInputs,
InferenceEngine::OutputsDataMap networkOutputs) override;
std::shared_ptr<InferenceEngine::IRemoteContext> GetContext() const override;
std::shared_ptr<InferenceEngine::RemoteContext> GetContext() const override;
~MultiDeviceExecutableNetwork() override;
void ScheduleToWorkerInferRequest(InferenceEngine::Task, DeviceName preferred_device = "");

View File

@ -22,7 +22,7 @@ namespace InferenceEngine {
class IInferencePlugin;
class IInferRequestInternal;
class IRemoteContext;
class RemoteContext;
class IVariableStateInternal;
/**
@ -134,7 +134,7 @@ public:
* @brief Gets the remote context.
* @return A reference to a context
*/
virtual std::shared_ptr<IRemoteContext> GetContext() const;
virtual std::shared_ptr<RemoteContext> GetContext() const;
protected:
~IExecutableNetworkInternal() = default;

View File

@ -28,7 +28,7 @@ namespace InferenceEngine {
class ICore;
class IExecutableNetworkInternal;
class IRemoteContext;
class RemoteContext;
class IExtension;
/**
@ -147,13 +147,13 @@ public:
* @brief Creates an executable network from network object, on specified remote context
* @param network A network object acquired from InferenceEngine::Core::ReadNetwork
* @param config string-string map of config parameters relevant only for this load operation
* @param context A pointer to plugin context derived from IRemoteContext class used to
* @param context A pointer to plugin context derived from RemoteContext class used to
* execute the network
* @return Created Executable Network object
*/
virtual std::shared_ptr<IExecutableNetworkInternal> LoadNetwork(const CNNNetwork& network,
const std::map<std::string, std::string>& config,
const std::shared_ptr<IRemoteContext>& context);
const std::shared_ptr<RemoteContext>& context);
/**
* @brief Creates an executable network from model file path
@ -197,14 +197,14 @@ public:
* @param[in] params The map of parameters
* @return A remote context object
*/
virtual std::shared_ptr<IRemoteContext> CreateContext(const ParamMap& params);
virtual std::shared_ptr<RemoteContext> CreateContext(const ParamMap& params);
/**
* @brief Provides a default remote context instance if supported by a plugin
* @param[in] params The map of parameters
* @return The default context.
*/
virtual std::shared_ptr<IRemoteContext> GetDefaultContext(const ParamMap& params);
virtual std::shared_ptr<RemoteContext> GetDefaultContext(const ParamMap& params);
/**
* @deprecated Use ImportNetwork(std::istream& networkModel, const std::map<std::string, std::string>& config)
@ -236,7 +236,7 @@ public:
* @return An Executable network
*/
virtual std::shared_ptr<IExecutableNetworkInternal> ImportNetwork(std::istream& networkModel,
const std::shared_ptr<IRemoteContext>& context,
const std::shared_ptr<RemoteContext>& context,
const std::map<std::string, std::string>& config);
/**
@ -283,7 +283,7 @@ protected:
* resources)
* @note The function is used in
* InferencePluginInternal::LoadNetwork(const CNNNetwork&, const std::map<std::string, std::string>&,
* IRemoteContext::Ptr) which performs common steps first and calls this plugin-dependent method implementation
* RemoteContext::Ptr) which performs common steps first and calls this plugin-dependent method implementation
* after.
* @param network A network object
* @param context A remote context
@ -292,7 +292,7 @@ protected:
*/
virtual std::shared_ptr<IExecutableNetworkInternal> LoadExeNetworkImpl(
const CNNNetwork& network,
const std::shared_ptr<IRemoteContext>& context,
const std::shared_ptr<RemoteContext>& context,
const std::map<std::string, std::string>& config);
/**

View File

@ -1,67 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
/**
* @brief This is a header file for the IE RemoteContext and RemoteBlob classes
*
* @file ie_remote_context.hpp
*/
#pragma once
#include <memory>
#include <string>
#include "ie_parameter.hpp"
#include "ie_remote_context.hpp"
namespace InferenceEngine {
class RemoteBlob;
class INFERENCE_ENGINE_API_CLASS(IRemoteContext)
: public RemoteContext,
public std::enable_shared_from_this<RemoteContext> {
public:
/**
* @brief A smart pointer to the IRemoteContext object
*/
using Ptr = std::shared_ptr<IRemoteContext>;
/**
* @brief Returns name of the device on which underlying object is allocated.
* Abstract method.
* @return A device name string in the same format as that in plugin metric.
*/
std::string getDeviceName() const noexcept override;
/**
* @brief Allocates memory blob in device memory or wraps user-supplied memory handle
* using the specified tensor description and low-level device-specific parameters.
* Returns a pointer to the object which implements RemoteBlob interface.
* @param tensorDesc Defines the layout and dims of the blob
* @param params Map of the low-level blob object parameters.
* Abstract method.
* @return A pointer to plugin object that implements RemoteBlob interface.
*/
std::shared_ptr<RemoteBlob> CreateBlob(const TensorDesc& tensorDesc, const ParamMap& params = {}) override;
/**
* @brief Returns a map of device-specific parameters required for low-level
* operations with underlying object.
* Parameters include device/context handles, access flags,
* etc. Contents of the map returned depend on remote execution context that is
* currently set on the device (working scenario).
* Abstract method.
* @return A map of name/parameter elements.
*/
ParamMap getParams() const override;
protected:
/**
* @brief IRemoteContext destructor
*/
~IRemoteContext() = default;
};
} // namespace InferenceEngine

View File

@ -17,7 +17,7 @@
#include "details/ie_so_loader.h"
#include "ie_metric_helpers.hpp"
#include "cpp_interfaces/interface/ie_iremote_context.hpp"
#include "ie_remote_context.hpp"
#include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp"
#include "cpp_interfaces/interface/ie_iplugin_internal.hpp"
@ -62,7 +62,7 @@ std::string getTestCaseName(const testing::TestParamInfo<std::tuple<TestParam, s
return std::get<1>(std::get<0>(obj.param)) + "_" + std::get<1>(obj.param);
}
class MockRemoteContext : public IRemoteContext {
class MockRemoteContext : public RemoteContext {
std::string m_name;
public:
MockRemoteContext(std::string name): m_name(std::move(name)) {}
@ -97,7 +97,7 @@ public:
const std::map<std::string, std::string>& config));
MOCK_METHOD3(LoadExeNetworkImpl, std::shared_ptr<IExecutableNetworkInternal>(const CNNNetwork& network,
const IRemoteContext::Ptr& context,
const RemoteContext::Ptr& context,
const std::map<std::string, std::string>& config));
MOCK_CONST_METHOD0(OnLoadNetworkFromFile, void(void));
@ -106,7 +106,7 @@ public:
const std::map<std::string, std::string>& config));
MOCK_METHOD3(ImportNetwork, IExecutableNetworkInternal::Ptr(std::istream& networkModel,
const IRemoteContext::Ptr& context,
const RemoteContext::Ptr& context,
const std::map<std::string, std::string>& config));
MOCK_CONST_METHOD2(QueryNetwork, QueryNetworkResult(const CNNNetwork& network,
@ -114,7 +114,7 @@ public:
MOCK_CONST_METHOD2(GetMetric, Parameter(const std::string& name, const std::map<std::string, Parameter>& options));
MOCK_METHOD1(SetConfig, void(const std::map<std::string, std::string>& options));
MOCK_METHOD1(GetDefaultContext, std::shared_ptr<IRemoteContext>(const ParamMap& params));
MOCK_METHOD1(GetDefaultContext, std::shared_ptr<RemoteContext>(const ParamMap& params));
};
class MockExecutableNetwork : public IExecutableNetworkInternal {
@ -336,7 +336,7 @@ private:
WillByDefault(Return("mock"));
ON_CALL(plugin, ImportNetwork(_, _, _)).
WillByDefault(Invoke([&](std::istream &istr, const IRemoteContext::Ptr&,
WillByDefault(Invoke([&](std::istream &istr, const RemoteContext::Ptr&,
const std::map<std::string, std::string> &) {
return createMockIExecutableNet();
}));
@ -347,7 +347,7 @@ private:
}));
ON_CALL(plugin, LoadExeNetworkImpl(_, _, _)).
WillByDefault(Invoke([&](const CNNNetwork &, const IRemoteContext::Ptr&,
WillByDefault(Invoke([&](const CNNNetwork &, const RemoteContext::Ptr&,
const std::map<std::string, std::string> &) {
return net;
}));
@ -443,7 +443,7 @@ TEST_P(CachingTest, TestLoadCustomImportExport) {
EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber());
EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber());
ON_CALL(*mockPlugin, ImportNetwork(_, _, _)).
WillByDefault(Invoke([&](std::istream& s, IRemoteContext::Ptr,
WillByDefault(Invoke([&](std::istream& s, RemoteContext::Ptr,
const std::map<std::string, std::string> &) {
char a[sizeof(customData)];
s.read(a, sizeof(customData));

View File

@ -17,14 +17,14 @@ public:
MOCK_METHOD3(LoadNetwork, InferenceEngine::SoExecutableNetworkInternal(
const InferenceEngine::CNNNetwork&, const std::string&, const std::map<std::string, std::string>&));
MOCK_METHOD3(LoadNetwork, InferenceEngine::SoExecutableNetworkInternal(
const InferenceEngine::CNNNetwork&, const std::shared_ptr<InferenceEngine::IRemoteContext> &, const std::map<std::string, std::string>&));
const InferenceEngine::CNNNetwork&, const std::shared_ptr<InferenceEngine::RemoteContext> &, const std::map<std::string, std::string>&));
MOCK_METHOD3(LoadNetwork, InferenceEngine::SoExecutableNetworkInternal(
const std::string &, const std::string &, const std::map<std::string, std::string>&));
MOCK_METHOD3(ImportNetwork, InferenceEngine::SoExecutableNetworkInternal(
std::istream&, const std::string&, const std::map<std::string, std::string>&));
MOCK_METHOD3(ImportNetwork, InferenceEngine::SoExecutableNetworkInternal(
std::istream&, const std::shared_ptr<InferenceEngine::IRemoteContext>&, const std::map<std::string, std::string>&));
std::istream&, const std::shared_ptr<InferenceEngine::RemoteContext>&, const std::map<std::string, std::string>&));
MOCK_CONST_METHOD3(QueryNetwork, InferenceEngine::QueryNetworkResult(
const InferenceEngine::CNNNetwork&, const std::string&, const std::map<std::string, std::string>&));

View File

@ -30,7 +30,7 @@ public:
MOCK_METHOD1(SetConfig, void(const std::map<std::string, Parameter> &config));
MOCK_CONST_METHOD1(GetConfig, Parameter(const std::string &name));
MOCK_CONST_METHOD1(GetMetric, Parameter(const std::string &name));
MOCK_CONST_METHOD0(GetContext, std::shared_ptr<IRemoteContext>(void));
MOCK_CONST_METHOD0(GetContext, std::shared_ptr<RemoteContext>(void));
void WrapOstreamExport(std::ostream& networkModel) {
IExecutableNetworkInternal::Export(networkModel);
}

View File

@ -30,15 +30,15 @@ public:
MOCK_CONST_METHOD2(GetMetric, InferenceEngine::Parameter(
const std::string&, const std::map<std::string, InferenceEngine::Parameter>&));
MOCK_METHOD1(CreateContext,
std::shared_ptr<InferenceEngine::IRemoteContext>(const InferenceEngine::ParamMap&));
MOCK_METHOD1(GetDefaultContext, std::shared_ptr<InferenceEngine::IRemoteContext>(const InferenceEngine::ParamMap&));
std::shared_ptr<InferenceEngine::RemoteContext>(const InferenceEngine::ParamMap&));
MOCK_METHOD1(GetDefaultContext, std::shared_ptr<InferenceEngine::RemoteContext>(const InferenceEngine::ParamMap&));
MOCK_METHOD3(LoadNetwork, std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>(
const InferenceEngine::CNNNetwork&, const std::map<std::string, std::string>&,
std::shared_ptr<InferenceEngine::IRemoteContext>));
std::shared_ptr<InferenceEngine::RemoteContext>));
MOCK_METHOD2(ImportNetwork, std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>(
std::istream&, const std::map<std::string, std::string>&));
MOCK_METHOD3(ImportNetwork, std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>(
std::istream&, const std::shared_ptr<InferenceEngine::IRemoteContext>&,
std::istream&, const std::shared_ptr<InferenceEngine::RemoteContext>&,
const std::map<std::string, std::string>&));
MOCK_CONST_METHOD2(QueryNetwork,
InferenceEngine::QueryNetworkResult(const InferenceEngine::CNNNetwork&,

View File

@ -45,7 +45,7 @@ MockPlugin::LoadNetwork(const CNNNetwork &network,
std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>
MockPlugin::LoadNetwork(const CNNNetwork& network,
const std::map<std::string, std::string>& config,
const std::shared_ptr<IRemoteContext>& context) {
const std::shared_ptr<RemoteContext>& context) {
if (_target) {
return _target->LoadNetwork(network, config, context);
} else {
@ -81,7 +81,7 @@ MockPlugin::ImportNetwork(std::istream& networkModel,
std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>
MockPlugin::ImportNetwork(std::istream& networkModel,
const std::shared_ptr<InferenceEngine::IRemoteContext>& context,
const std::shared_ptr<InferenceEngine::RemoteContext>& context,
const std::map<std::string, std::string>& config) {
if (_target) {
return _target->ImportNetwork(networkModel, context, config);
@ -90,7 +90,7 @@ MockPlugin::ImportNetwork(std::istream& networkModel,
}
}
std::shared_ptr<InferenceEngine::IRemoteContext> MockPlugin::GetDefaultContext(const InferenceEngine::ParamMap& params) {
std::shared_ptr<InferenceEngine::RemoteContext> MockPlugin::GetDefaultContext(const InferenceEngine::ParamMap& params) {
if (_target) {
return _target->GetDefaultContext(params);
} else {

View File

@ -24,7 +24,7 @@ public:
std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>
LoadNetwork(const InferenceEngine::CNNNetwork& network,
const std::map<std::string, std::string>& config,
const std::shared_ptr<InferenceEngine::IRemoteContext>& context) override;
const std::shared_ptr<InferenceEngine::RemoteContext>& context) override;
std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>
LoadExeNetworkImpl(const InferenceEngine::CNNNetwork& network,
@ -40,13 +40,13 @@ public:
std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>
ImportNetwork(std::istream& networkModel,
const std::shared_ptr<InferenceEngine::IRemoteContext>& context,
const std::shared_ptr<InferenceEngine::RemoteContext>& context,
const std::map<std::string, std::string>& config) override;
InferenceEngine::Parameter GetMetric(const std::string& name,
const std::map<std::string, InferenceEngine::Parameter>& options) const override;
std::shared_ptr<InferenceEngine::IRemoteContext> GetDefaultContext(const InferenceEngine::ParamMap& params) override;
std::shared_ptr<InferenceEngine::RemoteContext> GetDefaultContext(const InferenceEngine::ParamMap& params) override;
InferenceEngine::QueryNetworkResult QueryNetwork(const InferenceEngine::CNNNetwork& network,
const std::map<std::string, std::string>& config) const override;