Skip to content

Commit 19f2a72

Browse files
barracuda156seberg
andauthored
BUG: Fix pocketfft umath strides for AIX compatibility (numpy#29768)
* _pocketfft_umath.cpp: fix types Fixes: numpy#29758 Credits to @seberg * _pocketfft_umath.cpp: fix unused variable warning * Move npts_in calculation into #ifndef --------- Co-authored-by: Sebastian Berg <[email protected]>
1 parent 435c2cd commit 19f2a72

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

numpy/fft/_pocketfft_umath.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
template<PyUFuncGenericFunction cpp_ufunc>
3333
static void
3434
wrap_legacy_cpp_ufunc(char **args, npy_intp const *dimensions,
35-
ptrdiff_t const *steps, void *func)
35+
npy_intp const *steps, void *func)
3636
{
3737
NPY_ALLOW_C_API_DEF
3838
try {
@@ -86,14 +86,14 @@ copy_output(T buff[], char *out, npy_intp step_out, size_t n)
8686
*/
8787
template <typename T>
8888
static void
89-
fft_loop(char **args, npy_intp const *dimensions, ptrdiff_t const *steps,
89+
fft_loop(char **args, npy_intp const *dimensions, npy_intp const *steps,
9090
void *func)
9191
{
9292
char *ip = args[0], *fp = args[1], *op = args[2];
9393
size_t n_outer = (size_t)dimensions[0];
94-
ptrdiff_t si = steps[0], sf = steps[1], so = steps[2];
94+
npy_intp si = steps[0], sf = steps[1], so = steps[2];
9595
size_t nin = (size_t)dimensions[1], nout = (size_t)dimensions[2];
96-
ptrdiff_t step_in = steps[3], step_out = steps[4];
96+
npy_intp step_in = steps[3], step_out = steps[4];
9797
bool direction = *((bool *)func); /* pocketfft::FORWARD or BACKWARD */
9898

9999
assert (nout > 0);
@@ -144,9 +144,9 @@ rfft_impl(char **args, npy_intp const *dimensions, npy_intp const *steps,
144144
{
145145
char *ip = args[0], *fp = args[1], *op = args[2];
146146
size_t n_outer = (size_t)dimensions[0];
147-
ptrdiff_t si = steps[0], sf = steps[1], so = steps[2];
147+
npy_intp si = steps[0], sf = steps[1], so = steps[2];
148148
size_t nin = (size_t)dimensions[1], nout = (size_t)dimensions[2];
149-
ptrdiff_t step_in = steps[3], step_out = steps[4];
149+
npy_intp step_in = steps[3], step_out = steps[4];
150150

151151
assert (nout > 0 && nout == npts / 2 + 1);
152152

@@ -233,14 +233,13 @@ irfft_loop(char **args, npy_intp const *dimensions, npy_intp const *steps, void
233233
size_t nin = (size_t)dimensions[1], nout = (size_t)dimensions[2];
234234
ptrdiff_t step_in = steps[3], step_out = steps[4];
235235

236-
size_t npts_in = nout / 2 + 1;
237-
238236
assert(nout > 0);
239237

240238
#ifndef POCKETFFT_NO_VECTORS
241239
/*
242240
* Call pocketfft directly if vectorization is possible.
243241
*/
242+
size_t npts_in = nout / 2 + 1;
244243
constexpr auto vlen = pocketfft::detail::VLEN<T>::val;
245244
if (vlen > 1 && n_outer >= vlen && nin >= npts_in && sf == 0) {
246245
std::vector<size_t> axes = { 1 };

0 commit comments

Comments
 (0)