Repository navigation
Support x86-64 microarchitecture levels in wheel variants - #22832
Conversation
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
9de7689 to
4984f1f
Compare
| const PROPERTIES: [SupportedVariantFeature; 0] = []; | ||
| #[cfg(target_arch = "x86_64")] | ||
| static PROPERTIES: LazyLock<[SupportedVariantFeature; 1]> = LazyLock::new(|| { | ||
| let name = VariantFeature::try_from("level".to_owned()).expect("valid feature name"); |
There was a problem hiding this comment.
do we need to support more than just level?
There was a problem hiding this comment.
Initially, we had the whole archspec as support. That's a huge scope that draws in a lot of complexity such as a database (json file) that maps different CPU types to their capabilities, pulling in a bunch of dependencies, code generation and/or dependencies, and binary size. You can see an archspec implementation here: https://github.com/archspec/archspec-rs, and more analysis about the binary size here: archspec/archspec-rs#26. I always have an old branch about how large the full feature level support would be if we implement it ourselves if you want to compare that.
I want start with this code and extend with more feature if people have concrete examples where they want to target they wheels more specific than let's say an x86_64_v2, x86_64_v3 and x86_64_v4 wheel.
f0f1d3d to
de8949c
Compare
de8949c to
563c3e3
Compare
947c398 to
84b3120
Compare
Add an x86_64 wheel variant provider emitting a
x86_64::levelfeature, with valuesv1,v2,v3, andv4, following the upstream provider at https://github.com/wheelnext/x86_64-variant-provider. The implementation is a minimal reimplementation of the archspec method.The CPU information is collected in Python: With transparent emulation, e.g. between arm64 and x86_64, uv may run on a different arch than the Python interpreter, but only the Python interpreter platform is relevant.
If the CPU level could not be determined, e.g. for cross-installs or because the interpreter is in a sandbox or emulation that doesn't allow access, we use v2 as baseline. Processors for the last 10 - 15 years all support v2.
There's expected an unexpected failures for platform detection. Expected failures (e.g. we can't read
/proc) are silent and fall back to v2, unless there unless there is a terminal wheel unavailable error. There is an upstack PR for that. Unexpected error for now warn (to gathter feedback), but will be promoted to errors for stable (i.e., no silent downgrades due to uv detection bugs).Benchmarks
Measured on x86-64 linux with Python 3.12.