Add support for device and copy kwargs in from_dlpack to match Array API#20175
Conversation
jakevdp
left a comment
There was a problem hiding this comment.
Looks great! A few minor comments
cd8ec29 to
40cb7d8
Compare
|
Lint errors might indicate a problem: |
This is a bug in the |
|
Internal pytype tests are failing with many variations of this error: |
|
Can you change your commit message to something more informative? Thanks! |
…o_buffer` in `python/xla_extension` Imported from GitHub PR openxla/xla#10433 Encountered bug in jax-ml/jax#20175 (see this [comment](jax-ml/jax#20175 (comment))). This adjusts the stub file to properly overload `dlpack_managed_tensor_to_buffer` so that both signatures can be checked against. Copybara import of the project: -- 75cabb5149b4a0bdd9e819fac0ea6a0ba756bff6 by Meekail Zain <zainmeekail@gmail.com>: Update Merging this change closes #10433 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#10433 from Micky774:type_update 75cabb5149b4a0bdd9e819fac0ea6a0ba756bff6 PiperOrigin-RevId: 615173747
…o_buffer` in `python/xla_extension` Imported from GitHub PR openxla/xla#10433 Encountered bug in jax-ml/jax#20175 (see this [comment](jax-ml/jax#20175 (comment))). This adjusts the stub file to properly overload `dlpack_managed_tensor_to_buffer` so that both signatures can be checked against. Copybara import of the project: -- 75cabb5149b4a0bdd9e819fac0ea6a0ba756bff6 by Meekail Zain <zainmeekail@gmail.com>: Update Merging this change closes #10433 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#10433 from Micky774:type_update 75cabb5149b4a0bdd9e819fac0ea6a0ba756bff6 PiperOrigin-RevId: 615173747
…o_buffer` in `python/xla_extension` Imported from GitHub PR openxla/xla#10433 Encountered bug in jax-ml/jax#20175 (see this [comment](jax-ml/jax#20175 (comment))). This adjusts the stub file to properly overload `dlpack_managed_tensor_to_buffer` so that both signatures can be checked against. Copybara import of the project: -- 75cabb5149b4a0bdd9e819fac0ea6a0ba756bff6 by Meekail Zain <zainmeekail@gmail.com>: Update Merging this change closes #10433 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#10433 from Micky774:type_update 75cabb5149b4a0bdd9e819fac0ea6a0ba756bff6 PiperOrigin-RevId: 615173747
…o_buffer` in `python/xla_extension` Imported from GitHub PR #10433 Encountered bug in jax-ml/jax#20175 (see this [comment](jax-ml/jax#20175 (comment))). This adjusts the stub file to properly overload `dlpack_managed_tensor_to_buffer` so that both signatures can be checked against. Copybara import of the project: -- 75cabb5 by Meekail Zain <zainmeekail@gmail.com>: Update Merging this change closes #10433 COPYBARA_INTEGRATE_REVIEW=#10433 from Micky774:type_update 75cabb5 PiperOrigin-RevId: 615973838
…o_buffer` in `python/xla_extension` Imported from GitHub PR openxla/xla#10433 Encountered bug in jax-ml/jax#20175 (see this [comment](jax-ml/jax#20175 (comment))). This adjusts the stub file to properly overload `dlpack_managed_tensor_to_buffer` so that both signatures can be checked against. Copybara import of the project: -- 75cabb5149b4a0bdd9e819fac0ea6a0ba756bff6 by Meekail Zain <zainmeekail@gmail.com>: Update Merging this change closes #10433 PiperOrigin-RevId: 615973838
@jakevdp are the internal tests still failing? If so, I will update the typing to use the |
|
Still failing: I think the issue is that trying to depend on |
jakevdp
left a comment
There was a problem hiding this comment.
Looks good - could we add some test coverage for the new arguments in array_interoperability_test.py?
|
This looks good, and is probably ready to merge more-or-less. However there's a subtlety here that I've been thinking about with @yashk2810 – the issue is that the behavior of All of this is somewhat second-order though, so we should probably merge this change and iterate from there. |
Towards #20200
cf. data-apis/array-api#741
Note
"In principle, arbitrary cross-device copies could be allowed too, but the consensus in data-apis/array-api#626 was that limiting to device-to-host copies is enough for now". This PR includes the optional device-to-device transfer.
Default behavior is preserved when
device=None, copy=None