8000 build-time popcnt test completes successfully when it should fail · Issue #19067 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

build-time popcnt test completes successfully when it should fail #19067

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

Closed
cmichal2 opened this issue May 22, 2021 · 1 comment · Fixed by #19071
Closed

build-time popcnt test completes successfully when it should fail #19067

cmichal2 opened this issue May 22, 2021 · 1 comment · Fixed by #19071
Labels
00 - Bug 36 - Build Build related PR component: numpy.distutils component: SIMD Issues in SIMD (fast instruction sets) code or machinery

Comments

@cmichal2
Copy link
Contributor

Building numpy 1.20 with gcc-9.2 or 10.2 on cpus that don't support the popcnt instruction produces code that fails at run time when numpy is imported. The issue appears to be that the test to see if popcnt functions, in cpu_popcnt.c, succeeds even when it should fail. The code that's there, when compiled with -S (with or without optimization) produces no popcnt instructions in its output. Probably this could be fixed by executing popcnt on a value that is not known at compile time - perhaps a random number, or a pid?

Another alternative might be to use a similar test at compile time as is used at run-time, where it appears that a cpu register is checked to see if popcnt is available.

More details at https://bugs.gentoo.org/788184

@seiko2plus seiko2plus added 00 - Bug 36 - Build Build related PR component: numpy.distutils component: SIMD Issues in SIMD (fast instruction sets) code or machinery labels May 23, 2021
@seiko2plus
Copy link
Member

Thank you for your report. According to the build log, this bug can be triggered when option native is provided via build arg --cpu-baseline or through passing GCC flag -march=native via the environment variable CFLAGS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug 36 - Build Build related PR component: numpy.distutils component: SIMD Issues in SIMD (fast instruction sets) code or machinery
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0