Skip to content

ci: run lance-linalg's release tests on the runner's own CPU - #8844

Merged
Xuanwo merged 4 commits into
lance-format:mainfrom
LuciferYang:ci/linalg-native-release-run
Oct 23, 2026
Merged

Xuanwo merged 4 commits into
lance-format:mainfrom
LuciferYang:ci/linalg-native-release-run

Conversation

@LuciferYang

@LuciferYang LuciferYang commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

qemu-pre-haswell already builds lance-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 to env for that step only. The build step and the new run move above the QEMU setup steps, and the job's name: 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-linalg tests for avx, avx2, fma, or an avx512* feature. A Nehalem has none of them, so SIMD_SUPPORT resolves to None and 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 the ci profile, which inherits dev. The nightly compat-sequence job 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 crate Fresh and 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 env RUSTFLAGS replaces the per-target rustflags in .cargo/config.toml wholesale. 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, so fp16kernels is 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_report writes 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-run never invokes the runner, and lance-linalg's build.rs needs only a C compiler.

The move does not disturb the two ordering constraints in the job. Swatinem/rust-cache still precedes the first cargo invocation, and Restore QEMU 8.2.10 still precedes both steps that read its cache-hit output.

The rename, and the one line of Rust

The job id qemu-pre-haswell is unchanged, so the rust-cache key, which is derived from github.job, is unaffected. Only the display name changes.

rust/lance-linalg/src/distance/dot_f16.rs referred 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 what rust/lance-linalg/src/simd/i32.rs already 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, env works as a cargo runner, and test_x86_runtime_feature_report is 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-linalg in 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.

@github-actions github-actions Bot added A-index Vector index, linalg, tokenizer A-ci CI / build workflows ci Github Action or Test issues labels Aug 28, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Aug 28, 2026
@lance-gatekeeper lance-gatekeeper Bot removed K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Sep 15, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Sep 15, 2026
@lance-gatekeeper lance-gatekeeper Bot removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Oct 17, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Oct 17, 2026
@lance-gatekeeper lance-gatekeeper Bot removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Oct 23, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Gate recommendation: approve with a non-blocking risk.

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.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Oct 23, 2026
@Xuanwo
Xuanwo merged commit 8559302 into lance-format:main Oct 23, 2026
40 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ci CI / build workflows A-index Vector index, linalg, tokenizer ci Github Action or Test issues K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants