Skip to content

Commit

Permalink
Fixed C++ RTTI for Core base classes (#28640)
Browse files Browse the repository at this point in the history
### Ported:
- #28555
- #28624
- #28636
  • Loading branch information
ilya-lavrenov authored Jan 24, 2025
1 parent 074a5a1 commit 815af98
Show file tree
Hide file tree
Showing 80 changed files with 240 additions and 132 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ on:
schedule:
# at 00:00 on workdays
- cron: '0 0 * * 1,2,3,4,5'
#pull_request:
# pull_request:
# paths-ignore:
# - '**/docs/**'
# - 'docs/**'
# - '**/**.md'
# - '**.md'
# - '**/layer_tests_summary/**'
# - '**/conformance/**'
#push:
# push:
# paths-ignore:
# - '**/docs/**'
# - 'docs/**'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mac_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ on:
schedule:
# at 00:00 on workdays
- cron: '0 0 * * 1,2,3,4,5'
#pull_request:
# pull_request:
# paths-ignore:
# - '**/docs/**'
# - 'docs/**'
# - '**/**.md'
# - '**.md'
# - '**/layer_tests_summary/**'
# - '**/conformance/**'
#push:
# push:
# paths-ignore:
# - '**/docs/**'
# - 'docs/**'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "graph_iterator.hpp"

#include "openvino/frontend/graph_iterator.hpp"
#include "openvino/frontend/tensorflow/graph_iterator.hpp"

namespace py = pybind11;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <pybind11/pybind11.h>

#include "openvino/frontend/decoder.hpp"
#include "openvino/frontend/graph_iterator.hpp"
#include "openvino/frontend/tensorflow/graph_iterator.hpp"

namespace py = pybind11;

Expand Down
6 changes: 3 additions & 3 deletions src/bindings/python/src/pyopenvino/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,9 @@ ov::Any py_object_to_any(const py::object& py_obj) {
// FrontEnd Decoder
} else if (py::isinstance<ov::frontend::IDecoder>(py_obj)) {
return py::cast<std::shared_ptr<ov::frontend::IDecoder>>(py_obj);
// TF FrontEnd GraphIterator
} else if (py::isinstance<ov::frontend::tensorflow::GraphIterator>(py_obj)) {
return py::cast<std::shared_ptr<ov::frontend::tensorflow::GraphIterator>>(py_obj);
// FrontEnd GraphIterator
} else if (py::isinstance<ov::frontend::GraphIterator>(py_obj)) {
return py::cast<std::shared_ptr<ov::frontend::GraphIterator>>(py_obj);
// Custom FrontEnd Types
} else if (py::isinstance<ov::frontend::type::Tensor>(py_obj)) {
return py::cast<ov::frontend::type::Tensor>(py_obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace low_precision {
class LP_TRANSFORMATIONS_API CleanupTransformation : public LayerTransformation {
public:
CleanupTransformation(const Params& params);
virtual ~CleanupTransformation() = default;

bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const override;
static bool canBeTransformedStatic(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace low_precision {
class LP_TRANSFORMATIONS_API FuseElementwiseToFakeQuantizeTransformation : public CleanupTransformation {
public:
FuseElementwiseToFakeQuantizeTransformation(const Params& params);
virtual ~FuseElementwiseToFakeQuantizeTransformation() = default;

bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const override;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ class LP_TRANSFORMATIONS_API LayerTransformation : public ov::pass::MatcherPass
};

LayerTransformation(const Params& params);
virtual ~LayerTransformation() = default;
virtual bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) = 0;

void setContext(TransformationContext* context) noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
template <class T>
class LP_TRANSFORMATIONS_API SharedAttribute : public ov::RuntimeAttribute {
public:
virtual ~SharedAttribute() = default;

/**
* @ingroup ov_transformation_common_api
* @brief SharedValueAttribute type for shared value attributes.
Expand Down
4 changes: 1 addition & 3 deletions src/core/include/openvino/core/any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ class OPENVINO_API Any {
template <class U, class T, class... Others>
U convert_impl() const;

virtual ~Base() = default;
virtual ~Base();
};

template <class T, typename = void>
Expand Down Expand Up @@ -611,8 +611,6 @@ class OPENVINO_API Any {
template <typename... Args>
Impl(Args&&... args) : value(std::forward<Args>(args)...) {}

virtual ~Impl(){};

const std::type_info& type_info() const override {
return typeid(T);
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/include/openvino/core/attribute_adapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class OPENVINO_API ValueAccessor<void> {
/// \brief type info enables identification of the value accessor, as well as is_type and
/// as_type.
virtual const DiscreteTypeInfo& get_type_info() const = 0;
virtual ~ValueAccessor() = default;
virtual ~ValueAccessor();
virtual void set_as_any(const ov::Any& x) {
OPENVINO_NOT_IMPLEMENTED;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/include/openvino/core/attribute_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class VisitorAdapter;
/// deserialization.
class OPENVINO_API AttributeVisitor {
public:
virtual ~AttributeVisitor() = default;
virtual ~AttributeVisitor();
// Must implement these methods
/// \brief handles all specialized on_adapter methods implemented by the visitor.
///
Expand Down
2 changes: 1 addition & 1 deletion src/core/include/openvino/core/model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class OPENVINO_API Model : public std::enable_shared_from_this<Model> {
/// based on traversing the graph from the results and the sinks.
Model(const ov::OutputVector& results, const ov::SinkVector& sinks, const std::string& name = "");

virtual ~Model() = default;
virtual ~Model();
/// Return the number of outputs for this Model.
size_t get_output_size() const;

Expand Down
2 changes: 1 addition & 1 deletion src/core/include/openvino/core/runtime_attribute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OPENVINO_API RuntimeAttribute {
}
using Ptr = std::shared_ptr<RuntimeAttribute>;
using Base = std::tuple<::ov::RuntimeAttribute>;
virtual ~RuntimeAttribute() = default;
virtual ~RuntimeAttribute();
virtual bool is_copyable() const;
virtual bool is_copyable(const std::shared_ptr<Node>& to) const;
virtual Any init(const std::shared_ptr<Node>& node) const;
Expand Down
8 changes: 4 additions & 4 deletions src/core/include/openvino/op/util/multi_subgraph_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class OPENVINO_API MultiSubGraphOp : public ov::op::Sink {
OPENVINO_OP("MultiSubGraphOp", "util", ov::op::Sink);
/// \brief Abstract class describes a connection between a MultiSubGraphOp input and
/// the body.
class InputDescription {
class OPENVINO_API InputDescription {
protected:
///
/// \brief Constructs a new instance.
Expand All @@ -34,7 +34,7 @@ class OPENVINO_API MultiSubGraphOp : public ov::op::Sink {
public:
using Ptr = std::shared_ptr<InputDescription>;
using type_info_t = DiscreteTypeInfo;
virtual ~InputDescription() = default;
virtual ~InputDescription();
virtual std::shared_ptr<InputDescription> copy() const = 0;

virtual const type_info_t& get_type_info() const = 0;
Expand All @@ -45,7 +45,7 @@ class OPENVINO_API MultiSubGraphOp : public ov::op::Sink {

/// \brief Abstract class describes how a MultiSubGraphOp output is produced from
/// the body.
class OutputDescription {
class OPENVINO_API OutputDescription {
protected:
///
/// \brief Constructs a new instance.
Expand All @@ -59,7 +59,7 @@ class OPENVINO_API MultiSubGraphOp : public ov::op::Sink {
public:
using Ptr = std::shared_ptr<OutputDescription>;
using type_info_t = DiscreteTypeInfo;
virtual ~OutputDescription() = default;
virtual ~OutputDescription();
virtual std::shared_ptr<OutputDescription> copy() const = 0;
virtual const type_info_t& get_type_info() const = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/core/include/openvino/op/util/variable_extension.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class OPENVINO_API VariableExtension {
virtual std::string get_variable_id() const = 0;

protected:
virtual ~VariableExtension(){};
virtual ~VariableExtension();

protected:
std::shared_ptr<Variable> m_variable;
Expand Down
2 changes: 1 addition & 1 deletion src/core/include/openvino/pass/pass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class OPENVINO_API PassBase {

public:
PassBase();
virtual ~PassBase() = default;
virtual ~PassBase();
/// Check if this pass has all the pass properties.
bool get_property(const PassPropertyMask& prop_mask) const;

Expand Down
5 changes: 3 additions & 2 deletions src/core/include/openvino/pass/pattern/matcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class OPENVINO_API Matcher {
Matcher(std::shared_ptr<Node> pattern_node, const std::string& name);
Matcher(std::shared_ptr<Node> pattern_node, const std::string& name, bool strict_mode);

virtual ~Matcher() = default;
virtual ~Matcher();

/// \brief Matches a pattern to \p graph_node
///
/// \param graph_value is an input graph to be matched against
Expand Down Expand Up @@ -176,7 +177,7 @@ class OPENVINO_API Matcher {

size_t add_node(Output<Node> node);

bool virtual match_value(const ov::Output<Node>& pattern_value, const ov::Output<Node>& graph_value);
virtual bool match_value(const ov::Output<Node>& pattern_value, const ov::Output<Node>& graph_value);

bool is_strict_mode() {
return m_strict_mode;
Expand Down
4 changes: 2 additions & 2 deletions src/core/include/openvino/runtime/allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class OPENVINO_API Allocator {

friend class ov::Tensor;

struct Base : public std::enable_shared_from_this<Base> {
struct OPENVINO_API Base : public std::enable_shared_from_this<Base> {
virtual void* addressof() = 0;
const void* addressof() const {
return const_cast<Base*>(this)->addressof();
Expand All @@ -48,7 +48,7 @@ class OPENVINO_API Allocator {
virtual bool is_equal(const Base& other) const = 0;

protected:
virtual ~Base() = default;
virtual ~Base();
};

template <typename A>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PhiloxConverter {
public:
PhiloxConverter() = delete;

virtual ~PhiloxConverter(){};
virtual ~PhiloxConverter() = default;

/// \brief Returns the number of generated elements per execution
/// based on the requested data type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PhiloxGenerator {
public:
PhiloxGenerator() = delete;

virtual ~PhiloxGenerator(){};
virtual ~PhiloxGenerator() = default;

/// @brief Get a set of 4 random 32-bit unsigned integers based on the seed(s).
/// @return A vector with a random set of 4 32-bit unsigned integers.
Expand Down
2 changes: 2 additions & 0 deletions src/core/src/any.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ bool util::equal(std::type_index lhs, std::type_index rhs) {
return result;
}

Any::Base::~Base() = default;

bool Any::Base::is(const std::type_info& other) const {
return util::equal(type_info(), other);
}
Expand Down
4 changes: 4 additions & 0 deletions src/core/src/attribute_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

using namespace std;

ov::ValueAccessor<void>::~ValueAccessor() = default;

ov::AttributeVisitor::~AttributeVisitor() = default;

void ov::AttributeVisitor::start_structure(const string& name) {
m_context.push_back(name);
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/src/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ ov::Model::Model(const ov::OutputVector& results, const ov::SinkVector& sinks, c

ov::Model::Model(const OutputVector& results, const string& name) : Model(results, ov::SinkVector{}, name) {}

ov::Model::~Model() = default;

void ov::Model::prerequirements(bool detect_variables, bool detect_parameters) {
OV_ITT_SCOPED_TASK(ov::itt::domains::core, "Model::prerequirements");

Expand Down
4 changes: 4 additions & 0 deletions src/core/src/op/util/multi_subgraph_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ ov::op::util::MultiSubGraphOp::InputDescription::InputDescription(uint64_t input
: m_input_index(input_index),
m_body_parameter_index(body_parameter_index) {}

ov::op::util::MultiSubGraphOp::InputDescription::~InputDescription() = default;

ov::op::util::MultiSubGraphOp::OutputDescription::OutputDescription(uint64_t body_value_index, uint64_t output_index)
: m_body_value_index(body_value_index),
m_output_index(output_index) {}

ov::op::util::MultiSubGraphOp::OutputDescription::~OutputDescription() = default;

ov::op::util::MultiSubGraphOp::SliceInputDescription::SliceInputDescription(uint64_t input_index,
uint64_t body_parameter_index,
int64_t start,
Expand Down
9 changes: 9 additions & 0 deletions src/core/src/op/util/variable_extension.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (C) 2018-2025 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "openvino/op/util/variable_extension.hpp"

using namespace ov::op::util;

VariableExtension::~VariableExtension() = default;
2 changes: 2 additions & 0 deletions src/core/src/pass/pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ using namespace std;

ov::pass::PassBase::PassBase() : m_property(), m_name(), m_pass_config(std::make_shared<PassConfig>()) {}

ov::pass::PassBase::~PassBase() = default;

bool ov::pass::PassBase::get_property(const PassPropertyMask& prop) const {
return m_property.is_set(prop);
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/src/pattern/matcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Matcher::Matcher(std::shared_ptr<Node> pattern_node, const std::string& name)
Matcher::Matcher(std::shared_ptr<Node> pattern_node, const std::string& name, bool strict_mode)
: Matcher(make_node_output(pattern_node), name, strict_mode) {}

Matcher::~Matcher() = default;

MatcherState::~MatcherState() {
if (m_restore) {
if (!m_matcher->m_matched_list.empty()) {
Expand Down
2 changes: 2 additions & 0 deletions src/core/src/runtime/allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ struct DefaultAllocator {
}
};

Allocator::Base::~Base() = default;

Allocator::Allocator() : Allocator{DefaultAllocator{}} {}

Allocator::~Allocator() {
Expand Down
2 changes: 2 additions & 0 deletions src/core/src/runtime_attribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace ov {

RuntimeAttribute::~RuntimeAttribute() = default;

std::string RuntimeAttribute::to_string() const {
return {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#pragma once

#include "openvino/core/type/element_type.hpp"
#include "openvino/frontend/visibility.hpp"
#include "openvino/op/util/framework_node.hpp"

namespace ov {
Expand All @@ -17,7 +18,7 @@ namespace frontend {
// into a floating-point tensor [N1, N2, ..., Nk, 2]
// where a slice with index [..., 0] represents a real part and
// a slice with index [..., 1] represents a imaginary part.
class ComplexTypeMark : public ov::op::util::FrameworkNode {
class FRONTEND_API ComplexTypeMark : public ov::op::util::FrameworkNode {
public:
OPENVINO_OP("ComplexTypeMark", "util", ov::op::util::FrameworkNode);

Expand All @@ -27,6 +28,8 @@ class ComplexTypeMark : public ov::op::util::FrameworkNode {
validate_and_infer_types();
}

~ComplexTypeMark() override;

void validate_and_infer_types() override {
set_output_type(0, ov::element::dynamic, PartialShape::dynamic());
}
Expand Down
4 changes: 2 additions & 2 deletions src/frontends/common/include/openvino/frontend/decoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ struct Union;
} // namespace type

/// Plays a role of node, block and module decoder
class IDecoder {
class FRONTEND_API IDecoder {
public:
virtual ~IDecoder() = default;
virtual ~IDecoder();
};

class FRONTEND_API DecoderBase : public IDecoder {
Expand Down
Loading

0 comments on commit 815af98

Please sign in to comment.