Skip to content

Commit

Permalink
Use exec_model_info.hpp to replace exec_graph_info.hpp (openvinotoolk…
Browse files Browse the repository at this point in the history
…it#22179)

Co-authored-by: Ilya Lavrenov <[email protected]>
  • Loading branch information
riverlijunjie and ilya-lavrenov authored Jan 17, 2024
1 parent 8f3bc9d commit 6ad6ac7
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 117 deletions.
11 changes: 5 additions & 6 deletions src/frontends/tensorflow/tests/compilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// SPDX-License-Identifier: Apache-2.0
//

#include <exec_graph_info.hpp>
#include <openvino/frontend/manager.hpp>
#include <openvino/openvino.hpp>

#include "gtest/gtest.h"
#include "openvino/frontend/manager.hpp"
#include "openvino/openvino.hpp"
#include "openvino/runtime/exec_model_info.hpp"
#include "tf_utils.hpp"
#include "utils.hpp"

Expand Down Expand Up @@ -54,7 +53,7 @@ TEST_F(CompileModelsTests, ModelWithSplitConvConcat)
ov::CompiledModel compiled_model = core.compile_model(model, "CPU");
const auto runtime_model = compiled_model.get_runtime_model();
auto get_layer_type = [](const std::shared_ptr<ov::Node>& node) {
return node->get_rt_info().at(ExecGraphInfoSerialization::LAYER_TYPE).as<std::string>();
return node->get_rt_info().at(ov::exec_model_info::LAYER_TYPE).as<std::string>();
};
const auto ops = runtime_model->get_ops();
EXPECT_EQ(0, std::count_if(ops.begin(), ops.end(), [&](const std::shared_ptr<ov::Node>& node) {
Expand All @@ -76,7 +75,7 @@ TEST_F(CompileModelsTests, ModelWithShapeOf) {
ov::CompiledModel compiled_model = core.compile_model(model, "CPU");
const auto runtime_model = compiled_model.get_runtime_model();
auto get_layer_type = [](const std::shared_ptr<ov::Node>& node) {
return node->get_rt_info().at(ExecGraphInfoSerialization::LAYER_TYPE).as<std::string>();
return node->get_rt_info().at(ov::exec_model_info::LAYER_TYPE).as<std::string>();
};
const auto ops = runtime_model->get_ops();
// one Input, one Eltwise and one Output
Expand Down
38 changes: 0 additions & 38 deletions src/inference/dev_api/exec_graph_info.hpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "cnn_network_ngraph_impl.hpp"
#include "cpp/ie_cnn_network.h"
#include "dev/converter_utils.hpp"
#include "exec_graph_info.hpp"
#include "ie_api.h"
#include "ie_icore.hpp"
#include "ie_iextension.h"
Expand All @@ -37,6 +36,7 @@
#include "openvino/core/runtime_attribute.hpp"
#include "openvino/op/util/op_types.hpp"
#include "openvino/pass/manager.hpp"
#include "openvino/runtime/exec_model_info.hpp"
#include "openvino/runtime/threading/executor_manager.hpp"
#include "transformations/utils/utils.hpp"

Expand Down
1 change: 0 additions & 1 deletion src/inference/src/ie_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <tuple>
#include <vector>

#include "exec_graph_info.hpp"
#include "ie_blob.h"
#include "ie_extension.h"
#include "ie_iextension.h"
Expand Down
34 changes: 17 additions & 17 deletions src/plugins/intel_cpu/src/graph_dumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

#include "graph_dumper.h"

#include "utils/debug_capabilities.h"
#include "exec_graph_info.hpp"
#include "dnnl_debug.h"
#include "openvino/pass/manager.hpp"
#include "openvino/pass/serialize.hpp"
#include <dnnl_debug.h>
#include "openvino/runtime/exec_model_info.hpp"
#include "utils/debug_capabilities.h"

#include <vector>
#include <string>
#include <memory>
#include <map>
#include <memory>
#include <string>
#include <vector>

namespace ov {
namespace intel_cpu {
Expand All @@ -28,16 +28,16 @@ std::map<std::string, std::string> extract_node_metadata(const NodePtr &node) {

if (node->getType() == Type::Input && node->isConstant()) {
// We need to separate Input and Const layers
serialization_info[ExecGraphInfoSerialization::LAYER_TYPE] = "Const";
serialization_info[ov::exec_model_info::LAYER_TYPE] = "Const";
} else {
serialization_info[ExecGraphInfoSerialization::LAYER_TYPE] = NameFromType(node->getType());
serialization_info[ov::exec_model_info::LAYER_TYPE] = NameFromType(node->getType());
}

// Original layers
serialization_info[ExecGraphInfoSerialization::ORIGINAL_NAMES] = node->getOriginalLayers();
serialization_info[ov::exec_model_info::ORIGINAL_NAMES] = node->getOriginalLayers();

// Implementation type name
serialization_info[ExecGraphInfoSerialization::IMPL_TYPE] = node->getPrimitiveDescriptorType();
serialization_info[ov::exec_model_info::IMPL_TYPE] = node->getPrimitiveDescriptorType();

std::string outputPrecisionsStr;
if (!node->getChildEdges().empty()) {
Expand All @@ -62,7 +62,7 @@ std::map<std::string, std::string> extract_node_metadata(const NodePtr &node) {
outputPrecisionsStr = node->getParentEdgeAt(0)->getMemory().getDesc().getPrecision().get_type_name();
}
}
serialization_info[ExecGraphInfoSerialization::OUTPUT_PRECISIONS] = outputPrecisionsStr;
serialization_info[ov::exec_model_info::OUTPUT_PRECISIONS] = outputPrecisionsStr;

std::string outputLayoutsStr;
auto outDescs = node->getSelectedPrimitiveDescriptor()->getConfig().outConfs;
Expand All @@ -87,18 +87,18 @@ std::map<std::string, std::string> extract_node_metadata(const NodePtr &node) {
} else {
outputLayoutsStr = dnnl::utils::fmt2str(dnnl::memory::format_tag::undef);
}
serialization_info[ExecGraphInfoSerialization::OUTPUT_LAYOUTS] = outputLayoutsStr;
serialization_info[ov::exec_model_info::OUTPUT_LAYOUTS] = outputLayoutsStr;

// Performance
if (node->PerfCounter().avg() != 0) {
serialization_info[ExecGraphInfoSerialization::PERF_COUNTER] = std::to_string(node->PerfCounter().avg());
serialization_info[ov::exec_model_info::PERF_COUNTER] = std::to_string(node->PerfCounter().avg());
} else {
serialization_info[ExecGraphInfoSerialization::PERF_COUNTER] = "not_executed"; // it means it was not calculated yet
serialization_info[ov::exec_model_info::PERF_COUNTER] = "not_executed"; // it means it was not calculated yet
}

serialization_info[ExecGraphInfoSerialization::EXECUTION_ORDER] = std::to_string(node->getExecIndex());
serialization_info[ov::exec_model_info::EXECUTION_ORDER] = std::to_string(node->getExecIndex());

serialization_info[ExecGraphInfoSerialization::RUNTIME_PRECISION] = node->getRuntimePrecision().get_type_name();
serialization_info[ov::exec_model_info::RUNTIME_PRECISION] = node->getRuntimePrecision().get_type_name();

return serialization_info;
}
Expand Down Expand Up @@ -164,7 +164,7 @@ std::shared_ptr<ov::Model> dump_graph_as_ie_ngraph_net(const Graph &graph) {
results.emplace_back(std::make_shared<ov::op::v0::Result>(get_inputs(node).back()));
return_node = results.back();
} else {
return_node = std::make_shared<ExecGraphInfoSerialization::ExecutionNode>(
return_node = std::make_shared<ov::exec_model_info::ExecutionNode>(
get_inputs(node), node->getSelectedPrimitiveDescriptor()->getConfig().outConfs.size());

for (size_t port = 0; port < return_node->get_output_size(); ++port) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void ConvolutionLayerCPUTest::checkBiasFusing(ov::CompiledModel& execNet) const
return it->second.as<std::string>();
};

if (getExecValue(ExecGraphInfoSerialization::LAYER_TYPE) == "Convolution") {
if (getExecValue(ov::exec_model_info::LAYER_TYPE) == "Convolution") {
foundConv = true;
ASSERT_EQ(3, node->inputs().size());
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class GroupConvolutionLayerCPUTest : public testing::WithParamInterface<groupCon
return it->second.as<std::string>();
};

if (getExecValue(ExecGraphInfoSerialization::LAYER_TYPE) == "Convolution") {
if (getExecValue(ov::exec_model_info::LAYER_TYPE) == "Convolution") {
foundConv = true;
ASSERT_EQ(3, node->inputs().size());
break;
Expand Down Expand Up @@ -225,8 +225,8 @@ TEST_P(ExpectFallbackGroupConvolutionLayerCPUTest, CompareWithRefs) {
OPENVINO_ASSERT(rtInfo.end() != it);
return it->second.as<std::string>();
};
if ("Convolution" == getExecValue(ExecGraphInfoSerialization::LAYER_TYPE)) {
auto primType = getExecValue(ExecGraphInfoSerialization::IMPL_TYPE);
if ("Convolution" == getExecValue(ov::exec_model_info::LAYER_TYPE)) {
auto primType = getExecValue(ov::exec_model_info::IMPL_TYPE);
ASSERT_TRUE(selectedType != primType) << "primType is unexpected: " << primType;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class MatMulDecompressConvertTest : public testing::WithParamInterface<MatMulDec
const auto execFunction = compiledModel.get_runtime_model();
ASSERT_NE(nullptr, execFunction);
for (const auto& fcNode : execFunction->get_ops()) {
if (getExecValue(fcNode->get_rt_info(), ExecGraphInfoSerialization::LAYER_TYPE) == "FullyConnected") {
if (getExecValue(fcNode->get_rt_info(), ov::exec_model_info::LAYER_TYPE) == "FullyConnected") {
const auto& constNode = fcNode->get_input_node_shared_ptr(1);
ov::element::Type expectedType(
getExecValue(constNode->get_rt_info(), ov::exec_model_info::OUTPUT_PRECISIONS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class MatmulBrgemmInt8Test : public testing::WithParamInterface<MatmulBrgemmInt8
return it->second.as<std::string>();
};
if (node->get_friendly_name() == nodeName) {
auto primType = getExecValue(ExecGraphInfoSerialization::IMPL_TYPE);
auto primType = getExecValue(ov::exec_model_info::IMPL_TYPE);
ASSERT_TRUE(primTypeCheck(primType)) << "primType is unexpected: " << primType << " Expected: " << selectedType;
ASSERT_EQ(node->get_output_element_type(0), outType);
ASSERT_EQ(node->get_input_element_type(0), inType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
#include "shared_test_classes/base/layer_test_utils.hpp"
#include "transformations/rt_info/primitives_priority_attribute.hpp"

// To be removed
#include "exec_graph_info.hpp"

namespace CPUTestUtils {
typedef enum {
undef,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifcorer: Apache-2.0
//

#include <exec_graph_info.hpp>
#include <fstream>
#include <openvino/pass/serialize.hpp>
#include <openvino/core/preprocess/pre_post_process.hpp>
Expand All @@ -13,6 +12,7 @@
#include "common_test_utils/ov_test_utils.hpp"
#include "functional_test_utils/plugin_cache.hpp"
#include "openvino/op/concat.hpp"
#include "openvino/runtime/exec_model_info.hpp"
#include "openvino/runtime/tensor.hpp"
#include "common_test_utils/subgraph_builders/conv_pool_relu.hpp"
#include "common_test_utils/subgraph_builders/multiple_input_outpput_double_concat.hpp"
Expand Down Expand Up @@ -367,10 +367,10 @@ TEST_P(OVCompiledModelBaseTestOptional, CheckExecGraphInfoBeforeExecution) {
};

// Each layer from the execGraphInfo network must have PM data option set
EXPECT_EQ("not_executed", getExecValue(ExecGraphInfoSerialization::PERF_COUNTER));
EXPECT_EQ("not_executed", getExecValue(ov::exec_model_info::PERF_COUNTER));
// Parse origin layer names (fused/merged layers) from the executable graph
// and compare with layers from the original model
auto origFromExecLayer = getExecValue(ExecGraphInfoSerialization::ORIGINAL_NAMES);
auto origFromExecLayer = getExecValue(ov::exec_model_info::ORIGINAL_NAMES);
if (origFromExecLayer.empty()) {
constCnt++;
} else {
Expand Down Expand Up @@ -420,7 +420,7 @@ TEST_P(OVCompiledModelBaseTestOptional, CheckExecGraphInfoAfterExecution) {

// At least one layer in the topology should be executed and have valid perf counter value
try {
float x = static_cast<float>(std::atof(getExecValue(ExecGraphInfoSerialization::PERF_COUNTER).c_str()));
float x = static_cast<float>(std::atof(getExecValue(ov::exec_model_info::PERF_COUNTER).c_str()));
std::cout << "TIME: " << x << std::endl;
EXPECT_GE(x, 0.0f);
hasOpWithValidTime = true;
Expand All @@ -429,7 +429,7 @@ TEST_P(OVCompiledModelBaseTestOptional, CheckExecGraphInfoAfterExecution) {

// Parse origin layer names (fused/merged layers) from the executable graph
// and compare with layers from the original model
auto origFromExecLayer = getExecValue(ExecGraphInfoSerialization::ORIGINAL_NAMES);
auto origFromExecLayer = getExecValue(ov::exec_model_info::ORIGINAL_NAMES);
std::vector<std::string> origFromExecLayerSep = ov::test::utils::splitStringByDelimiter(origFromExecLayer);
if (origFromExecLayer.empty()) {
constCnt++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

#include <fstream>

#include <exec_graph_info.hpp>
#include <openvino/pass/serialize.hpp>
#include "base/ov_behavior_test_utils.hpp"
#include "common_test_utils/ov_test_utils.hpp"
#include "common_test_utils/common_utils.hpp"
#include "common_test_utils/file_utils.hpp"

#include "functional_test_utils/plugin_cache.hpp"
#include "common_test_utils/ov_test_utils.hpp"
#include "common_test_utils/subgraph_builders/multiple_input_outpput_double_concat.hpp"
#include "functional_test_utils/plugin_cache.hpp"
#include "openvino/pass/serialize.hpp"
#include "openvino/runtime/exec_model_info.hpp"

namespace ov {
namespace test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0
//

#include <exec_graph_info.hpp>
#include "base/behavior_test_utils.hpp"
#include "common_test_utils/ov_test_utils.hpp"
#include "common_test_utils/file_utils.hpp"
#include "openvino/runtime/exec_model_info.hpp"
#include "openvino/core/model.hpp"
#include "openvino/op/relu.hpp"
#include "common_test_utils/subgraph_builders/conv_pool_relu.hpp"
Expand Down Expand Up @@ -183,10 +183,10 @@ TEST_P(ExecutableNetworkBaseTest, CheckExecGraphInfoBeforeExecution) {
};

// Each layer from the execGraphInfo network must have PM data option set
ASSERT_EQ("not_executed", getExecValue(ExecGraphInfoSerialization::PERF_COUNTER));
ASSERT_EQ("not_executed", getExecValue(ov::exec_model_info::PERF_COUNTER));
// Parse origin layer names (fused/merged layers) from the executable graph
// and compare with layers from the original model
auto origFromExecLayer = getExecValue(ExecGraphInfoSerialization::ORIGINAL_NAMES);
auto origFromExecLayer = getExecValue(ov::exec_model_info::ORIGINAL_NAMES);
if (origFromExecLayer.empty()) {
constCnt++;
} else {
Expand Down Expand Up @@ -236,15 +236,15 @@ TEST_P(ExecutableNetworkBaseTest, CheckExecGraphInfoAfterExecution) {

// At least one layer in the topology should be executed and have valid perf counter value
try {
float x = static_cast<float>(std::atof(getExecValue(ExecGraphInfoSerialization::PERF_COUNTER).c_str()));
float x = static_cast<float>(std::atof(getExecValue(ov::exec_model_info::PERF_COUNTER).c_str()));
std::cout << "TIME: " << x << std::endl;
ASSERT_GE(x, 0.0f);
hasOpWithValidTime = true;
} catch (std::exception &) {}

// Parse origin layer names (fused/merged layers) from the executable graph
// and compare with layers from the original model
auto origFromExecLayer = getExecValue(ExecGraphInfoSerialization::ORIGINAL_NAMES);
auto origFromExecLayer = getExecValue(ov::exec_model_info::ORIGINAL_NAMES);
std::vector<std::string> origFromExecLayerSep = ov::test::utils::splitStringByDelimiter(origFromExecLayer);
if (origFromExecLayer.empty()) {
constCnt++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

#include <fstream>

#include "exec_graph_info.hpp"
#include "base/ov_behavior_test_utils.hpp"
#include "shared_test_classes/base/ov_subgraph.hpp"
#include "openvino/runtime/exec_model_info.hpp"
#include "pugixml.hpp"
#include "shared_test_classes/base/ov_subgraph.hpp"

namespace ov {
namespace test {
Expand Down
Loading

0 comments on commit 6ad6ac7

Please sign in to comment.