From 8354b59b7a877719474f801fcc27a3cbce16276f Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Wed, 15 Jul 2026 15:27:53 +0100 Subject: [PATCH 01/18] Initial logs changes --- .../intel_npu/src/plugin/include/plugin.hpp | 16 ++++++++++ .../intel_npu/src/plugin/src/plugin.cpp | 29 ++++++++++++++--- .../compiled_model/compatibility_string.hpp | 9 ++++++ .../behavior/compiled_model/property.hpp | 27 ++++++++++------ .../infer_with_host_compile.hpp | 9 ++++-- .../ov_infer_request/compile_and_infer.cpp | 2 +- .../infer_request_dynamic.cpp | 4 ++- .../ov_infer_request/infer_request_run.hpp | 32 ++++++++++++------- .../behavior/ov_plugin/core_integration.hpp | 32 +++++++++++++++++++ .../internal/compiler_adapter/zero_graph.hpp | 5 +++ 10 files changed, 134 insertions(+), 31 deletions(-) diff --git a/src/plugins/intel_npu/src/plugin/include/plugin.hpp b/src/plugins/intel_npu/src/plugin/include/plugin.hpp index d759a27083e27d..5644f4eda73a73 100644 --- a/src/plugins/intel_npu/src/plugin/include/plugin.hpp +++ b/src/plugins/intel_npu/src/plugin/include/plugin.hpp @@ -6,6 +6,7 @@ #include #include +#include #include #include "backends_registry.hpp" @@ -62,6 +63,21 @@ class Plugin : public ov::IPlugin { const ov::AnyMap& properties) const override; private: + // applies ov::log::level from per-call properties and restores on scope exit + // permanent level changes belong in set_property(); per-call properties are scoped + // self: is this a RAII trait? + class LogLevelScope { + public: + explicit LogLevelScope(const ov::AnyMap& props, Logger& instanceLogger); + ~LogLevelScope(); + LogLevelScope(const LogLevelScope&) = delete; + LogLevelScope& operator=(const LogLevelScope&) = delete; + private: + Logger& _instanceLogger; + std::optional _prevGlobal; + std::optional _prevInstance; + }; + void update_log_level(const ov::AnyMap& properties) const; /** diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp index fcc4a43dd2fb0d..0787022bba91a8 100644 --- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp +++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp @@ -331,6 +331,27 @@ void init_config(const IEngineBackend* backend, OptionsDesc& options, FilteredCo namespace intel_npu { +Plugin::LogLevelScope::LogLevelScope(const ov::AnyMap& props, Logger& instanceLogger) + : _instanceLogger(instanceLogger) { + const auto it = props.find(ov::log::level.name()); + if (it == props.end()) { + return; + } + const auto lvl = it->second.as(); + _prevGlobal = Logger::global().level(); + _prevInstance = _instanceLogger.level(); + Logger::global().setLevel(lvl); + _instanceLogger.setLevel(lvl); +} + +Plugin::LogLevelScope::~LogLevelScope() { + if (!_prevGlobal) { + return; + } + Logger::global().setLevel(*_prevGlobal); + _instanceLogger.setLevel(*_prevInstance); +} + Plugin::Plugin() : _logger("NPUPlugin", Logger::global().level()) { OV_ITT_SCOPED_TASK(itt::domains::NPUPlugin, "Plugin::Plugin"); set_device_name("NPU"); @@ -389,7 +410,7 @@ bool Plugin::is_property_supported(const std::string& name, const ov::AnyMap& ar std::shared_ptr Plugin::compile_model(const std::shared_ptr& model, const ov::AnyMap& properties) const { OV_ITT_SCOPED_TASK(itt::domains::NPUPlugin, "Plugin::compile_model"); - update_log_level(properties); + LogLevelScope logScope(properties, _logger); // Before going any further: if // ... 1 - NPUW mode is activated @@ -631,7 +652,7 @@ 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"); - update_log_level(properties); + LogLevelScope logScope(properties, _logger); if (properties.find(ov::hint::compiled_blob.name()) != properties.end()) { _logger.warning("ov::hint::compiled_blob is no longer supported for import_model(stream) API! Please use new " @@ -698,7 +719,7 @@ std::shared_ptr Plugin::import_model(std::istream& stream, std::shared_ptr Plugin::import_model(const ov::Tensor& compiledBlob, const ov::AnyMap& properties) const { OV_ITT_SCOPED_TASK(itt::domains::NPUPlugin, "Plugin::import_model"); - update_log_level(properties); + LogLevelScope logScope(properties, _logger); // Need to create intermediate istream for NPUW ov::SharedStreamBuffer buffer{compiledBlob.data(), compiledBlob.get_byte_size()}; @@ -758,7 +779,7 @@ std::shared_ptr Plugin::import_model(const ov::Tensor& compi ov::SupportedOpsMap Plugin::query_model(const std::shared_ptr& model, const ov::AnyMap& properties) const { OV_ITT_SCOPED_TASK(itt::domains::NPUPlugin, "Plugin::query_model"); - update_log_level(properties); + LogLevelScope logScope(properties, _logger); auto localProperties = properties; diff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.hpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.hpp index bfa353c62a57a0..814f5c6ad2130c 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.hpp @@ -29,11 +29,20 @@ class ClassCompatibilityStringTestNPU : public OVCompiledModelPropertiesBase, std::string deviceName; ov::Core core; +private: + ov::log::Level _savedLogLevel{ov::log::Level::NO}; + public: void SetUp() override { SKIP_IF_CURRENT_TEST_IS_DISABLED(); OVCompiledModelPropertiesBase::SetUp(); deviceName = GetParam(); + _savedLogLevel = ::intel_npu::Logger::global().level(); + } + + void TearDown() override { + ::intel_npu::Logger::global().setLevel(_savedLogLevel); + OVCompiledModelPropertiesBase::TearDown(); } static std::string getTestCaseName(testing::TestParamInfo obj) { auto targetDevice = obj.param; diff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp index b57ed49069be2d..b614a794b2f7c2 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp @@ -42,6 +42,9 @@ class ClassExecutableNetworkGetPropertiesTestNPU ov::Any configValue; ov::Core ie; +private: + ov::log::Level _savedLogLevel{ov::log::Level::NO}; + public: void SetUp() override { SKIP_IF_CURRENT_TEST_IS_DISABLED(); @@ -50,6 +53,12 @@ class ClassExecutableNetworkGetPropertiesTestNPU std::tie(configKey, configValue) = std::get<1>(GetParam()); model = ov::test::utils::make_conv_pool_relu(); + _savedLogLevel = ::intel_npu::Logger::global().level(); + } + + void TearDown() override { + ::intel_npu::Logger::global().setLevel(_savedLogLevel); + OVCompiledModelPropertiesBase::TearDown(); } static std::string getTestCaseName( testing::TestParamInfo>> obj) { @@ -366,6 +375,7 @@ TEST_P(CheckCompilerTypeProperty, CheckLogAfterSettingExtraConfigToGetProperty) std::string logs; std::mutex logs_mutex; ov::Core core; + ov::test::utils::LoggerLevelGuard levelGuard(::intel_npu::Logger::global().level()); // Keep this std::function alive while logging is active. std::function log_cb = [&](std::string_view msg) { @@ -397,6 +407,7 @@ TEST_P(CheckCompilerTypeProperty, CheckLogAfterGettingPropertyWithExtraConfig) { std::string logs; std::mutex logs_mutex; ov::Core core; + ov::test::utils::LoggerLevelGuard levelGuard(::intel_npu::Logger::global().level()); core.set_property(deviceName, ov::log::level(ov::log::Level::INFO)); @@ -433,6 +444,7 @@ TEST_P(CheckCompilerTypeProperty, SetRuntimeProperty) { std::string logs; std::mutex logs_mutex; ov::Core core; + ov::test::utils::LoggerLevelGuard levelGuard(::intel_npu::Logger::global().level()); core.set_property(deviceName, ov::log::level(ov::log::Level::INFO)); @@ -466,6 +478,7 @@ TEST_P(CheckCompilerTypeProperty, SetCompilerPropertyForDifferentCompiler) { std::string logs; std::mutex logs_mutex; ov::Core core; + ov::test::utils::LoggerLevelGuard levelGuard(::intel_npu::Logger::global().level()); core.set_property(deviceName, ov::log::level(ov::log::Level::INFO)); @@ -515,6 +528,7 @@ TEST_P(CheckCompilerTypeProperty, GetCompilerVersion) { std::string logs; std::mutex logs_mutex; ov::Core core; + ov::test::utils::LoggerLevelGuard levelGuard(::intel_npu::Logger::global().level()); core.set_property(deviceName, ov::log::level(ov::log::Level::INFO)); @@ -615,6 +629,7 @@ TEST_P(CheckCompilerPropertyWhenImporting, ExpectedNoThrowFromImportWithCompiler ov::Core core_compile, core_import; ov::CompiledModel compiled_model; std::stringstream export_stream; + ov::test::utils::LoggerLevelGuard levelGuard(::intel_npu::Logger::global().level()); OV_ASSERT_NO_THROW(compiled_model = core_compile.compile_model(model, deviceName)); OV_ASSERT_NO_THROW(compiled_model.export_model(export_stream)); @@ -697,6 +712,7 @@ TEST_P(CheckCompilerPropertyWhenImporting, CheckImportWithCompilerProperty) { ov::Core core_for_importing; ov::CompiledModel compiled_model; std::stringstream export_stream; + ov::test::utils::LoggerLevelGuard levelGuard(::intel_npu::Logger::global().level()); OV_ASSERT_NO_THROW(compiled_model = core_for_compiler.compile_model(model, deviceName)); OV_ASSERT_NO_THROW(compiled_model.export_model(export_stream)); @@ -737,6 +753,7 @@ TEST_P(CheckCompilerPropertyWhenImporting, CheckImportWithCompilerPropertyAfterC ov::Core core; ov::CompiledModel compiled_model; std::stringstream export_stream; + ov::test::utils::LoggerLevelGuard levelGuard(::intel_npu::Logger::global().level()); OV_ASSERT_NO_THROW(compiled_model = core.compile_model(model, deviceName)); OV_ASSERT_NO_THROW(compiled_model.export_model(export_stream)); @@ -778,10 +795,6 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromSetProperty) { ov::Core core; ov::CompiledModel compiled_model; - ov::log::Level previous_log_level = ov::log::Level::NO; - OV_ASSERT_NO_THROW(previous_log_level = core.get_property(deviceName, ov::log::level)); - core.set_property(deviceName, ov::log::level(ov::log::Level::INFO)); - // Keep this std::function alive while logging is active. std::function log_cb = [&](std::string_view msg) { std::lock_guard lock(logs_mutex); @@ -794,7 +807,6 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromSetProperty) { OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::hint::enable_cpu_pinning(true))); OV_ASSERT_NO_THROW(compiled_model = core.compile_model(model, deviceName)); } - OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::log::level(previous_log_level))); bool enable_cpu_pinning = false; OV_ASSERT_NO_THROW(enable_cpu_pinning = compiled_model.get_property(ov::hint::enable_cpu_pinning)); @@ -824,10 +836,6 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromCompileProperty) { ov::Core core; ov::CompiledModel compiled_model; - ov::log::Level previous_log_level = ov::log::Level::NO; - OV_ASSERT_NO_THROW(previous_log_level = core.get_property(deviceName, ov::log::level)); - core.set_property(deviceName, ov::log::level(ov::log::Level::INFO)); - // Keep this std::function alive while logging is active. std::function log_cb = [&](std::string_view msg) { std::lock_guard lock(logs_mutex); @@ -840,7 +848,6 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromCompileProperty) { OV_ASSERT_NO_THROW(compiled_model = core.compile_model(model, deviceName, {ov::hint::enable_cpu_pinning(true)})); } - OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::log::level(previous_log_level))); bool enable_cpu_pinning = false; OV_ASSERT_NO_THROW(enable_cpu_pinning = compiled_model.get_property(ov::hint::enable_cpu_pinning)); diff --git a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp index f4a97d9d7c21a6..5a3e5ace50682b 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp @@ -420,8 +420,9 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithDecreasedSize) { auto model = createModelByName(selectedModelName); ScopedLogCapture logCapture; - core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); auto setupResult = prepareRuntimeCompareContext(model); + + core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; } @@ -490,8 +491,9 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithIncreasedSize) { auto model = createModelByName(selectedModelName); ScopedLogCapture logCapture; - core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); auto setupResult = prepareRuntimeCompareContext(model); + + core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; } @@ -560,8 +562,9 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithZeroTensor) { auto model = createModelByName(selectedModelName); ScopedLogCapture logCapture; - core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); auto setupResult = prepareRuntimeCompareContext(model); + + core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; } diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/compile_and_infer.cpp b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/compile_and_infer.cpp index d8da236900e1bd..ee262d75276493 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/compile_and_infer.cpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/compile_and_infer.cpp @@ -12,7 +12,7 @@ namespace { using namespace ov::test::behavior; -const std::vector configs = {{}}; +const std::vector configs = {{ov::log::level(ov::log::Level::ERR)}}; INSTANTIATE_TEST_SUITE_P(compatibility_smoke_BehaviorTests, OVCompileAndInferRequest, diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp index e1e1ebe35d79d0..17c1b20cf8bd3d 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp @@ -13,7 +13,9 @@ using namespace ov::test::behavior; namespace { -const std::vector config = {{{"NPU_COMPILATION_MODE", "ReferenceSW"}}}; +const std::vector config = { + {{"NPU_COMPILATION_MODE", "ReferenceSW"}, {ov::log::level(ov::log::Level::ERR)}} +}; INSTANTIATE_TEST_SUITE_P( smoke_BehaviorTests, diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp index 652e691a4eaf8e..d707322a4cf660 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp @@ -2305,13 +2305,15 @@ TEST_P(CpuVaTensorsTests, checkResultsAfterRawMemoryIsDestroyedAndReallocatedAft logs.push_back('\n'); }; - internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); + utils::LoggerLevelGuard level_guard(::intel_npu::Logger::global().level()); { - // don't flood console with messages from model compilation + auto compile_cfg = configuration; + compile_cfg[ov::log::level.name()] = ov::Any(ov::log::Level::ERR); utils::LogCallbackGuard log_callback_guard(log_cb); - ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, configuration); + ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, compile_cfg); inference_request = compiled_model.create_infer_request(); } + internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); logs.clear(); for (size_t i = 0; i < 10; ++i) { @@ -2369,15 +2371,17 @@ TEST_P(CpuVaTensorsTests, checkResultsAfterRunningWithSameRawMemoryMultipleTimes float* input_data = static_cast(::operator new(shape_size * sizeof(float), std::align_val_t(4096))); float* output_data = static_cast(::operator new(shape_size * sizeof(float), std::align_val_t(4096))); - internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); + utils::LoggerLevelGuard level_guard(::intel_npu::Logger::global().level()); { - // don't flood console with messages from model compilation + auto compile_cfg = configuration; + compile_cfg[ov::log::level.name()] = ov::Any(ov::log::Level::ERR); utils::LogCallbackGuard log_callback_guard(log_cb); - ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, configuration); + ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, compile_cfg); inference_request = compiled_model.create_infer_request(); inference_request.set_input_tensor(ov::Tensor{ov::element::f32, shape, input_data}); inference_request.set_output_tensor(ov::Tensor{ov::element::f32, shape, output_data}); } + internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); logs.clear(); for (size_t i = 0; i < 10; ++i) { @@ -2435,17 +2439,19 @@ TEST_P(CpuVaTensorsTests, checkResultsAfterRunningWithSameZeroTensorMultipleTime logs.push_back('\n'); }; - internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); + utils::LoggerLevelGuard level_guard(::intel_npu::Logger::global().level()); { - // don't flood console with messages from model compilation + auto compile_cfg = configuration; + compile_cfg[ov::log::level.name()] = ov::Any(ov::log::Level::ERR); utils::LogCallbackGuard log_callback_guard(log_cb); - ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, configuration); + ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, compile_cfg); inference_request = compiled_model.create_infer_request(); input_tensor = inference_request.get_input_tensor(); output_tensor = inference_request.get_output_tensor(); input_data = input_tensor.data(); output_data = output_tensor.data(); } + internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); logs.clear(); for (size_t i = 0; i < 10; ++i) { @@ -2500,15 +2506,17 @@ TEST_P(CpuVaTensorsTests, checkResultsAfterRunningWithSameZeroHostTensorMultiple float* input_data = input_tensor.data(); float* output_data = output_tensor.data(); - internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); + utils::LoggerLevelGuard level_guard(::intel_npu::Logger::global().level()); { - // don't flood console with messages from model compilation + auto compile_cfg = configuration; + compile_cfg[ov::log::level.name()] = ov::Any(ov::log::Level::ERR); utils::LogCallbackGuard log_callback_guard(log_cb); - ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, configuration); + ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, compile_cfg); inference_request = compiled_model.create_infer_request(); inference_request.set_input_tensor(input_tensor); inference_request.set_output_tensor(output_tensor); } + internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); logs.clear(); for (size_t i = 0; i < 10; ++i) { diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp index f490f9da0e2611..621a50d4f64be3 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp @@ -452,6 +452,38 @@ TEST_P(OVClassCompileModel, CompileModelWithDifferentThreadNumbers) { testing::HasSubstr("ov::compilation_num_threads must be positive int32 value")); } +TEST_P(OVClassNetworkTestPNPU, smoke_LogLevelPerCallPropertyDoesNotContaminateSubsequentCompile) { + SKIP_IF_CURRENT_TEST_IS_DISABLED(); + + auto model = ov::test::utils::make_conv_pool_relu(); + ov::Core ie; + + utils::LoggerLevelGuard levelGuard(::intel_npu::Logger::global().level()); + + { + std::string firstCompileLogs; + std::function cb = [&](std::string_view msg) { + firstCompileLogs.append(msg); + firstCompileLogs.push_back('\n'); + }; + utils::LogCallbackGuard captureGuard(cb); + OV_ASSERT_NO_THROW(ie.compile_model(model, target_device, {{ov::log::level(ov::log::Level::ERR)}})); + } + + std::string secondCompileLogs; + { + std::function cb = [&](std::string_view msg) { + secondCompileLogs.append(msg); + secondCompileLogs.push_back('\n'); + }; + utils::LogCallbackGuard captureGuard(cb); + OV_ASSERT_NO_THROW(ie.compile_model(model, target_device)); + } + + EXPECT_TRUE(secondCompileLogs.find("[WARNING]") != std::string::npos); + EXPECT_FALSE(secondCompileLogs.find("[INFO]") != std::string::npos); +} + #ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT TEST_P(OVClassBasicTestPNPU, smoke_registerPluginsLibrariesUnicodePath) { diff --git a/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp b/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp index a0ec07d87bf98c..dd30e3b4eaa962 100644 --- a/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp +++ b/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp @@ -83,6 +83,9 @@ class ZeroGraphTest : public ::testing::TestWithParamGetParam(); model = ov::test::utils::make_multi_single_conv(); @@ -102,6 +105,7 @@ class ZeroGraphTest : public ::testing::TestWithParam Date: Wed, 15 Jul 2026 15:31:50 +0100 Subject: [PATCH 02/18] Fix copyright --- .../behavior/ov_infer_request/infer_request_dynamic.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp index 17c1b20cf8bd3d..32ccbaa0c4d7cf 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp @@ -1,4 +1,3 @@ -// // Copyright (C) 2018-2026 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // From 011750dbb44fe171da3b5b765d7b8385ac9131a4 Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Thu, 16 Jul 2026 12:38:08 +0100 Subject: [PATCH 03/18] Fixes, nitpicks and reverts --- .../intel_npu/src/plugin/include/plugin.hpp | 7 ++--- .../intel_npu/src/plugin/src/plugin.cpp | 30 ++++++++++++++----- .../behavior/compiled_model/property.hpp | 10 +++++++ .../infer_with_host_compile.hpp | 6 ++-- .../ov_infer_request/compile_and_infer.cpp | 2 +- .../infer_request_dynamic.cpp | 2 +- .../ov_infer_request/infer_request_run.hpp | 28 ++++++++--------- .../behavior/ov_plugin/core_integration.hpp | 14 ++++++--- 8 files changed, 62 insertions(+), 37 deletions(-) diff --git a/src/plugins/intel_npu/src/plugin/include/plugin.hpp b/src/plugins/intel_npu/src/plugin/include/plugin.hpp index 5644f4eda73a73..9204b394847e2e 100644 --- a/src/plugins/intel_npu/src/plugin/include/plugin.hpp +++ b/src/plugins/intel_npu/src/plugin/include/plugin.hpp @@ -63,12 +63,11 @@ class Plugin : public ov::IPlugin { const ov::AnyMap& properties) const override; private: - // applies ov::log::level from per-call properties and restores on scope exit - // permanent level changes belong in set_property(); per-call properties are scoped - // self: is this a RAII trait? + // applies ov::log::level from per-call properties and restores the previous level on scope exit + // permanent level changes belong in set_property(); per-call properties are scoped to the call class LogLevelScope { public: - explicit LogLevelScope(const ov::AnyMap& props, Logger& instanceLogger); + LogLevelScope(const ov::AnyMap& props, Logger& instanceLogger); ~LogLevelScope(); LogLevelScope(const LogLevelScope&) = delete; LogLevelScope& operator=(const LogLevelScope&) = delete; diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp index 0787022bba91a8..77c7858a06474d 100644 --- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp +++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp @@ -6,6 +6,7 @@ #include #include +#include #include "compiled_model.hpp" #include "intel_npu/common/compiler_adapter_factory.hpp" @@ -331,17 +332,28 @@ void init_config(const IEngineBackend* backend, OptionsDesc& options, FilteredCo namespace intel_npu { +namespace { + +std::optional read_log_level(const ov::AnyMap& properties) { + const auto it = properties.find(ov::log::level.name()); + if (it == properties.end()) { + return std::nullopt; + } + return it->second.as(); +} + +} // namespace + Plugin::LogLevelScope::LogLevelScope(const ov::AnyMap& props, Logger& instanceLogger) : _instanceLogger(instanceLogger) { - const auto it = props.find(ov::log::level.name()); - if (it == props.end()) { + const auto lvl = read_log_level(props); + if (!lvl) { return; } - const auto lvl = it->second.as(); _prevGlobal = Logger::global().level(); _prevInstance = _instanceLogger.level(); - Logger::global().setLevel(lvl); - _instanceLogger.setLevel(lvl); + Logger::global().setLevel(*lvl); + _instanceLogger.setLevel(*lvl); } Plugin::LogLevelScope::~LogLevelScope() { @@ -997,10 +1009,12 @@ std::shared_ptr Plugin::parse(const ov::Tensor& tensorBig, } void Plugin::update_log_level(const ov::AnyMap& properties) const { - if (properties.count(ov::log::level.name()) != 0) { - Logger::global().setLevel(properties.at(ov::log::level.name()).as()); - _logger.setLevel(properties.at(ov::log::level.name()).as()); + const auto lvl = read_log_level(properties); + if (!lvl) { + return; } + Logger::global().setLevel(*lvl); + _logger.setLevel(*lvl); } std::atomic Plugin::_compiledModelLoadCounter{1}; diff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp index b614a794b2f7c2..3cea5a13eae3b9 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp @@ -795,6 +795,10 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromSetProperty) { ov::Core core; ov::CompiledModel compiled_model; + ov::log::Level previous_log_level = ov::log::Level::NO; + OV_ASSERT_NO_THROW(previous_log_level = core.get_property(deviceName, ov::log::level)); + core.set_property(deviceName, ov::log::level(ov::log::Level::INFO)); + // Keep this std::function alive while logging is active. std::function log_cb = [&](std::string_view msg) { std::lock_guard lock(logs_mutex); @@ -807,6 +811,7 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromSetProperty) { OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::hint::enable_cpu_pinning(true))); OV_ASSERT_NO_THROW(compiled_model = core.compile_model(model, deviceName)); } + OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::log::level(previous_log_level))); bool enable_cpu_pinning = false; OV_ASSERT_NO_THROW(enable_cpu_pinning = compiled_model.get_property(ov::hint::enable_cpu_pinning)); @@ -836,6 +841,10 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromCompileProperty) { ov::Core core; ov::CompiledModel compiled_model; + ov::log::Level previous_log_level = ov::log::Level::NO; + OV_ASSERT_NO_THROW(previous_log_level = core.get_property(deviceName, ov::log::level)); + core.set_property(deviceName, ov::log::level(ov::log::Level::INFO)); + // Keep this std::function alive while logging is active. std::function log_cb = [&](std::string_view msg) { std::lock_guard lock(logs_mutex); @@ -848,6 +857,7 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromCompileProperty) { OV_ASSERT_NO_THROW(compiled_model = core.compile_model(model, deviceName, {ov::hint::enable_cpu_pinning(true)})); } + OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::log::level(previous_log_level))); bool enable_cpu_pinning = false; OV_ASSERT_NO_THROW(enable_cpu_pinning = compiled_model.get_property(ov::hint::enable_cpu_pinning)); diff --git a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp index 5a3e5ace50682b..f7dd49ef7be1b3 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp @@ -420,9 +420,9 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithDecreasedSize) { auto model = createModelByName(selectedModelName); ScopedLogCapture logCapture; + core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); auto setupResult = prepareRuntimeCompareContext(model); - core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; } @@ -491,9 +491,9 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithIncreasedSize) { auto model = createModelByName(selectedModelName); ScopedLogCapture logCapture; + core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); auto setupResult = prepareRuntimeCompareContext(model); - core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; } @@ -562,9 +562,9 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithZeroTensor) { auto model = createModelByName(selectedModelName); ScopedLogCapture logCapture; + core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); auto setupResult = prepareRuntimeCompareContext(model); - core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; } diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/compile_and_infer.cpp b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/compile_and_infer.cpp index ee262d75276493..d8da236900e1bd 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/compile_and_infer.cpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/compile_and_infer.cpp @@ -12,7 +12,7 @@ namespace { using namespace ov::test::behavior; -const std::vector configs = {{ov::log::level(ov::log::Level::ERR)}}; +const std::vector configs = {{}}; INSTANTIATE_TEST_SUITE_P(compatibility_smoke_BehaviorTests, OVCompileAndInferRequest, diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp index 32ccbaa0c4d7cf..5fedfaead73250 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp @@ -13,7 +13,7 @@ using namespace ov::test::behavior; namespace { const std::vector config = { - {{"NPU_COMPILATION_MODE", "ReferenceSW"}, {ov::log::level(ov::log::Level::ERR)}} + {{"NPU_COMPILATION_MODE", "ReferenceSW"}} }; INSTANTIATE_TEST_SUITE_P( diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp index d707322a4cf660..7fe2b486a6eb01 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp @@ -2306,14 +2306,13 @@ TEST_P(CpuVaTensorsTests, checkResultsAfterRawMemoryIsDestroyedAndReallocatedAft }; utils::LoggerLevelGuard level_guard(::intel_npu::Logger::global().level()); + internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); { - auto compile_cfg = configuration; - compile_cfg[ov::log::level.name()] = ov::Any(ov::log::Level::ERR); + // don't flood console with messages from model compilation utils::LogCallbackGuard log_callback_guard(log_cb); - ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, compile_cfg); + ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, configuration); inference_request = compiled_model.create_infer_request(); } - internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); logs.clear(); for (size_t i = 0; i < 10; ++i) { @@ -2372,16 +2371,15 @@ TEST_P(CpuVaTensorsTests, checkResultsAfterRunningWithSameRawMemoryMultipleTimes float* output_data = static_cast(::operator new(shape_size * sizeof(float), std::align_val_t(4096))); utils::LoggerLevelGuard level_guard(::intel_npu::Logger::global().level()); + internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); { - auto compile_cfg = configuration; - compile_cfg[ov::log::level.name()] = ov::Any(ov::log::Level::ERR); + // don't flood console with messages from model compilation utils::LogCallbackGuard log_callback_guard(log_cb); - ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, compile_cfg); + ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, configuration); inference_request = compiled_model.create_infer_request(); inference_request.set_input_tensor(ov::Tensor{ov::element::f32, shape, input_data}); inference_request.set_output_tensor(ov::Tensor{ov::element::f32, shape, output_data}); } - internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); logs.clear(); for (size_t i = 0; i < 10; ++i) { @@ -2440,18 +2438,17 @@ TEST_P(CpuVaTensorsTests, checkResultsAfterRunningWithSameZeroTensorMultipleTime }; utils::LoggerLevelGuard level_guard(::intel_npu::Logger::global().level()); + internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); { - auto compile_cfg = configuration; - compile_cfg[ov::log::level.name()] = ov::Any(ov::log::Level::ERR); + // don't flood console with messages from model compilation utils::LogCallbackGuard log_callback_guard(log_cb); - ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, compile_cfg); + ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, configuration); inference_request = compiled_model.create_infer_request(); input_tensor = inference_request.get_input_tensor(); output_tensor = inference_request.get_output_tensor(); input_data = input_tensor.data(); output_data = output_tensor.data(); } - internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); logs.clear(); for (size_t i = 0; i < 10; ++i) { @@ -2507,16 +2504,15 @@ TEST_P(CpuVaTensorsTests, checkResultsAfterRunningWithSameZeroHostTensorMultiple float* output_data = output_tensor.data(); utils::LoggerLevelGuard level_guard(::intel_npu::Logger::global().level()); + internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); { - auto compile_cfg = configuration; - compile_cfg[ov::log::level.name()] = ov::Any(ov::log::Level::ERR); + // don't flood console with messages from model compilation utils::LogCallbackGuard log_callback_guard(log_cb); - ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, compile_cfg); + ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, configuration); inference_request = compiled_model.create_infer_request(); inference_request.set_input_tensor(input_tensor); inference_request.set_output_tensor(output_tensor); } - internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); logs.clear(); for (size_t i = 0; i < 10; ++i) { diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp index 621a50d4f64be3..19f5823c189130 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp @@ -460,16 +460,20 @@ TEST_P(OVClassNetworkTestPNPU, smoke_LogLevelPerCallPropertyDoesNotContaminateSu utils::LoggerLevelGuard levelGuard(::intel_npu::Logger::global().level()); + std::string firstCompileLogs; { - std::string firstCompileLogs; std::function cb = [&](std::string_view msg) { firstCompileLogs.append(msg); firstCompileLogs.push_back('\n'); }; utils::LogCallbackGuard captureGuard(cb); - OV_ASSERT_NO_THROW(ie.compile_model(model, target_device, {{ov::log::level(ov::log::Level::ERR)}})); + OV_ASSERT_NO_THROW(ie.compile_model(model, target_device, {{ov::log::level(ov::log::Level::INFO)}})); } + ASSERT_NE(firstCompileLogs.find("[INFO]"), std::string::npos) + << "Expected [INFO] output while compiling with a per-call INFO log level, but captured:\n" + << firstCompileLogs.substr(0, 500); + std::string secondCompileLogs; { std::function cb = [&](std::string_view msg) { @@ -480,8 +484,10 @@ TEST_P(OVClassNetworkTestPNPU, smoke_LogLevelPerCallPropertyDoesNotContaminateSu OV_ASSERT_NO_THROW(ie.compile_model(model, target_device)); } - EXPECT_TRUE(secondCompileLogs.find("[WARNING]") != std::string::npos); - EXPECT_FALSE(secondCompileLogs.find("[INFO]") != std::string::npos); + EXPECT_FALSE(secondCompileLogs.find("[INFO]") != std::string::npos) + << "Per-call log::level from first compile contaminated the second compile.\n" + "Captured output snippet:\n" + << secondCompileLogs.substr(0, 500); } #ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT From 9fc2ebf48d48068a13ebb9805265a0d3c2df233a Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Thu, 16 Jul 2026 11:39:41 +0000 Subject: [PATCH 04/18] Clang format --- .../intel_npu/src/plugin/include/plugin.hpp | 1 + .../compiled_model/compatibility_string.hpp | 20 ++++++------ .../infer_with_host_compile.hpp | 31 ++++++++++--------- .../infer_request_dynamic.cpp | 4 +-- .../ov_infer_request/infer_request_run.hpp | 3 +- .../behavior/ov_plugin/core_integration.hpp | 2 +- 6 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/plugins/intel_npu/src/plugin/include/plugin.hpp b/src/plugins/intel_npu/src/plugin/include/plugin.hpp index 9204b394847e2e..61b5a6cf08d63a 100644 --- a/src/plugins/intel_npu/src/plugin/include/plugin.hpp +++ b/src/plugins/intel_npu/src/plugin/include/plugin.hpp @@ -71,6 +71,7 @@ class Plugin : public ov::IPlugin { ~LogLevelScope(); LogLevelScope(const LogLevelScope&) = delete; LogLevelScope& operator=(const LogLevelScope&) = delete; + private: Logger& _instanceLogger; std::optional _prevGlobal; diff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.hpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.hpp index 814f5c6ad2130c..6f57711db1d4bd 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.hpp @@ -123,11 +123,11 @@ TEST_P(ClassCompatibilityStringTestSuite, RuntimeRequirementsIsSupported) { ASSERT_FALSE(it->is_mutable()); OV_ASSERT_NO_THROW(auto requirements = compiledModel.get_property(ov::runtime_requirements)); - OV_ASSERT_NO_THROW(compiledModel = core.compile_model( - model, - deviceName, - {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER), - ov::intel_npu::bypass_umd_caching(true)})); + OV_ASSERT_NO_THROW(compiledModel = + core.compile_model(model, + deviceName, + {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER), + ov::intel_npu::bypass_umd_caching(true)})); // Test that RUNTIME_REQUIREMENTS is supported for CID when the L0 graph extension version >= 1.16, // and unsupported for earlier driver versions. CIP always supports it. OV_ASSERT_NO_THROW(properties = compiledModel.get_property(ov::supported_properties)); @@ -164,11 +164,11 @@ TEST_P(ClassCompatibilityStringTestSuite, RuntimeRequirementsValueIsReadableWhen OV_ASSERT_NO_THROW(requirements = compiledModel.get_property(ov::runtime_requirements)); ASSERT_FALSE(requirements.empty()); - OV_ASSERT_NO_THROW(compiledModel = core.compile_model( - model, - deviceName, - {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER), - ov::intel_npu::bypass_umd_caching(true)})); + OV_ASSERT_NO_THROW(compiledModel = + core.compile_model(model, + deviceName, + {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER), + ov::intel_npu::bypass_umd_caching(true)})); OV_ASSERT_NO_THROW(properties = compiledModel.get_property(ov::supported_properties)); it = find(properties.cbegin(), properties.cend(), ov::runtime_requirements); diff --git a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp index f7dd49ef7be1b3..47b7e9ba434f58 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp @@ -5,8 +5,8 @@ #pragma once #include -#include #include +#include #include #include #include @@ -30,16 +30,18 @@ inline std::shared_ptr createMaxPoolModel(bool dynamicBatch = false, std::shared_ptr input; if (dynamicBatch) { input = std::make_shared(ov::element::f16, - ov::PartialShape{ov::Dimension(1, 10), 16, 720, 1280}); + ov::PartialShape{ov::Dimension(1, 10), 16, 720, 1280}); } else { - input = std::make_shared(ov::element::f16, - ov::PartialShape{1, 16, ov::Dimension(10, 720), ov::Dimension(10, 1280)}); + input = std::make_shared( + ov::element::f16, + ov::PartialShape{1, 16, ov::Dimension(10, 720), ov::Dimension(10, 1280)}); } std::string inputName = "input1"; input->set_friendly_name(inputName); input->get_output_tensor(0).set_names({inputName}); - if (!nhwcLayout) input->set_layout("NCHW"); + if (!nhwcLayout) + input->set_layout("NCHW"); auto maxpool = std::make_shared(input, Strides{1, 1}, Shape{0, 0}, @@ -51,12 +53,13 @@ inline std::shared_ptr createMaxPoolModel(bool dynamicBatch = false, auto result = std::make_shared(maxpool); std::string outputName = "output"; - if (!nhwcLayout) result->set_layout("NCHW"); + if (!nhwcLayout) + result->set_layout("NCHW"); result->set_friendly_name(outputName); result->get_output_tensor(0).set_names({outputName}); auto model = std::make_shared(ResultVector{result}, ParameterVector{input}, "MaxPool"); - + // making input and output to be NHWC if (nhwcLayout) { auto preProc = ov::preprocess::PrePostProcessor(model); @@ -72,8 +75,9 @@ inline std::shared_ptr createMaxPoolModel(bool dynamicBatch = false, } inline std::shared_ptr createCustomNetModel() { - auto input = std::make_shared(ov::element::f16, - ov::PartialShape{1, 16, ov::Dimension(1, 1080), ov::Dimension(10, 1920)}); + auto input = std::make_shared( + ov::element::f16, + ov::PartialShape{1, 16, ov::Dimension(1, 1080), ov::Dimension(10, 1920)}); input->set_friendly_name("Parameter_59"); auto make_conv_add = [](const ov::Output& data, @@ -711,12 +715,9 @@ TEST_P(InferWithDefaultHostCompileTests, CompileDynamicModelWithNoHostCompileMod } if (selectedModelName == "MaxPool_NCHW_DynBatch") { - ASSERT_TRUE(isElfBlob(modelStream.str())) - << "Expected exported model to be an ELF blob"; - } - else if (selectedModelName == "MaxPool_NCHW") { - ASSERT_TRUE(isByteCodeBlob(modelStream.str())) - << "Expected exported model to be a bytecode"; + ASSERT_TRUE(isElfBlob(modelStream.str())) << "Expected exported model to be an ELF blob"; + } else if (selectedModelName == "MaxPool_NCHW") { + ASSERT_TRUE(isByteCodeBlob(modelStream.str())) << "Expected exported model to be a bytecode"; } ov::InferRequest reqDynamic; diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp index 5fedfaead73250..5b678a1d96f582 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_dynamic.cpp @@ -12,9 +12,7 @@ using namespace ov::test::behavior; namespace { -const std::vector config = { - {{"NPU_COMPILATION_MODE", "ReferenceSW"}} -}; +const std::vector config = {{{"NPU_COMPILATION_MODE", "ReferenceSW"}}}; INSTANTIATE_TEST_SUITE_P( smoke_BehaviorTests, diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp index 7fe2b486a6eb01..99bb0b1b090dce 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp @@ -2584,8 +2584,7 @@ TEST_P(CpuVaTensorsTests, checkResultsAfterRunningWithSameRawMemoryMultipleTimes ::operator delete(output_data, std::align_val_t(4096)); } -class DynamicBoundsTests : public InferRequestRunTests -{ +class DynamicBoundsTests : public InferRequestRunTests { public: void SetUp() override { InferRequestRunTests::SetUp(); diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp index 19f5823c189130..8684e949e547df 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp @@ -383,7 +383,7 @@ TEST_P(OVClassGetMetricAndPrintNoThrow, NpuDeviceAllocMemSizeSameAfterDestroyInf ov::CompiledModel compiledModel; auto model = createModelWithLargeSize(); - //Warm up inference to initialize driver scratch buffers + // Warm up inference to initialize driver scratch buffers OV_ASSERT_NO_THROW(compiledModel = core.compile_model(model, target_device)); auto inferRequest = compiledModel.create_infer_request(); inferRequest.infer(); From 76bf7c810a8737eaa1dfcb4bc14105fa4a650daf Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Thu, 16 Jul 2026 12:45:43 +0100 Subject: [PATCH 05/18] Rearrange new logger functions from plugin.cpp --- .../intel_npu/src/plugin/src/plugin.cpp | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp index 77c7858a06474d..ef28f6b980848a 100644 --- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp +++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp @@ -328,12 +328,6 @@ void init_config(const IEngineBackend* backend, OptionsDesc& options, FilteredCo } } -} // namespace - -namespace intel_npu { - -namespace { - std::optional read_log_level(const ov::AnyMap& properties) { const auto it = properties.find(ov::log::level.name()); if (it == properties.end()) { @@ -344,25 +338,7 @@ std::optional read_log_level(const ov::AnyMap& properties) { } // namespace -Plugin::LogLevelScope::LogLevelScope(const ov::AnyMap& props, Logger& instanceLogger) - : _instanceLogger(instanceLogger) { - const auto lvl = read_log_level(props); - if (!lvl) { - return; - } - _prevGlobal = Logger::global().level(); - _prevInstance = _instanceLogger.level(); - Logger::global().setLevel(*lvl); - _instanceLogger.setLevel(*lvl); -} - -Plugin::LogLevelScope::~LogLevelScope() { - if (!_prevGlobal) { - return; - } - Logger::global().setLevel(*_prevGlobal); - _instanceLogger.setLevel(*_prevInstance); -} +namespace intel_npu { Plugin::Plugin() : _logger("NPUPlugin", Logger::global().level()) { OV_ITT_SCOPED_TASK(itt::domains::NPUPlugin, "Plugin::Plugin"); @@ -1008,6 +984,26 @@ std::shared_ptr Plugin::parse(const ov::Tensor& tensorBig, return std::make_shared(modelDummy, shared_from_this(), device, graph, localConfig, batchSize); } +Plugin::LogLevelScope::LogLevelScope(const ov::AnyMap& props, Logger& instanceLogger) + : _instanceLogger(instanceLogger) { + const auto lvl = read_log_level(props); + if (!lvl) { + return; + } + _prevGlobal = Logger::global().level(); + _prevInstance = _instanceLogger.level(); + Logger::global().setLevel(*lvl); + _instanceLogger.setLevel(*lvl); +} + +Plugin::LogLevelScope::~LogLevelScope() { + if (!_prevGlobal) { + return; + } + Logger::global().setLevel(*_prevGlobal); + _instanceLogger.setLevel(*_prevInstance); +} + void Plugin::update_log_level(const ov::AnyMap& properties) const { const auto lvl = read_log_level(properties); if (!lvl) { From e47f42183312a952c90005babf4f4932fe0576f4 Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Thu, 16 Jul 2026 17:09:55 +0100 Subject: [PATCH 06/18] Try to reduce the logs some more --- .../behavior/compiled_model/property.hpp | 16 +++++----------- .../behavior/ov_plugin/core_integration.cpp | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp index 3cea5a13eae3b9..daab0fbc30ab2e 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp @@ -795,9 +795,7 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromSetProperty) { ov::Core core; ov::CompiledModel compiled_model; - ov::log::Level previous_log_level = ov::log::Level::NO; - OV_ASSERT_NO_THROW(previous_log_level = core.get_property(deviceName, ov::log::level)); - core.set_property(deviceName, ov::log::level(ov::log::Level::INFO)); + ov::test::utils::LoggerLevelGuard levelGuard(ov::log::Level::WARNING); // Keep this std::function alive while logging is active. std::function log_cb = [&](std::string_view msg) { @@ -811,7 +809,6 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromSetProperty) { OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::hint::enable_cpu_pinning(true))); OV_ASSERT_NO_THROW(compiled_model = core.compile_model(model, deviceName)); } - OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::log::level(previous_log_level))); bool enable_cpu_pinning = false; OV_ASSERT_NO_THROW(enable_cpu_pinning = compiled_model.get_property(ov::hint::enable_cpu_pinning)); @@ -841,10 +838,6 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromCompileProperty) { ov::Core core; ov::CompiledModel compiled_model; - ov::log::Level previous_log_level = ov::log::Level::NO; - OV_ASSERT_NO_THROW(previous_log_level = core.get_property(deviceName, ov::log::level)); - core.set_property(deviceName, ov::log::level(ov::log::Level::INFO)); - // Keep this std::function alive while logging is active. std::function log_cb = [&](std::string_view msg) { std::lock_guard lock(logs_mutex); @@ -854,10 +847,11 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromCompileProperty) { { ov::test::utils::LogCallbackGuard log_callback_guard(log_cb); - OV_ASSERT_NO_THROW(compiled_model = - core.compile_model(model, deviceName, {ov::hint::enable_cpu_pinning(true)})); + OV_ASSERT_NO_THROW(compiled_model = core.compile_model(model, + deviceName, + {ov::hint::enable_cpu_pinning(true), + ov::log::level(ov::log::Level::WARNING)})); } - OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::log::level(previous_log_level))); bool enable_cpu_pinning = false; OV_ASSERT_NO_THROW(enable_cpu_pinning = compiled_model.get_property(ov::hint::enable_cpu_pinning)); diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.cpp b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.cpp index e22c5ac8c22833..b2bebc3ce68712 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.cpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.cpp @@ -38,7 +38,7 @@ static std::string getTestCaseName(const testing::TestParamInfo& ob } } // namespace OVClassNetworkTestName -const std::vector configs = {{}}; +const std::vector configs = {{ov::log::level(ov::log::Level::ERR)}}; #ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT INSTANTIATE_TEST_SUITE_P(compatibility_smoke_BehaviorTests_OVClassBasicTestP, From da23ff096e5b38d6707b67fd3997f243ff41c9f0 Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Thu, 16 Jul 2026 16:11:40 +0000 Subject: [PATCH 07/18] Clang format --- .../tests/functional/behavior/compiled_model/property.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp index daab0fbc30ab2e..760e1be45ebe94 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp @@ -847,10 +847,10 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromCompileProperty) { { ov::test::utils::LogCallbackGuard log_callback_guard(log_cb); - OV_ASSERT_NO_THROW(compiled_model = core.compile_model(model, - deviceName, - {ov::hint::enable_cpu_pinning(true), - ov::log::level(ov::log::Level::WARNING)})); + OV_ASSERT_NO_THROW(compiled_model = core.compile_model( + model, + deviceName, + {ov::hint::enable_cpu_pinning(true), ov::log::level(ov::log::Level::WARNING)})); } bool enable_cpu_pinning = false; From 7f42feffb2861b6c77866bac4ae0e95c415ce8dd Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Fri, 17 Jul 2026 07:06:36 +0100 Subject: [PATCH 08/18] Fix failing test --- .../tests/functional/behavior/compiled_model/property.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp index 760e1be45ebe94..9ed22ad80fe88a 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp @@ -795,7 +795,7 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromSetProperty) { ov::Core core; ov::CompiledModel compiled_model; - ov::test::utils::LoggerLevelGuard levelGuard(ov::log::Level::WARNING); + core.set_property(deviceName, ov::log::level(ov::log::Level::WARNING)); // Keep this std::function alive while logging is active. std::function log_cb = [&](std::string_view msg) { From 910d80a8c8754139e74a22f0aeeed5e41eb08540 Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Fri, 17 Jul 2026 07:08:29 +0100 Subject: [PATCH 09/18] Try to reduce more logs --- .../infer_with_host_compile.hpp | 6 ++--- .../ov_infer_request/infer_request_run.hpp | 16 +++--------- .../behavior/ov_plugin/core_integration.hpp | 25 +++++++------------ 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp index 47b7e9ba434f58..83ec9953e910ba 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp @@ -424,8 +424,8 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithDecreasedSize) { auto model = createModelByName(selectedModelName); ScopedLogCapture logCapture; - core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); auto setupResult = prepareRuntimeCompareContext(model); + core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; @@ -495,8 +495,8 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithIncreasedSize) { auto model = createModelByName(selectedModelName); ScopedLogCapture logCapture; - core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); auto setupResult = prepareRuntimeCompareContext(model); + core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; @@ -566,8 +566,8 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithZeroTensor) { auto model = createModelByName(selectedModelName); ScopedLogCapture logCapture; - core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); auto setupResult = prepareRuntimeCompareContext(model); + core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp index 99bb0b1b090dce..37a24271f64206 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_infer_request/infer_request_run.hpp @@ -2305,12 +2305,10 @@ TEST_P(CpuVaTensorsTests, checkResultsAfterRawMemoryIsDestroyedAndReallocatedAft logs.push_back('\n'); }; - utils::LoggerLevelGuard level_guard(::intel_npu::Logger::global().level()); - internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); { - // don't flood console with messages from model compilation utils::LogCallbackGuard log_callback_guard(log_cb); ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, configuration); + internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); inference_request = compiled_model.create_infer_request(); } logs.clear(); @@ -2370,12 +2368,10 @@ TEST_P(CpuVaTensorsTests, checkResultsAfterRunningWithSameRawMemoryMultipleTimes float* input_data = static_cast(::operator new(shape_size * sizeof(float), std::align_val_t(4096))); float* output_data = static_cast(::operator new(shape_size * sizeof(float), std::align_val_t(4096))); - utils::LoggerLevelGuard level_guard(::intel_npu::Logger::global().level()); - internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); { - // don't flood console with messages from model compilation utils::LogCallbackGuard log_callback_guard(log_cb); ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, configuration); + internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); inference_request = compiled_model.create_infer_request(); inference_request.set_input_tensor(ov::Tensor{ov::element::f32, shape, input_data}); inference_request.set_output_tensor(ov::Tensor{ov::element::f32, shape, output_data}); @@ -2437,12 +2433,10 @@ TEST_P(CpuVaTensorsTests, checkResultsAfterRunningWithSameZeroTensorMultipleTime logs.push_back('\n'); }; - utils::LoggerLevelGuard level_guard(::intel_npu::Logger::global().level()); - internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); { - // don't flood console with messages from model compilation utils::LogCallbackGuard log_callback_guard(log_cb); ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, configuration); + internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); inference_request = compiled_model.create_infer_request(); input_tensor = inference_request.get_input_tensor(); output_tensor = inference_request.get_output_tensor(); @@ -2503,12 +2497,10 @@ TEST_P(CpuVaTensorsTests, checkResultsAfterRunningWithSameZeroHostTensorMultiple float* input_data = input_tensor.data(); float* output_data = output_tensor.data(); - utils::LoggerLevelGuard level_guard(::intel_npu::Logger::global().level()); - internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); { - // don't flood console with messages from model compilation utils::LogCallbackGuard log_callback_guard(log_cb); ov::CompiledModel compiled_model = internal_core.compile_model(model, target_device, configuration); + internal_core.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)); inference_request = compiled_model.create_infer_request(); inference_request.set_input_tensor(input_tensor); inference_request.set_output_tensor(output_tensor); diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp index 8684e949e547df..052c4c5706a50c 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp @@ -459,32 +459,25 @@ TEST_P(OVClassNetworkTestPNPU, smoke_LogLevelPerCallPropertyDoesNotContaminateSu ov::Core ie; utils::LoggerLevelGuard levelGuard(::intel_npu::Logger::global().level()); + const ov::log::Level baseline = ::intel_npu::Logger::global().level(); - std::string firstCompileLogs; { - std::function cb = [&](std::string_view msg) { - firstCompileLogs.append(msg); - firstCompileLogs.push_back('\n'); - }; - utils::LogCallbackGuard captureGuard(cb); + utils::LogCallbackGuard silentGuard(nullptr); OV_ASSERT_NO_THROW(ie.compile_model(model, target_device, {{ov::log::level(ov::log::Level::INFO)}})); } + ASSERT_EQ(::intel_npu::Logger::global().level(), baseline) + << "Per-call log::level(INFO) contaminated Logger::global() after compile_model returned"; - ASSERT_NE(firstCompileLogs.find("[INFO]"), std::string::npos) - << "Expected [INFO] output while compiling with a per-call INFO log level, but captured:\n" - << firstCompileLogs.substr(0, 500); - + // second compile with not per-call log level should not inherit the INFO level from the first compile std::string secondCompileLogs; { - std::function cb = [&](std::string_view msg) { - secondCompileLogs.append(msg); + utils::LogCallbackGuard captureGuard([&](std::string_view m) { + secondCompileLogs.append(m); secondCompileLogs.push_back('\n'); - }; - utils::LogCallbackGuard captureGuard(cb); + }); OV_ASSERT_NO_THROW(ie.compile_model(model, target_device)); } - - EXPECT_FALSE(secondCompileLogs.find("[INFO]") != std::string::npos) + EXPECT_EQ(secondCompileLogs.find("[INFO]"), std::string::npos) << "Per-call log::level from first compile contaminated the second compile.\n" "Captured output snippet:\n" << secondCompileLogs.substr(0, 500); From a55936909e417aba5c963962ed4b474ec1480bb7 Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Fri, 17 Jul 2026 09:55:24 +0100 Subject: [PATCH 10/18] Try fix host compile tests --- .../dynamic_host_pipeline/infer_with_host_compile.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp index 83ec9953e910ba..fb4ad964fde4be 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp @@ -372,6 +372,8 @@ InferWithHostCompileTests::RuntimeCompareSetupResult InferWithHostCompileTests:: return result; } + core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); + try { result.context.reqDynamic = result.context.compiledModel.create_infer_request(); } catch (const ov::Exception& e) { @@ -425,7 +427,6 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithDecreasedSize) { ScopedLogCapture logCapture; auto setupResult = prepareRuntimeCompareContext(model); - core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; @@ -496,7 +497,6 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithIncreasedSize) { ScopedLogCapture logCapture; auto setupResult = prepareRuntimeCompareContext(model); - core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; @@ -567,7 +567,6 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithZeroTensor) { ScopedLogCapture logCapture; auto setupResult = prepareRuntimeCompareContext(model); - core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; From 3b9cced340bf9baa103062a174bb1dea4be63ee1 Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Fri, 17 Jul 2026 10:05:19 +0100 Subject: [PATCH 11/18] Reduce logs for contaminate test --- .../tests/functional/behavior/ov_plugin/core_integration.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp index 052c4c5706a50c..71f5b2e0e77e6b 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp @@ -463,7 +463,7 @@ TEST_P(OVClassNetworkTestPNPU, smoke_LogLevelPerCallPropertyDoesNotContaminateSu { utils::LogCallbackGuard silentGuard(nullptr); - OV_ASSERT_NO_THROW(ie.compile_model(model, target_device, {{ov::log::level(ov::log::Level::INFO)}})); + OV_ASSERT_NO_THROW(ie.compile_model(model, target_device, {{ov::log::level(ov::log::Level::WARNING)}})); } ASSERT_EQ(::intel_npu::Logger::global().level(), baseline) << "Per-call log::level(INFO) contaminated Logger::global() after compile_model returned"; From c874aec20e560c85c2451f966ff7fe2f19339fc6 Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Fri, 17 Jul 2026 15:24:27 +0100 Subject: [PATCH 12/18] Revert changes to host compile tests --- .../infer_with_host_compile.hpp | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp index fb4ad964fde4be..f4a97d9d7c21a6 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp @@ -5,8 +5,8 @@ #pragma once #include -#include #include +#include #include #include #include @@ -30,18 +30,16 @@ inline std::shared_ptr createMaxPoolModel(bool dynamicBatch = false, std::shared_ptr input; if (dynamicBatch) { input = std::make_shared(ov::element::f16, - ov::PartialShape{ov::Dimension(1, 10), 16, 720, 1280}); + ov::PartialShape{ov::Dimension(1, 10), 16, 720, 1280}); } else { - input = std::make_shared( - ov::element::f16, - ov::PartialShape{1, 16, ov::Dimension(10, 720), ov::Dimension(10, 1280)}); + input = std::make_shared(ov::element::f16, + ov::PartialShape{1, 16, ov::Dimension(10, 720), ov::Dimension(10, 1280)}); } std::string inputName = "input1"; input->set_friendly_name(inputName); input->get_output_tensor(0).set_names({inputName}); - if (!nhwcLayout) - input->set_layout("NCHW"); + if (!nhwcLayout) input->set_layout("NCHW"); auto maxpool = std::make_shared(input, Strides{1, 1}, Shape{0, 0}, @@ -53,13 +51,12 @@ inline std::shared_ptr createMaxPoolModel(bool dynamicBatch = false, auto result = std::make_shared(maxpool); std::string outputName = "output"; - if (!nhwcLayout) - result->set_layout("NCHW"); + if (!nhwcLayout) result->set_layout("NCHW"); result->set_friendly_name(outputName); result->get_output_tensor(0).set_names({outputName}); auto model = std::make_shared(ResultVector{result}, ParameterVector{input}, "MaxPool"); - + // making input and output to be NHWC if (nhwcLayout) { auto preProc = ov::preprocess::PrePostProcessor(model); @@ -75,9 +72,8 @@ inline std::shared_ptr createMaxPoolModel(bool dynamicBatch = false, } inline std::shared_ptr createCustomNetModel() { - auto input = std::make_shared( - ov::element::f16, - ov::PartialShape{1, 16, ov::Dimension(1, 1080), ov::Dimension(10, 1920)}); + auto input = std::make_shared(ov::element::f16, + ov::PartialShape{1, 16, ov::Dimension(1, 1080), ov::Dimension(10, 1920)}); input->set_friendly_name("Parameter_59"); auto make_conv_add = [](const ov::Output& data, @@ -372,8 +368,6 @@ InferWithHostCompileTests::RuntimeCompareSetupResult InferWithHostCompileTests:: return result; } - core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); - try { result.context.reqDynamic = result.context.compiledModel.create_infer_request(); } catch (const ov::Exception& e) { @@ -426,8 +420,8 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithDecreasedSize) { auto model = createModelByName(selectedModelName); ScopedLogCapture logCapture; + core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); auto setupResult = prepareRuntimeCompareContext(model); - if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; } @@ -496,8 +490,8 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithIncreasedSize) { auto model = createModelByName(selectedModelName); ScopedLogCapture logCapture; + core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); auto setupResult = prepareRuntimeCompareContext(model); - if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; } @@ -566,8 +560,8 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithZeroTensor) { auto model = createModelByName(selectedModelName); ScopedLogCapture logCapture; + core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG)); auto setupResult = prepareRuntimeCompareContext(model); - if (setupResult.status == RuntimeCompareStatus::fail) { FAIL() << setupResult.message; } @@ -714,9 +708,12 @@ TEST_P(InferWithDefaultHostCompileTests, CompileDynamicModelWithNoHostCompileMod } if (selectedModelName == "MaxPool_NCHW_DynBatch") { - ASSERT_TRUE(isElfBlob(modelStream.str())) << "Expected exported model to be an ELF blob"; - } else if (selectedModelName == "MaxPool_NCHW") { - ASSERT_TRUE(isByteCodeBlob(modelStream.str())) << "Expected exported model to be a bytecode"; + ASSERT_TRUE(isElfBlob(modelStream.str())) + << "Expected exported model to be an ELF blob"; + } + else if (selectedModelName == "MaxPool_NCHW") { + ASSERT_TRUE(isByteCodeBlob(modelStream.str())) + << "Expected exported model to be a bytecode"; } ov::InferRequest reqDynamic; From 75cfeaf88623bdc0e3171aaeb20c0a238f0a8ec8 Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Mon, 20 Jul 2026 09:49:16 +0100 Subject: [PATCH 13/18] Fix log restoration in setups --- .../behavior/compiled_model/compatibility_string.hpp | 6 +++--- .../tests/functional/behavior/compiled_model/property.hpp | 8 +++++--- .../functional/internal/compiler_adapter/zero_graph.hpp | 8 +++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.hpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.hpp index 6f57711db1d4bd..f87c84b7a99f38 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.hpp @@ -30,18 +30,18 @@ class ClassCompatibilityStringTestNPU : public OVCompiledModelPropertiesBase, ov::Core core; private: - ov::log::Level _savedLogLevel{ov::log::Level::NO}; + std::optional _logGuard; public: void SetUp() override { + _logGuard.emplace(::intel_npu::Logger::global().level()); SKIP_IF_CURRENT_TEST_IS_DISABLED(); OVCompiledModelPropertiesBase::SetUp(); deviceName = GetParam(); - _savedLogLevel = ::intel_npu::Logger::global().level(); } void TearDown() override { - ::intel_npu::Logger::global().setLevel(_savedLogLevel); + _logGuard.reset(); OVCompiledModelPropertiesBase::TearDown(); } static std::string getTestCaseName(testing::TestParamInfo obj) { diff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp index 9ed22ad80fe88a..84b42bf078bee4 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp @@ -43,21 +43,23 @@ class ClassExecutableNetworkGetPropertiesTestNPU ov::Core ie; private: - ov::log::Level _savedLogLevel{ov::log::Level::NO}; + std::optional _logGuard; public: void SetUp() override { + _logGuard.emplace(::intel_npu::Logger::global().level()); SKIP_IF_CURRENT_TEST_IS_DISABLED(); + OVCompiledModelPropertiesBase::SetUp(); + deviceName = std::get<0>(GetParam()); std::tie(configKey, configValue) = std::get<1>(GetParam()); model = ov::test::utils::make_conv_pool_relu(); - _savedLogLevel = ::intel_npu::Logger::global().level(); } void TearDown() override { - ::intel_npu::Logger::global().setLevel(_savedLogLevel); + _logGuard.reset(); OVCompiledModelPropertiesBase::TearDown(); } static std::string getTestCaseName( diff --git a/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp b/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp index dd30e3b4eaa962..2776736622740e 100644 --- a/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp +++ b/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp @@ -81,11 +81,9 @@ class ZeroGraphTest : public ::testing::TestWithParamGetParam(); model = ov::test::utils::make_multi_single_conv(); @@ -105,7 +103,7 @@ class ZeroGraphTest : public ::testing::TestWithParam _logGuard; }; using ZeroGraphCompilationTests = ZeroGraphTest; From d4d09e4f0888929c48b6cd6286ca9c07686ad9d5 Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Mon, 20 Jul 2026 09:50:44 +0100 Subject: [PATCH 14/18] Fix contaminate test --- .../functional/behavior/ov_plugin/core_integration.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp index 71f5b2e0e77e6b..3546ddd5c3dcf7 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp @@ -458,17 +458,17 @@ TEST_P(OVClassNetworkTestPNPU, smoke_LogLevelPerCallPropertyDoesNotContaminateSu auto model = ov::test::utils::make_conv_pool_relu(); ov::Core ie; - utils::LoggerLevelGuard levelGuard(::intel_npu::Logger::global().level()); - const ov::log::Level baseline = ::intel_npu::Logger::global().level(); + utils::LoggerLevelGuard levelGuard(ov::log::Level::WARNING); + const ov::log::Level baseline = ov::log::Level::WARNING; { utils::LogCallbackGuard silentGuard(nullptr); - OV_ASSERT_NO_THROW(ie.compile_model(model, target_device, {{ov::log::level(ov::log::Level::WARNING)}})); + OV_ASSERT_NO_THROW(ie.compile_model(model, target_device, ov::AnyMap{ov::log::level(ov::log::Level::WARNING)})); } ASSERT_EQ(::intel_npu::Logger::global().level(), baseline) - << "Per-call log::level(INFO) contaminated Logger::global() after compile_model returned"; + << "Per-call log::level(WARNING) contaminated Logger::global() after compile_model returned"; - // second compile with not per-call log level should not inherit the INFO level from the first compile + // second compile with no per-call log level should not inherit the WARNING level from the first compile std::string secondCompileLogs; { utils::LogCallbackGuard captureGuard([&](std::string_view m) { From dbdb8449667673272a547cf1d0450583ee5ca139 Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Mon, 20 Jul 2026 08:52:03 +0000 Subject: [PATCH 15/18] Clang format --- .../infer_with_host_compile.hpp | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp index f4a97d9d7c21a6..34292875a5db5c 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp @@ -5,8 +5,8 @@ #pragma once #include -#include #include +#include #include #include #include @@ -30,16 +30,18 @@ inline std::shared_ptr createMaxPoolModel(bool dynamicBatch = false, std::shared_ptr input; if (dynamicBatch) { input = std::make_shared(ov::element::f16, - ov::PartialShape{ov::Dimension(1, 10), 16, 720, 1280}); + ov::PartialShape{ov::Dimension(1, 10), 16, 720, 1280}); } else { - input = std::make_shared(ov::element::f16, - ov::PartialShape{1, 16, ov::Dimension(10, 720), ov::Dimension(10, 1280)}); + input = std::make_shared( + ov::element::f16, + ov::PartialShape{1, 16, ov::Dimension(10, 720), ov::Dimension(10, 1280)}); } std::string inputName = "input1"; input->set_friendly_name(inputName); input->get_output_tensor(0).set_names({inputName}); - if (!nhwcLayout) input->set_layout("NCHW"); + if (!nhwcLayout) + input->set_layout("NCHW"); auto maxpool = std::make_shared(input, Strides{1, 1}, Shape{0, 0}, @@ -51,12 +53,13 @@ inline std::shared_ptr createMaxPoolModel(bool dynamicBatch = false, auto result = std::make_shared(maxpool); std::string outputName = "output"; - if (!nhwcLayout) result->set_layout("NCHW"); + if (!nhwcLayout) + result->set_layout("NCHW"); result->set_friendly_name(outputName); result->get_output_tensor(0).set_names({outputName}); auto model = std::make_shared(ResultVector{result}, ParameterVector{input}, "MaxPool"); - + // making input and output to be NHWC if (nhwcLayout) { auto preProc = ov::preprocess::PrePostProcessor(model); @@ -72,8 +75,9 @@ inline std::shared_ptr createMaxPoolModel(bool dynamicBatch = false, } inline std::shared_ptr createCustomNetModel() { - auto input = std::make_shared(ov::element::f16, - ov::PartialShape{1, 16, ov::Dimension(1, 1080), ov::Dimension(10, 1920)}); + auto input = std::make_shared( + ov::element::f16, + ov::PartialShape{1, 16, ov::Dimension(1, 1080), ov::Dimension(10, 1920)}); input->set_friendly_name("Parameter_59"); auto make_conv_add = [](const ov::Output& data, @@ -708,12 +712,9 @@ TEST_P(InferWithDefaultHostCompileTests, CompileDynamicModelWithNoHostCompileMod } if (selectedModelName == "MaxPool_NCHW_DynBatch") { - ASSERT_TRUE(isElfBlob(modelStream.str())) - << "Expected exported model to be an ELF blob"; - } - else if (selectedModelName == "MaxPool_NCHW") { - ASSERT_TRUE(isByteCodeBlob(modelStream.str())) - << "Expected exported model to be a bytecode"; + ASSERT_TRUE(isElfBlob(modelStream.str())) << "Expected exported model to be an ELF blob"; + } else if (selectedModelName == "MaxPool_NCHW") { + ASSERT_TRUE(isByteCodeBlob(modelStream.str())) << "Expected exported model to be a bytecode"; } ov::InferRequest reqDynamic; From e28ef206aedd8fc3393045cba6e8bbb846cd170f Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Mon, 20 Jul 2026 11:19:20 +0100 Subject: [PATCH 16/18] Revert "Clang format" This reverts commit dbdb8449667673272a547cf1d0450583ee5ca139. --- .../infer_with_host_compile.hpp | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp index 34292875a5db5c..f4a97d9d7c21a6 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.hpp @@ -5,8 +5,8 @@ #pragma once #include -#include #include +#include #include #include #include @@ -30,18 +30,16 @@ inline std::shared_ptr createMaxPoolModel(bool dynamicBatch = false, std::shared_ptr input; if (dynamicBatch) { input = std::make_shared(ov::element::f16, - ov::PartialShape{ov::Dimension(1, 10), 16, 720, 1280}); + ov::PartialShape{ov::Dimension(1, 10), 16, 720, 1280}); } else { - input = std::make_shared( - ov::element::f16, - ov::PartialShape{1, 16, ov::Dimension(10, 720), ov::Dimension(10, 1280)}); + input = std::make_shared(ov::element::f16, + ov::PartialShape{1, 16, ov::Dimension(10, 720), ov::Dimension(10, 1280)}); } std::string inputName = "input1"; input->set_friendly_name(inputName); input->get_output_tensor(0).set_names({inputName}); - if (!nhwcLayout) - input->set_layout("NCHW"); + if (!nhwcLayout) input->set_layout("NCHW"); auto maxpool = std::make_shared(input, Strides{1, 1}, Shape{0, 0}, @@ -53,13 +51,12 @@ inline std::shared_ptr createMaxPoolModel(bool dynamicBatch = false, auto result = std::make_shared(maxpool); std::string outputName = "output"; - if (!nhwcLayout) - result->set_layout("NCHW"); + if (!nhwcLayout) result->set_layout("NCHW"); result->set_friendly_name(outputName); result->get_output_tensor(0).set_names({outputName}); auto model = std::make_shared(ResultVector{result}, ParameterVector{input}, "MaxPool"); - + // making input and output to be NHWC if (nhwcLayout) { auto preProc = ov::preprocess::PrePostProcessor(model); @@ -75,9 +72,8 @@ inline std::shared_ptr createMaxPoolModel(bool dynamicBatch = false, } inline std::shared_ptr createCustomNetModel() { - auto input = std::make_shared( - ov::element::f16, - ov::PartialShape{1, 16, ov::Dimension(1, 1080), ov::Dimension(10, 1920)}); + auto input = std::make_shared(ov::element::f16, + ov::PartialShape{1, 16, ov::Dimension(1, 1080), ov::Dimension(10, 1920)}); input->set_friendly_name("Parameter_59"); auto make_conv_add = [](const ov::Output& data, @@ -712,9 +708,12 @@ TEST_P(InferWithDefaultHostCompileTests, CompileDynamicModelWithNoHostCompileMod } if (selectedModelName == "MaxPool_NCHW_DynBatch") { - ASSERT_TRUE(isElfBlob(modelStream.str())) << "Expected exported model to be an ELF blob"; - } else if (selectedModelName == "MaxPool_NCHW") { - ASSERT_TRUE(isByteCodeBlob(modelStream.str())) << "Expected exported model to be a bytecode"; + ASSERT_TRUE(isElfBlob(modelStream.str())) + << "Expected exported model to be an ELF blob"; + } + else if (selectedModelName == "MaxPool_NCHW") { + ASSERT_TRUE(isByteCodeBlob(modelStream.str())) + << "Expected exported model to be a bytecode"; } ov::InferRequest reqDynamic; From 926c853af395f06652893fe3e8c3c671dda16ad8 Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Mon, 20 Jul 2026 11:41:59 +0100 Subject: [PATCH 17/18] Add missing guards --- .../tests/functional/behavior/compiled_model/property.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp index 84b42bf078bee4..2fa00eb68a2929 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp @@ -797,6 +797,7 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromSetProperty) { ov::Core core; ov::CompiledModel compiled_model; + ov::test::utils::LoggerLevelGuard logGuard(ov::log::Level::WARNING); core.set_property(deviceName, ov::log::level(ov::log::Level::WARNING)); // Keep this std::function alive while logging is active. @@ -840,6 +841,8 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromCompileProperty) { ov::Core core; ov::CompiledModel compiled_model; + ov::test::utils::LoggerLevelGuard logGuard(ov::log::Level::WARNING); + // Keep this std::function alive while logging is active. std::function log_cb = [&](std::string_view msg) { std::lock_guard lock(logs_mutex); From e7117101e764177856b7412f2f4f23c838bc3606 Mon Sep 17 00:00:00 2001 From: alexandruenache1111 Date: Mon, 20 Jul 2026 11:42:54 +0100 Subject: [PATCH 18/18] Nitpicks contaminate test --- .../behavior/ov_plugin/core_integration.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp index 3546ddd5c3dcf7..e51ff296e585e9 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/core_integration.hpp @@ -66,10 +66,10 @@ class OVClassBaseTestPNPU : public OVClassNetworkTest, } void SetUp() override { - std::tie(target_device, configuration) = this->GetParam(); SKIP_IF_CURRENT_TEST_IS_DISABLED(); + APIBaseTest::SetUp(); - SKIP_IF_CURRENT_TEST_IS_DISABLED(); + std::tie(target_device, configuration) = this->GetParam(); // Generic network actualNetwork = ov::test::utils::make_split_conv_concat(); // Quite simple network @@ -458,8 +458,9 @@ TEST_P(OVClassNetworkTestPNPU, smoke_LogLevelPerCallPropertyDoesNotContaminateSu auto model = ov::test::utils::make_conv_pool_relu(); ov::Core ie; - utils::LoggerLevelGuard levelGuard(ov::log::Level::WARNING); - const ov::log::Level baseline = ov::log::Level::WARNING; + // if the log level leaks, the second compile will produce WARNING logs and the test will fail + utils::LoggerLevelGuard levelGuard(ov::log::Level::ERR); + const ov::log::Level baseline = ov::log::Level::ERR; { utils::LogCallbackGuard silentGuard(nullptr); @@ -468,7 +469,6 @@ TEST_P(OVClassNetworkTestPNPU, smoke_LogLevelPerCallPropertyDoesNotContaminateSu ASSERT_EQ(::intel_npu::Logger::global().level(), baseline) << "Per-call log::level(WARNING) contaminated Logger::global() after compile_model returned"; - // second compile with no per-call log level should not inherit the WARNING level from the first compile std::string secondCompileLogs; { utils::LogCallbackGuard captureGuard([&](std::string_view m) { @@ -477,8 +477,8 @@ TEST_P(OVClassNetworkTestPNPU, smoke_LogLevelPerCallPropertyDoesNotContaminateSu }); OV_ASSERT_NO_THROW(ie.compile_model(model, target_device)); } - EXPECT_EQ(secondCompileLogs.find("[INFO]"), std::string::npos) - << "Per-call log::level from first compile contaminated the second compile.\n" + EXPECT_EQ(secondCompileLogs.find("[WARNING]"), std::string::npos) + << "Per-call log::level(WARNING) from first compile contaminated the second compile.\n" "Captured output snippet:\n" << secondCompileLogs.substr(0, 500); }