IntelPython / dpctl

Python SYCL bindings and SYCL-based Python Array API library
https://intelpython.github.io/dpctl/
Apache License 2.0
97 stars 29 forks source link

Update dlpack to v1.0rc #1667

Closed ndgrigorian closed 1 month ago

ndgrigorian commented 1 month ago

This PR bumps the version of dlpack by bringing in the new dlpack.h from v1.0rc.

As a result of changes introduced in v1.0rc

This pull request also slips in a minor change to usm_ndarray's constructor to honor the writable flag when buffer is another usm_ndarray

github-actions[bot] commented 1 month ago

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. :crossed_fingers:

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_336 ran successfully. Passed: 884 Failed: 8 Skipped: 92

coveralls commented 1 month ago

Coverage Status

coverage: 87.948% (+0.06%) from 87.892% when pulling f0ced4e899910b5e6da589dad977c731ac18d011 on feature/dlpack-1-support into d3e124a20a4dc04003845aaacfc213dc8e0059bc on master.

ndgrigorian commented 1 month ago

@oleksandr-pavlyk The commit from the memory work branch seems to have broken the dlpack tests on Windows.

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_337 ran successfully. Passed: 883 Failed: 9 Skipped: 92

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_339 ran successfully. Passed: 884 Failed: 8 Skipped: 92

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_340 ran successfully. Passed: 883 Failed: 9 Skipped: 92

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_340 ran successfully. Passed: 884 Failed: 8 Skipped: 92

oleksandr-pavlyk commented 1 month ago

The check need tweaking:

In [9]: x.__dlpack__(max_version=1)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[9], line 1
----> 1 x.__dlpack__(max_version=1)

File ~/repos/dpctl_tmp/dpctl/tensor/_usmarray.pyx:1131, in dpctl.tensor._usmarray.usm_ndarray.__dlpack__()
   1129 else:
   1130     dpctl_dlpack_version = get_build_dlpack_version()
-> 1131     if max_version >= dpctl_dlpack_version or max_version[0] == dpctl_dlpack_version[0]:
   1132         # DLManagedTensorVersioned path
   1133         # TODO: add logic for targeting a device

TypeError: '>=' not supported between instances of 'int' and 'tuple'

The check should check that max_version is a 2-tuple of integers. But looking at this check, what is the purpose of overriding clause max_version[0] == dpctl_dlpack_version[0]?

oleksandr-pavlyk commented 1 month ago

Please update dpctl/tensor/include/dlpack/README.md with version and SHA of the vendored dlpack.h

ndgrigorian commented 1 month ago

The check need tweaking:

In [9]: x.__dlpack__(max_version=1)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[9], line 1
----> 1 x.__dlpack__(max_version=1)

File ~/repos/dpctl_tmp/dpctl/tensor/_usmarray.pyx:1131, in dpctl.tensor._usmarray.usm_ndarray.__dlpack__()
   1129 else:
   1130     dpctl_dlpack_version = get_build_dlpack_version()
-> 1131     if max_version >= dpctl_dlpack_version or max_version[0] == dpctl_dlpack_version[0]:
   1132         # DLManagedTensorVersioned path
   1133         # TODO: add logic for targeting a device

TypeError: '>=' not supported between instances of 'int' and 'tuple'

The check should check that max_version is a 2-tuple of integers. But looking at this check, what is the purpose of overriding clause max_version[0] == dpctl_dlpack_version[0]?

max_version[0] >= dpctl_dlpack_version[0] should be enough.

The spec recommends that if the major versions match, it's a strong enough condition to return a capsule with our own max_version.

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_344 ran successfully. Passed: 888 Failed: 17 Skipped: 91

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_345 ran successfully. Passed: 888 Failed: 17 Skipped: 91

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_346 ran successfully. Passed: 888 Failed: 17 Skipped: 91

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_346 ran successfully. Passed: 888 Failed: 17 Skipped: 91

oleksandr-pavlyk commented 1 month ago

It would be good to factor out common code from to_dlpack_capsule and to_dlpack_versioned_capsule into a function.

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_348 ran successfully. Passed: 888 Failed: 17 Skipped: 91

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_349 ran successfully. Passed: 889 Failed: 16 Skipped: 91

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_351 ran successfully. Passed: 888 Failed: 17 Skipped: 91

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_352 ran successfully. Passed: 889 Failed: 16 Skipped: 91