Skip to content

[OVEP] Fix for appropriate device not selected #696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: ovep-develop
Choose a base branch
from
Open
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
19 changes: 6 additions & 13 deletions onnxruntime/core/providers/openvino/openvino_provider_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ std::string ParseDeviceType(std::shared_ptr<OVCore> ov_core, const ProviderOptio
luid_list = split(luid_str, ',');
}

bool all_devices_found = true;

for (auto device : devices_to_check) {
bool device_found = false;
// Check deprecated device format (CPU_FP32, GPU.0_FP16, etc.) and remove the suffix in place
Expand All @@ -137,6 +135,9 @@ std::string ParseDeviceType(std::shared_ptr<OVCore> ov_core, const ProviderOptio
// Here we need to find the full device name (with .idx, but without _precision)
if (std::find(std::begin(available_devices), std::end(available_devices), device) != std::end(available_devices))
device_found = true;
if (!device_found) {
ORT_THROW("[ERROR] [OpenVINO] Device ", device, " is not available");
}
if (device_prefix != "CPU" && luid_list.size() > 0) {
for (const auto& dev : available_devices) {
ov::device::LUID ov_luid = OVCore::Get()->core.get_property(dev, ov::device::luid);
Expand All @@ -149,7 +150,6 @@ std::string ParseDeviceType(std::shared_ptr<OVCore> ov_core, const ProviderOptio
ORT_THROW(msg);
}
}
all_devices_found = all_devices_found && device_found;
}
if (luid_list.size() > 0) {
std::string ov_luid_devices;
Expand Down Expand Up @@ -180,16 +180,9 @@ std::string ParseDeviceType(std::shared_ptr<OVCore> ov_core, const ProviderOptio
selected_device = std::move(ov_luid_devices);
}
}
// If invalid device is chosen error is thrown
if (!all_devices_found) {
ORT_THROW(
"[ERROR] [OpenVINO] You have selected wrong configuration value for the key 'device_type'. "
"Select from 'CPU', 'GPU', 'NPU', 'GPU.x' where x = 0,1,2 and so on or from"
" HETERO/MULTI/AUTO/BATCH options available. \n");
} else {
LOGS_DEFAULT(INFO) << "[OpenVINO-EP] Choosing Device: " << selected_device;
return selected_device;
}

LOGS_DEFAULT(INFO) << "[OpenVINO-EP] Choosing Device: " << selected_device;
return selected_device;
}

void ParseProviderOptions([[maybe_unused]] ProviderInfo& result, [[maybe_unused]] const ProviderOptions& config_options) {}
Expand Down
Loading