Removed FixRtInfo pass (#16870)

* Removed FixRtInfo pass

* Removed FixRtInfo pass

* Fixed macOS compilation
This commit is contained in:
Ilya Lavrenov 2023-09-19 00:07:59 +04:00 committed by GitHub
parent 10dc2d8b9b
commit 54609e7b72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 13 additions and 111 deletions

View File

@ -106,8 +106,6 @@ function(openvino_developer_export_targets)
if(TARGET "${target_name}") if(TARGET "${target_name}")
get_target_property(original_name ${target_name} ALIASED_TARGET) get_target_property(original_name ${target_name} ALIASED_TARGET)
if(TARGET "${original_name}") if(TARGET "${original_name}")
message(STATUS "The name ${target_name} is an ALIAS for ${original_name}. "
"It will be exported to the OpenVINODeveloperPackage with the original name.")
list(REMOVE_ITEM ${EXPORT_COMPONENT} ${target_name}) list(REMOVE_ITEM ${EXPORT_COMPONENT} ${target_name})
list(APPEND ${EXPORT_COMPONENT} ${original_name}) list(APPEND ${EXPORT_COMPONENT} ${original_name})
endif() endif()

View File

@ -69,7 +69,6 @@ It checks whether the code region in this module is active or inactive by the ma
There is an example of `conditional_compilation_gen.h`: There is an example of `conditional_compilation_gen.h`:
``` ```
#define ov_pass_FixRtInfo_run_on_function 1
#define ov_pass_GraphRewrite_run_on_model 1 #define ov_pass_GraphRewrite_run_on_model 1
#define ov_pass_InitNodeInfo_run_on_function 1 #define ov_pass_InitNodeInfo_run_on_function 1
#define ov_pass_ConstantFolding_run_on_model 1 #define ov_pass_ConstantFolding_run_on_model 1

View File

@ -62,7 +62,7 @@ static uint64_t hash_combine(uint64_t seed, const T &v) {
namespace rt_info { namespace rt_info {
// some node attr is not type of ov::RuntimeAttribute, need dedicate visitor. // some node attr is not type of ov::RuntimeAttribute, need dedicate visitor.
const std::vector<std::string> list_of_names{ static const std::vector<std::string> list_of_names{
"PrimitivesPriority", "PrimitivesPriority",
"alt_width", "alt_width",
}; };

View File

@ -1,38 +0,0 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
/**
* @brief Defines initialize node runtime information pass
* @file init_node_info.hpp
*/
#include <memory>
#include <vector>
#include "openvino/pass/graph_rewrite.hpp"
#include "transformations_visibility.hpp"
namespace ov {
namespace pass {
class TRANSFORMATIONS_API FixRtInfo;
} // namespace pass
} // namespace ov
/**
* @ingroup ie_transformation_common_api
* @brief FixRtInfo transformation helps to fix info attributes in a single place.
* User can pass runtime attribute using various types.
* This Pass should generalize them runtime info representation.
*
* Used to extract runtime attributes from shared pointer to `ov::RuntimeAttributeWrapper` to standard or trivial types
*/
class ov::pass::FixRtInfo : public ov::pass::ModelPass {
public:
OPENVINO_RTTI("FixRtInfo", "0");
bool run_on_model(const std::shared_ptr<ov::Model>& m) override;
};

View File

@ -1,42 +0,0 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/fix_rt_info.hpp"
#include <memory>
#include <vector>
#include "itt.hpp"
#include "openvino/core/rt_info.hpp"
#include "openvino/opsets/opset1.hpp"
#include "transformations/rt_info/primitives_priority_attribute.hpp"
bool ov::pass::FixRtInfo::run_on_model(const std::shared_ptr<ov::Model>& f) {
RUN_ON_FUNCTION_SCOPE(FixRtInfo);
for (auto& node : f->get_ops()) {
// Recursively apply transformation for sub-graph based operations
if (auto sub_graph_node = std::dynamic_pointer_cast<op::util::SubGraphOp>(node)) {
if (auto sub_graph = sub_graph_node->get_function()) {
run_on_model(sub_graph);
}
}
auto& rt_info = node->get_rt_info();
{
auto it_info = rt_info.find("PrimitivesPriority");
if (it_info != rt_info.end()) {
if (it_info->second.is<ov::PrimitivesPriority>()) {
rt_info.emplace(ov::PrimitivesPriority::get_type_info_static(),
it_info->second.as<ov::PrimitivesPriority>());
}
if (it_info->second.is<std::string>()) {
rt_info.emplace(ov::PrimitivesPriority::get_type_info_static(),
ov::PrimitivesPriority{it_info->second.as<std::string>()});
}
rt_info.erase(it_info);
}
}
}
return false;
}

View File

@ -8,9 +8,7 @@
#include <vector> #include <vector>
#include "itt.hpp" #include "itt.hpp"
#include "openvino/core/rt_info.hpp" #include "openvino/op/util/sub_graph_base.hpp"
#include "openvino/opsets/opset1.hpp"
#include "transformations/fix_rt_info.hpp"
#include "transformations/rt_info/fused_names_attribute.hpp" #include "transformations/rt_info/fused_names_attribute.hpp"
#include "transformations/rt_info/primitives_priority_attribute.hpp" #include "transformations/rt_info/primitives_priority_attribute.hpp"
@ -27,6 +25,5 @@ bool ov::pass::InitNodeInfo::run_on_model(const std::shared_ptr<ov::Model>& f) {
auto& rtInfo = node->get_rt_info(); auto& rtInfo = node->get_rt_info();
rtInfo.emplace(FusedNames::get_type_info_static(), FusedNames{node->get_friendly_name()}); rtInfo.emplace(FusedNames::get_type_info_static(), FusedNames{node->get_friendly_name()});
} }
FixRtInfo{}.run_on_model(f);
return false; return false;
} }

View File

@ -122,7 +122,6 @@ file(GLOB_RECURSE smart_reshape_srcs ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/smart_
file(GLOB_RECURSE rt_info_srcs ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/rt_info/*.cpp) file(GLOB_RECURSE rt_info_srcs ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/rt_info/*.cpp)
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/src/pass/convert_precision.cpp" set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/src/pass/convert_precision.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/pass/convert_fp32_to_fp16.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/pass/convert_fp32_to_fp16.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/pass/fix_rt_info.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/pass/init_node_info.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/pass/init_node_info.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/pass/serialize.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/pass/serialize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/op/type_relaxed.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/op/type_relaxed.cpp"

View File

@ -197,7 +197,7 @@ void ngfunction_2_ir(pugi::xml_node& node,
bool deterministic); bool deterministic);
namespace rt_info { namespace rt_info {
const std::vector<std::string> list_of_names{ static const std::vector<std::string> list_of_names{
"PrimitivesPriority", "PrimitivesPriority",
"alt_width", "alt_width",
}; };

View File

@ -11,8 +11,6 @@ ov_try_use_gold_linker()
add_definitions(-DSERIALIZED_ZOO=\"${TEST_MODEL_ZOO}/core/models\") add_definitions(-DSERIALIZED_ZOO=\"${TEST_MODEL_ZOO}/core/models\")
message(STATUS "OpenVINO Core unit tests enabled")
# For type relaxed types # For type relaxed types
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/threading.cpp set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/threading.cpp
PROPERTIES INCLUDE_DIRECTORIES $<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>) PROPERTIES INCLUDE_DIRECTORIES $<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>)

View File

@ -29,7 +29,6 @@
#include "transformations/common_optimizations/nop_elimination.hpp" #include "transformations/common_optimizations/nop_elimination.hpp"
#include "transformations/common_optimizations/remove_concat_zero_dim_input.hpp" #include "transformations/common_optimizations/remove_concat_zero_dim_input.hpp"
#include "transformations/common_optimizations/remove_multi_subgraph_op_dangling_params.hpp" #include "transformations/common_optimizations/remove_multi_subgraph_op_dangling_params.hpp"
#include "transformations/fix_rt_info.hpp"
#include "transformations/smart_reshape/set_batch_size.hpp" #include "transformations/smart_reshape/set_batch_size.hpp"
#include "transformations/smart_reshape/smart_reshape.hpp" #include "transformations/smart_reshape/smart_reshape.hpp"
#include "transformations/utils/utils.hpp" #include "transformations/utils/utils.hpp"
@ -136,7 +135,6 @@ CNNNetworkNGraphImpl::CNNNetworkNGraphImpl(const std::shared_ptr<Function>& nGra
{ {
ov::pass::Manager m; ov::pass::Manager m;
using namespace ov::pass; using namespace ov::pass;
REGISTER_PASS(m, FixRtInfo)
REGISTER_PASS(m, EliminateScatterUpdate) REGISTER_PASS(m, EliminateScatterUpdate)
REGISTER_PASS(m, RemoveConcatZeroDimInput) REGISTER_PASS(m, RemoveConcatZeroDimInput)
REGISTER_PASS(m, RemoveMultiSubGraphOpDanglingParamsResults) REGISTER_PASS(m, RemoveMultiSubGraphOpDanglingParamsResults)
@ -199,12 +197,6 @@ CNNNetworkNGraphImpl::CNNNetworkNGraphImpl(const CNNNetwork& network) {
} }
_ngraph_function = ngraph::clone_function(*network.getFunction()); _ngraph_function = ngraph::clone_function(*network.getFunction());
{
ov::pass::Manager m;
using namespace ov::pass;
REGISTER_PASS(m, FixRtInfo)
m.run_passes(_ngraph_function);
}
validateFunctionNames(); validateFunctionNames();
InputsDataMap inputs = network.getInputsInfo(); InputsDataMap inputs = network.getInputsInfo();
OutputsDataMap outputs = network.getOutputsInfo(); OutputsDataMap outputs = network.getOutputsInfo();

View File

@ -18,7 +18,6 @@
#include "itt.hpp" #include "itt.hpp"
#include "ngraph/opsets/opset6.hpp" #include "ngraph/opsets/opset6.hpp"
#include "openvino/pass/manager.hpp" #include "openvino/pass/manager.hpp"
#include "transformations/fix_rt_info.hpp"
#include "transformations/hash.hpp" #include "transformations/hash.hpp"
#include "transformations/rt_info/fused_names_attribute.hpp" #include "transformations/rt_info/fused_names_attribute.hpp"
#include "transformations/rt_info/primitives_priority_attribute.hpp" #include "transformations/rt_info/primitives_priority_attribute.hpp"
@ -86,7 +85,6 @@ std::string ModelCache::compute_hash(const std::shared_ptr<const ov::Model>& mod
uint64_t seed = 0; uint64_t seed = 0;
// 1. Calculate hash on function // 1. Calculate hash on function
ov::pass::Manager m; ov::pass::Manager m;
m.register_pass<ov::pass::FixRtInfo>();
m.register_pass<ov::pass::Hash>(seed); m.register_pass<ov::pass::Hash>(seed);
m.run_passes(std::const_pointer_cast<ov::Model>(model)); m.run_passes(std::const_pointer_cast<ov::Model>(model));

View File

@ -189,8 +189,7 @@ TEST(NetworkContext, HashWithPrimitivesPriority) {
op3["PrimitivesPriority"] = "testPriority"; op3["PrimitivesPriority"] = "testPriority";
ASSERT_NE(ModelCache::compute_hash(net1, {}), ModelCache::compute_hash(net2, {})); ASSERT_NE(ModelCache::compute_hash(net1, {}), ModelCache::compute_hash(net2, {}));
ASSERT_NE(ModelCache::compute_hash(net2, {}), ModelCache::compute_hash(net3, {}));
ASSERT_EQ(ModelCache::compute_hash(net2, {}), ModelCache::compute_hash(net3, {}));
} }
TEST(NetworkContext, HashWithFusedNames) { TEST(NetworkContext, HashWithFusedNames) {

View File

@ -6,6 +6,7 @@
#include "ie_ngraph_utils.hpp" #include "ie_ngraph_utils.hpp"
#include "openvino/core/type/element_type.hpp" #include "openvino/core/type/element_type.hpp"
#include "utils/rt_info/memory_formats_attribute.hpp" #include "utils/rt_info/memory_formats_attribute.hpp"
#include "transformations/rt_info/primitives_priority_attribute.hpp"
#include "utils/general_utils.h" #include "utils/general_utils.h"
#include <cstdint> #include <cstdint>
@ -101,7 +102,7 @@ std::string CPUTestsBase::fmts2str(const std::vector<cpu_memory_format_t> &fmts,
return str; return str;
} }
std::string CPUTestsBase::impls2str(const std::vector<std::string> &priority) { ov::PrimitivesPriority CPUTestsBase::impls2primProiority(const std::vector<std::string> &priority) {
std::string str; std::string str;
for (auto &impl : priority) { for (auto &impl : priority) {
((str += "cpu:") += impl) += ","; ((str += "cpu:") += impl) += ",";
@ -109,7 +110,7 @@ std::string CPUTestsBase::impls2str(const std::vector<std::string> &priority) {
if (!str.empty()) { if (!str.empty()) {
str.pop_back(); str.pop_back();
} }
return str; return ov::PrimitivesPriority(str);
} }
void CPUTestsBase::CheckPluginRelatedResults(InferenceEngine::ExecutableNetwork &execNet, const std::set<std::string>& nodeType) const { void CPUTestsBase::CheckPluginRelatedResults(InferenceEngine::ExecutableNetwork &execNet, const std::set<std::string>& nodeType) const {
@ -321,7 +322,7 @@ CPUTestsBase::makeCPUInfo(const std::vector<cpu_memory_format_t>& inFmts,
ov::intel_cpu::OutputMemoryFormats(fmts2str(outFmts, "cpu:"))}); ov::intel_cpu::OutputMemoryFormats(fmts2str(outFmts, "cpu:"))});
} }
if (!priority.empty()) { if (!priority.empty()) {
cpuInfo.insert({"PrimitivesPriority", impls2str(priority)}); cpuInfo.emplace(ov::PrimitivesPriority::get_type_info_static(), impls2primProiority(priority));
} }
cpuInfo.insert({"enforceBF16evenForGraphTail", true}); cpuInfo.insert({"enforceBF16evenForGraphTail", true});

View File

@ -7,6 +7,7 @@
#include <string> #include <string>
#include "ie_system_conf.h" #include "ie_system_conf.h"
#include "shared_test_classes/base/layer_test_utils.hpp" #include "shared_test_classes/base/layer_test_utils.hpp"
#include "transformations/rt_info/primitives_priority_attribute.hpp"
#include <exec_graph_info.hpp> #include <exec_graph_info.hpp>
#include <openvino/runtime/compiled_model.hpp> #include <openvino/runtime/compiled_model.hpp>
#include "ie_system_conf.h" #include "ie_system_conf.h"
@ -122,7 +123,7 @@ public:
static const char *cpu_fmt2str(cpu_memory_format_t v); static const char *cpu_fmt2str(cpu_memory_format_t v);
static cpu_memory_format_t cpu_str2fmt(const char *str); static cpu_memory_format_t cpu_str2fmt(const char *str);
static std::string fmts2str(const std::vector<cpu_memory_format_t> &fmts, const std::string &prefix); static std::string fmts2str(const std::vector<cpu_memory_format_t> &fmts, const std::string &prefix);
static std::string impls2str(const std::vector<std::string> &priority); static ov::PrimitivesPriority impls2primProiority(const std::vector<std::string> &priority);
static CPUInfo makeCPUInfo(const std::vector<cpu_memory_format_t>& inFmts, static CPUInfo makeCPUInfo(const std::vector<cpu_memory_format_t>& inFmts,
const std::vector<cpu_memory_format_t>& outFmts, const std::vector<cpu_memory_format_t>& outFmts,
const std::vector<std::string>& priority); const std::vector<std::string>& priority);

View File

@ -28,11 +28,11 @@ ov_add_test_target(
find_package(OpenCV QUIET COMPONENTS core imgproc) find_package(OpenCV QUIET COMPONENTS core imgproc)
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER_EQUAL 3.4) if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER_EQUAL 3.4)
message("-- Reference preprocessing: OpenCV tests are enabled") message(STATUS "Reference preprocessing: OpenCV tests are enabled")
target_compile_definitions(${TARGET_NAME} PRIVATE OPENCV_TEMPLATE_TESTS) target_compile_definitions(${TARGET_NAME} PRIVATE OPENCV_TEMPLATE_TESTS)
target_link_libraries(${TARGET_NAME} PRIVATE opencv_imgproc opencv_core) target_link_libraries(${TARGET_NAME} PRIVATE opencv_imgproc opencv_core)
else() else()
message("-- Reference preprocessing: OpenCV tests are disabled, because OpenCV ver. 3.4+ is not found") message(WARNING "Reference preprocessing: OpenCV tests are disabled, because OpenCV ver. 3.4+ is not found")
endif() endif()
if (ENABLE_INTEL_CPU) if (ENABLE_INTEL_CPU)

View File

@ -140,7 +140,7 @@ void OpSummary::updateOPsStats(const std::shared_ptr<ov::Model>& model, const Pa
return; return;
} }
bool isFunctionalGraph = false; bool isFunctionalGraph = false;
for (const auto &op : model->get_ordered_ops()) { for (const auto& op : model->get_ordered_ops()) {
if (!std::dynamic_pointer_cast<ov::op::v0::Parameter>(op) && if (!std::dynamic_pointer_cast<ov::op::v0::Parameter>(op) &&
!std::dynamic_pointer_cast<ov::op::v0::Constant>(op) && !std::dynamic_pointer_cast<ov::op::v0::Constant>(op) &&
!std::dynamic_pointer_cast<ov::op::v0::Result>(op)) { !std::dynamic_pointer_cast<ov::op::v0::Result>(op)) {