Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MNT: Update windows-2019 to windows-2022[wheel build]#28955

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
abhishek-iitmadras wants to merge1 commit intonumpy:main
base:main
Choose a base branch
Loading
fromabhishek-iitmadras:abhishek_window

Conversation

abhishek-iitmadras
Copy link
Contributor

@abhishek-iitmadrasabhishek-iitmadras commentedMay 14, 2025
edited
Loading

As per info in :actions/runner-images#12045
We need to change window runner.

rgommers reacted with thumbs up emoji
@abhishek-iitmadrasabhishek-iitmadras changed the titleUpdate windows-2019 to windows-latestMNT: Update windows-2019 to windows-latestMay 15, 2025
@charris
Copy link
Member

close/reopen

@charrischarris reopened thisMay 26, 2025
@charrischarris added this to the2.3.0 release milestoneMay 26, 2025
@charrischarris added the triage reviewIssue/PR to be discussed at the next triage meeting labelMay 26, 2025
@charris
Copy link
Member

Put a triage label on this, as the deadline is coming up and there are problems.

@charris
Copy link
Member

@h-vetinari Ping, because ISTR that you were involved last time we updated the windows version.

@charris
Copy link
Member

The failures seem to mostly come fromtest_unary_spurious_fpexception and accuracy in some ufuncs.

@charris
Copy link
Member

charris commentedMay 26, 2025
edited
Loading

The failures seem to mostly come from test_unary_spurious_fpexception and accuracy in some ufuncs.

  • Thetest_unary_spurious_fpexception seems to come from OpenBLAS
  • The accuracy failures are in the no blas builds.
abhishek-iitmadras reacted with eyes emoji

@h-vetinari
Copy link
Contributor

@h-vetinari Ping, because ISTR that you were involved last time we updated the windows version.

Thanks for the ping. The only place where this really becomes relevant is for linking tonpymath.lib. Anyone doing that will most likely need to update to VS2022.

Given that VS2019 is EOL for over a year, and that VS2022 is an ABI-compatible update, this should not be an undue burden. The timing matches well, I've just picked up theproposal to move to VS2022 in conda-forge again.

@mattip
Copy link
Member

The only place where this really becomes relevant is for linking tonpymath.lib

Isn't this snippet meant to make anpymath.lib that can be used by older linkers?

if cc.get_id()=='msvc'
# Disable voltbl section for vc142 to allow link using mingw-w64; see:
# https://github.com/matthew-brett/dll_investigation/issues/1#issuecomment-1100468171
# Needs to be added to static libraries that are shipped for reuse (i.e.,
# libnpymath and libnpyrandom)
if cc.has_argument('-d2VolatileMetadata-')
staticlib_cflags+='-d2VolatileMetadata-'
endif
endif

@mattip
Copy link
Member

The test_unary_spurious_fpexception seems to come from OpenBLAS

Maybe related to#29039 which updates OpenBLAS

@h-vetinari
Copy link
Contributor

Isn't this snippet meant to make anpymath.lib that can be used by older linkers?

Not AFAIU. That's about reusing/sharing the objects in the static library between MSVC and mingw, and thecomment from the upstream devs at the time was

Mixing static libraries or object files between mingw and msvc is not
supported, and not expected to work, in general. You might have been lucky
and your library might have been simple enough not to hit any problematic
case though.

The virality of the msvc toolset concerns being able to link to something built with VS2022 (which - at least on paper - then also requires VS2022)

@charris
Copy link
Member

Rather than latest, it would be better to explicitly use vs2022.

@charris
Copy link
Member

@seiko2plus Thetest_unary_spurious_fpexception are inufunc = <ufunc 'spacing'> forf andd. I see that test is already skipped fore. Should we just skip it forf andd as well? Is there something we should do for SIMD instead?

@rgommers
Copy link
Member

The only place where this really becomes relevant is for linking tonpymath.lib. Anyone doing that will most likely need to update to VS2022.

Agreed, which means we need to update to the 2022 image in SciPy first before merging this.

