Skip to content

Commit

Permalink
Review comments applied
Browse files Browse the repository at this point in the history
  • Loading branch information
v-Golubev committed Nov 29, 2023
1 parent 878f05e commit 08be8e3
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#pragma once

#include "pass.hpp"
#include "snippets/lowered/linear_ir.hpp"

namespace ov {
namespace snippets {
namespace lowered {
namespace pass {

/**
* @interface SerializeBase
* @brief Base class for LinearIR serialization passes
* @ingroup snippets
*/
class SerializeBase : public Pass {
public:
OPENVINO_RTTI("SerializeBase", "Pass")
SerializeBase(const std::string& xml_path);

protected:
std::string get_bin_path_from_xml(const std::string& xml_path);

const std::string m_xml_path;
const std::string m_bin_path;
};

} // namespace pass
} // namespace lowered
} // namespace snippets
} // namespace ov
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "pass.hpp"
#include "serialize_base.hpp"
#include "snippets/lowered/linear_ir.hpp"

namespace ov {
Expand All @@ -17,15 +17,11 @@ namespace pass {
* @brief Serializes control flow graph of LinearIR
* @ingroup snippets
*/
class SerializeControlFlow : public Pass {
class SerializeControlFlow : public SerializeBase {
public:
OPENVINO_RTTI("SerializeControlFlow", "Pass")
SerializeControlFlow(const std::string& xml_path, const std::string& bin_path = "");
OPENVINO_RTTI("SerializeControlFlow", "Pass", SerializeBase)
SerializeControlFlow(const std::string& xml_path) : SerializeBase(xml_path) {}
bool run(LinearIR& linear_ir) override;

private:
const std::string m_xml_path;
const std::string m_bin_path;
};

} // namespace pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "pass.hpp"
#include "serialize_base.hpp"
#include "snippets/lowered/linear_ir.hpp"

namespace ov {
Expand All @@ -15,20 +15,15 @@ namespace pass {
/**
* @interface SerializeDataFlow
* @brief Serializes data flow graph of LinearIR
* @attention
* - This pass can not be run on the LinearIR after tail loop insertion.
* - Control flow operations (e.g. LoopBegin/LoopEnd) are not serialized
* @attention - This pass can not be run on the LinearIR after tail loop insertion.
* @attention - Control flow operations (e.g. LoopBegin/LoopEnd) are not serialized
* @ingroup snippets
*/
class SerializeDataFlow : public Pass {
class SerializeDataFlow : public SerializeBase {
public:
OPENVINO_RTTI("SerializeDataFlow", "Pass")
SerializeDataFlow(const std::string& xml_path, const std::string& bin_path = "");
OPENVINO_RTTI("SerializeDataFlow", "Pass", SerializeBase)
SerializeDataFlow(const std::string& xml_path) : SerializeBase(xml_path) {}
bool run(LinearIR& linear_ir) override;

private:
const std::string m_xml_path;
const std::string m_bin_path;
};

} // namespace pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ class SerializationNode : public ov::op::Op {
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector &new_args) const override;
bool visit_attributes(AttributeVisitor &visitor) override;

_OPENVINO_HIDDEN_METHOD static const DiscreteTypeInfo& get_type_info_static() {
static ::ov::DiscreteTypeInfo type_info_static{"SerializationNode", "SnippetsOpset"};
return type_info_static;
}

const ::ov::DiscreteTypeInfo& get_type_info() const override {
return m_expr->get_node()->get_type_info();
}
Expand Down
29 changes: 29 additions & 0 deletions src/common/snippets/src/lowered/pass/serialize_base.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "snippets/lowered/pass/serialize_base.hpp"

#include "snippets/itt.hpp"

namespace ov {
namespace snippets {
namespace lowered {
namespace pass {

SerializeBase::SerializeBase(const std::string& xml_path)
: m_xml_path(xml_path),
m_bin_path(get_bin_path_from_xml(xml_path)) {}

std::string SerializeBase::get_bin_path_from_xml(const std::string& xml_path) {
#if defined(__linux__)
return "/dev/null";
#else
return "";
#endif
}

} // namespace pass
} // namespace lowered
} // namespace snippets
} // namespace ov
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ namespace snippets {
namespace lowered {
namespace pass {

SerializeControlFlow::SerializeControlFlow(const std::string& xml_path, const std::string& bin_path)
: m_xml_path(xml_path),
m_bin_path(bin_path) {}

bool SerializeControlFlow::run(LinearIR& linear_ir) {
OV_ITT_SCOPED_TASK(ov::pass::itt::domains::SnippetsTransform, "Snippets::SerializeControlFlow")
if (linear_ir.empty())
Expand Down
4 changes: 0 additions & 4 deletions src/common/snippets/src/lowered/pass/serialize_data_flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ namespace snippets {
namespace lowered {
namespace pass {

SerializeDataFlow::SerializeDataFlow(const std::string& xml_path, const std::string& bin_path)
: m_xml_path(xml_path),
m_bin_path(bin_path) {}

bool SerializeDataFlow::run(LinearIR& linear_ir) {
OV_ITT_SCOPED_TASK(ov::pass::itt::domains::SnippetsTransform, "Snippets::SerializeDataFlow")
if (linear_ir.empty())
Expand Down

0 comments on commit 08be8e3

Please sign in to comment.