Skip to content

Implement device keyword into can_cast, result_type #1420

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

Closed
ndgrigorian opened this issue Sep 25, 2023 · 3 comments
Closed

Implement device keyword into can_cast, result_type #1420

ndgrigorian opened this issue Sep 25, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@ndgrigorian
Copy link
Collaborator

The array API standard will soon require the device keyword be added to can_cast and result_type

See:
data-apis/array-api#691

@ndgrigorian ndgrigorian added the enhancement New feature or request label Sep 25, 2023
@kgryte
Copy link

kgryte commented Oct 16, 2023

@ndgrigorian Following up here, it is not guaranteed that the Array API standard will require device kwarg support, as there are some concerns as to whether such support is desirable. If you have particular thoughts on whether it should be required, please provide that input on the PR and/or associated issue. Thanks!

@oleksandr-pavlyk
Copy link
Contributor

It has been decided against implementing device keyword in these functions. When all arguments are dtype, full type promotion graph is to be used. When some arguments are arrays, devices must be the same, and the device-specific type promotion graph is to be used.

Hence, the recommended usage is xp.can_cast( array, to_dtype) rather than xp.can_cast(array.dtype, to_dtype).

We still should adjust implementation of dpctl.tensor.can_cast and dpctl.tensor.result_type to conform to this specification.

@ndgrigorian
Copy link
Collaborator Author

As the array API has decided against this, I will close this issue.

#1488 will also make these functions device-aware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants