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

Implements dpctl.tensor.nextafter per array API #1730

Merged
merged 6 commits into from
Jul 19, 2024

Conversation

ndgrigorian
Copy link
Collaborator

This PR implements the nextafter function coming to the next version of the array API specification

  • 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 Jul 13, 2024

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

@coveralls
Copy link
Collaborator

coveralls commented Jul 13, 2024

Coverage Status

coverage: 87.97% (+0.003%) from 87.967%
when pulling e5f9810 on dpctl-tensor-nextafter
into f646ac1 on master.

Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310h15de555_105 ran successfully.
Passed: 894
Failed: 15
Skipped: 105

The basic test also to include nextafter(arr, 0), nextafter(arr, inf),
nextafter(arr, -inf)
Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310h15de555_113 ran successfully.
Passed: 894
Failed: 15
Skipped: 105

@oleksandr-pavlyk oleksandr-pavlyk marked this pull request as ready for review July 17, 2024 18:13
Copy link
Collaborator

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you @ndgrigorian

I did push changes to extend test file.

@oleksandr-pavlyk
Copy link
Collaborator

BTW, test_nextafter_special_cases_zero[f2] fails for CUDA devices:

In [1]: import dpctl.tensor as dpt

In [2]: x1 = dpt.asarray([-0.0, 0.0, -0.0, 0.0], dtype="f2", device="cuda")

In [3]: x2 = dpt.asarray([0.0, -0.0, -0.0, 0.0], dtype="f2", device="cuda")

In [4]: dpt.nextafter(x1, x2)
Out[4]: usm_ndarray([-0.,  0., -0.,  0.], dtype=float16)

In [5]: y1 = dpt.asarray([-0.0, 0.0, -0.0, 0.0], dtype="f2")

In [6]: y2 = dpt.asarray([0.0, -0.0, -0.0, 0.0], dtype="f2")

In [7]: dpt.nextafter(y1, y2)
Out[7]: usm_ndarray([ 0., -0., -0.,  0.], dtype=float16)

@oleksandr-pavlyk
Copy link
Collaborator

Reported as OFNAAO-302. Will add skipping this test for "float16" on CUDA devices for now.

Implementation of CUDA backend for DPC++ has a known issue where
sycl::nextafter for sycl::half type does not comply with C++ stipulation
that nextafter(from_, to_) must return to_ if from_ is equal to to_.
Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310h15de555_116 ran successfully.
Passed: 894
Failed: 15
Skipped: 105

Copy link
Collaborator

@antonwolfy antonwolfy left a comment

Choose a reason for hiding this comment

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

I've reused it in dpnp-1938 and it works fine. Thank you!

@oleksandr-pavlyk oleksandr-pavlyk merged commit 477946e into master Jul 19, 2024
27 of 35 checks passed
@oleksandr-pavlyk oleksandr-pavlyk deleted the dpctl-tensor-nextafter branch July 19, 2024 14:32
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.

None yet

4 participants