Skip to content

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

[NPU] Update docs with info about runtime_requirements and compatibility_check (#36795)

Alexandru Enache347b31c3c9ef
diff --git a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rst b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rst
index bffa77e503e..ae343efd16e 100644
--- a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rst
+++ b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rst
@@ -170,6 +170,8 @@ The NPU device is currently supported by AUTO inference modes
ov::range_for_streams
ov::num_streams
ov::execution_devices
+ ov::runtime_requirements
+ ov::compatibility_check
ov::device::architecture
ov::device::capabilities
ov::device::full_name
@@ -378,6 +380,32 @@ or
compiled_model.export_model(custom_encrypted_blob_stream);
+**ov::runtime_requirements**
+
+This property returns a plugin-specific requirements string from a compiled model.
+
+.. code-block::
+
+ auto requirements = compiled_model.get_property(ov::runtime_requirements);
+
+.. note::
+
+ Particular models might not support the ``ov::runtime_requirements`` property. For example,
+ models compiled with a driver (compiler-in-driver) that does not support Level Zero
+ version 1.16, or models compiled with ``ENABLE_WEIGHTLESS=true``, which is only a
+ preview feature for now. Before reading the property, the application is recommended
+ to check whether it is present in the list of supported properties for that model.
+ Reading an unsupported property will throw.
+
+**ov::compatibility_check**
+
+This property can be queried with a requirements string to check whether
+the described model is compatible with the current runtime.
+
+.. code-block::
+
+ auto compat = core.get_property("NPU", ov::compatibility_check, {{ov::runtime_requirements.name(), requirements}});
+
Limitations
#############################
diff --git a/src/inference/include/openvino/runtime/properties.hpp b/src/inference/include/openvino/runtime/properties.hpp
index 7467e350ff3..5727fbd6252 100644
--- a/src/inference/include/openvino/runtime/properties.hpp
+++ b/src/inference/include/openvino/runtime/properties.hpp
@@ -1520,8 +1520,7 @@ inline constexpr Property<std::string, PropertyMutability::RO> runtime_requireme
* auto compiled_model = core.compile_model(model, "NPU");
* auto requirements = compiled_model.get_property(ov::runtime_requirements);
* auto compat = core.get_property("NPU", ov::compatibility_check, {{ov::runtime_requirements.name(), requirements}});
- * if (compat == ov::CompatibilityCheck::OPTIMAL ||
- * compat == ov::CompatibilityCheck::PREFER_RECOMPILATION) {
+ * if (compat == ov::CompatibilityCheck::SUPPORTED) {
* auto imported = core.import_model(blob_stream, "NPU");
* }
* @endcode
diff --git a/src/plugins/intel_npu/README.md b/src/plugins/intel_npu/README.md
index c910aad6a0b..2aae5baa24f 100644
--- a/src/plugins/intel_npu/README.md
+++ b/src/plugins/intel_npu/README.md
@@ -191,6 +191,8 @@ The following properties are supported (may differ based on current system confi
| `ov::caching_properties`/</br>`CACHING_PROPERTIES` | RW | Returns a list of all properties that are used by OpenVINO cache to build the hash key. | `N/A` | `N/A` |
| `ov::compilation_num_threads`/</br>`COMPILATION_NUM_THREADS` | RW | Maximum number of threads that can be used for compilation tasks. | `N/A` | `N/A` |
| `ov::num_streams`/</br>`NUM_STREAMS` | RW | Sets the per-executor stream/thread limit. Executor layout depends on mode: `AUTO` uses only the task executor; `0` runs `start_async` on the caller thread, uses a single wait executor thread, and disables the callback executor; explicit positive values use separate executors for start, wait, and callback stages, each configured with `num_streams` threads. | `AUTO/`</br>`INT` | `AUTO` |
+| `ov::runtime_requirements`/</br>`RUNTIME_REQUIREMENTS` | RO | Returns a string containing the runtime requirements of the compiled model. The string can be used with `ov::compatibility_check` to check compatibility before import.</br>Throws if no requirements are available for the compiled model (for example weightless models, or Level Zero drivers older than 1.16). | `N/A` | `N/A` |
+| `ov::compatibility_check`/</br>`COMPATIBILITY_CHECK` | RO | Checks whether the current runtime is compatible with a compiled model, using a requirements string passed through `ov::runtime_requirements`. | `SUPPORTED`/</br>`UNSUPPORTED`/</br>`NOT_APPLICABLE` | `NOT_APPLICABLE` |
| `ov::optimal_number_of_infer_requests`/</br>`OPTIMAL_NUMBER_OF_INFER_REQUESTS` | RO | Returns the optimal number of inference requests to be used by the application. Depends on the platform version and on ov::hint::performance_mode. Please see the table below. | `N/A` | `N/A` |
| `ov::range_for_async_infer_requests`/</br>`RANGE_FOR_ASYNC_INFER_REQUESTS` | RO | Returns a tuple (bottom, top, step). </br> Not used by the NPU plugin. | `N/A` | `N/A` |
| `ov::range_for_streams`/</br>`RANGE_FOR_STREAMS` | RO | Returns a tuple (bottom, top).</br> Not used by the NPU plugin. | `N/A`| `N/A` |
@@ -332,6 +334,22 @@ Setting extra properties during offline compilation may result in compiled model
Example: Setting ``performance-hint-override=latency`` through ``ov::intel_npu::compilation_mode_params`` instructs the compiler to use all available resources for the given platform. If ``ov::intel_npu::max_tiles`` is not provided, the compiler falls back to a fixed lookup table embedded in the library to determine available resources, which might not be representative of all SKUs.
<br>
+### ov::runtime_requirements and ov::compatibility_check
+
+A string containing plugin-specific runtime requirements can be retrieved from a compiled model using the ``ov::runtime_requirements`` property:
+```
+ auto requirements = compiled_model.get_property(ov::runtime_requirements);
+```
+This string can later be used before import to check the compatibility of the described model with the current runtime:
+```
+ auto compat = core.get_property("NPU", ov::compatibility_check, {{ov::runtime_requirements.name(), requirements}});
+```
+
+> Note: `ov::runtime_requirements` is not available for every compiled model. Querying it throws for models without runtime requirements (for example weightless models, or Level Zero drivers older than 1.16); `ov::compatibility_check` returns `NOT_APPLICABLE` in those cases. Before reading the property, the application is recommended to check whether it is present in the model's list of supported properties.
+
+Developers and contributors can find more details on how the plugin handles this data internally (the compile, export, and import flow) in [Runtime Requirements and Compatibility Check](./docs/runtime-requirements.md).
+<br>
+
## Stateful models
Key ingredients to support stateful models which distinguish them from other models are:
diff --git a/src/plugins/intel_npu/docs/runtime-requirements.md b/src/plugins/intel_npu/docs/runtime-requirements.md
new file mode 100644
index 00000000000..bcc685ad3e5
--- /dev/null
+++ b/src/plugins/intel_npu/docs/runtime-requirements.md
@@ -0,0 +1,67 @@
+# NPU Runtime Requirements and Compatibility Check
+
+This document describes the internal data flow behind the `ov::runtime_requirements`
+and `ov::compatibility_check` properties across compilation, export, and import in the Intel NPU plugin.
+
+For the user-facing description, supported values, and usage examples of these properties, see the
+Supported Properties table in the [NPU plugin README](../README.md#supported-properties).
+
+## Overview
+
+- The compiler produces a compatibility descriptor for the generated blob.
+- The plugin stores that descriptor in the graph object attached to the compiled model.
+- When the user calls `compiled_model.get_property(ov::runtime_requirements)`, the plugin embeds that compiler-generated descriptor in its human-readable metadata string and returns it as the complete runtime requirements at the plugin level.
+- During `export_model(...)`, the raw descriptor is written into NPU metadata.
+- During `import_model(...)`, the raw descriptor is restored from metadata as an owning `std::string` passed to the parser (before the metadata object is discarded), attached to the parsed graph, and later exposed again through `ov::runtime_requirements`.
+
+## Sequence
+
+```mermaid
+sequenceDiagram
+ autonumber
+ actor User as OV User
+ participant Plugin as NPU Plugin
+ participant Adapter as Compiler Adapter
+ participant Compiler as Compiler
+ participant Graph as IGraph / Graph
+ participant PM as PropertyManager
+ participant Meta as NPU Metadata
+
+ User->>Plugin: compile_model(model, "NPU", config)
+ Plugin->>Adapter: compile(model, config)
+ Adapter->>Compiler: obtain blob + compatibility descriptor
+ Note over Adapter,Compiler: CIP: VCLCompilerImpl::compile()<br/>CID: driver builds graph,<br/> then zeDeviceGetRuntimeRequirements()
+ Compiler-->>Adapter: blob + compatibilityDescriptor
+ Adapter->>Graph: construct Graph(..., compatibilityDescriptor)
+ Adapter-->>Plugin: compiled graph (stores descriptor)
+ Plugin-->>User: ov::CompiledModel
+
+ User->>Plugin: get_property(ov::runtime_requirements)
+ Plugin->>PM: getProperty("RUNTIME_REQUIREMENTS")
+ PM->>Graph: get_compatibility_descriptor()
+ Graph-->>PM: raw compatibilityDescriptor
+ PM->>Meta: Metadata(..., descriptor).write_as_text()
+ Meta-->>PM: human-readable requirements string
+ PM-->>User: requirements string
+
+ User->>Plugin: export_model(stream)
+ Plugin->>Graph: export_blob() + get_compatibility_descriptor()
+ Graph-->>Plugin: blob bytes + compatibilityDescriptor
+ Plugin->>Meta: Metadata(..., descriptor).write(stream)
+ Meta-->>User: stream = blob + metadata payload
+
+ User->>Plugin: import_model(stream)
+ Plugin->>Meta: read_metadata_from(stream)
+ Meta-->>Plugin: blobSize + compatibilityDescriptor
+ Plugin->>Graph: parse(blob, descriptor), construct restored Graph
+ Plugin-->>User: imported ov::CompiledModel
+```
+
+## Main Code Paths
+
+- Descriptor-to-property generation: `compiled_model_property_manager.cpp`, `buildRuntimeRequirements(...)`
+- Compiler-in-plugin descriptor fetch: `plugin_compiler_adapter.cpp`, `VCLCompilerImpl::compile(...)`
+- Compiler-in-driver descriptor fetch: `driver_compiler_adapter.cpp`, `ze_graph_ext_wrappers.cpp`
+- Graph storage: `graph.cpp`
+- Export metadata write: `compiled_model.cpp`, `metadata.cpp`
+- Import metadata read and graph reconstruction: `plugin.cpp`, `parser.cpp`, `metadata.cpp`