| 22 | namespace { |
| 23 | |
| 24 | Status PickDeviceHelper(bool allow_mixing_unknown_and_cpu, |
| 25 | absl::Span<const absl::string_view> device_names, |
| 26 | string* result) { |
| 27 | jit::DeviceInfoCache cache; |
| 28 | jit::DeviceSet device_set; |
| 29 | for (absl::string_view name : device_names) { |
| 30 | TF_ASSIGN_OR_RETURN(jit::DeviceId device_id, cache.GetIdFor(name)); |
| 31 | device_set.Insert(device_id); |
| 32 | } |
| 33 | |
| 34 | TF_ASSIGN_OR_RETURN( |
| 35 | jit::DeviceId result_id, |
| 36 | PickDeviceForXla(cache, device_set, allow_mixing_unknown_and_cpu)); |
| 37 | *result = string(cache.GetNameFor(result_id)); |
| 38 | return Status::OK(); |
| 39 | } |
| 40 | |
| 41 | void CheckPickDeviceResult(absl::string_view expected_result, |
| 42 | bool allow_mixing_unknown_and_cpu, |
no test coverage detected