Skip to content

Support x86-64 microarchitecture levels in wheel variants - #22832

Merged
konstin merged 1 commit into
mainfrom
konsti/x86-64-variant-provider
Nov 4, 2026
Merged

konstin merged 1 commit into
mainfrom
konsti/x86-64-variant-provider

Conversation

@konstin

@konstin konstin commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Add an x86_64 wheel variant provider emitting a x86_64::level feature, with values v1, v2, v3, and v4, 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.

Interpreter cache Slowdown Relative slowdown
Miss 2.29 ± 0.78 ms 3.43% ± 1.19 percentage points
Hit 0.33 ± 0.29 ms 2.50% ± 2.14 percentage points

@konstin konstin changed the title Support the x86_64 wheel variant provider Support the x86_64 and aarch64 wheel variant providers Oct 22, 2026
@codspeed

codspeed Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 7 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 89 untouched benchmarks
⏩ 84 skipped benchmarks1


Comparing konsti/x86-64-variant-provider (df19608) with main (f5fde68)

Open in CodSpeed

Footnotes

  1. 84 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@konstin konstin changed the title Support the x86_64 and aarch64 wheel variant providers Support x86-64-v4 wheel variants Oct 22, 2026
@konstin
konstin force-pushed the konsti/x86-64-variant-provider branch from 9de7689 to 4984f1f Compare October 22, 2026 14:10
@konstin konstin changed the title Support x86-64-v4 wheel variants Support x86-64 microarchitecture levels in wheel variants Oct 22, 2026
Base automatically changed from konsti/nvidia-variant-provider to main October 22, 2026 22:14
@konstin
konstin marked this pull request as ready for review October 22, 2026 22:45
@konstin
konstin requested review from charliermarsh and zsol October 22, 2026 22:45
@konstin konstin added the preview Experimental behavior label Oct 22, 2026
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");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we need to support more than just level?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

@konstin
konstin force-pushed the konsti/x86-64-variant-provider branch from f0f1d3d to de8949c Compare October 23, 2026 11:14
@konstin
konstin force-pushed the konsti/x86-64-variant-provider branch from de8949c to 563c3e3 Compare October 23, 2026 11:43
@konstin
konstin force-pushed the konsti/x86-64-variant-provider branch from 947c398 to 84b3120 Compare October 26, 2026 23:12

This branch was previously deployed

1 inactive deployment
automations — df196083 Deployed Nov 3, 2026 by konstin via review / security review #53276
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Experimental behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

⌂ 换网址