Skip to content

Commit eba737b

Browse files
Ensure C-contiguous input for cuFFT compatibility
1 parent f56a43f commit eba737b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

dpnp/fft/dpnp_utils_fft.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,11 @@ def _fft(a, norm, out, forward, in_place, c2c, axes, batch_fft=True):
395395
a = dpnp.reshape(a, local_shape)
396396
index = 1
397397

398+
# cuFFT requires input arrays to be C-contiguous (row-major)
399+
# for correct execution
400+
if dpnp.is_cuda_backend(a) and not a.flags.c_contiguous:
401+
a = dpnp.ascontiguousarray(a)
402+
398403
a_strides = _standardize_strides_to_nonzero(a.strides, a.shape)
399404
dsc, out_strides = _commit_descriptor(
400405
a, forward, in_place, c2c, a_strides, index, batch_fft

0 commit comments

Comments
 (0)