@@ -76,7 +76,7 @@ std::string ParseDeviceType(std::shared_ptr<OVCore> ov_core, const ProviderOptio
7676 if (supported_device_modes.contains (device_mode)) {
7777 const auto & devices = selected_device.substr (delimit + 1 );
7878 devices_to_check = split (devices, ' ,' );
79- ORT_ENFORCE (devices_to_check.size () > 0 , " Modes should have devices listed based on priority" );
79+ ORT_ENFORCE (devices_to_check.size () > 0 , " Mode AUTO/HETERO/MULTI should have devices listed based on priority" );
8080 } else {
8181 ORT_THROW (" [ERROR] [OpenVINO] Invalid device_type is selected. Supported modes are AUTO/HETERO/MULTI" );
8282 }
@@ -153,16 +153,24 @@ std::string ParseDeviceType(std::shared_ptr<OVCore> ov_core, const ProviderOptio
153153 std::string ov_luid_devices;
154154 for (auto luid_str : luid_list) {
155155 if (ov_luid_map.contains (luid_str)) {
156- if (!ov_luid_devices.empty ()) ov_luid_devices = ov_luid_devices + " ," ;
157- ov_luid_devices = ov_luid_devices + ov_luid_map.at (luid_str);
156+ std::string ov_dev = ov_luid_map.at (luid_str);
157+ std::string ov_dev_strip = split (ov_dev, ' .' )[0 ];
158+ if (std::find (std::begin (devices_to_check), std::end (devices_to_check), ov_dev) != std::end (devices_to_check) ||
159+ std::find (std::begin (devices_to_check), std::end (devices_to_check), ov_dev_strip) != std::end (devices_to_check)) {
160+ if (!ov_luid_devices.empty ()) ov_luid_devices = ov_luid_devices + " ," ;
161+ ov_luid_devices = ov_luid_devices + ov_dev;
162+ } else {
163+ ORT_THROW (" LUID : " , ov_dev, " does not match with device_type : " , selected_device);
164+ }
158165 } else {
159- ORT_THROW (" Invalid device_luid is set " );
166+ ORT_THROW (" Invalid device_luid is passed. Kindly verify that the device type and LUID corresponds to the same HW " );
160167 }
161168 }
162169 if (!device_mode.empty ()) {
163170 selected_device = device_mode + " :" + ov_luid_devices;
164171 for (auto dev_str : devices_to_check) {
165172 auto default_dev = split (dev_str, ' .' )[0 ];
173+
166174 if (ov_luid_devices.find (default_dev) == std::string::npos)
167175 selected_device = selected_device + " ," + dev_str;
168176 }
@@ -171,13 +179,15 @@ std::string ParseDeviceType(std::shared_ptr<OVCore> ov_core, const ProviderOptio
171179 }
172180 }
173181 // If invalid device is chosen error is thrown
174- if (!all_devices_found)
182+ if (!all_devices_found) {
175183 ORT_THROW (
176184 " [ERROR] [OpenVINO] You have selected wrong configuration value for the key 'device_type'. "
177185 " Select from 'CPU', 'GPU', 'NPU', 'GPU.x' where x = 0,1,2 and so on or from"
178186 " HETERO/MULTI/AUTO/BATCH options available. \n " );
179- else
187+ } else {
188+ LOGS_DEFAULT (INFO) << " [OpenVINO-EP] Choosing Device: " << selected_device;
180189 return selected_device;
190+ }
181191}
182192
183193void ParseProviderOptions ([[maybe_unused]] ProviderInfo& result, [[maybe_unused]] const ProviderOptions& config_options) {}
0 commit comments