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

Prefer x86_64_v2 Python builds #8517

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

Prefer x86_64_v2 Python builds #8517

wants to merge 2 commits into from

Conversation

j178
Copy link
Contributor

@j178 j178 commented Oct 24, 2024

Summary

Resolves #8499

@j178 j178 marked this pull request as ready for review October 24, 2024 15:04
Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

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

Thank you!

return (flavor_priority, build_option_priority)
return (arch_priority, flavor_priority, build_option_priority)

def _arch_priority(self, arch: Arch) -> int:
Copy link
Member

Choose a reason for hiding this comment

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

Nit: This can be a method on Arch

@konstin konstin requested a review from zanieb October 24, 2024 16:12
@konstin
Copy link
Member

konstin commented Oct 24, 2024

I check that the versions uv uses all run on my machine.

CC @zanieb for the changes in the generator script.

@zanieb
Copy link
Member

zanieb commented Oct 24, 2024

Can we use these unconditionally? Don't we need to check if the system supports the v2 instruction set before selecting these distributions?

@konstin
Copy link
Member

konstin commented Oct 24, 2024

According to https://gregoryszorc.com/docs/python-build-standalone/main/running.html:

x86_64_v2-*

Targets 64-bit Intel/AMD CPUs approximately newer than Nehalem (released in 2008).
Binaries will have SSE3, SSE4, and other CPU instructions added after the ~initial x86-64 CPUs were launched in 2003.
Binaries will crash if you attempt to run them on an older CPU not supporting the newer instructions.

Requiring at least a cpu from 2008 is safe enough. I'd like to add cpu feature detection on top of that (e.g. avx2 for x86_64_v3), but this change in itself is a good idea.

@zanieb
Copy link
Member

zanieb commented Oct 24, 2024

I think we should probably retain the x86_64 downloads (so you can install them by key) then add and prefer the x86_64_v2 downloads by default. Removing access to the x86_64 downloads entirely doesn't make sense to me.

Also, this is a breaking change; although it may not be likely. We might want to roll it into 0.5.0.

@zanieb zanieb added the uv python Related to the uv python interface label Oct 24, 2024
@zanieb
Copy link
Member

zanieb commented Oct 24, 2024

I'm not particularly enthused about defaulting to the v2 builds without checking the CPU features, especially since we need to do so anyway in the future. But I feel less strongly about that as long as there's a path towards recovering the existing behavior.

@danielhollas
Copy link

Are there any benchmarks that show whether / how much CPython is faster with these extra instructions? Might by interesting to run the pyperformance test suite (which is what faster CPython team uses for benchmarking).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
uv python Related to the uv python interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use SSE builds for Python Build Standalone on linux
4 participants