Skip to content

Commit 8b8ccfb

Browse files
committed
Export init and main separately
1 parent 72477a4 commit 8b8ccfb

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

src/plugins/intel_npu/src/plugin/include/compiled_model.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class CompiledModel final : public ICompiledModel {
7979
std::map<std::string, std::tuple<bool, ov::PropertyMutability, std::function<ov::Any(const Config&)>>> _properties;
8080
std::vector<ov::PropertyName> _supportedProperties;
8181

82+
// mutable bool exportInitFlag = false;
8283
std::shared_ptr<IGraph> _graph;
8384
std::shared_ptr<IGraph> _initGraph;
8485
std::shared_ptr<ov::Model> _initModel;

src/plugins/intel_npu/src/plugin/src/compiled_model.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ void CompiledModel::export_model(std::ostream& stream) const {
131131
size_t blobSizeBeforeVersioning = _graph->export_blob(stream);
132132
auto meta = Metadata<CURRENT_METADATA_VERSION>(blobSizeBeforeVersioning, ov::get_openvino_version().buildNumber);
133133
meta.write(stream);
134+
135+
// DEBUG EXPORT
136+
// if (!exportInitFlag) {
137+
// _graph->export_blob(stream);
138+
// exportInitFlag = true;
139+
// } else {
140+
// _initGraph->export_blob(stream);
141+
// }
134142
}
135143

136144
std::shared_ptr<const ov::Model> CompiledModel::get_runtime_model() const {

src/plugins/intel_npu/tools/compile_tool/main.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,20 @@ int main(int argc, char* argv[]) {
467467
std::cout << "Writing into file - " << outputName << std::endl;
468468
compiledModel.export_model(outputFile);
469469
}
470+
471+
// DEBUG EXPORT
472+
// {
473+
// std::string outputInitName = outputName.substr(0, outputName.size()-5) + "_init.blob";
474+
// std::ofstream outputInitFile{outputInitName, std::ios::out | std::ios::binary};
475+
// if (!outputInitFile.is_open()) {
476+
// std::cout << "Outputting file " << outputInitName << " can't be opened for writing" << std::endl;
477+
// return EXIT_FAILURE;
478+
// } else {
479+
// std::cout << "Writing into file - " << outputInitName << std::endl;
480+
// compiledModel.export_model(outputInitFile);
481+
// }
482+
// }
483+
470484
std::cout << "Done. LoadNetwork time elapsed: " << loadNetworkTimeElapsed.count() << " ms" << std::endl;
471485
} catch (const std::exception& error) {
472486
std::cerr << error.what() << std::endl;

0 commit comments

Comments
 (0)