Skip to content

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
Contributor

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).

@notatallshaw-gts
Copy link

Is there a way to manually set uv to prefer v2 or v3 builds?

And then this could be documented as a non-default performance enhancement.

@charliermarsh
Copy link
Member

charliermarsh commented Dec 4, 2024

I might finish this up, it looks straightforward to detect this with https://doc.rust-lang.org/std/macro.is_x86_feature_detected.html.

@charliermarsh
Copy link
Member

(I didn't mean to close it, accidental click.)

@zanieb
Copy link
Member

zanieb commented Dec 10, 2024

Taking this up in #9781

@zanieb zanieb closed this Dec 10, 2024
zanieb added a commit that referenced this pull request Dec 10, 2024
…tion sets (#9781)

Supersedes #8517 with an alternative
approach of making all the variants available instead of replacing the
x86_64 (v1) variant with x86_64_v2.

Doesn't add automatic inference of the supported instructions, but that
should be doable per @charliermarsh's comment there. Going to do it as a
follow-up since this has been pretty time consuming.

e.g.,

```
❯ cargo run -q -- python install cpython-3.12.8-linux-x86_64_v3-gnu
Installed Python 3.12.8 in 2.72s
 + cpython-3.12.8-linux-x86_64_v3-gnu
```

Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
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

6 participants