Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[TRANSFORMATION] Introduce new DisablePrecisionConversion RT attribute for ConvertPrecision (#34311)

Andrii Staikovac001bacd3a9
diff --git a/src/bindings/python/tests/test_runtime/test_model.py b/src/bindings/python/tests/test_runtime/test_model.py
index 7814129da61..f38f6f7a6a7 100644
--- a/src/bindings/python/tests/test_runtime/test_model.py
+++ b/src/bindings/python/tests/test_runtime/test_model.py
@@ -672,6 +672,34 @@ def test_serialize_rt_info(request, tmp_path):
os.remove(bin_path)
+def test_serialize_node_rt_info_disable_fp16(request, tmp_path):
+ # Setting rt_info["precise_0"] = "" on a node from Python simulates
+ # disabling FP16 compression. During serialization, "precise_0" is
+ # converted into a DisablePrecisionConversion attribute so the flag
+ # persists in the IR. After deserialization the key becomes
+ # "DisablePrecisionConversion_0". This test verifies the round-trip.
+ core = Core()
+ xml_path, bin_path = create_filenames_for_ir(request.node.name, tmp_path)
+
+ param = ops.parameter(PartialShape([1, 3]), dtype=np.float32, name="data")
+ relu = ops.relu(param, name="relu_node")
+ model = Model(relu, [param], "TestModel")
+
+ # Set the string-based rt_info that Python users would use
+ relu.get_rt_info()["precise_0"] = ""
+ assert "precise_0" in relu.get_rt_info()
+
+ serialize(model, xml_path, bin_path)
+ res_model = core.read_model(model=xml_path, weights=bin_path)
+
+ for op in res_model.get_ops():
+ if op.get_friendly_name() == "relu_node":
+ assert "DisablePrecisionConversion_0" in op.get_rt_info()
+
+ os.remove(xml_path)
+ os.remove(bin_path)
+
+
def make_enum_info():
from enum import Enum
diff --git a/src/common/transformations/include/transformations/fp16_compression/convert_legacy_precision_attribute.hpp b/src/common/transformations/include/transformations/fp16_compression/convert_legacy_precision_attribute.hpp
new file mode 100644
index 00000000000..e24fe8da2b5
--- /dev/null
+++ b/src/common/transformations/include/transformations/fp16_compression/convert_legacy_precision_attribute.hpp
@@ -0,0 +1,27 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include "openvino/pass/matcher_pass.hpp"
+#include "transformations_visibility.hpp"
+
+namespace ov::pass {
+
+class TRANSFORMATIONS_API ConvertLegacyPrecisionAttribute;
+
+} // namespace ov::pass
+
+/**
+ * @ingroup ov_transformation_common_api
+ * @brief ConvertLegacyPrecisionAttribute migrates the legacy DisableFP16Compression
+ * runtime attribute ("precise") to the new DisablePrecisionConversion attribute.
+ * This ensures backward compatibility when loading old IR models that use the
+ * legacy attribute.
+ */
+class ov::pass::ConvertLegacyPrecisionAttribute : public ov::pass::ModelPass {
+public:
+ OPENVINO_MODEL_PASS_RTTI("ConvertLegacyPrecisionAttribute");
+ bool run_on_model(const std::shared_ptr<ov::Model>& model) override;
+};
diff --git a/src/common/transformations/include/transformations/rt_info/disable_fp16_compression.hpp b/src/common/transformations/include/transformations/rt_info/disable_fp16_compression.hpp
index 58a3895b7f6..8d9f06d8af7 100644
--- a/src/common/transformations/include/transformations/rt_info/disable_fp16_compression.hpp
+++ b/src/common/transformations/include/transformations/rt_info/disable_fp16_compression.hpp
@@ -4,6 +4,11 @@
#pragma once
+#include <map>
+#include <set>
+#include <vector>
+
+#include "openvino/core/attribute_adapter.hpp"
#include "openvino/core/node.hpp"
#include "openvino/core/runtime_attribute.hpp"
#include "transformations_visibility.hpp"
@@ -43,4 +48,121 @@ public:
}
};
-} // namespace ov
+/**
+ * @brief Disable precision conversion from any type (dynamic) to the specified type on a @ref Node.
+ *
+ * @param node Node to apply the attribute to.
+ * @param to Target element type to disable conversion to.
+ */
+TRANSFORMATIONS_API void disable_conversion(const std::shared_ptr<Node>& node, const element::Type& to);
+
+/**
+ * @brief Disable precision conversion from one type to another on a @ref Node.
+ *
+ * @param node Node to apply the attribute to.
+ * @param from Source element type.
+ * @param to Target element type.
+ */
+TRANSFORMATIONS_API void disable_conversion(const std::shared_ptr<Node>& node,
+ const element::Type& from,
+ const element::Type& to);
+
+/**
+ * @brief Disable precision conversion for all combinations of the specified source and target types on a @ref Node.
+ *
+ * @param node Node to apply the attribute to.
+ * @param from_types Source element types.
+ * @param to_types Target element types.
+ */
+TRANSFORMATIONS_API void disable_conversion(const std::shared_ptr<Node>& node,
+ const element::TypeVector& from_types,
+ const element::TypeVector& to_types);
+
+/**
+ * @brief Enable precision conversion from any type (dynamic) to the specified type on a @ref Node.
+ *
+ * @param node Node to remove the attribute from.
+ * @param to Target element type to enable conversion to.
+ */
+TRANSFORMATIONS_API void enable_conversion(const std::shared_ptr<Node>& node, const element::Type& to);
+
+/**
+ * @brief Enable precision conversion from one type to another on a @ref Node.
+ *
+ * @param node Node to remove the attribute from.
+ * @param from Source element type.
+ * @param to Target element type.
+ */
+TRANSFORMATIONS_API void enable_conversion(const std::shared_ptr<Node>& node,
+ const element::Type& from,
+ const element::Type& to);
+
+/**
+ * @brief Enable precision conversion for all combinations of the specified source and target types on a @ref Node.
+ *
+ * @param node Node to remove the attribute from.
+ * @param from_types Source element types.
+ * @param to_types Target element types.
+ */
+TRANSFORMATIONS_API void enable_conversion(const std::shared_ptr<Node>& node,
+ const element::TypeVector& from_types,
+ const element::TypeVector& to_types);
+
+/**
+ * @brief Check if precision conversion from any type (dynamic) to the specified type is disabled on a @ref Node.
+ *
+ * @param node Node to check.
+ * @param to Target element type to check.
+ * @return true if conversion to the given type is disabled, false otherwise.
+ */
+TRANSFORMATIONS_API bool is_conversion_disabled(const std::shared_ptr<const Node>& node, const element::Type& to);
+
+/**
+ * @brief Check if precision conversion from one type to another is disabled on a @ref Node.
+ *
+ * @param node Node to check.
+ * @param from Source element type.
+ * @param to Target element type.
+ * @return true if conversion from the given source to the given target type is disabled, false otherwise.
+ */
+TRANSFORMATIONS_API bool is_conversion_disabled(const std::shared_ptr<const Node>& node,
+ const element::Type& from,
+ const element::Type& to);
+
+using DisabledPrecisionMap = std::map<ov::element::Type, std::set<ov::element::Type>>;
+
+class TRANSFORMATIONS_API DisablePrecisionConversion : public RuntimeAttribute {
+public:
+ OPENVINO_RTTI("DisablePrecisionConversion", "0", RuntimeAttribute);
+
+ DisablePrecisionConversion() = default;
+
+ explicit DisablePrecisionConversion(const element::Type& from, const element::Type& to) {
+ m_disabled_precisions[from].insert(to);
+ }
+
+ bool is_copyable() const override {
+ return false;
+ }
+
+ bool visit_attributes(AttributeVisitor& visitor) override;
+
+ DisabledPrecisionMap m_disabled_precisions = {};
+};
+
+template <>
+class TRANSFORMATIONS_API AttributeAdapter<DisabledPrecisionMap> : public ValueAccessor<std::string> {
+public:
+ OPENVINO_RTTI("AttributeAdapter<DisabledPrecisionMap>");
+
+ explicit AttributeAdapter(DisabledPrecisionMap& value) : m_ref(value), m_serialized() {}
+
+ const std::string& get() override;
+ void set(const std::string& value) override;
+
+private:
+ DisabledPrecisionMap& m_ref;
+ std::string m_serialized;
+};
+
+} // namespace ov
\ No newline at end of file
diff --git a/src/common/transformations/src/transformations/convert_precision.cpp b/src/common/transformations/src/transformations/convert_precision.cpp
index caae21e7b52..9f3ff9bfb71 100644
--- a/src/common/transformations/src/transformations/convert_precision.cpp
+++ b/src/common/transformations/src/transformations/convert_precision.cpp
@@ -16,6 +16,7 @@
#include "openvino/pass/constant_folding.hpp"
#include "openvino/pass/manager.hpp"
#include "openvino/reference/convert.hpp"
+#include "openvino/util/common_util.hpp"
#include "ov_ops/rms.hpp"
#include "ov_ops/type_relaxed.hpp"
#include "transformations/fp16_compression/align_mixed_fp32_fp16_types.hpp"
@@ -176,6 +177,15 @@ bool node_is_replaced(const std::shared_ptr<Node>& node) {
return has_consumers && !(is_type<op::v0::Result>(node) || is_type<op::Sink>(node));
}
+static precisions_map filter_precisions_for_node(const std::shared_ptr<ov::Node>& node,
+ const precisions_map& precisions) {
+ precisions_map result = precisions;
+ ov::util::erase_if(result, [&](const precisions_map::value_type& entry) {
+ return is_conversion_disabled(node, entry.first, entry.second);
+ });
+ return result;
+}
+
bool convert_node_output_precision(
const std::shared_ptr<ov::Node>& node,
const precisions_map& precisions,
@@ -220,8 +230,7 @@ bool convert_function_precision(ov::pass::PassBase& pass,
const type_to_fuse_map& type_to_extend,
const precisions_map& precisions,
std::unordered_map<const ov::Node*, std::vector<Input<Node>>>& const_to_internal_output,
- bool has_fp16_compression,
- bool skip_precision_sensitive,
+ bool keep_sensitive_in_fp32,
bool is_changed,
bool is_subgraph,
bool convert_input_output_precision,
@@ -229,7 +238,7 @@ bool convert_function_precision(ov::pass::PassBase& pass,
bool names_compatibility_mode) {
bool is_output_precision_changed = false;
- if (skip_precision_sensitive && has_fp16_compression) {
+ if (keep_sensitive_in_fp32 && precisions.count(element::f32) && precisions.at(element::f32) == element::f16) {
pass::Manager manager(pass.get_pass_config(), "KeepPrecisionSensitiveInFP32");
// Mark subgraphs with disable_fp16_compression to keep them in FP32
manager.register_pass<pass::MarkSugraphsToKeepInMixedPrecision>();
@@ -251,15 +260,13 @@ bool convert_function_precision(ov::pass::PassBase& pass,
// otherwise we insert Convert operation.
auto ops = f->get_ordered_ops();
for (auto& node : ops) {
- if (skip_precision_sensitive && fp16_compression_is_disabled(node) && has_fp16_compression)
- continue;
- is_changed = convert_node_input_precision(node, precisions, type_to_extend) || is_changed;
+ auto node_precisions = filter_precisions_for_node(node, precisions);
+ is_changed = convert_node_input_precision(node, node_precisions, type_to_extend) || is_changed;
}
for (const auto& param : f->get_parameters()) {
- if (skip_precision_sensitive && fp16_compression_is_disabled(param) && has_fp16_compression)
- continue;
- is_changed = fuse_type_to_parameter(param, precisions, convert_input_output_precision) || is_changed;
+ auto node_precisions = filter_precisions_for_node(param, precisions);
+ is_changed = fuse_type_to_parameter(param, node_precisions, convert_input_output_precision) || is_changed;
}
if (convert_input_output_precision || store_original_precision_as_rt_attribute) {
@@ -289,11 +296,16 @@ bool convert_function_precision(ov::pass::PassBase& pass,
// to the freshly allocated replacement. Without the std::move the original
// constants stay alive until the loop ends, doubling the peak memory of
// the pass on constant-heavy models.
+
for (size_t i = 0; i < ops.size(); ++i) {
auto node = std::move(ops[i]);
- // skip precision sensitive nodes
- if (skip_precision_sensitive && fp16_compression_is_disabled(node) && has_fp16_compression)
+ auto node_precisions = filter_precisions_for_node(node, precisions);
+
+ // Skip nodes where all requested conversions are disabled (e.g. sensitive ops kept in FP32)
+ if (keep_sensitive_in_fp32 && node_precisions.empty()) {
continue;
+ }
+
// Recursively apply transformation for sub-graph based operations
if (auto sub_graph_node = ov::as_type_ptr<op::util::MultiSubGraphOp>(node)) {
size_t sub_graphs_num = sub_graph_node->get_internal_subgraphs_size();
@@ -304,11 +316,10 @@ bool convert_function_precision(ov::pass::PassBase& pass,
type_to_extend,
precisions,
const_to_internal_output,
- has_fp16_compression,
- skip_precision_sensitive,
+ keep_sensitive_in_fp32,
is_changed || is_output_precision_changed,
- true,
- true,
+ true, // is_changed
+ true, // is_subgraph
store_original_precision_as_rt_attribute,
names_compatibility_mode) ||
is_changed;
@@ -323,7 +334,7 @@ bool convert_function_precision(ov::pass::PassBase& pass,
continue;
}
is_output_precision_changed = convert_node_output_precision(node,
- precisions,
+ node_precisions,
type_to_fuse,
const_to_internal_output,
is_changed || is_output_precision_changed) ||
@@ -391,8 +402,7 @@ bool convert_precision(ov::pass::PassBase& pass,
const type_to_fuse_map& type_to_fuse,
const type_to_fuse_map& type_to_extend,
const precisions_map& precisions,
- bool has_fp16_compression,
- bool skip_precision_sensitive,
+ bool keep_sensitive_in_fp32,
bool convert_input_output_precision,
bool store_original_precision_as_rt_attribute) {
// As Constant operations can be shared between multiple ov::Models so before
@@ -407,8 +417,7 @@ bool convert_precision(ov::pass::PassBase& pass,
type_to_extend,
precisions,
const_to_internal_output,
- has_fp16_compression,
- skip_precision_sensitive,
+ keep_sensitive_in_fp32,
false,
false,
convert_input_output_precision,
@@ -452,8 +461,6 @@ bool ov::pass::ConvertPrecision::run_on_model(const std::shared_ptr<ov::Model>&
if (used_precisions.empty())
return false;
- bool has_fp16_compression = m_precisions.count(element::f32) > 0 && m_precisions[element::f32] == element::f16;
-
type_to_fuse_map type_to_fuse{
{v0::Convert::get_type_info_static(), fuse_type_to_convert},
{v3::ShapeOf::get_type_info_static(), fuse_type_to_shapeof},
@@ -525,7 +532,6 @@ bool ov::pass::ConvertPrecision::run_on_model(const std::shared_ptr<ov::Model>&
type_to_fuse,
type_to_extend,
used_precisions,
- has_fp16_compression,
m_keep_precision_sensitive_in_fp32,
m_convert_input_output_precision,
m_store_original_precision_as_rt_attribute);
@@ -610,7 +616,7 @@ bool fuse_type_to_range_v4(const std::shared_ptr<ov::Node>& node, const precisio
return false;
const auto& to = it->second;
if (auto range = ov::as_type_ptr<v4::Range>(node)) {
- if ((to == ov::element::f16 && !fp16_compression_is_disabled(node)) || to.is_integral_number()) {
+ if (to.is_real() || to.is_integral_number()) {
range->set_output_type(to);
return true;
}
diff --git a/src/common/transformations/src/transformations/fp16_compression/convert_legacy_precision_attribute.cpp b/src/common/transformations/src/transformations/fp16_compression/convert_legacy_precision_attribute.cpp
new file mode 100644
index 00000000000..8056ff09d28
--- /dev/null
+++ b/src/common/transformations/src/transformations/fp16_compression/convert_legacy_precision_attribute.cpp
@@ -0,0 +1,28 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "transformations/fp16_compression/convert_legacy_precision_attribute.hpp"
+
+#include "itt.hpp"
+#include "openvino/op/util/multi_subgraph_base.hpp"
+#include "transformations/rt_info/disable_fp16_compression.hpp"
+
+bool ov::pass::ConvertLegacyPrecisionAttribute::run_on_model(const std::shared_ptr<ov::Model>& model) {
+ RUN_ON_MODEL_SCOPE(ConvertLegacyPrecisionAttribute);
+ bool changed = false;
+ for (const auto& node : model->get_ordered_ops()) {
+ if (node->get_rt_info().count(DisableFP16Compression::get_type_info_static())) {
+ node->get_rt_info().erase(DisableFP16Compression::get_type_info_static()); // remove legacy attribute
+ disable_conversion(node, element::f16);
+ changed = true;
+ }
+
+ if (auto sub_graph_node = ov::as_type_ptr<op::util::MultiSubGraphOp>(node)) {
+ for (size_t i = 0; i < sub_graph_node->get_internal_subgraphs_size(); ++i) {
+ changed = run_on_model(sub_graph_node->get_function(static_cast<int>(i))) || changed;
+ }
+ }
+ }
+ return changed;
+}
diff --git a/src/common/transformations/src/transformations/rt_info/attributes.cpp b/src/common/transformations/src/transformations/rt_info/attributes.cpp
index 97420f849f9..20cf8f0e0d2 100644
--- a/src/common/transformations/src/transformations/rt_info/attributes.cpp
+++ b/src/common/transformations/src/transformations/rt_info/attributes.cpp
@@ -9,6 +9,7 @@ ov::pass::Attributes::Attributes() {
register_factory<PrimitivesPriority>();
register_factory<DisableConstantFolding>();
register_factory<DisableFP16Compression>();
+ register_factory<DisablePrecisionConversion>();
register_factory<NmsSelectedIndices>();
register_factory<OldApiMapOrder>();
register_factory<OldApiMapElementType>();
diff --git a/src/common/transformations/src/transformations/rt_info/disable_fp16_compression.cpp b/src/common/transformations/src/transformations/rt_info/disable_fp16_compression.cpp
index 28999cfb2f0..646ab0f55b8 100644
--- a/src/common/transformations/src/transformations/rt_info/disable_fp16_compression.cpp
+++ b/src/common/transformations/src/transformations/rt_info/disable_fp16_compression.cpp
@@ -4,6 +4,10 @@
#include "transformations/rt_info/disable_fp16_compression.hpp"
+#include <sstream>
+
+#include "openvino/util/common_util.hpp"
+
namespace {
const std::string& get_postponed_fp16_compression_tag() {
static const std::string postponed_fp16_compression_tag("postponed_fp16_compression");
@@ -12,18 +16,15 @@ const std::string& get_postponed_fp16_compression_tag() {
} // namespace
void ov::disable_fp16_compression(const std::shared_ptr<Node>& node) {
- auto& rt_info = node->get_rt_info();
- rt_info[DisableFP16Compression::get_type_info_static()] = DisableFP16Compression{};
+ disable_conversion(node, element::f16);
}
void ov::enable_fp16_compression(const std::shared_ptr<Node>& node) {
- auto& rt_info = node->get_rt_info();
- rt_info.erase(DisableFP16Compression::get_type_info_static());
+ enable_conversion(node, element::f16);
}
bool ov::fp16_compression_is_disabled(const std::shared_ptr<const Node>& node) {
- const auto& rt_info = node->get_rt_info();
- return rt_info.count(DisableFP16Compression::get_type_info_static());
+ return is_conversion_disabled(node, element::f16);
}
void ov::postpone_fp16_compression(ov::RTMap& rt_info) {
@@ -37,3 +38,124 @@ bool ov::is_fp16_compression_postponed(const ov::RTMap& rt_info) {
void ov::do_not_postpone_fp16_compression(ov::RTMap& rt_info) {
rt_info.erase(get_postponed_fp16_compression_tag());
}
+
+void ov::disable_conversion(const std::shared_ptr<Node>& node, const element::Type& to) {
+ return disable_conversion(node, element::dynamic, to);
+}
+
+void ov::disable_conversion(const std::shared_ptr<Node>& node, const element::Type& from, const element::Type& to) {
+ auto& rt_info = node->get_rt_info();
+ auto it = rt_info.find(DisablePrecisionConversion::get_type_info_static());
+ if (it != rt_info.end()) {
+ auto& dpc_attribute = it->second.as<DisablePrecisionConversion>();
+ dpc_attribute.m_disabled_precisions[from].insert(to);
+ } else {
+ rt_info[DisablePrecisionConversion::get_type_info_static()] = DisablePrecisionConversion(from, to);
+ }
+}
+
+void ov::disable_conversion(const std::shared_ptr<Node>& node,
+ const element::TypeVector& from_types,
+ const element::TypeVector& to_types) {
+ for (const auto& from : from_types) {
+ for (const auto& to : to_types) {
+ disable_conversion(node, from, to);
+ }
+ }
+}
+
+void ov::enable_conversion(const std::shared_ptr<Node>& node, const element::Type& to) {
+ enable_conversion(node, element::dynamic, to);
+}
+
+void ov::enable_conversion(const std::shared_ptr<Node>& node, const element::Type& from, const element::Type& to) {
+ auto& rt_info = node->get_rt_info();
+ auto it = rt_info.find(DisablePrecisionConversion::get_type_info_static());
+ if (it != rt_info.end()) {
+ auto& dpc_attribute = it->second.as<DisablePrecisionConversion>();
+ auto from_it = dpc_attribute.m_disabled_precisions.find(from);
+ if (from_it != dpc_attribute.m_disabled_precisions.end()) {
+ from_it->second.erase(to);
+ if (from_it->second.empty()) {
+ dpc_attribute.m_disabled_precisions.erase(from_it);
+ }
+ }
+ }
+}
+
+void ov::enable_conversion(const std::shared_ptr<Node>& node,
+ const element::TypeVector& from_types,
+ const element::TypeVector& to_types) {
+ for (const auto& from : from_types) {
+ for (const auto& to : to_types) {
+ enable_conversion(node, from, to);
+ }
+ }
+}
+
+bool ov::is_conversion_disabled(const std::shared_ptr<const Node>& node, const element::Type& to) {
+ return is_conversion_disabled(node, element::dynamic, to);
+}
+
+bool ov::is_conversion_disabled(const std::shared_ptr<const Node>& node,
+ const element::Type& from,
+ const element::Type& to) {
+ auto& rt_info = node->get_rt_info();
+ auto it = rt_info.find(DisablePrecisionConversion::get_type_info_static());
+ if (it != rt_info.end()) {
+ auto& dpc_attribute = it->second.as<DisablePrecisionConversion>();
+
+ auto dyn_it = dpc_attribute.m_disabled_precisions.find(element::dynamic);
+ if (dyn_it != dpc_attribute.m_disabled_precisions.end() &&
+ (dyn_it->second.count(element::dynamic) || dyn_it->second.count(to))) {
+ return true;
+ }
+
+ auto from_it = dpc_attribute.m_disabled_precisions.find(from);
+ if (from_it != dpc_attribute.m_disabled_precisions.end()) {
+ const auto& to_set = from_it->second;
+ if (to_set.count(to) || to_set.count(element::dynamic)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ return false;
+}
+
+bool ov::DisablePrecisionConversion::visit_attributes(AttributeVisitor& visitor) {
+ visitor.on_attribute("value", m_disabled_precisions);
+ return true;
+}
+
+// Format: "from:to1,to2;from2:to3,to4" - entries separated by ';' (no ';' at the end)
+const std::string& ov::AttributeAdapter<ov::DisabledPrecisionMap>::get() {
+ std::ostringstream oss;
+ auto it = m_ref.begin();
+ if (it != m_ref.end()) {
+ oss << it->first << ':' << ov::util::join<std::ostream>(it->second, ",");
+ while (++it != m_ref.end()) {
+ const auto& [from, to] = *it;
+ oss << ';' << from << ':' << ov::util::join<std::ostream>(to, ",");
+ }
+ }
+ m_serialized = oss.str();
+ return m_serialized;
+}
+
+void ov::AttributeAdapter<ov::DisabledPrecisionMap>::set(const std::string& value) {
+ m_ref.clear();
+ for (std::string_view sv(value); !sv.empty();) {
+ const auto sep_pos = sv.find(';');
+ const auto entry = sv.substr(0, sep_pos);
+ sv = sep_pos != std::string_view::npos ? sv.substr(sep_pos + 1) : std::string_view{};
+ if (const auto colon_pos = entry.find(':'); colon_pos != std::string_view::npos) {
+ element::Type from_type(std::string(entry.substr(0, colon_pos)));
+ auto& to_set = m_ref[from_type];
+ ov::util::view_transform(entry.substr(colon_pos + 1), std::inserter(to_set, to_set.end()), ",", [](auto s) {
+ return element::Type(std::string(s));
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/common/transformations/tests/common_optimizations/convert_legacy_precision_attribute_test.cpp b/src/common/transformations/tests/common_optimizations/convert_legacy_precision_attribute_test.cpp
new file mode 100644
index 00000000000..813670a49ca
--- /dev/null
+++ b/src/common/transformations/tests/common_optimizations/convert_legacy_precision_attribute_test.cpp
@@ -0,0 +1,100 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "transformations/fp16_compression/convert_legacy_precision_attribute.hpp"
+
+#include <gtest/gtest.h>
+
+#include "common_test_utils/ov_test_utils.hpp"
+#include "openvino/core/model.hpp"
+#include "openvino/op/add.hpp"
+#include "openvino/op/constant.hpp"
+#include "openvino/op/if.hpp"
+#include "openvino/op/matmul.hpp"
+#include "openvino/op/parameter.hpp"
+#include "openvino/op/result.hpp"
+#include "openvino/pass/manager.hpp"
+#include "transformations/rt_info/disable_fp16_compression.hpp"
+
+namespace ov::test {
+
+TEST(ConvertLegacyPrecisionAttributeTest, basic_migration) {
+ // Create model with legacy attribute on a node
+ auto data_1 = std::make_shared<op::v0::Parameter>(element::f32, Shape{1, 10});
+ auto data_2 = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 1});
+ auto matmul = std::make_shared<op::v0::MatMul>(data_1, data_2);
+ matmul->get_rt_info()[DisableFP16Compression::get_type_info_static()] = DisableFP16Compression{};
+ auto result = std::make_shared<op::v0::Result>(matmul);
+ auto model = std::make_shared<Model>(ResultVector{result}, ParameterVector{data_1, data_2});
+
+ // Verify legacy attribute is present before the pass
+ ASSERT_TRUE(matmul->get_rt_info().count(DisableFP16Compression::get_type_info_static()));
+
+ pass::Manager m;
+ m.register_pass<pass::ConvertLegacyPrecisionAttribute>();
+ bool res = m.run_passes(model);
+
+ ASSERT_TRUE(res);
+
+ const auto& rt_info = matmul->get_rt_info();
+
+ ASSERT_FALSE(rt_info.count(DisableFP16Compression::get_type_info_static()));
+ ASSERT_TRUE(rt_info.count(DisablePrecisionConversion::get_type_info_static()));
+
+ // Verify the map content: {dynamic -> {f16}}
+ const auto& attr = rt_info.at(DisablePrecisionConversion::get_type_info_static()).as<DisablePrecisionConversion>();
+ DisabledPrecisionMap expected = {{element::dynamic, {element::f16}}};
+ ASSERT_EQ(attr.m_disabled_precisions, expected);
+
+ ASSERT_TRUE(is_conversion_disabled(matmul, element::f16));
+}
+
+TEST(ConvertLegacyPrecisionAttributeTest, no_legacy_attribute) {
+ // Node without any attribute — pass should not modify it
+ auto data_1 = std::make_shared<op::v0::Parameter>(element::f32, Shape{1, 10});
+ auto data_2 = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 1});
+ auto matmul = std::make_shared<op::v0::MatMul>(data_1, data_2);
+ auto result = std::make_shared<op::v0::Result>(matmul);
+ auto model = std::make_shared<Model>(ResultVector{result}, ParameterVector{data_1, data_2});
+
+ pass::Manager m;
+ m.register_pass<pass::ConvertLegacyPrecisionAttribute>();
+ bool res = m.run_passes(model);
+
+ ASSERT_FALSE(res);
+
+ const auto& rt_info = matmul->get_rt_info();
+ ASSERT_FALSE(rt_info.count(DisableFP16Compression::get_type_info_static()));
+ ASSERT_FALSE(rt_info.count(DisablePrecisionConversion::get_type_info_static()));
+ ASSERT_FALSE(is_conversion_disabled(matmul, element::f16));
+}
+
+TEST(ConvertLegacyPrecisionAttributeTest, multiple_nodes) {
+ // Multiple nodes with legacy attribute
+ auto data_1 = std::make_shared<op::v0::Parameter>(element::f32, Shape{1, 10});
+ auto data_2 = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 1});
+ auto add = std::make_shared<op::v1::Add>(data_1, data_1);
+ auto matmul = std::make_shared<op::v0::MatMul>(add, data_2);
+ add->get_rt_info()[DisableFP16Compression::get_type_info_static()] = DisableFP16Compression{};
+ matmul->get_rt_info()[DisableFP16Compression::get_type_info_static()] = DisableFP16Compression{};
+ auto result = std::make_shared<op::v0::Result>(matmul);
+ auto model = std::make_shared<Model>(ResultVector{result}, ParameterVector{data_1, data_2});
+
+ pass::Manager m;
+ m.register_pass<pass::ConvertLegacyPrecisionAttribute>();
+ bool res = m.run_passes(model);
+
+ ASSERT_TRUE(res);
+
+ // Both nodes should be migrated
+ ASSERT_FALSE(add->get_rt_info().count(DisableFP16Compression::get_type_info_static()));
+ ASSERT_TRUE(add->get_rt_info().count(DisablePrecisionConversion::get_type_info_static()));
+ ASSERT_TRUE(is_conversion_disabled(add, element::f16));
+
+ ASSERT_FALSE(matmul->get_rt_info().count(DisableFP16Compression::get_type_info_static()));
+ ASSERT_TRUE(matmul->get_rt_info().count(DisablePrecisionConversion::get_type_info_static()));
+ ASSERT_TRUE(is_conversion_disabled(matmul, element::f16));
+}
+
+} // namespace ov::test
\ No newline at end of file
diff --git a/src/common/transformations/tests/common_optimizations/disable_precision_conversion_api_test.cpp b/src/common/transformations/tests/common_optimizations/disable_precision_conversion_api_test.cpp
new file mode 100644
index 00000000000..186184d3750
--- /dev/null
+++ b/src/common/transformations/tests/common_optimizations/disable_precision_conversion_api_test.cpp
@@ -0,0 +1,132 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include <gtest/gtest.h>
+
+#include "openvino/op/matmul.hpp"
+#include "openvino/op/parameter.hpp"
+#include "transformations/rt_info/disable_fp16_compression.hpp"
+
+namespace ov::test {
+
+TEST(DisablePrecisionConversionAPITest, no_attribute_returns_false) {
+ auto data_1 = std::make_shared<op::v0::Parameter>(element::f32, Shape{1, 10});
+ auto data_2 = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 1});
+ auto node = std::make_shared<op::v0::MatMul>(data_1, data_2);
+
+ // Node with no DisablePrecisionConversion at all
+ ASSERT_FALSE(is_conversion_disabled(node, element::f16));
+ ASSERT_FALSE(is_conversion_disabled(node, element::f32, element::f16));
+ ASSERT_FALSE(is_conversion_disabled(node, element::dynamic, element::f16));
+}
+
+TEST(DisablePrecisionConversionAPITest, specific_from_to_without_dynamic_entry) {
+ auto data_1 = std::make_shared<op::v0::Parameter>(element::f32, Shape{1, 10});
+ auto data_2 = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 1});
+ auto node = std::make_shared<op::v0::MatMul>(data_1, data_2);
+
+ // Only f32->f16, no dynamic entry
+ disable_conversion(node, element::f32, element::f16);
+
+ ASSERT_FALSE(is_conversion_disabled(node, element::f16));
+ ASSERT_TRUE(is_conversion_disabled(node, element::f32, element::f16));
+ ASSERT_FALSE(is_conversion_disabled(node, element::f32, element::bf16));
+ ASSERT_FALSE(is_conversion_disabled(node, element::f64, element::f16));
+}
+
+TEST(DisablePrecisionConversionAPITest, enable_erases_dynamic_entry) {
+ auto data_1 = std::make_shared<op::v0::Parameter>(element::f32, Shape{1, 10});
+ auto data_2 = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 1});
+ auto node = std::make_shared<op::v0::MatMul>(data_1, data_2);
+
+ // Add dynamic->f16, then remove it. dynamic entry should be erased
+ disable_conversion(node, element::f16);
+
+ ASSERT_TRUE(is_conversion_disabled(node, element::f16));
+ ASSERT_TRUE(node->get_rt_info().count(DisablePrecisionConversion::get_type_info_static()));
+
+ const auto& attr_before =
+ node->get_rt_info().at(DisablePrecisionConversion::get_type_info_static()).as<DisablePrecisionConversion>();
+ ASSERT_EQ(attr_before.m_disabled_precisions.count(element::dynamic), 1);
+
+ enable_conversion(node, element::f16);
+
+ const auto& attr_after =
+ node->get_rt_info().at(DisablePrecisionConversion::get_type_info_static()).as<DisablePrecisionConversion>();
+ ASSERT_EQ(attr_after.m_disabled_precisions.count(element::dynamic), 0);
+
+ ASSERT_FALSE(is_conversion_disabled(node, element::f16));
+}
+
+TEST(DisablePrecisionConversionAPITest, specific_from_dynamic_to_blocks_all_targets) {
+ auto data_1 = std::make_shared<op::v0::Parameter>(element::f32, Shape{1, 10});
+ auto data_2 = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 1});
+ auto node = std::make_shared<op::v0::MatMul>(data_1, data_2);
+
+ // f32->dynamic means block f32 to anything
+ disable_conversion(node, element::f32, element::dynamic);
+
+ ASSERT_TRUE(is_conversion_disabled(node, element::f32, element::f16));
+ ASSERT_TRUE(is_conversion_disabled(node, element::f32, element::bf16));
+ ASSERT_TRUE(is_conversion_disabled(node, element::f32, element::i8));
+
+ // Other source types are not blocked
+ ASSERT_FALSE(is_conversion_disabled(node, element::f64, element::f16));
+ ASSERT_FALSE(is_conversion_disabled(node, element::f16));
+}
+
+TEST(DisablePrecisionConversionAPITest, dynamic_to_dynamic_blocks_everything) {
+ auto data_1 = std::make_shared<op::v0::Parameter>(element::f32, Shape{1, 10});
+ auto data_2 = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 1});
+ auto node = std::make_shared<op::v0::MatMul>(data_1, data_2);
+
+ // dynamic->dynamic means block all conversions
+ disable_conversion(node, element::dynamic, element::dynamic);
+
+ ASSERT_TRUE(is_conversion_disabled(node, element::f16));
+ ASSERT_TRUE(is_conversion_disabled(node, element::bf16));
+ ASSERT_TRUE(is_conversion_disabled(node, element::f32, element::f16));
+ ASSERT_TRUE(is_conversion_disabled(node, element::f64, element::bf16));
+ ASSERT_TRUE(is_conversion_disabled(node, element::f32, element::i8));
+}
+
+TEST(DisablePrecisionConversionAPITest, adapter_roundtrip) {
+ DisabledPrecisionMap original = {{element::dynamic, {element::f16}}, {element::f32, {element::bf16, element::f16}}};
+
+ AttributeAdapter<DisabledPrecisionMap> serializing_adapter(original);
+ const std::string& serialized = serializing_adapter.get();
+
+ DisabledPrecisionMap restored;
+ AttributeAdapter<DisabledPrecisionMap> deserializing_adapter(restored);
+ deserializing_adapter.set(serialized);
+
+ // Verify the restored map matches the original
+ ASSERT_EQ(restored.size(), original.size());
+
+ auto it_dynamic = restored.find(element::dynamic);
+ ASSERT_NE(it_dynamic, restored.end());
+ ASSERT_EQ(it_dynamic->second.size(), 1);
+ ASSERT_TRUE(it_dynamic->second.count(element::f16));
+
+ auto it_f32 = restored.find(element::f32);
+ ASSERT_NE(it_f32, restored.end());
+ ASSERT_EQ(it_f32->second.size(), 2);
+ ASSERT_TRUE(it_f32->second.count(element::bf16));
+ ASSERT_TRUE(it_f32->second.count(element::f16));
+}
+
+TEST(DisablePrecisionConversionAPITest, adapter_empty_roundtrip) {
+ // Empty map roundtrip
+ DisabledPrecisionMap original;
+ AttributeAdapter<DisabledPrecisionMap> adapter(original);
+ const std::string& serialized = adapter.get();
+ ASSERT_TRUE(serialized.empty());
+
+ DisabledPrecisionMap restored;
+ AttributeAdapter<DisabledPrecisionMap> deserializing_adapter(restored);
+ deserializing_adapter.set(serialized);
+ ASSERT_TRUE(restored.empty());
+}
+
+} // namespace ov::test
\ No newline at end of file
diff --git a/src/core/src/pass/serialize.cpp b/src/core/src/pass/serialize.cpp
index e6d663ed6b6..e039427a6e7 100644
--- a/src/core/src/pass/serialize.cpp
+++ b/src/core/src/pass/serialize.cpp
@@ -26,6 +26,7 @@
#include "openvino/xml_util/constant_writer.hpp"
#include "openvino/xml_util/xml_serialize_util.hpp"
#include "pugixml.hpp"
+#include "transformations/fp16_compression/convert_legacy_precision_attribute.hpp"
#include "transformations/hash.hpp"
#include "transformations/rt_info/disable_fp16_compression.hpp"
#include "transformations/rt_info/primitives_priority_attribute.hpp"
@@ -43,15 +44,12 @@ std::filesystem::path provide_bin_path(const std::filesystem::path& xml_path) {
return bin_path;
}
-void convert_py_rt_info(ov::Model& model) {
- // TODO xxx-105807: if rt_info is set in python api as a string ['precise_0'] = '',
- // we need to convert value to a class in order to have rt_info in the IR. The code below will convert
- // ['precise_0'] = '' into => rt_info['precise_0'] = DisableFP16Compression{}
- for (auto& node : model.get_ops()) {
- if (fp16_compression_is_disabled(node)) {
- disable_fp16_compression(node);
- }
- }
+inline void convert_py_rt_info(std::shared_ptr<ov::Model> model) {
+ // TODO xxx-105807/187630: if rt_info is set in python api as a string ['precise_0'] = '',
+ // we need to convert value to a class in order to have rt_info in the IR. The code below will convert
+ // ['precise_0'] = '' into => rt_info['precise_0'] = DisablePrecisionConversion{}
+ // Once the issue is resolved, no conversion should take place and the code below should be removed
+ ov::pass::ConvertLegacyPrecisionAttribute().run_on_model(model);
}
void serialize_func(std::ostream& xml_file,
@@ -115,7 +113,7 @@ bool pass::Serialize::run_on_model(const std::shared_ptr<ov::Model>& model) {
OPENVINO_ASSERT(model, "ov::Model not provided");
model->validate_nodes_and_infer_types();
- convert_py_rt_info(*model);
+ convert_py_rt_info(model);
if (m_xml_file && m_bin_file) {
serialize_func(*m_xml_file, *m_bin_file, model, m_version);
diff --git a/src/core/tests/pass/serialization/rt_info_serialization.cpp b/src/core/tests/pass/serialization/rt_info_serialization.cpp
index 0353c5da31e..a016c79d94e 100644
--- a/src/core/tests/pass/serialization/rt_info_serialization.cpp
+++ b/src/core/tests/pass/serialization/rt_info_serialization.cpp
@@ -128,7 +128,9 @@ TEST_F(RTInfoSerializationTest, rt_info_precise_test) {
info[ov::DisableFP16Compression::get_type_info_static()] = ov::DisableFP16Compression{};
};
auto check_info = [](const ov::RTMap& info) {
- const std::string& key = ov::DisableFP16Compression::get_type_info_static();
+ const std::string& legacy_key = ov::DisableFP16Compression::get_type_info_static();
+ const std::string& key = ov::DisablePrecisionConversion::get_type_info_static();
+ ASSERT_FALSE(info.count(legacy_key));
ASSERT_TRUE(info.count(key));
};
@@ -151,6 +153,163 @@ TEST_F(RTInfoSerializationTest, rt_info_precise_test) {
check_info(matmul->get_rt_info());
}
+TEST_F(RTInfoSerializationTest, rt_info_disable_precision_conversion_roundtrip) {
+ // Set the new attribute directly (not via legacy), serialize, read back, verify contents
+ std::shared_ptr<ov::Model> model;
+ {
+ auto data_1 = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{1, 10});
+ auto data_2 = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{10, 1});
+ auto matmul = std::make_shared<ov::op::v0::MatMul>(data_1, data_2);
+ ov::disable_conversion(matmul, ov::element::f16);
+ ov::disable_conversion(matmul, ov::element::f32, ov::element::bf16);
+ ov::disable_conversion(matmul, ov::element::f32, ov::element::f16);
+ auto result = std::make_shared<ov::op::v0::Result>(matmul);
+ model = std::make_shared<ov::Model>(ov::ResultVector{result}, ov::ParameterVector{data_1, data_2});
+ }
+
+ ov::pass::Manager m;
+ m.register_pass<ov::pass::Serialize>(m_out_xml_path, m_out_bin_path);
+ m.run_passes(model);
+
+ auto f = getWithIRFrontend(m_out_xml_path, m_out_bin_path);
+ ASSERT_NE(nullptr, f);
+
+ auto matmul = f->get_results()[0]->get_input_node_ptr(0);
+ const auto& rt_info = matmul->get_rt_info();
+
+ ASSERT_FALSE(rt_info.count(ov::DisableFP16Compression::get_type_info_static()));
+
+ ASSERT_TRUE(rt_info.count(ov::DisablePrecisionConversion::get_type_info_static()));
+
+ const auto& attr =
+ rt_info.at(ov::DisablePrecisionConversion::get_type_info_static()).as<ov::DisablePrecisionConversion>();
+ const auto& precisions = attr.m_disabled_precisions;
+
+ // Check dynamic -> {f16}
+ auto it_dynamic = precisions.find(ov::element::dynamic);
+ ASSERT_NE(it_dynamic, precisions.end());
+ ASSERT_EQ(it_dynamic->second.size(), 1);
+ ASSERT_TRUE(it_dynamic->second.count(ov::element::f16));
+
+ // Check f32 -> {bf16, f16}
+ auto it_f32 = precisions.find(ov::element::f32);
+ ASSERT_NE(it_f32, precisions.end());
+ ASSERT_EQ(it_f32->second.size(), 2);
+ ASSERT_TRUE(it_f32->second.count(ov::element::bf16));
+ ASSERT_TRUE(it_f32->second.count(ov::element::f16));
+}
+
+// Pins the serialization format "from:to1,to2;from2:to3,to4". Do not change without updating model compatibility.
+TEST(RTInfoSerialization, disable_precision_conversion_xml_format) {
+ std::string ref_ir_xml = R"V0G0N(<?xml version="1.0"?>
+<net name="TestModel" version="11">
+ <layers>
+ <layer id="0" name="input_1" type="Parameter" version="opset1">
+ <data shape="1,10" element_type="f32" />
+ <output>
+ <port id="0" precision="FP32">
+ <dim>1</dim>
+ <dim>10</dim>
+ </port>
+ </output>
+ </layer>
+ <layer id="1" name="input_2" type="Parameter" version="opset1">
+ <data shape="10,1" element_type="f32" />
+ <output>
+ <port id="0" precision="FP32">
+ <dim>10</dim>
+ <dim>1</dim>
+ </port>
+ </output>
+ </layer>
+ <layer id="2" name="matmul" type="MatMul" version="opset1">
+ <data transpose_a="false" transpose_b="false" />
+ <rt_info>
+ <attribute name="DisablePrecisionConversion" version="0" value="dynamic:f16;f32:bf16,f16" />
+ </rt_info>
+ <input>
+ <port id="0" precision="FP32">
+ <dim>1</dim>
+ <dim>10</dim>
+ </port>
+ <port id="1" precision="FP32">
+ <dim>10</dim>
+ <dim>1</dim>
+ </port>
+ </input>
+ <output>
+ <port id="2" precision="FP32">
+ <dim>1</dim>
+ <dim>1</dim>
+ </port>
+ </output>
+ </layer>
+ <layer id="3" name="result" type="Result" version="opset1">
+ <input>
+ <port id="0" precision="FP32">
+ <dim>1</dim>
+ <dim>1</dim>
+ </port>
+ </input>
+ </layer>
+ </layers>
+ <edges>
+ <edge from-layer="0" from-port="0" to-layer="2" to-port="0" />
+ <edge from-layer="1" from-port="0" to-layer="2" to-port="1" />
+ <edge from-layer="2" from-port="2" to-layer="3" to-port="0" />
+ </edges>
+ <rt_info />
+</net>
+)V0G0N";
+
+ ov::Core core;
+ auto model = core.read_model(ref_ir_xml, ov::Tensor());
+ ASSERT_NE(nullptr, model);
+
+ auto matmul = model->get_results()[0]->get_input_node_ptr(0);
+ const auto& rt_info = matmul->get_rt_info();
+
+ ASSERT_TRUE(rt_info.count(ov::DisablePrecisionConversion::get_type_info_static()));
+
+ const auto& attr =
+ rt_info.at(ov::DisablePrecisionConversion::get_type_info_static()).as<ov::DisablePrecisionConversion>();
+ const auto& precisions = attr.m_disabled_precisions;
+
+ // Verify dynamic -> {f16}
+ auto it_dynamic = precisions.find(ov::element::dynamic);
+ ASSERT_NE(it_dynamic, precisions.end());
+ ASSERT_EQ(it_dynamic->second.size(), 1);
+ ASSERT_TRUE(it_dynamic->second.count(ov::element::f16));
+
+ // Verify f32 -> {bf16, f16}
+ auto it_f32 = precisions.find(ov::element::f32);
+ ASSERT_NE(it_f32, precisions.end());
+ ASSERT_EQ(it_f32->second.size(), 2);
+ ASSERT_TRUE(it_f32->second.count(ov::element::bf16));
+ ASSERT_TRUE(it_f32->second.count(ov::element::f16));
+
+ // Verify serialization produces the same XML
+ {
+ auto data_1 = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{1, 10});
+ auto data_2 = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{10, 1});
+ auto matmul = std::make_shared<ov::op::v0::MatMul>(data_1, data_2);
+ ov::disable_conversion(matmul, ov::element::f16);
+ ov::disable_conversion(matmul, ov::element::f32, ov::element::bf16);
+ ov::disable_conversion(matmul, ov::element::f32, ov::element::f16);
+ auto result = std::make_shared<ov::op::v0::Result>(matmul);
+ auto built_model = std::make_shared<ov::Model>(ov::ResultVector{result}, ov::ParameterVector{data_1, data_2});
+ built_model->set_friendly_name("TestModel");
+ data_1->set_friendly_name("input_1");
+ data_2->set_friendly_name("input_2");
+ matmul->set_friendly_name("matmul");
+ result->set_friendly_name("result");
+
+ std::stringstream model_ss, weights_ss;
+ ov::pass::Serialize(model_ss, weights_ss).run_on_model(built_model);
+ EXPECT_EQ(ref_ir_xml, model_ss.str());
+ }
+}
+
TEST_F(RTInfoSerializationTest, all_attributes_v10) {
auto init_info = [](ov::RTMap& info) {
info[ov::FusedNames::get_type_info_static()] = ov::FusedNames("add");
diff --git a/src/frontends/ir/src/frontend.cpp b/src/frontends/ir/src/frontend.cpp
index 5337bed0210..7d9c8c143bb 100644
--- a/src/frontends/ir/src/frontend.cpp
+++ b/src/frontends/ir/src/frontend.cpp
@@ -18,6 +18,7 @@
#include "openvino/util/file_util.hpp"
#include "openvino/util/mmap_object.hpp"
#include "openvino/util/xml_parse_utils.hpp"
+#include "transformations/fp16_compression/convert_legacy_precision_attribute.hpp"
#include "transformations/resolve_names_collisions.hpp"
#include "utils.hpp"
@@ -261,6 +262,7 @@ std::string FrontEnd::get_name() const {
void FrontEnd::normalize(const std::shared_ptr<ov::Model>& model) const {
ov::pass::Manager manager("Frontend:IR:normalize");
manager.register_pass<pass::ResolveNameCollisions>();
+ manager.register_pass<pass::ConvertLegacyPrecisionAttribute>();
manager.run_passes(model);
}