Skip to content

Commit a54d529

Browse files
Fix concurrency issue with iterator invalidation
1 parent b258ed0 commit a54d529

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

src/plugins/intel_npu/src/plugin/npuw/base_sync_infer_request.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ class IBaseInferRequest : public ov::ISyncInferRequest {
104104
mutable std::map<ov::Output<const ov::Node>, TensorStorage>
105105
m_port_to_tensor; // mutable due to lazy I/O allocation in get_tensor()
106106

107+
// Have to reserve size of all structures modified by get_tensor(),
108+
// otherwise iterators get invalid during parallel loops.
109+
// FIXME: too much details we have to keep in mind - consider a better solution
110+
void reserve_for_lazy_io();
111+
107112
// Check that m_port_to_tensor does have a tensor stored at the port
108113
bool is_stored(const ov::Output<const ov::Node>& port) const;
109114
// Check the port is I/O

src/plugins/intel_npu/src/plugin/npuw/just_sync_infer_request.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ ov::npuw::JustInferRequest::JustInferRequest(const std::shared_ptr<ov::npuw::Com
326326
}
327327
} // if(function_pipelining)
328328

329+
reserve_for_lazy_io();
329330
alloc_quant_gather();
330331
connect_subrequests();
331332
init_gio();

src/plugins/intel_npu/src/plugin/npuw/unfold_sync_infer_request.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ ov::npuw::UnfoldInferRequest::UnfoldInferRequest(const std::shared_ptr<ov::npuw:
4343
LOG_INFO("DONE");
4444
} // for(submodels)
4545

46+
reserve_for_lazy_io();
4647
alloc_quant_gather();
4748

4849
LOG_INFO("Connecting subrequests...");

0 commit comments

Comments
 (0)