Skip to content

Commit 07be1a2

Browse files
committed
fix comments2
1 parent 7de605e commit 07be1a2

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/plugins/intel_npu/src/compiler_adapter/include/compiler_impl.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#pragma once
66

77
#include <memory>
8+
#include <mutex>
89

910
#include "compiler.h"
1011
#include "intel_npu/common/filtered_config.hpp"
@@ -23,7 +24,15 @@ class VCLCompilerImpl final : public intel_npu::ICompiler {
2324
~VCLCompilerImpl() override;
2425

2526
static std::shared_ptr<VCLCompilerImpl> getInstance() {
26-
static std::weak_ptr<VCLCompilerImpl> compiler = std::make_shared<VCLCompilerImpl>();
27+
static std::mutex mutex;
28+
static std::weak_ptr<VCLCompilerImpl> weak_compiler;
29+
30+
std::lock_guard<std::mutex> lock(mutex);
31+
auto compiler = weak_compiler.lock();
32+
if (!compiler) {
33+
compiler = std::make_shared<VCLCompilerImpl>();
34+
weak_compiler = compiler;
35+
}
2736
return compiler;
2837
}
2938

src/plugins/intel_npu/src/compiler_adapter/src/compiler_impl.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,10 +615,12 @@ ov::SupportedOpsMap VCLCompilerImpl::query(const std::shared_ptr<const ov::Model
615615

616616
if (useBaseModelSerializer) {
617617
_logger.debug("serialize IR is base method, useBaseModelSerializer is %d", useBaseModelSerializer);
618-
std::cout << "1) serialize IR is base method (copy weights), useBaseModelSerializer is " << useBaseModelSerializer << std::endl;
618+
std::cout << "1) serialize IR is base method (copy weights), useBaseModelSerializer is "
619+
<< useBaseModelSerializer << std::endl;
619620
} else {
620621
_logger.debug("serialize IR is vcl method, useBaseModelSerializer is %d", useBaseModelSerializer);
621-
std::cout << "2) serialize IR is vcl method(No copy weights), useBaseModelSerializer is " << useBaseModelSerializer << std::endl;
622+
std::cout << "2) serialize IR is vcl method(No copy weights), useBaseModelSerializer is "
623+
<< useBaseModelSerializer << std::endl;
622624

623625
// To resolve the issue with the default configuration where no user passes the serializer config, the VCL
624626
// serializer will be used as the default in the plugin adapter. You need to pass the serializer config;

0 commit comments

Comments
 (0)