Skip to content

Update third party tests - #3023

Open
antonwolfy wants to merge 18 commits into
masterfrom
update-third-party-tests
Open

antonwolfy wants to merge 18 commits into
masterfrom
update-third-party-tests

Conversation

@antonwolfy

@antonwolfy antonwolfy commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

This PR refreshes the vendored third-party test suite under dpnp/tests/third_party/cupy and cupyx: it syncs the tests with upstream changes, migrates and expands coverage, adapts to newer NumPy/SciPy, and makes the newly added tests portable across dpnp devices (CPU/GPU, with and without native fp64 support). The change is test-only — no library or runtime code is modified.

What's included

New and expanded coverage:

  • cumulative_sum / cumulative_prod (Array API) and batch-scan kernel tests for cumsum / cumprod
  • cupy.linalg.tensordot, shape argument to reshape, and additional eigenvalue tests
  • cupyx.scipy.special erf tests, and additional test_search / test_join / test_ndarray cases

Framework and compatibility updates:

  • Migrate test_raw.py to pytest
  • Support and test NumPy 2.5 and SciPy 1.18
  • Mark a globally-mutating test as thread-unsafe; reject CUB block reduction for short (<128) partial reductions

Correctness fixes surfaced by the new tests:

  • Fix rfftn/fftn shape mismatch when s and non-default axes are given together
  • Address casting a negative stride as unsigned int in dlpack; random integer ranges should use uint internally
  • Harden the custom along-axis scan against overflow; avoid an extra host copy when uploading a non-contiguous NumPy array

Device portability for the new batch-scan tests:

  • Build inputs at the device-supported float precision (float64 only where fp64 is available, else float32) so NumPy and dpnp compute at the same precision
  • Relax cumprod tolerance on the float32 path (rtol=1e-5, atol=1e-6); keep the fp64 path strict
  • Mute the expected NumPy float32 overflow warning on long axes so the infra-warnings tracker stays clean

Checklist

  • 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.21.0 release milestone Aug 13, 2026
@antonwolfy antonwolfy self-assigned this Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@antonwolfy
antonwolfy marked this pull request as ready for review August 13, 2026 12:32
@antonwolfy
antonwolfy marked this pull request as draft August 13, 2026 12:32
@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Array API standard conformance tests for dpnp=0.21.0dev11=py314ha0e2e8e_27 ran successfully.
Passed: 1376
Failed: 0
Skipped: 6

@coveralls

coveralls commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Status

No base build to compare — update-third-party-tests into master

@antonwolfy
antonwolfy force-pushed the update-third-party-tests branch 2 times, most recently from cb8c139 to 5bd33aa Compare August 19, 2026 21:08
@antonwolfy
antonwolfy force-pushed the update-third-party-tests branch 4 times, most recently from 6683145 to 636a808 Compare September 13, 2026 12:26
@antonwolfy
antonwolfy force-pushed the update-third-party-tests branch 3 times, most recently from 971de36 to 930a5b8 Compare September 29, 2026 11:56
test_cum{sum,prod}_axis_batch_kernels hardcoded float64 inputs, which
dpnp downcasts to float32 on devices without fp64 support while NumPy
keeps float64 -- tripping the allclose dtype check and, for cumprod,
diverging by percent-level near float32 underflow along long axes.

Build both sides at cupy.default_float_type() so they compute at the
same precision, and relax cumprod to rtol=1e-5/atol=1e-6 to absorb
float32 scan rounding.
On non-fp64 devices test_cumprod_axis_batch_kernels runs in float32,
where the cumulative product overflows to inf along long axes (dpnp and
the NumPy reference alike, so the inf==inf comparison still holds). Add
a message-scoped filterwarnings mark so the expected NumPy overflow
RuntimeWarning is no longer reported by the infra-warnings tracker.
@antonwolfy
antonwolfy force-pushed the update-third-party-tests branch from 930a5b8 to d0df49c Compare September 30, 2026 09:23
@antonwolfy
antonwolfy marked this pull request as ready for review September 30, 2026 10:48
@@ -511,11 +599,11 @@ def test_compiler_flag(self):
x1, x2, y = self._helper(ker_times, cupy.float64)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks like this test passes float64 in as dtype, is it a concern on devices w/o fp64?

)

@testing.for_dtypes(dtype_)
@testing.for_dtypes([numpy.float64, numpy.complex128])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seems the has_support_aspect check was removed here, is it safe?

# @pytest.mark.thread_unsafe(reason="allocation too large.")
def test_argmax_int32_overflow(self):
a = testing.shaped_arange((2**32 + 1,), cupy, numpy.float64)
a = cupy.arange(2**32 + 1, dtype=cupy.float64)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Another raw call with float64

# @pytest.mark.thread_unsafe(reason="allocation too large.")
def test_argmin_int32_overflow(self):
a = testing.shaped_arange((2**32 + 1,), cupy, numpy.float64)
a = cupy.arange(2**32 + 1, dtype=cupy.float64)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same

This branch has not been deployed

No deployments
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.

3 participants