OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[NPU] Refactor NPU property handling into owner-specific property managers (#36166)
Patrik Stepan3d614dbd0eed
diff --git a/src/plugins/intel_npu/docs/npu-properties-howto.md b/src/plugins/intel_npu/docs/npu-properties-howto.mdindex aa98d9b02b4..4f990ca4f01 100644--- a/src/plugins/intel_npu/docs/npu-properties-howto.md+++ b/src/plugins/intel_npu/docs/npu-properties-howto.md@@ -1,4 +1,4 @@-# NPU Properties+# NPU PropertiesWhat is a property from NPU Plugin's POV and Step-by-step guide on how to add onePractical manual for NPU plugin properties@@ -41,8 +41,8 @@ Practical manual for NPU plugin properties| Option | a configuration entry in our internal configuration.</br>Consists of an OptionBase template descriptor + a template OptionValue value. | `LOG_LEVEL` || Config | Our internal database of configuration keys and their values | `_globalConfig` || Metric | A property which does not map to any configuration key and configuration entry in our internal config.</br>Usually a static value directly read from driver or OS. | `ov::device::pci_info` |-| Compiler | Npu compiler as viewed from the plugin’s perspective.</br>Can be Compiler-In-Driver or Compiler-In-Plugin | `CID` |-| “Anonymous” property</br>OR</br>compiler-private property | A setting from application level which the plugin has no knowledge of</br>(it is not registered, plugin is not aware of its datatype)</br> but which the compiler reports as supported via is_supported() API. | N/A |+| Compiler | Npu compiler as viewed from the plugin's perspective.</br>Can be Compiler-In-Driver or Compiler-In-Plugin | `CID` |+| "Anonymous" property</br>OR</br>compiler-private property | A setting from application level which the plugin has no knowledge of</br>(it is not registered, plugin is not aware of its datatype)</br> but which the compiler reports as supported via is_supported() API. | N/A |<br>@@ -54,14 +54,14 @@ Practical manual for NPU plugin properties### Property vs Option vs MetricAs it can be observed in the above class hierarchy diagram, a Property is a public interface to an internal information, the top layer of abstraction.-A property can connect internally to an Option or to a Metric.-The main difference between Option and Metric is that while Options are entries in our internal database (Config) which can be modified at any time, Metrics are static read-only pieces of information-which do not exist in the internal database. Metrics can not be set or changed externally, their values are not stored in the plugin and they most often just a direct system or driver call.+A property can connect internally to an Option or to a Metric.+The main difference between Option and Metric is that while Options are entries in our internal database (Config) which can be modified at any time, Metrics are static read-only pieces of information+which do not exist in the internal database. Metrics can not be set or changed externally, their values are not stored in the plugin and they most often just a direct system or driver call.Example of Metrics in NPU Plugin are: driver version, compiler version, device architecture, pci information, gops, uuid, luid, etc.-To summarize:-A property can map internally to **one** of the 2 types:+To summarize:+A property can map internally to **one** of the 2 types:- either a Option, if it has an entry in our internal Config, it is a mutable setting used either by compiler or by inference-- either a Metric, if it is a static immutable piece of information that only needs to be returned on request (system/platform/hardware etc information)+- either a Metric, if it is a static immutable piece of information that only needs to be returned on request (system/platform/hardware etc information)### OptionBase\<T\>Implements the option descriptor. This class contains all the details of a config option: name, datatype, default value, parser, public/private, mutability, compiler version (for legacy support), etc. This serves as the key in our configuration map.@@ -133,24 +133,24 @@ struct OptionBase {### OptionDescis storage for the registered options This is the base map which stores the available optionBase descriptors.-This layer implements the option database manipulation functions: add/remove/has/reset+This layer implements the option database manipulation functions: add/remove/has/reset```` Note: This layer is static, intialized once in plugin constructor with all the options the Plugin has knowledge of. ````-### Config-is the highlevel configuration “database” which implements the mapping between OptionBase and templatized OptionValue.-Maps and stores the user-defined values for each entry in OptionsDesc layer.-Implements the top level configuration manipulation functions:-get/update/has/getString/toString/fromString and handles typecasts, typeverification, parsing and conversions.+### Config+is the highlevel configuration "database" which implements the mapping between OptionBase and templatized OptionValue.+Maps and stores the user-defined values for each entry in OptionsDesc layer.+Implements the top level configuration manipulation functions:+get/update/has/getString/toString/fromString and handles typecasts, typeverification, parsing and conversions.```` Note: This layer is static, initialized once in plugin constructor with the provided (also static) OptionDesc. ````-### FilteredConfig-is a derivative class of Config, used only by NPU Plugin, which implements additional filtering layers atop of the base config,-such as enabling/disabling keys based on their availability/support on the current system configuration.+### FilteredConfig+is a derivative class of Config, used only by NPU Plugin, which implements additional filtering layers atop of the base config,+such as enabling/disabling keys based on their availability/support on the current system configuration.```` Note: This layer dynamically changes based on system configuration and compiler_type ````### Properties-is the top level class and serves as the NPU Plugin’s interface to OpenVino and the application layer.-It’s main purpose is to implement get_property and set_property interfaces and the callback functions of each property.+is the top level class and serves as the NPU Plugin's interface to OpenVino and the application layer.+It's main purpose is to implement get_property and set_property interfaces and the callback functions of each property.```` Note: This layer dynamically changes based on system configuration and compiler_type ````<br><br>@@ -272,24 +272,24 @@ It ensures that it is enabled or disabled based in the current system/environmen## Step 4. Link the new property to the new optionFourth step is to create and register the Property (which is basicly the interface to this configuration option) for both Plugin and CompiledModel (if needed)### For plugin-npu_plugin/plugin/src/properties.cpp > function registerPluginProperties()+npu_plugin/plugin/src/plugin_property_manager.cpp > function PluginPropertyManager::registerProperties()```cpp-TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::example_property, EXAMPLE_PROPERTY);+try_register_property_based_on_config<EXAMPLE_PROPERTY>(_config, _properties, ov::intel_npu::example_property.name());```**Explanation:**-this macro will register (if all conditions are met) a property with the name ov::intel_npu::example_property.name()+this helper function will register (if all conditions are met) a property with the name ov::intel_npu::example_property.name()which maps to our internal configuration named EXAMPLE_PROPERTYand has a simple callback function of config.get<EXAMPLE_PROPERTY>()### For compiled-model (if required)-npu_plugin/plugin/src/properties.cpp > function registerCompiledModelProperties()+npu_plugin/plugin/src/compiled_model_property_manager.cpp > function CompiledModelPropertyManager::registerProperties()```cpp-TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::example_property, EXAMPLE_PROPERTY);+try_register_property_based_on_config_if_set_as_read_only<EXAMPLE_PROPERTY>(_config, _properties, ov::intel_npu::example_property.name());```**Explanation:**-this macro will register (if all conditions are met) a property with the name ov::intel_npu::example_property.name()-which maps to our internal configuration named EXAMPLE_PROPERTY-and has a simple callback function of config.get<EXAMPLE_PROPERTY>()-**(!!) ONLY** if it has been previously explicitly set at compile time+this helper function registers the compiled-model property with the name ov::intel_npu::example_property.name()+which maps to our internal configuration named EXAMPLE_PROPERTY+and has a simple callback function of config.get<EXAMPLE_PROPERTY>()+**(!!) ONLY** if it has been previously explicitly set at compile time.## Step 5. Python bindingsIn order for the property to be property exposed in python API, add python wrapper for the new property in pyOpenvino@@ -327,15 +327,16 @@ Notes:- datatype of the property is enum ExampleType { VAL1, VAL2, VAL3 }## Step 2. Define and register a callback function for the new (metric) Property-You need to register the new property and define a callback function for it, in properties.cpp.-For plugin: npu_plugin/plugin/src/properties.cpp > function registerPluginProperties()-For compiled-model: npu_plugin/plugin/src/properties.cpp > function registerCompiledModelProperties()+You need to register the new property and define a callback function in the owner-specific property manager.+For plugin: npu_plugin/plugin/src/plugin_property_manager.cpp > function PluginPropertyManager::registerProperties()+For compiled-model: npu_plugin/plugin/src/compiled_model_property_manager.cpp > function CompiledModelPropertyManager::registerProperties()```cpp- REGISTER_SIMPLE_METRIC(ov::intel_npu::example_property, true, _metrics->GetDriverVersion());+ register_property_with_custom_function(_properties, ov::intel_npu::example_property.name(), true, _metrics->GetDriverVersion());```**Explanation**-this macro will register a property with the name **ov::intel_npu::example_property (NPU_EXAMPLE_PROPERTY)**, which will be public and included in supported_properties (second parameter)-which will execute _metrics->GetDriverVersion() function as it's get_property callback+this helper function will register a property with the name **ov::intel_npu::example_property (NPU_EXAMPLE_PROPERTY)**, which will be public and included in supported_properties (second parameter)+which will execute `_metrics->GetDriverVersion()` as its get_property callback.+Note: the first argument is the property name string (`property.name()`), not the property object itself.## Step 3. Python bindingsIn order for the property to be property exposed in python API, add python wrapper for the new property in pyOpenvino@@ -348,69 +349,103 @@ In section // sumbodule npu## Step 4. Update documentationDocument the new property in the appropaite sections (+ additional information, if required) in:```bash-openvino/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rst-openvino/src/plugins/intel_npu/README.md+openvino/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rst+openvino/src/plugins/intel_npu/README.md```<br><br># Compiled-model properties-By internal convention, what needs to be included in compiled-model properties gets decided based on the following statements:+By internal convention, what needs to be included in compiled-model properties gets decided based on the following statements:- every option which has an effect on model compilation (meaning options with mode=OptionMode::CompileTime or OptionMode::Both) need to be included-- options (with some specific exceptions) should be publicly advertised in compiled-model's supported_properties **ONLY** if they have been explicitly set prior to model compilation.+- options (with some specific exceptions) should be publicly advertised in compiled-model's supported_properties **ONLY** if they have been explicitly set prior to model compilation.- compiled-model properties (with a few specific exceptions) are all READ-ONLY, for the reason that the model has already been compiled.-This is to ensure that we only expose settings we are sure were taken into account by compiler.+This is to ensure that we only expose settings we are sure were taken into account by compiler.-To facilitate registering properties in compiled-model **ONLY** if they have been explicitly set prior to model compilation, properties.cpp offers a helper macro:-#### TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(OPT_NAME, OPT_TYPE)-This macro will register the provided property (OPT_NAME) to the provided option (OPT_TYPE) only if a value for it exists in the config. (default values do not live in config, but directly read from OptionsDesc)-Example:+To facilitate registering properties in compiled-model **ONLY** if they have been explicitly set prior to model compilation, property_registration.hpp provides a helper function:+#### try_register_property_based_on_config_if_set_as_read_only<OPT_TYPE>(config, properties, propertyName)+This helper function registers the provided property to the provided option type only if a value for it exists in the config. (default values do not live in config, but are directly read from OptionsDesc)+Example:```cpp- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::compilation_mode, COMPILATION_MODE);+ try_register_property_based_on_config_if_set_as_read_only<COMPILATION_MODE>(_config,+ _properties,+ ov::intel_npu::compilation_mode.name());```<br><br># Special cases## SC.1 Adding a new property which requires custom functions-If the new property requires a custom callback function, only Step 4. changes.-Instead of using TRY_REGISTER_SIMPLE_PROPERTY macro, you can choose from the following helper macros:--#### TRY_REGISTER_VARPUB_PROPERTY(OPT_NAME, OPT_TYPE, PROP_VISIBILITY)-This can be used when callback is standard, but visibility (public/private) is custom.-Instead of using automaticly the value from optionsBase, one can define a custom function to determine-whether the property will be public (included in supported_properties) or private and provide as PROP_VISIBILITY parameter.-#### TRY_REGISTER_CUSTOMFUNC_PROPERTY(OPT_NAME, OPT_TYPE, PROP_RETFUNC)-This macro can be used whenever a custom callback function is required for this property,-provided as a lambda function as PROP_RETFUNC parameter.-(Standard callback function just returns the value of the config)-#### TRY_REGISTER_CUSTOM_PROPERTY(OPT_NAME, OPT_TYPE, PROP_VISIBILITY, PROP_MUTABILITY, PROP_RETFUNC)-This macro bypasses all automatic descriptor fetching, availability checks, and compatibility verifications-and gives you the possibility to register a completely custom property with custom visibility and custom callback function.+If the new property requires a custom callback function, only Step 4. changes.+Instead of using try_register_property_based_on_config helper function, you can choose from the following helper functions:++#### try_register_property_based_on_config_with_visibility<OPT_TYPE>(config, properties, propertyName, is_public)+This can be used when callback is standard, but visibility (public/private) is custom.+Instead of using automatically the value from the option descriptor, one can pass a runtime bool to determine+whether the property will be public (included in supported_properties) or private.+Example:+```cpp+ try_register_property_based_on_config_with_visibility<RUN_INFERENCES_SEQUENTIALLY>(+ _config,+ _properties,+ ov::intel_npu::run_inferences_sequentially.name(),+ [&] { return _backend && _backend->getInitStructs(); }());+```++#### try_register_property_based_on_config_with_custom_function(config, properties, propertyName, getter)+This helper function can be used whenever a custom callback function/implementation is required for this property,+provided as a lambda function. The getter receives the Config object and must return an ov::Any value.+(Standard callback function just returns the value of the config)+Example:+```cpp+ try_register_property_based_on_config_with_custom_function(_config, _properties, ov::intel_npu::stepping.name(),+ [&](const Config& config) {+ if (!config.has<STEPPING>()) {+ return static_cast<int64_t>(_metrics->GetSteppingNumber(specifiedDeviceName));+ }+ return config.get<STEPPING>();+ });+```## SC.2 Adding a new (metric-backed) property which requires customization-As oppposed to option-backed properties, for metric-backed ones we only have 1 extra helper macro,-apart from REGISTER_SIMPLE_METRIC (which lets you define name, visibility and return value as a single function call):+Apart from `register_property_with_custom_function`, two additional helper functions are available for metric-backed properties:-#### REGISTER_CUSTOM_METRIC(PROP_NAME, PROP_VISIBILITY, PROP_RETFUNC)-This macro offers the possibility to define a full custom callback function, as a lambda function propided as parameter PROP_RETFUNC,-instead of just a single value function call as REGISTER_SIMPLE_METRIC.-Example:+#### try_register_property_with_custom_function(properties, propertyName, shouldRegister, isPublic, getter)+Conditionally registers a metric property. The property is only added when `shouldRegister` is true.+Use this when the availability of a metric depends on a runtime condition (e.g. backend capability check).+Example:```cpp- REGISTER_CUSTOM_METRIC(ov::device::full_name,- !_metrics->GetAvailableDevicesNames().empty(),- [&](const Config& config) {- const auto specifiedDeviceName = get_specified_device_name(config);- return _metrics->GetFullDeviceName(specifiedDeviceName);- });+ try_register_property_with_custom_function(_properties,+ ov::device::full_name.name(),+ !_metrics->GetAvailableDevicesNames().empty(),+ true,+ [&](const Config& config) {+ const auto specifiedDeviceName = get_specified_device_name(config);+ return _metrics->GetFullDeviceName(specifiedDeviceName);+ });+```++#### try_register_property_with_custom_function_and_args(properties, propertyName, shouldRegister, isPublic, getter)+Same as `try_register_property_with_custom_function`, but for properties whose getter also receives an `ov::AnyMap` of additional+arguments at get_property call time. Use this for properties such as `ov::compatibility_check` that accept+extra input arguments.+Example:+```cpp+ try_register_property_with_custom_function_and_args(_properties,+ ov::compatibility_check.name(),+ _compatibilityCheckSupported,+ true,+ [this](const Config&, const ov::AnyMap& arguments) {+ return validateCompatibilityDescriptor(_backend, arguments);+ });```## SC.3 Filtering out options at registration phase-There is a possibility to get options filtered out right at the options registration phase too, if desired by a specific cornercase.-If the option is not registered, it will be virtually inexistent in the whole stack at runtime, so there will be no added overhead by all the availability checks and verifications the properties manager does.-To achieve this, we can condition the registration of the option in:-plugin.cpp > (function) void Plugin::init_options()-Example:+There is a possibility to get options filtered out right at the options registration phase too, if desired by a specific cornercase.+If the option is not registered, it will be virtually inexistent in the whole stack at runtime, so there will be no added overhead by all the availability checks and verifications the properties manager does.+To achieve this, we can condition the registration of the option in:+plugin.cpp > (function) void Plugin::init_options()+Example:```cppif (_backend) {if (_backend->isCommandQueueExtSupported()) {@@ -419,10 +454,10 @@ Example:}}```-The above code will register TURBO and WORKLOAD_TYPE options only if command queue extension is supported by the backend (and of course, first if a backend exists)+The above code will register TURBO and WORKLOAD_TYPE options only if command queue extension is supported by the backend (and of course, first if a backend exists)Having skipped the option registration (in case command queue extension is not supported), the option will not exist in the stack, will not be checked for compiler support, will not be enabled/disabled dinamically and **can not be enabled dynamically** anymore at runtime.<br><br># Removing a public property-Removing a public property can be done by removing everything added in section “How do add a new public property” step-by-step.\ No newline at end of file+Removing a public property can be done by removing everything added in section "How do add a new public property" step-by-step.diff --git a/src/plugins/intel_npu/src/backend/include/zero_device.hpp b/src/plugins/intel_npu/src/backend/include/zero_device.hppindex 2b054218e0c..259e36b247c 100644--- a/src/plugins/intel_npu/src/backend/include/zero_device.hpp+++ b/src/plugins/intel_npu/src/backend/include/zero_device.hpp@@ -37,6 +37,8 @@ public:void updateInfo(const ov::AnyMap& properties) override;+ bool validateCompatibilityDescriptor(const std::string& compatibilityDescriptor) const override;+ZeroDevice& operator=(const ZeroDevice&) = delete;ZeroDevice(const ZeroDevice&) = delete;diff --git a/src/plugins/intel_npu/src/backend/src/zero_device.cpp b/src/plugins/intel_npu/src/backend/src/zero_device.cppindex fcbc2d21536..d72776dd0bb 100644--- a/src/plugins/intel_npu/src/backend/src/zero_device.cpp+++ b/src/plugins/intel_npu/src/backend/src/zero_device.cpp@@ -196,3 +196,27 @@ void ZeroDevice::updateInfo(const ov::AnyMap& properties) {_log.setLevel(properties.at(ov::log::level.name()).as<ov::log::Level>());}}++bool ZeroDevice::validateCompatibilityDescriptor(const std::string& compatibilityDescriptor) const {+ if (_initStructs->getZeDrvApiVersion() < ZE_MAKE_VERSION(1, 16)) {+ OPENVINO_THROW("Compatibility descriptor validation is not supported by this driver");+ }++ ze_validate_runtime_requirements_output_t output = {};+ output.stype = ZE_STRUCTURE_TYPE_RUNTIME_REQUIREMENTS_OUTPUT;+ output.pNext = nullptr;++ const ze_result_t result =+ zeDeviceValidateRuntimeRequirements(_initStructs->getDevice(), compatibilityDescriptor.c_str(), &output);++ if (result != ZE_RESULT_SUCCESS) {+ _log.warning("zeDeviceValidateRuntimeRequirements returned error: 0x%x", static_cast<uint32_t>(result));+ return false;+ }++ // Only REQUIREMENTS_MET and MET_RECOMPILATION_ADVISABLE are treated as compatible.+ // NOT_APPLICABLE (the descriptor does not apply to this device) and REQUIREMENTS_NOT_MET are+ // intentionally treated as incompatible, since neither guarantees the blob runs correctly here+ return output.result == ZE_VALIDATE_RUNTIME_REQUIREMENTS_RESULT_REQUIREMENTS_MET ||+ output.result == ZE_VALIDATE_RUNTIME_REQUIREMENTS_RESULT_REQUIREMENTS_MET_RECOMPILATION_ADVISABLE;+}diff --git a/src/plugins/intel_npu/src/common/include/intel_npu/common/icompiler_adapter.hpp b/src/plugins/intel_npu/src/common/include/intel_npu/common/icompiler_adapter.hppindex 588681b2d9c..8031d01a80d 100644--- a/src/plugins/intel_npu/src/common/include/intel_npu/common/icompiler_adapter.hpp+++ b/src/plugins/intel_npu/src/common/include/intel_npu/common/icompiler_adapter.hpp@@ -35,9 +35,8 @@ public:const FilteredConfig& config) const = 0;virtual uint32_t get_version() const = 0;virtual std::optional<std::vector<std::string>> get_supported_options() const = 0;- virtual bool is_option_supported(std::string optName, std::optional<std::string> optValue = std::nullopt) const = 0;-- virtual bool validate_compatibility_descriptor(const std::string& compatibilityDescriptor) const = 0;+ virtual bool is_option_supported(const std::string& optName,+ const std::optional<std::string>& optValue = std::nullopt) const = 0;virtual ~ICompilerAdapter() = default;};diff --git a/src/plugins/intel_npu/src/common/include/intel_npu/common/npu.hpp b/src/plugins/intel_npu/src/common/include/intel_npu/common/npu.hppindex 739cab5170e..8ee4245e6a9 100644--- a/src/plugins/intel_npu/src/common/include/intel_npu/common/npu.hpp+++ b/src/plugins/intel_npu/src/common/include/intel_npu/common/npu.hpp@@ -85,6 +85,7 @@ public:const Config& config) = 0;virtual void updateInfo(const ov::AnyMap& properties) = 0;+ virtual bool validateCompatibilityDescriptor(const std::string& compatibilityDescriptor) const = 0;protected:virtual ~IDevice() = default;diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/compiler_impl.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/compiler_impl.hppindex 9f1552ea2b9..cb0e8affeab 100644--- a/src/plugins/intel_npu/src/compiler_adapter/include/compiler_impl.hpp+++ b/src/plugins/intel_npu/src/compiler_adapter/include/compiler_impl.hpp@@ -85,21 +85,23 @@ public:*/bool get_supported_options(std::vector<char>& options) const;- bool is_option_supported(std::string option, std::optional<std::string> optValue = std::nullopt) const;-- std::shared_ptr<void> getLinkedLibrary() const;+ bool is_option_supported(const std::string& option,+ const std::optional<std::string>& optValue = std::nullopt) const;/**- * @brief Validates the compatibility descriptor against the current device information.- * This function is used as a fallback check when the driver on the system does not support the required API- * @param compatibilityDescriptor The compatibility descriptor (string) to be validated+ * @brief Checks whether the given option and value are supported by the compiler for the specified device.+ * This overload is used when a device descriptor is available, allowing device-specific validation.* @param in_device_desc Pointer to a device descriptor containing the device ID, number of- * tiles and stepping information- * @return false if the platform does not meet the requirements specified in the compatibility descriptor,- * true if the platform is compatible+ * tiles and stepping information used for device-specific checks+ * @param option The option name to check+ * @param optValue The option value to validate+ * @return true if the option and value are supported for the given device, false otherwise*/- bool validate_compatibility_descriptor(const std::string& compatibilityDescriptor,- vcl_device_desc_t* in_device_desc) const;+ bool is_option_supported(vcl_device_desc_t* in_device_desc,+ const std::string& option,+ const std::optional<std::string>& optValue = std::nullopt) const;++ std::shared_ptr<void> getLinkedLibrary() const;private:/**diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/driver_compiler_adapter.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/driver_compiler_adapter.hppindex 432d85a1303..6b6c064ba4d 100644--- a/src/plugins/intel_npu/src/compiler_adapter/include/driver_compiler_adapter.hpp+++ b/src/plugins/intel_npu/src/compiler_adapter/include/driver_compiler_adapter.hpp@@ -28,12 +28,11 @@ public:std::optional<std::vector<std::string>> get_supported_options() const override;- bool is_option_supported(std::string optName, std::optional<std::string> optValue = std::nullopt) const override;+ bool is_option_supported(const std::string& optName,+ const std::optional<std::string>& optValue = std::nullopt) const override;uint32_t get_version() const override;- bool validate_compatibility_descriptor(const std::string& compatibilityDescriptor) const override;-private:bool isCompilerOptionSupported(const FilteredConfig& config,const ze_graph_compiler_version_info_t& compilerVersion,diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/plugin_compiler_adapter.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/plugin_compiler_adapter.hppindex 2e402cee30d..8ed80b82cbb 100644--- a/src/plugins/intel_npu/src/compiler_adapter/include/plugin_compiler_adapter.hpp+++ b/src/plugins/intel_npu/src/compiler_adapter/include/plugin_compiler_adapter.hpp@@ -29,12 +29,11 @@ public:std::optional<std::vector<std::string>> get_supported_options() const override;- bool is_option_supported(std::string optName, std::optional<std::string> optValue = std::nullopt) const override;+ bool is_option_supported(const std::string& optName,+ const std::optional<std::string>& optValue = std::nullopt) const override;uint32_t get_version() const override;- bool validate_compatibility_descriptor(const std::string& compatibilityDescriptor) const override;-private:std::shared_ptr<ZeroInitStructsHolder> _zeroInitStruct;diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/ze_graph_ext_wrappers.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/ze_graph_ext_wrappers.hppindex 0dd6d4df308..1106107d345 100644--- a/src/plugins/intel_npu/src/compiler_adapter/include/ze_graph_ext_wrappers.hpp+++ b/src/plugins/intel_npu/src/compiler_adapter/include/ze_graph_ext_wrappers.hpp@@ -63,8 +63,8 @@ public:* @return `true` if the option is supported, `false` if it is not supported,* and `std::nullopt` if the option-support query itself is not supported.*/- std::optional<bool> isOptionSupported(std::string optName,- std::optional<std::string> optValue = std::nullopt) const;+ std::optional<bool> isOptionSupported(const std::string& optName,+ const std::optional<std::string>& optValue = std::nullopt) const;/*** @brief Tells us whether or not the driver is able to receive and take into account a hash of the model instead ofdiff --git a/src/plugins/intel_npu/src/compiler_adapter/src/compiler_impl.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/compiler_impl.cppindex cca2c372fb8..a9355190061 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/compiler_impl.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/compiler_impl.cpp@@ -521,13 +521,13 @@ bool VCLCompilerImpl::get_supported_options(std::vector<char>& options) const {return false;}-bool VCLCompilerImpl::is_option_supported(std::string option, std::optional<std::string> optValue) const {+bool VCLCompilerImpl::is_option_supported(const std::string& option, const std::optional<std::string>& optValue) const {try {const char* optname_ch = option.c_str();const char* optvalue_ch = optValue.has_value() ? optValue.value().c_str() : nullptr;_logger.debug("is_option_supported start for option: %s, value: %s",optname_ch,- optValue ? optvalue_ch : "null");+ optvalue_ch ? optvalue_ch : "null");THROW_ON_FAIL_FOR_VCL("vclGetCompilerIsOptionSupported",vclGetCompilerIsOptionSupported(_compilerHandle, optname_ch, optvalue_ch),_logHandle);@@ -540,8 +540,9 @@ bool VCLCompilerImpl::is_option_supported(std::string option, std::optional<std:return false;}-bool VCLCompilerImpl::validate_compatibility_descriptor(const std::string& compatibilityDescriptor,- vcl_device_desc_t* in_device_desc) const {+bool VCLCompilerImpl::is_option_supported(vcl_device_desc_t* in_device_desc,+ const std::string& option,+ const std::optional<std::string>& optValue) const {vcl_compiler_desc_t compilerDesc;compilerDesc.version = _vclVersion;compilerDesc.debugLevel = static_cast<vcl_log_level_t>(static_cast<int>(Logger::global().level()) + 1);@@ -555,9 +556,11 @@ bool VCLCompilerImpl::validate_compatibility_descriptor(const std::string& compavclCompilerCreate(&compilerDesc, in_device_desc, &compilerHandle, &logHandle),nullptr);- const char* optname_ch = ov::compatibility_check.name();- const char* optvalue_ch = compatibilityDescriptor.c_str();- _logger.debug("is_option_supported start for option: %s, value: %s", optname_ch, optvalue_ch);+ const char* optname_ch = option.c_str();+ const char* optvalue_ch = optValue.has_value() ? optValue.value().c_str() : nullptr;+ _logger.debug("is_option_supported start for option: %s, value: %s",+ optname_ch,+ optvalue_ch ? optvalue_ch : "null");THROW_ON_FAIL_FOR_VCL("vclGetCompilerIsOptionSupported",vclGetCompilerIsOptionSupported(compilerHandle, optname_ch, optvalue_ch),logHandle);diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cppindex 9b9c36da2b0..b88be161b4c 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp@@ -290,31 +290,9 @@ std::optional<std::vector<std::string>> DriverCompilerAdapter::get_supported_optreturn compilerOpts;}-bool DriverCompilerAdapter::is_option_supported(std::string optName, std::optional<std::string> optValue) const {- // This is a special case, as RUNTIME_REQUIREMENTS is a read-only runtime property- // used to signal that compiler can provide a compatibility string through a dedicated- // VCL compiler method. It is not a regular settable option.- // Therefore, we cannot rely on the compiler's usual option support checking method alone.- if (optName == RUNTIME_REQUIREMENTS::key()) {- if (optValue.has_value())- OPENVINO_THROW("The option '",- RUNTIME_REQUIREMENTS::key(),- "' is a read-only property and does not accept any value.");-- // Compatibility string generation is not yet supported through the L0 API, even if compiler supports it- return false;- }- // The COMPATIBILITY_CHECK option is used to signal if compiler adapter supports- // the validateCompatibilityDescriptor method- if (optName == COMPATIBILITY_CHECK::key()) {- if (optValue.has_value())- OPENVINO_THROW("Compatibility string should be verified with validate_compatibility_descriptor()");-- // Compatibility string validation is not yet supported through the L0 API- return false;- }-- auto isOptionSupported = _zeGraphExt->isOptionSupported(std::move(optName), std::move(optValue));+bool DriverCompilerAdapter::is_option_supported(const std::string& optName,+ const std::optional<std::string>& optValue) const {+ auto isOptionSupported = _zeGraphExt->isOptionSupported(optName, optValue);return isOptionSupported.value_or(false);}@@ -338,8 +316,4 @@ bool DriverCompilerAdapter::isCompilerOptionSupported(const FilteredConfig& conf(compilerVersion.minor >= minorCompilerOptSupportValue));}-bool DriverCompilerAdapter::validate_compatibility_descriptor(const std::string& compatibilityDescriptor) const {- OPENVINO_THROW_NOT_IMPLEMENTED("Compatibility descriptor validation is not yet supported through the L0 API");-}-} // namespace intel_npudiff --git a/src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cppindex 7a25b614f65..cb9851d5739 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cpp@@ -283,24 +283,14 @@ std::optional<std::vector<std::string>> PluginCompilerAdapter::get_supported_optreturn compilerOpts;}-bool PluginCompilerAdapter::is_option_supported(std::string optname, std::optional<std::string> optValue) const {- const bool hasValue = optValue.has_value();- const std::string value = hasValue ? optValue.value() : "";- if (_compiler->is_option_supported(optname, std::move(optValue))) {- _logger.debug("Option %s is supported `%s` by VCLCompilerImpl",- optname.c_str(),- hasValue ? value.c_str() : "null");- return true;- } else {- _logger.debug("Option %s is not supported `%s` by VCLCompilerImpl",- optname.c_str(),- hasValue ? value.c_str() : "null");- return false;- }-}+bool PluginCompilerAdapter::is_option_supported(const std::string& optname,+ const std::optional<std::string>& optValue) const {+ if (optname == COMPATIBILITY_CHECK::key()) {+ if (_zeroInitStruct == nullptr || _zeroInitStruct->getDevice() == nullptr) {+ _logger.warning("No device is found, compatibility check is not available");+ return false;+ }-bool PluginCompilerAdapter::validate_compatibility_descriptor(const std::string& compatibilityDescriptor) const {- if (_zeroInitStruct && _zeroInitStruct->getDevice()) {ze_device_properties_t device_properties = {};device_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES;auto result = zeDeviceGetProperties(_zeroInitStruct->getDevice(), &device_properties);@@ -315,11 +305,38 @@ bool PluginCompilerAdapter::validate_compatibility_descriptor(const std::string&vcl_desc.deviceID,vcl_desc.tileCount);- return _compiler->validate_compatibility_descriptor(compatibilityDescriptor, &vcl_desc);+ const bool hasValue = optValue.has_value();+ const std::string value = hasValue ? optValue.value() : "";+ if (_compiler->is_option_supported(&vcl_desc, optname, optValue)) {+ _logger.debug("Option %s is supported `%s` by VCLCompilerImpl",+ optname.c_str(),+ hasValue ? value.c_str() : "null");+ return true;+ } else {+ _logger.debug("Option %s is not supported `%s` by VCLCompilerImpl",+ optname.c_str(),+ hasValue ? value.c_str() : "null");+ return false;+ }+ } else {+ _logger.warning("Can not get device properties, compatibility check is not available");+ return false;}}- return false;+ const bool hasValue = optValue.has_value();+ const std::string value = hasValue ? optValue.value() : "";+ if (_compiler->is_option_supported(optname, optValue)) {+ _logger.debug("Option %s is supported `%s` by VCLCompilerImpl",+ optname.c_str(),+ hasValue ? value.c_str() : "null");+ return true;+ } else {+ _logger.debug("Option %s is not supported `%s` by VCLCompilerImpl",+ optname.c_str(),+ hasValue ? value.c_str() : "null");+ return false;+ }}} // namespace intel_npudiff --git a/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cppindex a408bbd0749..34048558709 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cpp@@ -623,8 +623,8 @@ std::optional<std::string> ZeGraphExtWrappers::getCompilerSupportedOptions() conreturn "";}-std::optional<bool> ZeGraphExtWrappers::isOptionSupported(std::string optName,- std::optional<std::string> optValue) const {+std::optional<bool> ZeGraphExtWrappers::isOptionSupported(const std::string& optName,+ const std::optional<std::string>& optValue) const {// Early exit if api is not supportedif (!_isCompilerOptionQuerySupported) {_logger.debug("Compiler option query is not supported by the driver - skipping!");diff --git a/src/plugins/intel_npu/src/plugin/include/compiled_model.hpp b/src/plugins/intel_npu/src/plugin/include/compiled_model.hppindex 62e5c06d5af..0d9348fff16 100644--- a/src/plugins/intel_npu/src/plugin/include/compiled_model.hpp+++ b/src/plugins/intel_npu/src/plugin/include/compiled_model.hpp@@ -7,11 +7,11 @@#include <mutex>#include <optional>+#include "compiled_model_property_manager.hpp"#include "intel_npu/common/icompiled_model.hpp"#include "intel_npu/common/npu.hpp"#include "intel_npu/utils/logger/logger.hpp"#include "openvino/runtime/so_ptr.hpp"-#include "properties.hpp"namespace intel_npu {@@ -67,7 +67,9 @@ private:Logger _logger;const std::shared_ptr<IDevice> _device;- std::unique_ptr<Properties> _propertiesManager;++ std::unique_ptr<CompiledModelPropertyManager> _propertiesManager;+std::shared_ptr<IGraph> _graph;std::shared_ptr<ov::threading::ITaskExecutor> _resultExecutor = nullptr;diff --git a/src/plugins/intel_npu/src/plugin/include/compiled_model_property_manager.hpp b/src/plugins/intel_npu/src/plugin/include/compiled_model_property_manager.hppnew file mode 100644index 00000000000..34b95226c64--- /dev/null+++ b/src/plugins/intel_npu/src/plugin/include/compiled_model_property_manager.hpp@@ -0,0 +1,50 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once++#include <map>+#include <memory>+#include <mutex>+#include <optional>+#include <string>+#include <vector>++#include "intel_npu/common/filtered_config.hpp"+#include "intel_npu/common/igraph.hpp"+#include "intel_npu/utils/logger/logger.hpp"+#include "property_registration.hpp"++namespace intel_npu {++class CompiledModelPropertyManager final {+public:+ CompiledModelPropertyManager(const FilteredConfig& config,+ const std::shared_ptr<IGraph>& graph,+ const std::optional<int64_t>& batchSize,+ Logger& logger);++ void setProperty(const ov::AnyMap& properties);+ ov::Any getProperty(const std::string& name) const;++ const FilteredConfig& getConfig() const {+ return _config;+ }++private:+ void registerProperties();++ FilteredConfig _config;++ std::shared_ptr<IGraph> _graph;+ std::optional<int64_t> _batchSize;+ Logger& _logger;++ std::map<std::string, PropertyDescriptor> _properties;+ std::vector<ov::PropertyName> _supportedProperties;++ mutable std::mutex _mutex;+};++} // namespace intel_npudiff --git a/src/plugins/intel_npu/src/plugin/include/metrics.hpp b/src/plugins/intel_npu/src/plugin/include/metrics.hppindex 61a784deca8..6dfd9dea40f 100644--- a/src/plugins/intel_npu/src/plugin/include/metrics.hpp+++ b/src/plugins/intel_npu/src/plugin/include/metrics.hpp@@ -18,14 +18,12 @@ namespace intel_npu {class Metrics final {public:- Metrics(const ov::SoPtr<IEngineBackend>& backend);+ Metrics(const ov::SoPtr<IEngineBackend>& backend) : _backend(backend) {};std::vector<std::string> GetAvailableDevicesNames() const;- const std::vector<std::string>& SupportedMetrics() const;std::string GetFullDeviceName(const std::string& specifiedDeviceName) const;IDevice::Uuid GetDeviceUuid(const std::string& specifiedDeviceName) const;ov::device::LUID GetDeviceLUID(const std::string& specifiedDeviceName) const;- const std::vector<std::string>& GetSupportedConfigKeys() const;const std::vector<std::string> GetOptimizationCapabilities() const;const std::tuple<uint32_t, uint32_t, uint32_t>& GetRangeForAsyncInferRequest() const;const std::tuple<uint32_t, uint32_t>& GetRangeForStreams() const;@@ -46,8 +44,6 @@ public:private:const ov::SoPtr<IEngineBackend> _backend;- std::vector<std::string> _supportedMetrics;- std::vector<std::string> _supportedConfigKeys;static constexpr uint32_t _maxNumOfOptimalInferRequests = 8u;const std::vector<std::string> _optimizationCapabilities = {ov::device::capability::FP16,diff --git a/src/plugins/intel_npu/src/plugin/include/plugin.hpp b/src/plugins/intel_npu/src/plugin/include/plugin.hppindex 07eb6ba26a2..d759a27083e 100644--- a/src/plugins/intel_npu/src/plugin/include/plugin.hpp+++ b/src/plugins/intel_npu/src/plugin/include/plugin.hpp@@ -14,7 +14,7 @@#include "metadata.hpp"#include "openvino/runtime/iplugin.hpp"#include "openvino/runtime/so_ptr.hpp"-#include "properties.hpp"+#include "plugin_property_manager.hpp"namespace intel_npu {@@ -80,9 +80,6 @@ private:std::unique_ptr<MetadataBase> metadata,const ov::AnyMap& properties) const;- ov::CompatibilityCheck validate_compatibility_descriptor(ov::intel_npu::CompilerType compilerType,- const ov::AnyMap& arguments) const;-std::unique_ptr<BackendsRegistry> _backendsRegistry;// _backend might not be set by the plugin; certain actions, such as offline compilation, might be supported.@@ -90,7 +87,7 @@ private:ov::SoPtr<IEngineBackend> _backend;mutable Logger _logger;- std::unique_ptr<Properties> _propertiesManager;+ std::unique_ptr<PluginPropertyManager> _propertiesManager;static std::atomic<int> _compiledModelLoadCounter;};diff --git a/src/plugins/intel_npu/src/plugin/include/plugin_property_manager.hpp b/src/plugins/intel_npu/src/plugin/include/plugin_property_manager.hppnew file mode 100644index 00000000000..3f77b711db0--- /dev/null+++ b/src/plugins/intel_npu/src/plugin/include/plugin_property_manager.hpp@@ -0,0 +1,122 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once++#include <map>+#include <memory>+#include <mutex>+#include <string>+#include <vector>++#include "intel_npu/common/filtered_config.hpp"+#include "intel_npu/common/icompiler_adapter.hpp"+#include "intel_npu/config/npuw.hpp"+#include "intel_npu/utils/logger/logger.hpp"+#include "metrics.hpp"+#include "property_registration.hpp"++namespace intel_npu {++class PluginPropertyManager final {+public:+ PluginPropertyManager(const FilteredConfig& config,+ const std::shared_ptr<Metrics>& metrics,+ const ov::SoPtr<IEngineBackend>& backend,+ Logger& logger);++ PluginPropertyManager& operator=(const PluginPropertyManager& other) = delete;++ void setProperty(const ov::AnyMap& properties);+ ov::Any getProperty(const std::string& name, const ov::AnyMap& arguments = {}) const;+ bool isPropertySupported(const std::string& name, const ov::AnyMap& arguments = {}) const;++ const FilteredConfig& getConfig() const {+ return _config;+ }++ FilteredConfig getConfigWithCompilerPropertiesDisabled(const ov::AnyMap& properties) const;+ FilteredConfig getConfigForSpecificCompiler(const ov::AnyMap& properties, const ICompilerAdapter* compiler) const;++ std::string determinePlatform(const ov::AnyMap& properties) const;+ std::string determineDeviceId(const ov::AnyMap& properties) const;+ ov::intel_npu::CompilerType determineCompilerType(const ov::AnyMap& properties) const;++private:+ PluginPropertyManager(const PluginPropertyManager& other);+ struct CopyState {+ FilteredConfig config;+ std::shared_ptr<Metrics> metrics;+ ov::SoPtr<IEngineBackend> backend;+ Logger& logger;+ ov::intel_npu::CompilerType currentlyUsedCompiler;+ ov::intel_npu::CompilerType _compilerForCompatibilityCheck;+ bool compatibilityCheckSupported;+ std::string currentlyUsedPlatform;+ bool compilerConfigsFilteredByCompiler;+ bool compatibilityCheckFiltered;+ };++ explicit PluginPropertyManager(CopyState&& state);++ void registerProperties() const;+ void initializeCompatibilityCheckSupportIfNeeded() const;+ bool isPropertyRegistered(const std::string& propertyName) const;++ mutable FilteredConfig _config;++ std::shared_ptr<Metrics> _metrics;+ ov::SoPtr<IEngineBackend> _backend;+ Logger& _logger;++ mutable ov::intel_npu::CompilerType _currentlyUsedCompiler = ov::intel_npu::CompilerType::PREFER_PLUGIN;+ mutable ov::intel_npu::CompilerType _compilerForCompatibilityCheck = ov::intel_npu::CompilerType::DRIVER;+ mutable bool _compatibilityCheckSupported = false;+ mutable std::string _currentlyUsedPlatform;+ mutable bool _compilerConfigsFilteredByCompiler = false;+ mutable bool _compatibilityCheckFiltered = false;++ mutable std::map<std::string, PropertyDescriptor> _properties;+ mutable std::vector<ov::PropertyName> _supportedProperties;++ const std::vector<ov::PropertyName> _cachingProperties = [] {+ std::vector<ov::PropertyName> properties = {+ ov::cache_mode.name(),+ ov::enable_profiling.name(),+ ov::device::architecture.name(),+ ov::hint::execution_mode.name(),+ ov::hint::inference_precision.name(),+ ov::hint::performance_mode.name(),+ ov::intel_npu::batch_compiler_mode_settings.name(),+ ov::intel_npu::batch_mode.name(),+ ov::intel_npu::compilation_mode.name(),+ ov::intel_npu::compilation_mode_params.name(),+ ov::intel_npu::compiler_dynamic_quantization.name(),+ ov::intel_npu::compiler_type.name(),+ ov::intel_npu::dma_engines.name(),+ ov::intel_npu::driver_version.name(),+ ov::intel_npu::dynamic_shape_to_static.name(),+ ov::intel_npu::enable_strides_for.name(),+ ov::intel_npu::max_tiles.name(),+ ov::intel_npu::stepping.name(),+ ov::intel_npu::tiles.name(),+ ov::intel_npu::turbo.name(),+ ov::intel_npu::qdq_optimization.name(),+ ov::intel_npu::qdq_optimization_aggressive.name(),+ };+ for_each_cached_npuw_option([&](auto tag) {+ using Opt = typename decltype(tag)::type;+ properties.emplace_back(std::string{Opt::key()});+ });+ return properties;+ }();++ const std::vector<ov::PropertyName> _internalSupportedProperties = {ov::internal::caching_properties.name(),+ ov::internal::caching_with_mmap.name(),+ ov::internal::cache_header_alignment.name()};++ mutable std::mutex _mutex;+};++} // namespace intel_npudiff --git a/src/plugins/intel_npu/src/plugin/include/properties.hpp b/src/plugins/intel_npu/src/plugin/include/properties.hppdeleted file mode 100644index 500e90a10a9..00000000000--- a/src/plugins/intel_npu/src/plugin/include/properties.hpp+++ /dev/null@@ -1,181 +0,0 @@-// Copyright (C) 2018-2026 Intel Corporation-// SPDX-License-Identifier: Apache-2.0-//--#pragma once--#include "intel_npu/common/filtered_config.hpp"-#include "intel_npu/common/icompiler_adapter.hpp"-#include "intel_npu/config/npuw.hpp"-#include "metrics.hpp"--namespace intel_npu {--enum class PropertiesType { PLUGIN, COMPILED_MODEL };--class Properties final {-public:- /**- * @brief Properties handler constructor- * @param pType - type of object this handler gets attached to: PLUGIN or COMPILED_MODEL- * @param config - reference to the global configuration table of the parent object- * @param metrics - reference ptr to the metrics object of the parent object (PLUGIN only)- */- Properties(const PropertiesType pType,- const FilteredConfig& config,- const std::shared_ptr<Metrics>& metrics = nullptr,- const ov::SoPtr<IEngineBackend>& backend = {nullptr});-- Properties(const Properties& other);- Properties& operator=(const Properties& other) = delete;-- /**- * @brief Get the values of a property in a map- */- ov::Any getProperty(const std::string& name);-- /**- * @brief Set the values of a subset of properties, provided as a map- * @details- * - checks if the property exists, will report if unsupported- * - checks if the property is Read-only, will report error if so- */- 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- */- const FilteredConfig& getConfig() const {- return _config;- }-- /**- * @brief Updates a copy of the config list based on the provided properties, and returns it.- * @details- * - Updates the config with the provided arguments and returns it.- */- FilteredConfig getConfigWithCompilerPropertiesDisabled(const ov::AnyMap& properties);-- /**- * @brief Updates a copy of the config list based on the provided properties and compiler, and returns it.- * @details- * - Checks if the compiler has changed; if so, re-filters configs.- * - Filters compiler options based on the current compiler.- * - Updates the config with the provided arguments and returns it.- */- FilteredConfig getConfigForSpecificCompiler(const ov::AnyMap& properties, const ICompilerAdapter* compiler);-- std::string determinePlatform(const ov::AnyMap& properties) const;- std::string determineDeviceId(const ov::AnyMap& properties) const;- ov::intel_npu::CompilerType determineCompilerType(const ov::AnyMap& properties) const;- ov::intel_npu::CompilerType determineCompilerTypeForCompatibilityCheck() const;--private:- struct CopyState {- PropertiesType pType;- FilteredConfig config;- std::shared_ptr<Metrics> metrics;- ov::SoPtr<IEngineBackend> backend;- Logger logger;- ov::intel_npu::CompilerType currentlyUsedCompiler;- std::string currentlyUsedPlatform;- bool compilerConfigsFilteredByCompiler;- bool compatibilityCheckFiltered;- std::map<std::string, std::tuple<bool, ov::PropertyMutability, std::function<ov::Any(const Config&)>>>- properties;- std::vector<ov::PropertyName> supportedProperties;- };-- explicit Properties(CopyState&& state);-- PropertiesType _pType;- FilteredConfig _config;- std::shared_ptr<Metrics> _metrics;- ov::SoPtr<IEngineBackend> _backend;- Logger _logger;-- ov::intel_npu::CompilerType _currentlyUsedCompiler = ov::intel_npu::CompilerType::PREFER_PLUGIN;- ov::intel_npu::CompilerType _compilerForCompatibilityCheck = ov::intel_npu::CompilerType::DRIVER;- std::string _currentlyUsedPlatform;-- // Boolean to check whether properties were filtered with compiler supported properties- bool _compilerConfigsFilteredByCompiler = false;- // Boolean to signal that compatibility check was already filtered by compiler support- bool _compatibilityCheckFiltered = false;-- // properties map: {name -> [supported, mutable, eval function]}- std::map<std::string, std::tuple<bool, ov::PropertyMutability, std::function<ov::Any(const Config&)>>> _properties;- std::vector<ov::PropertyName> _supportedProperties;-- // The compatibility_check property is supported only in case at least one of the compilers (CID or CIP) supports it- // To avoid loading the compiler library and check the support when the property is registered, the check can- // be performed at a later stage, when the property is actually queried.- bool disable_compatibility_check_if_needed();-- /**- * @brief Checks whether a property was registered by its name- */- bool isPropertyRegistered(const std::string& propertyName) const;-- // internal registration functions based on client object- /**- * @brief Initialize the properties map and try registering the properties for npu-plugin and compiled-model- * Can be used for both plugin and compiled-model properties maps, based on the provided pType param to the- * constructor of this object- * @details- * - it will reset the properties map- * - it will try registering config-backed option-based properties, with data from global configuration (supported,- * visibilty, mutability, value)- * - if an option is not present in the global config, it assumes it is not supported and will skip it- * - it will register metric-based properties, with data from the metrics interface- * - at the end it populates supported_properties with the now dynamically registered public properties- */- void registerProperties();- void registerPluginProperties();- void registerCompiledModelProperties();-- const std::vector<ov::PropertyName> _cachingProperties = [] {- std::vector<ov::PropertyName> properties = {- ov::cache_mode.name(),- ov::enable_profiling.name(),- ov::device::architecture.name(),- ov::hint::execution_mode.name(),- ov::hint::inference_precision.name(),- ov::hint::performance_mode.name(),- ov::intel_npu::batch_compiler_mode_settings.name(),- ov::intel_npu::batch_mode.name(),- ov::intel_npu::compilation_mode.name(),- ov::intel_npu::compilation_mode_params.name(),- ov::intel_npu::compiler_dynamic_quantization.name(),- ov::intel_npu::compiler_type.name(),- ov::intel_npu::dma_engines.name(),- ov::intel_npu::driver_version.name(),- ov::intel_npu::dynamic_shape_to_static.name(),- ov::intel_npu::enable_strides_for.name(),- ov::intel_npu::max_tiles.name(),- ov::intel_npu::stepping.name(),- ov::intel_npu::tiles.name(),- ov::intel_npu::turbo.name(),- ov::intel_npu::qdq_optimization.name(),- ov::intel_npu::qdq_optimization_aggressive.name(),- };- for_each_cached_npuw_option([&](auto tag) {- using Opt = typename decltype(tag)::type;- properties.emplace_back(std::string{Opt::key()});- });- return properties;- }();-- const std::vector<ov::PropertyName> _internalSupportedProperties = {ov::internal::caching_properties.name(),- ov::internal::caching_with_mmap.name(),- ov::internal::cache_header_alignment.name()};-- mutable std::mutex _mutex;-};--} // namespace intel_npudiff --git a/src/plugins/intel_npu/src/plugin/include/property_registration.hpp b/src/plugins/intel_npu/src/plugin/include/property_registration.hppnew file mode 100644index 00000000000..670ee5c6e2e--- /dev/null+++ b/src/plugins/intel_npu/src/plugin/include/property_registration.hpp@@ -0,0 +1,244 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once++#include <functional>+#include <map>+#include <string>+#include <type_traits>+#include <utility>++#include "openvino/runtime/properties.hpp"++namespace intel_npu {++class Config;++struct PropertyDescriptor final {+ bool isPublic;+ ov::PropertyMutability mutability;+ std::function<ov::Any(const Config&)> get;+ std::function<ov::Any(const Config&, const ov::AnyMap&)> getWithArgs;+};++using PropertyMap = std::map<std::string, PropertyDescriptor>;++/**+ * @brief Register a simple property backed directly by a config option.+ *+ * Use this when the property name maps to an option stored in the provided config and+ * the getter is just config.get<OPT_TYPE>().+ */+template <typename OptionType, typename ConfigLike>+inline void try_register_property_based_on_config(const ConfigLike& config,+ PropertyMap& properties,+ const std::string& propertyName) {+ if (!config.isAvailable(propertyName)) {+ return;+ }++ const auto& option = config.getOpt(propertyName);+ properties.emplace(propertyName,+ PropertyDescriptor{option.isPublic(),+ option.mutability(),+ std::function<ov::Any(const Config&)>([](const Config& configValue) {+ return configValue.get<OptionType>();+ }),+ {}});+}++/**+ * @brief Register a config-backed property with explicit public/private visibility.+ *+ * Use this when the callback is the standard config.get<OPT_TYPE>() but the visibility (public/private)+ * must be determined at runtime rather than taken from the option descriptor.+ */+template <typename OptionType, typename ConfigLike>+inline void try_register_property_based_on_config_with_visibility(const ConfigLike& config,+ PropertyMap& properties,+ const std::string& propertyName,+ bool isPublic) {+ if (!config.isAvailable(propertyName)) {+ return;+ }++ const auto& option = config.getOpt(propertyName);+ properties.emplace(propertyName,+ PropertyDescriptor{isPublic,+ option.mutability(),+ std::function<ov::Any(const Config&)>([](const Config& configValue) {+ return configValue.get<OptionType>();+ }),+ {}});+}++/**+ * @brief Register a custom property only when the property is available in the provided config.+ *+ * Use this when a custom function/implementation is required. Visibility and mutability are taken from the option+ * descriptor.+ */+template <typename ConfigLike, typename Getter>+inline void try_register_property_based_on_config_with_custom_function(const ConfigLike& config,+ PropertyMap& properties,+ const std::string& propertyName,+ Getter&& getter) {+ if (!config.isAvailable(propertyName)) {+ return;+ }++ const auto& option = config.getOpt(propertyName);+ properties.emplace(propertyName,+ PropertyDescriptor{option.isPublic(),+ option.mutability(),+ std::function<ov::Any(const Config&)>(std::forward<Getter>(getter)),+ {}});+}++/**+ * @brief Register a compiled-model property backed directly by the current config.+ */+template <typename OptionType, typename ConfigLike>+inline void try_register_property_based_on_config_as_read_only(const ConfigLike& config,+ PropertyMap& properties,+ const std::string& propertyName) {+ if (!config.isAvailable(propertyName)) {+ return;+ }++ const auto& option = config.getOpt(propertyName);+ properties.emplace(propertyName,+ PropertyDescriptor{option.isPublic(),+ ov::PropertyMutability::RO,+ std::function<ov::Any(const Config&)>([](const Config& configValue) {+ return configValue.get<OptionType>();+ }),+ {}});+}++/**+ * @brief Register a compiled-model property only if it was explicitly set before compilation.+ *+ * Default option values are not materialized into the config, so this form advertises a property only when+ * the user or upper layer actually set it.+ */+template <typename OptionType, typename ConfigLike>+inline void try_register_property_based_on_config_if_set_as_read_only(const ConfigLike& config,+ PropertyMap& properties,+ const std::string& propertyName) {+ if (!(config.has(propertyName) && config.isAvailable(propertyName))) {+ return;+ }++ const auto& option = config.getOpt(propertyName);+ properties.emplace(propertyName,+ PropertyDescriptor{option.isPublic(),+ ov::PropertyMutability::RO,+ std::function<ov::Any(const Config&)>([](const Config& configValue) {+ return configValue.get<OptionType>();+ }),+ {}});+}++/**+ * @brief Register a simple exposed NPUW option property.+ *+ * Equivalent to try_register_property_based_on_config, but uses OPT_TYPE::key() for the property name.+ */+template <typename OptionType, typename ConfigLike>+inline void try_register_npuw_option_property(const ConfigLike& config, PropertyMap& properties) {+ const auto propertyName = std::string(OptionType::key());+ if (!config.isAvailable(propertyName)) {+ return;+ }++ const auto& option = config.getOpt(propertyName);+ properties.emplace(propertyName,+ PropertyDescriptor{option.isPublic(),+ option.mutability(),+ std::function<ov::Any(const Config&)>([](const Config& configValue) {+ return configValue.get<OptionType>();+ }),+ {}});+}++template <typename GetterOrValue>+inline auto make_metric_getter(GetterOrValue&& getterOrValue) {+ using GetterOrValueType = std::decay_t<GetterOrValue>;++ if constexpr (std::is_invocable_v<GetterOrValueType, const Config&>) {+ return std::forward<GetterOrValue>(getterOrValue);+ } else {+ return [value = std::forward<GetterOrValue>(getterOrValue)](const Config&) {+ return value;+ };+ }+}++/**+ * @brief Register a simple metric property.+ *+ * Metrics are read-only properties. Accepts either a plain value or a getter lambda `(const Config&) -> T`.+ * Use this as the default form for metric registration.+ */+template <typename GetterOrValue>+inline void register_property_with_custom_function(PropertyMap& properties,+ const std::string& propertyName,+ bool isPublic,+ GetterOrValue&& getterOrValue) {+ properties.emplace(propertyName,+ PropertyDescriptor{isPublic,+ ov::PropertyMutability::RO,+ std::function<ov::Any(const Config&)>(+ make_metric_getter(std::forward<GetterOrValue>(getterOrValue))),+ {}});+}++/**+ * @brief Conditionally register a metric property with a standard (Config-only) custom function.+ *+ * Registers the property only when @p shouldRegister is true.+ * Use this when a metric property must be conditionally exposed based on device/backend capabilities.+ */+template <typename Getter>+inline void try_register_property_with_custom_function(PropertyMap& properties,+ const std::string& propertyName,+ bool shouldRegister,+ bool isPublic,+ Getter&& getter) {+ if (!shouldRegister) {+ return;+ }+ properties.emplace(propertyName,+ PropertyDescriptor{isPublic,+ ov::PropertyMutability::RO,+ std::function<ov::Any(const Config&)>(std::forward<Getter>(getter)),+ {}});+}++/**+ * @brief Conditionally register a metric property whose custom function requires additional AnyMap arguments.+ *+ * Registers the property only when @p shouldRegister is true.+ * Use this for properties that accept extra arguments at get_property call time (e.g. compatibility_check).+ */+template <typename Getter>+inline void try_register_property_with_custom_function_and_args(PropertyMap& properties,+ const std::string& propertyName,+ bool shouldRegister,+ bool isPublic,+ Getter&& getter) {+ if (!shouldRegister) {+ return;+ }+ properties.emplace(+ propertyName,+ PropertyDescriptor{isPublic,+ ov::PropertyMutability::RO,+ {},+ std::function<ov::Any(const Config&, const ov::AnyMap&)>(std::forward<Getter>(getter))});+}++} // namespace intel_npudiff --git a/src/plugins/intel_npu/src/plugin/src/compiled_model.cpp b/src/plugins/intel_npu/src/plugin/src/compiled_model.cppindex 02066a470c6..6b5ebd17136 100644--- a/src/plugins/intel_npu/src/plugin/src/compiled_model.cpp+++ b/src/plugins/intel_npu/src/plugin/src/compiled_model.cpp@@ -9,6 +9,7 @@#include <string_view>#include "async_infer_request.hpp"+#include "compiled_model_property_manager.hpp"#include "executor.hpp"#include "intel_npu/common/device_helpers.hpp"#include "intel_npu/common/itt.hpp"@@ -38,13 +39,9 @@ CompiledModel::CompiledModel(const std::shared_ptr<const ov::Model>& model,// Support for specific properties might depend on the characteristics of the compiled model.// Adjust lower level config availability to influence the supported properties list if neededFilteredConfig localConfig = config;- if (!_graph->get_compatibility_descriptor().has_value()) {- _logger.debug("Graph's compatibility descriptor has no value. Disabling RUNTIME_REQUIREMENTS property.");- localConfig.enable(ov::runtime_requirements.name(), false);- }OV_ITT_TASK_CHAIN(COMPILED_MODEL, itt::domains::NPUPlugin, "CompiledModel::CompiledModel", "initialize_properties");- _propertiesManager = std::make_unique<Properties>(PropertiesType::COMPILED_MODEL, localConfig);+ _propertiesManager = std::make_unique<CompiledModelPropertyManager>(localConfig, _graph, _batchSize, _logger);OV_ITT_TASK_SKIP(COMPILED_MODEL);}@@ -216,43 +213,6 @@ void CompiledModel::set_property(const ov::AnyMap& properties) {}ov::Any CompiledModel::get_property(const std::string& name) const {- // special cases- if (name == ov::model_name.name()) {- OPENVINO_ASSERT(_graph != nullptr, "Missing graph");- return _graph->get_metadata().name;- } else if (name == ov::runtime_requirements.name()) {- // Reading the (dummy) property content to check if it is supported- _propertiesManager->getProperty(name);-- auto compatibilityDescriptor = _graph->get_compatibility_descriptor();- if (compatibilityDescriptor.has_value()) {- const auto descriptorView = compatibilityDescriptor.value();- _logger.debug("Runtime requirements from the graph %.*s length: %zu",- static_cast<int>(descriptorView.size()),- descriptorView.data(),- descriptorView.size());- }-- std::ostringstream requirementsString;- Metadata<CURRENT_METADATA_VERSION>(- 0, // no real blob- CURRENT_OPENVINO_VERSION,- std::nullopt, // weightless blobs are not supported- _batchSize,- std::nullopt, // input_layouts are not relevant for the compatibility check- std::nullopt, // output_layouts are not relevant for the compatibility check- std::nullopt, // skip compiler version as well since it is already included in runtime requirements string- std::nullopt, // skip encrypted blob size since it is not relevant for the compatibility check- compatibilityDescriptor)- .write_as_text(requirementsString);- _logger.debug("Runtime requirements string: %s length: %zu",- requirementsString.str().c_str(),- requirementsString.str().length());-- return requirementsString.str();- }-- // default behaviourreturn _propertiesManager->getProperty(name);}diff --git a/src/plugins/intel_npu/src/plugin/src/compiled_model_property_manager.cpp b/src/plugins/intel_npu/src/plugin/src/compiled_model_property_manager.cppnew file mode 100644index 00000000000..f110dbdf395--- /dev/null+++ b/src/plugins/intel_npu/src/plugin/src/compiled_model_property_manager.cpp@@ -0,0 +1,218 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include "compiled_model_property_manager.hpp"++#include <sstream>++#include "intel_npu/common/device_helpers.hpp"+#include "intel_npu/config/options.hpp"+#include "metadata.hpp"++namespace {++inline void logCpuPinningDeprecationWarning(intel_npu::Logger& logger) {+ OPENVINO_SUPPRESS_DEPRECATED_START+ logger.warning(intel_npu::ENABLE_CPU_PINNING::deprecationMessage());+ OPENVINO_SUPPRESS_DEPRECATED_END+}++std::string buildRuntimeRequirements(const std::shared_ptr<intel_npu::IGraph>& graph,+ const std::optional<int64_t>& batchSize,+ intel_npu::Logger& logger) {+ OPENVINO_ASSERT(graph != nullptr, "Missing graph");++ auto compatibilityDescriptor = graph->get_compatibility_descriptor();+ if (!compatibilityDescriptor.has_value()) {+ OPENVINO_THROW("RUNTIME_REQUIREMENTS cannot be generated for this compiled model.");+ }+ const auto descriptorView = compatibilityDescriptor.value();+ logger.debug("Runtime requirements from the graph %.*s length: %zu",+ static_cast<int>(descriptorView.size()),+ descriptorView.data(),+ descriptorView.size());++ std::ostringstream requirementsString;+ intel_npu::Metadata<intel_npu::CURRENT_METADATA_VERSION>(0,+ intel_npu::CURRENT_OPENVINO_VERSION,+ std::nullopt,+ batchSize,+ std::nullopt,+ std::nullopt,+ std::nullopt,+ std::nullopt,+ compatibilityDescriptor)+ .write_as_text(requirementsString);++ logger.debug("Runtime requirements string: %s length: %zu",+ requirementsString.str().c_str(),+ requirementsString.str().length());++ return requirementsString.str();+}++} // namespace++namespace intel_npu {++CompiledModelPropertyManager::CompiledModelPropertyManager(const FilteredConfig& config,+ const std::shared_ptr<IGraph>& graph,+ const std::optional<int64_t>& batchSize,+ Logger& logger)+ : _config(config),+ _graph(graph),+ _batchSize(batchSize),+ _logger(logger) {+ registerProperties();+}++void CompiledModelPropertyManager::setProperty(const ov::AnyMap& properties) {+ std::lock_guard<std::mutex> lock(_mutex);++ if (properties.find(ov::hint::enable_cpu_pinning.name()) != properties.end()) {+ logCpuPinningDeprecationWarning(_logger);+ }++ std::map<std::string, std::string> configsToSet;+ ov::AnyMap specialConfigsToSet;++ for (const auto& property : properties) {+ const auto propertyIt = _properties.find(property.first);+ if (propertyIt == _properties.end()) {+ OPENVINO_THROW("Unsupported configuration key: ", property.first);+ }++ if (propertyIt->second.mutability == ov::PropertyMutability::RO) {+ OPENVINO_THROW("READ-ONLY configuration key: ", property.first);+ }++ if (property.first == ov::cache_encryption_callbacks.name()) {+ specialConfigsToSet.emplace(property.first, property.second);+ } else {+ configsToSet.emplace(property.first, property.second.as<std::string>());+ }+ }++ if (!configsToSet.empty()) {+ _config.update(configsToSet);+ }++ if (!specialConfigsToSet.empty()) {+ _config.updateAny(specialConfigsToSet);+ }+}++ov::Any CompiledModelPropertyManager::getProperty(const std::string& name) const {+ std::lock_guard<std::mutex> lock(_mutex);++ if (name == ov::hint::enable_cpu_pinning.name()) {+ logCpuPinningDeprecationWarning(_logger);+ }++ const auto propertyIt = _properties.find(name);+ if (propertyIt != _properties.end()) {+ if (propertyIt->second.mutability == ov::PropertyMutability::WO) {+ _logger.warning("Trying to get WRITE-ONLY property: %s. Returning empty `ov::Any` object", name.c_str());+ return ov::Any();+ }+ return propertyIt->second.get(_config);+ }++ try {+ return _config.getInternal(name);+ } catch (...) {+ OPENVINO_THROW("Unsupported configuration key: ", name);+ }+}++void CompiledModelPropertyManager::registerProperties() {+ _properties.clear();+ _supportedProperties.clear();++ try_register_property_based_on_config<MODEL_PRIORITY>(_config, _properties, ov::hint::model_priority.name());+ try_register_property_based_on_config<WORKLOAD_TYPE>(_config, _properties, ov::workload_type.name());++ // clang-format off+ OPENVINO_SUPPRESS_DEPRECATED_START+ try_register_property_based_on_config_as_read_only<ENABLE_CPU_PINNING>(_config, _properties, ov::hint::enable_cpu_pinning.name());+ OPENVINO_SUPPRESS_DEPRECATED_END+ try_register_property_based_on_config_as_read_only<LOG_LEVEL>(_config, _properties, ov::log::level.name());+ try_register_property_based_on_config_as_read_only<LOADED_FROM_CACHE>(_config, _properties, ov::loaded_from_cache.name());+ try_register_property_based_on_config_as_read_only<PERFORMANCE_HINT>(_config, _properties, ov::hint::performance_mode.name());+ try_register_property_based_on_config_as_read_only<EXECUTION_MODE_HINT>(_config, _properties, ov::hint::execution_mode.name());+ try_register_property_based_on_config_as_read_only<PERFORMANCE_HINT_NUM_REQUESTS>(_config, _properties, ov::hint::num_requests.name());+ try_register_property_based_on_config_as_read_only<COMPILATION_NUM_THREADS>(_config, _properties, ov::compilation_num_threads.name());+ try_register_property_based_on_config_as_read_only<INFERENCE_PRECISION_HINT>(_config, _properties, ov::hint::inference_precision.name());+ try_register_property_based_on_config_as_read_only<CACHE_MODE>(_config, _properties, ov::cache_mode.name());++ try_register_property_based_on_config_if_set_as_read_only<NUM_STREAMS>(_config, _properties, ov::num_streams.name());+ try_register_property_based_on_config_if_set_as_read_only<COMPILER_TYPE>(_config, _properties, ov::intel_npu::compiler_type.name());+ try_register_property_based_on_config_if_set_as_read_only<COMPILER_VERSION>(_config, _properties, ov::intel_npu::compiler_version.name());+ try_register_property_based_on_config_if_set_as_read_only<WEIGHTS_PATH>(_config, _properties, ov::weights_path.name());+ try_register_property_based_on_config_if_set_as_read_only<CACHE_DIR>(_config, _properties, ov::cache_dir.name());+ try_register_property_based_on_config_if_set_as_read_only<PERF_COUNT>(_config, _properties, ov::enable_profiling.name());+ try_register_property_based_on_config_if_set_as_read_only<PROFILING_TYPE>(_config, _properties, ov::intel_npu::profiling_type.name());+ try_register_property_based_on_config_if_set_as_read_only<TURBO>(_config, _properties, ov::intel_npu::turbo.name());+ try_register_property_based_on_config_if_set_as_read_only<COMPILATION_MODE_PARAMS>(_config, _properties, ov::intel_npu::compilation_mode_params.name());+ try_register_property_based_on_config_if_set_as_read_only<DMA_ENGINES>(_config, _properties, ov::intel_npu::dma_engines.name());+ try_register_property_based_on_config_if_set_as_read_only<TILES>(_config, _properties, ov::intel_npu::tiles.name());+ try_register_property_based_on_config_if_set_as_read_only<COMPILATION_MODE>(_config, _properties, ov::intel_npu::compilation_mode.name());+ try_register_property_based_on_config_if_set_as_read_only<PLATFORM>(_config, _properties, ov::intel_npu::platform.name());+ try_register_property_based_on_config_if_set_as_read_only<DYNAMIC_SHAPE_TO_STATIC>(_config, _properties, ov::intel_npu::dynamic_shape_to_static.name());+ try_register_property_based_on_config_if_set_as_read_only<BACKEND_COMPILATION_PARAMS>(_config, _properties, ov::intel_npu::backend_compilation_params.name());+ try_register_property_based_on_config_if_set_as_read_only<BYPASS_UMD_CACHING>(_config, _properties, ov::intel_npu::bypass_umd_caching.name());+ try_register_property_based_on_config_if_set_as_read_only<DEFER_WEIGHTS_LOAD>(_config, _properties, ov::intel_npu::defer_weights_load.name());+ try_register_property_based_on_config_if_set_as_read_only<COMPILER_DYNAMIC_QUANTIZATION>(_config, _properties, ov::intel_npu::compiler_dynamic_quantization.name());+ try_register_property_based_on_config_if_set_as_read_only<QDQ_OPTIMIZATION>(_config, _properties, ov::intel_npu::qdq_optimization.name());+ try_register_property_based_on_config_if_set_as_read_only<QDQ_OPTIMIZATION_AGGRESSIVE>(_config, _properties, ov::intel_npu::qdq_optimization_aggressive.name());+ try_register_property_based_on_config_if_set_as_read_only<DISABLE_VERSION_CHECK>(_config, _properties, ov::intel_npu::disable_version_check.name());+ try_register_property_based_on_config_if_set_as_read_only<EXPORT_RAW_BLOB>(_config, _properties, ov::intel_npu::export_raw_blob.name());+ try_register_property_based_on_config_if_set_as_read_only<IMPORT_RAW_BLOB>(_config, _properties, ov::intel_npu::import_raw_blob.name());+ try_register_property_based_on_config_if_set_as_read_only<BATCH_COMPILER_MODE_SETTINGS>(_config, _properties, ov::intel_npu::batch_compiler_mode_settings.name());+ try_register_property_based_on_config_if_set_as_read_only<RUN_INFERENCES_SEQUENTIALLY>(_config, _properties, ov::intel_npu::run_inferences_sequentially.name());+ try_register_property_based_on_config_if_set_as_read_only<ENABLE_WEIGHTLESS>(_config, _properties, ov::enable_weightless.name());+ try_register_property_based_on_config_if_set_as_read_only<SEPARATE_WEIGHTS_VERSION>(_config, _properties, ov::intel_npu::separate_weights_version.name());+ try_register_property_based_on_config_if_set_as_read_only<ENABLE_STRIDES_FOR>(_config, _properties, ov::intel_npu::enable_strides_for.name());+ try_register_property_based_on_config_if_set_as_read_only<BATCH_MODE>(_config, _properties, ov::intel_npu::batch_mode.name());+ try_register_property_based_on_config_if_set_as_read_only<SHARED_COMMON_QUEUE>(_config, _properties, ov::intel_npu::shared_common_queue.name());++ try_register_property_based_on_config_with_custom_function(_config, _properties, ov::cache_encryption_callbacks.name(), [](const Config&) {+ return ov::EncryptionCallbacks{nullptr, nullptr};+ });++ register_property_with_custom_function(_properties, ov::hint::model.name(), true, [](const Config&) {+ return std::shared_ptr<const ov::Model>(nullptr);+ });+ register_property_with_custom_function(_properties, ov::model_name.name(), true, [this](const Config&) {+ OPENVINO_ASSERT(_graph != nullptr, "Missing graph");+ return ov::Any(_graph->get_metadata().name);+ });+ register_property_with_custom_function(_properties, ov::optimal_number_of_infer_requests.name(), true, [](const Config& config) {+ return ov::Any(utils::getOptimalNumberOfInferRequestsInParallel(config.get<PLATFORM>(), config.get<PERFORMANCE_HINT>()));+ });+ register_property_with_custom_function(_properties, ov::execution_devices.name(), true, [](const Config&) {+ return ov::Any(std::string("NPU"));+ });+ register_property_with_custom_function(_properties, ov::supported_properties.name(), true, [this](const Config&) {+ return ov::Any(_supportedProperties);+ });+ // clang-format on++ try_register_property_with_custom_function(+ _properties,+ ov::runtime_requirements.name(),+ _graph != nullptr && _graph->get_compatibility_descriptor().has_value(),+ true,+ [this](const Config&) {+ return ov::Any(buildRuntimeRequirements(_graph, _batchSize, _logger));+ });++ for (const auto& property : _properties) {+ if (property.second.isPublic) {+ _supportedProperties.emplace_back(property.first, property.second.mutability);+ }+ }+}++} // namespace intel_npudiff --git a/src/plugins/intel_npu/src/plugin/src/metrics.cpp b/src/plugins/intel_npu/src/plugin/src/metrics.cppindex 24af8c5661f..58506a06337 100644--- a/src/plugins/intel_npu/src/plugin/src/metrics.cpp+++ b/src/plugins/intel_npu/src/plugin/src/metrics.cpp@@ -11,43 +11,10 @@namespace intel_npu {-Metrics::Metrics(const ov::SoPtr<IEngineBackend>& backend) : _backend(backend) {- _supportedMetrics = {ov::supported_properties.name(),- ov::available_devices.name(),- ov::device::full_name.name(),- ov::device::capabilities.name(),- ov::range_for_async_infer_requests.name(),- ov::range_for_streams.name(),- ov::device::capability::EXPORT_IMPORT,- ov::device::architecture.name(),- ov::internal::caching_properties.name(),- ov::cache_dir.name(),- ov::intel_npu::device_alloc_mem_size.name(),- ov::intel_npu::device_total_mem_size.name(),- ov::intel_npu::driver_version.name(),- ov::intel_npu::stepping.name(),- ov::intel_npu::max_tiles.name(),- ov::device::pci_info.name(),- ov::device::gops.name()};-- _supportedConfigKeys = {ov::log::level.name(),- ov::enable_profiling.name(),- ov::device::id.name(),- ov::hint::performance_mode.name(),- ov::num_streams.name(),- ov::hint::num_requests.name(),- ov::intel_npu::compilation_mode_params.name(),- ov::intel_npu::dynamic_shape_to_static.name()};-}-std::vector<std::string> Metrics::GetAvailableDevicesNames() const {return _backend == nullptr ? std::vector<std::string>() : _backend->getDeviceNames();}-const std::vector<std::string>& Metrics::SupportedMetrics() const {- return _supportedMetrics;-}-std::string Metrics::GetFullDeviceName(const std::string& specifiedDeviceName) const {const auto devName = getDeviceName(specifiedDeviceName);auto device = _backend->getDevice(devName);@@ -58,10 +25,6 @@ std::string Metrics::GetFullDeviceName(const std::string& specifiedDeviceName) cOPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");}-const std::vector<std::string>& Metrics::GetSupportedConfigKeys() const {- return _supportedConfigKeys;-}-const std::vector<std::string> Metrics::GetOptimizationCapabilities() const {return _optimizationCapabilities;}diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cppindex 35638fc48a3..c8ffb1bd11d 100644--- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp+++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp@@ -31,6 +31,7 @@#include "openvino/runtime/properties.hpp"#include "openvino/runtime/shared_buffer.hpp"#include "openvino/util/file_util.hpp"+#include "plugin_property_manager.hpp"#include "remote_context.hpp"#include "transformations.hpp"@@ -190,23 +191,22 @@ std::shared_ptr<ov::ICompiledModel> import_model_npuw(std::istream& stream,return nullptr;}-std::shared_ptr<const ov::Model> exclude_model_ptr_from_map(ov::AnyMap& properties) {- std::shared_ptr<const ov::Model> modelPtr = nullptr;+std::shared_ptr<const ov::Model> get_model_ptr_from_map(ov::AnyMap& properties) {if (properties.count(ov::hint::model.name())) {try {- modelPtr = properties.at(ov::hint::model.name()).as<std::shared_ptr<const ov::Model>>();+ return properties.at(ov::hint::model.name()).as<std::shared_ptr<const ov::Model>>();} catch (const ov::Exception&) {try {- modelPtr = std::const_pointer_cast<const ov::Model>(+ return std::const_pointer_cast<const ov::Model>(properties.at(ov::hint::model.name()).as<std::shared_ptr<ov::Model>>());} catch (const ov::Exception&) {OPENVINO_THROW("The value of the \"ov::hint::model\" configuration option (\"MODEL_PTR\") has the ""wrong data type. Expected: std::shared_ptr<const ov::Model>.");}}- properties.erase(ov::hint::model.name());}- return modelPtr;++ return nullptr;}void init_config(const IEngineBackend* backend, OptionsDesc& options, FilteredConfig& config) {@@ -359,7 +359,7 @@ Plugin::Plugin() : _logger("NPUPlugin", Logger::global().level()) {/// Init and register propertiesOV_ITT_TASK_NEXT(PLUGIN, "RegisterProperties");- _propertiesManager = std::make_unique<Properties>(PropertiesType::PLUGIN, config, metrics, _backend);+ _propertiesManager = std::make_unique<PluginPropertyManager>(config, metrics, _backend, _logger);}void Plugin::set_property(const ov::AnyMap& properties) {@@ -375,112 +375,12 @@ void Plugin::set_property(const ov::AnyMap& properties) {_propertiesManager->setProperty(properties);}-ov::CompatibilityCheck Plugin::validate_compatibility_descriptor(ov::intel_npu::CompilerType compilerType,- const ov::AnyMap& arguments) const {- if (arguments.empty() || arguments.find(ov::runtime_requirements.name()) == arguments.end()) {- return ov::CompatibilityCheck::NOT_APPLICABLE;- }-- const auto& runtimeRequirements = arguments.at(ov::runtime_requirements.name()).as<const std::string&>();- _logger.debug("Received runtime_requirements: %s length: %zu",- runtimeRequirements.c_str(),- runtimeRequirements.length());-- // NPU Plugin's runtime requirements are captured in its metadata.- // For now plugin's requirements are met if metadata can be retrieved from the tensor- std::unique_ptr<MetadataBase> metadata = nullptr;- try {- // The plugin cares only about the string size and the metadata version check for now. Additional checks based- // on other metadata fields can be done following this line.- metadata = read_as_text(runtimeRequirements);- } catch (const std::exception& ex) {- // Unsupported version, could not read the metadata or an unknown error has occured. Report that the- // requirements are not met.- _logger.debug("Failed to read metadata from the runtime requirements. The requirements are not met. %s",- ex.what());- return ov::CompatibilityCheck::UNSUPPORTED;- }-- const auto descriptorView = metadata->get_compatibility_descriptor();- std::string compatibilityDescriptor = descriptorView.has_value() ? std::string(descriptorView.value()) : "";- _logger.debug("Retrieved compatibility descriptor from metadata: %s length: %zu",- compatibilityDescriptor.c_str(),- compatibilityDescriptor.length());-- // Implement only the fallback path for now through the PLUGIN compiler type- std::unique_ptr<ICompilerAdapter> compiler = nullptr;- CompilerAdapterFactory factory;- try {- compiler = factory.getCompiler(_backend, compilerType, std::string_view{});-- // Compiler can validate only if the string describes a blob compatible with the current platform- auto result = compiler->validate_compatibility_descriptor(compatibilityDescriptor);- _logger.debug("Compatibility check result: %s", result ? "met" : "not met");- if (result) {- return ov::CompatibilityCheck::SUPPORTED;- } else {- return ov::CompatibilityCheck::UNSUPPORTED;- }- } catch (const std::exception&) {- _logger.error("Failed to create the recommended compiler type for the compatibility check %d. The requirements "- "are not met.",- static_cast<int>(compilerType));- return ov::CompatibilityCheck::NOT_APPLICABLE;- }-}-ov::Any Plugin::get_property(const std::string& name, const ov::AnyMap& arguments) const {- // Special cases that need to be treated outside of the property manager.- // Checking runtime requirements requires access to plugin's metadata- if (name == ov::compatibility_check.name()) {- // Reading the (dummy) property content to check if it is supported- // Expected to throw if the property is not supported- _propertiesManager->getProperty(name);-- // The property was enabled based on the support of the compatibility check in the compiler adapters- // Use the compiler type determined for compatibility check to validate the requirements and return the result- auto compilerType = _propertiesManager->determineCompilerTypeForCompatibilityCheck();-- // Validates both local (plugin's) requirements and device requirements- return validate_compatibility_descriptor(compilerType, arguments);- }-- 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);- copyPropertiesManager->setProperty(npuPluginArguments);-- return copyPropertiesManager->getProperty(name);- }-- return _propertiesManager->getProperty(name);+ return _propertiesManager->getProperty(name, arguments);}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);+ return _propertiesManager->isPropertySupported(name, arguments);}std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<const ov::Model>& model,@@ -503,12 +403,6 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<}}- // ov::hint::model has no corresponding "Config" implementation thus we need to- // remove it from the list of properties- if (exclude_model_ptr_from_map(localProperties)) {- _logger.warning("Model received in config will be ignored as it was already provided by parameter.");- }-if (_backend != nullptr) {_backend->updateInfo(localProperties);}@@ -725,14 +619,10 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<}ov::SoPtr<ov::IRemoteContext> Plugin::create_context(const ov::AnyMap& remoteProperties) const {- auto npuPluginProperties = remoteProperties;- exclude_model_ptr_from_map(npuPluginProperties);- return std::make_shared<RemoteContextImpl>(_backend, npuPluginProperties);+ return std::make_shared<RemoteContextImpl>(_backend, remoteProperties);}-ov::SoPtr<ov::IRemoteContext> Plugin::get_default_context(const ov::AnyMap& remoteProperties) const {- auto npuPluginProperties = remoteProperties;- exclude_model_ptr_from_map(npuPluginProperties);+ov::SoPtr<ov::IRemoteContext> Plugin::get_default_context(const ov::AnyMap&) const {return std::make_shared<RemoteContextImpl>(_backend);}@@ -777,7 +667,6 @@ std::shared_ptr<ov::ICompiledModel> Plugin::import_model(std::istream& stream, c_logger.info("Blob compatibility check skipped.");}OPENVINO_ASSERT(blobSize > 0, "Parsed blob size is empty from the given stream!");-ov::Allocator customAllocator{utils::AlignedAllocator{utils::STANDARD_PAGE_SIZE}};ov::Tensor tensor(ov::element::u8, ov::Shape{blobSize}, customAllocator);if (blobSize > static_cast<decltype(blobSize)>(std::numeric_limits<std::streamsize>::max())) {@@ -869,7 +758,6 @@ ov::SupportedOpsMap Plugin::query_model(const std::shared_ptr<const ov::Model>&update_log_level(properties);auto localProperties = properties;- exclude_model_ptr_from_map(localProperties);if (_backend != nullptr) {_backend->updateInfo(localProperties);@@ -913,9 +801,7 @@ std::shared_ptr<ov::ICompiledModel> Plugin::parse(const ov::Tensor& tensorBig,auto localProperties = properties;- // ov::hint::model has no corresponding "Config" implementation thus we need to- // remove it from the list of properties- auto originalModel = exclude_model_ptr_from_map(localProperties);+ auto originalModel = get_model_ptr_from_map(localProperties);std::shared_ptr<IDevice> device =utils::getDeviceById(_backend, _propertiesManager->determineDeviceId(localProperties));diff --git a/src/plugins/intel_npu/src/plugin/src/plugin_property_manager.cpp b/src/plugins/intel_npu/src/plugin/src/plugin_property_manager.cppnew file mode 100644index 00000000000..ca93999cc76--- /dev/null+++ b/src/plugins/intel_npu/src/plugin/src/plugin_property_manager.cpp@@ -0,0 +1,973 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include "plugin_property_manager.hpp"++#include <algorithm>+#include <optional>+#include <tuple>+#include <utility>++#include "intel_npu/common/compiler_adapter_factory.hpp"+#include "intel_npu/common/device_helpers.hpp"+#include "intel_npu/config/options.hpp"+#include "intel_npu/utils/utils.hpp"+#include "metadata.hpp"++namespace {++std::map<std::string, std::string> any_copy(const ov::AnyMap& params) {+ std::map<std::string, std::string> result;+ for (auto&& value : params) {+ result.emplace(value.first, value.second.as<std::string>());+ }+ 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();+}++inline void logCpuPinningDeprecationWarning(intel_npu::Logger& logger) {+ OPENVINO_SUPPRESS_DEPRECATED_START+ logger.warning(intel_npu::ENABLE_CPU_PINNING::deprecationMessage());+ OPENVINO_SUPPRESS_DEPRECATED_END+}++void filterPropertiesByCompilerSupport(intel_npu::FilteredConfig& config,+ const intel_npu::ICompilerAdapter* compiler,+ const ov::SoPtr<intel_npu::IEngineBackend>& backend,+ const intel_npu::Logger& logger) {+ using namespace intel_npu;++ bool legacy = false;+ std::optional<std::vector<std::string>> compilerSupportList{};+ uint32_t compilerVersion = 0;++ OPENVINO_ASSERT(compiler != nullptr, "Compiler must be present to filter properties by compiler support");++ compilerVersion = compiler->get_version();+ compilerSupportList = compiler->get_supported_options();++ if (!compilerSupportList.has_value()) {+ logger.info("No compiler support options list received! Fallback to version-based option registration");+ legacy = true;+ }++ logger.debug("Compiler version: %u", compilerVersion);+ logger.debug("Legacy registration: %s", legacy ? "true" : "false");+ if (!legacy) {+ const auto& supportedOptions = compilerSupportList.value();+ logger.debug("Compiler supported options list (%zu): ", supportedOptions.size());+ for (const auto& str : supportedOptions) {+ logger.debug(" %s ", str.c_str());+ }+ }++ config.walkEnables([&](const std::string& key) {+ bool isEnabled = false;+ auto opt = config.getOpt(key);+ // Special case for some both configs. Don't need compiler for these Both properties.+ // Runtime (plugin-only) options are always enabled+ if (opt.mode() != OptionMode::RunTime && !isSpecialBothProperty(key)) {+ if (legacy) {+ // Compiler or common option in Legacy mode? Checking its supported version+ if (compilerVersion >= opt.compilerSupportVersion()) {+ isEnabled = true;+ }+ } else {+ // We have compiler, we are not in legacy mode = we have a valid list of supported options+ // Searching in the list+ const auto& supportedOptions = compilerSupportList.value();+ auto it = std::find(supportedOptions.begin(), supportedOptions.end(), key);+ if (it != supportedOptions.end()) {+ isEnabled = true;+ } else {+ // Not found in the supported options list.+ if (compiler != nullptr) {+ // Checking if it is a private option?+ isEnabled = compiler->is_option_supported(key);+ } else {+ // Not in the list and not a private option = disabling+ isEnabled = false;+ }+ }+ }++ if (!isEnabled) {+ logger.debug("Config option %s not supported! Requirements not met.", key.c_str());+ } else {+ logger.debug("Enabled config option %s", key.c_str());+ }++ // update enable flag+ config.enable(key, isEnabled);+ }+ });++ // Special cases+ // NPU_TURBO which might not be supported by compiler, but driver will still use it+ // if it exists in config = driver supports it+ // if compiler->is_option_suported is false = compiler doesn't support it and gets marked disabled by default logic+ // however, if driver supports it, we still need it (and will skip giving it to compiler) = force-enable+ if (backend && backend->isCommandQueueExtSupported()) {+ config.enable(ov::intel_npu::turbo.name(), true);+ }++ if (config.isAvailable(ov::intel_npu::enable_strides_for.name())) {+ if (backend && backend->getGraphExtVersion() < ZE_MAKE_VERSION(1, 16)) {+ logger.info("Config option %s not supported by the driver! Requirements not met.",+ ov::intel_npu::enable_strides_for.name());+ config.enable(ov::intel_npu::enable_strides_for.name(), false);+ }+ }+}++void disableCompilerProperties(intel_npu::FilteredConfig& config, const ov::SoPtr<intel_npu::IEngineBackend>& backend) {+ using namespace intel_npu;++ config.walkEnables([&](const std::string& key) {+ auto opt = config.getOpt(key);+ // Special case for some both configs. Don't need compiler for these Both properties.+ // Runtime (plugin-only) options are always enabled+ if (opt.mode() != OptionMode::RunTime && !isSpecialBothProperty(key)) {+ // Disable all compiler options+ config.enable(key, false);+ }+ });++ // Special cases+ // NPU_TURBO might be supported by the driver+ if (backend && backend->isCommandQueueExtSupported()) {+ config.enable(ov::intel_npu::turbo.name(), true);+ }+}++static auto get_specified_device_name(const intel_npu::Config& config) {+ if (config.has<intel_npu::DEVICE_ID>()) {+ return config.get<intel_npu::DEVICE_ID>();+ }+ return std::string();+}++void exclude_model_ptr_from_map(ov::AnyMap& properties) {+ if (properties.count(ov::hint::model.name())) {+ properties.erase(ov::hint::model.name());+ }+}++bool isCompatibilityCheckSupported(const ov::SoPtr<intel_npu::IEngineBackend>& backend) {+ using namespace intel_npu;++ if (!backend || !backend->getDevice()) {+ return false;+ }++ const auto initStructs = backend->getInitStructs();+ if (initStructs != nullptr && initStructs->getZeDrvApiVersion() >= ZE_MAKE_VERSION(1, 16)) {+ return true;+ }++ // Fallback to plugin compiler if the driver does not expose compatibility check API.+ CompilerAdapterFactory compilerFactory;+ auto compilerType = ov::intel_npu::CompilerType::PLUGIN;+ try {+ auto tempCompiler = compilerFactory.getCompiler(backend, compilerType, std::string_view{});+ return tempCompiler->is_option_supported(ov::compatibility_check.name());+ } catch (...) {+ return false;+ }+}++ov::CompatibilityCheck validateCompatibilityDescriptor(const ov::SoPtr<intel_npu::IEngineBackend>& backend,+ const ov::AnyMap& arguments) {+ using namespace intel_npu;++ if (arguments.empty() || arguments.find(ov::runtime_requirements.name()) == arguments.end()) {+ return ov::CompatibilityCheck::NOT_APPLICABLE;+ }++ const auto& runtimeRequirements = arguments.at(ov::runtime_requirements.name()).as<const std::string&>();++ std::unique_ptr<MetadataBase> metadata = nullptr;+ try {+ metadata = read_as_text(runtimeRequirements);+ } catch (...) {+ return ov::CompatibilityCheck::UNSUPPORTED;+ }++ const auto descriptorView = metadata->get_compatibility_descriptor();+ std::string compatibilityDescriptor = descriptorView.has_value() ? std::string(descriptorView.value()) : "";++ if (compatibilityDescriptor.empty()) {+ return ov::CompatibilityCheck::NOT_APPLICABLE;+ }++ OPENVINO_ASSERT(backend && backend->getDevice(), "Device is not available for compatibility descriptor validation");++ const auto device = backend->getDevice();+ const auto initStructs = backend->getInitStructs();++ if (device != nullptr && initStructs != nullptr && initStructs->getZeDrvApiVersion() >= ZE_MAKE_VERSION(1, 16)) {+ auto result = device->validateCompatibilityDescriptor(compatibilityDescriptor);+ return result ? ov::CompatibilityCheck::SUPPORTED : ov::CompatibilityCheck::UNSUPPORTED;+ }++ // fallback on compiler in plugin if driver does not support compatibility check+ CompilerAdapterFactory factory;+ auto compilerType = ov::intel_npu::CompilerType::PLUGIN;+ try {+ auto compiler = factory.getCompiler(backend, compilerType, std::string_view{});++ auto result =+ compiler->is_option_supported(ov::compatibility_check.name(), std::make_optional(compatibilityDescriptor));+ return result ? ov::CompatibilityCheck::SUPPORTED : ov::CompatibilityCheck::UNSUPPORTED;+ } catch (...) {+ return ov::CompatibilityCheck::NOT_APPLICABLE;+ }+}++} // namespace++namespace intel_npu {++PluginPropertyManager::PluginPropertyManager(const FilteredConfig& config,+ const std::shared_ptr<Metrics>& metrics,+ const ov::SoPtr<IEngineBackend>& backend,+ Logger& logger)+ : _config(config),+ _metrics(metrics),+ _backend(backend),+ _logger(logger) {+ registerProperties();+}++PluginPropertyManager::PluginPropertyManager(const PluginPropertyManager& other)+ : PluginPropertyManager([&other]() {+ std::lock_guard<std::mutex> lock(other._mutex);+ return CopyState{other._config,+ other._metrics,+ other._backend,+ other._logger,+ other._currentlyUsedCompiler,+ other._compilerForCompatibilityCheck,+ other._compatibilityCheckSupported,+ other._currentlyUsedPlatform,+ other._compilerConfigsFilteredByCompiler,+ other._compatibilityCheckFiltered};+ }()) {}++PluginPropertyManager::PluginPropertyManager(CopyState&& state)+ : _config(std::move(state.config)),+ _metrics(std::move(state.metrics)),+ _backend(std::move(state.backend)),+ _logger(state.logger),+ _currentlyUsedCompiler(state.currentlyUsedCompiler),+ _compilerForCompatibilityCheck(state._compilerForCompatibilityCheck),+ _compatibilityCheckSupported(state.compatibilityCheckSupported),+ _currentlyUsedPlatform(std::move(state.currentlyUsedPlatform)),+ _compilerConfigsFilteredByCompiler(state.compilerConfigsFilteredByCompiler),+ _compatibilityCheckFiltered(state.compatibilityCheckFiltered) {+ registerProperties();+}++void PluginPropertyManager::registerProperties() const {+ _properties.clear();+ _supportedProperties.clear();++ // clang-format off+ try_register_property_based_on_config<PERF_COUNT>(_config, _properties, ov::enable_profiling.name());+ try_register_property_based_on_config<PERFORMANCE_HINT>(_config, _properties, ov::hint::performance_mode.name());+ try_register_property_based_on_config<EXECUTION_MODE_HINT>(_config, _properties, ov::hint::execution_mode.name());+ try_register_property_based_on_config<PERFORMANCE_HINT_NUM_REQUESTS>(_config, _properties, ov::hint::num_requests.name());+ try_register_property_based_on_config<COMPILATION_NUM_THREADS>(_config, _properties, ov::compilation_num_threads.name());+ try_register_property_based_on_config<INFERENCE_PRECISION_HINT>(_config, _properties, ov::hint::inference_precision.name());+ try_register_property_based_on_config<LOG_LEVEL>(_config, _properties, ov::log::level.name());+ try_register_property_based_on_config<CACHE_DIR>(_config, _properties, ov::cache_dir.name());+ try_register_property_based_on_config<CACHE_MODE>(_config, _properties, ov::cache_mode.name());+ try_register_property_based_on_config<COMPILED_BLOB>(_config, _properties, ov::hint::compiled_blob.name());+ try_register_property_based_on_config<DEVICE_ID>(_config, _properties, ov::device::id.name());+ try_register_property_based_on_config<NUM_STREAMS>(_config, _properties, ov::num_streams.name());+ try_register_property_based_on_config<WEIGHTS_PATH>(_config, _properties, ov::weights_path.name());+ try_register_property_based_on_config<COMPILATION_MODE_PARAMS>(_config, _properties, ov::intel_npu::compilation_mode_params.name());+ try_register_property_based_on_config<DMA_ENGINES>(_config, _properties, ov::intel_npu::dma_engines.name());+ try_register_property_based_on_config<TILES>(_config, _properties, ov::intel_npu::tiles.name());+ try_register_property_based_on_config<COMPILATION_MODE>(_config, _properties, ov::intel_npu::compilation_mode.name());+ try_register_property_based_on_config<COMPILER_TYPE>(_config, _properties, ov::intel_npu::compiler_type.name());+ try_register_property_based_on_config<PLATFORM>(_config, _properties, ov::intel_npu::platform.name());+ try_register_property_based_on_config<CREATE_EXECUTOR>(_config, _properties, ov::intel_npu::create_executor.name());+ try_register_property_based_on_config<DYNAMIC_SHAPE_TO_STATIC>(_config, _properties, ov::intel_npu::dynamic_shape_to_static.name());+ try_register_property_based_on_config<PROFILING_TYPE>(_config, _properties, ov::intel_npu::profiling_type.name());+ try_register_property_based_on_config<BACKEND_COMPILATION_PARAMS>(_config, _properties, ov::intel_npu::backend_compilation_params.name());+ try_register_property_based_on_config<BATCH_MODE>(_config, _properties, ov::intel_npu::batch_mode.name());+ try_register_property_based_on_config<TURBO>(_config, _properties, ov::intel_npu::turbo.name());+ try_register_property_based_on_config<MODEL_PRIORITY>(_config, _properties, ov::hint::model_priority.name());+ try_register_property_based_on_config<BYPASS_UMD_CACHING>(_config, _properties, ov::intel_npu::bypass_umd_caching.name());+ try_register_property_based_on_config<DEFER_WEIGHTS_LOAD>(_config, _properties, ov::intel_npu::defer_weights_load.name());+ try_register_property_based_on_config<COMPILER_DYNAMIC_QUANTIZATION>(_config, _properties, ov::intel_npu::compiler_dynamic_quantization.name());+ try_register_property_based_on_config<QDQ_OPTIMIZATION>(_config, _properties, ov::intel_npu::qdq_optimization.name());+ try_register_property_based_on_config<QDQ_OPTIMIZATION_AGGRESSIVE>(_config, _properties, ov::intel_npu::qdq_optimization_aggressive.name());+ try_register_property_based_on_config<DISABLE_VERSION_CHECK>(_config, _properties, ov::intel_npu::disable_version_check.name());+ try_register_property_based_on_config<EXPORT_RAW_BLOB>(_config, _properties, ov::intel_npu::export_raw_blob.name());+ try_register_property_based_on_config<IMPORT_RAW_BLOB>(_config, _properties, ov::intel_npu::import_raw_blob.name());+ try_register_property_based_on_config<BATCH_COMPILER_MODE_SETTINGS>(_config, _properties, ov::intel_npu::batch_compiler_mode_settings.name());+ OPENVINO_SUPPRESS_DEPRECATED_START+ try_register_property_based_on_config<ENABLE_CPU_PINNING>(_config, _properties, ov::hint::enable_cpu_pinning.name());+ OPENVINO_SUPPRESS_DEPRECATED_END+ try_register_property_based_on_config<WORKLOAD_TYPE>(_config, _properties, ov::workload_type.name());+ try_register_property_based_on_config<ENABLE_WEIGHTLESS>(_config, _properties, ov::enable_weightless.name());+ try_register_property_based_on_config<SEPARATE_WEIGHTS_VERSION>(_config, _properties, ov::intel_npu::separate_weights_version.name());+ try_register_property_based_on_config<MODEL_SERIALIZER_VERSION>(_config, _properties, ov::intel_npu::model_serializer_version.name());+ try_register_property_based_on_config<ENABLE_STRIDES_FOR>(_config, _properties, ov::intel_npu::enable_strides_for.name());+ try_register_property_based_on_config<DISABLE_IDLE_MEMORY_PRUNING>(_config, _properties, ov::intel_npu::disable_idle_memory_prunning.name());+ try_register_property_based_on_config<SHARED_COMMON_QUEUE>(_config, _properties, ov::intel_npu::shared_common_queue.name());++ try_register_property_based_on_config_with_custom_function(_config, _properties, ov::intel_npu::stepping.name(), [&](const Config& config) {+ if (!config.has<STEPPING>()) {+ try {+ const auto specifiedDeviceName = get_specified_device_name(config);+ return static_cast<int64_t>(_metrics->GetSteppingNumber(specifiedDeviceName));+ } catch (...) {+ _logger.warning("Metrics GetSteppingNumber failed to get value from device.");+ }+ }+ return config.get<STEPPING>();+ });+ try_register_property_based_on_config_with_custom_function(_config, _properties, ov::intel_npu::max_tiles.name(), [&](const Config& config) {+ if (!config.has<MAX_TILES>()) {+ try {+ const auto specifiedDeviceName = get_specified_device_name(config);+ return static_cast<int64_t>(_metrics->GetMaxTiles(specifiedDeviceName));+ } catch (...) {+ _logger.warning("Metrics GetMaxTiles failed to get value from device.");+ }+ }+ return config.get<MAX_TILES>();+ });+ try_register_property_based_on_config_with_custom_function(_config, _properties, ov::cache_encryption_callbacks.name(), [](const Config&) {+ return ov::EncryptionCallbacks{nullptr, nullptr};+ });+ // clang-format on++ // Special case: this property is always registered because it's supported by the implementation,+ // but it's not visible in supported_properties if the driver doesn't support it.+ try_register_property_based_on_config_with_visibility<RUN_INFERENCES_SEQUENTIALLY>(+ _config,+ _properties,+ ov::intel_npu::run_inferences_sequentially.name(),+ [&] {+ if (_backend && _backend->getInitStructs()) {+ if (_backend->getInitStructs()->getCommandQueueDdiTable().version() >= ZE_MAKE_VERSION(1, 1)) {+ return true;+ }+ }+ return false;+ }());++ for_each_exposed_npuw_option([&](auto tag) {+ using Opt = typename decltype(tag)::type;+ try_register_npuw_option_property<Opt>(_config, _properties);+ });++ // clang-format off+ if (_metrics != nullptr) {+ register_property_with_custom_function(_properties, ov::available_devices.name(), true, [&](const Config&) {+ return _metrics->GetAvailableDevicesNames();+ });+ register_property_with_custom_function(_properties, ov::device::capabilities.name(), true, [&](const Config&) {+ return _metrics->GetOptimizationCapabilities();+ });+ register_property_with_custom_function(_properties, ov::range_for_async_infer_requests.name(), true, [&](const Config&) {+ return _metrics->GetRangeForAsyncInferRequest();+ });+ register_property_with_custom_function(_properties, ov::range_for_streams.name(), true, [&](const Config&) {+ return _metrics->GetRangeForStreams();+ });+ register_property_with_custom_function(_properties, ov::device::pci_info.name(), true, [&](const Config& config) {+ return _metrics->GetPciInfo(get_specified_device_name(config));+ });+ register_property_with_custom_function(_properties, ov::device::gops.name(), true, [&](const Config& config) {+ return _metrics->GetGops(get_specified_device_name(config));+ });+ register_property_with_custom_function(_properties, ov::device::type.name(), true, [&](const Config& config) {+ return _metrics->GetDeviceType(get_specified_device_name(config));+ });+ register_property_with_custom_function(_properties, ov::intel_npu::device_alloc_mem_size.name(), true, [&](const Config& config) {+ return _metrics->GetDeviceAllocMemSize(get_specified_device_name(config));+ });+ register_property_with_custom_function(_properties, ov::intel_npu::device_total_mem_size.name(), true, [&](const Config& config) {+ return _metrics->GetDeviceTotalMemSize(get_specified_device_name(config));+ });+ register_property_with_custom_function(_properties, ov::intel_npu::driver_version.name(), true, [&](const Config&) {+ return _metrics->GetDriverVersion();+ });+ register_property_with_custom_function(_properties, ov::device::uuid.name(), true, [&](const Config& config) {+ auto devUuid = _metrics->GetDeviceUuid(get_specified_device_name(config));+ return decltype(ov::device::uuid)::value_type{devUuid};+ });+ register_property_with_custom_function(_properties, ov::device::luid.name(), _backend == nullptr ? false : _backend->isLUIDExtSupported(), [&](const Config& config) {+ return _metrics->GetDeviceLUID(get_specified_device_name(config));+ });+ register_property_with_custom_function(_properties, ov::execution_devices.name(), true, [&](const Config& config) {+ if (_metrics->GetAvailableDevicesNames().size() > 1) {+ return std::string("NPU." + config.get<DEVICE_ID>());+ }+ return std::string("NPU");+ });+ register_property_with_custom_function(_properties, ov::intel_npu::backend_name.name(), false, [&](const Config&) {+ return _metrics->GetBackendName();+ });++ try_register_property_with_custom_function(_properties, ov::device::architecture.name(), !_metrics->GetAvailableDevicesNames().empty(), true, [&](const Config& config) {+ return _metrics->GetDeviceArchitecture(get_specified_device_name(config));+ });+ try_register_property_with_custom_function(_properties, ov::device::full_name.name(), !_metrics->GetAvailableDevicesNames().empty(), true, [&](const Config& config) {+ return _metrics->GetFullDeviceName(get_specified_device_name(config));+ });+ }++ register_property_with_custom_function(_properties, ov::hint::model.name(), true, [](const Config&) {+ return std::shared_ptr<const ov::Model>(nullptr);+ });+ register_property_with_custom_function(_properties, ov::optimal_number_of_infer_requests.name(), true, [&](const Config& config) {+ return utils::getOptimalNumberOfInferRequestsInParallel(+ utils::getCompilationPlatform(+ config.get<PLATFORM>(),+ _backend == nullptr ? config.get<DEVICE_ID>()+ : _backend->getDevice(config.get<DEVICE_ID>())->getName(),+ _backend == nullptr ? std::vector<std::string>() : _backend->getDeviceNames()),+ config.get<PERFORMANCE_HINT>());+ });+ register_property_with_custom_function(_properties, ov::intel_npu::compiler_version.name(), true, [&](const Config& config) {+ 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 ? std::move(deviceId) : device->getName(),+ _backend == nullptr ? std::vector<std::string>() : _backend->getDeviceNames());++ CompilerAdapterFactory factory;+ auto dummyCompiler = factory.getCompiler(_backend, compilerType, compilationPlatform);++ return dummyCompiler->get_version();+ });+ register_property_with_custom_function(_properties, ov::internal::supported_properties.name(), false, [&](const Config&) {+ return _internalSupportedProperties;+ });+ register_property_with_custom_function(_properties, ov::internal::cache_header_alignment.name(), false, [&](const Config&) {+ return utils::STANDARD_PAGE_SIZE;+ });+ register_property_with_custom_function(_properties, ov::internal::caching_properties.name(), false, [&](const Config&) {+ std::vector<ov::PropertyName> caching_props{};+ for (auto prop : _cachingProperties) {+ if (_config.isAvailable(prop)) {+ caching_props.emplace_back(prop);+ }+ }+ for (auto prop : _cachingProperties) {+ if (prop.find("NPUW") != prop.npos) {+ caching_props.emplace_back(prop);+ }+ }+ return caching_props;+ });+ register_property_with_custom_function(_properties, ov::supported_properties.name(), true, [&](const Config&) {+ return _supportedProperties;+ });+ // clang-format on++ try_register_property_with_custom_function_and_args(_properties,+ ov::compatibility_check.name(),+ _compatibilityCheckFiltered && _compatibilityCheckSupported,+ true,+ [this](const Config&, const ov::AnyMap& arguments) {+ return validateCompatibilityDescriptor(_backend, arguments);+ });++ for (auto& property : _properties) {+ if (property.second.isPublic) {+ _supportedProperties.emplace_back(ov::PropertyName(property.first, property.second.mutability));+ }+ }+}++void PluginPropertyManager::initializeCompatibilityCheckSupportIfNeeded() const {+ if (_compatibilityCheckFiltered) {+ return;+ }++ _compatibilityCheckSupported = isCompatibilityCheckSupported(_backend);+ _compatibilityCheckFiltered = true;++ const auto compatibilityCheckName = std::string(ov::compatibility_check.name());++ // Keep only one descriptor for this property and update it after the one-time probe.+ _properties.erase(compatibilityCheckName);++ try_register_property_with_custom_function_and_args(_properties,+ compatibilityCheckName,+ _compatibilityCheckSupported,+ true,+ [this](const Config&, const ov::AnyMap& arguments) {+ return validateCompatibilityDescriptor(_backend, arguments);+ });++ // Update supported_properties incrementally for compatibility_check only.+ _supportedProperties.erase(+ std::remove(_supportedProperties.begin(), _supportedProperties.end(), compatibilityCheckName),+ _supportedProperties.end());+ if (_compatibilityCheckSupported) {+ _supportedProperties.emplace_back(ov::PropertyName(compatibilityCheckName, ov::PropertyMutability::RO));+ }+}++void PluginPropertyManager::setProperty(const ov::AnyMap& properties) {+ std::lock_guard<std::mutex> lock(_mutex);++ auto resolveCompilerTypeWithoutLock = [&](const ov::AnyMap& propertyMap) {+ auto compilerTypeIt = propertyMap.find(ov::intel_npu::compiler_type.name());+ if (compilerTypeIt != propertyMap.end()) {+ return COMPILER_TYPE::parse(compilerTypeIt->second.as<std::string>());+ }+ return _config.get<COMPILER_TYPE>();+ };++ auto resolveDeviceIdWithoutLock = [&](const ov::AnyMap& propertyMap) {+ auto deviceIdIt = propertyMap.find(std::string(ov::device::id.name()));+ if (deviceIdIt != propertyMap.end()) {+ return deviceIdIt->second.as<std::string>();+ }+ return _config.get<DEVICE_ID>();+ };++ auto resolvePlatformWithoutLock = [&](const ov::AnyMap& propertyMap) {+ auto platformIt = propertyMap.find(ov::intel_npu::platform.name());+ if (platformIt != propertyMap.end()) {+ return platformIt->second.as<std::string>();+ }+ return _config.get<PLATFORM>();+ };++ if (properties.find(ov::compatibility_check.name()) != properties.end()) {+ initializeCompatibilityCheckSupportIfNeeded();+ }++ if (properties.find(ov::hint::enable_cpu_pinning.name()) != properties.end()) {+ logCpuPinningDeprecationWarning(_logger);+ }++ std::unique_ptr<ICompilerAdapter> compiler = nullptr;+ bool propertyIsCompilerConfig = false;+ bool propertyIsRegistered = true;+ for (const auto& property : properties) {+ if (!isPropertyRegistered(property.first)) {+ propertyIsRegistered = false;+ break;+ }+ // Special case for some both configs. Don't need to check compiler support for these Both properties.+ const bool isNotSpecialBothProperty = !isSpecialBothProperty(property.first);+ if (_config.hasOpt(property.first) && isNotSpecialBothProperty) {+ auto opt = _config.getOpt(property.first);+ if (opt.mode() != OptionMode::RunTime) {+ propertyIsCompilerConfig = true;+ break;+ }+ }+ }++ // Check if one of the properties is compiler config which needs to return different values based on compiler+ // and platform configuration+ if (propertyIsCompilerConfig || !propertyIsRegistered) {+ auto compilerType = resolveCompilerTypeWithoutLock(properties);+ auto deviceId = resolveDeviceIdWithoutLock(properties);+ auto device = utils::getDeviceById(_backend, deviceId);++ auto compilationPlatform = utils::getCompilationPlatform(+ resolvePlatformWithoutLock(properties),+ device == nullptr ? std::move(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;+ compiler = factory.getCompiler(_backend, compilerType, compilationPlatform);++ if (!(_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 = std::move(compilationPlatform);+ }+ }++ std::map<std::string, std::string> cfgs_to_set;+ ov::AnyMap special_cfgs_to_set;+ for (auto&& value : properties) {+ if (_properties.find(value.first) == _properties.end()) {+ // property doesn't exist - checking as internal now+ if (compiler != nullptr) {+ if (compiler->is_option_supported(value.first)) {+ // if compiler reports it supported > registering as internal+ _config.addOrUpdateInternal(value.first, value.second.as<std::string>());+ } else {+ OPENVINO_THROW("Unsupported configuration key: ", value.first);+ }+ } else {+ OPENVINO_THROW("Unsupported configuration key: ", value.first);+ }+ } else {+ if (_properties[value.first].mutability == ov::PropertyMutability::RO) {+ OPENVINO_THROW("READ-ONLY configuration key: ", value.first);+ } else if (value.first == ov::cache_encryption_callbacks.name()) {+ special_cfgs_to_set.emplace(value.first, value.second);+ } else {+ cfgs_to_set.emplace(value.first, value.second.as<std::string>());+ }+ }+ }++ if (!cfgs_to_set.empty()) {+ _config.update(cfgs_to_set);+ }++ if (!special_cfgs_to_set.empty()) {+ _config.updateAny(special_cfgs_to_set);+ }+}++ov::Any PluginPropertyManager::getProperty(const std::string& name, const ov::AnyMap& arguments) const {+ if (!arguments.empty() && name != ov::compatibility_check.name()) {+ auto pluginArguments = arguments;+ exclude_model_ptr_from_map(pluginArguments);++ auto copyProperties = PluginPropertyManager(*this);+ copyProperties.setProperty(pluginArguments);+ return copyProperties.getProperty(name);+ }++ std::lock_guard<std::mutex> lock(_mutex);++ if (name == ov::hint::enable_cpu_pinning.name()) {+ logCpuPinningDeprecationWarning(_logger);+ }++ if (name == ov::supported_properties.name() || name == ov::compatibility_check.name()) {+ initializeCompatibilityCheckSupportIfNeeded();+ }++ bool propertyIsCompilerConfig = false;+ bool propertyIsRegistered = true;+ // If the property is not registered, there is no point of checking the config.+ if (!isPropertyRegistered(name)) {+ propertyIsRegistered = false;+ } else if (_config.hasOpt(name) && !isSpecialBothProperty(name)) {+ // Property is already registered but need to re-check if the CompilerTime config is still supported by the+ // current compiler.+ auto opt = _config.getOpt(name);+ if (opt.mode() != OptionMode::RunTime) {+ propertyIsCompilerConfig = true;+ }+ }++ // 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>();+ auto device = utils::getDeviceById(_backend, deviceId);++ auto compilationPlatform = utils::getCompilationPlatform(+ _config.get<PLATFORM>(),+ device == nullptr ? std::move(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) {+ OPENVINO_THROW("Failed to create compiler for getting property ", name, " with error: ", ex.what());+ }++ _logger.warning("Failed to create compiler for getting property %s with error: %s."+ "Returning 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 = std::move(compilationPlatform);+ }+ }++ auto&& configIterator = _properties.find(name);+ if (configIterator != _properties.cend()) {+ if (configIterator->second.mutability == ov::PropertyMutability::WO) {+ _logger.warning("Trying to get WRITE-ONLY property: %s. Returning empty `ov::Any` object", name.c_str());+ return ov::Any();+ }+ // Check if property requires arguments+ if (configIterator->second.getWithArgs) {+ return configIterator->second.getWithArgs(_config, arguments);+ }+ return configIterator->second.get(_config);+ }+ try {+ return _config.getInternal(name);+ } catch (...) {+ OPENVINO_THROW("Unsupported configuration key: ", name);+ }+}++bool PluginPropertyManager::isPropertySupported(const std::string& name, const ov::AnyMap& arguments) const {+ if (!arguments.empty() && name != ov::compatibility_check.name()) {+ auto pluginArguments = arguments;+ exclude_model_ptr_from_map(pluginArguments);++ auto copyProperties = PluginPropertyManager(*this);+ try {+ copyProperties.setProperty(pluginArguments);+ } catch (...) {+ return false;+ }++ return copyProperties.isPropertySupported(name);+ }++ std::lock_guard<std::mutex> lock(_mutex);+ if (name == ov::hint::enable_cpu_pinning.name()) {+ logCpuPinningDeprecationWarning(_logger);+ }++ if (name == ov::compatibility_check.name()) {+ initializeCompatibilityCheckSupportIfNeeded();+ }++ 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) {+ const auto it = _properties.find(name);+ return it->second.isPublic;+ }++ // 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 ? std::move(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 = std::move(compilationPlatform);+ }++ const auto it = _properties.find(name);+ return it != _properties.end() && it->second.isPublic;+}++FilteredConfig PluginPropertyManager::getConfigWithCompilerPropertiesDisabled(const ov::AnyMap& properties) const {+ auto [updatedConfig, compilerConfigsFilteredByCompiler, logger] = [&]() {+ std::lock_guard<std::mutex> lock(_mutex);+ return std::make_tuple(_config, _compilerConfigsFilteredByCompiler, _logger);+ }();++ auto pluginProperties = properties;+ exclude_model_ptr_from_map(pluginProperties);++ if (compilerConfigsFilteredByCompiler) {+ disableCompilerProperties(updatedConfig, _backend);+ }++ if (pluginProperties.find(ov::hint::enable_cpu_pinning.name()) != pluginProperties.end()) {+ logCpuPinningDeprecationWarning(logger);+ }++ if (pluginProperties.empty()) {+ return std::move(updatedConfig);+ }++ const std::map<std::string, std::string> rawConfig = any_copy(pluginProperties);+ std::map<std::string, std::string> cfgsToSet;+ ov::AnyMap specialCfgsToSet;+ for (const auto& [key, value] : rawConfig) {+ if (updatedConfig.hasOpt(key)) {+ const auto optionMode = updatedConfig.getOpt(key).mode();++ if (optionMode == OptionMode::CompileTime) {+ logger.info(+ "Config key '%s' is recognized as a compiler option, will not be used for current configuration.",+ key.c_str());+ continue;+ }++ if (optionMode == OptionMode::Both && !updatedConfig.isAvailable(key)) {+ logger.info("Config key '%s' is not enabled by the plugin, will not be used for current configuration.",+ key.c_str());+ continue;+ }+ }++ if (key == ov::cache_encryption_callbacks.name()) {+ specialCfgsToSet.emplace(key, pluginProperties.at(key));+ } else {+ cfgsToSet.emplace(key, value);+ }+ }++ updatedConfig.update(cfgsToSet);+ updatedConfig.updateAny(specialCfgsToSet);++ return std::move(updatedConfig);+}++FilteredConfig PluginPropertyManager::getConfigForSpecificCompiler(const ov::AnyMap& properties,+ const ICompilerAdapter* compiler) const {+ auto [updatedConfig, compilerConfigsFilteredByCompiler, currentlyUsedCompiler, currentlyUsedPlatform, logger] =+ [&]() {+ std::lock_guard<std::mutex> lock(_mutex);+ return std::make_tuple(_config,+ _compilerConfigsFilteredByCompiler,+ _currentlyUsedCompiler,+ _currentlyUsedPlatform,+ _logger);+ }();++ if (properties.find(ov::hint::enable_cpu_pinning.name()) != properties.end()) {+ logCpuPinningDeprecationWarning(logger);+ }++ auto pluginProperties = properties;+ exclude_model_ptr_from_map(pluginProperties);++ std::optional<ov::intel_npu::CompilerType> propertiesCompilerType = std::nullopt;+ std::optional<std::string> propertiesPlatform = std::nullopt;+ if (compilerConfigsFilteredByCompiler) {+ auto compilerType = pluginProperties.find(ov::intel_npu::compiler_type.name());+ if (compilerType != pluginProperties.end()) {+ propertiesCompilerType = compilerType->second.as<ov::intel_npu::CompilerType>();+ }+ }+ auto platform = pluginProperties.find(ov::intel_npu::platform.name());+ if (platform != pluginProperties.end()) {+ propertiesPlatform = platform->second.as<std::string>();+ }++ // filter out unsupported options+ if (!(compilerConfigsFilteredByCompiler &&+ propertiesCompilerType.value_or(currentlyUsedCompiler) == currentlyUsedCompiler &&+ propertiesPlatform.value_or(currentlyUsedPlatform) == currentlyUsedPlatform)) {+ // In case the compiler properties are not initialized or the compiler/platform was changed since last call -+ // filter out options again+ filterPropertiesByCompilerSupport(updatedConfig, compiler, _backend, logger);+ }++ const std::map<std::string, std::string> rawConfig = any_copy(pluginProperties);+ std::map<std::string, std::string> cfgsToSet;+ ov::AnyMap specialCfgsToSet;+ for (const auto& [key, value] : rawConfig) {+ if (!updatedConfig.hasOpt(key)) {+ // not a known config key+ if (!compiler->is_option_supported(key)) {+ OPENVINO_THROW("[ NOT_FOUND ] Option '", key, "' is not supported for current configuration");+ }+ updatedConfig.addOrUpdateInternal(key, value);+ } else if (key == ov::cache_encryption_callbacks.name()) {+ specialCfgsToSet.emplace(key, pluginProperties.at(key));+ } else {+ cfgsToSet.emplace(key, value);+ }+ }++ updatedConfig.update(cfgsToSet);+ updatedConfig.updateAny(specialCfgsToSet);++ return std::move(updatedConfig);+}++std::string PluginPropertyManager::determinePlatform(const ov::AnyMap& properties) const {+ auto platform = properties.find(ov::intel_npu::platform.name());+ if (platform != properties.end()) {+ return platform->second.as<std::string>();+ }+ std::lock_guard<std::mutex> lock(_mutex);+ return _config.get<PLATFORM>();+}++std::string PluginPropertyManager::determineDeviceId(const ov::AnyMap& properties) const {+ auto device_id = properties.find(std::string(ov::device::id.name()));+ if (device_id != properties.end()) {+ return device_id->second.as<std::string>();+ }+ std::lock_guard<std::mutex> lock(_mutex);+ return _config.get<DEVICE_ID>();+}++ov::intel_npu::CompilerType PluginPropertyManager::determineCompilerType(const ov::AnyMap& properties) const {+ auto it = properties.find(ov::intel_npu::compiler_type.name());+ if (it != properties.end()) {+ return COMPILER_TYPE::parse(it->second.as<std::string>());+ }+ std::lock_guard<std::mutex> lock(_mutex);+ return _config.get<COMPILER_TYPE>();+}++bool PluginPropertyManager::isPropertyRegistered(const std::string& propertyName) const {+ return _properties.find(propertyName) != _properties.end();+}++} // namespace intel_npudiff --git a/src/plugins/intel_npu/src/plugin/src/properties.cpp b/src/plugins/intel_npu/src/plugin/src/properties.cppdeleted file mode 100644index 0c4b2b067e9..00000000000--- a/src/plugins/intel_npu/src/plugin/src/properties.cpp+++ /dev/null@@ -1,1327 +0,0 @@-// Copyright (C) 2018-2026 Intel Corporation-// SPDX-License-Identifier: Apache-2.0-//--// Plugin-#include "properties.hpp"--#include "intel_npu/common/compiler_adapter_factory.hpp"-#include "intel_npu/common/device_helpers.hpp"-#include "intel_npu/config/npuw.hpp"-#include "intel_npu/config/options.hpp"-#include "intel_npu/utils/utils.hpp"--namespace {--std::map<std::string, std::string> any_copy(const ov::AnyMap& params) {- std::map<std::string, std::string> result;- for (auto&& value : params) {- result.emplace(value.first, value.second.as<std::string>());- }- 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();-}--inline void logCpuPinningDeprecationWarning(intel_npu::Logger& logger) {- OPENVINO_SUPPRESS_DEPRECATED_START- logger.warning(intel_npu::ENABLE_CPU_PINNING::deprecationMessage());- OPENVINO_SUPPRESS_DEPRECATED_END-}--void filterPropertiesByCompilerSupport(intel_npu::FilteredConfig& config,- const intel_npu::ICompilerAdapter* compiler,- const ov::SoPtr<intel_npu::IEngineBackend>& backend,- const intel_npu::Logger& logger) {- using namespace intel_npu;- bool legacy = false;- std::optional<std::vector<std::string>> compilerSupportList{};- uint32_t compilerVersion = 0;-- OPENVINO_ASSERT(compiler != nullptr, "Compiler must be present to filter properties by compiler support");-- compilerVersion = compiler->get_version();- compilerSupportList = compiler->get_supported_options();-- if (!compilerSupportList.has_value()) {- logger.info("No compiler support options list received! Fallback to version-based option registration");- legacy = true;- }-- // Logs- logger.debug("Compiler version: %u", compilerVersion);- logger.debug("Legacy registration: %s", legacy ? "true" : "false");- if (!legacy) {- const auto& supportedOptions = compilerSupportList.value();- logger.debug("Compiler supported options list (%zu): ", supportedOptions.size());- for (const auto& str : supportedOptions) {- logger.debug(" %s ", str.c_str());- }- }-- // Parse enables- config.walkEnables([&](const std::string& key) {- bool isEnabled = false;- auto opt = config.getOpt(key);- // Special case for some both configs. Don't need compiler for these Both properties.- // Runtime (plugin-only) options are always enabled- if (opt.mode() != OptionMode::RunTime && !isSpecialBothProperty(key)) {- if (legacy) {- // Compiler or common option in Legacy mode? Checking its supported version- if (compilerVersion >= opt.compilerSupportVersion()) {- isEnabled = true;- }- } else {- // We have compiler, we are not in legacy mode = we have a valid list of supported options- // Searching in the list- const auto& supportedOptions = compilerSupportList.value();- auto it = std::find(supportedOptions.begin(), supportedOptions.end(), key);- if (it != supportedOptions.end()) {- isEnabled = true;- } else {- // Not found in the supported options list.- if (compiler != nullptr) {- // Checking if it is a private option?- isEnabled = compiler->is_option_supported(key);- } else {- // Not in the list and not a private option = disabling- isEnabled = false;- }- }- }- if (!isEnabled) {- logger.debug("Config option %s not supported! Requirements not met.", key.c_str());- } else {- logger.debug("Enabled config option %s", key.c_str());- }- // update enable flag- config.enable(key, isEnabled);- }- });-- // Special cases- // NPU_TURBO which might not be supported by compiler, but driver will still use it- // if it exists in config = driver supports it- // if compiler->is_option_suported is false = compiler doesn't support it and gets marked disabled by default logic- // however, if driver supports it, we still need it (and will skip giving it to compiler) = force-enable- if (backend && backend->isCommandQueueExtSupported()) {- config.enable(ov::intel_npu::turbo.name(), true);- }-- if (config.isAvailable(ov::intel_npu::enable_strides_for.name())) {- if (backend && backend->getGraphExtVersion() < ZE_MAKE_VERSION(1, 16)) {- logger.info("Config option %s not supported by the driver! Requirements not met.",- ov::intel_npu::enable_strides_for.name());- config.enable(ov::intel_npu::enable_strides_for.name(), false);- }- }-}--void disableCompilerProperties(intel_npu::FilteredConfig& config, const ov::SoPtr<intel_npu::IEngineBackend>& backend) {- using namespace intel_npu;- // Parse enables- config.walkEnables([&](const std::string& key) {- auto opt = config.getOpt(key);-- // Special case for some both configs. Don't need compiler for these Both properties.- // Runtime (plugin-only) options are always enabled- if (opt.mode() != OptionMode::RunTime && !isSpecialBothProperty(key)) { // Compiler and common options- // Disable all compiler options- config.enable(key, false);- }- });-- // Special cases- // NPU_TURBO might be supported by the driver- if (backend && backend->isCommandQueueExtSupported()) {- config.enable(ov::intel_npu::turbo.name(), true);- }-}--// Helper function for retrieving the device name-std::string get_specified_device_name(const intel_npu::Config& config) {- if (config.has<intel_npu::DEVICE_ID>()) {- return config.get<intel_npu::DEVICE_ID>();- }- return std::string();-}--} // namespace--namespace intel_npu {--//-// Helper macro functions to ease registration of properties (both from configs and from metrics)-//--/**- * @brief Macro for registering simple get<> properties which have everything defined in their optionBase.- *- * This macro can be used for registering properties which have entry in the optionsDesc table and- * requre a simple globalconfig.get<TEMPLATE>() callback for value, without any extra data manipulation- * It will check if the configuration option is available in the globalconfig and if it exists,- * then registers it as a property in the internal property map. It handles- * public/private property visibility and the mutability of the property- * based on the configuration from the optionBase type.- *- * @param OPT_NAME Class/type of the option (will fetch .name() from it)- * @param OPT_TYPE Type (template) of the option- *- * @details- * - It first checks if the option was registered in the global config. Options not present in the global config- * are not supported in the current configuration and were previously filtered out on plugin level.- * - The property visibility (public/private) and mutability (RO/RW) are read from the base option descriptor- * (optionBase) the property will map to- * - COMPILED_MODEL only: In case the property is registered for a compiled_model, mutability will be automatically- * forced to READ-ONLY- * - COMPILED_MODEL only: If the configuration has no entry for the option, it means it was not set, which means it will- * skip registering it- * - A simple config.get<OPT_TYPE> lambda function is defined as the property's callback function- *- * @note The macro ensures that compiled model properties are marked read-only unless the configuration lacks the- * specified option type.- */-#define TRY_REGISTER_SIMPLE_PROPERTY(OPT_NAME, OPT_TYPE) \- do { \- std::string o_name = OPT_NAME.name(); \- if (_config.isAvailable(o_name)) { \- bool isPublic = _config.getOpt(o_name).isPublic(); \- ov::PropertyMutability isMutable = _config.getOpt(o_name).mutability(); \- if (_pType == PropertiesType::COMPILED_MODEL) { \- isMutable = ov::PropertyMutability::RO; \- } \- _properties.emplace(o_name, std::make_tuple(isPublic, isMutable, [](const Config& config) { \- return config.get<OPT_TYPE>(); \- })); \- } \- } while (0)--#define TRY_REGISTER_NPUW_OPTION_PROPERTY(OPT_TYPE) \- do { \- std::string o_name = std::string(OPT_TYPE::key()); \- if (_config.isAvailable(o_name)) { \- bool isPublic = _config.getOpt(o_name).isPublic(); \- ov::PropertyMutability isMutable = _config.getOpt(o_name).mutability(); \- if (_pType == PropertiesType::COMPILED_MODEL) { \- isMutable = ov::PropertyMutability::RO; \- } \- _properties.emplace(o_name, std::make_tuple(isPublic, isMutable, [](const Config& config) { \- return config.get<OPT_TYPE>(); \- })); \- } \- } while (0)--/**- * @brief Macro for registering simple get<> properties which have been previously set. For COMPILED_MODEL- *- * This macro is the same as TRY_REGISTER_SIMPLE_PROPERTY with the added functionality that it first verifies- * whether the option was previously set + forces the property to be public (!!). Basicly it will not register- * properties which are still on their default values. This is useful for Compiled_model properties to avoid reporting- * settings which were not set at model compilation. Having properties in compiled_model which report default value can- * be misleading as those default values might not even haven been used by compiler, or in extreme cornercases be out of- * sync with the compiler's default values.- *- * @param OPT_NAME Class/type of the option (will fetch .name() from it)- * @param OPT_TYPE Type (template) of the option- *- * @details- * - It first checks if the config has a previusly set value for this key. If there isn't any value set for this key,- * it will skip registration- * - Then checks if the option was registered in the global config. Options not present in the global config- * are not supported in the current configuration and were previously filtered out on plugin level.- * - The property visibility (public/private) and mutability (RO/RW) are read from the base option descriptor- * (optionBase) the property will map to- * - mutability will be automatically forced to READ-ONLY- * - visibility will be automatically forced to PUBLIC- * - If the configuration has no entry for the option, it means it was not set, which means it will- * skip registering it- * - A simple config.get<OPT_TYPE> lambda function is defined as the property's callback function- *- * @note The macro ensures that compiled model properties are marked read-only unless the configuration lacks the- * specified option type.- * @note ***** TO BE USED FOR COMPILED_MODEL ONLY ***** It forces the property public!- */-#define TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(OPT_NAME, OPT_TYPE) \- do { \- std::string o_name = OPT_NAME.name(); \- if (!_config.has(o_name)) { \- break; \- } \- if (_config.isAvailable(o_name)) { \- bool isPublic = _config.getOpt(o_name).isPublic(); \- ov::PropertyMutability isMutable = _config.getOpt(o_name).mutability(); \- if (_pType == PropertiesType::COMPILED_MODEL) { \- isMutable = ov::PropertyMutability::RO; \- isPublic = true; \- } \- _properties.emplace(o_name, std::make_tuple(isPublic, isMutable, [](const Config& config) { \- return config.get<OPT_TYPE>(); \- })); \- } \- } while (0)--/**- * @brief Macro for defining otherwise simple get<> properties but which have variable public/private field- *- * This macro offers the same functionality as TRY_REGISTER_SIMPLE_PROPERTY (see its description for more)- * with the extra feature that enforces plugin property visibility (public/private) given by user.- * Compiled model properties will still be forced to READ-ONLY- *- * @param OPT_NAME Class/type of the option (will fetch .name() from it)- * @param OPT_TYPE Type (template) of the option- * @param PROP_VISIBILITY Visibility (true=public, false=private) of the resulting property- *- * @details- * @see TRY_REGISTER_SIMPLE_PROPERTY- */-#define TRY_REGISTER_VARPUB_PROPERTY(OPT_NAME, OPT_TYPE, PROP_VISIBILITY) \- do { \- std::string o_name = OPT_NAME.name(); \- if (_config.isAvailable(o_name)) { \- ov::PropertyMutability isMutable = _config.getOpt(o_name).mutability(); \- if (_pType == PropertiesType::COMPILED_MODEL) { \- isMutable = ov::PropertyMutability::RO; \- } \- _properties.emplace(o_name, std::make_tuple(PROP_VISIBILITY, isMutable, [](const Config& config) { \- return config.get<OPT_TYPE>(); \- })); \- } \- } while (0)--/**- * @brief Macro for registering properties which need a custom return function- *- * This macro offers the same functionality as TRY_REGISTER_SIMPLE_PROPERTY (see its description for more)- * but with a custom callback function.- *- * @param OPT_NAME Class/type of the option (will fetch .name() from it)- * @param OPT_TYPE Type (template) of the option- * @param PROP_RETFUNC Custom lambda callback function for the resulting property- *- * @details- * @see TRY_REGISTER_SIMPLE_PROPERTY- */-#define TRY_REGISTER_CUSTOMFUNC_PROPERTY(OPT_NAME, OPT_TYPE, PROP_RETFUNC) \- do { \- std::string o_name = OPT_NAME.name(); \- if (_config.isAvailable(o_name)) { \- bool isPublic = _config.getOpt(o_name).isPublic(); \- ov::PropertyMutability isMutable = _config.getOpt(o_name).mutability(); \- if (_pType == PropertiesType::COMPILED_MODEL) { \- isMutable = ov::PropertyMutability::RO; \- } \- _properties.emplace(o_name, std::make_tuple(isPublic, isMutable, PROP_RETFUNC)); \- } \- } while (0)--/**- * @brief Macro for registering a fully custom property, with option entry validation- *- * This macro offers the flexibility of registering a fully custom property where all its parameters- * are user provided: visibility (public/private), mutability and callback function- *- * @param OPT_NAME Class/type of the option (will fetch .name() from it)- * @param OPT_TYPE Type (template) of the option- * @param PROP_VISIBILITY Visibility (true=public, false=private) of the resulting property- * @param PROP_MUTABILITY Mutability (RO/RW) of the resulting property- * @param PROP_RETFUNC Custom lambda callback function for the resulting property- *- * @details- * - It first checks if the option was registered in the global config. Options not present in the global config- * are not supported in the current configuration and were previously filtered out on plugin level.- * - A new entry is added to the properties table with the user provided parameters (visibility,mutability,callback)- * without any further checks and validations- *- * @note This macro does not offer any compiled-model specific checks, such as- * if the config options this property maps to has actual value, nor it enforces RO, like previous macros.- */-#define TRY_REGISTER_CUSTOM_PROPERTY(OPT_NAME, OPT_TYPE, PROP_VISIBILITY, PROP_MUTABILITY, PROP_RETFUNC) \- do { \- std::string o_name = OPT_NAME.name(); \- if (_config.isAvailable(o_name)) { \- _properties.emplace(o_name, std::make_tuple(PROP_VISIBILITY, PROP_MUTABILITY, PROP_RETFUNC)); \- } \- } while (0)--/**- * @brief Macro for force registering a fully custom property (no option entry validation.- *- * Same as TRY_REGISTER_CUSTOM_PROPERTY but without any checks. It will force register the property.- *- * @param OPT_NAME Class/type of the option (will fetch .name() from it)- * @param OPT_TYPE Type (template) of the option- * @param PROP_VISIBILITY Visibility (true=public, false=private) of the resulting property- * @param PROP_MUTABILITY Mutability (RO/RW) of the resulting property- * @param PROP_RETFUNC Custom lambda callback function for the resulting property- *- * @details- * - A new entry is added to the properties table with the user provided parameters (visibility,mutability,callback)- * without any checks and validations- *- * @note This macro does not offer any compiled-model specific checks, such as- * if the config options this property maps to has actual value, nor it enforces RO, like previous macros.- */-#define FORCE_REGISTER_CUSTOM_PROPERTY(OPT_NAME, OPT_TYPE, PROP_VISIBILITY, PROP_MUTABILITY, PROP_RETFUNC) \- do { \- _properties.emplace(OPT_NAME.name(), std::make_tuple(PROP_VISIBILITY, PROP_MUTABILITY, PROP_RETFUNC)); \- } while (0)--/**- * @brief Macro for defining properties which have simple single value returning metrics- *- * The key differentiator for Metrics (from configs) is that they don't have an entry in the config map, nor an- * OptionBase descriptor. Metrics are static, Read-Only properties returning fixed characteristics of the device, plugin- * or environment. Since they don't have an entry in the config map, nor an optionBase descriptor, their callback- * function returns custom data.- *- * @param PROP_NAME Class/type of the property (will fetch .name() from it)- * @param PROP_VISIBILITY Visibility (true=public, false=private) of the resulting property- * @param PROP_RETVAL Value for the callback function to return- *- * @details- * - A new entry is added to the properties table with the user provided parameters (visibility,mutability,callback val)- * without any checks and validations- *- * @note This macro does not offer any compiled-model specific checks- */-#define REGISTER_SIMPLE_METRIC(PROP_NAME, PROP_VISIBILITY, PROP_RETVAL) \- do { \- _properties.emplace( \- PROP_NAME.name(), \- std::make_tuple(PROP_VISIBILITY, ov::PropertyMutability::RO, [&](const Config& config) -> auto { \- return PROP_RETVAL; \- })); \- } while (0)--/**- * @brief Macro for defining metric properties with full callback lambda functions- *- * The difference from REGISTER_SIMPLE_METRIC is that here we can define the whole callback lambdafunction, not just the- * return value- *- * @param PROP_NAME Class/type of the property (will fetch .name() from it)- * @param PROP_VISIBILITY Visibility (true=public, false=private) of the resulting property- * @param PROP_RETFUNC Callback lambda function of the resulting property- *- * @details- * - A new entry is added to the properties table with the user provided parameters (visibility,mutability,callback- * func) without any checks and validations- *- * @note This macro does not offer any compiled-model specific checks- */-// Macro for defining metrics with custom return function-#define REGISTER_CUSTOM_METRIC(PROP_NAME, PROP_VISIBILITY, PROP_RETFUNC) \- do { \- _properties.emplace(PROP_NAME.name(), \- std::make_tuple(PROP_VISIBILITY, ov::PropertyMutability::RO, PROP_RETFUNC)); \- } while (0)--Properties::Properties(const PropertiesType pType,- const FilteredConfig& config,- const std::shared_ptr<Metrics>& metrics,- const ov::SoPtr<IEngineBackend>& backend)- : _pType(pType),- _config(config),- _metrics(metrics),- _backend(backend),- _logger("Properties", _config.get<LOG_LEVEL>()) {- registerProperties();-}--Properties::Properties(const Properties& other)- : Properties([&other]() {- std::lock_guard<std::mutex> lock(other._mutex);- return CopyState{other._pType,- other._config,- other._metrics,- other._backend,- other._logger,- other._currentlyUsedCompiler,- other._currentlyUsedPlatform,- other._compilerConfigsFilteredByCompiler,- other._compatibilityCheckFiltered,- other._properties,- other._supportedProperties};- }()) {}--Properties::Properties(CopyState&& state)- : _pType(state.pType),- _config(std::move(state.config)),- _metrics(std::move(state.metrics)),- _backend(std::move(state.backend)),- _logger(std::move(state.logger)),- _currentlyUsedCompiler(state.currentlyUsedCompiler),- _currentlyUsedPlatform(std::move(state.currentlyUsedPlatform)),- _compilerConfigsFilteredByCompiler(state.compilerConfigsFilteredByCompiler),- _compatibilityCheckFiltered(state.compatibilityCheckFiltered),- _properties(std::move(state.properties)),- _supportedProperties(std::move(state.supportedProperties)) {}--void Properties::registerProperties() {- // Reset- _properties.clear();- _supportedProperties.clear();-- switch (_pType) {- case PropertiesType::PLUGIN:- registerPluginProperties();- break;- case PropertiesType::COMPILED_MODEL:- registerCompiledModelProperties();- break;- default:- OPENVINO_THROW("Invalid plugin configuration!");- break;- }-- // 2.3. Common metrics (exposed same way by both Plugin and CompiledModel)- REGISTER_SIMPLE_METRIC(ov::supported_properties, true, _supportedProperties);-- // 3. Populate supported properties list- // ========- for (auto& property : _properties) {- if (std::get<0>(property.second)) {- _supportedProperties.emplace_back(ov::PropertyName(property.first, std::get<1>(property.second)));- }- }-}--void Properties::registerPluginProperties() {- // 1. Configs- // ========- // 1.1 simple configs which only return value- // TRY_REGISTER_SIMPLE_PROPERTY format: (property, config_to_return)- // TRY_REGISTER_VARPUB_PROPERTY format: (property, config_to_return, dynamic public/private value)- // TRY_REGISTER_CUSTOMFUNC_PROPERTY format: (property, custom_return_lambda_function)- // TRY_REGISTER_CUSTOM_PROPERTY format: (property, visibility, mutability, custom_return_lambda_function)- // FORCE_REGISTER_CUSTOM_PROPERTY format: (property, visibility, mutability, custom_return_lambda_function)- TRY_REGISTER_SIMPLE_PROPERTY(ov::enable_profiling, PERF_COUNT);- TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::performance_mode, PERFORMANCE_HINT);- TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::execution_mode, EXECUTION_MODE_HINT);- TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::num_requests, PERFORMANCE_HINT_NUM_REQUESTS);- TRY_REGISTER_SIMPLE_PROPERTY(ov::compilation_num_threads, COMPILATION_NUM_THREADS);- TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::inference_precision, INFERENCE_PRECISION_HINT);- TRY_REGISTER_SIMPLE_PROPERTY(ov::log::level, LOG_LEVEL);- TRY_REGISTER_SIMPLE_PROPERTY(ov::cache_dir, CACHE_DIR);- TRY_REGISTER_SIMPLE_PROPERTY(ov::cache_mode, CACHE_MODE);- TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::compiled_blob, COMPILED_BLOB);- TRY_REGISTER_SIMPLE_PROPERTY(ov::device::id, DEVICE_ID);- TRY_REGISTER_SIMPLE_PROPERTY(ov::num_streams, NUM_STREAMS);- TRY_REGISTER_SIMPLE_PROPERTY(ov::weights_path, WEIGHTS_PATH);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::compilation_mode_params, COMPILATION_MODE_PARAMS);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::dma_engines, DMA_ENGINES);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::tiles, TILES);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::compilation_mode, COMPILATION_MODE);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::compiler_type, COMPILER_TYPE);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::platform, PLATFORM);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::create_executor, CREATE_EXECUTOR);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::dynamic_shape_to_static, DYNAMIC_SHAPE_TO_STATIC);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::profiling_type, PROFILING_TYPE);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::backend_compilation_params, BACKEND_COMPILATION_PARAMS);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::batch_mode, BATCH_MODE);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::turbo, TURBO);- TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::model_priority, MODEL_PRIORITY);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::bypass_umd_caching, BYPASS_UMD_CACHING);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::defer_weights_load, DEFER_WEIGHTS_LOAD);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::compiler_dynamic_quantization, COMPILER_DYNAMIC_QUANTIZATION);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::qdq_optimization, QDQ_OPTIMIZATION);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::qdq_optimization_aggressive, QDQ_OPTIMIZATION_AGGRESSIVE);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::disable_version_check, DISABLE_VERSION_CHECK);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::export_raw_blob, EXPORT_RAW_BLOB);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::import_raw_blob, IMPORT_RAW_BLOB);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::batch_compiler_mode_settings, BATCH_COMPILER_MODE_SETTINGS);- OPENVINO_SUPPRESS_DEPRECATED_START- TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::enable_cpu_pinning, ENABLE_CPU_PINNING);- OPENVINO_SUPPRESS_DEPRECATED_END- TRY_REGISTER_SIMPLE_PROPERTY(ov::workload_type, WORKLOAD_TYPE);- TRY_REGISTER_SIMPLE_PROPERTY(ov::enable_weightless, ENABLE_WEIGHTLESS);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::separate_weights_version, SEPARATE_WEIGHTS_VERSION);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::model_serializer_version, MODEL_SERIALIZER_VERSION);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::enable_strides_for, ENABLE_STRIDES_FOR);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::disable_idle_memory_prunning, DISABLE_IDLE_MEMORY_PRUNING);- TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::shared_common_queue, SHARED_COMMON_QUEUE);-- TRY_REGISTER_CUSTOMFUNC_PROPERTY(ov::intel_npu::stepping, STEPPING, [&](const Config& config) {- if (!config.has<STEPPING>()) {- try {- const auto specifiedDeviceName = get_specified_device_name(config);- return static_cast<int64_t>(_metrics->GetSteppingNumber(specifiedDeviceName));- } catch (...) {- _logger.warning("Metrics GetSteppingNumber failed to get value from device.");- }- }- return config.get<STEPPING>();- });- TRY_REGISTER_CUSTOMFUNC_PROPERTY(ov::intel_npu::max_tiles, MAX_TILES, [&](const Config& config) {- if (!config.has<MAX_TILES>()) {- try {- const auto specifiedDeviceName = get_specified_device_name(config);- return static_cast<int64_t>(_metrics->GetMaxTiles(specifiedDeviceName));- } catch (...) {- _logger.warning("Metrics GetMaxTiles failed to get value from device.");- }- }- return config.get<MAX_TILES>();- });-- TRY_REGISTER_VARPUB_PROPERTY(ov::intel_npu::run_inferences_sequentially, RUN_INFERENCES_SEQUENTIALLY, [&] {- if (_backend && _backend->getInitStructs()) {- if (_backend->getInitStructs()->getCommandQueueDdiTable().version() >= ZE_MAKE_VERSION(1, 1)) {- return true;- }- }- return false;- }());- TRY_REGISTER_CUSTOM_PROPERTY(ov::compatibility_check,- COMPATIBILITY_CHECK,- true,- ov::PropertyMutability::RO,- [](const Config& /* unusedConfig */) {- // This property is implemented in the plugin directly- // This implementation here serves only to publish it in supported_properties- return false;- });-- TRY_REGISTER_CUSTOM_PROPERTY(- ov::cache_encryption_callbacks,- CACHE_ENCRYPTION_CALLBACKS,- true,- ov::PropertyMutability::WO,- [](const Config& /* unusedConfig */) {- return (ov::EncryptionCallbacks{- nullptr,- nullptr}); // enclosed in parentheses due to warning C4002 treated as error: too many arguments for- // function-like macro invocation 'TRY_REGISTER_CUSTOM_PROPERTY'- });-- FORCE_REGISTER_CUSTOM_PROPERTY(ov::hint::model,- MODEL_PTR,- true,- ov::PropertyMutability::RO,- [](const Config& /* unusedConfig */) {- return std::shared_ptr<const ov::Model>(nullptr);- });-- // NPUW properties are requested by OV Core during caching and have no effect on the NPU plugin. But we still need- // to enable those for OV Core to query.- for_each_exposed_npuw_option([&](auto tag) {- using Opt = typename decltype(tag)::type;- TRY_REGISTER_NPUW_OPTION_PROPERTY(Opt);- });-- // 2. Metrics (static device and enviroment properties)- // ========- // REGISTER_SIMPLE_METRIC format: (property, public true/false, return value)- // REGISTER_CUSTOM_METRIC format: (property, public true/false, return value function)- if (_metrics != nullptr) {- REGISTER_SIMPLE_METRIC(ov::available_devices, true, _metrics->GetAvailableDevicesNames());- REGISTER_SIMPLE_METRIC(ov::device::capabilities, true, _metrics->GetOptimizationCapabilities());- REGISTER_SIMPLE_METRIC(ov::optimal_number_of_infer_requests,- true,- utils::getOptimalNumberOfInferRequestsInParallel(- utils::getCompilationPlatform(- config.get<PLATFORM>(),- _backend == nullptr ? config.get<DEVICE_ID>()- : _backend->getDevice(config.get<DEVICE_ID>())->getName(),- _backend == nullptr ? std::vector<std::string>() : _backend->getDeviceNames()),- config.get<PERFORMANCE_HINT>()));- REGISTER_SIMPLE_METRIC(ov::range_for_async_infer_requests, true, _metrics->GetRangeForAsyncInferRequest());- REGISTER_SIMPLE_METRIC(ov::range_for_streams, true, _metrics->GetRangeForStreams());- REGISTER_SIMPLE_METRIC(ov::device::pci_info, true, _metrics->GetPciInfo(get_specified_device_name(config)));- REGISTER_SIMPLE_METRIC(ov::device::gops, true, _metrics->GetGops(get_specified_device_name(config)));- REGISTER_SIMPLE_METRIC(ov::device::type, true, _metrics->GetDeviceType(get_specified_device_name(config)));- REGISTER_CUSTOM_METRIC(ov::internal::supported_properties,- false,- [&](const Config&) -> const std::vector<ov::PropertyName>& {- return _internalSupportedProperties;- });- REGISTER_SIMPLE_METRIC(ov::internal::cache_header_alignment, false, utils::STANDARD_PAGE_SIZE);- REGISTER_SIMPLE_METRIC(ov::intel_npu::device_alloc_mem_size,- true,- _metrics->GetDeviceAllocMemSize(get_specified_device_name(config)));- REGISTER_SIMPLE_METRIC(ov::intel_npu::device_total_mem_size,- true,- _metrics->GetDeviceTotalMemSize(get_specified_device_name(config)));- REGISTER_SIMPLE_METRIC(ov::intel_npu::driver_version, true, _metrics->GetDriverVersion());- REGISTER_SIMPLE_METRIC(ov::intel_npu::backend_name, false, _metrics->GetBackendName());- REGISTER_CUSTOM_METRIC(ov::device::architecture,- !_metrics->GetAvailableDevicesNames().empty(),- [&](const Config& config) {- const auto specifiedDeviceName = get_specified_device_name(config);- return _metrics->GetDeviceArchitecture(specifiedDeviceName);- });- REGISTER_CUSTOM_METRIC(ov::device::full_name,- !_metrics->GetAvailableDevicesNames().empty(),- [&](const Config& config) {- const auto specifiedDeviceName = get_specified_device_name(config);- return _metrics->GetFullDeviceName(specifiedDeviceName);- });- REGISTER_CUSTOM_METRIC(ov::device::luid,- _backend == nullptr ? false : _backend->isLUIDExtSupported(),- [&](const Config& config) {- const auto specifiedDeviceName = get_specified_device_name(config);- return _metrics->GetDeviceLUID(specifiedDeviceName);- });- REGISTER_CUSTOM_METRIC(ov::device::uuid, true, [&](const Config& config) {- const auto specifiedDeviceName = get_specified_device_name(config);- auto devUuid = _metrics->GetDeviceUuid(specifiedDeviceName);- return decltype(ov::device::uuid)::value_type{devUuid};- });- REGISTER_CUSTOM_METRIC(ov::execution_devices, true, [&](const Config& config) {- if (_metrics->GetAvailableDevicesNames().size() > 1) {- return std::string("NPU." + config.get<DEVICE_ID>());- } else {- return std::string("NPU");- }- });- REGISTER_CUSTOM_METRIC(ov::intel_npu::compiler_version, true, [&](const Config& config) {- /// create dummy compiler- 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 ? std::move(deviceId) : device->getName(),- _backend == nullptr ? std::vector<std::string>() : _backend->getDeviceNames());-- CompilerAdapterFactory factory;- auto dummyCompiler = factory.getCompiler(_backend, compilerType, compilationPlatform);-- return dummyCompiler->get_version();- });- REGISTER_CUSTOM_METRIC(ov::internal::caching_properties, false, [&](const Config& config) {- // return a dynamically created list based on what is supported in current configuration- std::vector<ov::PropertyName> caching_props{};- // walk the static caching properties, add only what is supported now- for (auto prop : _cachingProperties) {- if (_config.isAvailable(prop)) {- caching_props.emplace_back(prop);- }- }- // NPUW properties are requested by OV Core during caching and have no effect on the NPU plugin. But we- // still need to enable those for OV Core to query. add all NPUW properties- for (auto prop : _cachingProperties) {- if (prop.find("NPUW") != prop.npos) {- caching_props.emplace_back(prop);- }- }- return caching_props;- });- }-}--void Properties::registerCompiledModelProperties() {- // 1. Configs- // ========- // 1.1 simple configs which only return value- // TRY_REGISTER_SIMPLE_PROPERTY format: (property, config_to_return)- // TRY_REGISTER_VARPUB_PROPERTY format: (property, config_to_return, dynamic public/private value)- // TRY_REGISTER_CUSTOMFUNC_PROPERTY format: (property, custom_return_lambda_function)- // TRY_REGISTER_CUSTOM_PROPERTY format: (property, visibility, mutability, custom_return_lambda_function)- // FORCE_REGISTER_CUSTOM_PROPERTY format: (property, visibility, mutability, custom_return_lambda_function)-- // Permanent properties- OPENVINO_SUPPRESS_DEPRECATED_START- TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::enable_cpu_pinning, ENABLE_CPU_PINNING);- OPENVINO_SUPPRESS_DEPRECATED_END- TRY_REGISTER_SIMPLE_PROPERTY(ov::log::level, LOG_LEVEL);- TRY_REGISTER_SIMPLE_PROPERTY(ov::loaded_from_cache, LOADED_FROM_CACHE);- TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::performance_mode, PERFORMANCE_HINT);- TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::execution_mode, EXECUTION_MODE_HINT);- TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::num_requests, PERFORMANCE_HINT_NUM_REQUESTS);- TRY_REGISTER_SIMPLE_PROPERTY(ov::compilation_num_threads, COMPILATION_NUM_THREADS);- TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::inference_precision, INFERENCE_PRECISION_HINT);- TRY_REGISTER_SIMPLE_PROPERTY(ov::cache_mode, CACHE_MODE);-- // Properties we shall only enable if they were set prior-to-compilation- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::num_streams, NUM_STREAMS);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::compiler_type, COMPILER_TYPE);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::compiler_version, COMPILER_VERSION);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::weights_path, WEIGHTS_PATH);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::cache_dir, CACHE_DIR);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::enable_profiling, PERF_COUNT);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::profiling_type, PROFILING_TYPE);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::turbo, TURBO);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::compilation_mode_params, COMPILATION_MODE_PARAMS);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::dma_engines, DMA_ENGINES);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::tiles, TILES);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::compilation_mode, COMPILATION_MODE);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::platform, PLATFORM);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::dynamic_shape_to_static, DYNAMIC_SHAPE_TO_STATIC);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::backend_compilation_params, BACKEND_COMPILATION_PARAMS);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::bypass_umd_caching, BYPASS_UMD_CACHING);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::defer_weights_load, DEFER_WEIGHTS_LOAD);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::compiler_dynamic_quantization,- COMPILER_DYNAMIC_QUANTIZATION);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::qdq_optimization, QDQ_OPTIMIZATION);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::qdq_optimization_aggressive, QDQ_OPTIMIZATION_AGGRESSIVE);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::disable_version_check, DISABLE_VERSION_CHECK);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::export_raw_blob, EXPORT_RAW_BLOB);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::import_raw_blob, IMPORT_RAW_BLOB);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::batch_compiler_mode_settings,- BATCH_COMPILER_MODE_SETTINGS);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::run_inferences_sequentially, RUN_INFERENCES_SEQUENTIALLY);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::enable_weightless, ENABLE_WEIGHTLESS);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::separate_weights_version, SEPARATE_WEIGHTS_VERSION);- TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::enable_strides_for, ENABLE_STRIDES_FOR);-- TRY_REGISTER_VARPUB_PROPERTY(ov::intel_npu::batch_mode, BATCH_MODE, false);- TRY_REGISTER_VARPUB_PROPERTY(ov::intel_npu::shared_common_queue, SHARED_COMMON_QUEUE, false);-- TRY_REGISTER_CUSTOM_PROPERTY(ov::hint::model_priority,- MODEL_PRIORITY,- true,- ov::PropertyMutability::RW,- [](const Config& config) {- return config.get<MODEL_PRIORITY>();- });-- TRY_REGISTER_CUSTOM_PROPERTY(ov::workload_type,- WORKLOAD_TYPE,- true,- ov::PropertyMutability::RW,- [](const Config& config) {- return config.get<WORKLOAD_TYPE>();- });-- TRY_REGISTER_CUSTOM_PROPERTY(- ov::cache_encryption_callbacks,- CACHE_ENCRYPTION_CALLBACKS,- true,- ov::PropertyMutability::WO,- [](const Config& /* unusedConfig */) {- return (ov::EncryptionCallbacks{- nullptr,- nullptr}); // enclosed in parentheses due to warning C4002 treated as error: too many arguments for- // function-like macro invocation 'TRY_REGISTER_CUSTOM_PROPERTY'- });-- FORCE_REGISTER_CUSTOM_PROPERTY(ov::hint::model,- MODEL_PTR,- true,- ov::PropertyMutability::RO,- [](const Config& /* unusedConfig */) {- return std::shared_ptr<const ov::Model>(nullptr);- });- TRY_REGISTER_CUSTOM_PROPERTY(ov::runtime_requirements,- RUNTIME_REQUIREMENTS,- true,- ov::PropertyMutability::RO,- [](const Config& /* unusedConfig */) {- // This property is implemented in compiled model directly- // This implementation here serves only to publish it in supported_properties- return std::string("");- });-- // 2. Metrics (static device and enviroment properties)- // ========- // REGISTER_SIMPLE_METRIC format: (property, public true/false, return value)- // REGISTER_CUSTOM_METRIC format: (property, public true/false, return value function)-- REGISTER_CUSTOM_METRIC(ov::model_name, true, [](const Config&) {- // TODO: log an error here as the code shouldn't have gotten here- // this property is implemented in compiled model directly- // this implementation here serves only to publish it in supported_properties- return std::string("invalid");- });- REGISTER_SIMPLE_METRIC(- ov::optimal_number_of_infer_requests,- true,- utils::getOptimalNumberOfInferRequestsInParallel(config.get<PLATFORM>(), config.get<PERFORMANCE_HINT>()));- REGISTER_CUSTOM_METRIC(ov::execution_devices, true, [](const Config&) {- // TODO: log an error here as the code shouldn't have gotten here- // this property is implemented in compiled model directly- // this implementation here serves only to publish it in supported_properties- return std::string("NPU");- });-}--ov::Any Properties::getProperty(const std::string& name) {- std::lock_guard<std::mutex> lock(_mutex);-- if (name == ov::hint::enable_cpu_pinning.name()) {- logCpuPinningDeprecationWarning(_logger);- }-- if (_pType == PropertiesType::PLUGIN) {- bool propertyIsCompilerConfig = false;- bool propertyIsRegistered = true;- // If the property is not registered, there is no point of checking the config.- if (!isPropertyRegistered(name)) {- propertyIsRegistered = false;- } else {- // Property is already registered but need to re-check if the CompilerTime config is still supported by the- // current compiler.- if (_config.hasOpt(name) && !isSpecialBothProperty(name)) {- auto opt = _config.getOpt(name);- if (opt.mode() != OptionMode::RunTime) {- propertyIsCompilerConfig = true;- }- }- }-- bool needToResetProperties = false;- if (name == ov::compatibility_check.name() || name == ov::supported_properties.name()) {- // Mark that properties need to be registered again if the internal config is updated- needToResetProperties = disable_compatibility_check_if_needed();- }- // 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>();- auto device = utils::getDeviceById(_backend, deviceId);-- auto compilationPlatform = utils::getCompilationPlatform(- _config.get<PLATFORM>(),- device == nullptr ? std::move(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) {- OPENVINO_THROW("Failed to create compiler for getting property ", name, " with error: ", ex.what());- }-- _logger.warning("Failed to create compiler for getting property %s with error: %s."- "Returning 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);-- _compilerConfigsFilteredByCompiler = true;- _currentlyUsedCompiler = compilerType;- _currentlyUsedPlatform = std::move(compilationPlatform);- needToResetProperties = true;- }- }-- if (needToResetProperties) {- // reset properties for the new options- registerProperties();- }- }-- auto&& configIterator = _properties.find(name);- if (configIterator != _properties.cend()) {- if (std::get<1>(configIterator->second) == ov::PropertyMutability::WO) {- _logger.warning("Trying to get WRITE-ONLY property: %s. Returning empty `ov::Any` object",- name.c_str()); // throw OV exception instead- return ov::Any();- }- return std::get<2>(configIterator->second)(_config);- }- try {- return _config.getInternal(name);- } catch (...) {- OPENVINO_THROW("Unsupported configuration key: ", name);- }-}--void Properties::setProperty(const ov::AnyMap& properties) {- std::lock_guard<std::mutex> lock(_mutex);-- if (properties.find(ov::log::level.name()) != properties.end()) {- _logger.setLevel(properties.at(ov::log::level.name()).as<ov::log::Level>());- }-- if (properties.find(ov::hint::enable_cpu_pinning.name()) != properties.end()) {- logCpuPinningDeprecationWarning(_logger);- }-- std::unique_ptr<ICompilerAdapter> compiler = nullptr;- if (_pType == PropertiesType::PLUGIN) {- bool propertyIsCompilerConfig = false;- bool propertyIsRegistered = true;- for (const auto& property : properties) {- if (!isPropertyRegistered(property.first)) {- propertyIsRegistered = false;- break;- }- // Special case for some both configs. Don't need to check compiler support for these Both properties.- const bool isNotSpecialBothProperty = !isSpecialBothProperty(property.first);- if (_config.hasOpt(property.first) && isNotSpecialBothProperty) {- auto opt = _config.getOpt(property.first);- if (opt.mode() != OptionMode::RunTime) {- propertyIsCompilerConfig = true;- break;- }- }- }-- // Check if one of the properties is compiler config which needs to return different values based on compiler- // and platform configuration- if (propertyIsCompilerConfig || !propertyIsRegistered) {- auto compilerType = determineCompilerType(properties);- auto deviceId = determineDeviceId(properties);- auto device = utils::getDeviceById(_backend, deviceId);-- auto compilationPlatform = utils::getCompilationPlatform(- determinePlatform(properties),- device == nullptr ? std::move(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;- compiler = factory.getCompiler(_backend, compilerType, compilationPlatform);-- if (!(_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 = std::move(compilationPlatform);- }- }- }-- std::map<std::string, std::string> cfgs_to_set;- ov::AnyMap special_cfgs_to_set;- for (auto&& value : properties) {- if (_properties.find(value.first) == _properties.end()) {- // property doesn't exist- // checking as internal now- if (compiler != nullptr) {- if (compiler->is_option_supported(value.first)) {- // if compiler reports it supported > registering as internal- _config.addOrUpdateInternal(value.first, value.second.as<std::string>());- } else {- OPENVINO_THROW("Unsupported configuration key: ", value.first);- }- } else {- OPENVINO_THROW("Unsupported configuration key: ", value.first);- }- } else {- if (std::get<1>(_properties[value.first]) == ov::PropertyMutability::RO) {- OPENVINO_THROW("READ-ONLY configuration key: ", value.first);- } else if (value.first == ov::cache_encryption_callbacks.name()) {- special_cfgs_to_set.emplace(value.first, value.second);- } else {- cfgs_to_set.emplace(value.first, value.second.as<std::string>());- }- }- }-- if (!cfgs_to_set.empty()) {- _config.update(cfgs_to_set);- }-- if (!special_cfgs_to_set.empty()) {- _config.updateAny(special_cfgs_to_set);- }-}--bool Properties::isPropertySupported(const std::string& name) {- std::lock_guard<std::mutex> lock(_mutex);- if (name == ov::hint::enable_cpu_pinning.name()) {- logCpuPinningDeprecationWarning(_logger);- }-- 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 (name == ov::compatibility_check.name()) {- bool disabled = disable_compatibility_check_if_needed();- if (disabled) {- registerProperties();- 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 ? std::move(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 = std::move(compilationPlatform);- }- }-- if (isPropertyRegistered(name)) {- return true;- }-- return false;-}--bool Properties::isPropertyRegistered(const std::string& propertyName) const {- return _properties.find(propertyName) != _properties.end();-}--FilteredConfig Properties::getConfigForSpecificCompiler(const ov::AnyMap& properties,- const ICompilerAdapter* compiler) {- auto [updatedConfig, compilerConfigsFilteredByCompiler, currentlyUsedCompiler, currentlyUsedPlatform, logger] =- [&]() {- std::lock_guard<std::mutex> lock(_mutex);- return std::make_tuple(_config,- _compilerConfigsFilteredByCompiler,- _currentlyUsedCompiler,- _currentlyUsedPlatform,- _logger);- }();-- if (properties.find(ov::hint::enable_cpu_pinning.name()) != properties.end()) {- logCpuPinningDeprecationWarning(logger);- }-- std::optional<ov::intel_npu::CompilerType> propertiesCompilerType = std::nullopt;- std::optional<std::string> propertiesPlatform = std::nullopt;- if (compilerConfigsFilteredByCompiler) {- auto compilerType = properties.find(ov::intel_npu::compiler_type.name());- if (compilerType != properties.end()) {- propertiesCompilerType = compilerType->second.as<ov::intel_npu::CompilerType>();- }- }- auto platform = properties.find(ov::intel_npu::platform.name());- if (platform != properties.end()) {- propertiesPlatform = platform->second.as<std::string>();- }-- // filter out unsupported options- if (!(compilerConfigsFilteredByCompiler &&- propertiesCompilerType.value_or(currentlyUsedCompiler) == currentlyUsedCompiler &&- propertiesPlatform.value_or(currentlyUsedPlatform) == currentlyUsedPlatform)) {- // In case the compiler properties are not initialized or the compiler/platform was changed since last call -- // filter out options again- filterPropertiesByCompilerSupport(updatedConfig, compiler, _backend, logger);- }-- const std::map<std::string, std::string> rawConfig = any_copy(properties);- std::map<std::string, std::string> cfgsToSet;- ov::AnyMap specialCfgsToSet;- for (const auto& [key, value] : rawConfig) {- if (!updatedConfig.hasOpt(key)) {- // not a known config key- if (!compiler->is_option_supported(key)) {- OPENVINO_THROW("[ NOT_FOUND ] Option '", key, "' is not supported for current configuration");- } else {- updatedConfig.addOrUpdateInternal(key, value);- }- } else if (key == ov::cache_encryption_callbacks.name()) {- specialCfgsToSet.emplace(key, properties.at(key));- } else {- cfgsToSet.emplace(key, value);- }- }-- updatedConfig.update(cfgsToSet);- updatedConfig.updateAny(specialCfgsToSet);-- return std::move(updatedConfig);-}--FilteredConfig Properties::getConfigWithCompilerPropertiesDisabled(const ov::AnyMap& properties) {- auto [updatedConfig, compilerConfigsFilteredByCompiler, logger] = [&]() {- std::lock_guard<std::mutex> lock(_mutex);- return std::make_tuple(_config, _compilerConfigsFilteredByCompiler, _logger);- }();-- if (compilerConfigsFilteredByCompiler) {- disableCompilerProperties(updatedConfig, _backend);- }-- if (properties.find(ov::hint::enable_cpu_pinning.name()) != properties.end()) {- logCpuPinningDeprecationWarning(logger);- }-- if (properties.empty()) {- return std::move(updatedConfig);- }-- const std::map<std::string, std::string> rawConfig = any_copy(properties);- std::map<std::string, std::string> cfgsToSet;- ov::AnyMap specialCfgsToSet;- for (const auto& [key, value] : rawConfig) {- if (updatedConfig.hasOpt(key)) {- const auto optionMode = updatedConfig.getOpt(key).mode();-- if (optionMode == OptionMode::CompileTime) {- logger.info(- "Config key '%s' is recognized as a compiler option, will not be used for current configuration.",- key.c_str());- continue;- }-- if (optionMode == OptionMode::Both && !updatedConfig.isAvailable(key)) {- logger.info("Config key '%s' is not enabled by the plugin, will not be used for current configuration.",- key.c_str());- continue;- }- }-- if (key == ov::cache_encryption_callbacks.name()) {- specialCfgsToSet.emplace(key, properties.at(key));- } else {- cfgsToSet.emplace(key, value);- }- }-- updatedConfig.update(cfgsToSet);- updatedConfig.updateAny(specialCfgsToSet);-- return std::move(updatedConfig);-}--ov::intel_npu::CompilerType Properties::determineCompilerType(const ov::AnyMap& properties) const {- // first look if provided config changes compiler type- auto it = properties.find(ov::intel_npu::compiler_type.name());- if (it != properties.end()) {- // if compiler_type is provided by local config = use that- return COMPILER_TYPE::parse(it->second.as<std::string>());- }- // if there is no compiler_type provided = use _config value- return _config.get<COMPILER_TYPE>();-}--std::string Properties::determinePlatform(const ov::AnyMap& properties) const {- auto platform = properties.find(ov::intel_npu::platform.name());- if (platform != properties.end()) {- return platform->second.as<std::string>();- }- return _config.get<PLATFORM>();-}--std::string Properties::determineDeviceId(const ov::AnyMap& properties) const {- auto device_id = properties.find(std::string(ov::device::id.name()));- if (device_id != properties.end()) {- return device_id->second.as<std::string>();- }- return _config.get<DEVICE_ID>();-}--bool Properties::disable_compatibility_check_if_needed() {- // COMPATIBILITY_CHECK is a RunTime option, thus enabled by default- // The property should be supported only if at least one of the compiler adapters support it.- // No need to check again if it was enabled already- // Plugin will prefer the validation to be performed through CID, but it will fallback- // to the CIP validation otherwise.-- if (_compatibilityCheckFiltered) {- // The property was already filtered by compiler support, no need to check again- return false;- }-- // Mark that the property has been filtered by compiler support, regardless of the result- _compatibilityCheckFiltered = true;-- CompilerAdapterFactory factory;- auto compilerType = ov::intel_npu::CompilerType::DRIVER;- try {- auto tempCompiler = factory.getCompiler(_backend, compilerType, std::string_view{});- // If CID is present but does not support the query, fallback to CIP- if (!tempCompiler->is_option_supported(ov::compatibility_check.name())) {- compilerType = ov::intel_npu::CompilerType::PLUGIN;- try {- tempCompiler = factory.getCompiler(_backend, compilerType, std::string_view{});- if (!tempCompiler->is_option_supported(ov::compatibility_check.name())) {- // Neither of the compiler adapters support the option, it should be disabled- _logger.debug("Neither CID nor CIP support the compatibility check! Disabling the property.");- _config.enable(ov::compatibility_check.name(), false);- return true; // config was updated- } else {- // CIP is present and supports the option, COMPATIBILITY_CHECK remains enabled- _compilerForCompatibilityCheck = ov::intel_npu::CompilerType::PLUGIN;- }- } catch (const std::exception&) {- // CIP is not present either, the property is not supported- _logger.debug("CIP is not present! Disabling the compatibility check property.");- _config.enable(ov::compatibility_check.name(), false);- return true; // config was updated- }- } else {- // COMPATIBILITY_CHECK remains enabled- _compilerForCompatibilityCheck = ov::intel_npu::CompilerType::DRIVER;- }- } catch (const std::exception&) {- // If CID is not present (driver is not present either) plugin will not be able to retrieve- // the device information required for the CIP check, thus the property should not be supported.- // No need to check the CIP support anymore in this case- _logger.debug("Driver is not present! Disabling the compatibility check property.");- _config.enable(ov::compatibility_check.name(), false);- return true; // config was updated- }-- return false; // config was not updated-}--ov::intel_npu::CompilerType Properties::determineCompilerTypeForCompatibilityCheck() const {- // The compiler type used for compatibility check is determined based on the support of- // the COMPATIBILITY_CHECK option in the compiler adapters. If the option is supported- // in CID, it will be preferred for compatibility check, otherwise CIP will be used- // if it supports the option.-- return _compilerForCompatibilityCheck;-}--} // namespace intel_npudiff --git a/src/plugins/intel_npu/tests/functional/CMakeLists.txt b/src/plugins/intel_npu/tests/functional/CMakeLists.txtindex 9341a4e5bcf..1b33742934a 100644--- a/src/plugins/intel_npu/tests/functional/CMakeLists.txt+++ b/src/plugins/intel_npu/tests/functional/CMakeLists.txt@@ -45,10 +45,11 @@ ov_add_test_target(OBJECT_FILES"${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/async_infer_request.cpp""${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/compiled_model.cpp"+ "${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/compiled_model_property_manager.cpp""${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/metadata.cpp"+ "${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/plugin_property_manager.cpp""${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/remote_context.cpp""${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/transformations.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""${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/executor.cpp"LINK_LIBRARIESdiff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.cpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.cppindex f3781431e0f..58ba7971eee 100644--- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.cpp+++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/compatibility_string.cpp@@ -2,15 +2,18 @@// SPDX-License-Identifier: Apache-2.0//-#include "common/npu_test_env_cfg.hpp"#include "compatibility_string.hpp"-using namespace ov::test::behavior;+#include "common/npu_test_env_cfg.hpp"-namespace {+using namespace ov::test::behavior;INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,ClassCompatibilityStringTestSuite,::testing::Values(ov::test::utils::DEVICE_NPU),ClassCompatibilityStringTestSuite::getTestCaseName);-} // namespace++INSTANTIATE_TEST_SUITE_P(compatibility_smoke_BehaviorCompatibilityFallbackTests,+ CompatibilityCheckFallbackTestSuite,+ ::testing::Values(ov::test::utils::DEVICE_NPU),+ CompatibilityCheckFallbackTestSuite::getTestCaseName);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.hppindex 2fc82bf5da1..cdd5d60cdd8 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@@ -8,23 +8,25 @@#include <gmock/gmock.h>#include <gtest/gtest.h>+#include <memory>+#include <mutex>#include <openvino/runtime/intel_npu/properties.hpp>#include "behavior/compiled_model/properties.hpp"#include "common/npu_test_env_cfg.hpp"+#include "common/utils.hpp"#include "common_test_utils/subgraph_builders/conv_pool_relu.hpp"+#include "intel_npu/utils/zero/zero_init.hpp"#include "openvino/pass/serialize.hpp"#include "shared_test_classes/base/ov_behavior_test_utils.hpp"-using namespace ov::test::behavior;namespace {// Tests specific for RUNTIME_REQUIREMENTS and COMPATIBILITY_CHECK properties-class ClassCompatibilityStringTestNPU- : public OVCompiledModelPropertiesBase,- public ::testing::WithParamInterface<std::string> {+class ClassCompatibilityStringTestNPU : public OVCompiledModelPropertiesBase,+ public ::testing::WithParamInterface<std::string> {protected:std::string deviceName;ov::Core core;@@ -66,8 +68,9 @@ TEST_P(ClassCompatibilityStringTestSuite, CompatibilityCheckIsSupported) {// Forcing CID as the current compiler typecore.set_property(deviceName, ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER));- // Test that COMPATIBILITY_CHECK is still present in supported properties when CID is used as the current compiler type- // Even if CID does not support the option, the property should be marked as supported since the plugin will fallback to CIP+ // Test that COMPATIBILITY_CHECK is still present in supported properties when CID is used as the current compiler+ // type Even if CID does not support the option, the property should be marked as supported since the plugin will+ // fallback to CIP{OV_ASSERT_NO_THROW(properties = core.get_property(deviceName, ov::supported_properties));auto it = find(properties.cbegin(), properties.cend(), ov::compatibility_check);@@ -82,11 +85,14 @@ TEST_P(ClassCompatibilityStringTestSuite, CompatibilityCheckInvalidArgument) {ASSERT_TRUE(result == ov::CompatibilityCheck::NOT_APPLICABLE);// Provide an argument without runtime_requirements- OV_ASSERT_NO_THROW(result = core.get_property(deviceName, ov::compatibility_check, ov::log::level(ov::log::Level::ERR)));+ OV_ASSERT_NO_THROW(result =+ core.get_property(deviceName, ov::compatibility_check, ov::log::level(ov::log::Level::ERR)));ASSERT_TRUE(result == ov::CompatibilityCheck::NOT_APPLICABLE);// An incorrect runtime_requirements argument should return UNSUPPORTED- OV_ASSERT_NO_THROW(result = core.get_property(deviceName, ov::compatibility_check, std::make_pair(ov::runtime_requirements.name(), "invalid_string")));+ OV_ASSERT_NO_THROW(result = core.get_property(deviceName,+ ov::compatibility_check,+ std::make_pair(ov::runtime_requirements.name(), "invalid_string")));ASSERT_TRUE(result == ov::CompatibilityCheck::UNSUPPORTED);}@@ -95,10 +101,11 @@ TEST_P(ClassCompatibilityStringTestSuite, RuntimeRequirementsIsSupported) {auto model = ov::test::utils::make_conv_pool_relu();ov::CompiledModel compiledModel;OV_ASSERT_NO_THROW(compiledModel = core.compile_model(- model, deviceName,- {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::PLUGIN),- ov::intel_npu::platform(ov::intel_npu::Platform::standardize(- ov::test::utils::getTestsPlatformFromEnvironmentOr(ov::test::utils::DEVICE_NPU)))}));+ model,+ deviceName,+ {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::PLUGIN),+ ov::intel_npu::platform(ov::intel_npu::Platform::standardize(+ ov::test::utils::getTestsPlatformFromEnvironmentOr(ov::test::utils::DEVICE_NPU)))}));std::vector<ov::PropertyName> properties;// Test that RUNTIME_REQUIREMENTS is supported for a model compiled with CIP@@ -110,7 +117,9 @@ TEST_P(ClassCompatibilityStringTestSuite, RuntimeRequirementsIsSupported) {}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_ASSERT_NO_THROW(+ compiledModel =+ core.compile_model(model, deviceName, ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER)));// Test that RUNTIME_REQUIREMENTS is not supported for a model compiled with CID// This check should be conditioned by the compiler/driver version once support is added in L0OV_ASSERT_NO_THROW(properties = compiledModel.get_property(ov::supported_properties));@@ -118,8 +127,9 @@ TEST_P(ClassCompatibilityStringTestSuite, RuntimeRequirementsIsSupported) {auto it = find(properties.cbegin(), properties.cend(), ov::runtime_requirements);ASSERT_TRUE(it == properties.cend());}- OV_EXPECT_THROW(auto requirements = compiledModel.get_property(ov::runtime_requirements), ov::Exception, testing::HasSubstr("Unsupported configuration key: RUNTIME_REQUIREMENTS"));-+ OV_EXPECT_THROW(auto requirements = compiledModel.get_property(ov::runtime_requirements),+ ov::Exception,+ testing::HasSubstr("Unsupported configuration key: RUNTIME_REQUIREMENTS"));}TEST_P(ClassCompatibilityStringTestSuite, RuntimeRequirementsIsNotSupportedForWS) {@@ -139,15 +149,18 @@ TEST_P(ClassCompatibilityStringTestSuite, RuntimeRequirementsIsNotSupportedForWSov::CompiledModel compiledModel;OV_ASSERT_NO_THROW(compiledModel = core.compile_model(- model, deviceName,- {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::PLUGIN),- ov::intel_npu::platform(ov::intel_npu::Platform::standardize(- ov::test::utils::getTestsPlatformFromEnvironmentOr(ov::test::utils::DEVICE_NPU))),- ov::enable_weightless(true)}));+ model,+ deviceName,+ {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::PLUGIN),+ ov::intel_npu::platform(ov::intel_npu::Platform::standardize(+ ov::test::utils::getTestsPlatformFromEnvironmentOr(ov::test::utils::DEVICE_NPU))),+ ov::enable_weightless(true)}));std::vector<ov::PropertyName> properties;// Test that RUNTIME_REQUIREMENTS is not supported for a weightless model- OV_EXPECT_THROW(auto requirements = compiledModel.get_property(ov::runtime_requirements), ov::Exception, testing::HasSubstr("Unsupported configuration key: RUNTIME_REQUIREMENTS"));+ OV_EXPECT_THROW(auto requirements = compiledModel.get_property(ov::runtime_requirements),+ ov::Exception,+ testing::HasSubstr("Unsupported configuration key: RUNTIME_REQUIREMENTS"));// Test that RUNTIME_REQUIREMENTS is not in the list of supported properties eitherOV_ASSERT_NO_THROW(properties = compiledModel.get_property(ov::supported_properties));@@ -160,10 +173,11 @@ TEST_P(ClassCompatibilityStringTestSuite, RuntimeRequirementsExportImport) {auto model = ov::test::utils::make_conv_pool_relu();ov::CompiledModel compiledModel;OV_ASSERT_NO_THROW(compiledModel = core.compile_model(- model, deviceName,- {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::PLUGIN),- ov::intel_npu::platform(ov::intel_npu::Platform::standardize(- ov::test::utils::getTestsPlatformFromEnvironmentOr(ov::test::utils::DEVICE_NPU)))}));+ model,+ deviceName,+ {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::PLUGIN),+ ov::intel_npu::platform(ov::intel_npu::Platform::standardize(+ ov::test::utils::getTestsPlatformFromEnvironmentOr(ov::test::utils::DEVICE_NPU)))}));std::string reference_requirements;OV_ASSERT_NO_THROW(reference_requirements = compiledModel.get_property(ov::runtime_requirements));@@ -191,16 +205,134 @@ TEST_P(ClassCompatibilityStringTestSuite, CompatibilityStringGenerateAndCheck) {auto model = ov::test::utils::make_conv_pool_relu();ov::CompiledModel compiledModel;OV_ASSERT_NO_THROW(compiledModel = core.compile_model(- model, deviceName,- {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::PLUGIN),- ov::intel_npu::platform(ov::intel_npu::Platform::standardize(- ov::test::utils::getTestsPlatformFromEnvironmentOr(ov::test::utils::DEVICE_NPU)))}));+ model,+ deviceName,+ {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::PLUGIN),+ ov::intel_npu::platform(ov::intel_npu::Platform::standardize(+ ov::test::utils::getTestsPlatformFromEnvironmentOr(ov::test::utils::DEVICE_NPU)))}));std::string requirements;OV_ASSERT_NO_THROW(requirements = compiledModel.get_property(ov::runtime_requirements));ov::CompatibilityCheck result = ov::CompatibilityCheck::NOT_APPLICABLE;- OV_ASSERT_NO_THROW(result = core.get_property(deviceName, ov::compatibility_check, std::make_pair(ov::runtime_requirements.name(), requirements)));+ OV_ASSERT_NO_THROW(result = core.get_property(deviceName,+ ov::compatibility_check,+ std::make_pair(ov::runtime_requirements.name(), requirements)));ASSERT_TRUE(result == ov::CompatibilityCheck::SUPPORTED);}+using CompatibilityCheckFallbackTestSuite = ClassCompatibilityStringTestNPU;++TEST_P(CompatibilityCheckFallbackTestSuite, CompatibilityCheckIsReadOnly) {+ std::string logs;+ std::mutex logs_mutex;+ ov::AnyMap compatibilityCheckProperty = {{ov::compatibility_check.name(), ov::Any(ov::AnyMap{})}};++ 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');+ };++ core.get_property(deviceName, ov::intel_npu::compiler_type); // initialize plugin with runtime property++ OV_ASSERT_NO_THROW(+ core.set_property(deviceName, ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER)));++ // Determine at runtime whether the driver version is sufficient to handle the+ // compatibility check without falling back to PluginCompilerAdapter.+ const auto initStructs = ::intel_npu::ZeroInitStructsHolder::getInstance();+ const bool driverHandlesCompatibilityCheck =+ initStructs != nullptr && initStructs->getZeDrvApiVersion() >= ZE_MAKE_VERSION(1, 16);++ auto original_level = core.get_property(deviceName, ov::log::level);+ OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::log::level(ov::log::Level::INFO)));+ {+ ov::test::utils::LogCallbackGuard log_callback_guard(log_cb);+ OV_EXPECT_THROW_HAS_SUBSTRING(core.set_property(deviceName, compatibilityCheckProperty),+ ov::Exception,+ "READ-ONLY");+ }+ OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::log::level(original_level)));++ ASSERT_EQ(logs.find("initialize DriverCompilerAdapter start"), std::string::npos);++ if (driverHandlesCompatibilityCheck) {+ ASSERT_EQ(logs.find("initialize PluginCompilerAdapter start"), std::string::npos);+ } else {+ ASSERT_NE(logs.find("initialize PluginCompilerAdapter start"), std::string::npos);+ }+}++TEST_P(CompatibilityCheckFallbackTestSuite, CompatibilityCheckUsesPluginCompilerFallbackForOlderDriver) {+ std::string logs;+ std::mutex logs_mutex;++ 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_ASSERT_NO_THROW(+ core.set_property(deviceName, ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER)));++ // Determine at runtime whether the driver version is sufficient to handle the+ // compatibility check without falling back to PluginCompilerAdapter.+ const auto initStructs = ::intel_npu::ZeroInitStructsHolder::getInstance();+ const bool driverHandlesCompatibilityCheck =+ initStructs != nullptr && initStructs->getZeDrvApiVersion() >= ZE_MAKE_VERSION(1, 16);++ auto original_level = core.get_property(deviceName, ov::log::level);+ OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::log::level(ov::log::Level::INFO)));+ {+ ov::test::utils::LogCallbackGuard log_callback_guard(log_cb);+ OV_ASSERT_NO_THROW((void)core.get_property(deviceName, ov::compatibility_check));+ }+ OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::log::level(original_level)));++ ASSERT_EQ(logs.find("initialize DriverCompilerAdapter start"), std::string::npos);++ if (driverHandlesCompatibilityCheck) {+ ASSERT_EQ(logs.find("initialize PluginCompilerAdapter start"), std::string::npos);+ } else {+ ASSERT_NE(logs.find("initialize PluginCompilerAdapter start"), std::string::npos);+ }+}++TEST_P(CompatibilityCheckFallbackTestSuite, CompatibilityCheckSupportedPropertiesLoadsPluginCompiler) {+ std::string logs;+ std::mutex logs_mutex;++ 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_ASSERT_NO_THROW(+ core.set_property(deviceName, ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER)));++ // Determine at runtime whether the driver version is sufficient to handle the+ // compatibility check without falling back to PluginCompilerAdapter.+ const auto initStructs = ::intel_npu::ZeroInitStructsHolder::getInstance();+ const bool driverHandlesCompatibilityCheck =+ initStructs != nullptr && initStructs->getZeDrvApiVersion() >= ZE_MAKE_VERSION(1, 16);++ auto original_level = core.get_property(deviceName, ov::log::level);+ OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::log::level(ov::log::Level::INFO)));+ {+ ov::test::utils::LogCallbackGuard log_callback_guard(log_cb);+ auto supported_props = core.get_property(deviceName, ov::supported_properties);+ auto it = std::find(supported_props.begin(), supported_props.end(), ov::compatibility_check.name());+ ASSERT_NE(it, supported_props.end());+ }+ OV_ASSERT_NO_THROW(core.set_property(deviceName, ov::log::level(original_level)));++ if (driverHandlesCompatibilityCheck) {+ ASSERT_EQ(logs.find("initialize PluginCompilerAdapter start"), std::string::npos);+ } else {+ ASSERT_NE(logs.find("initialize PluginCompilerAdapter start"), std::string::npos);+ }+}+} // namespacediff --git a/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.cpp b/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.cppindex 47cea7f6765..0fe58f6735b 100644--- a/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.cpp+++ b/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.cpp@@ -12,8 +12,7 @@ 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> supported_compiler_configs = {{ov::intel_npu::qdq_optimization.name()}};const std::vector<std::string> unsupported_compiler_configs = {{"DUMMY_PROPERTY"}};INSTANTIATE_TEST_SUITE_P(compatibility_smoke_BehaviorTest,@@ -22,6 +21,12 @@ INSTANTIATE_TEST_SUITE_P(compatibility_smoke_BehaviorTest,::testing::ValuesIn(supported_configs)),PropertiesManagerTests::getTestCaseName);+INSTANTIATE_TEST_SUITE_P(compatibility_smoke_BehaviorTest,+ CompatibilityCheckTests,+ ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_NPU),+ ::testing::Values(std::string{})),+ PropertiesManagerTests::getTestCaseName);+INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTest,ExpectLoadingCompilerPropertySupported,::testing::Combine(::testing::Values(ov::test::utils::DEVICE_NPU),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.hppindex c3e0afc72f0..d34a86af42c 100644--- a/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.hpp+++ b/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.hpp@@ -30,7 +30,7 @@#include "openvino/core/log.hpp"#include "openvino/runtime/core.hpp"#include "openvino/runtime/intel_npu/properties.hpp"-#include "properties.hpp"+#include "plugin_property_manager.hpp"#include "shared_test_classes/base/ov_behavior_test_utils.hpp"#include "zero_backend.hpp"@@ -49,7 +49,7 @@ 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::unique_ptr<::intel_npu::PluginPropertyManager> propertiesManager;std::string configuration;std::string targetDevice;@@ -181,7 +181,8 @@ public:}}- propertiesManager = std::make_unique<Properties>(PropertiesType::PLUGIN, npu_config, metrics, backend);+ propertiesManager =+ std::make_unique<PluginPropertyManager>(npu_config, metrics, backend, ::intel_npu::Logger::global());}void TearDown() override {@@ -214,7 +215,9 @@ TEST_P(PropertiesManagerTests, ExpectRunTimeSpecialBothPropertyIsSupported) {ASSERT_TRUE(isSupported);}-TEST_P(PropertiesManagerTests, ExpectArgumentIsNotSupported) {+using CompatibilityCheckTests = PropertiesManagerTests;++TEST_P(CompatibilityCheckTests, ExpectArgumentIsNotSupported) {std::string logs;std::mutex logs_mutex;bool isSupported = true;@@ -246,6 +249,81 @@ TEST_P(PropertiesManagerTests, ExpectArgumentIsNotSupported) {ASSERT_EQ(logs.find("initialize PluginCompilerAdapter start"), std::string::npos);}+TEST_P(CompatibilityCheckTests, CompatibilityCheckUsesPluginCompilerAdapterOnlyWhenDriverVersionIsInsufficient) {+ std::string logs;+ std::mutex logs_mutex;++ // 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');+ };++ // Determine at runtime whether the driver version is sufficient to handle the+ // compatibility check without falling back to PluginCompilerAdapter.+ const auto initStructs = backend ? backend->getInitStructs() : nullptr;+ const bool driverHandlesCompatibilityCheck =+ initStructs != nullptr && initStructs->getZeDrvApiVersion() >= ZE_MAKE_VERSION(1, 16);++ bool isSupported = false;+ {+ utils::LogCallbackGuard log_callback_guard(log_cb);+ utils::LoggerLevelGuard logger_level_guard(ov::log::Level::INFO);+ isSupported = propertiesManager->isPropertySupported(ov::compatibility_check.name());+ }++ if (driverHandlesCompatibilityCheck) {+ // Driver version >= 1.16: Property must be reported as supported.+ ASSERT_EQ(logs.find("initialize PluginCompilerAdapter complete"), std::string::npos);+ ASSERT_EQ(logs.find("initialize DriverCompilerAdapter start"), std::string::npos);+ ASSERT_TRUE(isSupported);+ } else {+ if (logs.find("initialize PluginCompilerAdapter complete") == std::string::npos) {+ // Driver version < 1.16: Because CiP can not be loaded on this path in CI, the property must be reported as+ // unsupported.+ ASSERT_EQ(logs.find("initialize DriverCompilerAdapter start"), std::string::npos);+ ASSERT_FALSE(isSupported);+ } else {+ // Driver version < 1.16: Because CiP can be loaded on this path in CI, the property must be reported as+ // supported.+ ASSERT_EQ(logs.find("initialize DriverCompilerAdapter start"), std::string::npos);+ ASSERT_TRUE(isSupported);+ }+ }+}++TEST_P(CompatibilityCheckTests, ExpectTurboPropertyAndCompatibilityCheckAreSupported) {+ std::string logs;+ std::mutex logs_mutex;+ bool turboSupported = 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');+ };++ const bool turboSupportedByDevice = backend && backend->isCommandQueueExtSupported();++ {+ utils::LogCallbackGuard log_callback_guard(log_cb);+ utils::LoggerLevelGuard logger_level_guard(ov::log::Level::INFO);+ propertiesManager->setProperty({{ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER)}});+ turboSupported = propertiesManager->isPropertySupported(ov::intel_npu::turbo.name());+ }++ if (turboSupportedByDevice) {+ // Turbo is supported by device, so checking support must not trigger compiler adapters.+ ASSERT_EQ(logs.find("initialize DriverCompilerAdapter start"), std::string::npos);+ ASSERT_TRUE(turboSupported);+ } else {+ ASSERT_NE(logs.find("initialize DriverCompilerAdapter start"), std::string::npos);+ ASSERT_FALSE(turboSupported);+ }+}+using ExpectLoadingCompilerPropertySupported = PropertiesManagerTests;TEST_P(ExpectLoadingCompilerPropertySupported, ExpectCompilerPropertyIsSupported) {