Skip to content

Build wheels for a portable x86-64-v2 baseline; bump to 0.2.8 - #19

Merged
seanmacavaney merged 1 commit into
mainfrom
baseline-cpu
Oct 16, 2026
Merged

seanmacavaney merged 1 commit into
mainfrom
baseline-cpu

Conversation

@seanmacavaney

Copy link
Copy Markdown
Collaborator

Published wheels crash with SIGILL (illegal instruction) on CPUs without AVX-512. .cargo/config.toml sets -C target-cpu=native, so the wheels built by publish-to-pypi.yml are compiled for the GitHub runner's CPU, which supports AVX-512.

Checked with the published bmp 0.2.7 wheels on an AMD Threadripper PRO 3955WX (AVX2, no AVX-512): importing the extension crashes with exit code 132 on every Python from 3.9 to 3.15. Each _bmp*.so contains 900-2700 AVX-512 instructions. The 0.2.6 wheels did the same.

Change

  • publish-to-pypi.yml: before each Build wheels step (Linux, Windows, macOS), overwrite .cargo/config.toml with target-cpu=x86-64-v2 (SSE4.2, POPCNT), which essentially all x86-64 CPUs support.
  • .cargo/config.toml is unchanged, so local builds still use target-cpu=native.
  • Version bumped to 0.2.8 so this can be released.

Why x86-64-v2

The source has no explicit SIMD besides _mm_prefetch (baseline x86-64); all vector code is compiler autovectorization. On a synthetic workload (150k docs, 1500 queries, one AMD Zen 2 machine, Python 3.12) I measured:

target-cpu µs/query
native 3949
x86-64-v3 (AVX2) 3749
x86-64-v2 3775

So no measurable gain from the newer baselines there. It's one workload on one CPU; if you'd rather have AVX2 (x86-64-v3) as the floor, it's a one-word change in the workflow step.

Verification (Linux x86_64, Python 3.15)

I ran the exact run: command from the workflow step, then maturin build --release --manifest-path python/Cargo.toml. The wheel contains 0 AVX2 instructions, versus 6414 for a build with the unmodified config. In both cases an index-and-search run returns the same documents and scores as before. I did not run the publish workflow itself, or build on Windows or macOS.

🤖 Generated with Claude Code

.cargo/config.toml sets target-cpu=native, so CI-built wheels were compiled for
the GitHub runner's CPU, which has AVX-512. The published wheels then crash
with SIGILL on CPUs without it (verified: bmp 0.2.7 on an AVX2-only AMD CPU,
on every Python 3.9-3.15).

Keep native for local builds, and have the publish workflow overwrite the
config with target-cpu=x86-64-v2 before building each wheel.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@seanmacavaney
seanmacavaney merged commit 67ad8c6 into main Oct 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant