diff --git a/inference-engine/src/inference_engine/ie_core.cpp b/inference-engine/src/inference_engine/ie_core.cpp index 256d6122176..c22eeb57454 100644 --- a/inference-engine/src/inference_engine/ie_core.cpp +++ b/inference-engine/src/inference_engine/ie_core.cpp @@ -332,6 +332,8 @@ public: * @return Reference to a CPP plugin wrapper */ InferencePlugin GetCPPPluginByName(const std::string& deviceName) const { + OV_ITT_SCOPED_TASK(itt::domains::IE_LT, "Core::Impl::GetCPPPluginByName"); + std::lock_guard lock(pluginsMutex); auto it = pluginRegistry.find(deviceName); diff --git a/inference-engine/src/inference_engine/ie_itt.hpp b/inference-engine/src/inference_engine/ie_itt.hpp index 3a3e02496ce..f49261bb49e 100644 --- a/inference-engine/src/inference_engine/ie_itt.hpp +++ b/inference-engine/src/inference_engine/ie_itt.hpp @@ -27,6 +27,7 @@ namespace InferenceEngine { namespace itt { namespace domains { OV_ITT_DOMAIN(IE); + OV_ITT_DOMAIN(IE_LT); } } } diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.hpp b/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.hpp index 16ed61984f7..7c9e53a59ad 100644 --- a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.hpp +++ b/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.hpp @@ -27,6 +27,7 @@ class INFERENCE_ENGINE_API_CLASS(ConvertMatMulToGemm); class ngraph::pass::ConvertMatMulToFCorGemm: public ngraph::pass::GraphRewrite { public: + NGRAPH_RTTI_DECLARATION; ConvertMatMulToFCorGemm() { add_matcher(); add_matcher(); diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.hpp b/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.hpp index b34bee5e91d..62c3480f760 100755 --- a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.hpp +++ b/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.hpp @@ -32,12 +32,9 @@ class INFERENCE_ENGINE_API_CLASS(ConvertMulOrAddFinally); class ngraph::pass::ConvertMulOrAddFinally: public ngraph::pass::GraphRewrite { public: + NGRAPH_RTTI_DECLARATION; // This pass finally converts single Multiply and Add operations to ScaleShift or Power operation - ConvertMulOrAddFinally() : GraphRewrite() { - convert_mul_or_add_finally(); - convert_mul_or_add_finally(); - convert_mul_or_add_finally(); - } + ConvertMulOrAddFinally(); private: template diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.hpp b/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.hpp index 2447219be9f..70fec3f63e1 100644 --- a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.hpp +++ b/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.hpp @@ -31,6 +31,7 @@ class INFERENCE_ENGINE_API_CLASS(ConvertRNNSequenceMatcher); class ngraph::pass::ConvertLSTMSequenceMatcher : public ngraph::pass::MatcherPass { public: + NGRAPH_RTTI_DECLARATION; ConvertLSTMSequenceMatcher(); }; @@ -43,6 +44,7 @@ public: class ngraph::pass::ConvertGRUSequenceMatcher : public ngraph::pass::MatcherPass { public: + NGRAPH_RTTI_DECLARATION; ConvertGRUSequenceMatcher(); }; @@ -55,5 +57,6 @@ public: class ngraph::pass::ConvertRNNSequenceMatcher : public ngraph::pass::MatcherPass { public: + NGRAPH_RTTI_DECLARATION; ConvertRNNSequenceMatcher(); }; diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_cells_to_cells_ie.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_cells_to_cells_ie.cpp index c7b0059c96d..10aed9b5a15 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_cells_to_cells_ie.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_cells_to_cells_ie.cpp @@ -145,4 +145,5 @@ ngraph::pass::ConvertRNNCellMatcher::ConvertRNNCellMatcher() { auto m = std::make_shared(rnn_cell_ngraph, "ConvertRNNCellToRNNCellIE"); this->register_matcher(m, callback); -} \ No newline at end of file +} + diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_gathertree_to_gathertree_ie.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_gathertree_to_gathertree_ie.cpp index 705db050e60..fa596d347d2 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_gathertree_to_gathertree_ie.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_gathertree_to_gathertree_ie.cpp @@ -37,4 +37,4 @@ ngraph::pass::ConvertGatherTreeToGatherTreeIEMatcher::ConvertGatherTreeToGatherT auto m = std::make_shared(gt, "ConvertGatherTreeToGatherTreeIE"); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_hard_sigmoid_to_hard_sigmoid_ie.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_hard_sigmoid_to_hard_sigmoid_ie.cpp index 41b80db5c62..f4069189674 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_hard_sigmoid_to_hard_sigmoid_ie.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_hard_sigmoid_to_hard_sigmoid_ie.cpp @@ -54,4 +54,4 @@ ngraph::pass::ConvertHardSigmoidToLegacyMatcher::ConvertHardSigmoidToLegacyMatch auto m = std::make_shared(node, "ConvertHardSigmoidToLegacy"); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.cpp index 2e65d68b3d0..3bd22f2ff13 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.cpp @@ -18,6 +18,7 @@ #include #include +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertMatMulToFCorGemm, "ConvertMatMulToFCorGemm", 0); NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertMatMulToFC, "ConvertMatMulToFC", 0); ngraph::pass::ConvertMatMulToFC::ConvertMatMulToFC() { diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.cpp new file mode 100644 index 00000000000..8e84c9f3404 --- /dev/null +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.cpp @@ -0,0 +1,13 @@ +// Copyright (C) 2018-2020 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "legacy/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.hpp" + +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertMulOrAddFinally, "ConvertMulOrAddFinally", 0); + +ngraph::pass::ConvertMulOrAddFinally::ConvertMulOrAddFinally() : GraphRewrite() { + convert_mul_or_add_finally(); + convert_mul_or_add_finally(); + convert_mul_or_add_finally(); +} diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.cpp index 31dd374eed2..589860af792 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.cpp @@ -101,4 +101,4 @@ ngraph::pass::ConvertNMSToNMSIEMatcher::ConvertNMSToNMSIEMatcher() { auto m = std::make_shared(nms, "ConvertNMSToNMSIE"); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.cpp index 4182ac11d92..b9995680089 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.cpp @@ -46,8 +46,6 @@ #include #include -#include "ie_legacy_itt.hpp" - #include #include @@ -59,7 +57,6 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertOpSet1ToLegacy, "ConvertOpSet1ToLegacy", 0); bool ngraph::pass::ConvertOpSet1ToLegacy::run_on_function(std::shared_ptr f) { - OV_ITT_SCOPED_TASK(InferenceEngine::itt::domains::IELegacy, "ngraph::pass::ConvertOpSet1ToLegacy"); ngraph::pass::Manager manager(get_pass_config()); diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_pad_to_pad_ie.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_pad_to_pad_ie.cpp index 0aaecd2f699..37b4dcdf3b6 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_pad_to_pad_ie.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_pad_to_pad_ie.cpp @@ -31,4 +31,4 @@ ngraph::pass::ConvertPadToLegacyMatcher::ConvertPadToLegacyMatcher() { auto m = std::make_shared(m_pad, "ConvertPadToLegacy"); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_selu_to_selu_ie.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_selu_to_selu_ie.cpp index f013efc8feb..ebf50f04988 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_selu_to_selu_ie.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_selu_to_selu_ie.cpp @@ -51,4 +51,4 @@ ngraph::pass::ConvertSeluToSeluIEMatcher::ConvertSeluToSeluIEMatcher() { auto m = std::make_shared(selu, "ConvertSeluToSeluIE"); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.cpp index c832d348356..4ac964ad92d 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.cpp @@ -14,6 +14,10 @@ #include #include +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertLSTMSequenceMatcher, "ConvertLSTMSequenceMatcher", 0); +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertGRUSequenceMatcher, "ConvertGRUSequenceMatcher", 0); +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertRNNSequenceMatcher, "ConvertRNNSequenceMatcher", 0); + ngraph::pass::ConvertLSTMSequenceMatcher::ConvertLSTMSequenceMatcher() { auto lstm_sequence_ngraph = ngraph::pattern::wrap_type(); diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_swish_to_swish_ie.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_swish_to_swish_ie.cpp index 6279e4a80a3..4cfa19dac56 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_swish_to_swish_ie.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_swish_to_swish_ie.cpp @@ -45,4 +45,4 @@ ngraph::pass::ConvertSwishToSwishIEMatcher::ConvertSwishToSwishIEMatcher() { auto m = std::make_shared(swish, "ConvertSwishToSwishIE"); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/reshape_1d_ops.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/reshape_1d_ops.cpp index 7f58d0234ec..f66ac792a1e 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/reshape_1d_ops.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/reshape_1d_ops.cpp @@ -173,4 +173,5 @@ ngraph::pass::Reshape1DMaxPool::Reshape1DMaxPool() { auto pool = ngraph::pattern::wrap_type(pattern::has_static_shape()); auto m = std::make_shared(pool, "Reshape1DMaxPool"); this->register_matcher(m, get_callback()); -} \ No newline at end of file +} + diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_exec_network.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_exec_network.cpp index 94919a18732..676a8d06b7f 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_exec_network.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_exec_network.cpp @@ -44,7 +44,7 @@ MKLDNNExecNetwork::MKLDNNExecNetwork(const InferenceEngine::ICNNNetwork &network extensionManager(extMgr), _cfg{cfg}, _name{network.getName()} { - OV_ITT_SCOPED_TASK(itt::domains::MKLDNNPlugin, "MKLDNNExecNetwork::MKLDNNExecNetwork"); + OV_ITT_TASK_CHAIN(taskChain, MKLDNNPlugin::itt::domains::MKLDNN_LT, "MKLDNNExecNetwork", "cloneNet"); // we are cloning network if we have statistics and we can transform network. _clonedNetwork = cloneNet(network); @@ -78,8 +78,10 @@ MKLDNNExecNetwork::MKLDNNExecNetwork(const InferenceEngine::ICNNNetwork &network } } + OV_ITT_TASK_NEXT(taskChain, "UnrollPasses"); MKLDNNGraph::ApplyUnrollPasses(static_cast(*_clonedNetwork)); + OV_ITT_TASK_NEXT(taskChain, "createConstInputs"); auto createConstInputTo = [&](CNNLayerPtr layer, Blob::Ptr blob, std::string name) { LayerParams attrs = {layer.get()->name + "_const_" + name, "Const", blob->getTensorDesc().getPrecision()}; auto constLayer = std::make_shared(attrs); @@ -133,6 +135,8 @@ MKLDNNExecNetwork::MKLDNNExecNetwork(const InferenceEngine::ICNNNetwork &network } } + OV_ITT_TASK_SKIP(taskChain); + if (_cfg.batchLimit > 1) { // check topology for applicability if (!CanProcessDynBatch(*_clonedNetwork)) { @@ -159,6 +163,7 @@ MKLDNNExecNetwork::MKLDNNExecNetwork(const InferenceEngine::ICNNNetwork &network // TODO: Remove `cloneNet` to `localNetwork` when `MKLDNNGraph::CreateGraph` // is fixed and does not change content of network passed (CVS-26420) auto localNetwork = cloneNet(static_cast(*_clonedNetwork)); + auto graph = std::make_shared(); { std::unique_lock lock{_cfgMutex}; @@ -169,6 +174,7 @@ MKLDNNExecNetwork::MKLDNNExecNetwork(const InferenceEngine::ICNNNetwork &network if (nullptr != streamExecutor) { numaNode = streamExecutor->GetNumaNodeId(); } + graph->CreateGraph(static_cast(*localNetwork), extensionManager, numaNodesWeights[numaNode]); return graph; }}; diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_graph.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_graph.cpp index 27b98b001ce..af03b605b4d 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_graph.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_graph.cpp @@ -89,6 +89,8 @@ template void MKLDNNGraph::ApplyUnrollPasses(ICNNNetwork&); template void MKLDNNGraph::CreateGraph(const NET &net, const MKLDNNExtensionManager::Ptr& extMgr, MKLDNNWeightsSharing::Ptr &w_cache) { + OV_ITT_SCOPED_TASK(MKLDNNPlugin::itt::domains::MKLDNN_LT, "CreateGraph"); + if (IsReady()) ForgetGraphData(); // disable caching if graph was created only once @@ -332,44 +334,25 @@ void MKLDNNGraph::InitGraph() { SortTopologically(); InitNodes(); + optimizer.ApplyCommonGraphOptimizations(*this); SortTopologically(); InitDescriptors(); - for (auto &node : graphNodes) { - node->initOptimalPrimitiveDescriptor(); - } + InitOptimalPrimitiveDescriptors(); + InitEdges(); optimizer.ApplyImplSpecificGraphOptimizations(*this); - SortTopologically(); Allocate(); CreatePrimitives(); - // Do it before cleanup. Because it will lose original layers information - for (auto &graphNode : graphNodes) { - auto nodeType = graphNode->getType(); - if (nodeType == Reorder || nodeType == Output) continue; + SetOriginalLayerNames(); - if (graphNode->getOriginalLayers().empty()) { - graphNode->addOriginalLayer(graphNode->getCnnLayer()); - } - - if (graphNode->getFusedWith().size() || graphNode->getMergeWith().size()) { - // Original layer names - std::vector internal = graphNode->getFusedWith(); - auto &merged = graphNode->getMergeWith(); - internal.insert(internal.end(), merged.begin(), merged.end()); - - for (auto &sub_node : internal) { - graphNode->addOriginalLayer(sub_node->getCnnLayer()); - } - } - } if (!config.dumpToDot.empty()) dumpToDotFile(config.dumpToDot + "_init.dot"); @@ -397,21 +380,44 @@ void MKLDNNGraph::InitGraph() { } #endif - mkldnn::stream stream = mkldnn::stream(stream::kind::eager); + ExecuteConstantNodesOnly(); +} + +void MKLDNNGraph::SetOriginalLayerNames() { + OV_ITT_SCOPED_TASK(itt::domains::MKLDNN_LT, "MKLDNNGraph::SetOriginalLayerNames"); + + // Do it before cleanup. Because it will lose original layers information for (auto &graphNode : graphNodes) { - if (!graphNode->isConstant()) - continue; - graphNode->execute(stream); + auto nodeType = graphNode->getType(); + if (nodeType == Reorder || nodeType == Output) continue; + + if (graphNode->getOriginalLayers().empty()) { + graphNode->addOriginalLayer(graphNode->getCnnLayer()); + } + + if (graphNode->getFusedWith().size() || graphNode->getMergeWith().size()) { + // Original layer names + std::vector internal = graphNode->getFusedWith(); + auto &merged = graphNode->getMergeWith(); + internal.insert(internal.end(), merged.begin(), merged.end()); + + for (auto &sub_node : internal) { + graphNode->addOriginalLayer(sub_node->getCnnLayer()); + } + } } } void MKLDNNGraph::InitNodes() { + OV_ITT_SCOPED_TASK(itt::domains::MKLDNN_LT, "MKLDNNGraph::InitNodes"); for (auto &node : graphNodes) { node->init(); } } void MKLDNNGraph::InitDescriptors() { + OV_ITT_TASK_CHAIN(taskChain, MKLDNNPlugin::itt::domains::MKLDNN_LT, "InitDescriptors", "Prepare"); + for (auto &node : graphNodes) { #if defined (COMPILED_CPU_MKLDNN_INPUT_NODE) if (node->getType() == Input && _meanImages.find(node->getName()) != _meanImages.end()) { @@ -420,18 +426,43 @@ void MKLDNNGraph::InitDescriptors() { inputNode->withMeanImage(); } #endif + OV_ITT_TASK_NEXT(taskChain, node->profiling.getSupportedDescriptors); node->getSupportedDescriptors(); + OV_ITT_TASK_NEXT(taskChain, node->profiling.initSupportedPrimitiveDescriptors); node->initSupportedPrimitiveDescriptors(); + + OV_ITT_TASK_NEXT(taskChain, node->profiling.filterSupportedPrimitiveDescriptors); node->filterSupportedPrimitiveDescriptors(); } for (auto &node : graphNodes) { + OV_ITT_TASK_NEXT(taskChain, node->profiling.selectOptimalPrimitiveDescriptor); node->selectOptimalPrimitiveDescriptor(); } } +void MKLDNNGraph::InitOptimalPrimitiveDescriptors() { + OV_ITT_SCOPED_TASK(itt::domains::MKLDNNPlugin, "MKLDNNGraph::InitOptimalPrimitiveDescriptors"); + for (auto &node : graphNodes) { + OV_ITT_SCOPED_TASK(itt::domains::MKLDNN_LT, node->profiling.initOptimalPrimitiveDescriptor); + node->initOptimalPrimitiveDescriptor(); + } +} + +void MKLDNNGraph::ExecuteConstantNodesOnly() { + OV_ITT_SCOPED_TASK(itt::domains::MKLDNN_LT, "MKLDNNGraph::ExecuteConstantNodesOnly"); + mkldnn::stream stream = mkldnn::stream(stream::kind::eager); + for (auto &graphNode : graphNodes) { + if (!graphNode->isConstant()) + continue; + graphNode->execute(stream); + } +} + void MKLDNNGraph::InitEdges() { + OV_ITT_SCOPED_TASK(itt::domains::MKLDNN_LT, "MKLDNNGraph::InitEdges"); + auto reorderArgs = [](const InferenceEngine::TensorDesc &parentDesc, const InferenceEngine::TensorDesc &childDesc) { std::string inArgs, outArgs; if (parentDesc.getPrecision() != childDesc.getPrecision()) { @@ -669,6 +700,8 @@ void MKLDNNGraph::AllocateWithReuse() { } void MKLDNNGraph::Allocate() { + OV_ITT_SCOPED_TASK(itt::domains::MKLDNN_LT, "MKLDNNGraph::Allocate"); + // resolve edges. Define which will be a view on others // NeedAllocation - real blob // NotAllocated - view on other blob, peer or in-place @@ -687,6 +720,7 @@ void MKLDNNGraph::Allocate() { void MKLDNNGraph::CreatePrimitives() { OV_ITT_SCOPED_TASK(itt::domains::MKLDNNPlugin, "MKLDNNGraph::CreatePrimitives"); for (auto& node : graphNodes) { + OV_ITT_SCOPED_TASK(itt::domains::MKLDNN_LT, node->profiling.createPrimitive); node->createPrimitive(); } } @@ -789,7 +823,7 @@ void MKLDNNGraph::Infer(int batch) { ENABLE_DUMP(do_before(DUMP_DIR, graphNodes[i])); if (!graphNodes[i]->isConstant()) { - OV_ITT_SCOPED_TASK(itt::domains::MKLDNNPlugin, graphNodes[i]->profilingTask); + OV_ITT_SCOPED_TASK(itt::domains::MKLDNNPlugin, graphNodes[i]->profiling.execute); graphNodes[i]->execute(stream); } @@ -821,6 +855,8 @@ void MKLDNNGraph::VisitNode(MKLDNNNodePtr node, std::vector& sort } void MKLDNNGraph::SortTopologically() { + OV_ITT_SCOPED_TASK(itt::domains::MKLDNN_LT, "MKLDNNGraph::SortTopologically"); + std::vector unsorted; std::vector sorted; diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_graph.h b/inference-engine/src/mkldnn_plugin/mkldnn_graph.h index ca092386447..d4c8bffe1cb 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_graph.h +++ b/inference-engine/src/mkldnn_plugin/mkldnn_graph.h @@ -140,10 +140,13 @@ protected: void InitGraph(); void InitNodes(); void InitDescriptors(); + void InitOptimalPrimitiveDescriptors(); void InitEdges(); void Allocate(); void AllocateWithReuse(); void CreatePrimitives(); + void ExecuteConstantNodesOnly(); + void SetOriginalLayerNames(); void do_before(const std::string &dir, const MKLDNNNodePtr &node); void do_after(const std::string &dir, const MKLDNNNodePtr &node); diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp index 8c2236b05c0..c70539511d6 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp @@ -38,6 +38,8 @@ #include #include +#include "mkldnn_itt.h" + using namespace mkldnn; using namespace MKLDNNPlugin; using namespace InferenceEngine; @@ -45,6 +47,8 @@ using namespace InferenceEngine; MKLDNNGraphOptimizer::MKLDNNGraphOptimizer() {} void MKLDNNGraphOptimizer::ApplyCommonGraphOptimizations(MKLDNNGraph &graph) { + OV_ITT_SCOPED_TASK(itt::domains::MKLDNN_LT, "MKLDNNGraphOptimizer::ApplyCommonGraphOptimizations"); + MergeTwoEqualScaleShifts(graph); graph.RemoveDroppedNodes(); @@ -134,6 +138,8 @@ void MKLDNNGraphOptimizer::ApplyCommonGraphOptimizations(MKLDNNGraph &graph) { } void MKLDNNGraphOptimizer::ApplyImplSpecificGraphOptimizations(MKLDNNGraph &graph) { + OV_ITT_SCOPED_TASK(itt::domains::MKLDNN_LT, "MKLDNNGraphOptimizer::ApplyImplSpecificGraphOptimizations"); + RemoveIOScaleShifts(graph); graph.RemoveDroppedNodes(); diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_itt.h b/inference-engine/src/mkldnn_plugin/mkldnn_itt.h index ca6b30ac81f..fb4e444a3ed 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_itt.h +++ b/inference-engine/src/mkldnn_plugin/mkldnn_itt.h @@ -27,6 +27,7 @@ namespace MKLDNNPlugin { namespace itt { namespace domains { OV_ITT_DOMAIN(MKLDNNPlugin); + OV_ITT_DOMAIN(MKLDNN_LT); } } } diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp index a4bfc1163a6..dbbbc0faac6 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp @@ -4,11 +4,14 @@ #include "mkldnn_node.h" #include "mkldnn_extension_mngr.h" +#include "mkldnn_itt.h" +#include "caseless.hpp" #include #include #include #include +#include #include #include @@ -158,7 +161,7 @@ MKLDNNNode::MKLDNNNode(const InferenceEngine::CNNLayerPtr& layer, const mkldnn:: MKLDNNWeightsSharing::Ptr &w_cache) : selectedPrimitiveDescriptorIndex(-1), permanent(false), temporary(false), constant(ConstantType::Unknown), weightCache(w_cache), cnnLayer(layer), engine(eng), name(layer->name), typeStr(layer->type), - type(TypeFromName(layer->type)), profilingTask(itt::handle(name)) { + type(TypeFromName(layer->type)), profiling(layer->name) { if (!layer->outData.empty()) { for (const auto& outData : layer->outData) { outDims.emplace_back(outData->getDims()); diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_node.h b/inference-engine/src/mkldnn_plugin/mkldnn_node.h index 469cc7a97c6..9b40943d776 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_node.h +++ b/inference-engine/src/mkldnn_plugin/mkldnn_node.h @@ -261,6 +261,39 @@ public: template class Registrar; + template + struct Tag {}; + + struct PerfCounters { + PerfCounters(std::string const& name) + : execute(openvino::itt::handle(name)) + , getSupportedDescriptors(openvino::itt::handle>("MKLDNNNode::getSupportedDescriptors")) + , initSupportedPrimitiveDescriptors(openvino::itt::handle>("MKLDNNNode::initSupportedPrimitiveDescriptors")) + , filterSupportedPrimitiveDescriptors(openvino::itt::handle>("MKLDNNNode::filterSupportedPrimitiveDescriptors")) + , selectOptimalPrimitiveDescriptor(openvino::itt::handle>("MKLDNNNode::selectOptimalPrimitiveDescriptor")) + , createPrimitive(openvino::itt::handle>("MKLDNNNode::createPrimitive")) + , initOptimalPrimitiveDescriptor(openvino::itt::handle>("MKLDNNNode::initOptimalPrimitiveDescriptor")) + {} + + template + void buildClassCounters(const std::string& type_name) { + getSupportedDescriptors = openvino::itt::handle>(type_name + "::getSupportedDescriptors"); + initSupportedPrimitiveDescriptors = openvino::itt::handle>(type_name + "::initSupportedPrimitiveDescriptors"); + filterSupportedPrimitiveDescriptors = openvino::itt::handle>(type_name + "::filterSupportedPrimitiveDescriptors"); + selectOptimalPrimitiveDescriptor = openvino::itt::handle>(type_name + "::selectOptimalPrimitiveDescriptor"); + createPrimitive = openvino::itt::handle>(type_name + "::createPrimitive"); + initOptimalPrimitiveDescriptor = openvino::itt::handle>(type_name + "::initOptimalPrimitiveDescriptor"); + } + + openvino::itt::handle_t execute; + openvino::itt::handle_t getSupportedDescriptors; + openvino::itt::handle_t initSupportedPrimitiveDescriptors; + openvino::itt::handle_t filterSupportedPrimitiveDescriptors; + openvino::itt::handle_t selectOptimalPrimitiveDescriptor; + openvino::itt::handle_t createPrimitive; + openvino::itt::handle_t initOptimalPrimitiveDescriptor; + }; + static Factory & factory(); ~MKLDNNNode() override = default; @@ -474,6 +507,14 @@ public: return desc.outputNumbers(); } + const PerfCounters & perfCounters() const { + return profiling; + } + + PerfCounters & perfCounters() { + return profiling; + } + protected: // TODO: It is necessary only in order to avoid modifications of cnnLayers and original topology std::vector outDims; @@ -563,7 +604,7 @@ private: std::string typeToStr(Type type); PerfCount perfCounter; - openvino::itt::handle_t profilingTask; + PerfCounters profiling; bool isEdgesEmpty(const std::vector& edges) const; @@ -611,6 +652,7 @@ public: [type](const InferenceEngine::CNNLayerPtr& layer, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &w_cache) -> MKLDNNNode* { MKLDNNNode *node = new To(layer, eng, w_cache); + node->perfCounters().buildClassCounters(NameFromType(type)); return node; }); } diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp index 93d2a49d0b1..220d306ace5 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp @@ -87,8 +87,6 @@ Engine::~Engine() { } static void Transformation(ICNNNetwork::Ptr& clonedNetwork, const Config& conf) { - OV_ITT_SCOPED_TASK(MKLDNNPlugin::itt::domains::MKLDNNPlugin, "Transformation"); - auto nGraphFunc = clonedNetwork->getFunction(); // Disable shape inference (WA for generic operations) ngraph::op::GenericIE::DisableReshape noReshape(nGraphFunc); @@ -198,8 +196,12 @@ static void Transformation(ICNNNetwork::Ptr& clonedNetwork, const Config& conf) }); legacyManager.run_passes(nGraphFunc); + OV_ITT_TASK_CHAIN(taskChain, MKLDNNPlugin::itt::domains::MKLDNN_LT, "Transformation", "convertFunctionToICNNNetwork"); + clonedNetwork = InferenceEngine::details::convertFunctionToICNNNetwork(nGraphFunc, *clonedNetwork); + OV_ITT_TASK_NEXT(taskChain, "ConvertIOPrecision"); + // WA: after conversion to CNNNetwork user precision can redefine input/output precisions // so we need to apply additional precision conversion but only for inputs and outputs for (auto & precision : convert_precision_list) { @@ -241,6 +243,7 @@ Engine::LoadExeNetworkImpl(const InferenceEngine::ICNNNetwork &network, const st } std::shared_ptr clonedNetwork = cloneNetwork(network); + bool is_transformed = false; if (clonedNetwork->getFunction()) { Transformation(clonedNetwork, conf); @@ -248,6 +251,7 @@ Engine::LoadExeNetworkImpl(const InferenceEngine::ICNNNetwork &network, const st } auto implNetwork = std::dynamic_pointer_cast(clonedNetwork); if (implNetwork) { + OV_ITT_SCOPED_TASK(itt::domains::MKLDNN_LT, "CNNNet_based_ConstFolding"); // valid for CNNNetworkImpl only, while there's no API in ICNNNetwork to change network ConstTransformer transformator(implNetwork.get()); transformator.fullTrim(); diff --git a/inference-engine/src/plugin_api/cpp_interfaces/impl/ie_plugin_internal.hpp b/inference-engine/src/plugin_api/cpp_interfaces/impl/ie_plugin_internal.hpp index 14ebb912f1f..9069132a657 100644 --- a/inference-engine/src/plugin_api/cpp_interfaces/impl/ie_plugin_internal.hpp +++ b/inference-engine/src/plugin_api/cpp_interfaces/impl/ie_plugin_internal.hpp @@ -19,6 +19,8 @@ #include "cpp_interfaces/base/ie_executable_network_base.hpp" #include "cpp_interfaces/impl/ie_executable_network_internal.hpp" #include "cpp_interfaces/interface/ie_iplugin_internal.hpp" +#include "cpp_interfaces/plugin_itt.hpp" + using namespace InferenceEngine; using namespace InferenceEngine::details; diff --git a/inference-engine/src/plugin_api/cpp_interfaces/plugin_itt.hpp b/inference-engine/src/plugin_api/cpp_interfaces/plugin_itt.hpp index 724cdc1dc19..709a8e947e4 100644 --- a/inference-engine/src/plugin_api/cpp_interfaces/plugin_itt.hpp +++ b/inference-engine/src/plugin_api/cpp_interfaces/plugin_itt.hpp @@ -27,6 +27,7 @@ namespace InferenceEngine { namespace itt { namespace domains { OV_ITT_DOMAIN(Plugin) + OV_ITT_DOMAIN(Plugin_LT) } } } diff --git a/inference-engine/src/readers/ir_reader/ie_ir_itt.hpp b/inference-engine/src/readers/ir_reader/ie_ir_itt.hpp index 9f0eb9a7034..1624aaa9ea6 100644 --- a/inference-engine/src/readers/ir_reader/ie_ir_itt.hpp +++ b/inference-engine/src/readers/ir_reader/ie_ir_itt.hpp @@ -27,6 +27,7 @@ namespace InferenceEngine { namespace itt { namespace domains { OV_ITT_DOMAIN(V10Reader); + OV_ITT_DOMAIN(V10Reader_RT); } } } diff --git a/inference-engine/src/readers/ir_reader/ie_ir_parser.cpp b/inference-engine/src/readers/ir_reader/ie_ir_parser.cpp index bb45bb0bf69..3ddcfdbc5db 100644 --- a/inference-engine/src/readers/ir_reader/ie_ir_parser.cpp +++ b/inference-engine/src/readers/ir_reader/ie_ir_parser.cpp @@ -3,6 +3,7 @@ // #include "ie_ir_parser.hpp" +#include "ie_ir_itt.hpp" #include #include @@ -83,6 +84,8 @@ V10Parser::V10Parser(const std::vector& exts) : _exts(exts) { } std::shared_ptr V10Parser::parse(const pugi::xml_node& root, std::istream& binStream) { + OV_ITT_TASK_CHAIN(taskChain, itt::domains::V10Reader_RT, "V10Parser", "Parse"); + using node_params = struct { pugi::xml_node xml; GenericLayerParams params; @@ -130,6 +133,8 @@ std::shared_ptr V10Parser::parse(const pugi::xml_node& root, std::i }; std::for_each(outputs.begin(), outputs.end(), dfs); + OV_ITT_TASK_NEXT(taskChain, "ConstructNgraphNodes"); + ngraph::ParameterVector parameter_nodes; ngraph::ResultVector result_nodes; ngraph::NodeVector allNodes; @@ -186,6 +191,8 @@ std::shared_ptr V10Parser::parse(const pugi::xml_node& root, std::i allNodes.emplace_back(node); } + OV_ITT_TASK_NEXT(taskChain, "ConstructNgraphFunction"); + ::ngraph::op::GenericIE::DisableReshape noReshape(allNodes); auto function = std::make_shared(result_nodes, assign_nodes, parameter_nodes, GetStrAttr(root, "name", "")); for (const auto& assign : assign_nodes) { @@ -193,8 +200,12 @@ std::shared_ptr V10Parser::parse(const pugi::xml_node& root, std::i variable_id_to_read_value.at(std::dynamic_pointer_cast(assign)->get_variable_id())); } + OV_ITT_TASK_NEXT(taskChain, "ConstructCNNNetwork"); + CNNNetwork net(function, _exts); + parsePreProcess(net, root, binStream); + return net; } diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/algebraic_simplification.hpp b/inference-engine/src/transformations/include/transformations/common_optimizations/algebraic_simplification.hpp index 56e5b62f415..a980d468497 100644 --- a/inference-engine/src/transformations/include/transformations/common_optimizations/algebraic_simplification.hpp +++ b/inference-engine/src/transformations/include/transformations/common_optimizations/algebraic_simplification.hpp @@ -31,5 +31,6 @@ class TRANSFORMATIONS_API AlgebraicSimplification; class ngraph::pass::AlgebraicSimplification : public FunctionPass { public: + NGRAPH_RTTI_DECLARATION; bool run_on_function(std::shared_ptr f) override; }; diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/conv_bias_fusion.hpp b/inference-engine/src/transformations/include/transformations/common_optimizations/conv_bias_fusion.hpp index 74b21145a00..f2c554df408 100644 --- a/inference-engine/src/transformations/include/transformations/common_optimizations/conv_bias_fusion.hpp +++ b/inference-engine/src/transformations/include/transformations/common_optimizations/conv_bias_fusion.hpp @@ -36,6 +36,7 @@ class TRANSFORMATIONS_API DeconvAddFusion; class ngraph::pass::ConvFusion: public ngraph::pass::GraphRewrite { public: + NGRAPH_RTTI_DECLARATION; ConvFusion() : GraphRewrite() { add_matcher(); add_matcher(); diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/fq_mul_fusion.hpp b/inference-engine/src/transformations/include/transformations/common_optimizations/fq_mul_fusion.hpp index 6bf4c0643a0..9fce8c3d4fb 100644 --- a/inference-engine/src/transformations/include/transformations/common_optimizations/fq_mul_fusion.hpp +++ b/inference-engine/src/transformations/include/transformations/common_optimizations/fq_mul_fusion.hpp @@ -28,5 +28,6 @@ class TRANSFORMATIONS_API FakeQuantizeMulFusion; class ngraph::pass::FakeQuantizeMulFusion : public ngraph::pass::MatcherPass { public: + NGRAPH_RTTI_DECLARATION; FakeQuantizeMulFusion(); }; diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/fq_reshape_fusion.hpp b/inference-engine/src/transformations/include/transformations/common_optimizations/fq_reshape_fusion.hpp index de5fd0d095b..b4b04627171 100644 --- a/inference-engine/src/transformations/include/transformations/common_optimizations/fq_reshape_fusion.hpp +++ b/inference-engine/src/transformations/include/transformations/common_optimizations/fq_reshape_fusion.hpp @@ -28,5 +28,6 @@ class TRANSFORMATIONS_API FakeQuantizeReshapeFusion; class ngraph::pass::FakeQuantizeReshapeFusion : public ngraph::pass::MatcherPass { public: + NGRAPH_RTTI_DECLARATION; FakeQuantizeReshapeFusion(); }; diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/nop_elimination.hpp b/inference-engine/src/transformations/include/transformations/common_optimizations/nop_elimination.hpp index ccf61563ae9..89ce2ab7fc9 100644 --- a/inference-engine/src/transformations/include/transformations/common_optimizations/nop_elimination.hpp +++ b/inference-engine/src/transformations/include/transformations/common_optimizations/nop_elimination.hpp @@ -22,5 +22,6 @@ class TRANSFORMATIONS_API NopElimination; class ngraph::pass::NopElimination: public ngraph::pass::FunctionPass { public: + NGRAPH_RTTI_DECLARATION; bool run_on_function(std::shared_ptr) override; }; diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/optimize_strided_slice.hpp b/inference-engine/src/transformations/include/transformations/common_optimizations/optimize_strided_slice.hpp index 0a732ced119..2bae8515ae6 100644 --- a/inference-engine/src/transformations/include/transformations/common_optimizations/optimize_strided_slice.hpp +++ b/inference-engine/src/transformations/include/transformations/common_optimizations/optimize_strided_slice.hpp @@ -69,12 +69,7 @@ public: class ngraph::pass::StridedSliceOptimization: public ngraph::pass::FunctionPass { public: NGRAPH_RTTI_DECLARATION; - bool run_on_function(std::shared_ptr f) override { - bool rewritten = UselessStridedSliceEraser().run_on_function(f); - rewritten |= SharedStridedSliceEraser().run_on_function(f); - rewritten |= GroupedStridedSliceOptimizer().run_on_function(f); - return rewritten; - } + bool run_on_function(std::shared_ptr f) override; }; ngraph::SlicePlan get_slice_plan(std::shared_ptr slice); \ No newline at end of file diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/bidirectional_sequences_decomposition.hpp b/inference-engine/src/transformations/include/transformations/op_conversions/bidirectional_sequences_decomposition.hpp index f3379991882..1173f83b132 100644 --- a/inference-engine/src/transformations/include/transformations/op_conversions/bidirectional_sequences_decomposition.hpp +++ b/inference-engine/src/transformations/include/transformations/op_conversions/bidirectional_sequences_decomposition.hpp @@ -30,6 +30,7 @@ class TRANSFORMATIONS_API BidirectionalRNNSequenceDecomposition; class ngraph::pass::BidirectionalLSTMSequenceDecomposition : public ngraph::pass::MatcherPass { public: + NGRAPH_RTTI_DECLARATION; BidirectionalLSTMSequenceDecomposition(); }; @@ -41,6 +42,7 @@ public: class ngraph::pass::BidirectionalGRUSequenceDecomposition : public ngraph::pass::MatcherPass { public: + NGRAPH_RTTI_DECLARATION; BidirectionalGRUSequenceDecomposition(); }; @@ -52,5 +54,6 @@ public: class ngraph::pass::BidirectionalRNNSequenceDecomposition : public ngraph::pass::MatcherPass { public: + NGRAPH_RTTI_DECLARATION; BidirectionalRNNSequenceDecomposition(); }; diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_convolutions.hpp b/inference-engine/src/transformations/include/transformations/op_conversions/convert_convolutions.hpp index d4cd799025f..8fcdadba5cc 100644 --- a/inference-engine/src/transformations/include/transformations/op_conversions/convert_convolutions.hpp +++ b/inference-engine/src/transformations/include/transformations/op_conversions/convert_convolutions.hpp @@ -26,6 +26,7 @@ class TRANSFORMATIONS_API ConvertGroupDeconvolution; class ngraph::pass::ConvertConvolutions: public ngraph::pass::GraphRewrite { public: + NGRAPH_RTTI_DECLARATION; ConvertConvolutions() { add_matcher(); add_matcher(); diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp b/inference-engine/src/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp index 81d01269df9..11a6edfc258 100644 --- a/inference-engine/src/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp +++ b/inference-engine/src/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp @@ -37,6 +37,7 @@ public: class ngraph::pass::ConvertReduceToPooling: public ngraph::pass::GraphRewrite { public: + NGRAPH_RTTI_DECLARATION; ConvertReduceToPooling() { add_matcher(); add_matcher(); @@ -46,6 +47,7 @@ public: class ngraph::pass::ConvertReduceMeanToPooling: public ConvertReduceBase { public: + NGRAPH_RTTI_DECLARATION; ConvertReduceMeanToPooling() { auto m = std::make_shared( ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape()), @@ -57,6 +59,7 @@ public: class ngraph::pass::ConvertReduceMaxToPooling: public ConvertReduceBase { public: + NGRAPH_RTTI_DECLARATION; ConvertReduceMaxToPooling() { auto m = std::make_shared( ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape()), @@ -68,6 +71,7 @@ public: class ngraph::pass::ConvertReduceSumToPooling: public ConvertReduceBase { public: + NGRAPH_RTTI_DECLARATION; ConvertReduceSumToPooling() { auto m = std::make_shared( ngraph::pattern::wrap_type({pattern::any_input(pattern::has_static_shape()), diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_ti_to_sequences.hpp b/inference-engine/src/transformations/include/transformations/op_conversions/convert_ti_to_sequences.hpp index 4e4d5855f0c..a0bbbb1b938 100644 --- a/inference-engine/src/transformations/include/transformations/op_conversions/convert_ti_to_sequences.hpp +++ b/inference-engine/src/transformations/include/transformations/op_conversions/convert_ti_to_sequences.hpp @@ -32,6 +32,7 @@ class TRANSFORMATIONS_API ConvertTensorIteratorToGRUSequence; class ngraph::pass::ConvertTensorIteratorToLSTMSequence: public ngraph::pass::MatcherPass { public: + NGRAPH_RTTI_DECLARATION; ConvertTensorIteratorToLSTMSequence(); }; @@ -43,6 +44,7 @@ public: class ngraph::pass::ConvertTensorIteratorToRNNSequence: public ngraph::pass::MatcherPass { public: + NGRAPH_RTTI_DECLARATION; ConvertTensorIteratorToRNNSequence(); }; @@ -54,5 +56,6 @@ public: class ngraph::pass::ConvertTensorIteratorToGRUSequence: public ngraph::pass::MatcherPass { public: + NGRAPH_RTTI_DECLARATION; ConvertTensorIteratorToGRUSequence(); }; \ No newline at end of file diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/algebraic_simplification.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/algebraic_simplification.cpp index 4a9b90bcff4..2822cef9f19 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/algebraic_simplification.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/algebraic_simplification.cpp @@ -28,6 +28,8 @@ using namespace std; using namespace ngraph; +NGRAPH_RTTI_DEFINITION(ngraph::pass::AlgebraicSimplification, "AlgebraicSimplification", 0); + //`simplify_gather`, optimizes gather if Gather is gathering the // whole input tensor static bool simplify_gather(std::shared_ptr node) { diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp index 3da68fccdb5..a0fc084da66 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp @@ -52,8 +52,6 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::CommonOptimizations, "CommonOptimizations", 0); bool ngraph::pass::CommonOptimizations::run_on_function(std::shared_ptr f) { - OV_ITT_SCOPED_TASK(itt::domains::IETransform, "ngraph::pass::CommonOptimizations"); - ngraph::pass::Manager manager(get_pass_config()); // This pass must be called first in pipeline diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/conv_bias_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/conv_bias_fusion.cpp index bb6a2eddf5a..8281f073261 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/conv_bias_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/conv_bias_fusion.cpp @@ -19,6 +19,8 @@ using namespace ngraph; +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvFusion, "ConvFusion", 0); + template std::pair, std::shared_ptr> parse_eltwise_inputs(std::shared_ptr node) { auto eltwise = std::dynamic_pointer_cast(node->input(0).get_source_output().get_node_shared_ptr()); diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/conv_mul_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/conv_mul_fusion.cpp index 4da727924fc..4f10f679743 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/conv_mul_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/conv_mul_fusion.cpp @@ -269,4 +269,4 @@ ngraph::pass::GroupConvolutionBackpropDataMultiplyFusion::GroupConvolutionBackpr auto m = std::make_shared(mul, "GroupConvolutionMultiplyFusion"); register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/fq_mul_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/fq_mul_fusion.cpp index 80ae7e0a299..7a62287285c 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/fq_mul_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/fq_mul_fusion.cpp @@ -12,6 +12,8 @@ #include #include +NGRAPH_RTTI_DEFINITION(ngraph::pass::FakeQuantizeMulFusion, "FakeQuantizeMulFusion", 0); + namespace { std::pair, ngraph::Output> get_adjusted_output_range(ngraph::Output out_low, diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/fq_reshape_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/fq_reshape_fusion.cpp index 32ecf1c66b3..0697a7ac4d5 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/fq_reshape_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/fq_reshape_fusion.cpp @@ -11,6 +11,8 @@ #include #include +NGRAPH_RTTI_DEFINITION(ngraph::pass::FakeQuantizeReshapeFusion, "FakeQuantizeReshapeFusion", 0); + ngraph::pass::FakeQuantizeReshapeFusion::FakeQuantizeReshapeFusion() { const auto fq_node_p = ngraph::pattern::wrap_type( {ngraph::pattern::wrap_type(), // for weights only diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/nop_elimination.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/nop_elimination.cpp index 685aef46a4e..dd0d5fd3257 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/nop_elimination.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/nop_elimination.cpp @@ -324,6 +324,8 @@ static bool eliminate_squeeze(const std::shared_ptr& node) { return false; } +NGRAPH_RTTI_DEFINITION(ngraph::pass::NopElimination, "NopElimination", 0); + bool pass::NopElimination::run_on_function(std::shared_ptr function) { static const std::unordered_map&)>> dispatcher{{TI(opset3::Pad), &eliminate_nop}, diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/optimize_strided_slice.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/optimize_strided_slice.cpp index fbe60a8c6c6..e4ec757881d 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/optimize_strided_slice.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/optimize_strided_slice.cpp @@ -231,3 +231,9 @@ bool ngraph::pass::GroupedStridedSliceOptimizer::run_on_function(std::shared_ptr return graph_rewritten; } +bool ngraph::pass::StridedSliceOptimization::run_on_function(std::shared_ptr f) { + bool rewritten = UselessStridedSliceEraser().run_on_function(f); + rewritten |= SharedStridedSliceEraser().run_on_function(f); + rewritten |= GroupedStridedSliceOptimizer().run_on_function(f); + return rewritten; +} diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/remove_filtering_boxes_by_size.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/remove_filtering_boxes_by_size.cpp index 56ea8be6399..7613695980a 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/remove_filtering_boxes_by_size.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/remove_filtering_boxes_by_size.cpp @@ -105,4 +105,4 @@ void ngraph::pass::RemoveFilteringBoxesBySize::remove_filtering_boxes_by_size() auto m = std::make_shared(cast, "RemoveFilteringBoxesBySize"); this->add_matcher(m, callback, PassProperty::CHANGE_DYNAMIC_STATE); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/itt.hpp b/inference-engine/src/transformations/src/transformations/itt.hpp index 6cd4836f715..994d93e5384 100644 --- a/inference-engine/src/transformations/src/transformations/itt.hpp +++ b/inference-engine/src/transformations/src/transformations/itt.hpp @@ -28,7 +28,8 @@ namespace pass { namespace itt { namespace domains { OV_ITT_DOMAIN(IETransform); -} -} -} -} + OV_ITT_DOMAIN(nGraphPass_LT); +} // namespace domains +} // namespace itt +} // namespace pass +} // namespace ngraph diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/bidirectional_sequences_decomposition.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/bidirectional_sequences_decomposition.cpp index 03f0a1bd572..69582760b03 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/bidirectional_sequences_decomposition.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/bidirectional_sequences_decomposition.cpp @@ -11,6 +11,10 @@ #include #include +NGRAPH_RTTI_DEFINITION(ngraph::pass::BidirectionalLSTMSequenceDecomposition, "BidirectionalLSTMSequenceDecomposition", 0); +NGRAPH_RTTI_DEFINITION(ngraph::pass::BidirectionalGRUSequenceDecomposition, "BidirectionalGRUSequenceDecomposition", 0); +NGRAPH_RTTI_DEFINITION(ngraph::pass::BidirectionalRNNSequenceDecomposition, "BidirectionalRNNSequenceDecomposition", 0); + ngraph::pass::BidirectionalLSTMSequenceDecomposition::BidirectionalLSTMSequenceDecomposition() { auto lstm_sequence_ngraph = ngraph::pattern::wrap_type(); diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_batch_to_space.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_batch_to_space.cpp index a6d6f3f92af..a8ea6c23045 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_batch_to_space.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_batch_to_space.cpp @@ -222,4 +222,4 @@ void ngraph::pass::ConvertBatchToSpace::convert_batch_to_space_by_elements() { auto m = std::make_shared(batch_to_space, "ConvertBatchToSpace"); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_convolutions.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_convolutions.cpp index 03fd8feed6d..8f71cb90227 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_convolutions.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_convolutions.cpp @@ -15,6 +15,7 @@ #include +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertConvolutions, "ConvertConvolutions", 0); NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertConvolution, "ConvertConvolution", 0); ngraph::pass::ConvertConvolution::ConvertConvolution() { diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_divide.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_divide.cpp index 969656253bc..cb38edfcd2c 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_divide.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_divide.cpp @@ -36,4 +36,4 @@ ngraph::pass::ConvertDivide::ConvertDivide() { auto m = std::make_shared(div, "ConvertDivide"); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_minimum_to_power_and_max.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_minimum_to_power_and_max.cpp index b98c6fa5c6a..3ed8c2b1813 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_minimum_to_power_and_max.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_minimum_to_power_and_max.cpp @@ -45,4 +45,4 @@ ngraph::pass::ConvertMinimum::ConvertMinimum() { auto m = std::make_shared(minimum, "ConvertMinimum"); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_mod.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_mod.cpp index 4df761c6142..e85f2a6ac93 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_mod.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_mod.cpp @@ -47,4 +47,4 @@ ngraph::pass::ConvertMod::ConvertMod() { auto m = std::make_shared(mod, "ConvertMod"); this->register_matcher(m, callback, PassProperty::CHANGE_DYNAMIC_STATE); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_negative.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_negative.cpp index 422391f9eaa..d3d7dd9a00d 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_negative.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_negative.cpp @@ -32,4 +32,4 @@ ngraph::pass::ConvertNegative::ConvertNegative() { auto m = std::make_shared(neg, "ConvertNegative"); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_reduce_to_pooling.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_reduce_to_pooling.cpp new file mode 100644 index 00000000000..5cc643d4a04 --- /dev/null +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_reduce_to_pooling.cpp @@ -0,0 +1,10 @@ +// Copyright (C) 2020 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "transformations/op_conversions/convert_reduce_to_pooling.hpp" + +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertReduceToPooling, "ConvertReduceToPooling", 0); +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertReduceMeanToPooling, "ConvertReduceMeanToPooling", 0); +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertReduceMaxToPooling, "ConvertReduceMaxToPooling", 0); +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertReduceSumToPooling, "ConvertReduceSumToPooling", 0); diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp index da2794ae30e..deef5e6e724 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp @@ -211,3 +211,4 @@ void ngraph::pass::ConvertScatterElementsToScatter::convert_scatter_elements_to_ auto m = std::make_shared(scatter, "ConvertScatterElementsToScatter"); this->add_matcher(m, callback, PassProperty::CHANGE_DYNAMIC_STATE); } + diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_shapeof3.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_shapeof3.cpp index 4cf68db7651..07917debee2 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_shapeof3.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_shapeof3.cpp @@ -44,4 +44,4 @@ void ngraph::pass::ConvertShapeOf3::convert_shapeof3() { auto m = std::make_shared(shapeof, "ConvertShapeOf3"); this->add_matcher(m, callback, PassProperty::CHANGE_DYNAMIC_STATE); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_shuffle_channels3.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_shuffle_channels3.cpp index ab7511fdbb0..0b8566b7d86 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_shuffle_channels3.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_shuffle_channels3.cpp @@ -99,4 +99,4 @@ void ngraph::pass::ConvertShuffleChannels3::convert_shuffle_channels3() { auto m = std::make_shared(shuffle_channels, "ConvertShuffleChannels3"); this->add_matcher(m, callback, PassProperty::CHANGE_DYNAMIC_STATE); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_batch.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_batch.cpp index 2f141cbfab0..44436873fd8 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_batch.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_batch.cpp @@ -206,4 +206,5 @@ void ngraph::pass::ConvertSpaceToBatch::convert_space_to_batch_by_elements() { auto m = std::make_shared(space_to_batch, "ConvertSpaceToBatch"); this->register_matcher(m, callback); -} \ No newline at end of file +} + diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_depth.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_depth.cpp index 35c66e83871..a6e585f544a 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_depth.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_depth.cpp @@ -91,4 +91,4 @@ ngraph::pass::ConvertSpaceToDepth::ConvertSpaceToDepth() { auto m = std::make_shared(dts, "ConvertSpaceToDepth"); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp b/inference-engine/src/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp index 9f59c36b225..5570d2380d5 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp +++ b/inference-engine/src/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp @@ -16,6 +16,10 @@ #include #include +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertTensorIteratorToLSTMSequence, "ConvertTensorIteratorToLSTMSequence", 0); +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertTensorIteratorToRNNSequence, "ConvertTensorIteratorToRNNSequence", 0); +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertTensorIteratorToGRUSequence, "ConvertTensorIteratorToGRUSequence", 0); + ngraph::pass::ConvertTensorIteratorToLSTMSequence::ConvertTensorIteratorToLSTMSequence() { auto tensor_iterator = std::make_shared(ngraph::element::f32, ngraph::Shape{}, ngraph::pattern::has_class()); diff --git a/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset2_to_opset1.cpp b/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset2_to_opset1.cpp index df71f2bd37c..8021011dd51 100644 --- a/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset2_to_opset1.cpp +++ b/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset2_to_opset1.cpp @@ -16,8 +16,6 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertOpSet2ToOpSet1, "ConvertOpSet2ToOpSet1", 0); bool ngraph::pass::ConvertOpSet2ToOpSet1::run_on_function(std::shared_ptr f) { - OV_ITT_SCOPED_TASK(itt::domains::IETransform, "ngraph::pass::ConvertOpSet2ToOpSet1"); - ngraph::pass::Manager manager(get_pass_config()); manager.register_pass(); diff --git a/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset3_to_opset2.cpp b/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset3_to_opset2.cpp index 2ad381e1367..35665673308 100644 --- a/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset3_to_opset2.cpp +++ b/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset3_to_opset2.cpp @@ -19,8 +19,6 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertOpSet3ToOpSet2, "ConvertOpSet3ToOpSet2", 0); bool ngraph::pass::ConvertOpSet3ToOpSet2::run_on_function(std::shared_ptr f) { - OV_ITT_SCOPED_TASK(itt::domains::IETransform, "ngraph::pass::ConvertOpSet3ToOpSet2"); - ngraph::pass::Manager manager(get_pass_config()); manager.register_pass(); diff --git a/inference-engine/src/transformations/src/transformations/smart_reshape/smart_reshape.cpp b/inference-engine/src/transformations/src/transformations/smart_reshape/smart_reshape.cpp index 305b6b1a83d..d58a4cdbeaa 100644 --- a/inference-engine/src/transformations/src/transformations/smart_reshape/smart_reshape.cpp +++ b/inference-engine/src/transformations/src/transformations/smart_reshape/smart_reshape.cpp @@ -7,7 +7,6 @@ #include #include -#include #include #include #include @@ -18,8 +17,6 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::SmartReshape, "SmartReshape", 0); bool ngraph::pass::SmartReshape::run_on_function(std::shared_ptr f) { - OV_ITT_SCOPED_TASK(itt::domains::IETransform, "ngraph::pass::SmartReshape"); - ngraph::pass::Manager static_manager; // This pass must be called first in pipeline static_manager.register_pass(); diff --git a/inference-engine/src/vpu/common/include/vpu/ngraph/transformations/dynamic_to_static_shape.hpp b/inference-engine/src/vpu/common/include/vpu/ngraph/transformations/dynamic_to_static_shape.hpp index 8101b84c696..0524f3920dd 100644 --- a/inference-engine/src/vpu/common/include/vpu/ngraph/transformations/dynamic_to_static_shape.hpp +++ b/inference-engine/src/vpu/common/include/vpu/ngraph/transformations/dynamic_to_static_shape.hpp @@ -15,6 +15,7 @@ using Transformations = std::unordered_map function) override; diff --git a/inference-engine/src/vpu/common/include/vpu/ngraph/transformations/eliminate_shapeof_after_dsr.hpp b/inference-engine/src/vpu/common/include/vpu/ngraph/transformations/eliminate_shapeof_after_dsr.hpp index 78afeca2e23..9ee68f02495 100644 --- a/inference-engine/src/vpu/common/include/vpu/ngraph/transformations/eliminate_shapeof_after_dsr.hpp +++ b/inference-engine/src/vpu/common/include/vpu/ngraph/transformations/eliminate_shapeof_after_dsr.hpp @@ -10,6 +10,7 @@ namespace vpu { class EliminateShapeOfAfterDSR : public ngraph::pass::GraphRewrite { public: + NGRAPH_RTTI_DECLARATION; EliminateShapeOfAfterDSR(); }; diff --git a/inference-engine/src/vpu/common/include/vpu/ngraph/transformations/merge_subsequent_dsr_operations.hpp b/inference-engine/src/vpu/common/include/vpu/ngraph/transformations/merge_subsequent_dsr_operations.hpp index 4f435d928ca..9161f2aa5a4 100644 --- a/inference-engine/src/vpu/common/include/vpu/ngraph/transformations/merge_subsequent_dsr_operations.hpp +++ b/inference-engine/src/vpu/common/include/vpu/ngraph/transformations/merge_subsequent_dsr_operations.hpp @@ -10,6 +10,7 @@ namespace vpu { class MergeSubsequentDSROperations : public ngraph::pass::GraphRewrite { public: + NGRAPH_RTTI_DECLARATION; MergeSubsequentDSROperations(); }; diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape.cpp index 2f86fd06d9d..407a1a7ab76 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape.cpp @@ -147,6 +147,8 @@ std::set getSupportedTypes(const Transformations& transformations) } // namespace +NGRAPH_RTTI_DEFINITION(DynamicToStaticShape, "DynamicToStaticShape", 0); + DynamicToStaticShape::DynamicToStaticShape(const Transformations& specificTransformations) : transformations(specificTransformations.empty() ? getDefaultTransformations() : specificTransformations) { transformations.emplace(ngraph::opset3::Result::type_info, [](const std::shared_ptr&){}); diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/eliminate_shapeof_after_dsr.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/eliminate_shapeof_after_dsr.cpp index 5b8841dc6c7..281d1cce91b 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/eliminate_shapeof_after_dsr.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/eliminate_shapeof_after_dsr.cpp @@ -9,6 +9,8 @@ #include +NGRAPH_RTTI_DEFINITION(vpu::EliminateShapeOfAfterDSR, "EliminateShapeOfAfterDSR", 0); + namespace vpu { EliminateShapeOfAfterDSR::EliminateShapeOfAfterDSR() : GraphRewrite() { diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/merge_subsequent_dsr_operations.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/merge_subsequent_dsr_operations.cpp index 922f7c7f4f0..b282e883da0 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/merge_subsequent_dsr_operations.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/merge_subsequent_dsr_operations.cpp @@ -5,6 +5,8 @@ #include "vpu/ngraph/transformations/merge_subsequent_dsr_operations.hpp" #include "vpu/ngraph/operations/dynamic_shape_resolver.hpp" +NGRAPH_RTTI_DEFINITION(vpu::MergeSubsequentDSROperations, "MergeSubsequentDSROperations", 0); + namespace vpu { MergeSubsequentDSROperations::MergeSubsequentDSROperations() : ngraph::pass::GraphRewrite() { diff --git a/inference-engine/tests/functional/inference_engine/CMakeLists.txt b/inference-engine/tests/functional/inference_engine/CMakeLists.txt index 3da8a690746..b51bbd98800 100644 --- a/inference-engine/tests/functional/inference_engine/CMakeLists.txt +++ b/inference-engine/tests/functional/inference_engine/CMakeLists.txt @@ -11,6 +11,7 @@ set(LINK_LIBRARIES funcTestUtils ngraphFunctions inference_engine_transformations + openvino::itt ) set(DEPENDENCIES mock_engine @@ -40,7 +41,7 @@ addIeTargetTest( ADD_CPPLINT DEPENDENCIES ${DEPENDENCIES} LABELS - IE + IE ) ie_faster_build(${TARGET_NAME} diff --git a/inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_engine/CMakeLists.txt b/inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_engine/CMakeLists.txt index a87543cd788..895e9426fa0 100644 --- a/inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_engine/CMakeLists.txt +++ b/inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_engine/CMakeLists.txt @@ -27,10 +27,13 @@ add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS}) -target_include_directories (${TARGET_NAME} PRIVATE - $ - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +if(TARGET IE::inference_engine_plugin_api) + target_link_libraries(${TARGET_NAME} PRIVATE IE::inference_engine_plugin_api) +else() + target_link_libraries(${TARGET_NAME} PRIVATE inference_engine_plugin_api) +endif() target_link_libraries(${TARGET_NAME} PRIVATE inference_engine) diff --git a/ngraph/core/include/ngraph/pass/constant_folding.hpp b/ngraph/core/include/ngraph/pass/constant_folding.hpp index 60076429ec9..d7bc91512c5 100644 --- a/ngraph/core/include/ngraph/pass/constant_folding.hpp +++ b/ngraph/core/include/ngraph/pass/constant_folding.hpp @@ -32,6 +32,7 @@ namespace ngraph class NGRAPH_API ngraph::pass::ConstantFolding : public ngraph::pass::GraphRewrite { public: + NGRAPH_RTTI_DECLARATION; ConstantFolding(const ngraph::BuildNodeExecutorMap& cfmap = ngraph::BuildNodeExecutorMap()); private: diff --git a/ngraph/core/include/ngraph/pass/convert_fp32_to_fp16.hpp b/ngraph/core/include/ngraph/pass/convert_fp32_to_fp16.hpp index f230fa6f841..80b483463a8 100644 --- a/ngraph/core/include/ngraph/pass/convert_fp32_to_fp16.hpp +++ b/ngraph/core/include/ngraph/pass/convert_fp32_to_fp16.hpp @@ -30,6 +30,7 @@ namespace ngraph class NGRAPH_API ngraph::pass::ConvertFP32ToFP16 : public ngraph::pass::GraphRewrite { public: + NGRAPH_RTTI_DECLARATION; ConvertFP32ToFP16() : GraphRewrite() { diff --git a/ngraph/core/src/function.cpp b/ngraph/core/src/function.cpp index ca6403db4fd..19741e33597 100644 --- a/ngraph/core/src/function.cpp +++ b/ngraph/core/src/function.cpp @@ -101,7 +101,8 @@ Function::Function(const OutputVector& results, void Function::validate_nodes_and_infer_types() { - OV_ITT_SCOPED_TASK(itt::domains::nGraph, "Function::validate_nodes_and_infer_types"); + OV_ITT_SCOPED_TASK(ngraph::itt::domains::nGraphPass_LT, + "Function::validate_nodes_and_infer_types"); for (auto& node : get_ordered_ops()) { diff --git a/ngraph/core/src/itt.hpp b/ngraph/core/src/itt.hpp index d519a8f262e..d15783865af 100644 --- a/ngraph/core/src/itt.hpp +++ b/ngraph/core/src/itt.hpp @@ -30,6 +30,7 @@ namespace ngraph namespace domains { OV_ITT_DOMAIN(nGraph); + OV_ITT_DOMAIN(nGraphPass_LT); OV_ITT_DOMAIN(nGraphOp, "nGraph::Op"); } } diff --git a/ngraph/core/src/pass/constant_folding.cpp b/ngraph/core/src/pass/constant_folding.cpp index 3237677c860..e24164c0a30 100644 --- a/ngraph/core/src/pass/constant_folding.cpp +++ b/ngraph/core/src/pass/constant_folding.cpp @@ -20,6 +20,8 @@ using namespace std; using namespace ngraph; +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConstantFolding, "ConstantFolding", 0); + ngraph::pass::ConstantFolding::ConstantFolding(const ngraph::BuildNodeExecutorMap& cfmap) : GraphRewrite() , m_cfmap{cfmap} diff --git a/ngraph/core/src/pass/convert_fp32_to_fp16.cpp b/ngraph/core/src/pass/convert_fp32_to_fp16.cpp index 377f750f7d0..60d87ed5c1d 100644 --- a/ngraph/core/src/pass/convert_fp32_to_fp16.cpp +++ b/ngraph/core/src/pass/convert_fp32_to_fp16.cpp @@ -21,6 +21,8 @@ using namespace std; using namespace ngraph; +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertFP32ToFP16, "ConvertFP32ToFP16", 0); + void pass::ConvertFP32ToFP16::convert_constants_precision() { auto constant = diff --git a/ngraph/core/src/pass/manager.cpp b/ngraph/core/src/pass/manager.cpp index 7c7a7f2b97c..4737a79613b 100644 --- a/ngraph/core/src/pass/manager.cpp +++ b/ngraph/core/src/pass/manager.cpp @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include "itt.hpp" #include "ngraph/env_util.hpp" @@ -34,6 +36,47 @@ using namespace std; using namespace ngraph; +namespace ngraph +{ + namespace pass + { + namespace + { + class PerfCounters + { + PerfCounters(PerfCounters const&) = delete; + PerfCounters& operator=(PerfCounters const&) = delete; + + public: + PerfCounters() = default; + + openvino::itt::handle_t operator[](::ngraph::Node::type_info_t const& type_inf) + { + std::lock_guard guard(m_mutex); + auto it = m_counters.find(&type_inf); + if (it != m_counters.end()) + return it->second; + return m_counters[&type_inf] = openvino::itt::handle(type_inf.name); + } + + private: + using key = ::ngraph::Node::type_info_t const*; + using value = openvino::itt::handle_t; + using counters_map = std::unordered_map; + + std::mutex m_mutex; + counters_map m_counters; + }; + + PerfCounters& perf_counters() + { + static PerfCounters counters; + return counters; + } + } + } +} + pass::Manager::Manager() : m_visualize(getenv_bool("NGRAPH_ENABLE_VISUALIZE_TRACING")) , m_pass_config(std::make_shared()) @@ -68,6 +111,9 @@ void pass::Manager::run_passes(shared_ptr func) continue; } + OV_ITT_SCOPED_TASK(itt::domains::nGraphPass_LT, + pass::perf_counters()[pass->get_type_info()]); + pass_timer.start(); NGRAPH_SUPPRESS_DEPRECATED_START diff --git a/openvino/itt/include/openvino/itt.hpp b/openvino/itt/include/openvino/itt.hpp index 86411d84242..153983b6d13 100644 --- a/openvino/itt/include/openvino/itt.hpp +++ b/openvino/itt/include/openvino/itt.hpp @@ -23,6 +23,7 @@ #include #include #include +#include namespace openvino { @@ -125,11 +126,97 @@ namespace openvino { internal::taskBegin(domain(), taskHandle); } + + /** + * @brief The ScopedTask destructor closes or ends the task scope + */ ~ScopedTask() noexcept { internal::taskEnd(domain()); } + ScopedTask(const ScopedTask&) = delete; ScopedTask& operator=(const ScopedTask&) = delete; }; + /** + * @class TaskChain + * @ingroup ie_dev_profiling + * @brief Used to annotate a sequence of sections of code which would be named at runtime + * @tparam The @p domain parameter is domain type which shoud be defined with OV_ITT_DOMAIN() macro. + */ + template + class TaskChain + { + uint32_t _id = 1; + std::string _prefix; + bool _skipped {}; + + TaskChain(const TaskChain&) = delete; + TaskChain& operator=(const TaskChain&) = delete; + + public: + /** + * @brief Construct TaskChain with defined annotation handle + */ + TaskChain(handle_t taskHandle, std::string && prefix) noexcept + : _prefix(std::forward(prefix)) + { + internal::taskBegin(domain(), taskHandle); + } + + /** + * @brief The TaskChain destructor closes or ends the task scope + */ + ~TaskChain() noexcept { skip(); } + + /** + * @brief Ends the previous task from the chain and starts a new one with the given annotation handle + */ + void next(handle_t taskHandle) + { + if(_skipped) + _skipped = false; + else + internal::taskEnd(domain()); + internal::taskBegin(domain(), taskHandle); + ++_id; + } + + /* + * @brief Generating a task name using a sequence number. + */ + std::string taskName() const + { + return _prefix + "_" + std::to_string(_id); + } + + /* + * @brief Generating a task name using a scope name. + */ + std::string taskNameOrHandle(const std::string & name) const + { + return _prefix + "_" + name; + } + + /* + * @brief Returns a handle provided as argument. + */ + handle_t taskNameOrHandle(handle_t handle) const + { + return handle; + } + + /* + * @brief Skips the remaining task scope. + */ + void skip() + { + if(!_skipped) + { + _skipped = true; + internal::taskEnd(domain()); + } + } + }; + /** * @def OV_ITT_DOMAIN(domainName) * @ingroup ie_dev_profiling @@ -143,6 +230,9 @@ namespace openvino * @cond */ +#define OV_ITT_CONCAT2(X, Y) X ## Y +#define OV_ITT_CONCAT(X, Y) OV_ITT_CONCAT2(X, Y) + #define OV_ITT_DOMAIN_1(domainName) \ inline openvino::itt::domain_t domainName() noexcept \ { \ @@ -176,17 +266,87 @@ inline openvino::itt::domain_t domainName() noexcept */ #define OV_ITT_SCOPED_TASK_1(domain) \ - struct Task ## __LINE__ {}; \ - openvino::itt::ScopedTask ittScopedTask ## __LINE__ \ - (openvino::itt::handle(ITT_FUNCTION_NAME)); + openvino::itt::ScopedTask OV_ITT_CONCAT(ittScopedTask, __LINE__) \ + (openvino::itt::handle(ITT_FUNCTION_NAME)); #define OV_ITT_SCOPED_TASK_2(domain, taskOrTaskName) \ - struct Task ## __LINE__ {}; \ - openvino::itt::ScopedTask ittScopedTask ## __LINE__ \ - (openvino::itt::handle(taskOrTaskName)); + openvino::itt::ScopedTask OV_ITT_CONCAT(ittScopedTask, __LINE__) \ + (openvino::itt::handle(taskOrTaskName)); /** * @endcond */ + +/** + * @def OV_ITT_TASK_CHAIN(chainId, domain, prefix, taskName) + * @ingroup ie_dev_profiling + * @brief Begins the sequrence of an annotated sections of code using @p prefix and @p taskName as section id. + * @details In case if prefix absent, the current function name is used, + * if taskName absent, the first chain index is used, i.e 1. + * @param chainId [in] The tasks chain identifier. + * @param domainName [in] Known at compile time name of module or library (the domain name). + * @param prefix [in] The task chain name prefix. The task name starts with this prefix. Parameter is optional. + * @param taskName [in] The annotation name for section of code. Parameter is optional. + */ +#define OV_ITT_TASK_CHAIN(...) OV_ITT_MACRO_OVERLOAD(OV_ITT_TASK_CHAIN, __VA_ARGS__) + +/** + * @cond + */ + +#define OV_ITT_TASK_CHAIN_2(chainId, domain) \ + openvino::itt::TaskChain chainId \ + (openvino::itt::handle \ + (std::string(ITT_FUNCTION_NAME) + "_1"), \ + ITT_FUNCTION_NAME); + +#define OV_ITT_TASK_CHAIN_3(chainId, domain, prefix) \ + openvino::itt::TaskChain chainId \ + (openvino::itt::handle \ + (std::string(prefix) + "_1"), \ + prefix); + +#define OV_ITT_TASK_CHAIN_4(chainId, domain, prefix, taskName) \ + openvino::itt::TaskChain chainId \ + (openvino::itt::handle \ + (std::string(prefix) + "_" + taskName), \ + prefix); + +/** + * @endcond + */ + +/** + * @def OV_ITT_TASK_NEXT(chainId, taskName) + * @ingroup ie_dev_profiling + * @brief Inserts new annotated section of code to tasks chain using @p taskName as section id. + * @details If taskName is missing, the current chain index is used. + * @param chainId [in] The tasks chain identifier. + * @param taskOrTaskName [in] The annotation name or handle for section of code. Parameter is optional. + */ +#define OV_ITT_TASK_NEXT(...) OV_ITT_MACRO_OVERLOAD(OV_ITT_TASK_NEXT, __VA_ARGS__) + +/** + * @cond + */ + +#define OV_ITT_TASK_NEXT_1(chainId) \ + chainId.next(openvino::itt::handle(chainId.taskName())); + +#define OV_ITT_TASK_NEXT_2(chainId, taskOrTaskName) \ + chainId.next(openvino::itt::handle(chainId.taskNameOrHandle(taskOrTaskName))); + +/** + * @endcond + */ + +/** + * @def OV_ITT_TASK_SKIP(chainId) + * @ingroup ie_dev_profiling + * @brief Skips the remaining task scope. + * @param chainId [in] The tasks chain identifier. + */ +#define OV_ITT_TASK_SKIP(chainId) chainId.skip(); + } // namespace itt } // namespace openvino diff --git a/openvino/itt/include/openvino/macro_overload.hpp b/openvino/itt/include/openvino/macro_overload.hpp index 59dc8d81d1a..9d638cff19f 100644 --- a/openvino/itt/include/openvino/macro_overload.hpp +++ b/openvino/itt/include/openvino/macro_overload.hpp @@ -25,8 +25,8 @@ #define OV_ITT_MACRO_NARG(...) OV_ITT_MACRO_EXPAND( OV_ITT_MACRO_NARG_(__VA_ARGS__, OV_ITT_MACRO_RSEQ_N()) ) #define OV_ITT_MACRO_NARG_(...) OV_ITT_MACRO_EXPAND( OV_ITT_MACRO_ARG_N(__VA_ARGS__) ) -#define OV_ITT_MACRO_ARG_N(_1, _2, _3, N, ...) N -#define OV_ITT_MACRO_RSEQ_N() 3, 2, 1, 0 +#define OV_ITT_MACRO_ARG_N(_1, _2, _3, _4, N, ...) N +#define OV_ITT_MACRO_RSEQ_N() 4, 3, 2, 1, 0 #define OV_ITT_MACRO_EVAL_(NAME, N) NAME ## _ ## N #define OV_ITT_MACRO_EVAL(NAME, N) OV_ITT_MACRO_EVAL_(NAME, N)