Skip to content

Commit e84ce62

Browse files
committed
fix: Dockerfile + CI default to x86-64-v3 (AVX2) for GitHub compatibility
- Dockerfile: ENV RUSTFLAGS="-C target-cpu=x86-64-v3" before build steps. Default Docker image now runs on AVX2+ hardware (GitHub CI, most servers). Dockerfile.avx512 still pins x86-64-v4 for production deployment. - ci.yaml: RUSTFLAGS "-D warnings" → "-D warnings -C target-cpu=x86-64-v3" so CI compiles with AVX2 enabled. Previously RUSTFLAGS overrode .cargo/config.toml entirely, compiling at baseline x86-64 (no AVX at all). The simd.rs polyfill detects AVX-512/AMX at runtime via LazyLock<Tier> regardless of compile target, so the AVX2 binary still dispatches to AVX-512 kernels on capable hardware. Compile-time v3 just means the AVX2 fallback paths are available when runtime detection fails. https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh
1 parent 1420f13 commit e84ce62

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414
CARGO_TERM_COLOR: always
1515
HOST: x86_64-unknown-linux-gnu
1616
FEATURES: "approx,serde,rayon"
17-
RUSTFLAGS: "-D warnings"
17+
RUSTFLAGS: "-D warnings -C target-cpu=x86-64-v3"
1818
MSRV: 1.64.0
1919
BLAS_MSRV: 1.71.1
2020

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ COPY crates/ crates/
3131
COPY src/ src/
3232
COPY ndarray-rand/src/ ndarray-rand/src/
3333

34+
# Default target: x86-64-v3 (AVX2) — runs on GitHub CI and most servers.
35+
# Use Dockerfile.avx512 for x86-64-v4 (AVX-512). ndarray's simd.rs polyfill
36+
# detects AVX-512 at runtime via LazyLock<Tier> even when compiled for v3;
37+
# compile-time v3 just means the scalar/AVX2 fallback paths are used when the
38+
# runtime check fails. Both paths produce identical results.
39+
ENV RUSTFLAGS="-C target-cpu=x86-64-v3"
40+
3441
# Build default features
3542
RUN cargo build --release 2>&1 && echo "=== DEFAULT BUILD OK ==="
3643

0 commit comments

Comments
 (0)