Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[NPU] Don't try to destroy the graph twice (#35990)

Bogdan Pereanu28bc5d78ed26
diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/weightless_graph.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/weightless_graph.cpp
index 1ede7e134e1..1e46fc409b2 100644
--- a/src/plugins/intel_npu/src/compiler_adapter/src/weightless_graph.cpp
+++ b/src/plugins/intel_npu/src/compiler_adapter/src/weightless_graph.cpp
@@ -593,19 +593,25 @@ void WeightlessGraph::release_init_blob(const size_t initIndex) {
}
void WeightlessGraph::release_graphs() {
- size_t initIndex = 0;
if (_zeGraphExt != nullptr) {
for (auto& initGraphDesc : _initsGraphDesc) {
- _zeGraphExt->destroyGraph(initGraphDesc);
+ if (initGraphDesc._handle) {
+ _zeGraphExt->destroyGraph(initGraphDesc);
+ }
+ }
+
+ _wgLogger.debug("Init graphs are destroyed");
+ }
- if (!_blobIsPersistent && _initBlobs != std::nullopt && _initBlobs->at(initIndex)) {
+ if (!_blobIsPersistent && _initBlobs != std::nullopt) {
+ for (size_t initIndex = 0; initIndex < _initBlobs->size(); ++initIndex) {
+ if (_initBlobs->at(initIndex)) {
_initBlobs->at(initIndex) = ov::Tensor();
}
-
- initIndex++;
}
+
+ _wgLogger.debug("Init blobs are released");
}
- _wgLogger.debug("Init graphs are destroyed");
}
WeightlessGraph::~WeightlessGraph() {