We should probably do that asap and then merge this and backport it to the 2.3.x branch. before releasing 2.3.0. Otherwise it'll become a potentially risky change in 2.3.1 or 2.3.2.

@abhishek-iitmadrasabhishek-iitmadras changed the titleMNT: Update windows-2019 to windows-latestMNT: Update windows-2019 to windows-2022May 31, 2025
@abhishek-iitmadras
Copy link
ContributorAuthor

Look like i need to skip spacing test for window

@charris
Copy link
Member

vs2022 changes:https://devblogs.microsoft.com/cppblog/the-fpcontract-flag-and-changes-to-fp-modes-in-vs2022/

abhishek-iitmadras reacted with thumbs up emoji

@abhishek-iitmadras
Copy link
ContributorAuthor

abhishek-iitmadras commentedJun 1, 2025
edited
Loading

vs2022 changes:https://devblogs.microsoft.com/cppblog/the-fpcontract-flag-and-changes-to-fp-modes-in-vs2022/

Windows Server 2019: Uses older MSVC that generates FMA contractions by default
Windows Server 2022: Uses VS2022's MSVC which does NOT generate FMA contractions by default

This change significantly affects floating-point precision, especially for transcendental functions

So we need to add the /fp:contract flag to MSVC builds.

@charris
Copy link
Member

Windows Server 2022: Uses VS2022's MSVC which does NOT generate FMA contractions by default

Note that meson shows FMA3 enabled, but evidently a flag is required for msvc in vs2022. I'm not clear on whether meson should handle that or not. Unfortunately, the/fp:contract flag is new. Maybe disable FMA3 if the flag is missing for recent msvc?@rgommers Thoughts?

@@ -119,7 +119,7 @@ jobs:

-name:Build and install
run:|
python -m pip install . -v -Ccompile-args="-j2" -Csetup-args="-Dallow-noblas=true"
python -m pip install . -v -Ccompile-args="-j2" -Csetup-args="-Dallow-noblas=true" -Csetup-args="-Dc_args=/fp:contract" -Csetup-args="-Dcpp_args=/fp:contract"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This would read better with a line continuation\ to break the line. Probably for the previous use as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This should be part of the meson flags when building SIMD code. I suggest moving it here:

FMA3.update(args: {'val':'/arch:AVX2','match': clear_arch})

abhishek-iitmadras and rgommers reacted with thumbs up emoji
if (ufunc == np.spacing and
platform.system() == 'Windows' and
any(np.isnan(d) if isinstance(d, (int, float)) else False for d in data)):
pytest.skip("spacing with NaN generates warnings on Windows/VS2022")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This seems overly precise given the rather broad skip the original author used and the FIXME. I'd just treatnp.spacing andnp.ceil separately.

@rgommers
Copy link
Member

Note that meson shows FMA3 enabled, but evidently a flag is required for msvc in vs2022. I'm not clear on whether meson should handle that or not. Unfortunately, the/fp:contract flag is new. Maybe disable FMA3 if the flag is missing for recent msvc?@rgommers Thoughts?

@seiko2plus knows more exactly where it goes, but I'm pretty it's in themeson_cpu/ machinery in this repo, not upstream. Or maybe in the top-levelmeson.build file right undersubdir('meson_cpu'). If we see FMA enabledand we see thatcc.get_id() == 'msvc', then add the/fp:contract flag to project-global C/C++ flags.

r-devulap reacted with thumbs up emoji

@abhishek-iitmadras
Copy link
ContributorAuthor

Can we run wheel builder CI on this patch?
I need to check wheel CI reactions on this patch.

@charris
Copy link
Member

charris commentedJun 2, 2025
edited
Loading

Can we run wheel builder CI on this patch?

Append[build wheel][wheel build] to the header line of the last commit.

@@ -119,7 +119,7 @@ jobs:

-name:Build and install
run:|
python -m pip install . -v -Ccompile-args="-j2" -Csetup-args="-Dallow-noblas=true"
python -m pip install . -v -Ccompile-args="-j2" -Csetup-args="-Dallow-noblas=true" -Csetup-args="-Dc_args=/fp:contract" -Csetup-args="-Dcpp_args=/fp:contract"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This should be part of the meson flags when building SIMD code. I suggest moving it here:

