Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
evkotov committed Mar 6, 2023
1 parent c067aec commit 3e881d1
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/plugins/intel_gna/src/transformations/gather_sinking.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "transformations/gather_sinking.hpp"

#include <ngraph/pass/constant_folding.hpp>
#include <ngraph/pass/graph_rewrite.hpp>
#include <ngraph/pass/manager.hpp>
#include <ngraph/pattern/op/wrap_type.hpp>
#include <ngraph/rt_info.hpp>

#include "itt.hpp"
#include "transformations/gather_sinking_unary.hpp"

using namespace ov;
using namespace ov::pass::pattern;
using namespace ov::op::util;
using namespace ov::intel_gna::pass;

GatherSinkingGeneralForward::GatherSinkingGeneralForward() {
MATCHER_SCOPE(GatherSinkingGeneralForward);
add_matcher<GatherSinkingUnaryForward>();
}

GatherSinkingGeneralBackward::GatherSinkingGeneralBackward() {
MATCHER_SCOPE(GatherSinkingGeneralBackward);
add_matcher<GatherSinkingUnaryBackward>();
}

bool GatherSinkingGeneral::run_on_model(const std::shared_ptr<ov::Model>& f) {
RUN_ON_FUNCTION_SCOPE(GatherSinkingGeneral);
{
ngraph::pass::Manager manager(get_pass_config());
manager.register_pass<GatherSinkingGeneralForward>();
manager.register_pass<ngraph::pass::ConstantFolding>();
manager.run_passes(f);
}

{
ngraph::pass::Manager manager(get_pass_config());
manager.register_pass<GatherSinkingGeneralBackward>();
manager.register_pass<ngraph::pass::ConstantFolding>();
manager.run_passes(f);
}

return false;
}
35 changes: 35 additions & 0 deletions src/plugins/intel_gna/src/transformations/gather_sinking.hpp
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 "openvino/pass/graph_rewrite.hpp"
#include "transformations_visibility.hpp"

namespace ov {
namespace intel_gna {
namespace pass {

class GatherSinkingGeneralForward : public ov::pass::GraphRewrite {
public:
OPENVINO_RTTI("GatherSinkingGeneralForward", "0");
GatherSinkingGeneralForward();
};

class GatherSinkingGeneralBackward : public ov::pass::GraphRewrite {
public:
OPENVINO_RTTI("GatherSinkingGeneralBackward", "0");
GatherSinkingGeneralBackward();
};

class GatherSinkingGeneral : public ov::pass::ModelPass {
public:
OPENVINO_RTTI("GatherSinkingGeneral", "0");
bool run_on_model(const std::shared_ptr<ov::Model>& m) override;
};


} // namespace pass
} // namespace intel_gna
} // namespace ov

0 comments on commit 3e881d1

Please sign in to comment.