From 647e0a03d4b8e71cc9fbbab900dec11f67287ece Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Tue, 9 Sep 2025 15:11:42 +0200 Subject: [PATCH 1/9] [Snippets] Add final Linear IR dump capability with subgraph naming Add support for dumping final Linear IR right before code generation using the existing OV_SNIPPETS_DUMP_LIR debug capability. - Extend OV_SNIPPETS_DUMP_LIR to support "final" pass name for capturing the final state of Linear IR before code generation - Add name_modifier option to include subgraph friendly names in dump filenames - Sanitize subgraph names by replacing '/' and ':' with '_' for filesystem compatibility - Update LIRPassDump to support optional name prefix for better file identification when multiple subgraphs are present Usage: ```bash OV_SNIPPETS_DUMP_LIR="passes=final name_modifier=subgraph_name" binary ``` --- .../linear_ir_passes_serialization.md | 8 +++++++- .../snippets/utils/debug_caps_config.hpp | 6 +++++- .../snippets/utils/linear_ir_pass_dumper.hpp | 17 +++++++++++++++- src/common/snippets/src/op/subgraph.cpp | 20 +++++++++++++++++++ 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/common/snippets/docs/debug_capabilities/linear_ir_passes_serialization.md b/src/common/snippets/docs/debug_capabilities/linear_ir_passes_serialization.md index 8fc016876ec0c4..f0e1ce1648bf78 100644 --- a/src/common/snippets/docs/debug_capabilities/linear_ir_passes_serialization.md +++ b/src/common/snippets/docs/debug_capabilities/linear_ir_passes_serialization.md @@ -16,6 +16,7 @@ Examples: OV_SNIPPETS_DUMP_LIR="passes=ExtractLoopInvariants dir=path/dumpdir formats=all" binary ... OV_SNIPPETS_DUMP_LIR="passes=all dir=path/dumpdir formats=control_flow" binary ... OV_SNIPPETS_DUMP_LIR="passes=FuseLoops,InsertLoops,InsertLoadStore formats=data_flow" binary ... + OV_SNIPPETS_DUMP_LIR="passes=final formats=control_flow name_modifier=subgraph_name" binary ... ``` Option names are case insensitive, the following options are supported: @@ -23,8 +24,13 @@ Option names are case insensitive, the following options are supported: It support multiple comma separated pass names. The names are case insensitive. Key word 'all' means to dump LIR around every pass. This option is a must have, should not be omitted. + In addition to specific pass names, special value `final` dumps a snapshot of the final Linear IR right before code generation. - `dir` : Path to dumped LIR files. If omitted, it defaults to snippets_LIR_dump. If specified path doesn't exist, the directory will be created automatically. - `formats` : Support values are control_flow, data_flow and all. - If omitted, it defaults to control_flow. \ No newline at end of file + If omitted, it defaults to control_flow. + - `name_modifier` : Optional naming modifier for dump files. Supported value is `subgraph_name`, which prepends the Snippets Subgraph friendly name to dumped files. If omitted, no name modification is performed. + +Notes: +- File names follow the same `OV_SNIPPETS_DUMP_LIR` convention: `lir___(control_flow|data_flow)_(in|out).xml`. When `name_modifier=subgraph_name` is set, it is prepended to the file name. diff --git a/src/common/snippets/include/snippets/utils/debug_caps_config.hpp b/src/common/snippets/include/snippets/utils/debug_caps_config.hpp index 74e91b4785b83a..6562bee58b1bc9 100644 --- a/src/common/snippets/include/snippets/utils/debug_caps_config.hpp +++ b/src/common/snippets/include/snippets/utils/debug_caps_config.hpp @@ -51,6 +51,7 @@ class DebugCapsConfig { std::string dir = "snippets_LIR_dump"; LIRFormatFilter format = {1 << LIRFormatFilter::controlFlow}; std::vector passes; + std::string name_modifier; std::vector getPropertySetters() override { return {PropertySetterPtr(new StringPropertySetter("dir", dir, "path to dumped LIRs")), @@ -59,7 +60,10 @@ class DebugCapsConfig { "passes", passes, "indicate dump LIRs around the passes. Support multiple passes with comma separated and case " - "insensitive. 'all' means dump all passes"))}; + "insensitive. 'all' means dump all passes")), + PropertySetterPtr(new StringPropertySetter("name_modifier", + name_modifier, + "optional name modifier, supported: subgraph_name"))}; } } dumpLIR; diff --git a/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp b/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp index b36cd47ef80e56..bcf3b7f94813f8 100644 --- a/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp +++ b/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp @@ -7,6 +7,7 @@ #include #ifdef SNIPPETS_DEBUG_CAPS +# include "openvino/util/common_util.hpp" # include "openvino/util/file_util.hpp" # include "snippets/lowered/linear_ir.hpp" # include "snippets/lowered/pass/serialize_control_flow.hpp" @@ -23,6 +24,13 @@ class LIRPassDump { debug_config(*linear_ir.get_config().debug_config) { dump("_in"); } + LIRPassDump(const lowered::LinearIR& linear_ir, std::string pass_name, std::string name_prefix) + : linear_ir(linear_ir), + pass_name(std::move(pass_name)), + name_prefix(std::move(name_prefix)), + debug_config(*linear_ir.get_config().debug_config) { + dump("_in"); + } ~LIRPassDump() { dump("_out"); } @@ -30,7 +38,13 @@ class LIRPassDump { private: void dump(const std::string&& postfix) const { static int num = 0; // just to keep dumped IRs ordered in filesystem - const auto pathAndName = debug_config.dumpLIR.dir + "/lir_"; + auto pathAndName = debug_config.dumpLIR.dir + "/"; + const bool use_subgraph_prefix = + ov::util::to_lower(debug_config.dumpLIR.name_modifier) == std::string("subgraph_name"); + if (use_subgraph_prefix && !name_prefix.empty()) { + pathAndName += name_prefix + "_"; + } + pathAndName += "lir_"; ov::util::create_directory_recursive(debug_config.dumpLIR.dir); @@ -51,6 +65,7 @@ class LIRPassDump { const lowered::LinearIR& linear_ir; const std::string pass_name; + const std::string name_prefix; const DebugCapsConfig& debug_config; }; diff --git a/src/common/snippets/src/op/subgraph.cpp b/src/common/snippets/src/op/subgraph.cpp index 385cc08f4e7a93..d8e522e879db06 100644 --- a/src/common/snippets/src/op/subgraph.cpp +++ b/src/common/snippets/src/op/subgraph.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -39,6 +40,7 @@ #include "openvino/opsets/opset1.hpp" #include "openvino/pass/constant_folding.hpp" #include "openvino/pass/pass_config.hpp" +#include "openvino/util/common_util.hpp" #include "snippets/generator.hpp" #include "snippets/itt.hpp" #include "snippets/lowered/expression.hpp" @@ -97,6 +99,7 @@ #include "snippets/shape_inference/shape_inference.hpp" #include "snippets/shape_types.hpp" #include "snippets/utils/debug_caps_config.hpp" +#include "snippets/utils/linear_ir_pass_dumper.hpp" #include "snippets/utils/utils.hpp" using namespace ov::op::util; @@ -619,6 +622,23 @@ snippets::Schedule Subgraph::generate(const void* compile_params) const { shape_dependent_pipeline.run(*linear_ir); } +#ifdef SNIPPETS_DEBUG_CAPS + const auto& debug_conf = *linear_ir->get_config().debug_config; + const auto& dump_names = debug_conf.dumpLIR.passes; + const bool dump_final = + (std::find(dump_names.begin(), dump_names.end(), std::string("final")) != dump_names.end()) || + (std::find(dump_names.begin(), dump_names.end(), std::string("all")) != dump_names.end()); + if (dump_final) { + std::string name_prefix; + if (ov::util::to_lower(debug_conf.dumpLIR.name_modifier) == std::string("subgraph_name")) { + name_prefix = get_friendly_name(); + std::replace(name_prefix.begin(), name_prefix.end(), '/', '_'); + std::replace(name_prefix.begin(), name_prefix.end(), ':', '_'); + } + LIRPassDump final_dump(*linear_ir, std::string("Final"), name_prefix); + } +#endif + auto lowering_result = m_generator->generate(linear_ir, compile_params); return Schedule{std::move(lowering_result)}; } From 6dfa38152885585c12aee261f45891ae4e430045 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Wed, 10 Sep 2025 12:56:34 +0200 Subject: [PATCH 2/9] Address Vladislav's comments --- .../debug_capabilities/linear_ir_passes_serialization.md | 5 ++--- .../snippets/include/snippets/utils/debug_caps_config.hpp | 5 +++-- .../include/snippets/utils/linear_ir_pass_dumper.hpp | 8 +------- src/common/snippets/src/op/subgraph.cpp | 2 ++ 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/common/snippets/docs/debug_capabilities/linear_ir_passes_serialization.md b/src/common/snippets/docs/debug_capabilities/linear_ir_passes_serialization.md index f0e1ce1648bf78..7a45f32aa95ad4 100644 --- a/src/common/snippets/docs/debug_capabilities/linear_ir_passes_serialization.md +++ b/src/common/snippets/docs/debug_capabilities/linear_ir_passes_serialization.md @@ -22,15 +22,14 @@ Examples: Option names are case insensitive, the following options are supported: - `passes` : Dump LIR around the passes if passes name are specified. It support multiple comma separated pass names. The names are case insensitive. - Key word 'all' means to dump LIR around every pass. This option is a must have, should not be omitted. - In addition to specific pass names, special value `final` dumps a snapshot of the final Linear IR right before code generation. + Special values: 'all' - dump all passes (includes 'final'), 'final' - dump final LIR snapshot right before code generation. - `dir` : Path to dumped LIR files. If omitted, it defaults to snippets_LIR_dump. If specified path doesn't exist, the directory will be created automatically. - `formats` : Support values are control_flow, data_flow and all. If omitted, it defaults to control_flow. - - `name_modifier` : Optional naming modifier for dump files. Supported value is `subgraph_name`, which prepends the Snippets Subgraph friendly name to dumped files. If omitted, no name modification is performed. + - `name_modifier` : Optional naming modifier for dump files. Supported value is `subgraph_name`, which prepends the Snippets Subgraph friendly name to dumped files. If omitted, no name modification is performed. Note: when using `subgraph_name`, characters '/' and ':' in the subgraph name are replaced with '_' for filesystem compatibility. Notes: - File names follow the same `OV_SNIPPETS_DUMP_LIR` convention: `lir___(control_flow|data_flow)_(in|out).xml`. When `name_modifier=subgraph_name` is set, it is prepended to the file name. diff --git a/src/common/snippets/include/snippets/utils/debug_caps_config.hpp b/src/common/snippets/include/snippets/utils/debug_caps_config.hpp index 6562bee58b1bc9..2a20e0e850df4f 100644 --- a/src/common/snippets/include/snippets/utils/debug_caps_config.hpp +++ b/src/common/snippets/include/snippets/utils/debug_caps_config.hpp @@ -51,7 +51,7 @@ class DebugCapsConfig { std::string dir = "snippets_LIR_dump"; LIRFormatFilter format = {1 << LIRFormatFilter::controlFlow}; std::vector passes; - std::string name_modifier; + bool use_subgraph_name = false; std::vector getPropertySetters() override { return {PropertySetterPtr(new StringPropertySetter("dir", dir, "path to dumped LIRs")), @@ -60,7 +60,8 @@ class DebugCapsConfig { "passes", passes, "indicate dump LIRs around the passes. Support multiple passes with comma separated and case " - "insensitive. 'all' means dump all passes")), + "insensitive. Special values: 'all' - dump all passes (includes 'final'), 'final' - dump final " + "LIR")), PropertySetterPtr(new StringPropertySetter("name_modifier", name_modifier, "optional name modifier, supported: subgraph_name"))}; diff --git a/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp b/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp index bcf3b7f94813f8..f5324f00e0212d 100644 --- a/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp +++ b/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp @@ -18,13 +18,7 @@ namespace ov::snippets { class LIRPassDump { public: - explicit LIRPassDump(const lowered::LinearIR& linear_ir, std::string pass_name) - : linear_ir(linear_ir), - pass_name(std::move(pass_name)), - debug_config(*linear_ir.get_config().debug_config) { - dump("_in"); - } - LIRPassDump(const lowered::LinearIR& linear_ir, std::string pass_name, std::string name_prefix) + explicit LIRPassDump(const lowered::LinearIR& linear_ir, std::string pass_name, std::string name_prefix = "") : linear_ir(linear_ir), pass_name(std::move(pass_name)), name_prefix(std::move(name_prefix)), diff --git a/src/common/snippets/src/op/subgraph.cpp b/src/common/snippets/src/op/subgraph.cpp index d8e522e879db06..f835542210cf68 100644 --- a/src/common/snippets/src/op/subgraph.cpp +++ b/src/common/snippets/src/op/subgraph.cpp @@ -632,6 +632,8 @@ snippets::Schedule Subgraph::generate(const void* compile_params) const { std::string name_prefix; if (ov::util::to_lower(debug_conf.dumpLIR.name_modifier) == std::string("subgraph_name")) { name_prefix = get_friendly_name(); + // Replace '/' and ':' characters with '_' to ensure filesystem compatibility + // These characters are problematic in file paths std::replace(name_prefix.begin(), name_prefix.end(), '/', '_'); std::replace(name_prefix.begin(), name_prefix.end(), ':', '_'); } From 6e3ab612b49a6991115d7f387983c49fdd8dfb4f Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Thu, 11 Sep 2025 11:23:43 +0200 Subject: [PATCH 3/9] fix build --- src/common/snippets/include/snippets/utils/debug_caps_config.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/snippets/include/snippets/utils/debug_caps_config.hpp b/src/common/snippets/include/snippets/utils/debug_caps_config.hpp index 2a20e0e850df4f..33e972d607d747 100644 --- a/src/common/snippets/include/snippets/utils/debug_caps_config.hpp +++ b/src/common/snippets/include/snippets/utils/debug_caps_config.hpp @@ -52,6 +52,7 @@ class DebugCapsConfig { LIRFormatFilter format = {1 << LIRFormatFilter::controlFlow}; std::vector passes; bool use_subgraph_name = false; + std::string name_modifier; std::vector getPropertySetters() override { return {PropertySetterPtr(new StringPropertySetter("dir", dir, "path to dumped LIRs")), From 52abb9b911dd558775d868c1aed23bb573ade289 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Mon, 15 Sep 2025 08:11:48 +0200 Subject: [PATCH 4/9] Address review comments --- .../linear_ir_passes_serialization.md | 16 ++++++---- .../snippets/utils/debug_caps_config.hpp | 9 +++--- .../snippets/utils/linear_ir_pass_dumper.hpp | 30 ++++++++++++++----- src/common/snippets/src/op/subgraph.cpp | 2 +- 4 files changed, 40 insertions(+), 17 deletions(-) diff --git a/src/common/snippets/docs/debug_capabilities/linear_ir_passes_serialization.md b/src/common/snippets/docs/debug_capabilities/linear_ir_passes_serialization.md index 7a45f32aa95ad4..2d9e4cbf56a63e 100644 --- a/src/common/snippets/docs/debug_capabilities/linear_ir_passes_serialization.md +++ b/src/common/snippets/docs/debug_capabilities/linear_ir_passes_serialization.md @@ -17,19 +17,25 @@ Examples: OV_SNIPPETS_DUMP_LIR="passes=all dir=path/dumpdir formats=control_flow" binary ... OV_SNIPPETS_DUMP_LIR="passes=FuseLoops,InsertLoops,InsertLoadStore formats=data_flow" binary ... OV_SNIPPETS_DUMP_LIR="passes=final formats=control_flow name_modifier=subgraph_name" binary ... + OV_SNIPPETS_DUMP_LIR="passes=all dir=path/dumpdir name_modifier=branchA" binary ... ``` +Dumped files have below names: + - Regular passes: `lir___(control_flow|data_flow)_(in|out).xml` (creates both input and output files) + - Final dump: `lir__Final_(control_flow|data_flow).xml` (creates single file only) + +When `name_modifier` is provided, it is prepended to file names as a prefix: + - `name_modifier=subgraph_name` prepends the Snippets Subgraph friendly name where available (e.g., final dump). + - any other non-empty value prepends that literal value (e.g., `branchA_lir_...`). + Option names are case insensitive, the following options are supported: - `passes` : Dump LIR around the passes if passes name are specified. It support multiple comma separated pass names. The names are case insensitive. This option is a must have, should not be omitted. - Special values: 'all' - dump all passes (includes 'final'), 'final' - dump final LIR snapshot right before code generation. + Special values: 'all' - dump all passes (includes 'final'), 'final' - dump final LIR snapshot right before code generation (single file, no _in/_out suffix). - `dir` : Path to dumped LIR files. If omitted, it defaults to snippets_LIR_dump. If specified path doesn't exist, the directory will be created automatically. - `formats` : Support values are control_flow, data_flow and all. If omitted, it defaults to control_flow. - - `name_modifier` : Optional naming modifier for dump files. Supported value is `subgraph_name`, which prepends the Snippets Subgraph friendly name to dumped files. If omitted, no name modification is performed. Note: when using `subgraph_name`, characters '/' and ':' in the subgraph name are replaced with '_' for filesystem compatibility. - -Notes: -- File names follow the same `OV_SNIPPETS_DUMP_LIR` convention: `lir___(control_flow|data_flow)_(in|out).xml`. When `name_modifier=subgraph_name` is set, it is prepended to the file name. + - `name_modifier` : Optional file-name prefix. Special value `subgraph_name` prepends the Snippets Subgraph friendly name to dumped files (where available). Any other non-empty value is used as a literal prefix. If omitted, no name modification is performed. Note: when using `subgraph_name`, characters '/' and ':' in the subgraph name are replaced with '_' for filesystem compatibility. diff --git a/src/common/snippets/include/snippets/utils/debug_caps_config.hpp b/src/common/snippets/include/snippets/utils/debug_caps_config.hpp index 33e972d607d747..af35e391d8cbae 100644 --- a/src/common/snippets/include/snippets/utils/debug_caps_config.hpp +++ b/src/common/snippets/include/snippets/utils/debug_caps_config.hpp @@ -51,7 +51,6 @@ class DebugCapsConfig { std::string dir = "snippets_LIR_dump"; LIRFormatFilter format = {1 << LIRFormatFilter::controlFlow}; std::vector passes; - bool use_subgraph_name = false; std::string name_modifier; std::vector getPropertySetters() override { @@ -63,9 +62,11 @@ class DebugCapsConfig { "indicate dump LIRs around the passes. Support multiple passes with comma separated and case " "insensitive. Special values: 'all' - dump all passes (includes 'final'), 'final' - dump final " "LIR")), - PropertySetterPtr(new StringPropertySetter("name_modifier", - name_modifier, - "optional name modifier, supported: subgraph_name"))}; + PropertySetterPtr(new StringPropertySetter( + "name_modifier", + name_modifier, + "optional file-name prefix; special value 'subgraph_name' uses the Subgraph friendly name; any " + "other non-empty value is used as a literal prefix"))}; } } dumpLIR; diff --git a/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp b/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp index f5324f00e0212d..6d264eef9abcdb 100644 --- a/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp +++ b/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp @@ -18,25 +18,40 @@ namespace ov::snippets { class LIRPassDump { public: - explicit LIRPassDump(const lowered::LinearIR& linear_ir, std::string pass_name, std::string name_prefix = "") + enum class DumpMode : uint8_t { Both, SingleDump }; + + explicit LIRPassDump(const lowered::LinearIR& linear_ir, + std::string pass_name, + std::string name_prefix = "", + DumpMode mode = DumpMode::Both) : linear_ir(linear_ir), pass_name(std::move(pass_name)), name_prefix(std::move(name_prefix)), + dump_mode(mode), debug_config(*linear_ir.get_config().debug_config) { - dump("_in"); + if (dump_mode == DumpMode::Both) { + dump("_in"); + } else { + dump(""); + } } ~LIRPassDump() { - dump("_out"); + if (dump_mode == DumpMode::Both) { + dump("_out"); + } } private: void dump(const std::string&& postfix) const { static int num = 0; // just to keep dumped IRs ordered in filesystem auto pathAndName = debug_config.dumpLIR.dir + "/"; - const bool use_subgraph_prefix = - ov::util::to_lower(debug_config.dumpLIR.name_modifier) == std::string("subgraph_name"); - if (use_subgraph_prefix && !name_prefix.empty()) { - pathAndName += name_prefix + "_"; + const auto nm_lower = ov::util::to_lower(debug_config.dumpLIR.name_modifier); + if (nm_lower == std::string("subgraph_name")) { + if (!name_prefix.empty()) { + pathAndName += name_prefix + "_"; + } + } else if (!debug_config.dumpLIR.name_modifier.empty()) { + pathAndName += debug_config.dumpLIR.name_modifier + "_"; } pathAndName += "lir_"; @@ -60,6 +75,7 @@ class LIRPassDump { const lowered::LinearIR& linear_ir; const std::string pass_name; const std::string name_prefix; + const DumpMode dump_mode; const DebugCapsConfig& debug_config; }; diff --git a/src/common/snippets/src/op/subgraph.cpp b/src/common/snippets/src/op/subgraph.cpp index f835542210cf68..d21f71a2fd8054 100644 --- a/src/common/snippets/src/op/subgraph.cpp +++ b/src/common/snippets/src/op/subgraph.cpp @@ -637,7 +637,7 @@ snippets::Schedule Subgraph::generate(const void* compile_params) const { std::replace(name_prefix.begin(), name_prefix.end(), '/', '_'); std::replace(name_prefix.begin(), name_prefix.end(), ':', '_'); } - LIRPassDump final_dump(*linear_ir, std::string("Final"), name_prefix); + LIRPassDump final_dump(*linear_ir, std::string("Final"), name_prefix, LIRPassDump::DumpMode::SingleDump); } #endif From c0d5382bd4d51229e099f2c6f73d691f84170bcd Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Mon, 15 Sep 2025 18:17:17 +0200 Subject: [PATCH 5/9] Save Subgraph friendly name --- .../snippets/include/snippets/lowered/linear_ir.hpp | 10 +++++++++- .../include/snippets/utils/linear_ir_pass_dumper.hpp | 7 ++++--- src/common/snippets/src/lowered/linear_ir_builder.cpp | 1 + src/common/snippets/src/op/subgraph.cpp | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/common/snippets/include/snippets/lowered/linear_ir.hpp b/src/common/snippets/include/snippets/lowered/linear_ir.hpp index 98086386d708f1..6cfdcc1ec1ea89 100644 --- a/src/common/snippets/include/snippets/lowered/linear_ir.hpp +++ b/src/common/snippets/include/snippets/lowered/linear_ir.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -102,7 +103,12 @@ class LinearIR { size_t get_static_buffer_scratchpad_size() const { return m_static_buffer_scratchpad_size; } - + const std::string& get_friendly_name() const { + return m_friendly_name; + } + void set_friendly_name(std::string name) { + m_friendly_name = std::move(name); + } void set_loop_depth(size_t loop_depth) { m_config.m_loop_depth = loop_depth; } @@ -394,6 +400,8 @@ class LinearIR { // Size of static Buffer Scratchpad (Buffers with defined allocation size) size_t m_static_buffer_scratchpad_size = 0; + // Human-readable identifier; typically set from Subgraph node friendly name + std::string m_friendly_name; }; using LinearIRPtr = std::shared_ptr; using LinearIRCPtr = std::shared_ptr; diff --git a/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp b/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp index 6d264eef9abcdb..dccbeb58c38285 100644 --- a/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp +++ b/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp @@ -47,8 +47,9 @@ class LIRPassDump { auto pathAndName = debug_config.dumpLIR.dir + "/"; const auto nm_lower = ov::util::to_lower(debug_config.dumpLIR.name_modifier); if (nm_lower == std::string("subgraph_name")) { - if (!name_prefix.empty()) { - pathAndName += name_prefix + "_"; + const std::string effective_prefix = name_prefix.empty() ? linear_ir.get_friendly_name() : name_prefix; + if (!effective_prefix.empty()) { + pathAndName += effective_prefix + "_"; } } else if (!debug_config.dumpLIR.name_modifier.empty()) { pathAndName += debug_config.dumpLIR.name_modifier + "_"; @@ -92,4 +93,4 @@ class LIRPassDump { : nullptr #else # define SNIPPETS_DEBUG_LIR_PASS_DUMP(_linear_ir, _pass) -#endif // SNIPPETS_DEBUG_CAPS \ No newline at end of file +#endif // SNIPPETS_DEBUG_CAPS diff --git a/src/common/snippets/src/lowered/linear_ir_builder.cpp b/src/common/snippets/src/lowered/linear_ir_builder.cpp index ac460f79856d18..7744c26c360a8c 100644 --- a/src/common/snippets/src/lowered/linear_ir_builder.cpp +++ b/src/common/snippets/src/lowered/linear_ir_builder.cpp @@ -80,6 +80,7 @@ std::vector> clone_nodes(const std::vectorm_config = src->m_config; + dst->m_friendly_name = src->m_friendly_name; dst->m_expressions = clone_range(src->m_expressions.cbegin(), src->m_expressions.cend(), expression_map); for (const auto& expr : dst->m_expressions) { diff --git a/src/common/snippets/src/op/subgraph.cpp b/src/common/snippets/src/op/subgraph.cpp index d21f71a2fd8054..0bee81dd050ff7 100644 --- a/src/common/snippets/src/op/subgraph.cpp +++ b/src/common/snippets/src/op/subgraph.cpp @@ -415,6 +415,7 @@ std::shared_ptr Subgraph::convert_body_to_linear_ir( #endif // SNIPPETS_DEBUG_CAPS m_linear_ir = std::make_shared(body_ptr(), shape_infer_factory, lowering_config); + m_linear_ir->set_friendly_name(get_friendly_name()); m_shape_infer = m_linear_ir->get_shape_infer_instance(); return m_linear_ir; } From 40263a4f1e648f3f3dd941cf622f8d7b1d4abb84 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Mon, 15 Sep 2025 18:27:58 +0200 Subject: [PATCH 6/9] fmt --- src/common/snippets/include/snippets/lowered/linear_ir.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/snippets/include/snippets/lowered/linear_ir.hpp b/src/common/snippets/include/snippets/lowered/linear_ir.hpp index 6cfdcc1ec1ea89..775b1f8e7fd3fd 100644 --- a/src/common/snippets/include/snippets/lowered/linear_ir.hpp +++ b/src/common/snippets/include/snippets/lowered/linear_ir.hpp @@ -9,8 +9,8 @@ #include #include #include -#include #include +#include #include #include #include From 4b8944f996f771e9dd40c40326db668482dfe31c Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Tue, 16 Sep 2025 12:12:45 +0200 Subject: [PATCH 7/9] Remove name_prefix --- .../snippets/utils/linear_ir_pass_dumper.hpp | 13 ++++++------- src/common/snippets/src/op/subgraph.cpp | 10 +--------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp b/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp index dccbeb58c38285..57a79bfe49ebdd 100644 --- a/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp +++ b/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp @@ -22,11 +22,9 @@ class LIRPassDump { explicit LIRPassDump(const lowered::LinearIR& linear_ir, std::string pass_name, - std::string name_prefix = "", DumpMode mode = DumpMode::Both) : linear_ir(linear_ir), pass_name(std::move(pass_name)), - name_prefix(std::move(name_prefix)), dump_mode(mode), debug_config(*linear_ir.get_config().debug_config) { if (dump_mode == DumpMode::Both) { @@ -47,10 +45,12 @@ class LIRPassDump { auto pathAndName = debug_config.dumpLIR.dir + "/"; const auto nm_lower = ov::util::to_lower(debug_config.dumpLIR.name_modifier); if (nm_lower == std::string("subgraph_name")) { - const std::string effective_prefix = name_prefix.empty() ? linear_ir.get_friendly_name() : name_prefix; - if (!effective_prefix.empty()) { - pathAndName += effective_prefix + "_"; - } + auto name_prefix = linear_ir.get_friendly_name(); + // Replace '/' and ':' characters with '_' to ensure filesystem compatibility + // These characters are problematic in file paths + std::replace(name_prefix.begin(), name_prefix.end(), '/', '_'); + std::replace(name_prefix.begin(), name_prefix.end(), ':', '_'); + pathAndName += name_prefix + "_"; } else if (!debug_config.dumpLIR.name_modifier.empty()) { pathAndName += debug_config.dumpLIR.name_modifier + "_"; } @@ -75,7 +75,6 @@ class LIRPassDump { const lowered::LinearIR& linear_ir; const std::string pass_name; - const std::string name_prefix; const DumpMode dump_mode; const DebugCapsConfig& debug_config; }; diff --git a/src/common/snippets/src/op/subgraph.cpp b/src/common/snippets/src/op/subgraph.cpp index 0bee81dd050ff7..dac612429d6f69 100644 --- a/src/common/snippets/src/op/subgraph.cpp +++ b/src/common/snippets/src/op/subgraph.cpp @@ -630,15 +630,7 @@ snippets::Schedule Subgraph::generate(const void* compile_params) const { (std::find(dump_names.begin(), dump_names.end(), std::string("final")) != dump_names.end()) || (std::find(dump_names.begin(), dump_names.end(), std::string("all")) != dump_names.end()); if (dump_final) { - std::string name_prefix; - if (ov::util::to_lower(debug_conf.dumpLIR.name_modifier) == std::string("subgraph_name")) { - name_prefix = get_friendly_name(); - // Replace '/' and ':' characters with '_' to ensure filesystem compatibility - // These characters are problematic in file paths - std::replace(name_prefix.begin(), name_prefix.end(), '/', '_'); - std::replace(name_prefix.begin(), name_prefix.end(), ':', '_'); - } - LIRPassDump final_dump(*linear_ir, std::string("Final"), name_prefix, LIRPassDump::DumpMode::SingleDump); + LIRPassDump final_dump(*linear_ir, std::string("Final"), LIRPassDump::DumpMode::SingleDump); } #endif From b8e2ec293bb3f59ba405dcac957d443e00613d51 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Tue, 16 Sep 2025 12:18:58 +0200 Subject: [PATCH 8/9] fmt --- .../snippets/include/snippets/utils/linear_ir_pass_dumper.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp b/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp index 57a79bfe49ebdd..8c32fb29a48130 100644 --- a/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp +++ b/src/common/snippets/include/snippets/utils/linear_ir_pass_dumper.hpp @@ -20,9 +20,7 @@ class LIRPassDump { public: enum class DumpMode : uint8_t { Both, SingleDump }; - explicit LIRPassDump(const lowered::LinearIR& linear_ir, - std::string pass_name, - DumpMode mode = DumpMode::Both) + explicit LIRPassDump(const lowered::LinearIR& linear_ir, std::string pass_name, DumpMode mode = DumpMode::Both) : linear_ir(linear_ir), pass_name(std::move(pass_name)), dump_mode(mode), From b75c2ea78aa8c3dc979a960d7d8a5364bff0ae4a Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Tue, 16 Sep 2025 13:08:42 +0200 Subject: [PATCH 9/9] tidy --- src/common/snippets/src/op/subgraph.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/snippets/src/op/subgraph.cpp b/src/common/snippets/src/op/subgraph.cpp index dac612429d6f69..6d5e6d89f3c1ad 100644 --- a/src/common/snippets/src/op/subgraph.cpp +++ b/src/common/snippets/src/op/subgraph.cpp @@ -40,7 +40,6 @@ #include "openvino/opsets/opset1.hpp" #include "openvino/pass/constant_folding.hpp" #include "openvino/pass/pass_config.hpp" -#include "openvino/util/common_util.hpp" #include "snippets/generator.hpp" #include "snippets/itt.hpp" #include "snippets/lowered/expression.hpp"