-
Notifications
You must be signed in to change notification settings - Fork 3k
[NPUW] Add subgraph composition dump (.sg) support #33876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
e065500 to
c221f5e
Compare
dmatveev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for the first PR! Here's some comments though.
- Is the PR description up to date? I belive there's no mentioned option in place now?
- I believe you're familiar now with the attention mechanisms and the way we handle it, would your schema reflect such structure with e.g. a PYRAMID hint? How would it look like?
| if (subgraph_counts.find(name) == subgraph_counts.end()) { | ||
| subgraph_order.push_back(name); | ||
| } | ||
| subgraph_counts[name]++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I believe you're counting by name(s) which you synthesize yourself based on real_id.. Are you sure these names match the subgraph names as we dump them? What I see here you reconstruct the same format but if it changes during the dump procedure well'get a discrepancy
Don't we have this name specified as the subgraph's ov::Model's friendly_name? I don't remember.
Probably it makes sense to:
- Introduce a tiny helper method here to format you a subgraph name - the way it'll be dumped - and use it in both places
- Simplify the counting method - you can just traverse through orderedSubgraphs and collect their
.replaced_by()to a set. This set will give you a list of uniqe subgraphs.. so then you iterate over it again and poll their names
ab4a46e to
84bb68f
Compare
047b116 to
29f2f2a
Compare
Introduces the NPUW_DUMP_SUBS_COMPOSITION configuration option. When enabled, generates a JSON file (.sg) containing the pipeline structure, including unique subgraphs and their repetitions. Also adds NPUW_DUMP_SUBS_DIR option to specify output directory.
Remove dedicated NPUW_DUMP_SUBS_COMPOSITION option. The .sg file is now automatically generated whenever subgraphs are dumped via NPUW_DUMP_SUBS. Remove unnecessary "./" prefix from subgraph paths in the JSON output.
Refactor path construction in dump_subgraph_model and dump_subgraph_composition to use ov::util::join_path instead of manual string with dir_prefix.
- Reorder includes alphabetically (fstream before iostream) - Fix indentation alignment for multi-line statements
- Introduce format_subgraph_name() helper to ensure consistent naming - Simplify dump_subgraph_composition() to use replaced_by() for unique subgraphs - Update all dump paths to use the helper method
…FA logic - Use format_subgraph_name helper for consistent naming - Always use first occurrence's id for subgraph names (matches dump) - Optimize counting of subgraph repetitions (single-pass) - Fix MoE early-return logic: pyramid/HFA files only listed when MoE is NOT present - Add clarifying comments about naming, ordering, and dump logic - Ensure composition file matches actual dumped files
29f2f2a to
f71964b
Compare
Introduces the NPUW_DUMP_SUBS_DIR configuration option for specifying NPUW dump directory. When NPUW_DUMP_SUBS is enabled, the plugin will now generate JSON files (.sg format) containing the pipeline structure, including unique subgraphs and their repetitions.
Details:
Tickets: