Skip to content

Commit

Permalink
Use device duck typing for empty device lists
Browse files Browse the repository at this point in the history
We are soon going to require all IFRT users to use `Client::MakeDeviceList()` to create a device list instead of calling `BasicDeviceList::Create()`. `PyDeviceList(nb::tuple py_device_assignment)` with an empty device assignment cannot infer the IFRT client to use, so it seems the simplest to fall back to device duck typing like we already do for device lists with devices from multiple clients.

PiperOrigin-RevId: 726233342
  • Loading branch information
junwhanahn authored and Google-ML-Automation committed Feb 13, 2025
1 parent 1c73e14 commit c36995b
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion xla/python/py_device_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ PyDeviceList::PyDeviceList(nb::tuple py_device_assignment)
: device_list_(py_device_assignment) {
// Attempt to convert to Python devices into `ifrt::DeviceList`.
if (py_device_assignment.size() == 0) {
device_list_ = xla::ifrt::BasicDeviceList::Create({});
return;
}
absl::InlinedVector<xla::ifrt::Device*, 1> devices;
Expand Down

0 comments on commit c36995b

Please sign in to comment.