diff --git a/src/plugins/intel_npu/src/al/include/intel_npu/al/config/common.hpp b/src/plugins/intel_npu/src/al/include/intel_npu/al/config/common.hpp index d88e35bff4096c..814764b77ff4fc 100644 --- a/src/plugins/intel_npu/src/al/include/intel_npu/al/config/common.hpp +++ b/src/plugins/intel_npu/src/al/include/intel_npu/al/config/common.hpp @@ -142,7 +142,11 @@ struct LOG_LEVEL final : OptionBase { } static ov::log::Level defaultValue() { - return ov::log::Level::NO; +#if defined(NPU_PLUGIN_DEVELOPER_BUILD) || !defined(NDEBUG) + return ov::log::Level::WARNING; +#else + return ov::log::Level::ERR; +#endif } }; diff --git a/src/plugins/intel_npu/src/al/include/npu.hpp b/src/plugins/intel_npu/src/al/include/npu.hpp index f2d4006368af84..b501c1727c4e32 100644 --- a/src/plugins/intel_npu/src/al/include/npu.hpp +++ b/src/plugins/intel_npu/src/al/include/npu.hpp @@ -43,6 +43,8 @@ class IEngineBackend : public std::enable_shared_from_this { virtual void registerOptions(OptionsDesc& options) const; /** @brief Get Level Zero context*/ virtual void* getContext() const; + /** @brief Update backend and device info */ + virtual void updateInfo(const Config& config) = 0; protected: virtual ~IEngineBackend() = default; @@ -83,6 +85,8 @@ class IDevice : public std::enable_shared_from_this { const std::shared_ptr& executor, const Config& config) = 0; + virtual void updateInfo(const Config& config) = 0; + virtual ov::SoPtr createRemoteTensor( std::shared_ptr context, const ov::element::Type& element_type, diff --git a/src/plugins/intel_npu/src/backend/include/zero_backend.hpp b/src/plugins/intel_npu/src/backend/include/zero_backend.hpp index 52745c962370fa..2dcc5c85a434be 100644 --- a/src/plugins/intel_npu/src/backend/include/zero_backend.hpp +++ b/src/plugins/intel_npu/src/backend/include/zero_backend.hpp @@ -29,6 +29,7 @@ class ZeroEngineBackend final : public IEngineBackend { bool isCommandQueueExtSupported() const override; void* getContext() const override; + void updateInfo(const Config& config) override; private: std::shared_ptr _instance; diff --git a/src/plugins/intel_npu/src/backend/include/zero_device.hpp b/src/plugins/intel_npu/src/backend/include/zero_device.hpp index fc4ac58f7643c5..9b2234c786557e 100644 --- a/src/plugins/intel_npu/src/backend/include/zero_device.hpp +++ b/src/plugins/intel_npu/src/backend/include/zero_device.hpp @@ -37,6 +37,9 @@ class ZeroDevice : public IDevice { std::shared_ptr createInferRequest(const std::shared_ptr& compiledModel, const std::shared_ptr& executor, const Config& config) override; + void updateInfo(const Config& config) override { + log.setLevel(config.get()); + } ov::SoPtr createRemoteTensor( std::shared_ptr context, diff --git a/src/plugins/intel_npu/src/backend/src/zero_backend.cpp b/src/plugins/intel_npu/src/backend/src/zero_backend.cpp index 761fb41504d2d5..2911f89cd6bb21 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_backend.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_backend.cpp @@ -11,9 +11,8 @@ namespace intel_npu { -ZeroEngineBackend::ZeroEngineBackend(const Config& config) : _logger("ZeroEngineBackend", config.get()) { +ZeroEngineBackend::ZeroEngineBackend(const Config& config) : _logger("ZeroEngineBackend", Logger::global().level()) { _logger.debug("ZeroEngineBackend - initialize started"); - Logger::global().setLevel(config.get()); _instance = std::make_shared(); @@ -69,4 +68,13 @@ void* ZeroEngineBackend::getContext() const { return _instance->getContext(); } +void ZeroEngineBackend::updateInfo(const Config& config) { + _logger.setLevel(config.get()); + if (_devices.size() > 0) { + for (auto& dev : _devices) { + dev.second->updateInfo(config); + } + } +} + } // namespace intel_npu diff --git a/src/plugins/intel_npu/src/backend/src/zero_executor.cpp b/src/plugins/intel_npu/src/backend/src/zero_executor.cpp index 9f2d5fcbf2e10a..16e410c35ed382 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_executor.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_executor.cpp @@ -49,7 +49,7 @@ ZeroExecutor::ZeroExecutor(const std::shared_ptr& i _initStructs->getCommandQueueDdiTable(), _config, group_ordinal)}} { - _logger.debug("ZeroExecutor::ZeroExecutor - create graph_command_list"); + _logger.debug("ZeroExecutor::ZeroExecutor init start - create graph_command_list"); OV_ITT_SCOPED_TASK(itt::domains::LevelZeroBackend, "Executor::ZeroExecutor"); CommandList graph_command_list(_initStructs->getDevice(), _initStructs->getContext(), diff --git a/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp b/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp index fdda6083d0bc6d..7c36033568591a 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp @@ -64,12 +64,12 @@ std::optional getBatchSizeForNode(const IONodeDescriptor& nodeDescriptor Logger logger("GetBatchSizeForNode", Logger::global().level()); if (nodeDescriptor.originalShape.rank().get_length() == 0) { - logger.info("Networks with empty shapes are not supported when batching is handled by the plugin"); + logger.warning("Networks with empty shapes are not supported when batching is handled by the plugin"); return std::nullopt; } if (nodeDescriptor.originalShape.is_dynamic()) { - logger.info("Dynamic networks are not supported when batching is handled by the plugin"); + logger.warning("Dynamic networks are not supported when batching is handled by the plugin"); return std::nullopt; } @@ -546,6 +546,7 @@ void ZeroInferRequest::infer_async() { void ZeroInferRequest::get_result() { OV_ITT_TASK_CHAIN(ZERO_RESULT, itt::domains::LevelZeroBackend, "get_result", "pull"); + _logger.debug("InferRequest::get_result start"); for (size_t i = 0; i < _batchSize; i++) { _pipeline->pull(i); @@ -641,7 +642,7 @@ std::vector ZeroInferRequest::get_profiling_info() const { const auto& compiledModel = *std::dynamic_pointer_cast(_compiledModel); const auto& compilerConfig = compiledModel.get_config(); if (!compilerConfig.get() || !_config.get()) { - _logger.debug("InferRequest::get_profiling_info complete with empty {}."); + _logger.warning("InferRequest::get_profiling_info complete with empty {}."); return {}; } diff --git a/src/plugins/intel_npu/src/backend/src/zero_init.cpp b/src/plugins/intel_npu/src/backend/src/zero_init.cpp index b7f40d807e2ed1..029ab6d8bccf59 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_init.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_init.cpp @@ -121,10 +121,10 @@ ZeroInitStructsHolder::ZeroInitStructsHolder() : log("NPUZeroInitStructsHolder", ZE_MAJOR_VERSION(ze_drv_api_version)); } if (ZE_MINOR_VERSION(ZE_API_VERSION_CURRENT) != ZE_MINOR_VERSION(ze_drv_api_version)) { - log.debug("Some features might not be available! " - "Plugin L0 API minor version = %d, Driver L0 API minor version = %d", - ZE_MINOR_VERSION(ZE_API_VERSION_CURRENT), - ZE_MINOR_VERSION(ze_drv_api_version)); + log.warning("Some features might not be available! " + "Plugin L0 API minor version = %d, Driver L0 API minor version = %d", + ZE_MINOR_VERSION(ZE_API_VERSION_CURRENT), + ZE_MINOR_VERSION(ze_drv_api_version)); } uint32_t count = 0; @@ -141,12 +141,12 @@ ZeroInitStructsHolder::ZeroInitStructsHolder() : log("NPUZeroInitStructsHolder", log.debug("ZeroInitStructsHolder - tie output of queryDriverExtensionVersion"); std::tie(driver_ext_version, graph_ext_name) = queryDriverExtensionVersion(extProps, count); - log.debug("Found Driver Version %d.%d, Driver Extension Version %d.%d (%s)", - ZE_MAJOR_VERSION(ze_drv_api_version), - ZE_MINOR_VERSION(ze_drv_api_version), - ZE_MAJOR_VERSION(driver_ext_version), - ZE_MINOR_VERSION(driver_ext_version), - graph_ext_name.c_str()); + log.info("Found Driver Version %d.%d, Driver Extension Version %d.%d (%s)", + ZE_MAJOR_VERSION(ze_drv_api_version), + ZE_MINOR_VERSION(ze_drv_api_version), + ZE_MAJOR_VERSION(driver_ext_version), + ZE_MINOR_VERSION(driver_ext_version), + graph_ext_name.c_str()); // Load our command queue extension try { diff --git a/src/plugins/intel_npu/src/compiler/include/driver_compiler_adapter.hpp b/src/plugins/intel_npu/src/compiler/include/driver_compiler_adapter.hpp index bbe61c57e012cb..b405114c9c1b19 100644 --- a/src/plugins/intel_npu/src/compiler/include/driver_compiler_adapter.hpp +++ b/src/plugins/intel_npu/src/compiler/include/driver_compiler_adapter.hpp @@ -39,7 +39,7 @@ class LevelZeroCompilerAdapter final : public ICompiler { */ std::shared_ptr apiAdapter; ze_driver_handle_t _driverHandle = nullptr; - mutable Logger _logger; + Logger _logger; }; } // namespace driverCompilerAdapter diff --git a/src/plugins/intel_npu/src/compiler/include/zero_compiler_in_driver.hpp b/src/plugins/intel_npu/src/compiler/include/zero_compiler_in_driver.hpp index 24ccf0353f7c0a..aff4deb0c29d17 100644 --- a/src/plugins/intel_npu/src/compiler/include/zero_compiler_in_driver.hpp +++ b/src/plugins/intel_npu/src/compiler/include/zero_compiler_in_driver.hpp @@ -184,7 +184,7 @@ class LevelZeroCompilerInDriver final : public ICompiler { ze_context_handle_t _context = nullptr; TableExtension* _graphDdiTableExt = nullptr; - mutable Logger _logger; + Logger _logger; }; template diff --git a/src/plugins/intel_npu/src/compiler/src/driver_compiler_adapter.cpp b/src/plugins/intel_npu/src/compiler/src/driver_compiler_adapter.cpp index 88fe7ee3edc459..e9fee3d9ee2f2a 100644 --- a/src/plugins/intel_npu/src/compiler/src/driver_compiler_adapter.cpp +++ b/src/plugins/intel_npu/src/compiler/src/driver_compiler_adapter.cpp @@ -15,7 +15,7 @@ namespace intel_npu { namespace driverCompilerAdapter { LevelZeroCompilerAdapter::LevelZeroCompilerAdapter() : _logger("LevelZeroCompilerAdapter", Logger::global().level()) { - _logger.debug("initialize zeAPI"); + _logger.debug("initialize zeAPI start"); auto result = zeInit(ZE_INIT_FLAG_VPU_ONLY); if (ZE_RESULT_SUCCESS != result) { OPENVINO_THROW("L0 initialize zeAPI", @@ -175,6 +175,7 @@ LevelZeroCompilerAdapter::LevelZeroCompilerAdapter() : _logger("LevelZeroCompile apiAdapter = std::make_shared>(graphExtName, _driverHandle); } + _logger.debug("initialize zeAPI end"); } uint32_t LevelZeroCompilerAdapter::getSupportedOpsetVersion() const { @@ -183,21 +184,18 @@ uint32_t LevelZeroCompilerAdapter::getSupportedOpsetVersion() const { NetworkDescription LevelZeroCompilerAdapter::compile(const std::shared_ptr& model, const Config& config) const { - _logger.setLevel(config.get()); - _logger.debug("compile"); + _logger.debug("compile start"); return apiAdapter->compile(model, config); } ov::SupportedOpsMap LevelZeroCompilerAdapter::query(const std::shared_ptr& model, const Config& config) const { - _logger.setLevel(config.get()); - _logger.debug("query"); + _logger.debug("query start"); return apiAdapter->query(model, config); } NetworkMetadata LevelZeroCompilerAdapter::parse(const std::vector& network, const Config& config) const { - _logger.setLevel(config.get()); - _logger.debug("parse"); + _logger.debug("parse start"); return apiAdapter->parse(network, config); } diff --git a/src/plugins/intel_npu/src/compiler/src/zero_compiler_in_driver.cpp b/src/plugins/intel_npu/src/compiler/src/zero_compiler_in_driver.cpp index c61d5ab0760ac3..3305c527c2966d 100644 --- a/src/plugins/intel_npu/src/compiler/src/zero_compiler_in_driver.cpp +++ b/src/plugins/intel_npu/src/compiler/src/zero_compiler_in_driver.cpp @@ -240,7 +240,7 @@ LevelZeroCompilerInDriver::~LevelZeroCompilerInDriver() { if (_context) { auto result = zeContextDestroy(_context); if (ZE_RESULT_SUCCESS != result) { - _logger.warning("zeContextDestroy failed %#X", uint64_t(result)); + _logger.error("zeContextDestroy failed %#X", uint64_t(result)); } } _logger.debug("LevelZeroCompilerInDriver obj destroyed"); @@ -558,7 +558,7 @@ template > std::unordered_set LevelZeroCompilerInDriver::queryImpl( const std::shared_ptr& /*model*/, const Config&) const { - _logger.debug("queryImpl - Driver version is less than 1.3, queryNetwork is unsupported."); + _logger.info("queryImpl - Driver version is less than 1.3, queryNetwork is unsupported."); return std::unordered_set(); } @@ -568,7 +568,7 @@ template > std::unordered_set LevelZeroCompilerInDriver::queryImpl( const std::shared_ptr& model, const Config& config) const { - _logger.debug("queryImpl - Calling queryNetwork of 1.3 version."); + _logger.info("queryImpl - Calling queryNetwork of 1.3 version."); ze_device_graph_properties_t deviceGraphProperties{}; auto result = _graphDdiTableExt->pfnDeviceGetGraphProperties(_deviceHandle, &deviceGraphProperties); @@ -700,15 +700,13 @@ std::unordered_set LevelZeroCompilerInDriver::getQu template ov::SupportedOpsMap LevelZeroCompilerInDriver::query(const std::shared_ptr& model, const Config& config) const { - _logger.setLevel(config.get()); - _logger.debug("query"); + _logger.debug("query start"); ov::SupportedOpsMap result; const std::string deviceName = "NPU"; try { const auto supportedLayers = queryImpl(model, config); - ; for (auto&& layerName : supportedLayers) { result.emplace(layerName, deviceName); } @@ -763,8 +761,7 @@ ze_result_t LevelZeroCompilerInDriver::createGraph(const ze_grap template NetworkDescription LevelZeroCompilerInDriver::compile(const std::shared_ptr& model, const Config& config) const { - _logger.setLevel(config.get()); - _logger.debug("compile"); + _logger.debug("compile start"); ze_device_graph_properties_t deviceGraphProperties{}; auto result = _graphDdiTableExt->pfnDeviceGetGraphProperties(_deviceHandle, &deviceGraphProperties); @@ -865,8 +862,6 @@ template NetworkMetadata LevelZeroCompilerInDriver::parse(const std::vector& network, const Config& config) const { OV_ITT_TASK_CHAIN(PARSE_BLOB, itt::domains::NPUPlugin, "LevelZeroCompilerInDriver::parse", "desc"); - _logger.setLevel(config.get()); - _logger.debug("getNetworkMeta"); ze_graph_handle_t graphHandle; if (!network.empty()) { @@ -909,12 +904,14 @@ NetworkMetadata LevelZeroCompilerInDriver::parse(const std::vect uint64_t(result)); } + _logger.debug("parse end"); return networkMeta; } template uint32_t LevelZeroCompilerInDriver::getSupportedOpsetVersion() const { - _logger.debug("getSupportedOpsetVersion"); + _logger.debug("getSupportedOpsetVersion start"); + ze_device_graph_properties_t graphProperties; auto result = _graphDdiTableExt->pfnDeviceGetGraphProperties(_deviceHandle, &graphProperties); @@ -929,6 +926,7 @@ uint32_t LevelZeroCompilerInDriver::getSupportedOpsetVersion() c } const auto maxOpsetVersion = graphProperties.maxOVOpsetVersionSupported; _logger.info("getSupportedOpsetVersion Max supported version of opset in CiD: %d", maxOpsetVersion); + _logger.debug("getSupportedOpset end"); return maxOpsetVersion; } @@ -1144,7 +1142,7 @@ NetworkMetadata LevelZeroCompilerInDriver::getNetworkMeta(ze_gra template template > std::string LevelZeroCompilerInDriver::getLatestBuildError() const { - _logger.debug("getLatestBuildError()"); + _logger.debug("getLatestBuildError start"); // Get log size uint32_t size = 0; @@ -1173,6 +1171,7 @@ std::string LevelZeroCompilerInDriver::getLatestBuildError() con "content of latest error log!"); return ""; } + _logger.debug("getLatestBuildError end"); return logContent; } diff --git a/src/plugins/intel_npu/src/plugin/include/compiler.hpp b/src/plugins/intel_npu/src/plugin/include/compiler.hpp index dbfe08580979d2..65982ada17d471 100644 --- a/src/plugins/intel_npu/src/plugin/include/compiler.hpp +++ b/src/plugins/intel_npu/src/plugin/include/compiler.hpp @@ -13,6 +13,6 @@ namespace intel_npu { -ov::SoPtr createCompiler(ov::intel_npu::CompilerType compilerType, const Logger& log); +ov::SoPtr createCompiler(ov::intel_npu::CompilerType compilerType); } // namespace intel_npu diff --git a/src/plugins/intel_npu/src/plugin/include/plugin.hpp b/src/plugins/intel_npu/src/plugin/include/plugin.hpp index 10f48d90ab4367..360dd0adaf4d1d 100644 --- a/src/plugins/intel_npu/src/plugin/include/plugin.hpp +++ b/src/plugins/intel_npu/src/plugin/include/plugin.hpp @@ -61,7 +61,7 @@ class Plugin : public ov::IPlugin { std::map _config; std::shared_ptr _options; Config _globalConfig; - Logger _logger; + mutable Logger _logger; std::unique_ptr _metrics; // properties map: {name -> [supported, mutable, eval function]} diff --git a/src/plugins/intel_npu/src/plugin/src/backends.cpp b/src/plugins/intel_npu/src/plugin/src/backends.cpp index d5e6da4370ac1d..7ad5b13ef30937 100644 --- a/src/plugins/intel_npu/src/plugin/src/backends.cpp +++ b/src/plugins/intel_npu/src/plugin/src/backends.cpp @@ -109,7 +109,7 @@ NPUBackends::NPUBackends(const std::vector& backendRegistry, } #endif } catch (const std::exception& ex) { - _logger.error("Got an error during backend '%s' loading : %s", backendName.c_str(), ex.what()); + _logger.warning("Got an error during backend '%s' loading : %s", backendName.c_str(), ex.what()); } catch (...) { _logger.error("Got an unknown error during backend '%s' loading", backendName.c_str()); } @@ -217,6 +217,9 @@ void* NPUBackends::getContext() const { // TODO config should be also specified to backends, to allow use logging in devices and all levels below void NPUBackends::setup(const Config& config) { _logger.setLevel(config.get()); + if (_backend != nullptr) { + _backend->updateInfo(config); + } } std::string NPUBackends::getCompilationPlatform(const std::string_view platform, const std::string& deviceId) const { diff --git a/src/plugins/intel_npu/src/plugin/src/compiled_model.cpp b/src/plugins/intel_npu/src/plugin/src/compiled_model.cpp index 0f0ef23dfcbc11..d584c62704fbf9 100644 --- a/src/plugins/intel_npu/src/plugin/src/compiled_model.cpp +++ b/src/plugins/intel_npu/src/plugin/src/compiled_model.cpp @@ -130,6 +130,11 @@ std::shared_ptr CompiledModel::create_sync_infer_request( void CompiledModel::export_model(std::ostream& stream) const { const auto& blob = _networkPtr->compiledNetwork; stream.write(reinterpret_cast(blob.data()), blob.size()); + if (!stream) { + _logger.error("Write blob to stream failed. Blob is broken!"); + } else { + _logger.info("Write blob to stream successfully."); + } std::stringstream str; str << "Blob size: " << blob.size() << ", hash: " << std::hex << hash(blob); diff --git a/src/plugins/intel_npu/src/plugin/src/compiler.cpp b/src/plugins/intel_npu/src/plugin/src/compiler.cpp index 10786fc913276e..f7f35d53a61b95 100644 --- a/src/plugins/intel_npu/src/plugin/src/compiler.cpp +++ b/src/plugins/intel_npu/src/plugin/src/compiler.cpp @@ -80,9 +80,9 @@ ov::SoPtr createCompilerImpl(ov::intel_npu::CompilerType compilerType } // namespace -ov::SoPtr intel_npu::createCompiler(ov::intel_npu::CompilerType compilerType, const Logger& log) { +ov::SoPtr intel_npu::createCompiler(ov::intel_npu::CompilerType compilerType) { OV_ITT_SCOPED_TASK(itt::domains::NPUPlugin, "intel_npu::createCompiler"); - auto logger = log.clone("createCompiler"); + auto logger = Logger::global().clone("createCompiler"); try { return createCompilerImpl(compilerType, logger); } catch (const std::exception& ex) { diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp index f18fc6aa13cf5f..12b10c82e2c30c 100644 --- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp +++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp @@ -135,10 +135,23 @@ std::map any_copy(const ov::AnyMap& params) { } size_t getFileSize(std::istream& stream) { + auto log = Logger::global().clone("getFileSize"); + if (!stream) { + OPENVINO_THROW("Stream is in bad status! Please check the passed stream status!"); + } + const size_t streamStart = stream.tellg(); stream.seekg(0, std::ios_base::end); const size_t streamEnd = stream.tellg(); stream.seekg(streamStart, std::ios_base::beg); + + log.debug("Read blob size: streamStart=%zu, streamEnd=%zu", streamStart, streamEnd); + + if (streamEnd < streamStart) { + OPENVINO_THROW("Invalid stream size: streamEnd (", streamEnd, + ") is not larger than streamStart (", streamStart, ")!"); + } + return streamEnd - streamStart; } @@ -159,6 +172,7 @@ namespace intel_npu { static Config merge_configs(const Config& globalConfig, const std::map& rawConfig, OptionMode mode = OptionMode::Both) { + update_log_level(rawConfig); Config localConfig = globalConfig; localConfig.update(rawConfig, mode); return localConfig; @@ -189,7 +203,6 @@ Plugin::Plugin() // parse env_variables to get LOG_LEVEL if needed _globalConfig.parseEnvVars(); - Logger::global().setLevel(_globalConfig.get()); // TODO: generation of available backends list can be done during execution of CMake scripts std::vector backendRegistry; @@ -607,8 +620,8 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< } const std::map propertiesMap = any_copy(properties); - update_log_level(propertiesMap); auto localConfig = merge_configs(_globalConfig, propertiesMap); + _logger.setLevel(localConfig.get()); const auto set_cache_dir = localConfig.get(); if (!set_cache_dir.empty()) { @@ -706,20 +719,20 @@ ov::SoPtr Plugin::get_default_context(const ov::AnyMap&) con std::shared_ptr Plugin::import_model(std::istream& stream, const ov::AnyMap& properties) const { OV_ITT_SCOPED_TASK(itt::domains::NPUPlugin, "Plugin::import_model"); OV_ITT_TASK_CHAIN(PLUGIN_IMPORT_MODEL, itt::domains::NPUPlugin, "Plugin::import_model", "merge_configs"); + const std::map propertiesMap = any_copy(properties); - update_log_level(propertiesMap); auto localConfig = merge_configs(_globalConfig, propertiesMap, OptionMode::RunTime); + _logger.setLevel(localConfig.get()); const auto platform = _backends->getCompilationPlatform(localConfig.get(), localConfig.get()); localConfig.update({{ov::intel_npu::platform.name(), platform}}); auto device = _backends->getDevice(localConfig.get()); set_batch_config(_backends->isBatchingSupported(), localConfig); - Logger logger("NPUPlugin", localConfig.get()); - const auto loadedFromCache = localConfig.get(); if (!loadedFromCache) { - logger.warning("The usage of a compiled model can lead to undefined behavior. Please use OpenVINO IR instead!"); + _logger.warning( + "The usage of a compiled model can lead to undefined behavior. Please use OpenVINO IR instead!"); } OV_ITT_TASK_NEXT(PLUGIN_IMPORT_MODEL, "parse"); @@ -730,11 +743,13 @@ std::shared_ptr Plugin::import_model(std::istream& stream, c auto compiler = getCompiler(localConfig); auto graphSize = getFileSize(stream); - if (graphSize == 0) { - OPENVINO_THROW("Blob is empty"); - } + std::vector blob(graphSize); stream.read(reinterpret_cast(blob.data()), graphSize); + if (!stream) { + OPENVINO_THROW("Failed to read data from stream!"); + } + _logger.debug("Successfully read %zu bytes into blob.", graphSize); auto meta = compiler->parse(blob, localConfig); meta.name = "net" + std::to_string(_compiledModelLoadCounter++); @@ -776,8 +791,8 @@ ov::SupportedOpsMap Plugin::query_model(const std::shared_ptr& const ov::AnyMap& properties) const { OV_ITT_SCOPED_TASK(itt::domains::NPUPlugin, "Plugin::query_model"); const std::map propertiesMap = any_copy(properties); - update_log_level(propertiesMap); auto localConfig = merge_configs(_globalConfig, propertiesMap, OptionMode::CompileTime); + _logger.setLevel(localConfig.get()); const auto platform = _backends->getCompilationPlatform(localConfig.get(), localConfig.get()); localConfig.update({{ov::intel_npu::platform.name(), platform}}); @@ -796,7 +811,7 @@ ov::SupportedOpsMap Plugin::query_model(const std::shared_ptr& ov::SoPtr Plugin::getCompiler(const Config& config) const { auto compilerType = config.get(); - return createCompiler(compilerType, _logger); + return createCompiler(compilerType); } std::atomic Plugin::_compiledModelLoadCounter{1}; diff --git a/src/plugins/intel_npu/src/utils/src/logger/logger.cpp b/src/plugins/intel_npu/src/utils/src/logger/logger.cpp index 3001f9cc406e60..eaf8b195aca3cb 100644 --- a/src/plugins/intel_npu/src/utils/src/logger/logger.cpp +++ b/src/plugins/intel_npu/src/utils/src/logger/logger.cpp @@ -64,7 +64,7 @@ Logger& Logger::global() { } static Logger log("global", logLvl); #else - static Logger log("global", ov::log::Level::NO); + static Logger log("global", ov::log::Level::ERR); #endif return log; }