Skip to content

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

[NPU] Registering a new config option that will be used for enabling the new model serializer (#32303)

Razvan Apetroaie80e587bccec1
diff --git a/src/plugins/intel_npu/src/al/include/intel_npu/config/options.hpp b/src/plugins/intel_npu/src/al/include/intel_npu/config/options.hpp
index 68966c98ff5..1976b3ebfbc 100644
--- a/src/plugins/intel_npu/src/al/include/intel_npu/config/options.hpp
+++ b/src/plugins/intel_npu/src/al/include/intel_npu/config/options.hpp
@@ -1411,4 +1411,18 @@ struct WS_COMPILE_CALL_NUMBER final : OptionBase<WS_COMPILE_CALL_NUMBER, uint32_
}
};
+struct USE_BASE_MODEL_SERIALIZER final : OptionBase<USE_BASE_MODEL_SERIALIZER, bool> {
+ static std::string_view key() {
+ return ov::intel_npu::use_base_model_serializer.name();
+ }
+
+ static bool defaultValue() {
+ return true;
+ }
+
+ static OptionMode mode() {
+ return OptionMode::CompileTime;
+ }
+};
+
} // namespace intel_npu
diff --git a/src/plugins/intel_npu/src/al/include/intel_npu/npu_private_properties.hpp b/src/plugins/intel_npu/src/al/include/intel_npu/npu_private_properties.hpp
index 24da138b51f..c485af1e0a3 100644
--- a/src/plugins/intel_npu/src/al/include/intel_npu/npu_private_properties.hpp
+++ b/src/plugins/intel_npu/src/al/include/intel_npu/npu_private_properties.hpp
@@ -348,6 +348,21 @@ static constexpr ov::Property<WSVersion> separate_weights_version{"NPU_SEPARATE_
*/
static constexpr ov::Property<bool> weightless_blob{"NPU_WEIGHTLESS_BLOB"};
+/**
+ * @brief [Only for NPU Plugin]
+ * Type: bool. Default is "true".
+ *
+ * This config option concerns the algorithm used for serializing the "ov::Model" at compilation time in order to be
+ * passed through the driver.
+ *
+ * The base serializer is the OV implementation of the "XmlSerializer" without any extensions. All weights are copied in
+ * a separate buffer. By turning this off, the NPU extension of the serializer is enabled. This allows optimizing the
+ * process by avoiding copies into a separate weights buffer. However, this solution may be less reliable.
+ *
+ * @note This option doesn't actually do anything right now, it has been registered in advance.
+ */
+static constexpr ov::Property<bool> use_base_model_serializer{"NPU_USE_BASE_MODEL_SERIALIZER"};
+
/**
* @brief [Experimental, only for NPU Plugin]
* Type: integer.
diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
index 6b81e5c8c0a..a40740e5e9c 100644
--- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
@@ -298,6 +298,7 @@ void Plugin::init_options() {
REGISTER_OPTION(WEIGHTLESS_BLOB);
REGISTER_OPTION(SEPARATE_WEIGHTS_VERSION);
REGISTER_OPTION(WS_COMPILE_CALL_NUMBER);
+ REGISTER_OPTION(USE_BASE_MODEL_SERIALIZER);
if (_backend) {
if (_backend->isCommandQueueExtSupported()) {
diff --git a/src/plugins/intel_npu/src/plugin/src/properties.cpp b/src/plugins/intel_npu/src/plugin/src/properties.cpp
index a17a6a26e9b..661adbb471d 100644
--- a/src/plugins/intel_npu/src/plugin/src/properties.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/properties.cpp
@@ -382,6 +382,7 @@ void Properties::registerPluginProperties() {
TRY_REGISTER_SIMPLE_PROPERTY(ov::workload_type, WORKLOAD_TYPE);
TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::weightless_blob, WEIGHTLESS_BLOB);
TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::separate_weights_version, SEPARATE_WEIGHTS_VERSION);
+ TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::use_base_model_serializer, USE_BASE_MODEL_SERIALIZER);
TRY_REGISTER_CUSTOMFUNC_PROPERTY(ov::intel_npu::stepping, STEPPING, [&](const Config& config) {
if (!config.has<STEPPING>()) {