Skip to content

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?

@github-actions
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.

@github-actions
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)
@github-actions
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
Contributor

@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
Contributor

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
Contributor

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_.
@github-actions
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
@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.

4 participants