Skip to content

Commit 0eb39d1

Browse files
committed
fix lib
1 parent f889eeb commit 0eb39d1

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class VCLCompilerImpl final : public intel_npu::ICompiler {
4343

4444
bool is_option_supported(const std::string& option, std::optional<std::string> optValue = std::nullopt) const;
4545

46-
std::shared_ptr<void> getLinkedLibrary() const;
46+
static std::shared_ptr<void> getLinkedLibrary();
4747

4848
private:
4949
vcl_log_handle_t _logHandle = nullptr;

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

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,16 @@ const std::shared_ptr<VCLCompilerImpl> VCLCompilerImpl::getInstance() {
259259

260260
VCLCompilerImpl::VCLCompilerImpl() : _logHandle(nullptr), _logger("VCLCompilerImpl", ov::log::Level::DEBUG) {
261261
_logger.debug("VCLCompilerImpl constructor start");
262+
const char* env_var = std::getenv("MY_ENV_VAR");
262263

263-
// Load VCL library
264-
(void)VCLApi::getInstance();
264+
if (env_var != nullptr) {
265+
std::cout << "MY_ENV_VAR is set." << std::endl;
266+
(void)VCLApi::getInstance();
267+
} else {
268+
std::cout << "MY_ENV_VAR is not set." << std::endl;
269+
}
270+
// // Load VCL library
271+
// (void)VCLApi::getInstance();
265272

266273
// Initialize the VCL API
267274
THROW_ON_FAIL_FOR_VCL("vclGetVersion", vclGetVersion(&_vclVersion, &_vclProfilingVersion), nullptr);
@@ -318,7 +325,21 @@ VCLCompilerImpl::~VCLCompilerImpl() {
318325
_logger.info("VCL Compiler destroyed successfully");
319326
}
320327

321-
std::shared_ptr<void> VCLCompilerImpl::getLinkedLibrary() const {
328+
// const std::shared_ptr<VCLCompilerImpl> VCLCompilerImpl::getInstance() {
329+
// static std::mutex mutex;
330+
// static std::weak_ptr<VCLCompilerImpl> weak_compiler;
331+
332+
// std::lock_guard<std::mutex> lock(mutex);
333+
// auto compiler = weak_compiler.lock();
334+
// if (!compiler) {
335+
// compiler = std::make_shared<VCLCompilerImpl>();
336+
// weak_compiler = compiler;
337+
// }
338+
// return compiler;
339+
// }
340+
341+
std::shared_ptr<void> VCLCompilerImpl::getLinkedLibrary() {
342+
std::cout << "=========> VCLCompilerImpl::getLinkedLibrary()" << std::endl;
322343
return VCLApi::getInstance()->getLibrary();
323344
}
324345

src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ PluginCompilerAdapter::PluginCompilerAdapter(const std::shared_ptr<ZeroInitStruc
7474

7575
_logger.info("Loading PLUGIN compiler");
7676
try {
77+
auto vclLib = VCLCompilerImpl::getLinkedLibrary();
7778
auto vclCompilerPtr = VCLCompilerImpl::getInstance();
78-
auto vclLib = vclCompilerPtr->getLinkedLibrary();
79+
//auto vclCompilerPtr = vclCompilerPtr->getInstance();
7980
_logger.info("PLUGIN VCL compiler is loading");
8081
if (vclCompilerPtr && vclLib) {
8182
_compiler = ov::SoPtr<intel_npu::ICompiler>(vclCompilerPtr, vclLib);

0 commit comments

Comments
 (0)