Skip to content

Commit c0650a0

Browse files
[NPUW] Fix for weights bank UIDs (openvinotoolkit#28297)
Previous PR openvinotoolkit#28282
1 parent fd29e26 commit c0650a0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ int64_t Bank::registerLT(const LazyTensor& tensor, const std::string& device) {
4141
std::lock_guard<std::mutex> guard(m_mutex);
4242

4343
auto& device_bank = m_device_banks[device_for_alloc];
44+
std::unique_lock dev_guard(device_bank.mutex);
45+
4446
auto iter_registered = device_bank.registered_tensors.find(tensor);
4547
if (iter_registered == device_bank.registered_tensors.end()) {
4648
auto uid = uid_count++;
@@ -79,10 +81,14 @@ void Bank::evaluate_and_allocate() {
7981
auto& device_bank = bank.second;
8082

8183
std::vector<LazyTensor> vec;
84+
85+
std::unique_lock storage_guard(device_bank.mutex);
8286
vec.reserve(device_bank.storage.size());
8387
for (const auto& el : device_bank.storage) {
8488
vec.push_back(el.second.lt);
8589
}
90+
storage_guard.unlock();
91+
8692
ov::parallel_for(vec.size(), [&](std::size_t idx) {
8793
const auto& lt = vec[idx];
8894
std::unique_lock dev_guard(device_bank.mutex);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Bank {
2929
// Register LazyTensor in a bank if it's not there. Returns LazyTensor's unique id
3030
int64_t registerLT(const LazyTensor& tensor, const std::string& device);
3131

32-
// Allocate and evaluate a registered tensor on a specified device (if needed) and return it from the bank
32+
// Get registered, allocated and evaluated tensor on a specified device
3333
ov::Tensor get(int64_t uid, const std::string& device);
3434

3535
// Evaluate and allocate all LazyTensors in the bank

0 commit comments

Comments
 (0)