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] Add internal support for ENABLE_WEIGHTLESS (#34460)
Patrik Stepan2cb21e7c0b5a
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.hppindex 52741f598db..3592e69a97d 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@@ -1357,6 +1357,20 @@ struct BATCH_COMPILER_MODE_SETTINGS final : OptionBase<BATCH_COMPILER_MODE_SETTI}};+struct ENABLE_WEIGHTLESS final : OptionBase<ENABLE_WEIGHTLESS, bool> {+ static std::string_view key() {+ return ov::enable_weightless.name();+ }++ static bool defaultValue() {+ return false;+ }++ static OptionMode mode() {+ return OptionMode::CompileTime;+ }+};+struct WEIGHTLESS_BLOB final : OptionBase<WEIGHTLESS_BLOB, bool> {static std::string_view key() {return ov::intel_npu::weightless_blob.name();diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cppindex a475d47c7c7..4941de072a1 100644--- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp+++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp@@ -262,6 +262,9 @@ void init_config(const IEngineBackend* backend, OptionsDesc& options, FilteredCoREGISTER_OPTION(IMPORT_RAW_BLOB);REGISTER_OPTION(BATCH_COMPILER_MODE_SETTINGS);REGISTER_OPTION(TURBO);+ REGISTER_OPTION(ENABLE_WEIGHTLESS);+ // WEIGHTLESS_BLOB can be removed once+ // NPU Compilers support ENABLE_WEIGHTLESSREGISTER_OPTION(WEIGHTLESS_BLOB);REGISTER_OPTION(SEPARATE_WEIGHTS_VERSION);REGISTER_OPTION(WS_COMPILE_CALL_NUMBER);@@ -646,7 +649,7 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<std::shared_ptr<intel_npu::IGraph> graph;auto compileWithConfig = [&](auto&& modelToCompile, const auto& config) {- if (!localConfig.get<WEIGHTLESS_BLOB>()) {+ if (!localConfig.get<WEIGHTLESS_BLOB>() && !localConfig.get<ENABLE_WEIGHTLESS>() ) {return compiler->compile(modelToCompile, config);} else {check_weightless_cache_attribute_occurrence(model);diff --git a/src/plugins/intel_npu/src/plugin/src/properties.cpp b/src/plugins/intel_npu/src/plugin/src/properties.cppindex a7d7a0ddb70..ee386035802 100644--- a/src/plugins/intel_npu/src/plugin/src/properties.cpp+++ b/src/plugins/intel_npu/src/plugin/src/properties.cpp@@ -520,6 +520,7 @@ void Properties::registerPluginProperties() {TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::batch_compiler_mode_settings, BATCH_COMPILER_MODE_SETTINGS);TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::enable_cpu_pinning, ENABLE_CPU_PINNING);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::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);@@ -788,6 +789,7 @@ void Properties::registerCompiledModelProperties() {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::weightless_blob, WEIGHTLESS_BLOB);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);