Skip to content

docs: clarify input arrays in device placement #919

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

Merged
merged 6 commits into from
Jun 23, 2025

Conversation

crusaderky
Copy link
Contributor

@crusaderky crusaderky commented Apr 1, 2025

Clarify how input arrays should be considered for device placement.
This new line is a repetition of bullet point 2, three lines above:

Preserve device assignment as much as possible (e.g. output arrays from a function are expected to be on the same device as input arrays to the function).

However, I am observing very high levels of ambiguity among the community on the interpretation of this paragraph, where I've had multiple people insist that the device set in the context manager or global default device should trump the device of input arrays. At which point, since all real-life backends always have a global default device, input-to-output device propagation would fly out of the window.

@rgommers
Copy link
Member

rgommers commented Apr 1, 2025

This change seems reasonable to me, it's more of a clarification than anything else. This numbered list was written with creation functions in mind I believe. The device= keyword descriptions already say something like "if device is None, use the device from the input array" in the relevant cases.

Before merging this, let's ensure the discussions in data-apis/array-api-compat#293 (and perhaps other places) have been settled to ensure it's all consistent.

@kgryte kgryte added this to the v2025 milestone Apr 2, 2025
@kgryte kgryte added the topic: Device Handling Device handling. label Apr 2, 2025
@kgryte kgryte changed the title Clarify input arrays in device placement docs: clarify input arrays in device placement Apr 2, 2025
@crusaderky
Copy link
Contributor Author

XREF #918
@kgryte ready for review and merge

Copy link
Contributor

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kgryte
Copy link
Contributor

kgryte commented Jun 23, 2025

Based on linked discussions and workgroup discussion, the proposed rule changes have agreement. As such, I'll go ahead and merge.

@kgryte kgryte merged commit 2d3abf7 into data-apis:main Jun 23, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: Device Handling Device handling.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants