-
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
Improve interoperability between SyclDevice
and DLPack devices
#1953
base: master
Are you sure you want to change the base?
Conversation
View rendered docs @ https://intelpython.github.io/dpctl/pulls/1953/index.html |
Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_368 ran successfully. |
ac69747
to
eb7f4fe
Compare
Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_411 ran successfully. |
Full dpctl namespace is unnecessary, as only SyclDevice is used
eb7f4fe
to
c529b29
Compare
Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_413 ran successfully. |
Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_415 ran successfully. |
cdef int dev_id = -1 | ||
|
||
if self.parent_device: | ||
raise TypeError("This SyclDevice is not a root device") |
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.
raise TypeError("This SyclDevice is not a root device") | |
raise ValueError("This SyclDevice is not a root device") |
@@ -2045,6 +2043,18 @@ cdef class SyclDevice(_SyclDevice): | |||
else: | |||
return str(relId) | |||
|
|||
def get_device_id(self): |
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.
Add a docstring
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.
This function requires self
to an unpartitioned device. It is useful to add function SyclDevice.get_unpartitioned_parent_device
to return the unpartitioned parent device that this device was obtained from.
from ._usmarray import DLDeviceType | ||
|
||
|
||
def dldevice_to_sycldevice(dl_dev: tuple): |
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.
Debating dldevice_to_sycldevice
vs dldevice_to_sycl_device
.
@icfaust |
This PR proposes improving dpctl's interoperability with DLPack by
get_device_id
todpctl.SyclDevice
which returns the ordinal ID of a root devicedpctl.tensor.dldevice_to_sycldevice
and its conversedpctl.tensor.sycldevice_to_dldevice
which function as conversions betweendpctl.SyclDevices
and the DLPack device tuples returned byarr.__dlpack_device__()
for some arrayarr
from an arbitrary array libraryCloses #1929