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

GH-29021: Convert _simd.c to multi-phase init (PEP 489)#29025

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
AA-Turner wants to merge1 commit intonumpy:main
base:main
Choose a base branch
Loading
fromAA-Turner:multi-phase/simd

Conversation

AA-Turner
Copy link

@AA-TurnerAA-Turner commentedMay 21, 2025
edited
Loading

@AA-Turner
Copy link
Author

s390x - baseline(Z13) is a transient failure:E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/jammy-updates/main/binary-s390x/Packages.gz File has unexpected size (1313374 != 1313377). Mirror sync in progress? [IP: 185.125.190.39 80]

static struct PyModuleDef defs = {
.m_base = PyModuleDef_HEAD_INIT,
.m_name = "numpy._core._simd",
.m_size = 0,
Copy link
Member

Choose a reason for hiding this comment

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

This was -1, did it become 0 on purpose?

Copy link
Author

@AA-TurnerAA-TurnerMay 22, 2025
edited
Loading

Choose a reason for hiding this comment

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

A value of-1 indicates to Python that the module has global state (PyModuleDef.m_size). It forbids any use of subinterpreters, re-initialisation, etc.

Changing to 0 was perhaps a gamble, seeing if tests passed. To be more conservative though, we could keepm_size to-1 and defer changing it to a non-negative number to a future PR. What would you suggest?

A

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I think we should change it to 0 in a future PR. Please only change it in a single PR, lets get one of these in before the mass move of all the other ones. Does the change impact performance? I would suggest redoing this in#29030, or one of the others that touch a commonly used module, and then running the benchmarks to see if there is a regression when using multi-phase init.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I've updated#29030 to keepm_size = -1.

Is there infrastructure to benchmark a PR? My laptop isn't an ideal environment & I don't have a spare computer to run thelocal benchmarks.

Copy link
Author

@AA-TurnerAA-TurnerMay 22, 2025
edited
Loading

Choose a reason for hiding this comment

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

Fromhttps://github.com/numpy/numpy/actions/runs/15179012580/job/42684537494?pr=29030

m_size may not be negative for multi-phase initialization

I'll get the Python documentation updated, this isn't very obvious! In the meantime, I'll revert the change to#29030.

I believe0 is the correct value to keep, as there is currently no per-module state and hence nothing to allocate memory for.

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

@mattipmattipmattip left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@AA-Turner@mattip

[8]ページ先頭

©2009-2025 Movatter.jp