Skip to content
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

[IFRT] Add Client::GetAllDevices() #17728

Merged
merged 1 commit into from
Oct 5, 2024
Merged

[IFRT] Add Client::GetAllDevices() #17728

merged 1 commit into from
Oct 5, 2024

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Sep 27, 2024

[IFRT] Add Client::GetAllDevices()

This defines Client::GetAllDevices(). It is similar to Client::devices(),
but it enumerates all devices available on the client, regardless of the
type/kind of devices. This multi-device behavior was implemented on certain
IFRT implementations, and PjRt-IFRT would return the same devices for now
because it has only one PjRt client. In the future, however, PjRt-IFRT would
support multiple device types and it GetAllDevices() will return more devices
while devices() may keep returning the devices of the primary device
type/kind.

Client::GetAllDevices() is essentially a transitional API in that its role
will be absorbed back to Client::devices() by making Client::devices() also
return all devices. However, this can only happen after the user code has been
updated to apply device filtering so that the legacy behavior around using
Client::devices() remains unchanged. By having a separate
Client::GetAllDevices() while the transition happens, we can incrementally
migrate the user code to apply the device filtering.

@copybara-service copybara-service bot force-pushed the test_679748878 branch 12 times, most recently from d77f485 to 1532a40 Compare October 4, 2024 21:33
@copybara-service copybara-service bot force-pushed the test_679748878 branch 3 times, most recently from b021172 to 5db9b92 Compare October 4, 2024 23:32
This defines `Client::GetAllDevices()`. It is similar to `Client::devices()`,
but it enumerates all devices available on the client, regardless of the
type/kind of devices. This multi-device behavior was implemented on certain
IFRT implementations, and PjRt-IFRT would return the same devices for now
because it has only one PjRt client. In the future, however, PjRt-IFRT would
support multiple device types and it `GetAllDevices()` will return more devices
while `devices()` may keep returning the devices of the primary device
type/kind.

`Client::GetAllDevices()` is essentially a transitional API in that its role
will be absorbed back to `Client::devices()` by making `Client::devices()` also
return all devices. However, this can only happen after the user code has been
updated to apply device filtering so that the legacy behavior around using
`Client::devices()` remains unchanged. By having a separate
`Client::GetAllDevices()` while the transition happens, we can incrementally
migrate the user code to apply the device filtering.

PiperOrigin-RevId: 682504020
@copybara-service copybara-service bot merged commit 54f3498 into main Oct 5, 2024
@copybara-service copybara-service bot deleted the test_679748878 branch October 5, 2024 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant