Skip to content

Commit 59bb1ea

Browse files
committed
Fix SIGILL in CI: pin Mojo target to x86-64-v3 (AVX2)
The codspeed benchmark runner crashed with exit code 132 (SIGILL) because `mojo build --emit object` defaults to the native CPU, which may emit AVX-512 or other instructions the CI runner doesn't support. Adds MOJO_MCPU env var (defaults to "native") that build.rs passes as `--mcpu` to the Mojo compiler. CI sets it to "x86-64-v3" (AVX2 baseline) to match the existing RUSTFLAGS="-C target-feature=+avx2". Signed-off-by: Claude <noreply@anthropic.com> https://claude.ai/code/session_01EVcJZP4ZmfvWRRg2CsgvST
1 parent 6bfda92 commit 59bb1ea

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ jobs:
751751
- name: Build benchmarks
752752
env:
753753
RUSTFLAGS: "-C target-feature=+avx2"
754+
MOJO_MCPU: "x86-64-v3"
754755
run: cargo codspeed build ${{ matrix.features }} $(printf -- '-p %s ' ${{ matrix.packages }}) --profile bench
755756
- name: Run benchmarks
756757
uses: CodSpeedHQ/action@d872884a306dd4853acf0f584f4b706cf0cc72a2

vortex-array/build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,18 @@ fn main() {
3434
let obj_path = out_dir.join("vortex_mojo_take.o");
3535

3636
// AOT compile the Mojo kernel to a native object file.
37+
//
38+
// Use MOJO_MCPU to override the target CPU (defaults to "native"). In CI the runner
39+
// CPU may differ from the build host, so we allow pinning to a baseline like
40+
// "x86-64-v3" (AVX2) to avoid emitting unsupported instructions (e.g. AVX-512).
41+
let mcpu = env::var("MOJO_MCPU").unwrap_or_else(|_| "native".to_owned());
42+
3743
let status = Command::new(&mojo_bin)
3844
.arg("build")
3945
.arg("--emit")
4046
.arg("object")
47+
.arg("--mcpu")
48+
.arg(&mcpu)
4149
.arg("-o")
4250
.arg(&obj_path)
4351
.arg(&kernel_src)

vortex-array/src/arrays/filter/execute/slice.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//! Provides both immutable and mutable (in-place) filtering of typed slices by various mask
77
//! representations: indices and ranges (slices).
88
9-
use std::mem::size_of;
109
use std::ptr;
1110

1211
use vortex_buffer::Buffer;
@@ -50,11 +49,11 @@ fn filter_slice_by_indices<T: Copy>(slice: &[T], indices: &[usize]) -> Buffer<T>
5049

5150
#[cfg(vortex_mojo)]
5251
mod mojo {
52+
use std::mem::size_of;
53+
5354
use vortex_buffer::Buffer;
5455
use vortex_buffer::BufferMut;
5556

56-
use super::size_of;
57-
5857
unsafe extern "C" {
5958
fn vortex_filter_1byte(src: usize, idx: usize, dst: usize, n: usize);
6059
fn vortex_filter_2byte(src: usize, idx: usize, dst: usize, n: usize);

0 commit comments

Comments
 (0)