@@ -198,10 +198,17 @@ pub const PREFERRED_I16_LANES: usize = 16;
198198// x86_64: re-export based on tier
199199// ============================================================================
200200
201- // Compile-time AVX-512 dispatch via target_feature.
202- // With target-cpu=x86-64-v4 (.cargo/config.toml), avx512f is enabled
203- // at compile time → all types use native __m512/__m512d/__m512i.
204- // The 256-bit types (F32x8, F64x4) also live in simd_avx512 (__m256).
201+ // Compile-time SIMD dispatch via target_feature. The cargo config
202+ // chosen at build (.cargo/config.toml = v3 default / config-avx512.toml
203+ // = v4 / config-native.toml = native) sets the `target_feature` flags
204+ // that select exactly one arm below.
205+ // * v3 / GitHub-CI default → `target_feature = "avx2"` only →
206+ // simd_avx2 backend (F32x16 = two-half (f32x8, f32x8), int wrappers
207+ // are scalar polyfills via the `avx2_int_type!` macro).
208+ // * v4 (or native on AVX-512 host) → `target_feature = "avx512f"` →
209+ // simd_avx512 backend with native __m512 / __m512d / __m512i.
210+ // * aarch64 → simd_neon backend.
211+ // * everything else (wasm32, riscv, etc.) → scalar fallback.
205212
206213// Note on the `nightly-simd` feature: it adds the `crate::simd_nightly`
207214// module (a portable-simd backend wrapping `core::simd`) but does NOT
@@ -272,6 +279,17 @@ pub use crate::simd_avx512::{f32_to_bf16_batch_rne, f32_to_bf16_scalar_rne};
272279#[ cfg( all( target_arch = "x86_64" , target_feature = "avx512bf16" ) ) ]
273280pub use crate :: simd_avx512:: { BF16x16 , BF16x8 } ;
274281
282+ // AVX2 baseline arm — selected by the `x86-64-v3` cargo default. The
283+ // predicate is `not(avx512f)` rather than `avx2 + not(avx512f)`: the
284+ // inner intrinsics in `simd_avx2.rs` use per-function `#[target_feature
285+ // (enable = "avx,avx2,fma")]` annotations, so the OPERATIONS gate
286+ // themselves at the symbol level even when the consumer build target
287+ // is x86-64 baseline. The struct-field types (`__m256` / `__m256i`)
288+ // are core::arch declarations and don't require AVX/AVX2 at the type
289+ // level — only execution does. Keeps GitHub CI green (it runs with
290+ // `RUSTFLAGS="-D warnings"` env, which overrides our v3 config.toml,
291+ // landing on x86-64 baseline → the previous tighter `avx2` predicate
292+ // left no matching arm).
275293#[ cfg( all( target_arch = "x86_64" , not( target_feature = "avx512f" ) ) ) ]
276294pub use crate :: simd_avx512:: { f32x8, f64x4, i16x16, i8x32, F32x8 , F64x4 , I16x16 , I8x32 } ;
277295
0 commit comments