Repository navigation
ci: run lance-linalg's release tests on the runner's own CPU - #8844
Merged
Xuanwo merged 4 commits intoOct 23, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
The base sync leaves this patch unchanged. Reusing the x86-64-v2 release test binary adds optimized native correctness checks without recompilation while preserving the Nehalem fallback/SIGILL run.
The remaining risk is unchanged: GitHub does not guarantee an AVX-capable runner, so a green native run does not by itself prove that a SIMD arm executed. The existing feature report makes CPU support visible in the log; no further change is requested for this pull request.
Xuanwo
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
qemu-pre-haswellalready buildslance-linalg's lib tests in release mode. This adds one step that runs that same binary a second time, on the runner's own CPU instead of under qemu, by overriding the cargo runner toenvfor that step only. The build step and the new run move above the QEMU setup steps, and the job'sname:changes because it now does two things.Why: no PR job runs the dispatched SIMD kernels in an optimized build
The job emulates a Nehalem, and every runtime feature gate in
lance-linalgtests foravx,avx2,fma, or anavx512*feature. A Nehalem has none of them, soSIMD_SUPPORTresolves toNoneand every dispatch takes its fallback arm. That is correct for a SIGILL check, but no job a pull request runs executes the dispatched kernels in an optimized build: the jobs that run tests use theciprofile, which inheritsdev. The nightlycompat-sequencejob builds a release wheel and builds and searches an IVF_PQ index over float32 vectors, but it runs once a night, gates no pull request, and checks recall rather than comparing kernels against a reference.Running the binary that is already on disk closes that gap, and it closes it for free. What it catches is a kernel that computes a wrong result only under optimized code generation, which
lance-linalg's comparisons against the scalar reference flag. A memory error inside a kernel is not guaranteed to crash in either profile; that is what the sanitizer job in #8878 is for.Cost
Nothing beyond the test run itself. Measured locally: after
cargo test --release -p lance-linalg --lib --no-run, changing only the runner env var and running again reports every crateFreshand recompiles nothing. The runner override is not an input to cargo's build fingerprint. The job's existing 60 minute budget already covers a from-scratch release build.What the native run does not cover
Worth stating so the next reader does not assume more than is there.
The binary is built with the job's
RUSTFLAGS: "-C target-cpu=x86-64-v2", and envRUSTFLAGSreplaces the per-targetrustflagsin.cargo/config.tomlwholesale. So#[cfg(target_feature = "avx2")]code is compiled out of it, and only the runtime-dispatched kernels are reachable, since#[target_feature(enable = "avx2")]is additive per function. Both runs use default features, sofp16kernelsis off.Which dispatch tier the native run takes depends on the runner's CPU, and GitHub does not contract a CPU model.
test_x86_runtime_feature_reportwrites the detected features to stderr, so the job log records what actually happened rather than leaving it to be inferred.Why the new step sits before the QEMU build
A step runs only if the ones before it succeeded, and the QEMU steps include building QEMU 8.2.10 from source on a cache miss. With the build and the native run first, a QEMU failure cannot take the native signal down with it. Nothing in the QEMU setup is a prerequisite for the cargo build:
--no-runnever invokes the runner, andlance-linalg'sbuild.rsneeds only a C compiler.The move does not disturb the two ordering constraints in the job.
Swatinem/rust-cachestill precedes the first cargo invocation, andRestore QEMU 8.2.10still precedes both steps that read itscache-hitoutput.The rename, and the one line of Rust
The job id
qemu-pre-haswellis unchanged, so therust-cachekey, which is derived fromgithub.job, is unaffected. Only the display name changes.rust/lance-linalg/src/distance/dot_f16.rsreferred to the job by its display name, which the rename would have left pointing at a string that exists nowhere in the repository. It now names the job id, matching whatrust/lance-linalg/src/simd/i32.rsalready does.Test plan
An x86_64 run with
RUSTFLAGS="-C target-cpu=x86-64-v2"and the pass-through runner, the closest local equivalent of the native step, confirms three things at once: the v2 baseline builds,envworks as a cargo runner, andtest_x86_runtime_feature_reportis visible without--nocapture. The resulting step order was checked against both ordering constraints above. The AVX2 and AVX-512 arms were compiled but not executed locally, since the host is aarch64 and an x86_64 build under Rosetta reports neither feature; they first execute when this job runs on a real x86 runner.A gap this leaves open
No job runs
lance-linalgin an optimized profile with--features fp16kernels. Turning it on compiles C, which would cost a rebuild and undo the zero-cost property above, so it belongs in its own change.