Skip to content

Commit

Permalink
[Snippets] Added the method
Browse files Browse the repository at this point in the history
  • Loading branch information
a-sidorova committed Sep 10, 2024
1 parent 47c3022 commit 6e8b8bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class BufferExpression : public Expression {
// Returns True, if allocation size is known. Otherwise returns False - allocation size is undefined
bool is_defined() const;

// Returns True, if the memory is independent - expression doesn't have parents (source)
bool is_independent_memory() const { return get_input_count() == 0; }

protected:
BufferExpression(const BufferExpression& other);
BufferExpression(const std::shared_ptr<Node>& n, const std::shared_ptr<IShapeInferSnippetsFactory>& factory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ LinearIR::constExprIt BrgemmCPUBlocking::move_new_memory_buffer(LinearIR& linear
const auto& brgemm_expr = brgemm_it->get();
const auto wsp_expr = brgemm_expr->get_input_port_connector(2)->get_source().get_expr();
const auto wsp_buffer = ov::as_type_ptr<ov::snippets::lowered::BufferExpression>(wsp_expr);
OPENVINO_ASSERT(wsp_buffer && wsp_buffer->get_input_count() == 0, "Incorrect Scratchpad buffer for Brgemm AMX");
OPENVINO_ASSERT(wsp_buffer && wsp_buffer->is_independent_memory(), "Incorrect Scratchpad buffer for Brgemm AMX");
// If scratchpad with temp memory is not explicitly before Brgemm, need to move to there.
if (wsp_expr != *std::prev(brgemm_it)) {
const auto wsp_it = linear_ir.find(wsp_expr);
Expand Down

0 comments on commit 6e8b8bb

Please sign in to comment.