BUG: Correct ambiguous logic for s390x CPU feature detection#29697
BUG: Correct ambiguous logic for s390x CPU feature detection#29697charris merged 1 commit intonumpy:mainfrom Sanjaykumar030:main
s390x CPU feature detection#29697Conversation
s390x CPU feature detection
|
Hi @jorenham, This PR refines the s390x CPU feature detection by replacing ambiguous VXE and VXE2 regex patterns with precise word-boundary matches. All tests pass, and there are no changes to compiler flags or feature hierarchy. Could you please review when you have a moment? Thanks! |
|
Thanks @Sanjaykumar030 . |
|
I'm am curious about the change to lower case. Is the match independent of case? |
s390x CPU feature detections390x CPU feature detection
|
Thanks for the question, @charris. The new regex patterns are case-sensitive, chosen to align with the lowercase feature strings reported on s390x. This keeps the behavior consistent with the existing build logic and avoids any breaking changes. |
|
Just went through my emails, @ngoldbaum can you have a brief look at this? I don't know how this matching works, but given Joren's comment, it is unclear to me that the author does. |
|
Great if any other maintainer is double-checking for safety. For clarity, here’s a comparison of old vs new behavior: CPU info: vx CPU info: vxe CPU info: vxenabled |
This PR continues the work from #29678 to improve CPU feature detection in the Meson build system, specifically for the
s390xarchitecture.Problem:
The current detection for
VXEandVXE2is ambiguous:These ambiguities may cause NumPy to compile with unsupported CPU instructions, risking Illegal Instruction crashes or performance issues.
Solution:
This PR replaces the fragile patterns with precise regular expressions using word boundaries (
\b):VXE → '\\bvxe\\b'VXE2 → '\\bvxe2\\b'No changes are made to the feature hierarchy, compiler flags, or test code.