forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
src/plugins/intel_gna/src/transformations/gather_sinking.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
35
src/plugins/intel_gna/src/transformations/gather_sinking.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |