diff --git a/rust/lance-linalg/src/simd.rs b/rust/lance-linalg/src/simd.rs index 23298694f75..7b4e2c72e7f 100644 --- a/rust/lance-linalg/src/simd.rs +++ b/rust/lance-linalg/src/simd.rs @@ -58,6 +58,20 @@ pub trait SIMD: /// Load unaligned data from memory. /// /// # Safety + /// + /// `ptr` must be valid for reads of `N` elements of `T`. + /// + /// Most implementations also require a target feature that the build's + /// baseline may not provide, and none of them check for it at runtime: + /// + /// - `f32x8`, `f32x16`, `f64x4`, `f64x8` and `i32x8` need AVX on x86_64 and + /// LASX on loongarch64; + /// - `u8x16` needs nothing beyond the baseline on any target. + /// + /// Calling one without its feature is undefined behaviour rather than a + /// wrong answer, so either build with the feature enabled, as + /// `.cargo/config.toml` does for `x86_64-unknown-linux-gnu`, or check with + /// `is_x86_feature_detected!` first. See #8872. unsafe fn load_unaligned(ptr: *const T) -> Self; /// Store the values to aligned memory.