Skip to content

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

[Snippets] Replace manual RTTI implementations with `OPENVINO_RTTI_BASE` (#31570)

Arseniy Obolenskiyc578733786c2
diff --git a/src/common/snippets/include/snippets/lowered/expression.hpp b/src/common/snippets/include/snippets/lowered/expression.hpp
index eea91b4662d..f56949474d8 100644
--- a/src/common/snippets/include/snippets/lowered/expression.hpp
+++ b/src/common/snippets/include/snippets/lowered/expression.hpp
@@ -32,6 +32,8 @@ class Expression : public std::enable_shared_from_this<Expression> {
friend class ExpressionPort;
public:
+ OPENVINO_RTTI_BASE("Expression")
+
Expression() = default;
virtual ~Expression() = default;
@@ -116,18 +118,6 @@ public:
virtual bool visit_attributes(AttributeVisitor& visitor);
- // Note that get_type_info_static and get_type_info are needed to mimic OPENVINO_RTTI interface,
- // so the standard OPENVINO_RTTI(...) macros could be used in derived classes.
- _OPENVINO_HIDDEN_METHOD static const ::ov::DiscreteTypeInfo& get_type_info_static() {
- static ::ov::DiscreteTypeInfo type_info_static{"Expression"};
- type_info_static.hash();
- return type_info_static;
- }
-
- virtual const DiscreteTypeInfo& get_type_info() const {
- return get_type_info_static();
- }
-
const char* get_type_name() const {
return get_type_info().name;
}
diff --git a/src/common/snippets/include/snippets/lowered/loop_info.hpp b/src/common/snippets/include/snippets/lowered/loop_info.hpp
index 5945af08745..14bc1c6b868 100644
--- a/src/common/snippets/include/snippets/lowered/loop_info.hpp
+++ b/src/common/snippets/include/snippets/lowered/loop_info.hpp
@@ -39,6 +39,8 @@ using LoopInfoPtr = std::shared_ptr<LoopInfo>;
*/
class LoopInfo : public std::enable_shared_from_this<LoopInfo> {
public:
+ OPENVINO_RTTI_BASE("LoopInfoBase")
+
LoopInfo() = default;
LoopInfo(size_t work_amount,
size_t increment,
@@ -160,18 +162,6 @@ public:
*/
virtual void sort_ports() = 0;
- // Note that get_type_info_static and get_type_info are needed to mimic OPENVINO_RTTI interface,
- // so the standard OPENVINO_RTTI(...) macros could be used in derived classes.
- _OPENVINO_HIDDEN_METHOD static const ::ov::DiscreteTypeInfo& get_type_info_static() {
- static ::ov::DiscreteTypeInfo type_info_static{"LoopInfoBase"};
- type_info_static.hash();
- return type_info_static;
- }
-
- virtual const DiscreteTypeInfo& get_type_info() const {
- return get_type_info_static();
- }
-
const char* get_type_name() const {
return get_type_info().name;
}
diff --git a/src/common/snippets/include/snippets/lowered/pass/pass.hpp b/src/common/snippets/include/snippets/lowered/pass/pass.hpp
index b34e6e2c2d1..47cd346179c 100644
--- a/src/common/snippets/include/snippets/lowered/pass/pass.hpp
+++ b/src/common/snippets/include/snippets/lowered/pass/pass.hpp
@@ -24,19 +24,10 @@ namespace ov::snippets::lowered::pass {
*/
class PassBase : public std::enable_shared_from_this<PassBase> {
public:
+ OPENVINO_RTTI_BASE("snippets::lowered::pass::PassBase")
+
PassBase() = default;
virtual ~PassBase() = default;
- // Note that get_type_info_static and get_type_info are needed to mimic OPENVINO_RTTI interface,
- // so the standard OPENVINO_RTTI(...) macros could be used in derived classes.
- _OPENVINO_HIDDEN_METHOD static const ::ov::DiscreteTypeInfo& get_type_info_static() {
- static ::ov::DiscreteTypeInfo type_info_static{"snippets::lowered::pass::PassBase"};
- type_info_static.hash();
- return type_info_static;
- }
-
- virtual const DiscreteTypeInfo& get_type_info() const {
- return get_type_info_static();
- }
const char* get_type_name() const {
return get_type_info().name;
diff --git a/src/common/snippets/include/snippets/runtime_configurator.hpp b/src/common/snippets/include/snippets/runtime_configurator.hpp
index e5dc8e7b680..5164b56abe3 100644
--- a/src/common/snippets/include/snippets/runtime_configurator.hpp
+++ b/src/common/snippets/include/snippets/runtime_configurator.hpp
@@ -31,21 +31,11 @@ namespace ov::snippets {
*/
class RuntimeConfig {
public:
+ OPENVINO_RTTI_BASE("RuntimeConfig")
+
RuntimeConfig() = default;
virtual ~RuntimeConfig() = default;
- // Note that get_type_info_static and get_type_info are needed to mimic OPENVINO_RTTI interface,
- // so the standard OPENVINO_RTTI(...) macros could be used in derived classes.
- _OPENVINO_HIDDEN_METHOD static const ::ov::DiscreteTypeInfo& get_type_info_static() {
- static ::ov::DiscreteTypeInfo type_info_static{"RuntimeConfig"};
- type_info_static.hash();
- return type_info_static;
- }
-
- [[nodiscard]] virtual const DiscreteTypeInfo& get_type_info() const {
- return get_type_info_static();
- }
-
[[nodiscard]] const char* get_type_name() const {
return get_type_info().name;
}