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

Buffer donation for Metal plugin #20212

Open
dlwh opened this issue Mar 12, 2024 · 1 comment
Open

Buffer donation for Metal plugin #20212

dlwh opened this issue Mar 12, 2024 · 1 comment
Assignees
Labels

Comments

@dlwh
Copy link
Contributor

dlwh commented Mar 12, 2024

Buffer donation would be nice. I don't see an issue for it so just opening it for tracking/asking if it's on the Apple JAX Metal Team's roadmap

>>> import jax
>>> jax.devices()
Platform 'METAL' is experimental and not all JAX functionality may be correctly supported!
2024-03-12 16:07:16.498439: W pjrt_plugin/src/mps_client.cc:563] WARNING: JAX Apple GPU support is experimental and not all JAX functionality is correctly supported!
Metal device set to: Apple M1 Pro

systemMemory: 32.00 GB
maxCacheSize: 10.67 GB

[METAL(id=0)]
>>> import jax.numpy as jnp
>>> x = jax.jit(lambda x: x)(jnp.zeros((4, 5))
...
...
...
... )
>>> x = jax.jit(lambda x: x)(jnp.zeros((4, 5)))
>>> x = jax.jit(lambda x: x, donate_args=True)(jnp.zeros((4, 5)))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: jit() got an unexpected keyword argument 'donate_args'
>>> x = jax.jit(lambda x: x, donate_argnums=(0,))(jnp.zeros((4, 5)))
/opt/homebrew/Caskroom/miniforge/base/envs/jax_metal/lib/python3.10/site-packages/jax/_src/interpreters/mlir.py:761: UserWarning: Some donated buffers were not usable: ShapedArray(float32[4,5]).
Donation is not implemented for ('METAL',).
See an explanation at https://jax.readthedocs.io/en/latest/faq.html#buffer-donation.
  warnings.warn("Some donated buffers were not usable:"
>>>
@dlwh dlwh added the enhancement New feature or request label Mar 12, 2024
@shuhand0
Copy link
Collaborator

Thanks for requesting the feature, and we will track it and update here when we have a plan.

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

No branches or pull requests

4 participants