Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
v-Golubev committed Dec 6, 2023
1 parent a4149ab commit 23e3045
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 23 deletions.
2 changes: 0 additions & 2 deletions src/common/snippets/include/snippets/lowered/loop_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ class LinearIR::LoopManager {
std::vector<lowered::pass::SubgraphPassPipeline> handlers;

private:
void initialize_handlers();

size_t m_work_amount = 0;
size_t m_increment = 0;
// The order of entry and exit expressions is important:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace pass {
class SetSingleIterationWithWorkAmount : public pass::SubgraphPass {
public:
SetSingleIterationWithWorkAmount(size_t work_amount);
OPENVINO_RTTI("SetSingleIterationWithWorkAmount", "Pass")
OPENVINO_RTTI("SetSingleIterationWithWorkAmount", "SubgraphPass")
bool run(const LinearIR& linear_ir, LinearIR::constExprIt begin, LinearIR::constExprIt end) override;

private:
Expand All @@ -27,7 +27,7 @@ class SetSingleIterationWithWorkAmount : public pass::SubgraphPass {
class UpdateMemoryAccessOps : public pass::SubgraphPass {
public:
UpdateMemoryAccessOps(size_t count);
OPENVINO_RTTI("UpdateMemoryAccessOps", "Pass")
OPENVINO_RTTI("UpdateMemoryAccessOps", "SubgraphPass")
bool run(const LinearIR& linear_ir, LinearIR::constExprIt begin, LinearIR::constExprIt end) override;

private:
Expand All @@ -37,7 +37,7 @@ class UpdateMemoryAccessOps : public pass::SubgraphPass {
class ReduceWorkAmount : public pass::SubgraphPass {
public:
ReduceWorkAmount(size_t reduce_value);
OPENVINO_RTTI("ReduceWorkAmount", "Pass")
OPENVINO_RTTI("ReduceWorkAmount", "SubgraphPass")
bool run(const LinearIR& linear_ir, LinearIR::constExprIt begin, LinearIR::constExprIt end) override;

private:
Expand All @@ -46,14 +46,14 @@ class ReduceWorkAmount : public pass::SubgraphPass {

class ZeroFinalizationOffsets : public pass::SubgraphPass {
public:
OPENVINO_RTTI("ZeroFinalizationOffsets", "Pass")
OPENVINO_RTTI("ZeroFinalizationOffsets", "SubgraphPass")
bool run(const LinearIR& linear_ir, LinearIR::constExprIt begin, LinearIR::constExprIt end) override;
};

class SetFillOffset : public pass::SubgraphPass {
public:
SetFillOffset(size_t offset);
OPENVINO_RTTI("SetFillOffset", "Pass")
OPENVINO_RTTI("SetFillOffset", "SubgraphPass")
bool run(const LinearIR& linear_ir, LinearIR::constExprIt begin, LinearIR::constExprIt end) override;

private:
Expand All @@ -63,7 +63,7 @@ class SetFillOffset : public pass::SubgraphPass {
class TransformInnerSplitLoop : public pass::SubgraphPass {
public:
TransformInnerSplitLoop(size_t tail_size);
OPENVINO_RTTI("TransformInnerSplitLoop", "Pass")
OPENVINO_RTTI("TransformInnerSplitLoop", "SubgraphPass")
bool run(const LinearIR& linear_ir, LinearIR::constExprIt begin, LinearIR::constExprIt end) override;

private:
Expand Down
8 changes: 2 additions & 6 deletions src/common/snippets/src/lowered/loop_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ LinearIR::LoopManager::LoopInfo::LoopInfo(size_t work_amount,
m_entry_points(entries),
m_exit_points(exits),
m_outer_splited_loop(outer_splited_loop) {
initialize_handlers();
handlers.resize(3);
}

LinearIR::LoopManager::LoopInfo::LoopInfo(size_t work_amount,
Expand All @@ -66,7 +66,7 @@ LinearIR::LoopManager::LoopInfo::LoopInfo(size_t work_amount,
m_entry_points.emplace_back(port);
for (const auto& port : exits)
m_exit_points.emplace_back(port);
initialize_handlers();
handlers.resize(3);
}

std::shared_ptr<LoopInfo> LoopInfo::clone_with_new_expr(const ExressionMap& expr_map) const {
Expand Down Expand Up @@ -150,10 +150,6 @@ void LoopInfo::set_outer_splited_loop(bool outer_splited_loop) {
m_outer_splited_loop = outer_splited_loop;
}

void LoopInfo::initialize_handlers() {
handlers.resize(3);
}

bool operator==(const LinearIR::LoopManager::LoopPort& lhs, const LinearIR::LoopManager::LoopPort& rhs) {
if (&lhs == &rhs)
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/common/snippets/src/lowered/pass/fuse_loops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ bool FuseLoops::can_be_fused(const LoopInfoPtr& loop_current, const LoopInfoPtr&

// WA: we can't fuse 2 loops if one of them has first iteration handler but second hasn't,
// because in this case Main/Tail body handlers of the loop wo first iter handler must be reset with new parameters
// (e.g. tail size). This logic is not implemented for now.
// (e.g. tail size). This logic is not implemented for now, so fusion for such loops is skipped.
const bool first_iter_handlers_match = loop_current->handlers[LoopManager::LoopInfo::FIRST_ITER].empty() ==
loop_target->handlers[LoopManager::LoopInfo::FIRST_ITER].empty();
const bool equal_parameters = current_work_amount == target_work_amount && current_increment == target_increment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ bool InsertSpecificIterations::run(LinearIR& linear_ir) {
if (!loop_end)
continue;

std::vector<lowered::pass::SubgraphPassPipeline> pipelines_to_run;
for (const auto& handlers : loop_manager->get_loop_info(loop_end->get_id())->handlers) {
if (!handlers.empty())
pipelines_to_run.emplace_back(handlers);
std::vector<std::reference_wrapper<const lowered::pass::SubgraphPassPipeline>> pipelines_to_run;
for (const auto& pipeline : loop_manager->get_loop_info(loop_end->get_id())->handlers) {
if (!pipeline.empty())
pipelines_to_run.emplace_back(pipeline);
}
if (pipelines_to_run.empty())
continue;
Expand All @@ -90,10 +90,10 @@ bool InsertSpecificIterations::run(LinearIR& linear_ir) {
};

for (size_t i = 0; i < pipelines_to_run.size() - 1; ++i) {
copy_and_run_specific_handlers(pipelines_to_run[i]);
copy_and_run_specific_handlers(pipelines_to_run[i].get());
}
// Last pipeline is run on original body to avoid unnecesarry copy
pipelines_to_run.back().run(linear_ir, main_body_begin_it, main_body_end_it);
pipelines_to_run.back().get().run(linear_ir, main_body_begin_it, main_body_end_it);
modified = true;
}
return modified;
Expand Down
2 changes: 1 addition & 1 deletion src/common/snippets/tests/src/lowered/pass/loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void init_linear_ir(const std::vector<ov::PartialShape>& in_shapes, Linea
const auto in_shape0 = in_shapes[0].get_shape();
const auto in_shape1 = in_shapes[1].get_shape();
const auto inner_wa = std::max(*in_shape0.rbegin(), *in_shape1.rbegin());
const auto inner_inc = std::min(vector_size, inner_wa);
const auto inner_inc = vector_size;
const auto blocked_wa = block_size;
const auto blocked_inc = 1;
const auto outer_wa = std::max(*(in_shape0.rbegin() + 1), *(in_shape1.rbegin() + 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace pass {
class SetBrgemmBeta : public snippets::lowered::pass::SubgraphPass {
public:
SetBrgemmBeta(float beta);
OPENVINO_RTTI("SetBrgemmBeta", "Pass")
OPENVINO_RTTI("SetBrgemmBeta", "SubgraphPass")
bool run(const snippets::lowered::LinearIR& linear_ir,
snippets::lowered::LinearIR::constExprIt begin,
snippets::lowered::LinearIR::constExprIt end) override;
Expand Down

0 comments on commit 23e3045

Please sign in to comment.