Skip to content

Update dpnp.isclose with scalar-specific SYCL kernels #2540

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

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
31f05a0
Init commit
vlad-perevezentsev Jun 18, 2025
745a28c
Init IsCloseContigFunctor with explicit T1, T2, resTy
vlad-perevezentsev Jun 20, 2025
295a848
Handle scalar inputs and broadcast shapes in def isclose()
vlad-perevezentsev Jun 23, 2025
1088fa7
Use three_offsets_indexer in IsCloseFunctor
vlad-perevezentsev Jun 24, 2025
1151fc3
Add strided implementation of isclose()
vlad-perevezentsev Jul 17, 2025
5f90ab5
Update strided implementation and rename functions
vlad-perevezentsev Jul 24, 2025
29bcb34
Refactor isclose scalar dispatch to use dispatch vectors
vlad-perevezentsev Jul 24, 2025
fe1f519
Simplify isclose function pointer declarations
vlad-perevezentsev Jul 24, 2025
38d8401
Restructure isclose.cpp
vlad-perevezentsev Jul 24, 2025
821065f
Use common validation utilities
vlad-perevezentsev Jul 24, 2025
4df1136
Fix argument order in IsCloseStridedScalarFunctor constructor
vlad-perevezentsev Jul 25, 2025
d80eab7
Cleanup isclose.cpp
vlad-perevezentsev Jul 25, 2025
8873008
Add support rtol/atol as complex to match NumPy
vlad-perevezentsev Jul 25, 2025
86c99cd
Expand and update tests for dpnp.isclose()
vlad-perevezentsev Jul 25, 2025
e3ca497
Merge master into update_isclose
vlad-perevezentsev Jul 25, 2025
2874520
Update copyright year
vlad-perevezentsev Jul 25, 2025
68b3878
Update changelog
vlad-perevezentsev Jul 25, 2025
ddd2ec0
Fix incorrect complex isclose logic and add proper overload
vlad-perevezentsev Jul 30, 2025
819262d
Make immutable variables const
vlad-perevezentsev Jul 30, 2025
8691551
Extend check_no_overlap to handle same logical tensors
vlad-perevezentsev Jul 30, 2025
15685e8
Fix rtol/atol conversion getting real part of complex to match NumPy
vlad-perevezentsev Jul 30, 2025
725891c
Apply remarks
vlad-perevezentsev Jul 30, 2025
c7c7011
Refactor isclose() by using separate _isclose_scalar_tol() for scalar…
vlad-perevezentsev Jul 30, 2025
665f043
Merge master into update_isclose
vlad-perevezentsev Jul 30, 2025
c5da321
Update TestIsClose
vlad-perevezentsev Jul 30, 2025
c1112c3
Add with_requires(numpy
vlad-perevezentsev Jul 31, 2025
35fc367
Remove unused includes
vlad-perevezentsev Jul 31, 2025
4b552eb
Use dpctl tensor include to use experimental SYCL namespace for complex
vlad-perevezentsev Jul 31, 2025
f68249c
Return inclusion pybind11/stl.h
vlad-perevezentsev Jul 31, 2025
394727f
Use static_assert to isclose
vlad-perevezentsev Jul 31, 2025
c27596f
Remove offsets passing for contig impl
vlad-perevezentsev Jul 31, 2025
a71f1bb
Use dpnp.broadcast_arrays() instead of dpnp.broadcast_shapes()
vlad-perevezentsev Jul 31, 2025
2d22e62
Improve code coverage
vlad-perevezentsev Jul 31, 2025
248e066
Merge remote-tracking branch 'origin/master' into update_isclose
vlad-perevezentsev Jul 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Replaced `ci` section in `.pre-commit-config.yaml` with a new GitHub workflow with scheduled run to autoupdate the `pre-commit` configuration [#2542](https://github.com/IntelPython/dpnp/pull/2542)
* FFT module is updated to perform in-place FFT in intermediate steps of ND FFT [#2543](https://github.com/IntelPython/dpnp/pull/2543)
* Reused dpctl tensor include to enable experimental SYCL namespace for complex types [#2546](https://github.com/IntelPython/dpnp/pull/2546)
* Improved performance of `dpnp.isclose` function by implementing a dedicated kernel for scalar `rtol` and `atol` arguments [#2540](https://github.com/IntelPython/dpnp/pull/2540)

### Deprecated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ inline void check_no_overlap(const array_ptr &input,
}

const auto &overlap = dpctl::tensor::overlap::MemoryOverlap();
const auto &same_logical_tensors =
dpctl::tensor::overlap::SameLogicalTensors();

if (overlap(*input, *output)) {
if (overlap(*input, *output) && !same_logical_tensors(*input, *output)) {
throw py::value_error(name_of(input, names) +
" has overlapping memory segments with " +
name_of(output, names));
Expand Down
1 change: 1 addition & 0 deletions dpnp/backend/extensions/ufunc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ set(_elementwise_sources
${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/heaviside.cpp
${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/i0.cpp
${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/interpolate.cpp
${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/isclose.cpp
${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/lcm.cpp
${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/ldexp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/logaddexp2.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "heaviside.hpp"
#include "i0.hpp"
#include "interpolate.hpp"
#include "isclose.hpp"
#include "lcm.hpp"
#include "ldexp.hpp"
#include "logaddexp2.hpp"
Expand Down Expand Up @@ -66,6 +67,7 @@ void init_elementwise_functions(py::module_ m)
init_heaviside(m);
init_i0(m);
init_interpolate(m);
init_isclose(m);
init_lcm(m);
init_ldexp(m);
init_logaddexp2(m);
Expand Down
Loading
Loading