[Core][CPU] Upgrade ie::extension to ov::extension (#21915)
This commit is contained in:
parent
a8311777d1
commit
3bf6f11dfd
|
|
@ -42,10 +42,10 @@ foreach(dev_map IN LISTS OV_DEVICE_MAPPING)
|
|||
|
||||
# declarations
|
||||
set(OV_PLUGINS_DECLARATIONS "${OV_PLUGINS_DECLARATIONS}
|
||||
IE_DEFINE_PLUGIN_CREATE_FUNCTION_DECLARATION(${_OV_CREATE_PLUGIN_FUNC});")
|
||||
OV_DEFINE_PLUGIN_CREATE_FUNCTION_DECLARATION(${_OV_CREATE_PLUGIN_FUNC});")
|
||||
if(${actual_dev_name}_AS_EXTENSION)
|
||||
set(OV_PLUGINS_DECLARATIONS "${OV_PLUGINS_DECLARATIONS}
|
||||
IE_DEFINE_EXTENSION_CREATE_FUNCTION_DECLARATION(${_OV_CREATE_EXTENSION_FUNC});")
|
||||
OV_DEFINE_EXTENSION_CREATE_FUNCTION_DECLARATION(${_OV_CREATE_EXTENSION_FUNC});")
|
||||
else()
|
||||
set(_OV_CREATE_EXTENSION_FUNC "nullptr")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ function(ov_add_plugin)
|
|||
if(OV_PLUGIN_AS_EXTENSION)
|
||||
# to distinguish functions creating extensions objects
|
||||
target_compile_definitions(${OV_PLUGIN_NAME} PRIVATE
|
||||
IE_CREATE_EXTENSION=CreateExtensionShared${OV_PLUGIN_DEVICE_NAME})
|
||||
OV_CREATE_EXTENSION=CreateExtensionShared${OV_PLUGIN_DEVICE_NAME})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -9,13 +9,23 @@
|
|||
|
||||
#ifdef OPENVINO_STATIC_LIBRARY
|
||||
|
||||
#include "cpp_interfaces/interface/ie_iplugin_internal.hpp"
|
||||
// The Macro used to create extensions for static library
|
||||
#define OV_DEFINE_EXTENSION_CREATE_FUNCTION_DECLARATION(_OV_CREATE_EXTENSION_FUNC) \
|
||||
OPENVINO_EXTENSION_C_API void \
|
||||
_OV_CREATE_EXTENSION_FUNC(std::vector<::ov::Extension::Ptr>& ext)
|
||||
|
||||
// The Macro used to create plugin for static library
|
||||
#define OV_DEFINE_PLUGIN_CREATE_FUNCTION_DECLARATION(_OV_CREATE_PLUGIN_FUNC) \
|
||||
OPENVINO_PLUGIN_API void \
|
||||
_OV_CREATE_PLUGIN_FUNC(::std::shared_ptr<::ov::IPlugin> &plugin) noexcept(false)
|
||||
|
||||
@OV_PLUGINS_DECLARATIONS@
|
||||
|
||||
using CreateExtensionFunc = void(std::vector<::ov::Extension::Ptr>&);
|
||||
using CreatePluginEngineFunc = void(std::shared_ptr<::ov::IPlugin>&);
|
||||
struct Value {
|
||||
InferenceEngine::CreatePluginEngineFunc * m_create_plugin_func;
|
||||
InferenceEngine::CreateExtensionFunc * m_create_extension_func;
|
||||
CreatePluginEngineFunc * m_create_plugin_func;
|
||||
CreateExtensionFunc * m_create_extension_func;
|
||||
std::map<std::string, std::string> m_default_config;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -28,24 +28,28 @@ public:
|
|||
|
||||
virtual ~Extension();
|
||||
};
|
||||
} // namespace ov
|
||||
|
||||
#ifndef OV_CREATE_EXTENSION
|
||||
/**
|
||||
* @brief The entry point for library with OpenVINO extensions
|
||||
*
|
||||
* @param vector of extensions
|
||||
*/
|
||||
OPENVINO_EXTENSION_C_API
|
||||
void create_extensions(std::vector<Extension::Ptr>&);
|
||||
void create_extensions(std::vector<ov::Extension::Ptr>&);
|
||||
|
||||
} // namespace ov
|
||||
# define OV_CREATE_EXTENSION create_extensions
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Macro generates the entry point for the library
|
||||
*
|
||||
* @param vector of extensions
|
||||
*/
|
||||
#define OPENVINO_CREATE_EXTENSIONS(extensions) \
|
||||
OPENVINO_EXTENSION_C_API \
|
||||
void ::ov::create_extensions(std::vector<::ov::Extension::Ptr>& ext) { \
|
||||
ext = extensions; \
|
||||
#define OPENVINO_CREATE_EXTENSIONS(extensions) \
|
||||
OPENVINO_EXTENSION_C_API void OV_CREATE_EXTENSION(std::vector<ov::Extension::Ptr>& ext); \
|
||||
OPENVINO_EXTENSION_C_API void OV_CREATE_EXTENSION(std::vector<ov::Extension::Ptr>& ext) { \
|
||||
ext = extensions; \
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include "ie_iextension.h"
|
||||
#include "ie_input_info.hpp"
|
||||
#include "ie_parameter.hpp"
|
||||
#include "openvino/core/extension.hpp"
|
||||
#include "openvino/runtime/iplugin.hpp"
|
||||
#include "openvino/util/pp.hpp"
|
||||
#include "so_ptr.hpp"
|
||||
|
|
@ -377,16 +378,6 @@ protected:
|
|||
bool _isNewAPI; //!< A flag which shows used API
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
using CreatePluginEngineFunc = void(std::shared_ptr<::ov::IPlugin>&);
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
using CreateExtensionFunc = void(std::shared_ptr<IExtension>&);
|
||||
|
||||
/**
|
||||
* @def IE_CREATE_PLUGIN
|
||||
* @brief Defines a name of a function creating plugin instance
|
||||
|
|
@ -428,17 +419,3 @@ convert_plugin(const std::shared_ptr<InferenceEngine::IInferencePlugin>& from);
|
|||
ie_plugin->SetVersion(version); \
|
||||
plugin = convert_plugin(ie_plugin); \
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
#define IE_DEFINE_PLUGIN_CREATE_FUNCTION_DECLARATION(_IE_CREATE_PLUGIN_FUNC) \
|
||||
INFERENCE_PLUGIN_API(void) \
|
||||
_IE_CREATE_PLUGIN_FUNC(::std::shared_ptr<::ov::IPlugin>& plugin) noexcept(false)
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
#define IE_DEFINE_EXTENSION_CREATE_FUNCTION_DECLARATION(_IE_CREATE_EXTENSION_FUNC) \
|
||||
INFERENCE_EXTENSION_API(void) \
|
||||
_IE_CREATE_EXTENSION_FUNC(::InferenceEngine::IExtensionPtr& ext)
|
||||
|
|
|
|||
|
|
@ -703,9 +703,9 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {
|
|||
|
||||
if (desc.extensionCreateFunc) { // static OpenVINO case
|
||||
try {
|
||||
InferenceEngine::IExtensionPtr ext;
|
||||
std::vector<ov::Extension::Ptr> ext;
|
||||
desc.extensionCreateFunc(ext);
|
||||
AddExtensionUnsafe(ext);
|
||||
add_extensions_unsafe(ext);
|
||||
} catch (const InferenceEngine::GeneralError&) {
|
||||
// the same extension can be registered multiple times - ignore it!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@
|
|||
|
||||
namespace ov {
|
||||
|
||||
using CreateExtensionFunc = void(std::vector<::ov::Extension::Ptr>&);
|
||||
using CreatePluginEngineFunc = void(std::shared_ptr<::ov::IPlugin>&);
|
||||
|
||||
const std::string DEFAULT_DEVICE_NAME = "DEFAULT_DEVICE";
|
||||
|
||||
struct Parsed {
|
||||
|
|
@ -123,8 +126,8 @@ private:
|
|||
ov::util::FilePath libraryLocation;
|
||||
ov::AnyMap defaultConfig;
|
||||
std::vector<ov::util::FilePath> listOfExtentions;
|
||||
InferenceEngine::CreatePluginEngineFunc* pluginCreateFunc = nullptr;
|
||||
InferenceEngine::CreateExtensionFunc* extensionCreateFunc = nullptr;
|
||||
CreatePluginEngineFunc* pluginCreateFunc = nullptr;
|
||||
CreateExtensionFunc* extensionCreateFunc = nullptr;
|
||||
|
||||
PluginDescriptor() = default;
|
||||
|
||||
|
|
@ -136,9 +139,9 @@ private:
|
|||
this->listOfExtentions = listOfExtentions;
|
||||
}
|
||||
|
||||
PluginDescriptor(InferenceEngine::CreatePluginEngineFunc* pluginCreateFunc,
|
||||
PluginDescriptor(CreatePluginEngineFunc* pluginCreateFunc,
|
||||
const ov::AnyMap& defaultConfig = {},
|
||||
InferenceEngine::CreateExtensionFunc* extensionCreateFunc = nullptr) {
|
||||
CreateExtensionFunc* extensionCreateFunc = nullptr) {
|
||||
this->pluginCreateFunc = pluginCreateFunc;
|
||||
this->defaultConfig = defaultConfig;
|
||||
this->extensionCreateFunc = extensionCreateFunc;
|
||||
|
|
|
|||
|
|
@ -40,13 +40,11 @@ struct ImmediateSerialExecutor : public ov::threading::ITaskExecutor {
|
|||
CompiledModel::CompiledModel(const std::shared_ptr<ov::Model>& model,
|
||||
const std::shared_ptr<const ov::IPlugin>& plugin,
|
||||
const Config& cfg,
|
||||
const ExtensionManager::Ptr& extMgr,
|
||||
const bool loaded_from_cache)
|
||||
: ov::ICompiledModel::ICompiledModel(model, plugin),
|
||||
m_model(model),
|
||||
m_plugin(plugin),
|
||||
m_cfg{cfg},
|
||||
extensionManager(extMgr),
|
||||
m_name{model->get_name()},
|
||||
m_loaded_from_cache(loaded_from_cache) {
|
||||
bool isFloatModel = !ov::op::util::has_op_with_type<ov::op::v0::FakeQuantize>(m_model);
|
||||
|
|
@ -125,7 +123,7 @@ CompiledModel::GraphGuard::Lock CompiledModel::get_graph() const {
|
|||
(m_cfg.lpTransformsMode == Config::On) &&
|
||||
ov::pass::low_precision::LowPrecision::isFunctionQuantized(m_model);
|
||||
|
||||
ctx = std::make_shared<GraphContext>(m_cfg, extensionManager, weightsCache, isQuantizedFlag);
|
||||
ctx = std::make_shared<GraphContext>(m_cfg, weightsCache, isQuantizedFlag);
|
||||
}
|
||||
const std::shared_ptr<const ov::Model> model = m_model;
|
||||
graphLock._graph.CreateGraph(model, ctx);
|
||||
|
|
@ -306,7 +304,7 @@ ov::Any CompiledModel::get_property(const std::string& name) const {
|
|||
}
|
||||
|
||||
void CompiledModel::export_model(std::ostream& modelStream) const {
|
||||
ModelSerializer serializer(modelStream, extensionManager);
|
||||
ModelSerializer serializer(modelStream);
|
||||
serializer << m_model;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "extension_mngr.h"
|
||||
#include "graph.h"
|
||||
#include "graph_context.h"
|
||||
#include "openvino/runtime/icompiled_model.hpp"
|
||||
|
|
@ -26,7 +25,6 @@ public:
|
|||
CompiledModel(const std::shared_ptr<ov::Model>& model,
|
||||
const std::shared_ptr<const ov::IPlugin>& plugin,
|
||||
const Config& cfg,
|
||||
const ExtensionManager::Ptr& extMgr,
|
||||
const bool loaded_from_cache = false);
|
||||
|
||||
std::shared_ptr<ov::IAsyncInferRequest> create_infer_request() const override;
|
||||
|
|
@ -55,7 +53,6 @@ private:
|
|||
// Usage example: helps to avoid data races during CPU Graph initialization in multi-streams scenario
|
||||
std::shared_ptr<std::mutex> m_mutex;
|
||||
Config m_cfg;
|
||||
ExtensionManager::Ptr extensionManager;
|
||||
mutable std::atomic_int m_numRequests = {0};
|
||||
std::string m_name;
|
||||
struct GraphGuard : public Graph {
|
||||
|
|
|
|||
|
|
@ -2,204 +2,137 @@
|
|||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "extension.h"
|
||||
#include "openvino/core/extension.hpp"
|
||||
|
||||
#include "openvino/core/op_extension.hpp"
|
||||
#include "ov_ops/augru_cell.hpp"
|
||||
#include "ov_ops/augru_sequence.hpp"
|
||||
#include "ov_ops/multiclass_nms_ie_internal.hpp"
|
||||
#include "ov_ops/nms_ie_internal.hpp"
|
||||
#include "ov_ops/nms_static_shape_ie.hpp"
|
||||
#include "ov_ops/type_relaxed.hpp"
|
||||
#include "snippets/op/subgraph.hpp"
|
||||
#include "transformations/cpu_opset/common/op/fully_connected.hpp"
|
||||
#include "transformations/cpu_opset/common/op/leaky_relu.hpp"
|
||||
#include "transformations/cpu_opset/common/op/ngram.hpp"
|
||||
#include "transformations/cpu_opset/common/op/power_static.hpp"
|
||||
#include "transformations/cpu_opset/common/op/sdpa.hpp"
|
||||
#include "transformations/cpu_opset/common/op/swish_cpu.hpp"
|
||||
#include "transformations/cpu_opset/common/op/ngram.hpp"
|
||||
#include "transformations/cpu_opset/x64/op/mha.hpp"
|
||||
#include "transformations/cpu_opset/x64/op/interaction.hpp"
|
||||
#include "transformations/snippets/x64/op/load_convert.hpp"
|
||||
#include "transformations/snippets/x64/op/store_convert.hpp"
|
||||
#include "transformations/snippets/x64/op/brgemm_cpu.hpp"
|
||||
#include "transformations/cpu_opset/x64/op/mha.hpp"
|
||||
#include "transformations/snippets/x64/op/brgemm_copy_b.hpp"
|
||||
#include "transformations/snippets/x64/op/brgemm_cpu.hpp"
|
||||
#include "transformations/snippets/x64/op/load_convert.hpp"
|
||||
#include "transformations/snippets/x64/op/perf_count_rdtsc.hpp"
|
||||
#include "transformations/snippets/x64/op/store_convert.hpp"
|
||||
|
||||
#include <ov_ops/augru_cell.hpp>
|
||||
#include <ov_ops/augru_sequence.hpp>
|
||||
#include <ov_ops/type_relaxed.hpp>
|
||||
#include <ov_ops/nms_ie_internal.hpp>
|
||||
#include <ov_ops/nms_static_shape_ie.hpp>
|
||||
#include <ov_ops/multiclass_nms_ie_internal.hpp>
|
||||
|
||||
#include "snippets/op/subgraph.hpp"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
namespace ov {
|
||||
namespace intel_cpu {
|
||||
|
||||
void Extension::GetVersion(const InferenceEngine::Version*& versionInfo) const noexcept {
|
||||
static const InferenceEngine::Version version = {
|
||||
{1, 0}, // extension API version
|
||||
"1.0",
|
||||
"Extension" // extension description message
|
||||
};
|
||||
|
||||
versionInfo = &version;
|
||||
}
|
||||
|
||||
void Extension::Unload() noexcept {}
|
||||
|
||||
std::map<std::string, ngraph::OpSet> Extension::getOpSets() {
|
||||
auto cpu_plugin_opset = []() {
|
||||
ngraph::OpSet opset;
|
||||
#define OP_EXTENSION(NAME) std::make_shared<ov::OpExtension<NAME>>(),
|
||||
|
||||
#if defined(OPENVINO_ARCH_X86_64)
|
||||
#define NGRAPH_OP_X64(NAME, NAMESPACE) NGRAPH_OP(NAME, NAMESPACE)
|
||||
# define OP_EXTENSION_X64(NAME) OP_EXTENSION(NAME)
|
||||
#else
|
||||
#define NGRAPH_OP_X64(NAME, NAMESPACE)
|
||||
# define OP_EXTENSION_X64(NAME)
|
||||
#endif
|
||||
|
||||
#define NGRAPH_OP(NAME, NAMESPACE) opset.insert<NAMESPACE::NAME>();
|
||||
NGRAPH_OP(FullyConnectedNode, ov::intel_cpu)
|
||||
NGRAPH_OP(LeakyReluNode, ov::intel_cpu)
|
||||
NGRAPH_OP(PowerStaticNode, ov::intel_cpu)
|
||||
NGRAPH_OP(SwishNode, ov::intel_cpu)
|
||||
NGRAPH_OP(NgramNode, ov::intel_cpu)
|
||||
NGRAPH_OP_X64(MHANode, ov::intel_cpu)
|
||||
NGRAPH_OP_X64(InteractionNode, ov::intel_cpu)
|
||||
NGRAPH_OP_X64(ScaledDotProductAttentionWithKVCache, ov::intel_cpu)
|
||||
#undef NGRAPH_OP
|
||||
#define CPU_EXTENSIONS \
|
||||
OP_EXTENSION(ov::intel_cpu::FullyConnectedNode) \
|
||||
OP_EXTENSION(ov::intel_cpu::LeakyReluNode) \
|
||||
OP_EXTENSION(ov::intel_cpu::PowerStaticNode) \
|
||||
OP_EXTENSION(ov::intel_cpu::SwishNode) \
|
||||
OP_EXTENSION(ov::intel_cpu::NgramNode) \
|
||||
OP_EXTENSION(ov::op::internal::NonMaxSuppressionIEInternal) \
|
||||
OP_EXTENSION(ov::op::internal::MulticlassNmsIEInternal) \
|
||||
OP_EXTENSION(ov::op::internal::AUGRUCell) \
|
||||
OP_EXTENSION(ov::op::internal::AUGRUSequence) \
|
||||
OP_EXTENSION(ov::op::internal::NmsStaticShapeIE<ov::op::v8::MatrixNms>) \
|
||||
OP_EXTENSION_X64(ov::intel_cpu::MHANode) \
|
||||
OP_EXTENSION_X64(ov::intel_cpu::InteractionNode) \
|
||||
OP_EXTENSION_X64(ov::intel_cpu::ScaledDotProductAttentionWithKVCache) \
|
||||
OP_EXTENSION_X64(ov::intel_cpu::LoadConvertSaturation) \
|
||||
OP_EXTENSION_X64(ov::intel_cpu::LoadConvertTruncation) \
|
||||
OP_EXTENSION_X64(ov::intel_cpu::StoreConvertSaturation) \
|
||||
OP_EXTENSION_X64(ov::intel_cpu::StoreConvertTruncation) \
|
||||
OP_EXTENSION_X64(ov::intel_cpu::BrgemmCPU) \
|
||||
OP_EXTENSION_X64(ov::intel_cpu::BrgemmCopyB)
|
||||
|
||||
return opset;
|
||||
};
|
||||
#define TYPE_RELAXED_EXTENSIONS \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::Add>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::AvgPool>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::Clamp>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::Concat>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::Convolution>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::ConvolutionBackpropData>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::DepthToSpace>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::Equal>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::FakeQuantize>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::Greater>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::GreaterEqual>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::GroupConvolution>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::GroupConvolutionBackpropData>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::Interpolate>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v4::Interpolate>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::Less>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::LessEqual>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::LogicalAnd>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::LogicalNot>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::LogicalOr>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::LogicalXor>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::MatMul>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::MaxPool>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::Multiply>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::NormalizeL2>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::NotEqual>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::PRelu>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::Relu>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::ReduceMax>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::ReduceLogicalAnd>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::ReduceLogicalOr>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::ReduceMean>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::ReduceMin>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::ReduceSum>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::Reshape>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::Select>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::ShapeOf>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::ShuffleChannels>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::Squeeze>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v1::Subtract>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::Unsqueeze>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v0::MVN>) \
|
||||
OP_EXTENSION(ov::op::TypeRelaxed<ov::op::v6::MVN>)
|
||||
|
||||
auto type_relaxed_opset = []() {
|
||||
ngraph::OpSet opset;
|
||||
|
||||
#define NGRAPH_OP(NAME, NAMESPACE) opset.insert<ov::op::TypeRelaxed<NAMESPACE::NAME>>();
|
||||
NGRAPH_OP(Add, ov::op::v1)
|
||||
NGRAPH_OP(AvgPool, ov::op::v1)
|
||||
NGRAPH_OP(Clamp, ov::op::v0)
|
||||
NGRAPH_OP(Concat, ov::op::v0)
|
||||
NGRAPH_OP(Convolution, ov::op::v1)
|
||||
NGRAPH_OP(ConvolutionBackpropData, ov::op::v1)
|
||||
NGRAPH_OP(DepthToSpace, ov::op::v0)
|
||||
NGRAPH_OP(Equal, ov::op::v1)
|
||||
NGRAPH_OP(FakeQuantize, ov::op::v0)
|
||||
NGRAPH_OP(Greater, ov::op::v1)
|
||||
NGRAPH_OP(GreaterEqual, ov::op::v1)
|
||||
NGRAPH_OP(GroupConvolution, ov::op::v1)
|
||||
NGRAPH_OP(GroupConvolutionBackpropData, ov::op::v1)
|
||||
NGRAPH_OP(Interpolate, ov::op::v0)
|
||||
NGRAPH_OP(Interpolate, ov::op::v4)
|
||||
NGRAPH_OP(Less, ov::op::v1)
|
||||
NGRAPH_OP(LessEqual, ov::op::v1)
|
||||
NGRAPH_OP(LogicalAnd, ov::op::v1)
|
||||
NGRAPH_OP(LogicalNot, ov::op::v1)
|
||||
NGRAPH_OP(LogicalOr, ov::op::v1)
|
||||
NGRAPH_OP(LogicalXor, ov::op::v1)
|
||||
NGRAPH_OP(MatMul, ov::op::v0)
|
||||
NGRAPH_OP(MaxPool, ov::op::v1)
|
||||
NGRAPH_OP(Multiply, ov::op::v1)
|
||||
NGRAPH_OP(NormalizeL2, ov::op::v0)
|
||||
NGRAPH_OP(NotEqual, ov::op::v1)
|
||||
NGRAPH_OP(PRelu, ov::op::v0)
|
||||
NGRAPH_OP(Relu, ov::op::v0)
|
||||
NGRAPH_OP(ReduceMax, ov::op::v1)
|
||||
NGRAPH_OP(ReduceLogicalAnd, ov::op::v1)
|
||||
NGRAPH_OP(ReduceLogicalOr, ov::op::v1)
|
||||
NGRAPH_OP(ReduceMean, ov::op::v1)
|
||||
NGRAPH_OP(ReduceMin, ov::op::v1)
|
||||
NGRAPH_OP(ReduceSum, ov::op::v1)
|
||||
NGRAPH_OP(Reshape, ov::op::v1)
|
||||
NGRAPH_OP(Select, ov::op::v1)
|
||||
NGRAPH_OP(ShapeOf, ov::op::v0)
|
||||
NGRAPH_OP(ShuffleChannels, ov::op::v0)
|
||||
NGRAPH_OP(Squeeze, ov::op::v0)
|
||||
NGRAPH_OP(Subtract, ov::op::v1)
|
||||
NGRAPH_OP(Unsqueeze, ov::op::v0)
|
||||
NGRAPH_OP(MVN, ov::op::v0)
|
||||
NGRAPH_OP(MVN, ov::op::v6)
|
||||
NGRAPH_OP(Select, ov::op::v1)
|
||||
NGRAPH_OP(ConvolutionBackpropData, ov::op::v1)
|
||||
#undef NGRAPH_OP
|
||||
|
||||
return opset;
|
||||
};
|
||||
|
||||
auto ie_internal_opset = []() {
|
||||
ngraph::OpSet opset;
|
||||
|
||||
#define NGRAPH_OP(NAME, NAMESPACE) opset.insert<NAMESPACE::NAME>();
|
||||
NGRAPH_OP(NonMaxSuppressionIEInternal, ov::op::internal)
|
||||
NGRAPH_OP(MulticlassNmsIEInternal, ov::op::internal)
|
||||
NGRAPH_OP(AUGRUCell, ov::op::internal)
|
||||
NGRAPH_OP(AUGRUSequence, ov::op::internal)
|
||||
NGRAPH_OP(NmsStaticShapeIE<ov::op::v8::MatrixNms>, ov::op::internal)
|
||||
#undef NGRAPH_OP
|
||||
|
||||
return opset;
|
||||
};
|
||||
|
||||
auto snippets_opset = []() {
|
||||
ngraph::OpSet opset;
|
||||
|
||||
#define NGRAPH_OP(NAME, NAMESPACE) opset.insert<NAMESPACE::NAME>();
|
||||
NGRAPH_OP(Brgemm, ov::snippets::op)
|
||||
NGRAPH_OP(BroadcastLoad, ov::snippets::op)
|
||||
NGRAPH_OP(BroadcastMove, ov::snippets::op)
|
||||
NGRAPH_OP(ConvertSaturation, ov::snippets::op)
|
||||
NGRAPH_OP(ConvertTruncation, ov::snippets::op)
|
||||
NGRAPH_OP(Fill, ov::snippets::op)
|
||||
NGRAPH_OP(HorizonMax, ov::snippets::op)
|
||||
NGRAPH_OP(HorizonSum, ov::snippets::op)
|
||||
NGRAPH_OP(Kernel, ov::snippets::op)
|
||||
NGRAPH_OP(IntermediateMemoryBuffer, ov::snippets::op)
|
||||
NGRAPH_OP(Load, ov::snippets::op)
|
||||
NGRAPH_OP(LoadReshape, ov::snippets::op)
|
||||
NGRAPH_OP(LoopBegin, ov::snippets::op)
|
||||
NGRAPH_OP(LoopEnd, ov::snippets::op)
|
||||
NGRAPH_OP(NewMemoryBuffer, ov::snippets::op)
|
||||
NGRAPH_OP(Nop, ov::snippets::op)
|
||||
NGRAPH_OP(PowerStatic, ov::snippets::op)
|
||||
NGRAPH_OP(Scalar, ov::snippets::op)
|
||||
NGRAPH_OP(Store, ov::snippets::op)
|
||||
NGRAPH_OP(Subgraph, ov::snippets::op)
|
||||
NGRAPH_OP(VectorBuffer, ov::snippets::op)
|
||||
NGRAPH_OP(RankNormalization, ov::snippets::op)
|
||||
#ifdef SNIPPETS_DEBUG_CAPS
|
||||
NGRAPH_OP(PerfCountBegin, ov::snippets::op)
|
||||
NGRAPH_OP(PerfCountEnd, ov::snippets::op)
|
||||
# define SNIPPETS_DEBUG_CAPS_EXTENSIONS \
|
||||
OP_EXTENSION(ov::snippets::op::PerfCountBegin) \
|
||||
OP_EXTENSION(ov::snippets::op::PerfCountEnd) \
|
||||
OP_EXTENSION_X64(ov::intel_cpu::PerfCountRdtscBegin) \
|
||||
OP_EXTENSION_X64(ov::intel_cpu::PerfCountRdtscEnd)
|
||||
#else
|
||||
# define SNIPPETS_DEBUG_CAPS_EXTENSIONS
|
||||
#endif
|
||||
NGRAPH_OP_X64(LoadConvertSaturation, ov::intel_cpu)
|
||||
NGRAPH_OP_X64(LoadConvertTruncation, ov::intel_cpu)
|
||||
NGRAPH_OP_X64(StoreConvertSaturation, ov::intel_cpu)
|
||||
NGRAPH_OP_X64(StoreConvertTruncation, ov::intel_cpu)
|
||||
NGRAPH_OP_X64(BrgemmCPU, ov::intel_cpu)
|
||||
NGRAPH_OP_X64(BrgemmCopyB, ov::intel_cpu)
|
||||
#ifdef SNIPPETS_DEBUG_CAPS
|
||||
NGRAPH_OP_X64(PerfCountRdtscBegin, ov::intel_cpu)
|
||||
NGRAPH_OP_X64(PerfCountRdtscEnd, ov::intel_cpu)
|
||||
#endif
|
||||
#undef NGRAPH_OP
|
||||
|
||||
return opset;
|
||||
};
|
||||
#define SNIPPETS_EXTENSIONS \
|
||||
OP_EXTENSION(ov::snippets::op::Brgemm) \
|
||||
OP_EXTENSION(ov::snippets::op::BroadcastLoad) \
|
||||
OP_EXTENSION(ov::snippets::op::BroadcastMove) \
|
||||
OP_EXTENSION(ov::snippets::op::ConvertSaturation) \
|
||||
OP_EXTENSION(ov::snippets::op::ConvertTruncation) \
|
||||
OP_EXTENSION(ov::snippets::op::Fill) \
|
||||
OP_EXTENSION(ov::snippets::op::HorizonMax) \
|
||||
OP_EXTENSION(ov::snippets::op::HorizonSum) \
|
||||
OP_EXTENSION(ov::snippets::op::Kernel) \
|
||||
OP_EXTENSION(ov::snippets::op::IntermediateMemoryBuffer) \
|
||||
OP_EXTENSION(ov::snippets::op::Load) \
|
||||
OP_EXTENSION(ov::snippets::op::LoadReshape) \
|
||||
OP_EXTENSION(ov::snippets::op::LoopBegin) \
|
||||
OP_EXTENSION(ov::snippets::op::LoopEnd) \
|
||||
OP_EXTENSION(ov::snippets::op::NewMemoryBuffer) \
|
||||
OP_EXTENSION(ov::snippets::op::Nop) \
|
||||
OP_EXTENSION(ov::snippets::op::PowerStatic) \
|
||||
OP_EXTENSION(ov::snippets::op::Scalar) \
|
||||
OP_EXTENSION(ov::snippets::op::Store) \
|
||||
OP_EXTENSION(ov::snippets::op::Subgraph) \
|
||||
OP_EXTENSION(ov::snippets::op::VectorBuffer) \
|
||||
OP_EXTENSION(ov::snippets::op::RankNormalization)
|
||||
|
||||
static std::map<std::string, ngraph::OpSet> opsets = {
|
||||
{ "cpu_plugin_opset", cpu_plugin_opset() },
|
||||
{ "type_relaxed_opset", type_relaxed_opset() },
|
||||
{ "ie_internal_opset", ie_internal_opset() },
|
||||
{ "SnippetsOpset", snippets_opset() },
|
||||
};
|
||||
|
||||
return opsets;
|
||||
}
|
||||
|
||||
std::vector<std::string> Extension::getImplTypes(const std::shared_ptr<ov::Node>&) {
|
||||
return {};
|
||||
}
|
||||
|
||||
InferenceEngine::ILayerImpl::Ptr Extension::getImplementation(const std::shared_ptr<ov::Node>& node, const std::string& implType) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace intel_cpu
|
||||
} // namespace ov
|
||||
|
||||
// Generate exported function
|
||||
IE_DEFINE_EXTENSION_CREATE_FUNCTION(ov::intel_cpu::Extension)
|
||||
OPENVINO_CREATE_EXTENSIONS(std::vector<ov::Extension::Ptr>(
|
||||
{CPU_EXTENSIONS TYPE_RELAXED_EXTENSIONS SNIPPETS_EXTENSIONS SNIPPETS_DEBUG_CAPS_EXTENSIONS}));
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ie_iextension.h>
|
||||
|
||||
namespace ov {
|
||||
namespace intel_cpu {
|
||||
|
||||
class Extension : public InferenceEngine::IExtension {
|
||||
public:
|
||||
void GetVersion(const InferenceEngine::Version*& versionInfo) const noexcept override;
|
||||
void Unload() noexcept override;
|
||||
std::map<std::string, ngraph::OpSet> getOpSets() override;
|
||||
std::vector<std::string> getImplTypes(const std::shared_ptr<ov::Node>& node) override;
|
||||
InferenceEngine::ILayerImpl::Ptr getImplementation(const std::shared_ptr<ov::Node>& node, const std::string& implType) override;
|
||||
};
|
||||
|
||||
} // namespace intel_cpu
|
||||
} // namespace ov
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include "extension_mngr.h"
|
||||
|
||||
using namespace InferenceEngine;
|
||||
|
||||
namespace ov {
|
||||
namespace intel_cpu {
|
||||
|
||||
void ExtensionManager::AddExtension(const IExtensionPtr& extension) {
|
||||
_extensions.push_back(extension);
|
||||
}
|
||||
|
||||
InferenceEngine::ILayerImpl::Ptr ExtensionManager::CreateImplementation(const std::shared_ptr<ov::Node>& op) {
|
||||
if (!op)
|
||||
OPENVINO_THROW("Cannot get nGraph operation!");
|
||||
for (const auto& ext : _extensions) {
|
||||
auto implTypes = ext->getImplTypes(op);
|
||||
for (const auto& type : implTypes) {
|
||||
if (type != "CPU")
|
||||
continue;
|
||||
auto impl = ext->getImplementation(op, "CPU");
|
||||
if (impl)
|
||||
return impl;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::vector<InferenceEngine::IExtensionPtr> & ExtensionManager::Extensions() const {
|
||||
return _extensions;
|
||||
}
|
||||
|
||||
} // namespace intel_cpu
|
||||
} // namespace ov
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <ie_iextension.h>
|
||||
|
||||
namespace ov {
|
||||
namespace intel_cpu {
|
||||
|
||||
class ExtensionManager {
|
||||
public:
|
||||
using Ptr = std::shared_ptr<ExtensionManager>;
|
||||
ExtensionManager() = default;
|
||||
InferenceEngine::ILayerImpl::Ptr CreateImplementation(const std::shared_ptr<ov::Node>& op);
|
||||
void AddExtension(const InferenceEngine::IExtensionPtr& extension);
|
||||
const std::vector<InferenceEngine::IExtensionPtr> & Extensions() const;
|
||||
|
||||
private:
|
||||
std::vector<InferenceEngine::IExtensionPtr> _extensions;
|
||||
};
|
||||
|
||||
} // namespace intel_cpu
|
||||
} // namespace ov
|
||||
|
|
@ -7,7 +7,6 @@
|
|||
#include "cache/multi_cache.h"
|
||||
#include "config.h"
|
||||
#include "dnnl_scratch_pad.h"
|
||||
#include "extension_mngr.h"
|
||||
#include "weights_cache.hpp"
|
||||
|
||||
namespace ov {
|
||||
|
|
@ -19,11 +18,9 @@ public:
|
|||
typedef std::shared_ptr<const GraphContext> CPtr;
|
||||
|
||||
GraphContext(const Config& config,
|
||||
ExtensionManager::Ptr extensionManager,
|
||||
WeightsSharing::Ptr w_cache,
|
||||
bool isGraphQuantized)
|
||||
: config(config),
|
||||
extensionManager(extensionManager),
|
||||
weightsCache(w_cache),
|
||||
isGraphQuantizedFlag(isGraphQuantized) {
|
||||
rtParamsCache = std::make_shared<MultiCache>(config.rtCacheCapacity);
|
||||
|
|
@ -34,10 +31,6 @@ public:
|
|||
return config;
|
||||
}
|
||||
|
||||
ExtensionManager::Ptr getExtensionManager() const {
|
||||
return extensionManager;
|
||||
}
|
||||
|
||||
WeightsSharing::Ptr getWeightsCache() const {
|
||||
return weightsCache;
|
||||
}
|
||||
|
|
@ -60,7 +53,6 @@ public:
|
|||
private:
|
||||
Config config; // network-level config
|
||||
|
||||
ExtensionManager::Ptr extensionManager;
|
||||
WeightsSharing::Ptr weightsCache; // per NUMA node caches for sharing weights data
|
||||
|
||||
MultiCachePtr rtParamsCache; // primitive cache
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#include "dnnl_extension_utils.h"
|
||||
#include "dnnl_types.h"
|
||||
#include "edge.h"
|
||||
#include "extension_mngr.h"
|
||||
#include "itt.h"
|
||||
#include "memory_desc/cpu_memory_desc_utils.h"
|
||||
#include "memory_desc/dnnl_blocked_memory_desc.h"
|
||||
|
|
@ -1295,7 +1294,7 @@ Node* Node::NodesFactory::create(const std::shared_ptr<ov::Node>& op, const Grap
|
|||
if (newNode == nullptr) {
|
||||
try {
|
||||
std::unique_ptr<Node> ol(createNodeIfRegistered(intel_cpu, TypeFromName(op->get_type_name()), op, context));
|
||||
if (ol != nullptr && ol->created(context->getExtensionManager()))
|
||||
if (ol != nullptr && ol->created())
|
||||
newNode = ol.release();
|
||||
} catch (const ov::Exception& ex) {
|
||||
if (dynamic_cast<const ov::NotImplemented*>(&ex) != nullptr) {
|
||||
|
|
@ -1309,7 +1308,7 @@ Node* Node::NodesFactory::create(const std::shared_ptr<ov::Node>& op, const Grap
|
|||
if (newNode == nullptr) {
|
||||
try {
|
||||
std::unique_ptr<Node> ol(new Reference(op, context, errorMessage));
|
||||
if (ol != nullptr && ol->created(context->getExtensionManager()))
|
||||
if (ol != nullptr && ol->created())
|
||||
newNode = ol.release();
|
||||
} catch (const ov::Exception& ex) {
|
||||
if (dynamic_cast<const ov::NotImplemented*>(&ex) != nullptr) {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@
|
|||
#include "dnnl_postops_composer.h"
|
||||
#include "dnnl_scratch_pad.h"
|
||||
#include "edge.h"
|
||||
#include "extension_mngr.h"
|
||||
#include "graph_context.h"
|
||||
#include "nodes/common/blocked_desc_creator.h"
|
||||
#include "nodes/executors/executor.hpp"
|
||||
#include "nodes/executors/mvn_list.hpp"
|
||||
|
|
@ -410,9 +408,6 @@ public:
|
|||
const std::vector<MemoryDescPtr>& outputDesc) {}
|
||||
virtual void initDescriptor(const NodeConfig& config);
|
||||
virtual bool created() const = 0;
|
||||
virtual bool created(const ExtensionManager::Ptr& extMgr) {
|
||||
return created();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Performs Node initialization based on graph context.
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ private:
|
|||
ptrdiff_t size;
|
||||
};
|
||||
|
||||
ExtensionManager::Ptr ext_mng;
|
||||
Graph subGraphThen;
|
||||
Graph subGraphElse;
|
||||
std::vector<std::deque<MemoryPtr>> inputMemThen, inputMemElse;
|
||||
|
|
|
|||
|
|
@ -140,7 +140,6 @@ private:
|
|||
int getNumIteration(const std::vector<PortMap>& inputPortMap, const std::vector<PortMap>& outputPortMap) const;
|
||||
bool runAsDynamic() const;
|
||||
|
||||
ExtensionManager::Ptr ext_mng;
|
||||
Graph sub_graph;
|
||||
std::vector<std::vector<MemoryPtr>> input_mems;
|
||||
std::vector<MemoryPtr> output_mem;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
#include "plugin.h"
|
||||
|
||||
#include "extension.h"
|
||||
#include "extension_mngr.h"
|
||||
#include "itt.h"
|
||||
#include "internal_properties.hpp"
|
||||
#include "openvino/runtime/intel_cpu/properties.hpp"
|
||||
|
|
@ -171,7 +169,6 @@ Engine::Engine() :
|
|||
get_executor_manager()->execute_task_by_streams_executor(IStreamsExecutor::Config::PreferredCoreType::BIG, [] {
|
||||
dnnl::impl::cpu::x64::cpu();
|
||||
});
|
||||
extensionManager->AddExtension(std::make_shared<Extension>());
|
||||
#if defined(OV_CPU_WITH_ACL)
|
||||
scheduler_guard = SchedulerGuard::instance();
|
||||
#endif
|
||||
|
|
@ -614,7 +611,7 @@ Engine::compile_model(const std::shared_ptr<const ov::Model>& model, const ov::A
|
|||
denormals_as_zero(false);
|
||||
}
|
||||
}
|
||||
return std::make_shared<CompiledModel>(cloned_model, shared_from_this(), conf, extensionManager);
|
||||
return std::make_shared<CompiledModel>(cloned_model, shared_from_this(), conf);
|
||||
}
|
||||
|
||||
void Engine::set_property(const ov::AnyMap &config) {
|
||||
|
|
@ -868,12 +865,6 @@ ov::Any Engine::get_ro_property(const std::string& name, const ov::AnyMap& optio
|
|||
OPENVINO_THROW("Cannot get unsupported property: ", name);
|
||||
}
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
void Engine::add_extension(const InferenceEngine::IExtensionPtr& extension) {
|
||||
extensionManager->AddExtension(extension);
|
||||
}
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
||||
ov::SupportedOpsMap Engine::query_model(const std::shared_ptr<const ov::Model>& model, const ov::AnyMap& config) const {
|
||||
WeightsSharing::Ptr fake_w_cache;
|
||||
|
||||
|
|
@ -892,7 +883,7 @@ ov::SupportedOpsMap Engine::query_model(const std::shared_ptr<const ov::Model>&
|
|||
const Config::SnippetsMode snippetsMode = getSnippetsMode(config, conf);
|
||||
|
||||
auto context =
|
||||
std::make_shared<GraphContext>(conf, extensionManager, fake_w_cache, false);
|
||||
std::make_shared<GraphContext>(conf, fake_w_cache, false);
|
||||
|
||||
auto supported = ov::get_supported_nodes(
|
||||
model,
|
||||
|
|
@ -945,7 +936,7 @@ std::shared_ptr<ov::ICompiledModel> Engine::import_model(std::istream& networkMo
|
|||
// import config props from caching model
|
||||
calculate_streams(conf, model, true);
|
||||
|
||||
auto compiled_model = std::make_shared<CompiledModel>(model, shared_from_this(), conf, extensionManager, true);
|
||||
auto compiled_model = std::make_shared<CompiledModel>(model, shared_from_this(), conf, true);
|
||||
return compiled_model;
|
||||
}
|
||||
} // namespace intel_cpu
|
||||
|
|
|
|||
|
|
@ -43,10 +43,6 @@ public:
|
|||
OPENVINO_THROW_NOT_IMPLEMENTED("Not Implemented get_default_context is not supported by CPU plugin!");
|
||||
};
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
void add_extension(const std::shared_ptr<InferenceEngine::IExtension>& extension) override;
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
||||
private:
|
||||
bool is_legacy_api() const;
|
||||
|
||||
|
|
@ -62,7 +58,6 @@ private:
|
|||
void calculate_streams(Config& conf, const std::shared_ptr<ov::Model>& model, bool imported = false) const;
|
||||
|
||||
Config engConfig;
|
||||
ExtensionManager::Ptr extensionManager = std::make_shared<ExtensionManager>();
|
||||
/* Explicily configured streams have higher priority than performance hints.
|
||||
So track if streams is set explicitly (not auto-configured) */
|
||||
bool streamsExplicitlySetForEngine = false;
|
||||
|
|
|
|||
|
|
@ -24,27 +24,10 @@ static void setInfo(pugi::xml_node& root, std::shared_ptr<ov::Model>& model) {
|
|||
}
|
||||
}
|
||||
|
||||
ModelSerializer::ModelSerializer(std::ostream & ostream, ExtensionManager::Ptr extensionManager)
|
||||
: _ostream(ostream)
|
||||
, _extensionManager(extensionManager) {
|
||||
}
|
||||
ModelSerializer::ModelSerializer(std::ostream& ostream) : _ostream(ostream) {}
|
||||
|
||||
void ModelSerializer::operator<<(const std::shared_ptr<ov::Model>& model) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
auto getCustomOpSets = [this]() {
|
||||
std::map<std::string, ngraph::OpSet> custom_opsets;
|
||||
|
||||
if (_extensionManager) {
|
||||
auto extensions = _extensionManager->Extensions();
|
||||
for (const auto& extension : extensions) {
|
||||
auto opset = extension->getOpSets();
|
||||
custom_opsets.insert(std::begin(opset), std::end(opset));
|
||||
}
|
||||
}
|
||||
|
||||
return custom_opsets;
|
||||
};
|
||||
|
||||
auto serializeInfo = [&](std::ostream& stream) {
|
||||
const std::string name = "cnndata";
|
||||
pugi::xml_document xml_doc;
|
||||
|
|
@ -59,7 +42,7 @@ void ModelSerializer::operator<<(const std::shared_ptr<ov::Model>& model) {
|
|||
};
|
||||
|
||||
// Serialize to old representation in case of old API
|
||||
ov::pass::StreamSerialize serializer(_ostream, getCustomOpSets(), serializeInfo);
|
||||
ov::pass::StreamSerialize serializer(_ostream, serializeInfo);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
serializer.run_on_model(std::const_pointer_cast<ov::Model>(model->clone()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,19 +6,17 @@
|
|||
#include <iostream>
|
||||
|
||||
#include "cpp/ie_cnn_network.h"
|
||||
#include "extension_mngr.h"
|
||||
|
||||
namespace ov {
|
||||
namespace intel_cpu {
|
||||
|
||||
class ModelSerializer {
|
||||
public:
|
||||
ModelSerializer(std::ostream& ostream, ExtensionManager::Ptr extensionManager);
|
||||
ModelSerializer(std::ostream& ostream);
|
||||
void operator<<(const std::shared_ptr<ov::Model>& model);
|
||||
|
||||
private:
|
||||
std::ostream& _ostream;
|
||||
ExtensionManager::Ptr _extensionManager;
|
||||
};
|
||||
|
||||
class ModelDeserializer {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#pragma once
|
||||
#ifdef CPU_DEBUG_CAPS
|
||||
|
||||
#include "extension.h"
|
||||
#include "debug_caps_config.h"
|
||||
#include "openvino/util/file_util.hpp"
|
||||
#include <openvino/pass/manager.hpp>
|
||||
|
|
@ -68,8 +67,7 @@ private:
|
|||
ov::pass::Manager serializer;
|
||||
|
||||
if (config.dumpIR.format.filter[DebugCapsConfig::IrFormatFilter::XmlBin]) {
|
||||
auto custom_opsets = std::make_shared<Extension>()->getOpSets();
|
||||
serializer.register_pass<ov::pass::Serialize>(pathAndName + ".xml", "", custom_opsets);
|
||||
serializer.register_pass<ov::pass::Serialize>(pathAndName + ".xml", "");
|
||||
}
|
||||
|
||||
if (config.dumpIR.format.filter[DebugCapsConfig::IrFormatFilter::Xml]) {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ TEST(MemStateGraphTest, smoke_Check_Memory_Modification_Guard) {
|
|||
|
||||
Config conf;
|
||||
conf.rtCacheCapacity = 0;
|
||||
auto context = std::make_shared<GraphContext>(conf, nullptr, nullptr, false);
|
||||
auto context = std::make_shared<GraphContext>(conf, nullptr, false);
|
||||
|
||||
auto input_node = std::make_shared<node::Input>(param, context);
|
||||
auto memory_input = std::make_shared<node::MemoryInput>(read, context);
|
||||
|
|
@ -266,7 +266,7 @@ TEST(MemStateGraphTest, smoke_ShapeOf_no_Inplace_Conflicts) {
|
|||
|
||||
Config conf;
|
||||
conf.rtCacheCapacity = 0;
|
||||
auto context = std::make_shared<GraphContext>(conf, nullptr, nullptr, false);
|
||||
auto context = std::make_shared<GraphContext>(conf, nullptr, false);
|
||||
|
||||
auto input_node = std::make_shared<node::Input>(param, context);
|
||||
auto memory_input = std::make_shared<node::MemoryInput>(read, context);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ protected:
|
|||
//
|
||||
Config conf;
|
||||
conf.rtCacheCapacity = 100;
|
||||
auto context = std::make_shared<GraphContext>(conf, nullptr, nullptr, false);
|
||||
auto context = std::make_shared<GraphContext>(conf, nullptr, false);
|
||||
const dnnl::engine cpuEngine = context->getEngine();
|
||||
|
||||
m_graph = std::unique_ptr<Graph>(new Graph());
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ TEST(ResolveEdgeConflictsCPUTest, smoke_Run_ResolveEdgeConflicts) {
|
|||
*/
|
||||
Config conf;
|
||||
conf.rtCacheCapacity = 100;
|
||||
auto context = std::make_shared<GraphContext>(conf, nullptr, nullptr, false);
|
||||
auto context = std::make_shared<GraphContext>(conf, nullptr, false);
|
||||
const dnnl::engine cpuEngine = context->getEngine();
|
||||
|
||||
std::unique_ptr<Graph> graph = std::unique_ptr<Graph>(new Graph());
|
||||
|
|
|
|||
|
|
@ -108,7 +108,6 @@ public:
|
|||
Config conf;
|
||||
conf.rtCacheCapacity = 100;
|
||||
auto context = std::make_shared<GraphContext>(conf,
|
||||
nullptr,
|
||||
std::make_shared<WeightsSharing>(),
|
||||
false);
|
||||
const dnnl::engine cpuEngine = context->getEngine();
|
||||
|
|
|
|||
Loading…
Reference in New Issue