-
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
Get coerced usm type #797
Get coerced usm type #797
Conversation
This function deduces the type of USM allocation for the output array based on USM types of the input arrays. Changed behavior of get_execution_queue(sequence_of_queues). Queues are equivalent now when they compare equal, i.e. q1 == q2 is True. This means that they are Python wrappers about copies of the same underlying SYCL queue. Since dpctl.SyclQueue() and dpctl.SyclQueue() produce two distinct instances they no longer are equivalent, and will not be compatible in the compute follows data paradigm. arr.to_device can be used to zero-copy reattach the new queue to the data provided that the original queue and the new queue have the same underlying SYCL context, which guarantees that SYCL pointer can be dereferenced in the new queue.
A forthcoming PR would implement caching for the mapping from filter strings and unpartitioned devices to queues. |
@PokhodenkoSA @Alexander-Makaryev @diptorupd The change to I would therefore not merge this until such caching is implemented. |
View rendered docs @ https://intelpython.github.io/dpctl/pulls/797/index.html |
…vices to queues As a result of this `X = dpt.empty((10,), device="gpu")` and `Y=dpt.empty((10,), device="gpu")` would have the same associated queue, i.e. `X.sycl_queue is Y.sycl_queue` would give True
…or strings produce identical cached queue
f8d473d
to
99f017d
Compare
The caching has been implemented now:
|
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
Adds
dpctl.utils.get_coerced_usm_type
to deduce the usm type for the output array based on usm types of input arrays.Also modified behavior of
dpctl.utils.get_execution_queue
. The notion of equivalency has changed. Now two queues are equivalent if they compare equal, i.e.q1 == q2
. This is true when the underlying C++ class instances are copies of the same underlying instance.Note that
dpctl.SyclQueue() == dpctl.SyclQueue()
returnsFalse
, and so woulddpctl.SyclQueue("cpu") == dpctl.SyclQueue("cpu")
.To bring two arrays to equivalent queues, do
Yc = Y.to_device(X.device)
, and thenfoo(X, Yc)
iffoo(X, Y)
was raising due to incompatible queues.