forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 1
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 of repacking tail of input_0 of BrgemmCPU
- Loading branch information
1 parent
2b6673e
commit 00f1e7b
Showing
24 changed files
with
569 additions
and
165 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,44 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "openvino/op/op.hpp" | ||
#include "snippets/op/memory_access.hpp" | ||
#include "snippets/shape_inference/shape_inference.hpp" | ||
|
||
namespace ov { | ||
namespace snippets { | ||
namespace op { | ||
|
||
/** | ||
* @interface SetScalar | ||
* @brief Sets passed 1-byte value to the memory pointer by provided `value_offset` | ||
* @ingroup snippets | ||
*/ | ||
class SetScalar : public modifier::MemoryAccess, public ov::op::Op { | ||
public: | ||
OPENVINO_OP("SetScalar", "SnippetsOpset"); | ||
SetScalar(uint8_t value = 0x0, size_t value_offset = 0lu, size_t ma_offset = 0lu, ov::element::Type element_type = ov::element::u8); | ||
|
||
uint8_t get_value() const { return m_value; } | ||
size_t get_value_offset() const { return m_value_offset; } | ||
|
||
void set_value(const uint8_t value) { m_value = value; } | ||
|
||
void validate_and_infer_types() override; | ||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override; | ||
bool visit_attributes(AttributeVisitor& visitor) override; | ||
|
||
protected: | ||
void validate_memory_access_params() const; | ||
|
||
uint8_t m_value = 0x0; | ||
size_t m_value_offset = 0; | ||
ov::element::Type m_element_type = ov::element::u8; | ||
}; | ||
|
||
} // namespace op | ||
} // 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "snippets/op/set_scalar.hpp" | ||
|
||
#include "snippets/utils/utils.hpp" | ||
#include "snippets/itt.hpp" | ||
|
||
|
||
namespace ov { | ||
namespace snippets { | ||
namespace op { | ||
|
||
SetScalar::SetScalar(uint8_t value, size_t value_offset, size_t ma_offset, ov::element::Type element_type) | ||
: MemoryAccess(std::set<size_t>{}, std::set<size_t>{0}), Op(), m_value(value), m_value_offset(value_offset), m_element_type(element_type) { | ||
set_output_port_descriptor({1, ma_offset}, 0); | ||
set_output_size(1); | ||
constructor_validate_and_infer_types(); | ||
} | ||
|
||
void SetScalar::validate_memory_access_params() const { | ||
// SetScalar has memory access port only on output | ||
const auto input_ma_ports = get_memory_access_input_ports(); | ||
const auto output_ma_ports = get_memory_access_output_ports(); | ||
OPENVINO_ASSERT(input_ma_ports.size() == 0, "SetScalar node shouldn't have memory access input port"); | ||
OPENVINO_ASSERT(output_ma_ports.size() == 1 && is_memory_access_output_port(0), "SetScalar node must have one memory access output port"); | ||
} | ||
|
||
void SetScalar::validate_and_infer_types() { | ||
INTERNAL_OP_SCOPE(SetScalar_validate_and_infer_types); | ||
OPENVINO_ASSERT(!utils::is_dynamic_value(m_value_offset), "Value offset must be static"); | ||
validate_memory_access_params(); | ||
set_output_type(0, m_element_type, ov::Shape{1}); | ||
} | ||
|
||
bool SetScalar::visit_attributes(AttributeVisitor& visitor) { | ||
INTERNAL_OP_SCOPE(SetScalar_visit_attributes); | ||
auto i32_value = static_cast<uint32_t>(m_value); | ||
visitor.on_attribute("value", i32_value); | ||
visitor.on_attribute("value_offset", m_value_offset); | ||
return MemoryAccess::visit_attributes(visitor); | ||
} | ||
|
||
std::shared_ptr<Node> SetScalar::clone_with_new_inputs(const OutputVector& new_args) const { | ||
INTERNAL_OP_SCOPE(SetScalar_clone_with_new_inputs); | ||
check_new_args_count(this, new_args); | ||
return std::make_shared<SetScalar>(m_value, m_value_offset, get_output_offset(0), m_element_type); | ||
} | ||
|
||
}// namespace op | ||
}// 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
Oops, something went wrong.