Skip to content

Add more dlpack tests #1670

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

Merged
merged 3 commits into from
May 10, 2024
Merged

Conversation

oleksandr-pavlyk
Copy link
Contributor

This PR adds tests to improve coverage in gh-1667

  • 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?
  • If this PR is a work in progress, are you opening the PR as a draft?

Copy link

github-actions bot commented May 10, 2024

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

Copy link

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

Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM! Thank you for the addition of tests to the branch @oleksandr-pavlyk

Use F-contiguous array to both legacy and versioned capsule.
Add tests for read-only array and for use of copy=True keyword
for __dlpack__ call
Copy link

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

@ndgrigorian ndgrigorian merged commit aba58c4 into feature/dlpack-1-support May 10, 2024
60 checks passed
@ndgrigorian ndgrigorian deleted the add-more-dlpack-tests branch May 10, 2024 21:57
ndgrigorian added a commit that referenced this pull request May 13, 2024
* Implements DLPack changes necessitated by memory object work

Use `ary_base` rather than `usm_ary` as manager_ctx in
     DLManagedTensor struct.

Tests for DLPack use fixture to provide all devices to take advantage
of caching.

* `usm_ndarray` constructor now honors the writable flag when passed a read-only array as `buffer` argument

* Adds support for DLPack v1.0

* Uses `dlpack.h` as per DLPack v1.0 rc
* Implements `device` and `copy` keywords into `__dlpack__` and `from_dlpack`
* Implements `max_version` argument into `__dlpack__`
* Adds `DLDeviceType` enumerator to `_usmarray.pyx` for representing device types as enumerators
* Reimplements `dpt._dlpack.get_build_dlpack_version` to return a tuple of the major version and the minor version

* Adds check for major version of versioned dlpack tensor to `from_dlpack_versioned_capsule`

Also adjusts some error messages in _dlpack.pyx

* Add missing device_type enumerators from `dlpack.h`

* usm_ary -> ary_base in `to_dlpack_versioned_capsule`

* Changes to exception messages throughout _dlpack.pyx

* Versioned DLpack tensor deleter and owner tweaked

These tweaks are based on similar changes made for the managed tensor during memory work

* Updates `dpctl/tensor/include/dlpack/README.md`

DLPack version updated and new SHA for `dlpack.h` added

* Adds check that `max_version` is a 2-tuple to `__dlpack__`

* Add more dlpack tests (#1670)

* Fixture all_root_devices is to keep only 2 devices from each platform

This is done to speed-up test suite execution on multi-GPU system,
like Aurora.

* Add tests for legacy/versions capsule import-export

* Expand tests more to improve coverage

Use F-contiguous array to both legacy and versioned capsule.
Add tests for read-only array and for use of copy=True keyword
for __dlpack__ call

* Test the writable flag of a usm_ndarray from read-only DLPack capsule

Also adds a test checking for the writable flag of a usm_ndarray constructed with a read-only usm_ndarray as the buffer

Removes some commented out `flags` checks from `test_meshgrid2`. These checks were malformed, as `dpt.meshgrid` returns a non-contiguous view in the test.

* Factor out device-id computation

Reuse that in both capsule producers to avoid code duplication

* Reuse get parent device ordinal id routine (#1672)

* Reused get_parent_device_ordinal_id routine

* test_legacy_dlpack_capsule uses 4 kinds of dtype

Added test to use non-default copy keyword, and non-default device keyword
argument.

* Adds more DLPack tests to improve coverage

* Adds a test for boolean arrays in test_legacy_dlpack_capsule

* DLPack tests for `copy` and `stream` kwargs in `__dlpack__`

---------

Co-authored-by: Oleksandr Pavlyk <oleksandr.pavlyk@intel.com>
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.

2 participants