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

Make sure array is copied under this situation: #24132

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

copybara-service[bot]
Copy link

Make sure array is copied under this situation:

x = np.arange(1000)
y = jax.device_put(x, device=jax.devices()[0], may_alias=False, donate=False)
z = jax.device_put(y, device=jax.devices()[0], may_alias=False, donate=False)

This condition will be true after this change z.unsafe_buffer_pointer() != y.unsafe_buffer_pointer()

Also lift the restrictions that CopyToMemorySpace doesn't work sometimes for
matching src+dest memory spaces. We can always bounce through the host if there
is no more efficient copy.

```
x = np.arange(1000)
y = jax.device_put(x, device=jax.devices()[0], may_alias=False, donate=False)
z = jax.device_put(y, device=jax.devices()[0], may_alias=False, donate=False)
```

This condition will be true after this change `z.unsafe_buffer_pointer() != y.unsafe_buffer_pointer()`

Also lift the restrictions that CopyToMemorySpace doesn't work sometimes for
matching src+dest memory spaces. We can always bounce through the host if there
is no more efficient copy.

PiperOrigin-RevId: 740114579
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