Re: git: b0b4d9e1eae8 - main - */*: Switch to NumPy 2.x

From: Vladimir Druzenko <vvd_at_freebsd.org>
Date: Mon, 11 May 2026 19:59:59 UTC
11.05.2026 22:35, Daniel Engberg пишет:
> On 2026-05-11 21:19, Max Brazhnikov wrote:
>> On Mon, 11 May 2026 14:42:57 -0400 Charlie Li wrote:
>>> Vladimir Druzenko wrote:
>>>> 06.05.2026 21:14, Vladimir Druzenko пишет:
>>>>> 06.05.2026 20:29, Max Brazhnikov пишет:
>>>>>> On Wed, 6 May 2026 01:04:14 +0300 Vladimir Druzenko wrote:
>>>>>>> Hello!
>>>>>>>
>>>>>>> 05.05.2026 22:33, Max Brazhnikov пишет:
>>>>>>>> The branch main has been updated by makc:
>>>>>>>>
>>>>>>>> URL: https://cgit.FreeBSD.org/ports/commit/?
>>>>>>>> id=b0b4d9e1eae890d0de1591e20fb37358439a2ff6
>>>>>>>>
>>>>>>>> commit b0b4d9e1eae890d0de1591e20fb37358439a2ff6
>>>>>>>> Author:     Max Brazhnikov <makc@FreeBSD.org>
>>>>>>>> AuthorDate: 2026-05-05 19:27:15 +0000
>>>>>>>> Commit:     Max Brazhnikov <makc@FreeBSD.org>
>>>>>>>> CommitDate: 2026-05-05 19:29:37 +0000
>>>>>>>>
>>>>>>>>        */*: Switch to NumPy 2.x
>>>>>>>>              PR:             294328
>>>>>>>>        Exp-run:        antoine
>>>>>>>> ---
>>>>>>>>     archivers/py-bitshuffle/Makefile            | 4 ++--
>>>>>>>>     archivers/py-blosc2/Makefile                | 4 ++--
>>>>>>>>     astro/astrometry/Makefile                   | 4 ++--
>>>>>>> By default NumPy 2.x builds with X86_V2, configure log:
>>>>>>> CPU Optimization Options
>>>>>>>      baseline:
>>>>>>>        Requested : min+detect
>>>>>>>        Enabled   : X86_V2
>>>>>>>      dispatch:
>>>>>>>        Requested : max
>>>>>>>        Enabled   : X86_V3 X86_V4 AVX512_ICL
>>>>>>>
>>>>>>> So numpy-config fails with SIGILL.
>>>>>>> Valgrid prints:
>>>>>>> RuntimeError: NumPy was built with baseline optimizations:
>>>>>>> (X86_V2) but your machine doesn't support:
>>>>>>> (X86_V2).
>>>>>>>
>>>>>>> Patch:
>>>>>>> diff --git a/math/py-numpy/Makefile b/math/py-numpy/Makefile
>>>>>>> index 9500c87da243..961f1e03ff86 100644
>>>>>>> --- a/math/py-numpy/Makefile
>>>>>>> +++ b/math/py-numpy/Makefile
>>>>>>> @@ -1,6 +1,6 @@
>>>>>>>     PORTNAME=      numpy
>>>>>>>     DISTVERSION=   2.4.4
>>>>>>> -PORTREVISION=  2
>>>>>>> +PORTREVISION=  3
>>>>>>>     PORTEPOCH=     1
>>>>>>>     CATEGORIES=    math python
>>>>>>>     MASTER_SITES=  PYPI \
>>>>>>> @@ -24,7 +24,9 @@ TEST_DEPENDS=
>>>>>>> ${PYTHON_PKGNAMEPREFIX}hypothesis>=5.3.0:devel/py-hypothesis@${PY_
>>>>>>>     USES=          compiler:c++17-lang cpe fortran pkgconfig
>>>>>>> python:3.11+
>>>>>>> shebangfix
>>>>>>>     USE_PYTHON=    autoplist concurrent cython pep517 pytest
>>>>>>>
>>>>>>> -PEP517_BUILD_CONFIG_SETTING= -Csetup-args=-Dallow-noblas=false
>>>>>>> +PEP517_BUILD_CONFIG_SETTING= -Csetup-args=-Dallow-noblas=false \
>>>>>>> + -Csetup-args=-Dcpu-baseline="none" \
>>>>>>> +  -Csetup-args=-Dcpu-baseline-detect="disabled"
>>>>>> Defining only -Dcpu-baseline="none" should be enough. Could you 
>>>>>> check
>>>>>> whether
>>>>>> it resolves the problem for you?
>>>>>>
>>>>>> Max
>>>>> You are right, -Dcpu-baseline="none" is enough.
>>>>> The -Csetup-args=-Dcpu-baseline-detect="disabled" option causes -
>>>>> march=* to be ignored when baseline detection occurs (if the user
>>>>> added CPUTYPE=* to the make.conf).
>>>>> So in order to respect -march this option should not be added.
>>>> Hello!
>>>> Can I commit this change?
>>>>
>>> Not yet. Still needs some further evaluation.
>> -Dcpu-baseline="none" is safe to commit and should be committed if we 
>> claim support for older CPU.
>>
>> Cheers,
>> Max
> What's probably better to do is to define none only if CPUTYPE is not 
> defined (set) and otherwise omit -Dcpu-baseline as the default 
> cpu-baseline-detect setting should take care of it otherwise according 
> to https://numpy.org/devdocs/reference/simd/build-options.html
>
> Best regards,
> Daniel

Not quite right: min = X86_V2, and baseline-detect adds any additional 
instructions detected to min.
So it's "X86_V2+detect", not just "detect". For CPUs that don't support 
X86_V2, this results in a SIGILL.
Universal solution would be "none+detect".

-- 
Best regards,
Vladimir Druzenko