Skip to content

Commit

Permalink
finalize look
Browse files Browse the repository at this point in the history
  • Loading branch information
aobolensk committed Jan 10, 2025
1 parent fc38702 commit 046410a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,13 @@ class BrgemmBlocking : public snippets::lowered::pass::RangedPass, public Brgemm
ss << M << "," << N << "," << K << ",";
int64_t m_block, n_block, k_block;
std::tie(m_block, n_block, k_block) = get_blocking_params(brgemm_expr);
ss << static_cast<int64_t>(m_block) << "," << static_cast<int64_t>(n_block) << ","
<< static_cast<int64_t>(k_block) << ",";
ss << '\n';
ss << m_block << "," << n_block << "," << k_block;
std::string params = ss.str();
return params;
}
#endif // SNIPPETS_DEBUG_CAPS
};
} // namespace pass
} // namespace lowered
} // namespace snippets
} // namespace ov
} // namespace pass
} // namespace lowered
} // namespace snippets
} // namespace ov
22 changes: 12 additions & 10 deletions src/common/snippets/include/snippets/utils/params_dumper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ namespace snippets {
class ParamsDump {
public:
explicit ParamsDump(const ov::snippets::lowered::ExpressionPtr expr,
std::string pass_name,
const DebugCapsConfig& debug_config,
std::string params)
: expr(expr),
pass_name(std::move(pass_name)),
debug_config(debug_config),
params(std::move(params)) {
dump("_in");
Expand All @@ -32,31 +30,35 @@ class ParamsDump {

private:
void dump(const std::string&& postfix) const {
ov::util::create_directory_recursive(debug_config.dumpParams.dir);

if (const auto brgemm = ov::as_type_ptr<snippets::op::Brgemm>(expr->get_node())) {
std::string csv_path = debug_config.dumpParams.dir + "/brgemm.csv";
std::ofstream csv_file(csv_path, std::ios_base::app);
OPENVINO_ASSERT(csv_file.is_open(), "Can't open file for dumping brgemm params");
static int brgemm_num = 0;
if (brgemm_num == 0) {
fprintf(stderr, "name,in_type,out_type,in_shapes,out_shapes,M,N,K,m_block,n_block,k_block\n");
csv_file << "name,in_type,out_type,in_shapes,out_shapes,M,N,K,m_block,n_block,k_block\n";
}
fprintf(stderr, "%s,%s", brgemm->get_friendly_name().c_str(), params.c_str());
csv_file << brgemm->get_friendly_name() << "," << params << "\n";

brgemm_num++;
}
}

const ov::snippets::lowered::ExpressionPtr& expr;
const std::string pass_name;
const DebugCapsConfig& debug_config;
const std::string params;
};

} // namespace snippets
} // namespace ov

#define SNIPPETS_DEBUG_PARAMS_DUMP(_expr, _pass) \
auto debug_config = linear_ir.get_config().debug_config; \
auto pass_name = std::string(_pass->get_type_name()); \
if (const auto brgemm = ov::as_type_ptr<BRGEMM_TYPE>(brgemm_expr->get_node())) { \
ov::snippets::ParamsDump dumper(brgemm_expr, pass_name, debug_config, params_to_csv(brgemm_expr)); \
#define SNIPPETS_DEBUG_PARAMS_DUMP(_expr, _pass) \
auto debug_config = linear_ir.get_config().debug_config; \
auto pass_name = std::string(_pass->get_type_name()); \
if (const auto brgemm = ov::as_type_ptr<BRGEMM_TYPE>(_expr->get_node())) { \
ov::snippets::ParamsDump dumper(_expr, debug_config, params_to_csv(_expr)); \
}
#else
#define SNIPPETS_DEBUG_PARAMS_DUMP(_expr, _pass)
Expand Down

0 comments on commit 046410a

Please sign in to comment.