EISW-204125 [OV EP] Update DumpOpenVINOEPModel to handle initializer data#960
Conversation
Expanded DumpOpenVINOEPModel to accept subgraph, logger, and initializer_data_in_proto flag. Now reconstructs and dumps a self-contained ONNX model when initializer data is omitted, ensuring standalone reloadability. Updated all call sites to pass new parameters.
There was a problem hiding this comment.
Pull request overview
Updates OpenVINO EP’s debug model dump helper to support cases where initializer data is intentionally omitted from the serialized ModelProto, enabling a reloadable debug .onnx dump.
Changes:
- Extends
DumpOpenVINOEPModelto acceptsubgraph,logger, and aninitializer_data_in_protoflag. - When initializer data is omitted (in-memory external data refs), reconstructs a dump-only model proto with initializer data included.
- Updates all call sites in
GetModelProtoFromFusedNodeto pass the new parameters/flag.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| std::fstream dump(model_name, std::ios::out | std::ios::trunc | std::ios::binary); | ||
| model_proto->SerializeToOstream(dump); | ||
| // When initializer data was omitted from the proto (ORT_MEM_ADDR references), build a | ||
| // self-contained proto for the dump so the saved .onnx file can be reloaded standalone. |
There was a problem hiding this comment.
The comment says the dump is "self-contained" and can be "reloaded standalone", but this path only guarantees removing in-memory ORT_MEM_ADDR external-data references. If the original model uses file-based external initializers (data_location=EXTERNAL), the dumped model may still depend on external files. Consider clarifying the comment (or explicitly inlining file-based external initializer data if true standalone reloadability is required).
| // self-contained proto for the dump so the saved .onnx file can be reloaded standalone. | |
| // proto for the dump that inlines those initializers so the saved .onnx file does not | |
| // depend on ORT_MEM_ADDR indirections. Note: models that use file-based external | |
| // initializers (data_location=EXTERNAL) may still depend on external files. |
|
Change does not impact release builds. |
Expanded DumpOpenVINOEPModel to accept subgraph, logger, and initializer_data_in_proto flag. Now reconstructs and dumps a self-contained ONNX model when initializer data is omitted, ensuring standalone reloadability. Updated all call sites to pass new parameters.
Related to: https://jira.devtools.intel.com/browse/EISW-204125
Note: only impacts non-release builds.