Skip to content

Add test for real FFT of misaligned input arrays - #3087

Merged
antonwolfy merged 3 commits into
masterfrom
add-rfft-input-alignment-test
Oct 6, 2026
Merged

antonwolfy merged 3 commits into
masterfrom
add-rfft-input-alignment-test

Conversation

@antonwolfy

@antonwolfy antonwolfy commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

This PR adds test_rfft_input_alignment to the third-party FFT tests. It covers real-to-complex FFTs whose input data pointer is not aligned to the size of a complex output element.

The test runs dpnp.fft.rfft (1-D) and dpnp.fft.rfftn (3-D) on float32/float64 inputs (float64 only on devices that support it), built in three ways, each at element offset 0 (aligned) and 1 (misaligned):

  • a contiguous view into a larger array (a[offset])
  • a strided view (a[..., offset::2])
  • an array created over an offset buffer (dpnp.ndarray(shape, dtype=dtype, buffer=backing, offset=offset))

Each case checks that the result matches NumPy and that the backing buffer is left unchanged.

These cases already work on Intel CPU and GPU devices, so no change to the implementation is needed; the test guards against regressions.

  • 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 Oct 5, 2026
@antonwolfy antonwolfy self-assigned this Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

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

oneMKL float32 rounding residue in zero bins is coherently amplified by
prod(shape) for constant input, exceeding the fixed atol=1e-3 inherited
from CuPy on some CPUs. Use eps * prod(shape) instead.
@coveralls

coveralls commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 78.669%. remained the same — add-rfft-input-alignment-test into master

@vlad-perevezentsev vlad-perevezentsev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM
Thank you @antonwolfy !

@antonwolfy
antonwolfy merged commit e22aa78 into master Oct 6, 2026
112 of 113 checks passed
@antonwolfy
antonwolfy deleted the add-rfft-input-alignment-test branch October 6, 2026 15:01
github-actions Bot added a commit that referenced this pull request Oct 6, 2026
This PR adds `test_rfft_input_alignment` to the third-party FFT tests.
It covers real-to-complex FFTs whose input data pointer is not aligned
to the size of a complex output element.

The test runs `dpnp.fft.rfft` (1-D) and `dpnp.fft.rfftn` (3-D) on
float32/float64 inputs (float64 only on devices that support it), built
in three ways, each at element offset 0 (aligned) and 1 (misaligned):
- a contiguous view into a larger array (`a[offset]`)
- a strided view (`a[..., offset::2]`)
- an array created over an offset buffer (`dpnp.ndarray(shape,
dtype=dtype, buffer=backing, offset=offset)`)

Each case checks that the result matches NumPy and that the backing
buffer is left unchanged.

These cases already work on Intel CPU and GPU devices, so no change to
the implementation is needed; the test guards against regressions. e22aa78
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