Skip to content

Commit

Permalink
Reverted to Remote Context (#7453)
Browse files Browse the repository at this point in the history
  • Loading branch information
apankratovantonp authored Sep 14, 2021
1 parent 651f07b commit 5e6896d
Show file tree
Hide file tree
Showing 29 changed files with 88 additions and 175 deletions.
6 changes: 3 additions & 3 deletions inference-engine/src/cldnn_engine/cldnn_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));

Expand All @@ -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));
}
Expand Down
6 changes: 3 additions & 3 deletions inference-engine/src/cldnn_engine/cldnn_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class clDNNEngine : public InferenceEngine::IInferencePlugin,
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;
Expand All @@ -53,8 +53,8 @@ class clDNNEngine : public InferenceEngine::IInferencePlugin,
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions inference-engine/src/cldnn_engine/cldnn_executable_network.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -32,7 +32,7 @@ class CLDNNExecNetwork : public InferenceEngine::ExecutableNetworkThreadSafeDefa

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;
Expand Down
2 changes: 1 addition & 1 deletion inference-engine/src/cldnn_engine/cldnn_remote_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
4 changes: 2 additions & 2 deletions inference-engine/src/cldnn_engine/cldnn_remote_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -54,7 +54,7 @@ class CLDNNRemoteBlobImpl : public InferenceEngine::gpu::details::param_map_obj_
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;
Expand Down
6 changes: 3 additions & 3 deletions inference-engine/src/gna_plugin/gna_plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand All @@ -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";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
#pragma once

#include <cpp_interfaces/interface/ie_iremote_context.hpp>
#include <ie_remote_context.hpp>
#include <memory>
#include <string>

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "ie_remote_context.hpp"

namespace InferenceEngine {
class IRemoteContext;
class RemoteBlob;
} // namespace InferenceEngine

Expand All @@ -36,15 +35,15 @@ 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
* @param so Plugin to use. This is required to ensure that RemoteContext can work properly even if plugin
* 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
16 changes: 8 additions & 8 deletions inference-engine/src/inference_engine/src/cpp/ie_plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class InferencePlugin : protected details::SOPointer<IInferencePlugin> {
}

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)});
}
Expand Down Expand Up @@ -95,7 +95,7 @@ class InferencePlugin : protected details::SOPointer<IInferencePlugin> {
}

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)});
}
Expand All @@ -104,11 +104,11 @@ class InferencePlugin : protected details::SOPointer<IInferencePlugin> {
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)});
}

Expand Down Expand Up @@ -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)});
}
Expand Down Expand Up @@ -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)});
}
Expand All @@ -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)});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down

This file was deleted.

Loading

0 comments on commit 5e6896d

Please sign in to comment.