Skip to content

Commit

Permalink
[Snippets] Applied Vladislav comments
Browse files Browse the repository at this point in the history
  • Loading branch information
a-sidorova committed Sep 9, 2024
1 parent 4f0d37d commit e34be5a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class LoopManager;
/**
* @interface BufferExpression
* @brief This is a base class for memory storage.
* Notes that Buffer should be a single consumer for operation output port
* Note that Buffer should be a single consumer for operation output port
* @param m_allocation_size - memory size for allocation in bytes. Dynamic value means undefined size.
* @param m_offset - offset in common Buffer scratchpad
* @param m_reg_group - number of register group. The Buffers from the same register group will have the same GPR
Expand Down
2 changes: 1 addition & 1 deletion src/common/snippets/src/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ LoweringResult Generator::generate(const lowered::LinearIRPtr& linear_ir, const

const auto kernel_op = op::Kernel::make_kernel(*linear_ir);
kernel_op->compile_params = compile_params;
const auto kernel_expr = linear_ir->get_expr_factory()->build<>(kernel_op, std::vector<lowered::PortConnectorPtr>{});
const auto kernel_expr = linear_ir->get_expr_factory()->build(kernel_op, std::vector<lowered::PortConnectorPtr>{});
const auto kernel = target->get(kernel_expr->get_node()->get_type_info())(kernel_expr);

kernel->emit_code({}, {});
Expand Down
8 changes: 5 additions & 3 deletions src/common/snippets/src/lowered/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ Expression::Expression(const Expression& other) :
std::enable_shared_from_this<Expression>(other), m_source_node(other.m_source_node), m_emitter(other.m_emitter),
m_loop_ids(other.m_loop_ids), m_shapeInference(other.m_shapeInference), m_need_shape_infer(other.m_need_shape_infer),
m_exec_num(other.m_exec_num) {
m_input_port_descriptors = {};
m_output_port_descriptors = {};
// Note that connectors are not filled on purpose, since you need a shared pointer to this to initialize them,
// which is not available in constructor. Also, an expression copy is rarely expected to use the same connectors.
m_input_port_connectors = {};
m_output_port_connectors = {};
// The copy ctor is used only in `clone_with_new_inputs`. This method is responsible for initialization of
// input port connectors and input port descriptors - they must be consistent.
m_input_port_descriptors = {};
m_output_port_descriptors = {};
validate_attributes();
}

Expand Down Expand Up @@ -132,7 +134,7 @@ void Expression::set_loop_ids(const std::vector<size_t>& loops) {
}

void Expression::update_port_attributes(const std::shared_ptr<Node>& new_node, const std::vector<PortConnectorPtr>& new_inputs,
const std::vector<PortDescriptorPtr>& new_in_descs, const std::vector<PortDescriptorPtr>& new_out_descs) {
const std::vector<PortDescriptorPtr>& new_in_descs, const std::vector<PortDescriptorPtr>& new_out_descs) {
OPENVINO_ASSERT(m_source_node->get_type_info() == new_node->get_type_info(), "Can't clone expression for a new node with incompatible type");
m_source_node = new_node;
OPENVINO_ASSERT(new_inputs.size() == new_in_descs.size(), "Can't create Expression with new inputs: invalid number of input port connectors passed");
Expand Down
2 changes: 1 addition & 1 deletion src/common/snippets/src/lowered/expression_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ std::shared_ptr<Expression> ExpressionFactory::build(const std::shared_ptr<Node>
return create(perf_counter, inputs, m_shape_infer_factory);
#endif
}
return create<>(n, inputs, m_shape_infer_factory);
return create(n, inputs, m_shape_infer_factory);
}

void ExpressionFactory::create_expression_outputs(const ExpressionPtr& expr) {
Expand Down
6 changes: 3 additions & 3 deletions src/common/snippets/src/lowered/linear_ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ LinearIR::LinearIR(const std::shared_ptr<ov::Model>& model,
constExprIt last_param = m_expressions.end();
for (const auto& n : get_ordered_ops(model)) {
constExprIt insertion_pos = m_expressions.end();
const auto expr = get_expr_factory()->build<>(n, get_expression_inputs_by_node(n));
const auto expr = get_expr_factory()->build(n, get_expression_inputs_by_node(n));

// Scalar should be on the Linear IR beginning after Parameters to have valid expression order after Loop passes.
// After these passes we must call pass MoveScalarToConsumer() to have a correct accuracy.
Expand Down Expand Up @@ -97,7 +97,7 @@ void update_consumers_and_regs(const ExpressionPtr& new_expr, const std::vector<
ExpressionPtr LinearIR::create_expression(const std::shared_ptr<Node>& n, const std::vector<PortConnectorPtr>& new_inputs,
const std::vector<size_t>& loop_ids, bool update_loop_ports,
const std::vector<std::set<ExpressionPort>>& consumers) {
const auto new_expr = get_expr_factory()->build<>(n, new_inputs);
const auto new_expr = get_expr_factory()->build(n, new_inputs);
update_consumers_and_regs(new_expr, consumers);
new_expr->set_loop_ids(loop_ids);

Expand Down Expand Up @@ -265,7 +265,7 @@ LinearIR::exprIt LinearIR::insert(LinearIR::constExprIt pos, const NodeVector& n
}

LinearIR::exprIt LinearIR::insert(LinearIR::constExprIt pos, const std::shared_ptr<Node>& n) {
const auto& expr = get_expr_factory()->build<>(n, get_expression_inputs_by_node(n));
const auto& expr = get_expr_factory()->build(n, get_expression_inputs_by_node(n));
register_expression(expr, m_config.m_manual_build_support, get_inserted_expr_exec_num(pos));
return m_expressions.insert(pos, expr);
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/snippets/src/lowered/pass/validate_buffers.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023 Intel Corporation
// Copyright (C) 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

Expand Down

0 comments on commit e34be5a

Please sign in to comment.