FMA3.update(args: {'val':'/arch:AVX2','match': clear_arch})

abhishek-iitmadras and rgommers reacted with thumbs up emoji
@abhishek-iitmadrasabhishek-iitmadras changed the titleMNT: Update windows-2019 to windows-2022MNT: Update windows-2019 to windows-2022[wheel build]Jun 2, 2025
@r-devulap
Copy link
Member

Note that /fp:contract is not supported MSVC < 19.14

abhishek-iitmadras reacted with thumbs up emoji

@rgommers
Copy link
Member

Note that /fp:contract is not supported MSVC < 19.14

Should be fine, since our minimum supported version is 19.20:

numpy/meson.build

Lines 30 to 33 inb353a18

elif cc.get_id()=='msvc'
ifnot cc.version().version_compare('>=19.20')
error('NumPy requires at least vc142 (default with Visual Studio 2019)'+ \
'when building with MSVC')

# Add compiler flags for 32-bit builds
if ("${{ matrix.buildplat[1] }}" -eq "win32") {
echo 'CIBW_CONFIG_SETTINGS=setup-args=-Dc_args="/fp:contract" setup-args=-Dcpp_args="/fp:contract"' >> $env:GITHUB_ENV
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The extra flags should not be required after updatingmeson_cpu.

abhishek-iitmadras reacted with thumbs up emoji
@charris
Copy link
Member

You need to do the update this way:

  FMA3.update(args: {'val': '/arch:AVX2', 'match': clear_arch})  FMA3.update(args: {'val': '/fp:contract'})
abhishek-iitmadras reacted with thumbs up emoji

@abhishek-iitmadras
Copy link
ContributorAuthor

abhishek-iitmadras commentedJun 2, 2025
edited
Loading

You need to do the update this way:

  FMA3.update(args: {'val': '/arch:AVX2', 'match': clear_arch})  FMA3.update(args: {'val': '/fp:contract'})

isn't it overriding the args for FMA3 ?Correct me if i am wrong

@abhishek-iitmadras
Copy link
ContributorAuthor

abhishek-iitmadras commentedJun 2, 2025
edited
Loading

Hi@charris@r-devulap

  1. Now floating-point contract flag for 32-bit MSVC builds only is added to meson build .
  2. Skip spacing tests with NaN on Windows MSVC (all dtypes) only.

Please have a review to this patch.
Thanks


# Add floating-point contract flag for 32-bit builds
# Fixes transcendental function accuracy on Windows Server 2022
if cpu_family=='x86'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This file is already undermeson_cpu/x86/meson.build, you don't need the if condition here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Don't we need the flag for 64-bit as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Don't we need the flag for 64-bit as well?

It doesn't seem required by us, but we probably do want it.

@charris
Copy link
Member

#29116 is working now. There is a bogus circleci failure that can be ignored. I'm curious if@r-devulap suggestion of putting the args in a list works.

@charris
Copy link
Member

The PyPy failure can be ignored.

@charrischarris removed the triage reviewIssue/PR to be discussed at the next triage meeting labelJun 2, 2025
@abhishek-iitmadrasabhishek-iitmadrasforce-pushed theabhishek_window branch 5 times, most recently from381fb87 to3a5335fCompareJune 3, 2025 10:14
Co-authored-by: Charles Harris <charlesr.harris@gmail.com>
@abhishek-iitmadras
Copy link
ContributorAuthor

@rgommers@charris@r-devulap
This patch seems ok, please have a review and merge.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@charrischarrischarris left review comments

@r-devulapr-devulapr-devulap requested changes

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Projects
None yet
Milestone
2.4.0 release
Development

Successfully merging this pull request may close these issues.

6 participants
@abhishek-iitmadras@charris@h-vetinari@mattip@rgommers@r-devulap

[8]ページ先頭

©2009-2025 Movatter.jp