Skip to content

Conversation

antonwolfy
Copy link
Contributor

@antonwolfy antonwolfy commented Aug 4, 2025

The PR changes the implementation of dpnp.erf function. It now invokes oneapi::mkl::vm implementation from pybind11 extension of OneMKL VM if possible or uses dedicated kernel from pybind11 extension of ufunc.

  • 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?

@antonwolfy antonwolfy added this to the 0.19.0 release milestone Aug 4, 2025
@antonwolfy antonwolfy self-assigned this Aug 4, 2025
Copy link
Contributor

github-actions bot commented Aug 4, 2025

Array API standard conformance tests for dpnp=0.19.0dev3=py313h509198e_68 ran successfully.
Passed: 1227
Failed: 0
Skipped: 9

Copy link
Contributor

github-actions bot commented Aug 4, 2025

View rendered docs @ https://intelpython.github.io/dpnp/index.html

@coveralls
Copy link
Collaborator

coveralls commented Aug 5, 2025

Coverage Status

coverage: 71.755% (+0.1%) from 71.64%
when pulling 2de4f06 on add-erf-impl
into 25b7466 on master.

Copy link
Contributor

@vlad-perevezentsev vlad-perevezentsev 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 @antonwolfy for the implementation of dpnp.erf and significant cleanup of cython code!!!

@antonwolfy
Copy link
Contributor Author

@ndgrigorian, let me know if you have more comments

namespace dpnp::kernels::erf
{
template <typename argT, typename Tp>
struct ErfFunctor
Copy link
Collaborator

Choose a reason for hiding this comment

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

to this day, I'm not sure why we didn't use inheritance with these structs from a common parent with sensible defaults. That may be the smart thing to do someday. For sure not in this PR though. Leaving this comment to remember.

Comment on lines +43 to +44
result = dpnp.special.erf(ia)
expected = scipy.special.erf(a)
Copy link
Collaborator

Choose a reason for hiding this comment

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

it might be more readable and reliable to simply test against the expected values, i.e, that erf(nan) gives nan, erf(inf) gives 1, and erf(-inf) gives -1

this way bugs or changes in behavior in scipy don't impact this test

Copy link
Collaborator

Choose a reason for hiding this comment

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

also wouldn't mind tests for 0 and -0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the current dpnp approach to test against numpy or scipy to ensure alignment in the behavior.
Btw, I've added a dedicated test for signed zero.

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.

other than minor comments about the test this LGTM

@antonwolfy antonwolfy merged commit d289709 into master Sep 17, 2025
73 of 75 checks passed
@antonwolfy antonwolfy deleted the add-erf-impl branch September 17, 2025 14:33
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