From beef6c02b919ecb19439fbb1bd5bd9192b8ce5b0 Mon Sep 17 00:00:00 2001 From: Dmitry Matveev Date: Thu, 30 May 2024 15:57:44 +0000 Subject: [PATCH] NPU: Fix the NPU<-->NPUW parameter bypass --- .../intel_npu/src/plugin/npuw/compiled_model.cpp | 15 +++++++++++++-- src/plugins/intel_npu/src/plugin/npuw/config.cpp | 14 +++----------- src/plugins/intel_npu/src/plugin/npuw/config.hpp | 3 +-- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp b/src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp index 300cdd21222f58..a04361a9dea6bf 100644 --- a/src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp +++ b/src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp @@ -36,12 +36,23 @@ namespace { ov::npuw::DeviceProperties get_properties_per_device(const std::shared_ptr& plugin, const std::string& device_priorities, const ov::AnyMap& properties) { + auto core = plugin->get_core(); auto device_names = ov::DeviceIDParser::get_hetero_devices(device_priorities); DeviceProperties device_properties; for (const auto& device_name : device_names) { auto properties_it = device_properties.find(device_name); - if (device_properties.end() == properties_it) - device_properties[device_name] = plugin->get_core()->get_supported_property(device_name, properties); + if (device_properties.end() == properties_it) { + device_properties[device_name] = core->get_supported_property(device_name, properties); + + // Do extra handling for the private NPU options + if (ov::npuw::util::starts_with(device_name, "NPU")) { + for (auto &&opt : properties) { + if (ov::npuw::util::starts_with(opt.first, "NPU")) { + device_properties[device_name][opt.first] = opt.second; + } + } + } // if(NPU) + } } return device_properties; } diff --git a/src/plugins/intel_npu/src/plugin/npuw/config.cpp b/src/plugins/intel_npu/src/plugin/npuw/config.cpp index 6c4e166f1d2199..c4e35cbb5f843b 100644 --- a/src/plugins/intel_npu/src/plugin/npuw/config.cpp +++ b/src/plugins/intel_npu/src/plugin/npuw/config.cpp @@ -20,7 +20,7 @@ const char* ov::npuw::get_env(const std::vector &list_to_try, Configuration::Configuration() : dump_graph(false) {} -Configuration::Configuration(const ov::AnyMap& config, const Configuration& defaultCfg, bool throwOnUnsupported) { +Configuration::Configuration(const ov::AnyMap& config, const Configuration& defaultCfg) { OPENVINO_SUPPRESS_DEPRECATED_START *this = defaultCfg; @@ -28,15 +28,10 @@ Configuration::Configuration(const ov::AnyMap& config, const Configuration& defa const auto& key = it.first; const auto& value = it.second; - // if (NPUW_CONFIG_KEY(DUMP_GRAPH_DOT) == key) { - // dump_graph = value.as(); - // } else - if (ov::device::priorities == key) { + if (ov::device::priorities == key) { // Use priorities to override the default order only device_priorities = value.as(); } else { - if (throwOnUnsupported) - OPENVINO_THROW("Property was not found: ", key); device_properties.emplace(key, value); } } @@ -45,10 +40,7 @@ Configuration::Configuration(const ov::AnyMap& config, const Configuration& defa ov::Any Configuration::get(const std::string& name) const { OPENVINO_SUPPRESS_DEPRECATED_START - // if (name == NPUW_CONFIG_KEY(DUMP_GRAPH_DOT)) { - // return {dump_graph}; - // } else - if (name == ov::device::priorities) { + if (name == ov::device::priorities) { return {device_priorities}; } else { OPENVINO_THROW("Property was not found: ", name); diff --git a/src/plugins/intel_npu/src/plugin/npuw/config.hpp b/src/plugins/intel_npu/src/plugin/npuw/config.hpp index b8b94a845bdb95..8325286a5eac46 100644 --- a/src/plugins/intel_npu/src/plugin/npuw/config.hpp +++ b/src/plugins/intel_npu/src/plugin/npuw/config.hpp @@ -24,8 +24,7 @@ struct Configuration { Configuration& operator=(Configuration&&) = default; explicit Configuration(const ov::AnyMap& config, - const Configuration& defaultCfg = {}, - bool throwOnUnsupported = false); + const Configuration& defaultCfg = {}); ov::Any get(const std::string& name) const;