-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Snippets] Added support for Reshape around Softmax applied comment part Added config parameter to disable MHA ops tokenization
- Loading branch information
1 parent
540357f
commit 0fd0f94
Showing
64 changed files
with
2,832 additions
and
229 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
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) 2018-2022 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <ngraph/op/op.hpp> | ||
|
||
namespace ngraph { | ||
namespace snippets { | ||
namespace op { | ||
|
||
/** | ||
* @interface Buffer | ||
* @brief The operation is for intermediate data storage | ||
* Notes: | ||
* - All buffers in a graph have the same memory pointer. So if we have a few buffers, | ||
* each buffer should have its own offset for common memory | ||
* - If Buffer is an input for operation output, this Buffer should be a single consumer for this port | ||
* @ingroup snippets | ||
*/ | ||
class Buffer : public ngraph::op::Op { | ||
public: | ||
OPENVINO_OP("Buffer", "SnippetsOpset"); | ||
BWDCMP_RTTI_DECLARATION; | ||
|
||
Buffer(const Output<Node>& x); | ||
Buffer() = default; | ||
|
||
size_t get_offset() const { return m_offset; } | ||
void set_offset(const size_t offset); | ||
|
||
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; | ||
|
||
private: | ||
size_t m_offset = 0lu; | ||
}; | ||
|
||
} // namespace op | ||
} // namespace snippets | ||
} // namespace ngraph |
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,47 @@ | ||
// Copyright (C) 2018-2022 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <ngraph/op/op.hpp> | ||
|
||
namespace ngraph { | ||
namespace snippets { | ||
namespace op { | ||
|
||
/** | ||
* @interface Fill | ||
* @brief Generated in Tail Loop vector representation in code generation step for cases when we should | ||
* refill regsiters by special numbers. | ||
* For example, for cases with ReduceMax or ReduceSum in Softmax | ||
* Where: | ||
* - offset - is value shift for filling | ||
* - fill_value - hexadecimal filling value | ||
* @ingroup snippets | ||
*/ | ||
class Fill : public ngraph::op::Op { | ||
public: | ||
OPENVINO_OP("Fill", "SnippetsOpset"); | ||
|
||
Fill(const Output<Node>& x, const size_t offset, const uint32_t fill_value = 0x0); | ||
Fill() = default; | ||
|
||
size_t get_offset() const { return m_offset; } | ||
uint32_t get_fill_value() const { return m_fill_value; } | ||
|
||
void set_offset(const size_t offset) { m_offset = offset; } | ||
void set_fill_value(const uint32_t fill_value) { m_fill_value = fill_value; } | ||
|
||
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; | ||
|
||
protected: | ||
size_t m_offset = 0lu; | ||
uint32_t m_fill_value = 0x0; | ||
}; | ||
|
||
} // namespace op | ||
} // namespace snippets | ||
} // namespace ngraph |
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,32 @@ | ||
// Copyright (C) 2018-2022 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "ngraph/op/op.hpp" | ||
|
||
namespace ngraph { | ||
namespace snippets { | ||
namespace op { | ||
|
||
/** | ||
* @interface HorizonMax | ||
* @brief The operation calculates a horizon maximum of a vector register | ||
* @ingroup snippets | ||
*/ | ||
class HorizonMax : public ngraph::op::Op { | ||
public: | ||
OPENVINO_OP("HorizonMax", "SnippetsOpset"); | ||
|
||
HorizonMax(const Output<Node>& x); | ||
HorizonMax() = default; | ||
|
||
bool visit_attributes(AttributeVisitor& visitor) override { return true;} | ||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override; | ||
void validate_and_infer_types() override; | ||
}; | ||
|
||
} // namespace op | ||
} // namespace snippets | ||
} // namespace ngraph |
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,32 @@ | ||
// Copyright (C) 2018-2022 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "ngraph/op/op.hpp" | ||
|
||
namespace ngraph { | ||
namespace snippets { | ||
namespace op { | ||
|
||
/** | ||
* @interface HorizonSum | ||
* @brief The operation calculates a horizon sum of a vector register | ||
* @ingroup snippets | ||
*/ | ||
class HorizonSum : public ngraph::op::Op { | ||
public: | ||
OPENVINO_OP("HorizonSum", "SnippetsOpset"); | ||
|
||
HorizonSum(const Output<Node>& x); | ||
HorizonSum() = default; | ||
|
||
bool visit_attributes(AttributeVisitor& visitor) override { return true;} | ||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override; | ||
void validate_and_infer_types() override; | ||
}; | ||
|
||
} // namespace op | ||
} // namespace snippets | ||
} // namespace ngraph |
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,34 @@ | ||
// Copyright (C) 2018-2022 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <ngraph/op/op.hpp> | ||
|
||
namespace ngraph { | ||
namespace snippets { | ||
namespace op { | ||
|
||
/** | ||
* @interface VectorBuffer | ||
* @brief The operation is for intermediate data storage in vector register | ||
* @ingroup snippets | ||
*/ | ||
class VectorBuffer : public ngraph::op::Op { | ||
public: | ||
OPENVINO_OP("VectorBuffer", "SnippetsOpset"); | ||
|
||
VectorBuffer(const ov::element::Type element_type = ov::element::f32); | ||
|
||
bool visit_attributes(AttributeVisitor& visitor) override { return true;} | ||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override; | ||
void validate_and_infer_types() override; | ||
|
||
private: | ||
ov::element::Type m_element_type; | ||
}; | ||
|
||
} // namespace op | ||
} // namespace snippets | ||
} // namespace ngraph |
27 changes: 27 additions & 0 deletions
27
src/common/snippets/include/snippets/pass/insert_buffer.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) 2018-2022 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <ngraph/pass/graph_rewrite.hpp> | ||
#include <ngraph/pattern/matcher.hpp> | ||
|
||
namespace ngraph { | ||
namespace snippets { | ||
namespace pass { | ||
|
||
/** | ||
* @interface InsertBuffer | ||
* @brief The pass inserts Buffers on Inputs and Outputs of special operations [Softmax, Transpose] is it's needed | ||
* @ingroup snippets | ||
*/ | ||
class InsertBuffer: public ngraph::pass::MatcherPass { | ||
public: | ||
InsertBuffer(); | ||
}; | ||
|
||
|
||
} // namespace pass | ||
} // namespace snippets | ||
} // namespace ngraph |
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
Oops, something went wrong.