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

Explicilty interface for AcquireExternalReference and WaitExternalReference #19845

Open
yliu120 opened this issue Nov 26, 2024 · 1 comment
Open

Comments

@yliu120
Copy link
Contributor

yliu120 commented Nov 26, 2024

Currently PJRT/XLA python has some implicit interface to let an external framework (e.g. numpy) to co-own a PjRtBuffer.

And the Execute function will check whether an input buffer has external reference. We want to add some explicit interface to hold, release, wait a device buffer from python so that other python framework can use them in a separate thread.

Code Pointer:

  1. https://cs.opensource.google/tensorflow/tensorflow/+/master:third_party/xla/xla/python/py_array.cc;l=873-883?q=AcquireExternalReference&start=11
  2. https://cs.opensource.google/tensorflow/tensorflow/+/master:third_party/xla/xla/pjrt/pjrt_stream_executor_client.cc;l=1464-1469
  3. https://cs.opensource.google/tensorflow/tensorflow/+/master:third_party/xla/xla/pjrt/pjrt_stream_executor_client.cc;l=1618-1621

We want to add WaitForOutstandingExternalReferenceHolds() and expose it to the Python/jax.Array interface as a first step.

@yliu120
Copy link
Contributor Author

yliu120 commented Nov 26, 2024

@hawkinsp For your reference

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

No branches or pull requests

1 participant