Skip to content
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

BUG: some ufuncs return NULL without setting an error when stride >= 2**31 elements and SIMD optimizations enabled #20921

Closed
jmuhlich opened this issue Jan 27, 2022 · 1 comment · Fixed by #20955

Comments

@jmuhlich
Copy link

jmuhlich commented Jan 27, 2022

Describe the issue:

Since SIMD optimizations were introduced, some ufuncs such as max and min raise SystemError: <built-in method reduce of numpy.ufunc object at ...> returned NULL without setting an error if the inner loop stride is 2**31 elements or greater.

Reproduce the code example:

# Requires 2+ GB of RAM.
import numpy as np
a = np.zeros((2, 2**31), 'uint8')
a.max(axis=0)

Error message:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".../numpy/core/_methods.py", line 40, in _amax
    return umr_maximum(a, axis, None, out, keepdims, initial, where)
SystemError: <built-in method reduce of numpy.ufunc object at 0x7fd1c5787540> returned NULL without setting an error

NumPy/Python version information:

Tested on both x86_64 and arm64:

cp38-cp38-manylinux2014_x86_64
1.22.1 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0]

cp310-cp310-macosx_11_0_arm64
1.22.1 3.10.2 (v3.10.2:a58ebcc701, Jan 13 2022, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)]

@charris charris added this to the 1.22.3 milestone Jan 28, 2022
seberg added a commit to seberg/numpy that referenced this issue Jan 31, 2022
The return type should not be integer of course (why doesn't C warn
about this?).

Closes numpygh-20921
@seberg
Copy link
Member

seberg commented Jan 31, 2022

Thanks for the report. For the record, it was not related to SIMD, just a unfortunate integer type issue in a different refactor.

charris pushed a commit to charris/numpy that referenced this issue Feb 2, 2022
The return type should not be integer of course (why doesn't C warn
about this?).

Closes numpygh-20921
seberg added a commit to seberg/numpy that referenced this issue Apr 24, 2022
The return type should not be integer of course (why doesn't C warn
about this?).

Closes numpygh-20921
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants