Skip to content

Commit

Permalink
Merge pull request openvinotoolkit#51 from dmatveev/dm/npuw_fix_params
Browse files Browse the repository at this point in the history
NPU: Fix the NPU<-->NPUW parameter bypass
  • Loading branch information
dmatveev authored May 30, 2024
2 parents 85239d4 + beef6c0 commit 559c77b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
15 changes: 13 additions & 2 deletions src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,23 @@ namespace {
ov::npuw::DeviceProperties get_properties_per_device(const std::shared_ptr<const ov::IPlugin>& 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;
}
Expand Down
14 changes: 3 additions & 11 deletions src/plugins/intel_npu/src/plugin/npuw/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,18 @@ const char* ov::npuw::get_env(const std::vector<std::string> &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;

for (const auto& it : config) {
const auto& key = it.first;
const auto& value = it.second;

// if (NPUW_CONFIG_KEY(DUMP_GRAPH_DOT) == key) {
// dump_graph = value.as<bool>();
// } else
if (ov::device::priorities == key) {
if (ov::device::priorities == key) {
// Use priorities to override the default order only
device_priorities = value.as<std::string>();
} else {
if (throwOnUnsupported)
OPENVINO_THROW("Property was not found: ", key);
device_properties.emplace(key, value);
}
}
Expand All @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/intel_npu/src/plugin/npuw/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 559c77b

Please sign in to comment.