Expand description
This library does a compile-time check that the target architecture supports either 128-bit NEON instructions (always available on aarch64), or 256-bit AVX2 instructions (must be explicitly enabled on x86-64).
In case the AVX2 feature is not enabled on x64, crates like wide and the
portable-simd feature will automatically fall back to scalar or 128-bit SIMD
instructions, which are less efficient than the intended 256-bit AVX2 instructions.
Thus, this crate ensures that compiled binaries actually use the intended fast-path.
This check is skipped in debug and documentation builds. In release builds,
it can be manually disabled by enabling the scalar feature,
in which case non-AVX2 fallbacks will be used.
The ensure_simd function can be used at the start of main() to do a
run-time check that the CPU that is running the binary actually supports
AVX2 instructions.
See the github readme for more details: https://github.com/ragnargrootkoerkamp/ensure_simd.
Functionsยง
- ensure_
simd - Do a run-time check that AVX2 SIMD instructions are available when compiled into the binary.