Skip to content

Commit 492f9da

Browse files
committed
exclude changes that is not relavent
1 parent cb45c6d commit 492f9da

File tree

5 files changed

+34
-51
lines changed

5 files changed

+34
-51
lines changed

src/common/snippets/include/snippets/lowered/loop_manager.hpp

-5
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ class LinearIR::LoopManager {
8585
void set_outer_splited_loop(bool outer_splited_loop);
8686
void set_first_iter_handler(FirstIterHandler handler);
8787

88-
// Update the parameters of existing LoopPorts
89-
void update_entry_points(const std::function<void(LoopPort&)>& updater);
90-
void update_exit_points(const std::function<void(LoopPort&)>& updater);
91-
9288
private:
9389
size_t m_work_amount = 0;
9490
size_t m_increment = 0;
@@ -254,7 +250,6 @@ class LinearIR::LoopManager {
254250
// for `before` the new Loop is the most outer Loop
255251
void insert_loop_id(const ExpressionPtr& expr, size_t new_id, bool before = true, size_t target_id = SIZE_MAX);
256252
void insert_loop_ids(const ExpressionPtr& expr, const std::vector<size_t>& new_ids, bool before = true, size_t target_id = SIZE_MAX);
257-
static bool is_loop_id_found(const ExpressionPtr& expr, size_t id);
258253

259254
std::map<size_t, LoopInfoPtr> m_map = {};
260255
size_t next_id = 0;

src/common/snippets/include/snippets/lowered/pass/insert_tail_loop.hpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ class InsertTailLoop : public Pass {
2424
public:
2525
OPENVINO_RTTI("InsertTailLoop", "Pass")
2626
bool run(LinearIR& linear_ir) override;
27-
static LinearIR::constExprIt insert_copy_loop(LinearIR& linear_ir,
28-
const size_t loop_id,
29-
const LinearIR::constExprIt& insert_pos);
27+
static LinearIR::constExprIt insert_copy_loop(LinearIR& linear_ir, const size_t loop_id, const LinearIR::constExprIt& insert_pos);
3028

3129
static constexpr size_t existing_subtensor_value = SIZE_MAX;
3230
static void propagate_updated_subtensor_through_loop(const LinearIR& linear_ir,

src/common/snippets/src/lowered/loop_manager.cpp

+2-19
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,6 @@ void LoopInfo::set_first_iter_handler(LoopInfo::FirstIterHandler first_iter_hand
141141
m_first_iter_handler = std::move(first_iter_handler);
142142
}
143143

144-
void LoopInfo::update_entry_points(const std::function<void(LoopPort&)>& updater) {
145-
std::for_each(m_entry_points.begin(), m_entry_points.end(), updater);
146-
}
147-
148-
void LoopInfo::update_exit_points(const std::function<void(LoopPort&)>& updater) {
149-
std::for_each(m_exit_points.begin(), m_exit_points.end(), updater);
150-
}
151-
152144
bool operator==(const LinearIR::LoopManager::LoopPort& lhs, const LinearIR::LoopManager::LoopPort& rhs) {
153145
if (&lhs == &rhs)
154146
return true;
@@ -366,8 +358,7 @@ size_t LinearIR::LoopManager::replace_with_new_loop(const LinearIR& linear_ir,
366358
const size_t old_id) {
367359
const auto is_bound_explicit_loop_begin = ov::is_type<op::LoopBegin>(loop_begin_pos->get()->get_node());
368360
const auto is_bound_explicit_loop_end = ov::is_type<op::LoopEnd>(std::prev(loop_end_pos)->get()->get_node());
369-
OPENVINO_ASSERT((is_bound_explicit_loop_begin && is_bound_explicit_loop_end) ||
370-
(!is_bound_explicit_loop_begin && !is_bound_explicit_loop_end),
361+
OPENVINO_ASSERT((is_bound_explicit_loop_begin && is_bound_explicit_loop_end) || (!is_bound_explicit_loop_begin && !is_bound_explicit_loop_end),
371362
"Incorrect LoopBounds!");
372363
const auto explicit_loop_bounds = is_bound_explicit_loop_begin && is_bound_explicit_loop_end;
373364

@@ -379,8 +370,7 @@ size_t LinearIR::LoopManager::replace_with_new_loop(const LinearIR& linear_ir,
379370
replace_loop_id(*expr_it, old_id, loop_id);
380371
}
381372

382-
// Check that other expression in LinearIR doesn't have the old loop ID - otherwise completely removed from loop
383-
// manager
373+
// Check that other expression in LinearIR doesn't have the old loop ID - otherwise completely removed from loop manager
384374
const auto old_loop_bounds = get_loop_bounds(linear_ir, old_id);
385375
// If new bounds are equal to old loop bounds, this means that old Loop is removed totally from LIR
386376
// In this case old loop info must be completely removed from loop manager
@@ -560,7 +550,6 @@ void LinearIR::LoopManager::sort_loop_ports(LinearIR::constExprIt& loop_begin_po
560550

561551
void LinearIR::LoopManager::insert_loop_id(const ExpressionPtr& expr, size_t new_id, bool before, size_t target_id) {
562552
OPENVINO_ASSERT(m_map.count(new_id) == 1, "Failed marking expression by Loop ID: the Loop with this ID hasn't registered");
563-
OPENVINO_ASSERT(!is_loop_id_found(expr, new_id), "Expression cannot have several the same Loop IDs");
564553
auto& loop_ids = expr->m_loop_ids;
565554
OPENVINO_ASSERT(std::find(loop_ids.cbegin(), loop_ids.cend(), new_id) == loop_ids.cend(),
566555
"Expression cannot have several the same Loop IDs");
@@ -588,7 +577,6 @@ void LinearIR::LoopManager::insert_loop_ids(const ExpressionPtr& expr, const std
588577

589578
void LinearIR::LoopManager::replace_loop_id(const ExpressionPtr& expr, size_t prev_id, size_t new_id) {
590579
OPENVINO_ASSERT(m_map.count(new_id), "Failed marking expression by Loop ID: the Loop with this ID hasn't registered");
591-
OPENVINO_ASSERT(!is_loop_id_found(expr, new_id), "Expression cannot have several the same Loop IDs");
592580
auto& loop_ids = expr->m_loop_ids;
593581
OPENVINO_ASSERT(std::find(loop_ids.cbegin(), loop_ids.cend(), new_id) == loop_ids.cend(),
594582
"Expression already has the Loop with ID " + std::to_string(new_id));
@@ -605,11 +593,6 @@ void LinearIR::LoopManager::remove_loop_id(const ExpressionPtr& expr, size_t id)
605593
loop_ids.erase(it);
606594
}
607595

608-
bool LinearIR::LoopManager::is_loop_id_found(const ExpressionPtr& expr, size_t id) {
609-
const auto loop_ids = expr->get_loop_ids();
610-
return std::find(loop_ids.cbegin(), loop_ids.cend(), id) != loop_ids.cend();
611-
}
612-
613596
}// namespace lowered
614597
}// namespace snippets
615598
}// namespace ov

src/common/snippets/src/lowered/pass/init_loops.cpp

+29-20
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@ InitLoops::InitLoops() : Pass() {}
3939

4040
void InitLoops::init_ptr_increments(const LinearIR::LoopManager::LoopInfoPtr& loop_info) {
4141
const auto work_amount = loop_info->get_work_amount();
42+
auto loop_entries = loop_info->get_entry_points();
43+
auto loop_exits = loop_info->get_exit_points();
4244

43-
auto init_entry_port_increment = [&work_amount](LoopPort& loop_entry) {
45+
for (auto& loop_entry : loop_entries) {
4446
loop_entry.ptr_increment = 0;
4547
if (loop_entry.is_incremented) {
4648
const auto& port = loop_entry.expr_port;
4749
const auto source = *port->get_connected_ports().begin();
50+
const auto loop_ids = port->get_expr()->get_loop_ids();
4851
const auto& layout = port->get_descriptor_ptr()->get_layout();
4952
const auto& shape = port->get_descriptor_ptr()->get_shape();
5053
const auto& dim = *(layout.rbegin() + loop_entry.dim_idx);
@@ -54,11 +57,13 @@ void InitLoops::init_ptr_increments(const LinearIR::LoopManager::LoopInfoPtr& lo
5457
loop_entry.ptr_increment = get_input_stride(dim, source.get_descriptor_ptr()->get_layout(), shape);
5558
}
5659
}
57-
};
58-
auto init_exit_port_increment = [&work_amount](LoopPort& loop_exit) {
60+
}
61+
62+
for (auto& loop_exit : loop_exits) {
5963
loop_exit.ptr_increment = 0;
6064
if (loop_exit.is_incremented) {
6165
const auto& port = loop_exit.expr_port;
66+
const auto loop_ids = port->get_expr()->get_loop_ids();
6267
const auto& layout = port->get_descriptor_ptr()->get_layout();
6368
const auto& shape = port->get_descriptor_ptr()->get_shape();
6469
const auto original_dim = layout.size() - 1 - loop_exit.dim_idx;
@@ -69,34 +74,38 @@ void InitLoops::init_ptr_increments(const LinearIR::LoopManager::LoopInfoPtr& lo
6974
loop_exit.ptr_increment = get_output_stride(dim, shape);
7075
}
7176
}
72-
};
73-
74-
loop_info->update_entry_points(init_entry_port_increment);
75-
loop_info->update_exit_points(init_exit_port_increment);
77+
}
78+
loop_info->set_entry_points(loop_entries);
79+
loop_info->set_exit_points(loop_exits);
7680
}
7781

7882
void InitLoops::init_finalization_offsets(const LinearIR::LoopManager::LoopInfoPtr& loop_info) {
7983
const auto work_amount = loop_info->get_work_amount();
80-
auto init_port_finalization_offset = [&work_amount](LoopPort& loop_port) {
81-
loop_port.finalization_offset = -1 * loop_port.ptr_increment * work_amount;
82-
};
83-
84-
loop_info->update_entry_points(init_port_finalization_offset);
85-
loop_info->update_exit_points(init_port_finalization_offset);
84+
auto loop_entries = loop_info->get_entry_points();
85+
auto loop_exits = loop_info->get_exit_points();
86+
for (auto& loop_entry : loop_entries) {
87+
loop_entry.finalization_offset = -1 * loop_entry.ptr_increment * work_amount;
88+
}
89+
for (auto& loop_exit : loop_exits) {
90+
loop_exit.finalization_offset = -1 * loop_exit.ptr_increment * work_amount;
91+
}
92+
loop_info->set_entry_points(loop_entries);
93+
loop_info->set_exit_points(loop_exits);
8694
}
8795

8896
void InitLoops::init_element_type_sizes(const LinearIR::LoopManager::LoopInfoPtr& loop_info) {
89-
auto init_entry_port_data_size = [](LoopPort& loop_entry) {
97+
auto loop_entries = loop_info->get_entry_points();
98+
auto loop_exits = loop_info->get_exit_points();
99+
for (auto& loop_entry : loop_entries) {
90100
const auto& port = loop_entry.expr_port;
91101
loop_entry.data_size = static_cast<int64_t>(port->get_expr()->get_node()->get_input_element_type(port->get_index()).size());
92-
};
93-
auto init_exit_port_data_size = [](LoopPort& loop_exit) {
102+
}
103+
for (auto& loop_exit : loop_exits) {
94104
const auto& port = loop_exit.expr_port;
95105
loop_exit.data_size = static_cast<int64_t>(port->get_expr()->get_node()->get_output_element_type(port->get_index()).size());
96-
};
97-
98-
loop_info->update_entry_points(init_entry_port_data_size);
99-
loop_info->update_exit_points(init_exit_port_data_size);
106+
}
107+
loop_info->set_entry_points(loop_entries);
108+
loop_info->set_exit_points(loop_exits);
100109
}
101110

102111
bool InitLoops::run(LinearIR& linear_ir) {

src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/brgemm_blocking.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,8 @@ bool BrgemmBlocking::run(LinearIR& linear_ir) {
161161
return false;
162162

163163
const auto loop_begin_it = linear_ir.find(linear_ir.get_expr_by_node(loop_end->get_loop_begin()));
164-
const auto new_loop_begin_pos =
165-
snippets::lowered::pass::InsertTailLoop::insert_copy_loop(linear_ir, loop_id, loop_begin_it);
166-
const auto new_loop_begin =
167-
ov::as_type_ptr<snippets::op::LoopBegin>(new_loop_begin_pos->get()->get_node());
164+
const auto new_loop_begin_pos = snippets::lowered::pass::InsertTailLoop::insert_copy_loop(linear_ir, loop_id, loop_begin_it);
165+
const auto new_loop_begin = ov::as_type_ptr<snippets::op::LoopBegin>(new_loop_begin_pos->get()->get_node());
168166
OPENVINO_ASSERT(new_loop_begin, "Cloned Loop does not contain LoopBegin op at the expected place.");
169167
const auto firt_iter_loop_end = new_loop_begin->get_loop_end();
170168
auto first_iter_loop_info = loop_manager->get_loop_info(firt_iter_loop_end->get_id());

0 commit comments

Comments
 (0)