Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 5 additions & 26 deletions onnxruntime/core/providers/openvino/backends/basic_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -274,31 +274,14 @@ void BasicBackend::PopulateConfigValue(ov::AnyMap& device_config) {
return devices;
};

// Check if a property is supported and mutable
auto is_supported_and_mutable = [&](const std::string& key,
const std::vector<ov::PropertyName>& supported_config) -> bool {
auto it = std::find_if(supported_config.begin(), supported_config.end(), [&](const ov::PropertyName& property) {
return property == key && property.is_mutable();
});
return it != supported_config.end();
};

// Set properties if they are valid, else log a warning if the property is missing or immutable by skipping the same
auto set_target_properties = [&](const std::string& device, const ov::AnyMap& config_options,
const std::vector<ov::PropertyName>& supported_properties) {
// Set properties, Validation will be handled by OpenVINO Core
auto set_target_properties = [&](const std::string& device, const ov::AnyMap& config_options) {
for (const auto& [key, value] : config_options) {
if ((key.find("NPUW") != std::string::npos) ||
((device_config.find(key) != device_config.end()) && session_context_.enable_causallm)) {
continue;
}
if (is_supported_and_mutable(key, supported_properties)) {
OVCore::Get()->core.set_property(device, ov::AnyMap{{key, value}});
} else {
LOGS_DEFAULT(WARNING) << "WARNING: Property \"" << key
<< "\" is either unsupported in current OpenVINO version"
<< " or property is immutable for target device \""
<< device << "\". Skipping setting this property.";
}
OVCore::Get()->core.set_property(device, ov::AnyMap{{key, value}});
}
};

Expand All @@ -317,18 +300,14 @@ void BasicBackend::PopulateConfigValue(ov::AnyMap& device_config) {
// Set properties only for individual devices (e.g., "CPU", "GPU")
for (const std::string& device : individual_devices) {
if (target_config.count(device)) {
// Get supported properties for each individual device
auto device_properties = OVCore::Get()->core.get_property(device, ov::supported_properties);
// Set properties for the device
set_target_properties(device, target_config.at(device), device_properties);
set_target_properties(device, target_config.at(device));
}
}
} else {
if (target_config.count(session_context_.device_type)) {
auto supported_properties = OVCore::Get()->core.get_property(session_context_.device_type,
ov::supported_properties);
set_target_properties(session_context_.device_type,
target_config.at(session_context_.device_type), supported_properties);
target_config.at(session_context_.device_type));
}
}
}
Expand Down
8 changes: 0 additions & 8 deletions onnxruntime/core/providers/openvino/ov_versions/data_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -469,15 +469,7 @@ void DataOps::populate_op_mode_supported() {
}
}

// check for input dimensions
const auto& x_arg = node->InputDefs()[0];
auto shape = x_arg->Shape();
if (shape != nullptr) {
// input tensor rank cannot be of one dimension
if (shape->dim_size() == 1 || shape->dim_size() == 4) {
return true;
}
}
// x_arg supports only float, int8 and float16 type
if ((x_arg->TypeAsProto()->tensor_type().elem_type() ==
ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_FLOAT) ||
Expand Down
Loading