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.
groupNorm tokenzation decompostion and sheduling
- Loading branch information
1 parent
c208a88
commit 1dbc0fd
Showing
27 changed files
with
505 additions
and
31 deletions.
There are no files selected for viewing
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,38 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "openvino/op/op.hpp" | ||
#include "snippets/shape_inference/shape_inference.hpp" | ||
|
||
namespace ov { | ||
namespace snippets { | ||
namespace op { | ||
|
||
/** | ||
* @interface Reshape | ||
* @brief Reshape input tensor to reqiured target shape | ||
* @ingroup snippets | ||
*/ | ||
class Reshape : public ov::op::Op { | ||
public: | ||
OPENVINO_OP("Reshape", "SnippetsOpset"); | ||
Reshape(const Output<Node>& x, ov::PartialShape target_shape); | ||
Reshape() = default; | ||
|
||
bool visit_attributes(AttributeVisitor& visitor) override; | ||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override; | ||
void validate_and_infer_types() override; | ||
|
||
const ov::PartialShape& get_target_shape() const; | ||
void set_target_shape(ov::PartialShape shape); | ||
|
||
private: | ||
ov::PartialShape m_target_shape = {}; | ||
}; | ||
|
||
} // namespace op | ||
} // namespace snippets | ||
} // namespace ov |
27 changes: 27 additions & 0 deletions
27
src/common/snippets/include/snippets/pass/gn_decomposition.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,27 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "openvino/pass/graph_rewrite.hpp" | ||
#include "openvino/pass/pattern/matcher.hpp" | ||
|
||
namespace ov { | ||
namespace snippets { | ||
namespace pass { | ||
|
||
/** | ||
* @interface GNDecomposition | ||
* @brief Decomposes GroupNormalization to a range of low-level operations | ||
* @ingroup snippets | ||
*/ | ||
class GNDecomposition: public ov::pass::MatcherPass { | ||
public: | ||
OPENVINO_RTTI("GNDecomposition", "0"); | ||
GNDecomposition(); | ||
}; | ||
|
||
} // namespace pass | ||
} // namespace snippets | ||
} // namespace ov |
28 changes: 28 additions & 0 deletions
28
src/common/snippets/include/snippets/pass/gn_tokenization.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,28 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "openvino/pass/graph_rewrite.hpp" | ||
#include "openvino/pass/pattern/matcher.hpp" | ||
#include "snippets/pass/tokenization.hpp" | ||
|
||
namespace ov { | ||
namespace snippets { | ||
namespace pass { | ||
|
||
/** | ||
* @interface TokenizeGNSnippets | ||
* @brief Tokenize GroupNormalization to a subgraph | ||
* @ingroup snippets | ||
*/ | ||
class TokenizeGNSnippets: public ov::pass::MatcherPass { | ||
public: | ||
OPENVINO_RTTI("TokenizeGNSnippets", "0"); | ||
TokenizeGNSnippets(); | ||
}; | ||
|
||
} // namespace pass | ||
} // namespace snippets | ||
} // namespace ov |
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
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
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
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
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
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
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
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
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
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
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,43 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "snippets/itt.hpp" | ||
|
||
#include "snippets/op/reshape.hpp" | ||
#include "snippets/utils.hpp" | ||
|
||
|
||
namespace ov { | ||
namespace snippets { | ||
namespace op { | ||
Reshape::Reshape(const Output<Node>& arg, ov::PartialShape target_shape) | ||
: Op({arg}), m_target_shape(target_shape) { | ||
constructor_validate_and_infer_types(); | ||
} | ||
|
||
void Reshape::validate_and_infer_types() { | ||
set_output_type(0, get_input_element_type(0), m_target_shape); | ||
} | ||
|
||
std::shared_ptr<Node> Reshape::clone_with_new_inputs(const OutputVector& new_args) const { | ||
INTERNAL_OP_SCOPE(Reshape); | ||
check_new_args_count(this, new_args); | ||
return std::make_shared<Reshape>(new_args.at(0), get_target_shape()); | ||
} | ||
|
||
bool Reshape::visit_attributes(AttributeVisitor& visitor) { | ||
visitor.on_attribute("target_shape", m_target_shape); | ||
return true; | ||
} | ||
|
||
const ov::PartialShape& Reshape::get_target_shape() const { | ||
return m_target_shape; | ||
} | ||
|
||
void Reshape::set_target_shape(ov::PartialShape shape) { | ||
m_target_shape = shape; | ||
} | ||
}// namespace op | ||
}// namespace snippets | ||
}// namespace ov |
Oops, something went wrong.