Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[NPU] Adding support for is_property_supported() plugin method (#34464)

Bogdan Pereanu59230a99bbc7
diff --git a/src/plugins/intel_npu/src/plugin/include/plugin.hpp b/src/plugins/intel_npu/src/plugin/include/plugin.hpp
index c32d29bd177..a960232186f 100644
--- a/src/plugins/intel_npu/src/plugin/include/plugin.hpp
+++ b/src/plugins/intel_npu/src/plugin/include/plugin.hpp
@@ -32,6 +32,8 @@ public:
ov::Any get_property(const std::string& name, const ov::AnyMap& arguments) const override;
+ bool is_property_supported(const std::string& name, const ov::AnyMap& arguments = {}) const override;
+
std::shared_ptr<ov::ICompiledModel> compile_model(const std::shared_ptr<const ov::Model>& model,
const ov::AnyMap& properties) const override;
diff --git a/src/plugins/intel_npu/src/plugin/include/properties.hpp b/src/plugins/intel_npu/src/plugin/include/properties.hpp
index d84a667ead3..4b38ff55156 100644
--- a/src/plugins/intel_npu/src/plugin/include/properties.hpp
+++ b/src/plugins/intel_npu/src/plugin/include/properties.hpp
@@ -42,6 +42,11 @@ public:
*/
void setProperty(const ov::AnyMap& properties);
+ /**
+ * @brief Checks if a property is supported by the plugin.
+ */
+ bool isPropertySupported(const std::string& name);
+
/**
* @brief Get a const reference to the stored config
*/
diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
index 4941de072a1..85b73eaec38 100644
--- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
@@ -432,10 +432,10 @@ void Plugin::set_property(const ov::AnyMap& properties) {
}
ov::Any Plugin::get_property(const std::string& name, const ov::AnyMap& arguments) const {
- auto npuPluginArguments = arguments;
- exclude_model_ptr_from_map(npuPluginArguments);
+ if (!arguments.empty()) {
+ auto npuPluginArguments = arguments;
+ exclude_model_ptr_from_map(npuPluginArguments);
- if (!npuPluginArguments.empty()) {
// Need to create a temporary copy of the properties manager. The set of arguments we get might change the list
// of supported properties, but we cannot alter the global state
auto copyPropertiesManager = std::make_unique<Properties>(*_propertiesManager);
@@ -447,6 +447,29 @@ ov::Any Plugin::get_property(const std::string& name, const ov::AnyMap& argument
return _propertiesManager->getProperty(name);
}
+bool Plugin::is_property_supported(const std::string& name, const ov::AnyMap& arguments) const {
+ if (!arguments.empty()) {
+ auto npuPluginArguments = arguments;
+ exclude_model_ptr_from_map(npuPluginArguments);
+
+ // Need to create a temporary copy of the properties manager. The set of arguments we get might change the list
+ // of supported properties, but we cannot alter the global state
+ auto copyPropertiesManager = std::make_unique<Properties>(*_propertiesManager);
+
+ try {
+ copyPropertiesManager->setProperty(npuPluginArguments);
+ } catch (...) {
+ // In case of a failure during property setting, we assume the arguments are not valid and thus the
+ // supported properties cannot be reliably determined - return false in this case
+ return false;
+ }
+
+ return copyPropertiesManager->isPropertySupported(name);
+ }
+
+ return _propertiesManager->isPropertySupported(name);
+}
+
std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<const ov::Model>& model,
const ov::AnyMap& properties) const {
OV_ITT_SCOPED_TASK(itt::domains::NPUPlugin, "Plugin::compile_model");
diff --git a/src/plugins/intel_npu/src/plugin/src/properties.cpp b/src/plugins/intel_npu/src/plugin/src/properties.cpp
index ee386035802..c46b3b80c26 100644
--- a/src/plugins/intel_npu/src/plugin/src/properties.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/properties.cpp
@@ -25,6 +25,11 @@ std::map<std::string, std::string> any_copy(const ov::AnyMap& params) {
return result;
}
+inline bool isSpecialBothProperty(const std::string& key) {
+ return key == ov::hint::performance_mode.name() || key == ov::enable_profiling.name() ||
+ key == ov::log::level.name();
+}
+
void filterPropertiesByCompilerSupport(intel_npu::FilteredConfig& config,
const intel_npu::ICompilerAdapter* compiler,
const ov::SoPtr<intel_npu::IEngineBackend>& backend,
@@ -60,10 +65,8 @@ void filterPropertiesByCompilerSupport(intel_npu::FilteredConfig& config,
bool isEnabled = false;
auto opt = config.getOpt(key);
// Special case for some both configs. Don't need compiler for these Both properties.
- const bool isNotSpecialBothProperty = key != ov::hint::performance_mode.name() &&
- key != ov::enable_profiling.name() && key != ov::log::level.name();
// Runtime (plugin-only) options are always enabled
- if (opt.mode() != OptionMode::RunTime && isNotSpecialBothProperty) {
+ if (opt.mode() != OptionMode::RunTime && !isSpecialBothProperty(key)) {
if (legacy) {
// Compiler or common option in Legacy mode? Checking its supported version
if (compilerVersion >= opt.compilerSupportVersion()) {
@@ -114,10 +117,8 @@ void disableCompilerProperties(intel_npu::FilteredConfig& config, const ov::SoPt
auto opt = config.getOpt(key);
// Special case for some both configs. Don't need compiler for these Both properties.
- const bool isNotSpecialBothProperty = key != ov::hint::performance_mode.name() &&
- key != ov::enable_profiling.name() && key != ov::log::level.name();
// Runtime (plugin-only) options are always enabled
- if (opt.mode() != OptionMode::RunTime && isNotSpecialBothProperty) { // Compiler and common options
+ if (opt.mode() != OptionMode::RunTime && !isSpecialBothProperty(key)) { // Compiler and common options
// Disable all compiler options
config.enable(key, false);
}
@@ -845,9 +846,7 @@ ov::Any Properties::getProperty(const std::string& name) {
} else {
// Property is already registered but need to re-check if the CompilerTime config is still supported by the
// current compiler.
- const bool isNotSpecialBothProperty = name != ov::hint::performance_mode.name() &&
- name != ov::enable_profiling.name() && name != ov::log::level.name();
- if (_config.hasOpt(name) && isNotSpecialBothProperty) {
+ if (_config.hasOpt(name) && !isSpecialBothProperty(name)) {
auto opt = _config.getOpt(name);
if (opt.mode() != OptionMode::RunTime) {
propertyIsCompilerConfig = true;
@@ -855,7 +854,10 @@ ov::Any Properties::getProperty(const std::string& name) {
}
}
- if (propertyIsCompilerConfig || !propertyIsRegistered || name == ov::supported_properties.name()) {
+ // Special case for Supported Properties and Caching Properties as they are compiler dependent. So we need to
+ // check compiler support for those properties on each getProperty call as well.
+ if (propertyIsCompilerConfig || !propertyIsRegistered || name == ov::supported_properties.name() ||
+ name == ov::internal::caching_properties.name()) {
std::unique_ptr<ICompilerAdapter> compiler = nullptr;
auto compilerType = _config.get<COMPILER_TYPE>();
auto deviceId = _config.get<DEVICE_ID>();
@@ -923,9 +925,7 @@ void Properties::setProperty(const ov::AnyMap& properties) {
break;
}
// Special case for some both configs. Don't need to check compiler support for these Both properties.
- const bool isNotSpecialBothProperty = property.first != ov::hint::performance_mode.name() &&
- property.first != ov::enable_profiling.name() &&
- property.first != ov::log::level.name();
+ const bool isNotSpecialBothProperty = !isSpecialBothProperty(property.first);
if (_config.hasOpt(property.first) && isNotSpecialBothProperty) {
auto opt = _config.getOpt(property.first);
if (opt.mode() != OptionMode::RunTime) {
@@ -995,6 +995,78 @@ void Properties::setProperty(const ov::AnyMap& properties) {
}
}
+bool Properties::isPropertySupported(const std::string& name) {
+ std::lock_guard<std::mutex> lock(_mutex);
+ if (_pType == PropertiesType::PLUGIN) {
+ const bool isRegistered = isPropertyRegistered(name);
+ const bool isConfigOption = _config.hasOpt(name);
+
+ if (!isRegistered && !isConfigOption) {
+ // Property is neither registered nor known by config
+ return false;
+ }
+
+ if (isRegistered) {
+ // Registered and not a config option: always supported. Or it is a special both property which is always
+ // supported.
+ if (!isConfigOption || isSpecialBothProperty(name)) {
+ return true;
+ }
+
+ // Registered as a config option: runtime mode is always supported.
+ auto opt = _config.getOpt(name);
+ if (opt.mode() == OptionMode::RunTime) {
+ return true;
+ }
+ }
+
+ // Property is compiler config, need to check compiler support
+ std::unique_ptr<ICompilerAdapter> compiler = nullptr;
+ auto compilerType = _config.get<COMPILER_TYPE>();
+ auto deviceId = _config.get<DEVICE_ID>();
+ auto device = utils::getDeviceById(_backend, deviceId);
+
+ auto compilationPlatform = utils::getCompilationPlatform(
+ _config.get<PLATFORM>(),
+ device == nullptr ? deviceId : device->getName(),
+ _backend == nullptr ? std::vector<std::string>() : _backend->getDeviceNames());
+
+ // Create a compiler to get the type and fetch version and supported options if needed
+ CompilerAdapterFactory factory;
+ try {
+ compiler = factory.getCompiler(_backend, compilerType, compilationPlatform);
+ } catch (const std::exception& ex) {
+ if (_config.hasOpt(name) && _config.getOpt(name).mode() == OptionMode::CompileTime) {
+ return false;
+ }
+
+ _logger.warning("Failed to create compiler to query property %s with error: %s. "
+ "Registering only runtime properties and metrics that do not require compiler support.",
+ name.c_str(),
+ ex.what());
+ }
+
+ if (compiler != nullptr && !(_compilerConfigsFilteredByCompiler && compilerType == _currentlyUsedCompiler &&
+ compilationPlatform == _currentlyUsedPlatform)) {
+ // In case properties are not initialized or the compiler/platform was changed since last call -
+ // filter out options again
+ filterPropertiesByCompilerSupport(_config, compiler.get(), _backend, _logger);
+
+ // reset properties for the new options
+ registerProperties();
+ _compilerConfigsFilteredByCompiler = true;
+ _currentlyUsedCompiler = compilerType;
+ _currentlyUsedPlatform = compilationPlatform;
+ }
+ }
+
+ if (isPropertyRegistered(name)) {
+ return true;
+ }
+
+ return false;
+}
+
bool Properties::isPropertyRegistered(const std::string& propertyName) const {
return _properties.find(propertyName) != _properties.end();
}
diff --git a/src/plugins/intel_npu/tests/functional/CMakeLists.txt b/src/plugins/intel_npu/tests/functional/CMakeLists.txt
index d008956d9ae..330b88d4012 100644
--- a/src/plugins/intel_npu/tests/functional/CMakeLists.txt
+++ b/src/plugins/intel_npu/tests/functional/CMakeLists.txt
@@ -43,6 +43,8 @@ ov_add_test_target(
"${CMAKE_CURRENT_SOURCE_DIR}/internal"
OBJECT_FILES
"${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/remote_context.cpp"
+ "${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/properties.cpp"
+ "${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/metrics.cpp"
LINK_LIBRARIES
${OPTIONAL_FUNC_TESTS_LIBS}
openvino::func_test_utils
diff --git a/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.cpp b/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.cpp
new file mode 100644
index 00000000000..47cea7f6765
--- /dev/null
+++ b/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.cpp
@@ -0,0 +1,35 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "internal/plugin/test_properties.hpp"
+
+#include "common/npu_test_env_cfg.hpp"
+#include "common/utils.hpp"
+
+using namespace ov::test::behavior;
+
+const std::vector<std::string> supported_configs = {{ov::hint::performance_mode.name()},
+ {ov::cache_dir.name()},
+ {ov::intel_npu::driver_version.name()}};
+const std::vector<std::string> supported_compiler_configs = {{ov::intel_npu::turbo.name()},
+ {ov::intel_npu::qdq_optimization.name()}};
+const std::vector<std::string> unsupported_compiler_configs = {{"DUMMY_PROPERTY"}};
+
+INSTANTIATE_TEST_SUITE_P(compatibility_smoke_BehaviorTest,
+ PropertiesManagerTests,
+ ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_NPU),
+ ::testing::ValuesIn(supported_configs)),
+ PropertiesManagerTests::getTestCaseName);
+
+INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTest,
+ ExpectLoadingCompilerPropertySupported,
+ ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_NPU),
+ ::testing::ValuesIn(supported_compiler_configs)),
+ PropertiesManagerTests::getTestCaseName);
+
+INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTest,
+ ExpectLoadingCompilerPropertyNotSupported,
+ ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_NPU),
+ ::testing::ValuesIn(unsupported_compiler_configs)),
+ PropertiesManagerTests::getTestCaseName);
diff --git a/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.hpp b/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.hpp
new file mode 100644
index 00000000000..f5f67d180c7
--- /dev/null
+++ b/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.hpp
@@ -0,0 +1,396 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include <gmock/gmock-matchers.h>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include <array>
+#include <cstddef>
+#include <exception>
+#include <memory>
+#include <random>
+#include <thread>
+
+#include "common/npu_test_env_cfg.hpp"
+#include "common/utils.hpp"
+#include "functional_test_utils/ov_plugin_cache.hpp"
+#include "intel_npu/common/compiler_adapter_factory.hpp"
+#include "intel_npu/common/filtered_config.hpp"
+#include "intel_npu/common/npu.hpp"
+#include "intel_npu/config/npuw.hpp"
+#include "intel_npu/config/options.hpp"
+#include "intel_npu/npu_private_properties.hpp"
+#include "intel_npu/npuw_private_properties.hpp"
+#include "metrics.hpp"
+#include "openvino/core/any.hpp"
+#include "openvino/core/log.hpp"
+#include "openvino/runtime/core.hpp"
+#include "openvino/runtime/intel_npu/properties.hpp"
+#include "properties.hpp"
+#include "shared_test_classes/base/ov_behavior_test_utils.hpp"
+#include "zero_backend.hpp"
+
+using ::testing::AllOf;
+using ::testing::HasSubstr;
+
+using ConfigParams = std::tuple<std::string, // Device name
+ std::string>; // Config name
+
+namespace {
+class LogCallbackGuard {
+public:
+ explicit LogCallbackGuard(const std::function<void(std::string_view)>& callback) {
+ ov::util::set_log_callback(callback);
+ }
+
+ ~LogCallbackGuard() {
+ ov::util::reset_log_callback();
+ }
+
+ LogCallbackGuard(const LogCallbackGuard&) = delete;
+ LogCallbackGuard& operator=(const LogCallbackGuard&) = delete;
+};
+
+class LoggerLevelGuard {
+public:
+ explicit LoggerLevelGuard(ov::log::Level level) : _previousLevel(::intel_npu::Logger::global().level()) {
+ ::intel_npu::Logger::global().setLevel(level);
+ }
+
+ ~LoggerLevelGuard() {
+ ::intel_npu::Logger::global().setLevel(_previousLevel);
+ }
+
+ LoggerLevelGuard(const LoggerLevelGuard&) = delete;
+ LoggerLevelGuard& operator=(const LoggerLevelGuard&) = delete;
+
+private:
+ ov::log::Level _previousLevel;
+};
+} // namespace
+
+namespace ov {
+namespace test {
+namespace behavior {
+class PropertiesManagerTests : public ov::test::behavior::OVPluginTestBase,
+ public testing::WithParamInterface<ConfigParams> {
+protected:
+ std::shared_ptr<::intel_npu::OptionsDesc> options = std::make_shared<::intel_npu::OptionsDesc>();
+ ::intel_npu::FilteredConfig npu_config = ::intel_npu::FilteredConfig(options);
+ ov::SoPtr<::intel_npu::IEngineBackend> backend;
+ std::unique_ptr<::intel_npu::Properties> propertiesManager;
+
+ std::string configuration;
+ std::string targetDevice;
+
+public:
+ static std::string getTestCaseName(const testing::TestParamInfo<ConfigParams>& obj) {
+ std::string targetDevice;
+ std::string configuration;
+ std::tie(targetDevice, configuration) = obj.param;
+
+ std::replace(targetDevice.begin(), targetDevice.end(), ':', '_');
+
+ std::ostringstream result;
+ result << "targetDevice=" << targetDevice << "_";
+ result << "targetPlatform=" << ov::test::utils::getTestsPlatformFromEnvironmentOr(targetDevice) << "_";
+ result << "config=" << configuration << "_";
+
+ return result.str();
+ }
+
+ void SetUp() override {
+ using namespace ::intel_npu;
+
+ std::tie(targetDevice, configuration) = this->GetParam();
+
+ SKIP_IF_CURRENT_TEST_IS_DISABLED()
+ OVPluginTestBase::SetUp();
+
+ backend = ov::SoPtr<IEngineBackend>(std::make_shared<ZeroEngineBackend>());
+ auto metrics = std::make_shared<Metrics>(backend);
+
+ options->reset();
+
+#define REGISTER_OPTION(OPT_TYPE) \
+ do { \
+ auto dummyopt = details::makeOptionModel<OPT_TYPE>(); \
+ std::string o_name = dummyopt.key().data(); \
+ options->add<OPT_TYPE>(); \
+ npu_config.enable(std::move(o_name), false); \
+ } while (0)
+
+ REGISTER_OPTION(LOG_LEVEL);
+ REGISTER_OPTION(CACHE_DIR);
+ REGISTER_OPTION(CACHE_MODE);
+ REGISTER_OPTION(COMPILED_BLOB);
+ REGISTER_OPTION(DEVICE_ID);
+ REGISTER_OPTION(NUM_STREAMS);
+ REGISTER_OPTION(PERF_COUNT);
+ REGISTER_OPTION(LOADED_FROM_CACHE);
+ REGISTER_OPTION(COMPILATION_NUM_THREADS);
+ REGISTER_OPTION(PERFORMANCE_HINT);
+ REGISTER_OPTION(EXECUTION_MODE_HINT);
+ REGISTER_OPTION(PERFORMANCE_HINT_NUM_REQUESTS);
+ REGISTER_OPTION(ENABLE_CPU_PINNING);
+ REGISTER_OPTION(INFERENCE_PRECISION_HINT);
+ REGISTER_OPTION(MODEL_PRIORITY);
+ REGISTER_OPTION(EXCLUSIVE_ASYNC_REQUESTS);
+ REGISTER_OPTION(COMPILATION_MODE_PARAMS);
+ REGISTER_OPTION(DMA_ENGINES);
+ REGISTER_OPTION(TILES);
+ REGISTER_OPTION(COMPILATION_MODE);
+ REGISTER_OPTION(COMPILER_TYPE);
+ REGISTER_OPTION(PLATFORM);
+ REGISTER_OPTION(CREATE_EXECUTOR);
+ REGISTER_OPTION(DYNAMIC_SHAPE_TO_STATIC);
+ REGISTER_OPTION(PROFILING_TYPE);
+ REGISTER_OPTION(BACKEND_COMPILATION_PARAMS);
+ REGISTER_OPTION(BATCH_MODE);
+ REGISTER_OPTION(BYPASS_UMD_CACHING);
+ REGISTER_OPTION(DEFER_WEIGHTS_LOAD);
+ REGISTER_OPTION(WEIGHTS_PATH);
+ REGISTER_OPTION(RUN_INFERENCES_SEQUENTIALLY);
+ REGISTER_OPTION(COMPILER_DYNAMIC_QUANTIZATION);
+ REGISTER_OPTION(QDQ_OPTIMIZATION);
+ REGISTER_OPTION(QDQ_OPTIMIZATION_AGGRESSIVE);
+ REGISTER_OPTION(STEPPING);
+ REGISTER_OPTION(MAX_TILES);
+ REGISTER_OPTION(DISABLE_VERSION_CHECK);
+ REGISTER_OPTION(EXPORT_RAW_BLOB);
+ REGISTER_OPTION(IMPORT_RAW_BLOB);
+ REGISTER_OPTION(BATCH_COMPILER_MODE_SETTINGS);
+ REGISTER_OPTION(TURBO);
+ REGISTER_OPTION(WEIGHTLESS_BLOB);
+ REGISTER_OPTION(SEPARATE_WEIGHTS_VERSION);
+ REGISTER_OPTION(WS_COMPILE_CALL_NUMBER);
+ REGISTER_OPTION(USE_BASE_MODEL_SERIALIZER);
+ REGISTER_OPTION(MODEL_SERIALIZER_VERSION);
+ REGISTER_OPTION(ENABLE_STRIDES_FOR);
+
+ if (backend) {
+ if (backend->isCommandQueueExtSupported()) {
+ REGISTER_OPTION(WORKLOAD_TYPE);
+ }
+ if (backend->isContextExtSupported()) {
+ REGISTER_OPTION(DISABLE_IDLE_MEMORY_PRUNING);
+ }
+ }
+
+ REGISTER_OPTION(NPU_USE_NPUW);
+ REGISTER_OPTION(NPUW_DEVICES);
+ REGISTER_OPTION(NPUW_SUBMODEL_DEVICE);
+ REGISTER_OPTION(NPUW_WEIGHTS_BANK);
+ REGISTER_OPTION(NPUW_WEIGHTS_BANK_ALLOC);
+ REGISTER_OPTION(NPUW_ONLINE_PIPELINE);
+ REGISTER_OPTION(NPUW_ONLINE_AVOID);
+ REGISTER_OPTION(NPUW_ONLINE_ISOLATE);
+ REGISTER_OPTION(NPUW_ONLINE_NO_FOLD);
+ REGISTER_OPTION(NPUW_ONLINE_MIN_SIZE);
+ REGISTER_OPTION(NPUW_ONLINE_KEEP_BLOCKS);
+ REGISTER_OPTION(NPUW_ONLINE_KEEP_BLOCK_SIZE);
+ REGISTER_OPTION(NPUW_ATTN);
+ REGISTER_OPTION(NPUW_FOLD);
+ REGISTER_OPTION(NPUW_CWAI);
+ REGISTER_OPTION(NPUW_DQ);
+ REGISTER_OPTION(NPUW_DQ_FULL);
+ REGISTER_OPTION(NPUW_PMM);
+ REGISTER_OPTION(NPUW_SLICE_OUT);
+ REGISTER_OPTION(NPUW_SPATIAL);
+ REGISTER_OPTION(NPUW_SPATIAL_NWAY);
+ REGISTER_OPTION(NPUW_SPATIAL_DYN);
+ REGISTER_OPTION(NPUW_F16IC);
+ REGISTER_OPTION(NPUW_HOST_GATHER);
+ REGISTER_OPTION(NPUW_DCOFF_TYPE);
+ REGISTER_OPTION(NPUW_DCOFF_SCALE);
+ REGISTER_OPTION(NPUW_FUNCALL_FOR_ALL);
+ REGISTER_OPTION(NPUW_FUNCALL_ASYNC);
+ REGISTER_OPTION(NPUW_UNFOLD_IREQS);
+ REGISTER_OPTION(NPUW_FALLBACK_EXEC);
+ REGISTER_OPTION(NPUW_LLM);
+ REGISTER_OPTION(NPUW_LLM_BATCH_DIM);
+ REGISTER_OPTION(NPUW_LLM_SEQ_LEN_DIM);
+ REGISTER_OPTION(NPUW_LLM_MAX_PROMPT_LEN);
+ REGISTER_OPTION(NPUW_LLM_MAX_GENERATION_TOKEN_LEN);
+ REGISTER_OPTION(NPUW_LLM_MIN_RESPONSE_LEN);
+ REGISTER_OPTION(NPUW_LLM_OPTIMIZE_V_TENSORS);
+ REGISTER_OPTION(NPUW_LLM_OPTIMIZE_FP8);
+ REGISTER_OPTION(NPUW_LLM_CACHE_ROPE);
+ REGISTER_OPTION(NPUW_LLM_PREFILL_MOE_HINT);
+ REGISTER_OPTION(NPUW_LLM_GENERATE_MOE_HINT);
+ REGISTER_OPTION(NPUW_LLM_GENERATE_PYRAMID);
+ REGISTER_OPTION(NPUW_LLM_PREFILL_CHUNK_SIZE);
+ REGISTER_OPTION(NPUW_LLM_SHARED_HEAD);
+ REGISTER_OPTION(NPUW_LLM_MAX_LORA_RANK);
+ REGISTER_OPTION(NPUW_LLM_ENABLE_PREFIX_CACHING);
+ REGISTER_OPTION(NPUW_LLM_PREFIX_CACHING_BLOCK_SIZE);
+ REGISTER_OPTION(NPUW_LLM_PREFIX_CACHING_MAX_NUM_BLOCKS);
+ REGISTER_OPTION(NPUW_WHISPER);
+ REGISTER_OPTION(NPUW_EAGLE);
+ REGISTER_OPTION(NPUW_TEXT_EMBED);
+ REGISTER_OPTION(NPUW_LLM_PREFILL_HINT);
+ REGISTER_OPTION(NPUW_LLM_PREFILL_CONFIG);
+ REGISTER_OPTION(NPUW_LLM_ADDITIONAL_PREFILL_CONFIG);
+ REGISTER_OPTION(NPUW_LLM_PREFILL_ATTENTION_HINT);
+ REGISTER_OPTION(NPUW_LLM_GENERATE_HINT);
+ REGISTER_OPTION(NPUW_LLM_GENERATE_CONFIG);
+ REGISTER_OPTION(NPUW_LLM_ADDITIONAL_GENERATE_CONFIG);
+ REGISTER_OPTION(NPUW_LLM_GENERATE_ATTENTION_HINT);
+ REGISTER_OPTION(NPUW_LLM_SHARED_LM_HEAD_CONFIG);
+ REGISTER_OPTION(NPUW_LLM_ADDITIONAL_SHARED_LM_HEAD_CONFIG);
+ REGISTER_OPTION(NPUW_KOKORO);
+ REGISTER_OPTION(NPUW_KOKORO_BLOCK_SIZE);
+ REGISTER_OPTION(NPUW_KOKORO_OVERLAP_SIZE);
+
+ npu_config.enableRuntimeOptions();
+
+ // Special cases - options with OptionMode::Both must be enabled for the plugin even if the compiler does not
+ // support them, because they may be used by the plugin itself or by the driver.
+ // We still check compiler support to decide whether these options should be removed from the config string.
+
+ // NPU_TURBO might be supported by the driver
+ if (backend && backend->isCommandQueueExtSupported()) {
+ npu_config.enable(ov::intel_npu::turbo.name(), true);
+ }
+
+ // LOG_LEVEL, PERFORMANCE_HINT and PERF_COUNT are needed by runtime options
+ npu_config.enable(ov::log::level.name(), true);
+ npu_config.enable(ov::hint::performance_mode.name(), true);
+ npu_config.enable(ov::enable_profiling.name(), true);
+
+ if (npu_config.get<COMPILER_TYPE>() == ov::intel_npu::CompilerType::PREFER_PLUGIN && backend != nullptr) {
+ auto device = backend->getDevice();
+ if (device) {
+ auto platformName = device->getName();
+ CompilerAdapterFactory compilerFactory;
+ auto compileType = compilerFactory.determineAppropriateCompilerTypeBasedOnPlatform(platformName);
+ if (compileType == ov::intel_npu::CompilerType::DRIVER) {
+ npu_config.update({{ov::intel_npu::compiler_type.name(), COMPILER_TYPE::toString(compileType)}});
+ }
+ }
+ }
+
+ propertiesManager = std::make_unique<Properties>(PropertiesType::PLUGIN, npu_config, metrics, backend);
+ }
+
+ void TearDown() override {
+ APIBaseTest::TearDown();
+ }
+};
+
+TEST_P(PropertiesManagerTests, ExpectRunTimeSpecialBothPropertyIsSupported) {
+ std::string logs;
+ std::mutex logs_mutex;
+ bool isSupported = false;
+
+ // Keep this std::function alive while logging is active.
+ std::function<void(std::string_view)> log_cb = [&](std::string_view msg) {
+ std::lock_guard<std::mutex> lock(logs_mutex);
+ logs.append(msg);
+ logs.push_back('\n');
+ };
+
+ {
+ LogCallbackGuard log_callback_guard(log_cb);
+ LoggerLevelGuard logger_level_guard(ov::log::Level::INFO);
+ propertiesManager->setProperty({{ov::log::level(ov::log::Level::INFO)}});
+ propertiesManager->setProperty({{ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER)}});
+ isSupported = propertiesManager->isPropertySupported(configuration);
+ }
+
+ ASSERT_EQ(logs.find("initialize DriverCompilerAdapter start"), std::string::npos);
+ ASSERT_EQ(logs.find("initialize PluginCompilerAdapter start"), std::string::npos);
+ ASSERT_TRUE(isSupported);
+}
+
+TEST_P(PropertiesManagerTests, ExpectArgumentIsNotSupported) {
+ std::string logs;
+ std::mutex logs_mutex;
+ bool isSupported = true;
+
+ // Keep this std::function alive while logging is active.
+ std::function<void(std::string_view)> log_cb = [&](std::string_view msg) {
+ std::lock_guard<std::mutex> lock(logs_mutex);
+ logs.append(msg);
+ logs.push_back('\n');
+ };
+
+ ov::AnyMap arguments = {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER),
+ {"DUMMY_PROPERTY", "DUMMY_VALUE"}};
+
+ {
+ LogCallbackGuard log_callback_guard(log_cb);
+ LoggerLevelGuard logger_level_guard(ov::log::Level::INFO);
+
+ try {
+ propertiesManager->setProperty(arguments);
+ isSupported = true;
+ } catch (...) {
+ isSupported = false;
+ }
+ }
+
+ ASSERT_FALSE(isSupported);
+ ASSERT_NE(logs.find("initialize DriverCompilerAdapter start"), std::string::npos);
+ ASSERT_EQ(logs.find("initialize PluginCompilerAdapter start"), std::string::npos);
+}
+
+using ExpectLoadingCompilerPropertySupported = PropertiesManagerTests;
+
+TEST_P(ExpectLoadingCompilerPropertySupported, ExpectCompilerPropertyIsSupported) {
+ std::string logs;
+ std::mutex logs_mutex;
+ bool isSupported = false;
+
+ // Keep this std::function alive while logging is active.
+ std::function<void(std::string_view)> log_cb = [&](std::string_view msg) {
+ std::lock_guard<std::mutex> lock(logs_mutex);
+ logs.append(msg);
+ logs.push_back('\n');
+ };
+
+ {
+ LogCallbackGuard log_callback_guard(log_cb);
+ LoggerLevelGuard logger_level_guard(ov::log::Level::INFO);
+ propertiesManager->setProperty({{ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER)}});
+ isSupported = propertiesManager->isPropertySupported(configuration);
+ }
+
+ ASSERT_TRUE(isSupported);
+ ASSERT_NE(logs.find("initialize DriverCompilerAdapter start"), std::string::npos);
+ ASSERT_EQ(logs.find("initialize PluginCompilerAdapter start"), std::string::npos);
+}
+
+using ExpectLoadingCompilerPropertyNotSupported = PropertiesManagerTests;
+
+TEST_P(ExpectLoadingCompilerPropertyNotSupported, ExpectCompilerPropertyIsNotSupported) {
+ std::string logs;
+ std::mutex logs_mutex;
+ bool isSupported = true;
+
+ // Keep this std::function alive while logging is active.
+ std::function<void(std::string_view)> log_cb = [&](std::string_view msg) {
+ std::lock_guard<std::mutex> lock(logs_mutex);
+ logs.append(msg);
+ logs.push_back('\n');
+ };
+
+ {
+ LogCallbackGuard log_callback_guard(log_cb);
+ LoggerLevelGuard logger_level_guard(ov::log::Level::INFO);
+ propertiesManager->setProperty({{ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER)}});
+ isSupported = propertiesManager->isPropertySupported(configuration);
+ }
+
+ ASSERT_FALSE(isSupported);
+ ASSERT_EQ(logs.find("initialize DriverCompilerAdapter start"), std::string::npos);
+ ASSERT_EQ(logs.find("initialize PluginCompilerAdapter start"), std::string::npos);
+}
+
+} // namespace behavior
+} // namespace test
+} // namespace ov