Skip to content

Commit c779c5b

Browse files
authored
Merge pull request #134 from AdaWorldAPI/cursor/gate-avx512-tests-9e6d
fix(simd): gate simd_avx512 tests behind target_feature = avx512f
2 parents 3b1ef9d + 2dd9c4f commit c779c5b

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

AGENTS.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ This is a Rust library crate (ndarray fork with HPC extensions). No external ser
1818

1919
### Environment notes
2020

21-
- **Rust 1.94.0** is pinned via `rust-toolchain.toml`; rustup auto-selects it in `/workspace`.
22-
- **No AVX-512 hardware** in Cloud Agent VMs — SIMD kernel tests using `#[target_feature(enable = "avx512f")]` are compile-gated and will be skipped at runtime. This is expected behavior.
21+
- **Rust 1.94.1** is pinned via `rust-toolchain.toml`; rustup auto-selects it in `/workspace`.
22+
- **No AVX-512 hardware** in Cloud Agent VMs — all test modules in `src/simd_avx512.rs` are gated with `#[cfg(all(test, target_feature = "avx512f"))]` and compile away entirely on non-AVX-512 targets. This is intentional: raw AVX-512 intrinsic tests must never run on CI/Cloud (x86-64-v3). The `simd.rs` LazyLock polyfill dispatches to `simd_avx2.rs` on these machines.
2323
- **Feature gates**: `intel-mkl` and `openblas` are mutually exclusive and require system libraries not installed by default. The default build uses `native` (pure Rust SIMD) which needs no extra libs.
24-
- **Build time**: ~18s cold, <1s incremental. Tests (~1819) take ~70s.
24+
- **Build time**: ~18s cold, <1s incremental. Tests (~1776 on non-AVX-512) take ~70s.
2525
- The workspace has sub-crates under `crates/` and `ndarray-rand/`. Default members exclude `blas-tests` and `blas-mock-tests` (they activate the `blas` feature which needs cblas-sys linking).
2626
- `libssl-dev` is needed as a build dependency for some transitive crates.
27+
- **`cargo fmt`**: `rustfmt.toml` uses 13+ nightly-only options (`brace_style`, `imports_granularity`, etc.). Stable rustfmt ignores them and reports massive diffs. This is a known pre-existing issue — do not attempt to fix formatting drift without coordinating with the project owner.

src/simd_avx512.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,7 +2626,7 @@ unsafe fn convert_f32_to_bf16_avx512f_rne(input: &[f32], output: &mut [u16]) {
26262626
}
26272627
}
26282628

2629-
#[cfg(test)]
2629+
#[cfg(all(test, target_feature = "avx512f"))]
26302630
mod bf16_tests {
26312631
use super::*;
26322632

@@ -3259,7 +3259,7 @@ pub fn f32_to_f16_batch_ieee754_rne(input: &[f32], output: &mut [u16]) {
32593259
}
32603260
}
32613261

3262-
#[cfg(test)]
3262+
#[cfg(all(test, target_feature = "avx512f"))]
32633263
mod f16_tests {
32643264
use super::*;
32653265

@@ -3356,7 +3356,7 @@ mod f16_tests {
33563356
}
33573357
}
33583358

3359-
#[cfg(test)]
3359+
#[cfg(all(test, target_feature = "avx512f"))]
33603360
mod u8x64_rasterizer_tests {
33613361
use super::U8x64;
33623362

@@ -3483,7 +3483,7 @@ mod u8x64_rasterizer_tests {
34833483
}
34843484
}
34853485

3486-
#[cfg(test)]
3486+
#[cfg(all(test, target_feature = "avx512f"))]
34873487
mod tier3_tests {
34883488
use super::{U16x32, U8x64};
34893489

@@ -3614,7 +3614,7 @@ mod tier3_tests {
36143614
// whichever path the linker selected.
36153615
// ────────────────────────────────────────────────────────────────────────
36163616

3617-
#[cfg(test)]
3617+
#[cfg(all(test, target_feature = "avx512f"))]
36183618
mod int_simd_tests {
36193619
use crate::simd::{I16x16, I16x32, I8x32, I8x64};
36203620

0 commit comments

Comments
 (0)