Skip to content
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

gh-125022: add support for simple SIMD features detection #125011

Open
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

picnixz
Copy link
Contributor

@picnixz picnixz commented Oct 5, 2024

In #124951, there has been some initial discussion on improving the performances of base64 and possibly {bytearray,bytes,str}.translate using SIMD instructions.

More generally, if we want to use specific SIMD instructions, it'd be good if we at least know whether we can use them or not. This PR is a PoC, experimental and (hence the skip news).

Note that the detection is essentially based on what was done in the blake2 module (though the flags being detected are different in this case but we can always add all those that are needed). To prepare for a harder detection of AVX instructions support, I added all the flags that are known to CPUID and possibly relevant. Note that more work needs to be done for a production use, especially in autoconf I think.

Note

The detection of a wider large family of CPUs (here we just assume Intel for simplicity and because we don't want to be overcomplicated for now) is still an ongoing work.

cc @gpshead

@picnixz picnixz added skip issue skip news build The build process and cross-build labels Oct 5, 2024
Python/cpuinfo.c Outdated Show resolved Hide resolved
Python/cpuinfo.c Outdated Show resolved Hide resolved
Include/internal/pycore_cpuinfo.h Outdated Show resolved Hide resolved
Include/internal/pycore_cpuinfo.h Outdated Show resolved Hide resolved
Include/internal/pycore_cpuinfo.h Outdated Show resolved Hide resolved
Python/cpuinfo.c Show resolved Hide resolved
Python/cpuinfo.c Outdated Show resolved Hide resolved
Python/cpuinfo.c Outdated Show resolved Hide resolved
Python/cpuinfo.c Outdated Show resolved Hide resolved
@picnixz picnixz marked this pull request as ready for review October 6, 2024 09:49
@picnixz picnixz changed the title Add support for simple SIMD features detection in autoconf (PoC) gh-125022: add support for simple SIMD features detection (PoC) Oct 6, 2024
@picnixz picnixz removed the skip issue label Oct 6, 2024
@picnixz picnixz changed the title gh-125022: add support for simple SIMD features detection (PoC) gh-125022: add support for simple SIMD features detection Oct 7, 2024
@picnixz

This comment was marked as resolved.

@picnixz picnixz marked this pull request as draft October 8, 2024 11:05
@picnixz picnixz marked this pull request as ready for review October 11, 2024 16:51
Makefile.pre.in Outdated Show resolved Hide resolved
Include/internal/pycore_cpuinfo.h Show resolved Hide resolved
@rruuaanng
Copy link
Contributor

I think the updated flag declaration is really good. It’s just for improving readability and not for public exposure, which is awesome.

configure.ac Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review build The build process and cross-build skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants