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

Improve interoperability between SyclDevice and DLPack devices #1953

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

ndgrigorian
Copy link
Collaborator

@ndgrigorian ndgrigorian commented Jan 4, 2025

This PR proposes improving dpctl's interoperability with DLPack by

  • Adding a new method get_device_id to dpctl.SyclDevice which returns the ordinal ID of a root device
  • Adding new functions dpctl.tensor.dldevice_to_sycldevice and its converse dpctl.tensor.sycldevice_to_dldevice which function as conversions between dpctl.SyclDevices and the DLPack device tuples returned by arr.__dlpack_device__() for some array arr from an arbitrary array library

Closes #1929

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?
  • If this PR is a work in progress, are you opening the PR as a draft?

dpctl/tensor/_dldevice_conversions.py Outdated Show resolved Hide resolved
dpctl/tensor/_dldevice_conversions.py Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Jan 4, 2025

Copy link

github-actions bot commented Jan 4, 2025

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_368 ran successfully.
Passed: 894
Failed: 2
Skipped: 118

@ndgrigorian ndgrigorian force-pushed the dlpack-enum-sycl-device-interop branch 2 times, most recently from ac69747 to eb7f4fe Compare January 7, 2025 18:49
Copy link

github-actions bot commented Jan 7, 2025

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_411 ran successfully.
Passed: 893
Failed: 3
Skipped: 118

@coveralls
Copy link
Collaborator

coveralls commented Jan 7, 2025

Coverage Status

coverage: 87.648% (-0.03%) from 87.681%
when pulling 7a9c6a8 on dlpack-enum-sycl-device-interop
into 598082f on master.

@ndgrigorian ndgrigorian force-pushed the dlpack-enum-sycl-device-interop branch from eb7f4fe to c529b29 Compare January 7, 2025 22:05
@ndgrigorian ndgrigorian marked this pull request as ready for review January 7, 2025 22:06
Copy link

github-actions bot commented Jan 7, 2025

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_413 ran successfully.
Passed: 894
Failed: 2
Skipped: 118

Copy link

github-actions bot commented Jan 9, 2025

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_415 ran successfully.
Passed: 893
Failed: 3
Skipped: 118

@ndgrigorian
Copy link
Collaborator Author

@icfaust
This PR implements new DLPack functions in line with your request

@ndgrigorian ndgrigorian force-pushed the dlpack-enum-sycl-device-interop branch from f010c23 to 5d4c8e8 Compare January 13, 2025 09:29
Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_436 ran successfully.
Passed: 894
Failed: 2
Skipped: 118

@ndgrigorian ndgrigorian force-pushed the dlpack-enum-sycl-device-interop branch from 5d4c8e8 to ec6c1d9 Compare January 13, 2025 17:05
Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_440 ran successfully.
Passed: 894
Failed: 2
Skipped: 118

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_441 ran successfully.
Passed: 894
Failed: 2
Skipped: 118

@ndgrigorian ndgrigorian force-pushed the dlpack-enum-sycl-device-interop branch from 9559620 to b1e8df1 Compare January 14, 2025 00:54
Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_440 ran successfully.
Passed: 894
Failed: 2
Skipped: 118

@oleksandr-pavlyk
Copy link
Collaborator

The docstring for the newly added method did not render well:

image

The example included in the docstring is missing. I suspect this is due to missing empty lines around :Example:.

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_450 ran successfully.
Passed: 894
Failed: 2
Skipped: 118

@ndgrigorian
Copy link
Collaborator Author

@oleksandr-pavlyk
The documentation rendering issue has been fixed.

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_452 ran successfully.
Passed: 894
Failed: 2
Skipped: 118

@ndgrigorian ndgrigorian force-pushed the dlpack-enum-sycl-device-interop branch from 64687a2 to 7a9c6a8 Compare January 14, 2025 19:31
Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_452 ran successfully.
Passed: 894
Failed: 2
Skipped: 118

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

Successfully merging this pull request may close these issues.

Feature Request: create SyclDevice and attribute to and from dlpack Enum in Python
3 participants