Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aobolensk committed Jan 24, 2025
1 parent e8387b7 commit 06eee03
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Snippet parameters dump

Snippet parameters can be captured during the pass flow, which can be useful for debugging and optimization purposes.
The pass dumps selected properties of some performance-critical operations in Subgraphs. Only MatMuls are currently supported by this pass.

To turn on snippet parameters dump feature, the following environment variable should be used:
To turn on snippet properties dump feature, the following environment variable should be used:
```sh
OV_SNIPPETS_DUMP_BRGEMM_PARAMS="path=<path_to_csv_dump_file>" binary ...
```
Expand All @@ -13,6 +13,7 @@ Examples:
```

Output example:

| subgraph_name | name | in_type | out_type | in_shapes | out_shapes | in_layouts | out_layouts | M | N | K | m_block | n_block | k_block | acc_max_time | avg_max_time |
|--------------------|------------|-------------|----------|-------------------------------------|----------------------|--------------------------|-------------|-----|-----|-----|---------|----------|----------|---------------|---------------|
| FakeQuantitze_457 | MatMul_438 | i8;i8;f32 | i32 | 1 16 128 64;1 16 64 128;1 16 64 128 | 1 16 128 128 | 0 2 1 3;0 1 2 3;0 1 2 3; | 0 1 2 3; | 128 | 128 | 64 | 32 | FULL_DIM | FULL_DIM | 41482 | 5185 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class BrgemmDebugParams : public snippets::lowered::pass::RangedPass {
}
static size_t seq_number = 0;
bool modified = false;
auto csv_path = linear_ir.get_config().debug_config.dumpParams.csv_path;
for (auto expr_it = begin; expr_it != end; expr_it++) {
const auto& brgemm_expr = *expr_it;
const auto brgemm = ov::as_type_ptr<BRGEMM_TYPE>(brgemm_expr->get_node());
Expand All @@ -56,7 +57,6 @@ class BrgemmDebugParams : public snippets::lowered::pass::RangedPass {
perf_count_end->set_friendly_name(std::string("PerfCount_End_") + std::to_string(seq_number) +
"_DebugParams");
// Attach brgemm parameters to PerfCountEnd node
auto csv_path = linear_ir.get_config().debug_config.dumpParams.csv_path;
perf_count_end->get_rt_info()["brgemm_params"] = params;
perf_count_end->get_rt_info()["brgemm_params_csv_path"] = csv_path;
linear_ir.insert_node(perf_count_end, empty_inputs, expr_it->get()->get_loop_ids(), false, next(expr_it));
Expand All @@ -69,7 +69,6 @@ class BrgemmDebugParams : public snippets::lowered::pass::RangedPass {
private:
std::string collect_params(const ov::snippets::lowered::ExpressionPtr& brgemm_expr,
const snippets::lowered::LinearIR& linear_ir) {
auto debug_config = linear_ir.get_config().debug_config;
const auto brgemm = ov::as_type_ptr<BRGEMM_TYPE>(brgemm_expr->get_node());
OPENVINO_ASSERT(brgemm, "Brgemm is nullptr!");
std::stringstream ss;
Expand Down
4 changes: 3 additions & 1 deletion src/common/snippets/src/op/perf_count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ void PerfCountEnd::output_perf_count() {
}
if (brgemm_csv_path.empty()) {
auto brgemm_csv_path_it = rt_info.find("brgemm_params_csv_path");
brgemm_csv_path = brgemm_csv_path_it->second.as<std::string>();
if (brgemm_csv_path_it != rt_info.end()) {
brgemm_csv_path = brgemm_csv_path_it->second.as<std::string>();
}
}
m_debug_params_map[get_friendly_name()] =
brgemm_params_it->second.as<std::string>() + std::to_string(acc_max) + ',' + std::to_string(avg_max);
Expand Down

0 comments on commit 06eee03

Please sign in to comment.