-
Notifications
You must be signed in to change notification settings - Fork 30
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
Cached device store #1076
Cached device store #1076
Conversation
This function caches queues by (context, device) key. The cache is stored in contextvars.ContextVar variable, learning our lessons from issue gh-11. get_device_cached_queue(dev : dpctl.SyclDevice) -> dpctl.SyclQueue get_device_cached_queue( (ctx: dpctl.SyclContext, dev : dpctl.SyclDevice) ) -> dpctl.SyclQueue Function retrieves the queue from cache, or adds the new queue instance there if previously absent.
Queue is looked up from cache for default-selected device.
View rendered docs @ https://intelpython.github.io/dpctl/pulls/1076/index.html |
Array API standard conformance tests for dpctl=0.14.1dev2=py310h41425db_21 ran successfully. |
Array API standard conformance tests for dpctl=0.14.1dev2=py310h41425db_29 ran successfully. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested together with dpnp
and it works fine. Thank you! LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! Thank you @oleksandr-pavlyk
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
I do not expect numba-dpex to use this functionality. |
Array API standard conformance tests for dpctl=0.14.1dev2=py310h41425db_31 ran successfully. |
This is the use case I had in mind:
To support these constructors inside the |
@diptorupd Yes, and I can add support for string argument for sure, but without boxing/unboxing support for |
yes, that is on my next set of todos |
This PR creates dedicate queue cache with context, device pair being a key.
Use of this cache in
dpctl.tensor.Device
,dpctl.tensor.from_dlpack
and indpctl.memory
allows to returns the same queue for a given device, streamlining user experience with compute-follows-data model.